Release 4.92.3 CVE-2019-16928
[exim-website.git] / docbook / 4.92.3 / 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 29 Sep 2019
17 </date>
18 <author><firstname>Exim</firstname><surname>Maintainers</surname></author>
19 <authorinitials>EM</authorinitials>
20 <revhistory><revision>
21 <revnumber>4.92.3</revnumber>
22 <date>29 Sep 2019</date>
23   <authorinitials>EM</authorinitials>
24 </revision></revhistory>
25 <copyright><year>
26 2018
27            </year><holder>University of Cambridge</holder></copyright>
28 </bookinfo>
29 <chapter id="CHID1">
30 <title>Introduction</title>
31
32 <indexterm role="variable">
33   <primary>$1, $2, etc.</primary>
34   <see><emphasis>numerical variables</emphasis></see>
35 </indexterm>
36 <indexterm role="concept">
37   <primary>address</primary>
38   <secondary>rewriting</secondary>
39   <see><emphasis>rewriting</emphasis></see>
40 </indexterm>
41 <indexterm role="concept">
42   <primary>Bounce Address Tag Validation</primary>
43   <see><emphasis>BATV</emphasis></see>
44 </indexterm>
45 <indexterm role="concept">
46   <primary>Client SMTP Authorization</primary>
47   <see><emphasis>CSA</emphasis></see>
48 </indexterm>
49 <indexterm role="concept">
50   <primary>CR character</primary>
51   <see><emphasis>carriage return</emphasis></see>
52 </indexterm>
53 <indexterm role="concept">
54   <primary>CRL</primary>
55   <see><emphasis>certificate revocation list</emphasis></see>
56 </indexterm>
57 <indexterm role="concept">
58   <primary>delivery</primary>
59   <secondary>failure report</secondary>
60   <see><emphasis>bounce message</emphasis></see>
61 </indexterm>
62 <indexterm role="concept">
63   <primary>dialup</primary>
64   <see><emphasis>intermittently connected hosts</emphasis></see>
65 </indexterm>
66 <indexterm role="concept">
67   <primary>exiscan</primary>
68   <see><emphasis>content scanning</emphasis></see>
69 </indexterm>
70 <indexterm role="concept">
71   <primary>failover</primary>
72   <see><emphasis>fallback</emphasis></see>
73 </indexterm>
74 <indexterm role="concept">
75   <primary>fallover</primary>
76   <see><emphasis>fallback</emphasis></see>
77 </indexterm>
78 <indexterm role="concept">
79   <primary>filter</primary>
80   <secondary>Sieve</secondary>
81   <see><emphasis>Sieve filter</emphasis></see>
82 </indexterm>
83 <indexterm role="concept">
84   <primary>ident</primary>
85   <see><emphasis>RFC 1413</emphasis></see>
86 </indexterm>
87 <indexterm role="concept">
88   <primary>LF character</primary>
89   <see><emphasis>linefeed</emphasis></see>
90 </indexterm>
91 <indexterm role="concept">
92   <primary>maximum</primary>
93   <seealso><emphasis>limit</emphasis></seealso>
94 </indexterm>
95 <indexterm role="concept">
96   <primary>monitor</primary>
97   <see><emphasis>Exim monitor</emphasis></see>
98 </indexterm>
99 <indexterm role="concept">
100   <primary>no_<emphasis>xxx</emphasis></primary>
101   <see>entry for xxx</see>
102 </indexterm>
103 <indexterm role="concept">
104   <primary>NUL</primary>
105   <see><emphasis>binary zero</emphasis></see>
106 </indexterm>
107 <indexterm role="concept">
108   <primary>passwd file</primary>
109   <see><emphasis>/etc/passwd</emphasis></see>
110 </indexterm>
111 <indexterm role="concept">
112   <primary>process id</primary>
113   <see><emphasis>pid</emphasis></see>
114 </indexterm>
115 <indexterm role="concept">
116   <primary>RBL</primary>
117   <see><emphasis>DNS list</emphasis></see>
118 </indexterm>
119 <indexterm role="concept">
120   <primary>redirection</primary>
121   <see><emphasis>address redirection</emphasis></see>
122 </indexterm>
123 <indexterm role="concept">
124   <primary>return path</primary>
125   <seealso><emphasis>envelope sender</emphasis></seealso>
126 </indexterm>
127 <indexterm role="concept">
128   <primary>scanning</primary>
129   <see><emphasis>content scanning</emphasis></see>
130 </indexterm>
131 <indexterm role="concept">
132   <primary>SSL</primary>
133   <see><emphasis>TLS</emphasis></see>
134 </indexterm>
135 <indexterm role="concept">
136   <primary>string</primary>
137   <secondary>expansion</secondary>
138   <see><emphasis>expansion</emphasis></see>
139 </indexterm>
140 <indexterm role="concept">
141   <primary>top bit</primary>
142   <see><emphasis>8-bit characters</emphasis></see>
143 </indexterm>
144 <indexterm role="concept">
145   <primary>variables</primary>
146   <see><emphasis>expansion, variables</emphasis></see>
147 </indexterm>
148 <indexterm role="concept">
149   <primary>zero, binary</primary>
150   <see><emphasis>binary zero</emphasis></see>
151 </indexterm>
152
153 <para>
154 Exim is a mail transfer agent (MTA) for hosts that are running Unix or
155 Unix-like operating systems. It was designed on the assumption that it would be
156 run on hosts that are permanently connected to the Internet. However, it can be
157 used on intermittently connected hosts with suitable configuration adjustments.
158 </para>
159 <para>
160 Configuration files currently exist for the following operating systems: AIX,
161 BSD/OS (aka BSDI), Darwin (Mac OS X), DGUX, Dragonfly, FreeBSD, GNU/Hurd,
162 GNU/Linux, HI-OSF (Hitachi), HI-UX, HP-UX, IRIX, MIPS RISCOS, NetBSD, OpenBSD,
163 OpenUNIX, QNX, SCO, SCO SVR4.2 (aka UNIX-SV), Solaris (aka SunOS5), SunOS4,
164 Tru64-Unix (formerly Digital UNIX, formerly DEC-OSF1), Ultrix, and UnixWare.
165 Some of these operating systems are no longer current and cannot easily be
166 tested, so the configuration files may no longer work in practice.
167 </para>
168 <para>
169 There are also configuration files for compiling Exim in the Cygwin environment
170 that can be installed on systems running Windows. However, this document does
171 not contain any information about running Exim in the Cygwin environment.
172 </para>
173 <para>
174 The terms and conditions for the use and distribution of Exim are contained in
175 the file <filename>NOTICE</filename>. Exim is distributed under the terms of the GNU General
176 Public Licence, a copy of which may be found in the file <filename>LICENCE</filename>.
177 </para>
178 <para>
179 The use, supply, or promotion of Exim for the purpose of sending bulk,
180 unsolicited electronic mail is incompatible with the basic aims of Exim,
181 which revolve around the free provision of a service that enhances the quality
182 of personal communications. The author of Exim regards indiscriminate
183 mass-mailing as an antisocial, irresponsible abuse of the Internet.
184 </para>
185 <para>
186 Exim owes a great deal to Smail 3 and its author, Ron Karr. Without the
187 experience of running and working on the Smail 3 code, I could never have
188 contemplated starting to write a new MTA. Many of the ideas and user interfaces
189 were originally taken from Smail 3, though the actual code of Exim is entirely
190 new, and has developed far beyond the initial concept.
191 </para>
192 <para>
193 Many people, both in Cambridge and around the world, have contributed to the
194 development and the testing of Exim, and to porting it to various operating
195 systems. I am grateful to them all. The distribution now contains a file called
196 <filename>ACKNOWLEDGMENTS</filename>, in which I have started recording the names of
197 contributors.
198 </para>
199 <section id="SECID1">
200 <title>Exim documentation</title>
201 <para revisionflag="changed">
202 <indexterm role="concept">
203 <primary>documentation</primary>
204 </indexterm>
205 This edition of the Exim specification applies to version 4.92.3 of Exim.
206 Substantive changes from the 4.91 edition are marked in some
207 renditions of this document; this paragraph is so marked if the rendition is
208 capable of showing a change indicator.
209 </para>
210 <para>
211 This document is very much a reference manual; it is not a tutorial. The reader
212 is expected to have some familiarity with the SMTP mail transfer protocol and
213 with general Unix system administration. Although there are some discussions
214 and examples in places, the information is mostly organized in a way that makes
215 it easy to look up, rather than in a natural order for sequential reading.
216 Furthermore, this manual aims to cover every aspect of Exim in detail, including
217 a number of rarely-used, special-purpose features that are unlikely to be of
218 very wide interest.
219 </para>
220 <para>
221 <indexterm role="concept">
222 <primary>books about Exim</primary>
223 </indexterm>
224 An <quote>easier</quote> discussion of Exim which provides more in-depth explanatory,
225 introductory, and tutorial material can be found in a book entitled <emphasis>The Exim
226 SMTP Mail Server</emphasis> (second edition, 2007), published by UIT Cambridge
227 (<emphasis role="bold"><ulink url="https://www.uit.co.uk/exim-book/">https://www.uit.co.uk/exim-book/</ulink></emphasis>).
228 </para>
229 <para>
230 The book also contains a chapter that gives a general introduction to SMTP and
231 Internet mail. Inevitably, however, the book is unlikely to be fully up-to-date
232 with the latest release of Exim. (Note that the earlier book about Exim,
233 published by O&#x2019;Reilly, covers Exim 3, and many things have changed in Exim 4.)
234 </para>
235 <para>
236 <indexterm role="concept">
237 <primary>Debian</primary>
238 <secondary>information sources</secondary>
239 </indexterm>
240 If you are using a Debian distribution of Exim, you will find information about
241 Debian-specific features in the file
242 <filename>/usr/share/doc/exim4-base/README.Debian</filename>.
243 The command <command>man update-exim.conf</command> is another source of Debian-specific
244 information.
245 </para>
246 <para>
247 <indexterm role="concept">
248 <primary><filename>doc/NewStuff</filename></primary>
249 </indexterm>
250 <indexterm role="concept">
251 <primary><filename>doc/ChangeLog</filename></primary>
252 </indexterm>
253 <indexterm role="concept">
254 <primary>change log</primary>
255 </indexterm>
256 As Exim develops, there may be features in newer versions that have not
257 yet made it into this document, which is updated only when the most significant
258 digit of the fractional part of the version number changes. Specifications of
259 new features that are not yet in this manual are placed in the file
260 <filename>doc/NewStuff</filename> in the Exim distribution.
261 </para>
262 <para>
263 Some features may be classified as <quote>experimental</quote>. These may change
264 incompatibly while they are developing, or even be withdrawn. For this reason,
265 they are not documented in this manual. Information about experimental features
266 can be found in the file <filename>doc/experimental.txt</filename>.
267 </para>
268 <para>
269 All changes to Exim (whether new features, bug fixes, or other kinds of
270 change) are noted briefly in the file called <filename>doc/ChangeLog</filename>.
271 </para>
272 <para>
273 <indexterm role="concept">
274 <primary><filename>doc/spec.txt</filename></primary>
275 </indexterm>
276 This specification itself is available as an ASCII file in <filename>doc/spec.txt</filename> so
277 that it can easily be searched with a text editor. Other files in the <filename>doc</filename>
278 directory are:
279 </para>
280 <informaltable frame="none">
281 <tgroup cols="2" colsep="0" rowsep="0">
282 <colspec colwidth="100pt" align="left"/>
283 <colspec colwidth="254pt" align="left"/>
284 <tbody>
285 <row>
286 <entry><filename>OptionLists.txt</filename></entry>
287 <entry>list of all options in alphabetical order</entry>
288 </row>
289 <row>
290 <entry><filename>dbm.discuss.txt</filename></entry>
291 <entry>discussion about DBM libraries</entry>
292 </row>
293 <row>
294 <entry><filename>exim.8</filename></entry>
295 <entry>a man page of Exim&#x2019;s command line options</entry>
296 </row>
297 <row>
298 <entry><filename>experimental.txt</filename></entry>
299 <entry>documentation of experimental features</entry>
300 </row>
301 <row>
302 <entry><filename>filter.txt</filename></entry>
303 <entry>specification of the filter language</entry>
304 </row>
305 <row>
306 <entry><filename>Exim3.upgrade</filename></entry>
307 <entry>upgrade notes from release 2 to release 3</entry>
308 </row>
309 <row>
310 <entry><filename>Exim4.upgrade</filename></entry>
311 <entry>upgrade notes from release 3 to release 4</entry>
312 </row>
313 <row>
314 <entry><filename>openssl.txt</filename></entry>
315 <entry>installing a current OpenSSL release</entry>
316 </row>
317 </tbody>
318 </tgroup>
319 </informaltable>
320 <para>
321 The main specification and the specification of the filtering language are also
322 available in other formats (HTML, PostScript, PDF, and Texinfo). Section
323 <xref linkend="SECTavail"/> below tells you how to get hold of these.
324 </para>
325 </section>
326 <section id="SECID2">
327 <title>FTP site and websites</title>
328 <para>
329 <indexterm role="concept">
330 <primary>website</primary>
331 </indexterm>
332 <indexterm role="concept">
333 <primary>FTP site</primary>
334 </indexterm>
335 The primary site for Exim source distributions is the <option>exim.org</option> FTP site,
336 available over HTTPS, HTTP and FTP.  These services, and the <option>exim.org</option>
337 website, are hosted at the University of Cambridge.
338 </para>
339 <para>
340 <indexterm role="concept">
341 <primary>wiki</primary>
342 </indexterm>
343 <indexterm role="concept">
344 <primary>FAQ</primary>
345 </indexterm>
346 As well as Exim distribution tar files, the Exim website contains a number of
347 differently formatted versions of the documentation. A recent addition to the
348 online information is the Exim wiki (<emphasis role="bold"><ulink url="https://wiki.exim.org">https://wiki.exim.org</ulink></emphasis>),
349 which contains what used to be a separate FAQ, as well as various other
350 examples, tips, and know-how that have been contributed by Exim users.
351 The wiki site should always redirect to the correct place, which is currently
352 provided by GitHub, and is open to editing by anyone with a GitHub account.
353 </para>
354 <para>
355 <indexterm role="concept">
356 <primary>Bugzilla</primary>
357 </indexterm>
358 An Exim Bugzilla exists at <emphasis role="bold"><ulink url="https://bugs.exim.org">https://bugs.exim.org</ulink></emphasis>. You can use
359 this to report bugs, and also to add items to the wish list. Please search
360 first to check that you are not duplicating a previous entry.
361 Please do not ask for configuration help in the bug-tracker.
362 </para>
363 </section>
364 <section id="SECID3">
365 <title>Mailing lists</title>
366 <para>
367 <indexterm role="concept">
368 <primary>mailing lists</primary>
369 <secondary>for Exim users</secondary>
370 </indexterm>
371 The following Exim mailing lists exist:
372 </para>
373 <informaltable frame="none">
374 <tgroup cols="2" colsep="0" rowsep="0">
375 <colspec colwidth="140pt" align="left"/>
376 <colspec colwidth="254pt" align="left"/>
377 <tbody>
378 <row>
379 <entry><emphasis>exim-announce@exim.org</emphasis></entry>
380 <entry>Moderated, low volume announcements list</entry>
381 </row>
382 <row>
383 <entry><emphasis>exim-users@exim.org</emphasis></entry>
384 <entry>General discussion list</entry>
385 </row>
386 <row>
387 <entry><emphasis>exim-dev@exim.org</emphasis></entry>
388 <entry>Discussion of bugs, enhancements, etc.</entry>
389 </row>
390 <row>
391 <entry><emphasis>exim-cvs@exim.org</emphasis></entry>
392 <entry>Automated commit messages from the VCS</entry>
393 </row>
394 </tbody>
395 </tgroup>
396 </informaltable>
397 <para>
398 You can subscribe to these lists, change your existing subscriptions, and view
399 or search the archives via the mailing lists link on the Exim home page.
400 <indexterm role="concept">
401 <primary>Debian</primary>
402 <secondary>mailing list for</secondary>
403 </indexterm>
404 If you are using a Debian distribution of Exim, you may wish to subscribe to
405 the Debian-specific mailing list <emphasis>pkg-exim4-users@lists.alioth.debian.org</emphasis>
406 via this web page:
407 </para>
408 <literallayout>
409 <emphasis role="bold"><ulink url="https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/pkg-exim4-users">https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/pkg-exim4-users</ulink></emphasis>
410 </literallayout>
411 <para>
412 Please ask Debian-specific questions on that list and not on the general Exim
413 lists.
414 </para>
415 </section>
416 <section id="SECID5">
417 <title>Bug reports</title>
418 <para>
419 <indexterm role="concept">
420 <primary>bug reports</primary>
421 </indexterm>
422 <indexterm role="concept">
423 <primary>reporting bugs</primary>
424 </indexterm>
425 Reports of obvious bugs can be emailed to <emphasis>bugs@exim.org</emphasis> or reported
426 via the Bugzilla (<emphasis role="bold"><ulink url="https://bugs.exim.org">https://bugs.exim.org</ulink></emphasis>). However, if you are unsure
427 whether some behaviour is a bug or not, the best thing to do is to post a
428 message to the <emphasis>exim-dev</emphasis> mailing list and have it discussed.
429 </para>
430 </section>
431 <section id="SECTavail">
432 <title>Where to find the Exim distribution</title>
433 <para>
434 <indexterm role="concept">
435 <primary>FTP site</primary>
436 </indexterm>
437 <indexterm role="concept">
438 <primary>HTTPS download site</primary>
439 </indexterm>
440 <indexterm role="concept">
441 <primary>distribution</primary>
442 <secondary>FTP site</secondary>
443 </indexterm>
444 <indexterm role="concept">
445 <primary>distribution</primary>
446 <secondary>https site</secondary>
447 </indexterm>
448 The master distribution site for the Exim distribution is
449 </para>
450 <literallayout>
451 <emphasis role="bold"><ulink url="https://downloads.exim.org/">https://downloads.exim.org/</ulink></emphasis>
452 </literallayout>
453 <para>
454 The service is available over HTTPS, HTTP and FTP.
455 We encourage people to migrate to HTTPS.
456 </para>
457 <para>
458 The content served at <emphasis role="bold"><ulink url="https://downloads.exim.org/">https://downloads.exim.org/</ulink></emphasis> is identical to the
459 content served at <emphasis role="bold"><ulink url="https://ftp.exim.org/pub/exim">https://ftp.exim.org/pub/exim</ulink></emphasis> and
460 <emphasis role="bold"><ulink url="ftp://ftp.exim.org/pub/exim">ftp://ftp.exim.org/pub/exim</ulink></emphasis>.
461 </para>
462 <para>
463 If accessing via a hostname containing <emphasis>ftp</emphasis>, then the file references that
464 follow are relative to the <filename>exim</filename> directories at these sites.
465 If accessing via the hostname <emphasis>downloads</emphasis> then the subdirectories described
466 here are top-level directories.
467 </para>
468 <para>
469 There are now quite a number of independent mirror sites around
470 the world. Those that I know about are listed in the file called <filename>Mirrors</filename>.
471 </para>
472 <para>
473 Within the top exim directory there are subdirectories called <filename>exim3</filename> (for
474 previous Exim 3 distributions), <filename>exim4</filename> (for the latest Exim 4
475 distributions), and <filename>Testing</filename> for testing versions. In the <filename>exim4</filename>
476 subdirectory, the current release can always be found in files called
477 </para>
478 <literallayout>
479 <filename>exim-n.nn.tar.xz</filename>
480 <filename>exim-n.nn.tar.gz</filename>
481 <filename>exim-n.nn.tar.bz2</filename>
482 </literallayout>
483 <para>
484 where <emphasis>n.nn</emphasis> is the highest such version number in the directory. The three
485 files contain identical data; the only difference is the type of compression.
486 The <filename>.xz</filename> file is usually the smallest, while the <filename>.gz</filename> file is the
487 most portable to old systems.
488 </para>
489 <para>
490 <indexterm role="concept">
491 <primary>distribution</primary>
492 <secondary>signing details</secondary>
493 </indexterm>
494 <indexterm role="concept">
495 <primary>distribution</primary>
496 <secondary>public key</secondary>
497 </indexterm>
498 <indexterm role="concept">
499 <primary>public key for signed distribution</primary>
500 </indexterm>
501 The distributions will be PGP signed by an individual key of the Release
502 Coordinator.  This key will have a uid containing an email address in the
503 <emphasis>exim.org</emphasis> domain and will have signatures from other people, including
504 other Exim maintainers.  We expect that the key will be in the "strong set" of
505 PGP keys.  There should be a trust path to that key from the Exim Maintainer&#x2019;s
506 PGP keys, a version of which can be found in the release directory in the file
507 <filename>Exim-Maintainers-Keyring.asc</filename>.  All keys used will be available in public keyserver pools,
508 such as <emphasis>pool.sks-keyservers.net</emphasis>.
509 </para>
510 <para>
511 At the time of the last update, releases were being made by Jeremy Harris and signed
512 with key <emphasis>0xBCE58C8CE41F32DF</emphasis>.  Other recent keys used for signing are those
513 of Heiko Schlittermann, <emphasis>0x26101B62F69376CE</emphasis>,
514 and of Phil Pennock, <emphasis>0x4D1E900E14C1CC04</emphasis>.
515 </para>
516 <para>
517 The signatures for the tar bundles are in:
518 </para>
519 <literallayout>
520 <filename>exim-n.nn.tar.xz.asc</filename>
521 <filename>exim-n.nn.tar.gz.asc</filename>
522 <filename>exim-n.nn.tar.bz2.asc</filename>
523 </literallayout>
524 <para>
525 For each released version, the log of changes is made available in a
526 separate file in the directory <filename>ChangeLogs</filename> so that it is possible to
527 find out what has changed without having to download the entire distribution.
528 </para>
529 <para>
530 <indexterm role="concept">
531 <primary>documentation</primary>
532 <secondary>available formats</secondary>
533 </indexterm>
534 The main distribution contains ASCII versions of this specification and other
535 documentation; other formats of the documents are available in separate files
536 inside the <filename>exim4</filename> directory of the FTP site:
537 </para>
538 <literallayout>
539 <filename>exim-html-n.nn.tar.gz</filename>
540 <filename>exim-pdf-n.nn.tar.gz</filename>
541 <filename>exim-postscript-n.nn.tar.gz</filename>
542 <filename>exim-texinfo-n.nn.tar.gz</filename>
543 </literallayout>
544 <para>
545 These tar files contain only the <filename>doc</filename> directory, not the complete
546 distribution, and are also available in <filename>.bz2</filename> and <filename>.xz</filename> forms.
547 </para>
548 </section>
549 <section id="SECID6">
550 <title>Limitations</title>
551 <itemizedlist>
552 <listitem>
553 <para>
554 <indexterm role="concept">
555 <primary>limitations of Exim</primary>
556 </indexterm>
557 <indexterm role="concept">
558 <primary>bang paths</primary>
559 <secondary>not handled by Exim</secondary>
560 </indexterm>
561 Exim is designed for use as an Internet MTA, and therefore handles addresses in
562 RFC 2822 domain format only. It cannot handle UUCP <quote>bang paths</quote>, though
563 simple two-component bang paths can be converted by a straightforward rewriting
564 configuration. This restriction does not prevent Exim from being interfaced to
565 UUCP as a transport mechanism, provided that domain addresses are used.
566 </para>
567 </listitem>
568 <listitem>
569 <para>
570 <indexterm role="concept">
571 <primary>domainless addresses</primary>
572 </indexterm>
573 <indexterm role="concept">
574 <primary>address</primary>
575 <secondary>without domain</secondary>
576 </indexterm>
577 Exim insists that every address it handles has a domain attached. For incoming
578 local messages, domainless addresses are automatically qualified with a
579 configured domain value. Configuration options specify from which remote
580 systems unqualified addresses are acceptable. These are then qualified on
581 arrival.
582 </para>
583 </listitem>
584 <listitem>
585 <para>
586 <indexterm role="concept">
587 <primary>transport</primary>
588 <secondary>external</secondary>
589 </indexterm>
590 <indexterm role="concept">
591 <primary>external transports</primary>
592 </indexterm>
593 The only external transport mechanisms that are currently implemented are SMTP
594 and LMTP over a TCP/IP network (including support for IPv6). However, a pipe
595 transport is available, and there are facilities for writing messages to files
596 and pipes, optionally in <emphasis>batched SMTP</emphasis> format; these facilities can be used
597 to send messages to other transport mechanisms such as UUCP, provided they can
598 handle domain-style addresses. Batched SMTP input is also catered for.
599 </para>
600 </listitem>
601 <listitem>
602 <para>
603 Exim is not designed for storing mail for dial-in hosts. When the volumes of
604 such mail are large, it is better to get the messages <quote>delivered</quote> into files
605 (that is, off Exim&#x2019;s queue) and subsequently passed on to the dial-in hosts by
606 other means.
607 </para>
608 </listitem>
609 <listitem>
610 <para>
611 Although Exim does have basic facilities for scanning incoming messages, these
612 are not comprehensive enough to do full virus or spam scanning. Such operations
613 are best carried out using additional specialized software packages. If you
614 compile Exim with the content-scanning extension, straightforward interfaces to
615 a number of common scanners are provided.
616 </para>
617 </listitem>
618 </itemizedlist>
619 </section>
620 <section id="SECID7">
621 <title>Runtime configuration</title>
622 <para>
623 Exim&#x2019;s runtime configuration is held in a single text file that is divided
624 into a number of sections. The entries in this file consist of keywords and
625 values, in the style of Smail 3 configuration files. A default configuration
626 file which is suitable for simple online installations is provided in the
627 distribution, and is described in chapter <xref linkend="CHAPdefconfil"/> below.
628 </para>
629 </section>
630 <section id="SECID8">
631 <title>Calling interface</title>
632 <para>
633 <indexterm role="concept">
634 <primary>Sendmail compatibility</primary>
635 <secondary>command line interface</secondary>
636 </indexterm>
637 Like many MTAs, Exim has adopted the Sendmail command line interface so that it
638 can be a straight replacement for <filename>/usr/lib/sendmail</filename> or
639 <filename>/usr/sbin/sendmail</filename> when sending mail, but you do not need to know anything
640 about Sendmail in order to run Exim. For actions other than sending messages,
641 Sendmail-compatible options also exist, but those that produce output (for
642 example, <option>-bp</option>, which lists the messages in the queue) do so in Exim&#x2019;s own
643 format. There are also some additional options that are compatible with Smail
644 3, and some further options that are new to Exim. Chapter <xref linkend="CHAPcommandline"/>
645 documents all Exim&#x2019;s command line options. This information is automatically
646 made into the man page that forms part of the Exim distribution.
647 </para>
648 <para>
649 Control of messages in the queue can be done via certain privileged command
650 line options. There is also an optional monitor program called <emphasis>eximon</emphasis>,
651 which displays current information in an X window, and which contains a menu
652 interface to Exim&#x2019;s command line administration options.
653 </para>
654 </section>
655 <section id="SECID9">
656 <title>Terminology</title>
657 <para>
658 <indexterm role="concept">
659 <primary>terminology definitions</primary>
660 </indexterm>
661 <indexterm role="concept">
662 <primary>body of message</primary>
663 <secondary>definition of</secondary>
664 </indexterm>
665 The <emphasis>body</emphasis> of a message is the actual data that the sender wants to transmit.
666 It is the last part of a message and is separated from the <emphasis>header</emphasis> (see
667 below) by a blank line.
668 </para>
669 <para>
670 <indexterm role="concept">
671 <primary>bounce message</primary>
672 <secondary>definition of</secondary>
673 </indexterm>
674 When a message cannot be delivered, it is normally returned to the sender in a
675 delivery failure message or a <quote>non-delivery report</quote> (NDR). The term
676 <emphasis>bounce</emphasis> is commonly used for this action, and the error reports are often
677 called <emphasis>bounce messages</emphasis>. This is a convenient shorthand for <quote>delivery
678 failure error report</quote>. Such messages have an empty sender address in the
679 message&#x2019;s <emphasis>envelope</emphasis> (see below) to ensure that they cannot themselves give
680 rise to further bounce messages.
681 </para>
682 <para>
683 The term <emphasis>default</emphasis> appears frequently in this manual. It is used to qualify a
684 value which is used in the absence of any setting in the configuration. It may
685 also qualify an action which is taken unless a configuration setting specifies
686 otherwise.
687 </para>
688 <para>
689 The term <emphasis>defer</emphasis> is used when the delivery of a message to a specific
690 destination cannot immediately take place for some reason (a remote host may be
691 down, or a user&#x2019;s local mailbox may be full). Such deliveries are <emphasis>deferred</emphasis>
692 until a later time.
693 </para>
694 <para>
695 The word <emphasis>domain</emphasis> is sometimes used to mean all but the first component of a
696 host&#x2019;s name. It is <emphasis>not</emphasis> used in that sense here, where it normally refers to
697 the part of an email address following the @ sign.
698 </para>
699 <para>
700 <indexterm role="concept">
701 <primary>envelope, definition of</primary>
702 </indexterm>
703 <indexterm role="concept">
704 <primary>sender</primary>
705 <secondary>definition of</secondary>
706 </indexterm>
707 A message in transit has an associated <emphasis>envelope</emphasis>, as well as a header and a
708 body. The envelope contains a sender address (to which bounce messages should
709 be delivered), and any number of recipient addresses. References to the
710 sender or the recipients of a message usually mean the addresses in the
711 envelope. An MTA uses these addresses for delivery, and for returning bounce
712 messages, not the addresses that appear in the header lines.
713 </para>
714 <para>
715 <indexterm role="concept">
716 <primary>message</primary>
717 <secondary>header, definition of</secondary>
718 </indexterm>
719 <indexterm role="concept">
720 <primary>header section</primary>
721 <secondary>definition of</secondary>
722 </indexterm>
723 The <emphasis>header</emphasis> of a message is the first part of a message&#x2019;s text, consisting
724 of a number of lines, each of which has a name such as <emphasis>From:</emphasis>, <emphasis>To:</emphasis>,
725 <emphasis>Subject:</emphasis>, etc. Long header lines can be split over several text lines by
726 indenting the continuations. The header is separated from the body by a blank
727 line.
728 </para>
729 <para>
730 <indexterm role="concept">
731 <primary>local part</primary>
732 <secondary>definition of</secondary>
733 </indexterm>
734 <indexterm role="concept">
735 <primary>domain</primary>
736 <secondary>definition of</secondary>
737 </indexterm>
738 The term <emphasis>local part</emphasis>, which is taken from RFC 2822, is used to refer to the
739 part of an email address that precedes the @ sign. The part that follows the
740 @ sign is called the <emphasis>domain</emphasis> or <emphasis>mail domain</emphasis>.
741 </para>
742 <para>
743 <indexterm role="concept">
744 <primary>local delivery</primary>
745 <secondary>definition of</secondary>
746 </indexterm>
747 <indexterm role="concept">
748 <primary>remote delivery, definition of</primary>
749 </indexterm>
750 The terms <emphasis>local delivery</emphasis> and <emphasis>remote delivery</emphasis> are used to distinguish
751 delivery to a file or a pipe on the local host from delivery by SMTP over
752 TCP/IP to another host. As far as Exim is concerned, all hosts other than the
753 host it is running on are <emphasis>remote</emphasis>.
754 </para>
755 <para>
756 <indexterm role="concept">
757 <primary>return path</primary>
758 <secondary>definition of</secondary>
759 </indexterm>
760 <emphasis>Return path</emphasis> is another name that is used for the sender address in a
761 message&#x2019;s envelope.
762 </para>
763 <para>
764 <indexterm role="concept">
765 <primary>queue</primary>
766 <secondary>definition of</secondary>
767 </indexterm>
768 The term <emphasis>queue</emphasis> is used to refer to the set of messages awaiting delivery
769 because this term is in widespread use in the context of MTAs. However, in
770 Exim&#x2019;s case, the reality is more like a pool than a queue, because there is
771 normally no ordering of waiting messages.
772 </para>
773 <para>
774 <indexterm role="concept">
775 <primary>queue runner</primary>
776 <secondary>definition of</secondary>
777 </indexterm>
778 The term <emphasis>queue runner</emphasis> is used to describe a process that scans the queue
779 and attempts to deliver those messages whose retry times have come. This term
780 is used by other MTAs and also relates to the command <option>runq</option>, but in Exim
781 the waiting messages are normally processed in an unpredictable order.
782 </para>
783 <para>
784 <indexterm role="concept">
785 <primary>spool directory</primary>
786 <secondary>definition of</secondary>
787 </indexterm>
788 The term <emphasis>spool directory</emphasis> is used for a directory in which Exim keeps the
789 messages in its queue &ndash; that is, those that it is in the process of
790 delivering. This should not be confused with the directory in which local
791 mailboxes are stored, which is called a <quote>spool directory</quote> by some people. In
792 the Exim documentation, <quote>spool</quote> is always used in the first sense.
793 </para>
794 </section>
795 </chapter>
796
797 <chapter id="CHID2">
798 <title>Incorporated code</title>
799 <para>
800 <indexterm role="concept">
801 <primary>incorporated code</primary>
802 </indexterm>
803 <indexterm role="concept">
804 <primary>regular expressions</primary>
805 <secondary>library</secondary>
806 </indexterm>
807 <indexterm role="concept">
808 <primary>PCRE</primary>
809 </indexterm>
810 <indexterm role="concept">
811 <primary>OpenDMARC</primary>
812 </indexterm>
813 A number of pieces of external code are included in the Exim distribution.
814 </para>
815 <itemizedlist>
816 <listitem>
817 <para>
818 Regular expressions are supported in the main Exim program and in the
819 Exim monitor using the freely-distributable PCRE library, copyright
820 &copy; University of Cambridge. The source to PCRE is no longer shipped with
821 Exim, so you will need to use the version of PCRE shipped with your system,
822 or obtain and install the full version of the library from
823 <emphasis role="bold"><ulink url="ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre">ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre</ulink></emphasis>.
824 </para>
825 </listitem>
826 <listitem>
827 <para>
828 <indexterm role="concept">
829 <primary>cdb</primary>
830 <secondary>acknowledgment</secondary>
831 </indexterm>
832 Support for the cdb (Constant DataBase) lookup method is provided by code
833 contributed by Nigel Metheringham of (at the time he contributed it) Planet
834 Online Ltd. The implementation is completely contained within the code of Exim.
835 It does not link against an external cdb library. The code contains the
836 following statements:
837 </para>
838 <blockquote>
839 <para>
840 Copyright &copy; 1998 Nigel Metheringham, Planet Online Ltd
841 </para>
842 <para>
843 This program is free software; you can redistribute it and/or modify it under
844 the terms of the GNU General Public License as published by the Free Software
845 Foundation; either version 2 of the License, or (at your option) any later
846 version.
847 This code implements Dan Bernstein&#x2019;s Constant DataBase (cdb) spec. Information,
848 the spec and sample code for cdb can be obtained from
849 <emphasis role="bold"><ulink url="https://cr.yp.to/cdb.html">https://cr.yp.to/cdb.html</ulink></emphasis>. This implementation borrows
850 some code from Dan Bernstein&#x2019;s implementation (which has no license
851 restrictions applied to it).
852 </para>
853 </blockquote>
854 </listitem>
855 <listitem>
856 <para>
857 <indexterm role="concept">
858 <primary>SPA authentication</primary>
859 </indexterm>
860 <indexterm role="concept">
861 <primary>Samba project</primary>
862 </indexterm>
863 <indexterm role="concept">
864 <primary>Microsoft Secure Password Authentication</primary>
865 </indexterm>
866 Client support for Microsoft&#x2019;s <emphasis>Secure Password Authentication</emphasis> is provided
867 by code contributed by Marc Prud&#x2019;hommeaux. Server support was contributed by
868 Tom Kistner. This includes code taken from the Samba project, which is released
869 under the Gnu GPL.
870 </para>
871 </listitem>
872 <listitem>
873 <para>
874 <indexterm role="concept">
875 <primary>Cyrus</primary>
876 </indexterm>
877 <indexterm role="concept">
878 <primary><emphasis>pwcheck</emphasis> daemon</primary>
879 </indexterm>
880 <indexterm role="concept">
881 <primary><emphasis>pwauthd</emphasis> daemon</primary>
882 </indexterm>
883 Support for calling the Cyrus <emphasis>pwcheck</emphasis> and <emphasis>saslauthd</emphasis> daemons is provided
884 by code taken from the Cyrus-SASL library and adapted by Alexander S.
885 Sabourenkov. The permission notice appears below, in accordance with the
886 conditions expressed therein.
887 </para>
888 <blockquote>
889 <para>
890 Copyright &copy; 2001 Carnegie Mellon University.  All rights reserved.
891 </para>
892 <para>
893 Redistribution and use in source and binary forms, with or without
894 modification, are permitted provided that the following conditions
895 are met:
896 </para>
897 <orderedlist numeration="arabic">
898 <listitem>
899 <para>
900 Redistributions of source code must retain the above copyright
901 notice, this list of conditions and the following disclaimer.
902 </para>
903 </listitem>
904 <listitem>
905 <para>
906 Redistributions in binary form must reproduce the above copyright
907 notice, this list of conditions and the following disclaimer in
908 the documentation and/or other materials provided with the
909 distribution.
910 </para>
911 </listitem>
912 <listitem>
913 <para>
914 The name <quote>Carnegie Mellon University</quote> must not be used to
915 endorse or promote products derived from this software without
916 prior written permission. For permission or any other legal
917 details, please contact
918 </para>
919 <literallayout>
920               Office of Technology Transfer
921               Carnegie Mellon University
922               5000 Forbes Avenue
923               Pittsburgh, PA  15213-3890
924               (412) 268-4387, fax: (412) 268-7395
925               tech-transfer@andrew.cmu.edu
926 </literallayout>
927 </listitem>
928 <listitem>
929 <para>
930 Redistributions of any form whatsoever must retain the following
931 acknowledgment:
932 </para>
933 <para>
934 <quote>This product includes software developed by Computing Services
935 at Carnegie Mellon University (<emphasis role="bold"><ulink url="https://www.cmu.edu/computing/">https://www.cmu.edu/computing/</ulink></emphasis>.</quote>
936 </para>
937 <para>
938 CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
939 THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
940 AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
941 FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
942 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
943 AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
944 OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
945 </para>
946 </listitem>
947 </orderedlist>
948 </blockquote>
949 </listitem>
950 <listitem>
951 <para>
952 <indexterm role="concept">
953 <primary>Exim monitor</primary>
954 <secondary>acknowledgment</secondary>
955 </indexterm>
956 <indexterm role="concept">
957 <primary>X-windows</primary>
958 </indexterm>
959 <indexterm role="concept">
960 <primary>Athena</primary>
961 </indexterm>
962 The Exim Monitor program, which is an X-Window application, includes
963 modified versions of the Athena StripChart and TextPop widgets.
964 This code is copyright by DEC and MIT, and their permission notice appears
965 below, in accordance with the conditions expressed therein.
966 </para>
967 <blockquote>
968 <para>
969 Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
970 and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
971 </para>
972 <para>
973 All Rights Reserved
974 </para>
975 <para>
976 Permission to use, copy, modify, and distribute this software and its
977 documentation for any purpose and without fee is hereby granted,
978 provided that the above copyright notice appear in all copies and that
979 both that copyright notice and this permission notice appear in
980 supporting documentation, and that the names of Digital or MIT not be
981 used in advertising or publicity pertaining to distribution of the
982 software without specific, written prior permission.
983 </para>
984 <para>
985 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
986 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
987 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
988 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
989 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
990 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
991 SOFTWARE.
992 </para>
993 </blockquote>
994 </listitem>
995 <listitem>
996 <para>
997 <indexterm role="concept">
998 <primary>opendmarc</primary>
999 <secondary>acknowledgment</secondary>
1000 </indexterm>
1001 The DMARC implementation uses the OpenDMARC library which is Copyrighted by
1002 The Trusted Domain Project. Portions of Exim source which use OpenDMARC
1003 derived code are indicated in the respective source files. The full OpenDMARC
1004 license is provided in the LICENSE.opendmarc file contained in the distributed
1005 source code.
1006 </para>
1007 </listitem>
1008 <listitem>
1009 <para>
1010 Many people have contributed code fragments, some large, some small, that were
1011 not covered by any specific license requirements. It is assumed that the
1012 contributors are happy to see their code incorporated into Exim under the GPL.
1013 </para>
1014 </listitem>
1015 </itemizedlist>
1016 </chapter>
1017
1018 <chapter id="CHID11">
1019 <title>How Exim receives and delivers mail</title>
1020 <titleabbrev>Receiving and delivering mail</titleabbrev>
1021 <section id="SECID10">
1022 <title>Overall philosophy</title>
1023 <para>
1024 <indexterm role="concept">
1025 <primary>design philosophy</primary>
1026 </indexterm>
1027 Exim is designed to work efficiently on systems that are permanently connected
1028 to the Internet and are handling a general mix of mail. In such circumstances,
1029 most messages can be delivered immediately. Consequently, Exim does not
1030 maintain independent queues of messages for specific domains or hosts, though
1031 it does try to send several messages in a single SMTP connection after a host
1032 has been down, and it also maintains per-host retry information.
1033 </para>
1034 </section>
1035 <section id="SECID11">
1036 <title>Policy control</title>
1037 <para>
1038 <indexterm role="concept">
1039 <primary>policy control</primary>
1040 <secondary>overview</secondary>
1041 </indexterm>
1042 Policy controls are now an important feature of MTAs that are connected to the
1043 Internet. Perhaps their most important job is to stop MTAs from being abused as
1044 <quote>open relays</quote> by misguided individuals who send out vast amounts of
1045 unsolicited junk and want to disguise its source. Exim provides flexible
1046 facilities for specifying policy controls on incoming mail:
1047 </para>
1048 <itemizedlist>
1049 <listitem>
1050 <para>
1051 <indexterm role="concept">
1052 <primary>access control lists (ACLs)</primary>
1053 <secondary>introduction</secondary>
1054 </indexterm>
1055 Exim 4 (unlike previous versions of Exim) implements policy controls on
1056 incoming mail by means of <emphasis>Access Control Lists</emphasis> (ACLs). Each list is a
1057 series of statements that may either grant or deny access. ACLs can be used at
1058 several places in the SMTP dialogue while receiving a message from a remote
1059 host. However, the most common places are after each RCPT command, and at the
1060 very end of the message. The sysadmin can specify conditions for accepting or
1061 rejecting individual recipients or the entire message, respectively, at these
1062 two points (see chapter <xref linkend="CHAPACL"/>). Denial of access results in an SMTP
1063 error code.
1064 </para>
1065 </listitem>
1066 <listitem>
1067 <para>
1068 An ACL is also available for locally generated, non-SMTP messages. In this
1069 case, the only available actions are to accept or deny the entire message.
1070 </para>
1071 </listitem>
1072 <listitem>
1073 <para>
1074 When Exim is compiled with the content-scanning extension, facilities are
1075 provided in the ACL mechanism for passing the message to external virus and/or
1076 spam scanning software. The result of such a scan is passed back to the ACL,
1077 which can then use it to decide what to do with the message.
1078 </para>
1079 </listitem>
1080 <listitem>
1081 <para>
1082 When a message has been received, either from a remote host or from the local
1083 host, but before the final acknowledgment has been sent, a locally supplied C
1084 function called <function>local_scan()</function> can be run to inspect the message and decide
1085 whether to accept it or not (see chapter <xref linkend="CHAPlocalscan"/>). If the message
1086 is accepted, the list of recipients can be modified by the function.
1087 </para>
1088 </listitem>
1089 <listitem>
1090 <para>
1091 Using the <function>local_scan()</function> mechanism is another way of calling external scanner
1092 software. The <option>SA-Exim</option> add-on package works this way. It does not require
1093 Exim to be compiled with the content-scanning extension.
1094 </para>
1095 </listitem>
1096 <listitem>
1097 <para>
1098 After a message has been accepted, a further checking mechanism is available in
1099 the form of the <emphasis>system filter</emphasis> (see chapter <xref linkend="CHAPsystemfilter"/>). This
1100 runs at the start of every delivery process.
1101 </para>
1102 </listitem>
1103 </itemizedlist>
1104 </section>
1105 <section id="SECID12">
1106 <title>User filters</title>
1107 <para>
1108 <indexterm role="concept">
1109 <primary>filter</primary>
1110 <secondary>introduction</secondary>
1111 </indexterm>
1112 <indexterm role="concept">
1113 <primary>Sieve filter</primary>
1114 </indexterm>
1115 In a conventional Exim configuration, users are able to run private filters by
1116 setting up appropriate <filename>.forward</filename> files in their home directories. See
1117 chapter <xref linkend="CHAPredirect"/> (about the <command>redirect</command> router) for the
1118 configuration needed to support this, and the separate document entitled
1119 <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis> for user details. Two different kinds
1120 of filtering are available:
1121 </para>
1122 <itemizedlist>
1123 <listitem>
1124 <para>
1125 Sieve filters are written in the standard filtering language that is defined
1126 by RFC 3028.
1127 </para>
1128 </listitem>
1129 <listitem>
1130 <para>
1131 Exim filters are written in a syntax that is unique to Exim, but which is more
1132 powerful than Sieve, which it pre-dates.
1133 </para>
1134 </listitem>
1135 </itemizedlist>
1136 <para>
1137 User filters are run as part of the routing process, described below.
1138 </para>
1139 </section>
1140 <section id="SECTmessiden">
1141 <title>Message identification</title>
1142 <para>
1143 <indexterm role="concept">
1144 <primary>message ids</primary>
1145 <secondary>details of format</secondary>
1146 </indexterm>
1147 <indexterm role="concept">
1148 <primary>format</primary>
1149 <secondary>of message id</secondary>
1150 </indexterm>
1151 <indexterm role="concept">
1152 <primary>id of message</primary>
1153 </indexterm>
1154 <indexterm role="concept">
1155 <primary>base62</primary>
1156 </indexterm>
1157 <indexterm role="concept">
1158 <primary>base36</primary>
1159 </indexterm>
1160 <indexterm role="concept">
1161 <primary>Darwin</primary>
1162 </indexterm>
1163 <indexterm role="concept">
1164 <primary>Cygwin</primary>
1165 </indexterm>
1166 Every message handled by Exim is given a <emphasis>message id</emphasis> which is sixteen
1167 characters long. It is divided into three parts, separated by hyphens, for
1168 example <literal>16VDhn-0001bo-D3</literal>. Each part is a sequence of letters and digits,
1169 normally encoding numbers in base 62. However, in the Darwin operating
1170 system (Mac OS X) and when Exim is compiled to run under Cygwin, base 36
1171 (avoiding the use of lower case letters) is used instead, because the message
1172 id is used to construct filenames, and the names of files in those systems are
1173 not always case-sensitive.
1174 </para>
1175 <para>
1176 <indexterm role="concept">
1177 <primary>pid (process id)</primary>
1178 <secondary>re-use of</secondary>
1179 </indexterm>
1180 The detail of the contents of the message id have changed as Exim has evolved.
1181 Earlier versions relied on the operating system not re-using a process id (pid)
1182 within one second. On modern operating systems, this assumption can no longer
1183 be made, so the algorithm had to be changed. To retain backward compatibility,
1184 the format of the message id was retained, which is why the following rules are
1185 somewhat eccentric:
1186 </para>
1187 <itemizedlist>
1188 <listitem>
1189 <para>
1190 The first six characters of the message id are the time at which the message
1191 started to be received, to a granularity of one second. That is, this field
1192 contains the number of seconds since the start of the epoch (the normal Unix
1193 way of representing the date and time of day).
1194 </para>
1195 </listitem>
1196 <listitem>
1197 <para>
1198 After the first hyphen, the next six characters are the id of the process that
1199 received the message.
1200 </para>
1201 </listitem>
1202 <listitem>
1203 <para>
1204 There are two different possibilities for the final two characters:
1205 </para>
1206 <orderedlist numeration="arabic">
1207 <listitem>
1208 <para>
1209 <indexterm role="option">
1210 <primary><option>localhost_number</option></primary>
1211 </indexterm>
1212 If <option>localhost_number</option> is not set, this value is the fractional part of the
1213 time of reception, normally in units of 1/2000 of a second, but for systems
1214 that must use base 36 instead of base 62 (because of case-insensitive file
1215 systems), the units are 1/1000 of a second.
1216 </para>
1217 </listitem>
1218 <listitem>
1219 <para>
1220 If <option>localhost_number</option> is set, it is multiplied by 200 (100) and added to
1221 the fractional part of the time, which in this case is in units of 1/200
1222 (1/100) of a second.
1223 </para>
1224 </listitem>
1225 </orderedlist>
1226 </listitem>
1227 </itemizedlist>
1228 <para>
1229 After a message has been received, Exim waits for the clock to tick at the
1230 appropriate resolution before proceeding, so that if another message is
1231 received by the same process, or by another process with the same (re-used)
1232 pid, it is guaranteed that the time will be different. In most cases, the clock
1233 will already have ticked while the message was being received.
1234 </para>
1235 </section>
1236 <section id="SECID13">
1237 <title>Receiving mail</title>
1238 <para>
1239 <indexterm role="concept">
1240 <primary>receiving mail</primary>
1241 </indexterm>
1242 <indexterm role="concept">
1243 <primary>message</primary>
1244 <secondary>reception</secondary>
1245 </indexterm>
1246 The only way Exim can receive mail from another host is using SMTP over
1247 TCP/IP, in which case the sender and recipient addresses are transferred using
1248 SMTP commands. However, from a locally running process (such as a user&#x2019;s MUA),
1249 there are several possibilities:
1250 </para>
1251 <itemizedlist>
1252 <listitem>
1253 <para>
1254 If the process runs Exim with the <option>-bm</option> option, the message is read
1255 non-interactively (usually via a pipe), with the recipients taken from the
1256 command line, or from the body of the message if <option>-t</option> is also used.
1257 </para>
1258 </listitem>
1259 <listitem>
1260 <para>
1261 If the process runs Exim with the <option>-bS</option> option, the message is also read
1262 non-interactively, but in this case the recipients are listed at the start of
1263 the message in a series of SMTP RCPT commands, terminated by a DATA
1264 command. This is called <quote>batch SMTP</quote> format,
1265 but it isn&#x2019;t really SMTP. The SMTP commands are just another way of passing
1266 envelope addresses in a non-interactive submission.
1267 </para>
1268 </listitem>
1269 <listitem>
1270 <para>
1271 If the process runs Exim with the <option>-bs</option> option, the message is read
1272 interactively, using the SMTP protocol. A two-way pipe is normally used for
1273 passing data between the local process and the Exim process.
1274 This is <quote>real</quote> SMTP and is handled in the same way as SMTP over TCP/IP. For
1275 example, the ACLs for SMTP commands are used for this form of submission.
1276 </para>
1277 </listitem>
1278 <listitem>
1279 <para>
1280 A local process may also make a TCP/IP call to the host&#x2019;s loopback address
1281 (127.0.0.1) or any other of its IP addresses. When receiving messages, Exim
1282 does not treat the loopback address specially. It treats all such connections
1283 in the same way as connections from other hosts.
1284 </para>
1285 </listitem>
1286 </itemizedlist>
1287 <para>
1288 <indexterm role="concept">
1289 <primary>message sender, constructed by Exim</primary>
1290 </indexterm>
1291 <indexterm role="concept">
1292 <primary>sender</primary>
1293 <secondary>constructed by Exim</secondary>
1294 </indexterm>
1295 In the three cases that do not involve TCP/IP, the sender address is
1296 constructed from the login name of the user that called Exim and a default
1297 qualification domain (which can be set by the <option>qualify_domain</option> configuration
1298 option). For local or batch SMTP, a sender address that is passed using the
1299 SMTP MAIL command is ignored. However, the system administrator may allow
1300 certain users (<quote>trusted users</quote>) to specify a different sender addresses
1301 unconditionally, or all users to specify certain forms of different sender
1302 address. The <option>-f</option> option or the SMTP MAIL command is used to specify these
1303 different addresses. See section <xref linkend="SECTtrustedadmin"/> for details of trusted
1304 users, and the <option>untrusted_set_sender</option> option for a way of allowing untrusted
1305 users to change sender addresses.
1306 </para>
1307 <para>
1308 Messages received by either of the non-interactive mechanisms are subject to
1309 checking by the non-SMTP ACL if one is defined. Messages received using SMTP
1310 (either over TCP/IP or interacting with a local process) can be checked by a
1311 number of ACLs that operate at different times during the SMTP session. Either
1312 individual recipients or the entire message can be rejected if local policy
1313 requirements are not met. The <function>local_scan()</function> function (see chapter
1314 <xref linkend="CHAPlocalscan"/>) is run for all incoming messages.
1315 </para>
1316 <para>
1317 Exim can be configured not to start a delivery process when a message is
1318 received; this can be unconditional, or depend on the number of incoming SMTP
1319 connections or the system load. In these situations, new messages wait on the
1320 queue until a queue runner process picks them up. However, in standard
1321 configurations under normal conditions, delivery is started as soon as a
1322 message is received.
1323 </para>
1324 </section>
1325 <section id="SECID14">
1326 <title>Handling an incoming message</title>
1327 <para>
1328 <indexterm role="concept">
1329 <primary>spool directory</primary>
1330 <secondary>files that hold a message</secondary>
1331 </indexterm>
1332 <indexterm role="concept">
1333 <primary>file</primary>
1334 <secondary>how a message is held</secondary>
1335 </indexterm>
1336 When Exim accepts a message, it writes two files in its spool directory. The
1337 first contains the envelope information, the current status of the message, and
1338 the header lines, and the second contains the body of the message. The names of
1339 the two spool files consist of the message id, followed by <literal>-H</literal> for the
1340 file containing the envelope and header, and <literal>-D</literal> for the data file.
1341 </para>
1342 <para>
1343 <indexterm role="concept">
1344 <primary>spool directory</primary>
1345 <secondary><filename>input</filename> sub-directory</secondary>
1346 </indexterm>
1347 By default, all these message files are held in a single directory called
1348 <filename>input</filename> inside the general Exim spool directory. Some operating systems do
1349 not perform very well if the number of files in a directory gets large; to
1350 improve performance in such cases, the <option>split_spool_directory</option> option can be
1351 used. This causes Exim to split up the input files into 62 sub-directories
1352 whose names are single letters or digits. When this is done, the queue is
1353 processed one sub-directory at a time instead of all at once, which can improve
1354 overall performance even when there are not enough files in each directory to
1355 affect file system performance.
1356 </para>
1357 <para>
1358 The envelope information consists of the address of the message&#x2019;s sender and
1359 the addresses of the recipients. This information is entirely separate from
1360 any addresses contained in the header lines. The status of the message includes
1361 a list of recipients who have already received the message. The format of the
1362 first spool file is described in chapter <xref linkend="CHAPspool"/>.
1363 </para>
1364 <para>
1365 <indexterm role="concept">
1366 <primary>rewriting</primary>
1367 <secondary>addresses</secondary>
1368 </indexterm>
1369 Address rewriting that is specified in the rewrite section of the configuration
1370 (see chapter <xref linkend="CHAPrewrite"/>) is done once and for all on incoming addresses,
1371 both in the header lines and the envelope, at the time the message is accepted.
1372 If during the course of delivery additional addresses are generated (for
1373 example, via aliasing), these new addresses are rewritten as soon as they are
1374 generated. At the time a message is actually delivered (transported) further
1375 rewriting can take place; because this is a transport option, it can be
1376 different for different forms of delivery. It is also possible to specify the
1377 addition or removal of certain header lines at the time the message is
1378 delivered (see chapters <xref linkend="CHAProutergeneric"/> and
1379 <xref linkend="CHAPtransportgeneric"/>).
1380 </para>
1381 </section>
1382 <section id="SECID15">
1383 <title>Life of a message</title>
1384 <para>
1385 <indexterm role="concept">
1386 <primary>message</primary>
1387 <secondary>life of</secondary>
1388 </indexterm>
1389 <indexterm role="concept">
1390 <primary>message</primary>
1391 <secondary>frozen</secondary>
1392 </indexterm>
1393 A message remains in the spool directory until it is completely delivered to
1394 its recipients or to an error address, or until it is deleted by an
1395 administrator or by the user who originally created it. In cases when delivery
1396 cannot proceed &ndash; for example when a message can neither be delivered to its
1397 recipients nor returned to its sender, the message is marked <quote>frozen</quote> on the
1398 spool, and no more deliveries are attempted.
1399 </para>
1400 <para>
1401 <indexterm role="concept">
1402 <primary>frozen messages</primary>
1403 <secondary>thawing</secondary>
1404 </indexterm>
1405 <indexterm role="concept">
1406 <primary>message</primary>
1407 <secondary>thawing frozen</secondary>
1408 </indexterm>
1409 An administrator can <quote>thaw</quote> such messages when the problem has been
1410 corrected, and can also freeze individual messages by hand if necessary. In
1411 addition, an administrator can force a delivery error, causing a bounce message
1412 to be sent.
1413 </para>
1414 <para>
1415 <indexterm role="option">
1416 <primary><option>timeout_frozen_after</option></primary>
1417 </indexterm>
1418 <indexterm role="option">
1419 <primary><option>ignore_bounce_errors_after</option></primary>
1420 </indexterm>
1421 There are options called <option>ignore_bounce_errors_after</option> and
1422 <option>timeout_frozen_after</option>, which discard frozen messages after a certain time.
1423 The first applies only to frozen bounces, the second to all frozen messages.
1424 </para>
1425 <para>
1426 <indexterm role="concept">
1427 <primary>message</primary>
1428 <secondary>log file for</secondary>
1429 </indexterm>
1430 <indexterm role="concept">
1431 <primary>log</primary>
1432 <secondary>file for each message</secondary>
1433 </indexterm>
1434 While Exim is working on a message, it writes information about each delivery
1435 attempt to its main log file. This includes successful, unsuccessful, and
1436 delayed deliveries for each recipient (see chapter <xref linkend="CHAPlog"/>). The log
1437 lines are also written to a separate <emphasis>message log</emphasis> file for each message.
1438 These logs are solely for the benefit of the administrator and are normally
1439 deleted along with the spool files when processing of a message is complete.
1440 The use of individual message logs can be disabled by setting
1441 <option>no_message_logs</option>; this might give an improvement in performance on very busy
1442 systems.
1443 </para>
1444 <para>
1445 <indexterm role="concept">
1446 <primary>journal file</primary>
1447 </indexterm>
1448 <indexterm role="concept">
1449 <primary>file</primary>
1450 <secondary>journal</secondary>
1451 </indexterm>
1452 All the information Exim itself needs to set up a delivery is kept in the first
1453 spool file, along with the header lines. When a successful delivery occurs, the
1454 address is immediately written at the end of a journal file, whose name is the
1455 message id followed by <literal>-J</literal>. At the end of a delivery run, if there are some
1456 addresses left to be tried again later, the first spool file (the <literal>-H</literal> file)
1457 is updated to indicate which these are, and the journal file is then deleted.
1458 Updating the spool file is done by writing a new file and renaming it, to
1459 minimize the possibility of data loss.
1460 </para>
1461 <para>
1462 Should the system or Exim crash after a successful delivery but before
1463 the spool file has been updated, the journal is left lying around. The next
1464 time Exim attempts to deliver the message, it reads the journal file and
1465 updates the spool file before proceeding. This minimizes the chances of double
1466 deliveries caused by crashes.
1467 </para>
1468 </section>
1469 <section id="SECTprocaddress">
1470 <title>Processing an address for delivery</title>
1471 <para>
1472 <indexterm role="concept">
1473 <primary>drivers</primary>
1474 <secondary>definition of</secondary>
1475 </indexterm>
1476 <indexterm role="concept">
1477 <primary>router</primary>
1478 <secondary>definition of</secondary>
1479 </indexterm>
1480 <indexterm role="concept">
1481 <primary>transport</primary>
1482 <secondary>definition of</secondary>
1483 </indexterm>
1484 The main delivery processing elements of Exim are called <emphasis>routers</emphasis> and
1485 <emphasis>transports</emphasis>, and collectively these are known as <emphasis>drivers</emphasis>. Code for a
1486 number of them is provided in the source distribution, and compile-time options
1487 specify which ones are included in the binary. Runtime options specify which
1488 ones are actually used for delivering messages.
1489 </para>
1490 <para>
1491 <indexterm role="concept">
1492 <primary>drivers</primary>
1493 <secondary>instance definition</secondary>
1494 </indexterm>
1495 Each driver that is specified in the runtime configuration is an <emphasis>instance</emphasis>
1496 of that particular driver type. Multiple instances are allowed; for example,
1497 you can set up several different <command>smtp</command> transports, each with different
1498 option values that might specify different ports or different timeouts. Each
1499 instance has its own identifying name. In what follows we will normally use the
1500 instance name when discussing one particular instance (that is, one specific
1501 configuration of the driver), and the generic driver name when discussing
1502 the driver&#x2019;s features in general.
1503 </para>
1504 <para>
1505 A <emphasis>router</emphasis> is a driver that operates on an address, either determining how
1506 its delivery should happen, by assigning it to a specific transport, or
1507 converting the address into one or more new addresses (for example, via an
1508 alias file). A router may also explicitly choose to fail an address, causing it
1509 to be bounced.
1510 </para>
1511 <para>
1512 A <emphasis>transport</emphasis> is a driver that transmits a copy of the message from Exim&#x2019;s
1513 spool to some destination. There are two kinds of transport: for a <emphasis>local</emphasis>
1514 transport, the destination is a file or a pipe on the local host, whereas for a
1515 <emphasis>remote</emphasis> transport the destination is some other host. A message is passed
1516 to a specific transport as a result of successful routing. If a message has
1517 several recipients, it may be passed to a number of different transports.
1518 </para>
1519 <para>
1520 <indexterm role="concept">
1521 <primary>preconditions</primary>
1522 <secondary>definition of</secondary>
1523 </indexterm>
1524 An address is processed by passing it to each configured router instance in
1525 turn, subject to certain preconditions, until a router accepts the address or
1526 specifies that it should be bounced. We will describe this process in more
1527 detail shortly. First, as a simple example, we consider how each recipient
1528 address in a message is processed in a small configuration of three routers.
1529 </para>
1530 <para>
1531 To make this a more concrete example, it is described in terms of some actual
1532 routers, but remember, this is only an example. You can configure Exim&#x2019;s
1533 routers in many different ways, and there may be any number of routers in a
1534 configuration.
1535 </para>
1536 <para>
1537 The first router that is specified in a configuration is often one that handles
1538 addresses in domains that are not recognized specifically by the local host.
1539 Typically these are addresses for arbitrary domains on the Internet. A precondition
1540 is set up which looks for the special domains known to the host (for example,
1541 its own domain name), and the router is run for addresses that do <emphasis>not</emphasis>
1542 match. Typically, this is a router that looks up domains in the DNS in order to
1543 find the hosts to which this address routes. If it succeeds, the address is
1544 assigned to a suitable SMTP transport; if it does not succeed, the router is
1545 configured to fail the address.
1546 </para>
1547 <para>
1548 The second router is reached only when the domain is recognized as one that
1549 <quote>belongs</quote> to the local host. This router does redirection &ndash; also known as
1550 aliasing and forwarding. When it generates one or more new addresses from the
1551 original, each of them is routed independently from the start. Otherwise, the
1552 router may cause an address to fail, or it may simply decline to handle the
1553 address, in which case the address is passed to the next router.
1554 </para>
1555 <para>
1556 The final router in many configurations is one that checks to see if the
1557 address belongs to a local mailbox. The precondition may involve a check to
1558 see if the local part is the name of a login account, or it may look up the
1559 local part in a file or a database. If its preconditions are not met, or if
1560 the router declines, we have reached the end of the routers. When this happens,
1561 the address is bounced.
1562 </para>
1563 </section>
1564 <section id="SECID16">
1565 <title>Processing an address for verification</title>
1566 <para>
1567 <indexterm role="concept">
1568 <primary>router</primary>
1569 <secondary>for verification</secondary>
1570 </indexterm>
1571 <indexterm role="concept">
1572 <primary>verifying address</primary>
1573 <secondary>overview</secondary>
1574 </indexterm>
1575 As well as being used to decide how to deliver to an address, Exim&#x2019;s routers
1576 are also used for <emphasis>address verification</emphasis>. Verification can be requested as
1577 one of the checks to be performed in an ACL for incoming messages, on both
1578 sender and recipient addresses, and it can be tested using the <option>-bv</option> and
1579 <option>-bvs</option> command line options.
1580 </para>
1581 <para>
1582 When an address is being verified, the routers are run in <quote>verify mode</quote>. This
1583 does not affect the way the routers work, but it is a state that can be
1584 detected. By this means, a router can be skipped or made to behave differently
1585 when verifying. A common example is a configuration in which the first router
1586 sends all messages to a message-scanning program unless they have been
1587 previously scanned. Thus, the first router accepts all addresses without any
1588 checking, making it useless for verifying. Normally, the <option>no_verify</option> option
1589 would be set for such a router, causing it to be skipped in verify mode.
1590 </para>
1591 </section>
1592 <section id="SECTrunindrou">
1593 <title>Running an individual router</title>
1594 <para>
1595 <indexterm role="concept">
1596 <primary>router</primary>
1597 <secondary>running details</secondary>
1598 </indexterm>
1599 <indexterm role="concept">
1600 <primary>preconditions</primary>
1601 <secondary>checking</secondary>
1602 </indexterm>
1603 <indexterm role="concept">
1604 <primary>router</primary>
1605 <secondary>result of running</secondary>
1606 </indexterm>
1607 As explained in the example above, a number of preconditions are checked before
1608 running a router. If any are not met, the router is skipped, and the address is
1609 passed to the next router. When all the preconditions on a router <emphasis>are</emphasis> met,
1610 the router is run. What happens next depends on the outcome, which is one of
1611 the following:
1612 </para>
1613 <itemizedlist>
1614 <listitem>
1615 <para>
1616 <emphasis>accept</emphasis>: The router accepts the address, and either assigns it to a
1617 transport or generates one or more <quote>child</quote> addresses. Processing the
1618 original address ceases
1619 <indexterm role="option">
1620 <primary><option>unseen</option></primary>
1621 </indexterm>
1622 unless the <option>unseen</option> option is set on the router. This option
1623 can be used to set up multiple deliveries with different routing (for example,
1624 for keeping archive copies of messages). When <option>unseen</option> is set, the address is
1625 passed to the next router. Normally, however, an <emphasis>accept</emphasis> return marks the
1626 end of routing.
1627 </para>
1628 <para>
1629 Any child addresses generated by the router are processed independently,
1630 starting with the first router by default. It is possible to change this by
1631 setting the <option>redirect_router</option> option to specify which router to start at for
1632 child addresses. Unlike <option>pass_router</option> (see below) the router specified by
1633 <option>redirect_router</option> may be anywhere in the router configuration.
1634 </para>
1635 </listitem>
1636 <listitem>
1637 <para>
1638 <emphasis>pass</emphasis>: The router recognizes the address, but cannot handle it itself. It
1639 requests that the address be passed to another router. By default, the address
1640 is passed to the next router, but this can be changed by setting the
1641 <option>pass_router</option> option. However, (unlike <option>redirect_router</option>) the named router
1642 must be below the current router (to avoid loops).
1643 </para>
1644 </listitem>
1645 <listitem>
1646 <para>
1647 <emphasis>decline</emphasis>: The router declines to accept the address because it does not
1648 recognize it at all. By default, the address is passed to the next router, but
1649 this can be prevented by setting the <option>no_more</option> option. When <option>no_more</option> is
1650 set, all the remaining routers are skipped. In effect, <option>no_more</option> converts
1651 <emphasis>decline</emphasis> into <emphasis>fail</emphasis>.
1652 </para>
1653 </listitem>
1654 <listitem>
1655 <para>
1656 <emphasis>fail</emphasis>: The router determines that the address should fail, and queues it for
1657 the generation of a bounce message. There is no further processing of the
1658 original address unless <option>unseen</option> is set on the router.
1659 </para>
1660 </listitem>
1661 <listitem>
1662 <para>
1663 <emphasis>defer</emphasis>: The router cannot handle the address at the present time. (A
1664 database may be offline, or a DNS lookup may have timed out.) No further
1665 processing of the address happens in this delivery attempt. It is tried again
1666 next time the message is considered for delivery.
1667 </para>
1668 </listitem>
1669 <listitem>
1670 <para>
1671 <emphasis>error</emphasis>: There is some error in the router (for example, a syntax error in
1672 its configuration). The action is as for defer.
1673 </para>
1674 </listitem>
1675 </itemizedlist>
1676 <para>
1677 If an address reaches the end of the routers without having been accepted by
1678 any of them, it is bounced as unrouteable. The default error message in this
1679 situation is <quote>unrouteable address</quote>, but you can set your own message by
1680 making use of the <option>cannot_route_message</option> option. This can be set for any
1681 router; the value from the last router that <quote>saw</quote> the address is used.
1682 </para>
1683 <para>
1684 Sometimes while routing you want to fail a delivery when some conditions are
1685 met but others are not, instead of passing the address on for further routing.
1686 You can do this by having a second router that explicitly fails the delivery
1687 when the relevant conditions are met. The <command>redirect</command> router has a <quote>fail</quote>
1688 facility for this purpose.
1689 </para>
1690 </section>
1691 <section id="SECID17">
1692 <title>Duplicate addresses</title>
1693 <para>
1694 <indexterm role="concept">
1695 <primary>case of local parts</primary>
1696 </indexterm>
1697 <indexterm role="concept">
1698 <primary>address duplicate, discarding</primary>
1699 </indexterm>
1700 <indexterm role="concept">
1701 <primary>duplicate addresses</primary>
1702 </indexterm>
1703 Once routing is complete, Exim scans the addresses that are assigned to local
1704 and remote transports and discards any duplicates that it finds. During this
1705 check, local parts are treated case-sensitively. This happens only when
1706 actually delivering a message; when testing routers with <option>-bt</option>, all the
1707 routed addresses are shown.
1708 </para>
1709 </section>
1710 <section id="SECTrouprecon">
1711 <title>Router preconditions</title>
1712 <para>
1713 <indexterm role="concept">
1714 <primary>router</primary>
1715 <secondary>preconditions, order of processing</secondary>
1716 </indexterm>
1717 <indexterm role="concept">
1718 <primary>preconditions</primary>
1719 <secondary>order of processing</secondary>
1720 </indexterm>
1721 The preconditions that are tested for each router are listed below, in the
1722 order in which they are tested. The individual configuration options are
1723 described in more detail in chapter <xref linkend="CHAProutergeneric"/>.
1724 </para>
1725 <itemizedlist>
1726 <listitem>
1727 <para>
1728 <indexterm role="concept">
1729 <primary>affix</primary>
1730 <secondary>router precondition</secondary>
1731 </indexterm>
1732 The <option>local_part_prefix</option> and <option>local_part_suffix</option> options can specify that
1733 the local parts handled by the router may or must have certain prefixes and/or
1734 suffixes. If a mandatory affix (prefix or suffix) is not present, the router is
1735 skipped. These conditions are tested first. When an affix is present, it is
1736 removed from the local part before further processing, including the evaluation
1737 of any other conditions.
1738 </para>
1739 </listitem>
1740 <listitem>
1741 <para>
1742 Routers can be designated for use only when not verifying an address, that is,
1743 only when routing it for delivery (or testing its delivery routing). If the
1744 <option>verify</option> option is set false, the router is skipped when Exim is verifying an
1745 address.
1746 Setting the <option>verify</option> option actually sets two options, <option>verify_sender</option> and
1747 <option>verify_recipient</option>, which independently control the use of the router for
1748 sender and recipient verification. You can set these options directly if
1749 you want a router to be used for only one type of verification.
1750 Note that cutthrough delivery is classed as a recipient verification for this purpose.
1751 </para>
1752 </listitem>
1753 <listitem>
1754 <para>
1755 If the <option>address_test</option> option is set false, the router is skipped when Exim is
1756 run with the <option>-bt</option> option to test an address routing. This can be helpful
1757 when the first router sends all new messages to a scanner of some sort; it
1758 makes it possible to use <option>-bt</option> to test subsequent delivery routing without
1759 having to simulate the effect of the scanner.
1760 </para>
1761 </listitem>
1762 <listitem>
1763 <para>
1764 Routers can be designated for use only when verifying an address, as
1765 opposed to routing it for delivery. The <option>verify_only</option> option controls this.
1766 Again, cutthrough delivery counts as a verification.
1767 </para>
1768 </listitem>
1769 <listitem>
1770 <para>
1771 Individual routers can be explicitly skipped when running the routers to
1772 check an address given in the SMTP EXPN command (see the <option>expn</option> option).
1773 </para>
1774 </listitem>
1775 <listitem>
1776 <para>
1777 If the <option>domains</option> option is set, the domain of the address must be in the set
1778 of domains that it defines.
1779 </para>
1780 </listitem>
1781 <listitem>
1782 <para>
1783 <indexterm role="variable">
1784 <primary><varname>$local_part_prefix</varname></primary>
1785 </indexterm>
1786 <indexterm role="variable">
1787 <primary><varname>$local_part</varname></primary>
1788 </indexterm>
1789 <indexterm role="variable">
1790 <primary><varname>$local_part_suffix</varname></primary>
1791 </indexterm>
1792 <indexterm role="concept">
1793 <primary>affix</primary>
1794 <secondary>router precondition</secondary>
1795 </indexterm>
1796 If the <option>local_parts</option> option is set, the local part of the address must be in
1797 the set of local parts that it defines. If <option>local_part_prefix</option> or
1798 <option>local_part_suffix</option> is in use, the prefix or suffix is removed from the local
1799 part before this check. If you want to do precondition tests on local parts
1800 that include affixes, you can do so by using a <option>condition</option> option (see below)
1801 that uses the variables <varname>$local_part</varname>, <varname>$local_part_prefix</varname>, and
1802 <varname>$local_part_suffix</varname> as necessary.
1803 </para>
1804 </listitem>
1805 <listitem>
1806 <para>
1807 <indexterm role="variable">
1808 <primary><varname>$local_user_uid</varname></primary>
1809 </indexterm>
1810 <indexterm role="variable">
1811 <primary><varname>$local_user_gid</varname></primary>
1812 </indexterm>
1813 <indexterm role="variable">
1814 <primary><varname>$home</varname></primary>
1815 </indexterm>
1816 If the <option>check_local_user</option> option is set, the local part must be the name of
1817 an account on the local host. If this check succeeds, the uid and gid of the
1818 local user are placed in <varname>$local_user_uid</varname> and <varname>$local_user_gid</varname> and the
1819 user&#x2019;s home directory is placed in <varname>$home</varname>; these values can be used in the
1820 remaining preconditions.
1821 </para>
1822 </listitem>
1823 <listitem>
1824 <para>
1825 If the <option>router_home_directory</option> option is set, it is expanded at this point,
1826 because it overrides the value of <varname>$home</varname>. If this expansion were left till
1827 later, the value of <varname>$home</varname> as set by <option>check_local_user</option> would be used in
1828 subsequent tests. Having two different values of <varname>$home</varname> in the same router
1829 could lead to confusion.
1830 </para>
1831 </listitem>
1832 <listitem>
1833 <para>
1834 If the <option>senders</option> option is set, the envelope sender address must be in the
1835 set of addresses that it defines.
1836 </para>
1837 </listitem>
1838 <listitem>
1839 <para>
1840 If the <option>require_files</option> option is set, the existence or non-existence of
1841 specified files is tested.
1842 </para>
1843 </listitem>
1844 <listitem>
1845 <para>
1846 <indexterm role="concept">
1847 <primary>customizing</primary>
1848 <secondary>precondition</secondary>
1849 </indexterm>
1850 If the <option>condition</option> option is set, it is evaluated and tested. This option
1851 uses an expanded string to allow you to set up your own custom preconditions.
1852 Expanded strings are described in chapter <xref linkend="CHAPexpand"/>.
1853 </para>
1854 </listitem>
1855 </itemizedlist>
1856 <para>
1857 Note that <option>require_files</option> comes near the end of the list, so you cannot use
1858 it to check for the existence of a file in which to lookup up a domain, local
1859 part, or sender. However, as these options are all expanded, you can use the
1860 <option>exists</option> expansion condition to make such tests within each condition. The
1861 <option>require_files</option> option is intended for checking files that the router may be
1862 going to use internally, or which are needed by a specific transport (for
1863 example, <filename>.procmailrc</filename>).
1864 </para>
1865 </section>
1866 <section id="SECID18">
1867 <title>Delivery in detail</title>
1868 <para>
1869 <indexterm role="concept">
1870 <primary>delivery</primary>
1871 <secondary>in detail</secondary>
1872 </indexterm>
1873 When a message is to be delivered, the sequence of events is as follows:
1874 </para>
1875 <itemizedlist>
1876 <listitem>
1877 <para>
1878 If a system-wide filter file is specified, the message is passed to it. The
1879 filter may add recipients to the message, replace the recipients, discard the
1880 message, cause a new message to be generated, or cause the message delivery to
1881 fail. The format of the system filter file is the same as for Exim user filter
1882 files, described in the separate document entitled <emphasis>Exim&#x2019;s interfaces to mail
1883 filtering</emphasis>.
1884 <indexterm role="concept">
1885 <primary>Sieve filter</primary>
1886 <secondary>not available for system filter</secondary>
1887 </indexterm>
1888 (<emphasis role="bold">Note</emphasis>: Sieve cannot be used for system filter files.)
1889 </para>
1890 <para>
1891 Some additional features are available in system filters &ndash; see chapter
1892 <xref linkend="CHAPsystemfilter"/> for details. Note that a message is passed to the system
1893 filter only once per delivery attempt, however many recipients it has. However,
1894 if there are several delivery attempts because one or more addresses could not
1895 be immediately delivered, the system filter is run each time. The filter
1896 condition <option>first_delivery</option> can be used to detect the first run of the system
1897 filter.
1898 </para>
1899 </listitem>
1900 <listitem>
1901 <para>
1902 Each recipient address is offered to each configured router, in turn, subject to
1903 its preconditions, until one is able to handle it. If no router can handle the
1904 address, that is, if they all decline, the address is failed. Because routers
1905 can be targeted at particular domains, several locally handled domains can be
1906 processed entirely independently of each other.
1907 </para>
1908 </listitem>
1909 <listitem>
1910 <para>
1911 <indexterm role="concept">
1912 <primary>routing</primary>
1913 <secondary>loops in</secondary>
1914 </indexterm>
1915 <indexterm role="concept">
1916 <primary>loop</primary>
1917 <secondary>while routing</secondary>
1918 </indexterm>
1919 A router that accepts an address may assign it to a local or a remote
1920 transport. However, the transport is not run at this time. Instead, the address
1921 is placed on a list for the particular transport, which will be run later.
1922 Alternatively, the router may generate one or more new addresses (typically
1923 from alias, forward, or filter files). New addresses are fed back into this
1924 process from the top, but in order to avoid loops, a router ignores any address
1925 which has an identically-named ancestor that was processed by itself.
1926 </para>
1927 </listitem>
1928 <listitem>
1929 <para>
1930 When all the routing has been done, addresses that have been successfully
1931 handled are passed to their assigned transports. When local transports are
1932 doing real local deliveries, they handle only one address at a time, but if a
1933 local transport is being used as a pseudo-remote transport (for example, to
1934 collect batched SMTP messages for transmission by some other means) multiple
1935 addresses can be handled. Remote transports can always handle more than one
1936 address at a time, but can be configured not to do so, or to restrict multiple
1937 addresses to the same domain.
1938 </para>
1939 </listitem>
1940 <listitem>
1941 <para>
1942 Each local delivery to a file or a pipe runs in a separate process under a
1943 non-privileged uid, and these deliveries are run one at a time. Remote
1944 deliveries also run in separate processes, normally under a uid that is private
1945 to Exim (<quote>the Exim user</quote>), but in this case, several remote deliveries can be
1946 run in parallel. The maximum number of simultaneous remote deliveries for any
1947 one message is set by the <option>remote_max_parallel</option> option.
1948 The order in which deliveries are done is not defined, except that all local
1949 deliveries happen before any remote deliveries.
1950 </para>
1951 </listitem>
1952 <listitem>
1953 <para>
1954 <indexterm role="concept">
1955 <primary>queue runner</primary>
1956 </indexterm>
1957 When it encounters a local delivery during a queue run, Exim checks its retry
1958 database to see if there has been a previous temporary delivery failure for the
1959 address before running the local transport. If there was a previous failure,
1960 Exim does not attempt a new delivery until the retry time for the address is
1961 reached. However, this happens only for delivery attempts that are part of a
1962 queue run. Local deliveries are always attempted when delivery immediately
1963 follows message reception, even if retry times are set for them. This makes for
1964 better behaviour if one particular message is causing problems (for example,
1965 causing quota overflow, or provoking an error in a filter file).
1966 </para>
1967 </listitem>
1968 <listitem>
1969 <para>
1970 <indexterm role="concept">
1971 <primary>delivery</primary>
1972 <secondary>retry in remote transports</secondary>
1973 </indexterm>
1974 Remote transports do their own retry handling, since an address may be
1975 deliverable to one of a number of hosts, each of which may have a different
1976 retry time. If there have been previous temporary failures and no host has
1977 reached its retry time, no delivery is attempted, whether in a queue run or
1978 not. See chapter <xref linkend="CHAPretry"/> for details of retry strategies.
1979 </para>
1980 </listitem>
1981 <listitem>
1982 <para>
1983 If there were any permanent errors, a bounce message is returned to an
1984 appropriate address (the sender in the common case), with details of the error
1985 for each failing address. Exim can be configured to send copies of bounce
1986 messages to other addresses.
1987 </para>
1988 </listitem>
1989 <listitem>
1990 <para>
1991 <indexterm role="concept">
1992 <primary>delivery</primary>
1993 <secondary>deferral</secondary>
1994 </indexterm>
1995 If one or more addresses suffered a temporary failure, the message is left on
1996 the queue, to be tried again later. Delivery of these addresses is said to be
1997 <emphasis>deferred</emphasis>.
1998 </para>
1999 </listitem>
2000 <listitem>
2001 <para>
2002 When all the recipient addresses have either been delivered or bounced,
2003 handling of the message is complete. The spool files and message log are
2004 deleted, though the message log can optionally be preserved if required.
2005 </para>
2006 </listitem>
2007 </itemizedlist>
2008 </section>
2009 <section id="SECID19">
2010 <title>Retry mechanism</title>
2011 <para>
2012 <indexterm role="concept">
2013 <primary>delivery</primary>
2014 <secondary>retry mechanism</secondary>
2015 </indexterm>
2016 <indexterm role="concept">
2017 <primary>retry</primary>
2018 <secondary>description of mechanism</secondary>
2019 </indexterm>
2020 <indexterm role="concept">
2021 <primary>queue runner</primary>
2022 </indexterm>
2023 Exim&#x2019;s mechanism for retrying messages that fail to get delivered at the first
2024 attempt is the queue runner process. You must either run an Exim daemon that
2025 uses the <option>-q</option> option with a time interval to start queue runners at regular
2026 intervals or use some other means (such as <emphasis>cron</emphasis>) to start them. If you do
2027 not arrange for queue runners to be run, messages that fail temporarily at the
2028 first attempt will remain in your queue forever. A queue runner process works
2029 its way through the queue, one message at a time, trying each delivery that has
2030 passed its retry time.
2031 You can run several queue runners at once.
2032 </para>
2033 <para>
2034 Exim uses a set of configured rules to determine when next to retry the failing
2035 address (see chapter <xref linkend="CHAPretry"/>). These rules also specify when Exim
2036 should give up trying to deliver to the address, at which point it generates a
2037 bounce message. If no retry rules are set for a particular host, address, and
2038 error combination, no retries are attempted, and temporary errors are treated
2039 as permanent.
2040 </para>
2041 </section>
2042 <section id="SECID20">
2043 <title>Temporary delivery failure</title>
2044 <para>
2045 <indexterm role="concept">
2046 <primary>delivery</primary>
2047 <secondary>temporary failure</secondary>
2048 </indexterm>
2049 There are many reasons why a message may not be immediately deliverable to a
2050 particular address. Failure to connect to a remote machine (because it, or the
2051 connection to it, is down) is one of the most common. Temporary failures may be
2052 detected during routing as well as during the transport stage of delivery.
2053 Local deliveries may be delayed if NFS files are unavailable, or if a mailbox
2054 is on a file system where the user is over quota. Exim can be configured to
2055 impose its own quotas on local mailboxes; where system quotas are set they will
2056 also apply.
2057 </para>
2058 <para>
2059 If a host is unreachable for a period of time, a number of messages may be
2060 waiting for it by the time it recovers, and sending them in a single SMTP
2061 connection is clearly beneficial. Whenever a delivery to a remote host is
2062 deferred,
2063 <indexterm role="concept">
2064 <primary>hints database</primary>
2065 <secondary>deferred deliveries</secondary>
2066 </indexterm>
2067 Exim makes a note in its hints database, and whenever a successful
2068 SMTP delivery has happened, it looks to see if any other messages are waiting
2069 for the same host. If any are found, they are sent over the same SMTP
2070 connection, subject to a configuration limit as to the maximum number in any
2071 one connection.
2072 </para>
2073 </section>
2074 <section id="SECID21">
2075 <title>Permanent delivery failure</title>
2076 <para>
2077 <indexterm role="concept">
2078 <primary>delivery</primary>
2079 <secondary>permanent failure</secondary>
2080 </indexterm>
2081 <indexterm role="concept">
2082 <primary>bounce message</primary>
2083 <secondary>when generated</secondary>
2084 </indexterm>
2085 When a message cannot be delivered to some or all of its intended recipients, a
2086 bounce message is generated. Temporary delivery failures turn into permanent
2087 errors when their timeout expires. All the addresses that fail in a given
2088 delivery attempt are listed in a single message. If the original message has
2089 many recipients, it is possible for some addresses to fail in one delivery
2090 attempt and others to fail subsequently, giving rise to more than one bounce
2091 message. The wording of bounce messages can be customized by the administrator.
2092 See chapter <xref linkend="CHAPemsgcust"/> for details.
2093 </para>
2094 <para>
2095 <indexterm role="concept">
2096 <primary><emphasis>X-Failed-Recipients:</emphasis> header line</primary>
2097 </indexterm>
2098 Bounce messages contain an <emphasis>X-Failed-Recipients:</emphasis> header line that lists the
2099 failed addresses, for the benefit of programs that try to analyse such messages
2100 automatically.
2101 </para>
2102 <para>
2103 <indexterm role="concept">
2104 <primary>bounce message</primary>
2105 <secondary>recipient of</secondary>
2106 </indexterm>
2107 A bounce message is normally sent to the sender of the original message, as
2108 obtained from the message&#x2019;s envelope. For incoming SMTP messages, this is the
2109 address given in the MAIL command. However, when an address is expanded via a
2110 forward or alias file, an alternative address can be specified for delivery
2111 failures of the generated addresses. For a mailing list expansion (see section
2112 <xref linkend="SECTmailinglists"/>) it is common to direct bounce messages to the manager
2113 of the list.
2114 </para>
2115 </section>
2116 <section id="SECID22">
2117 <title>Failures to deliver bounce messages</title>
2118 <para>
2119 <indexterm role="concept">
2120 <primary>bounce message</primary>
2121 <secondary>failure to deliver</secondary>
2122 </indexterm>
2123 If a bounce message (either locally generated or received from a remote host)
2124 itself suffers a permanent delivery failure, the message is left in the queue,
2125 but it is frozen, awaiting the attention of an administrator. There are options
2126 that can be used to make Exim discard such failed messages, or to keep them
2127 for only a short time (see <option>timeout_frozen_after</option> and
2128 <option>ignore_bounce_errors_after</option>).
2129 </para>
2130 </section>
2131 </chapter>
2132
2133 <chapter id="CHID3">
2134 <title>Building and installing Exim</title>
2135 <para>
2136 <indexterm role="concept" id="IIDbuex" class="startofrange">
2137 <primary>building Exim</primary>
2138 </indexterm>
2139 </para>
2140 <section id="SECID23">
2141 <title>Unpacking</title>
2142 <para>
2143 Exim is distributed as a gzipped or bzipped tar file which, when unpacked,
2144 creates a directory with the name of the current release (for example,
2145 <filename>exim-4.92.3</filename>) into which the following files are placed:
2146 </para>
2147 <informaltable frame="none">
2148 <tgroup cols="2" colsep="0" rowsep="0">
2149 <colspec colwidth="140pt" align="left"/>
2150 <colspec colwidth="254pt" align="left"/>
2151 <tbody>
2152 <row>
2153 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>ACKNOWLEDGMENTS</filename></entry>
2154 <entry>contains some acknowledgments</entry>
2155 </row>
2156 <row>
2157 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>CHANGES</filename></entry>
2158 <entry>contains a reference to where changes are documented</entry>
2159 </row>
2160 <row>
2161 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>LICENCE</filename></entry>
2162 <entry>the GNU General Public Licence</entry>
2163 </row>
2164 <row>
2165 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>Makefile</filename></entry>
2166 <entry>top-level make file</entry>
2167 </row>
2168 <row>
2169 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>NOTICE</filename></entry>
2170 <entry>conditions for the use of Exim</entry>
2171 </row>
2172 <row>
2173 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>README</filename></entry>
2174 <entry>list of files, directories and simple build instructions</entry>
2175 </row>
2176 </tbody>
2177 </tgroup>
2178 </informaltable>
2179 <para>
2180 Other files whose names begin with <filename>README</filename> may also be present. The
2181 following subdirectories are created:
2182 </para>
2183 <informaltable frame="none">
2184 <tgroup cols="2" colsep="0" rowsep="0">
2185 <colspec colwidth="140pt" align="left"/>
2186 <colspec colwidth="254pt" align="left"/>
2187 <tbody>
2188 <row>
2189 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>Local</filename></entry>
2190 <entry>an empty directory for local configuration files</entry>
2191 </row>
2192 <row>
2193 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>OS</filename></entry>
2194 <entry>OS-specific files</entry>
2195 </row>
2196 <row>
2197 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>doc</filename></entry>
2198 <entry>documentation files</entry>
2199 </row>
2200 <row>
2201 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>exim_monitor</filename></entry>
2202 <entry>source files for the Exim monitor</entry>
2203 </row>
2204 <row>
2205 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>scripts</filename></entry>
2206 <entry>scripts used in the build process</entry>
2207 </row>
2208 <row>
2209 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>src</filename></entry>
2210 <entry>remaining source files</entry>
2211 </row>
2212 <row>
2213 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>util</filename></entry>
2214 <entry>independent utilities</entry>
2215 </row>
2216 </tbody>
2217 </tgroup>
2218 </informaltable>
2219 <para>
2220 The main utility programs are contained in the <filename>src</filename> directory and are built
2221 with the Exim binary. The <filename>util</filename> directory contains a few optional scripts
2222 that may be useful to some sites.
2223 </para>
2224 </section>
2225 <section id="SECID24">
2226 <title>Multiple machine architectures and operating systems</title>
2227 <para>
2228 <indexterm role="concept">
2229 <primary>building Exim</primary>
2230 <secondary>multiple OS/architectures</secondary>
2231 </indexterm>
2232 The building process for Exim is arranged to make it easy to build binaries for
2233 a number of different architectures and operating systems from the same set of
2234 source files. Compilation does not take place in the <filename>src</filename> directory.
2235 Instead, a <emphasis>build directory</emphasis> is created for each architecture and operating
2236 system.
2237 <indexterm role="concept">
2238 <primary>symbolic link</primary>
2239 <secondary>to build directory</secondary>
2240 </indexterm>
2241 Symbolic links to the sources are installed in this directory, which is where
2242 the actual building takes place. In most cases, Exim can discover the machine
2243 architecture and operating system for itself, but the defaults can be
2244 overridden if necessary.
2245 <indexterm role="concept">
2246 <primary>compiler</primary>
2247 <secondary>requirements</secondary>
2248 </indexterm>
2249 <indexterm role="concept">
2250 <primary>compiler</primary>
2251 <secondary>version</secondary>
2252 </indexterm>
2253 A C99-capable compiler will be required for the build.
2254 </para>
2255 </section>
2256 <section id="SECTpcre">
2257 <title>PCRE library</title>
2258 <para>
2259 <indexterm role="concept">
2260 <primary>PCRE library</primary>
2261 </indexterm>
2262 Exim no longer has an embedded PCRE library as the vast majority of
2263 modern systems include PCRE as a system library, although you may need to
2264 install the PCRE package or the PCRE development package for your operating
2265 system. If your system has a normal PCRE installation the Exim build
2266 process will need no further configuration. If the library or the
2267 headers are in an unusual location you will need to either set the PCRE_LIBS
2268 and INCLUDE directives appropriately,
2269 or set PCRE_CONFIG=yes to use the installed <command>pcre-config</command> command.
2270 If your operating system has no
2271 PCRE support then you will need to obtain and build the current PCRE
2272 from <emphasis role="bold"><ulink url="ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/">ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/</ulink></emphasis>.
2273 More information on PCRE is available at <emphasis role="bold"><ulink url="https://www.pcre.org/">https://www.pcre.org/</ulink></emphasis>.
2274 </para>
2275 </section>
2276 <section id="SECTdb">
2277 <title>DBM libraries</title>
2278 <para>
2279 <indexterm role="concept">
2280 <primary>DBM libraries</primary>
2281 <secondary>discussion of</secondary>
2282 </indexterm>
2283 <indexterm role="concept">
2284 <primary>hints database</primary>
2285 <secondary>DBM files used for</secondary>
2286 </indexterm>
2287 Even if you do not use any DBM files in your configuration, Exim still needs a
2288 DBM library in order to operate, because it uses indexed files for its hints
2289 databases. Unfortunately, there are a number of DBM libraries in existence, and
2290 different operating systems often have different ones installed.
2291 </para>
2292 <para>
2293 <indexterm role="concept">
2294 <primary>Solaris</primary>
2295 <secondary>DBM library for</secondary>
2296 </indexterm>
2297 <indexterm role="concept">
2298 <primary>IRIX, DBM library for</primary>
2299 </indexterm>
2300 <indexterm role="concept">
2301 <primary>BSD, DBM library for</primary>
2302 </indexterm>
2303 <indexterm role="concept">
2304 <primary>Linux, DBM library for</primary>
2305 </indexterm>
2306 If you are using Solaris, IRIX, one of the modern BSD systems, or a modern
2307 Linux distribution, the DBM configuration should happen automatically, and you
2308 may be able to ignore this section. Otherwise, you may have to learn more than
2309 you would like about DBM libraries from what follows.
2310 </para>
2311 <para>
2312 <indexterm role="concept">
2313 <primary><emphasis>ndbm</emphasis> DBM library</primary>
2314 </indexterm>
2315 Licensed versions of Unix normally contain a library of DBM functions operating
2316 via the <emphasis>ndbm</emphasis> interface, and this is what Exim expects by default. Free
2317 versions of Unix seem to vary in what they contain as standard. In particular,
2318 some early versions of Linux have no default DBM library, and different
2319 distributors have chosen to bundle different libraries with their packaged
2320 versions. However, the more recent releases seem to have standardized on the
2321 Berkeley DB library.
2322 </para>
2323 <para>
2324 Different DBM libraries have different conventions for naming the files they
2325 use. When a program opens a file called <filename>dbmfile</filename>, there are several
2326 possibilities:
2327 </para>
2328 <orderedlist numeration="arabic">
2329 <listitem>
2330 <para>
2331 A traditional <emphasis>ndbm</emphasis> implementation, such as that supplied as part of
2332 Solaris, operates on two files called <filename>dbmfile.dir</filename> and <filename>dbmfile.pag</filename>.
2333 </para>
2334 </listitem>
2335 <listitem>
2336 <para>
2337 <indexterm role="concept">
2338 <primary><emphasis>gdbm</emphasis> DBM library</primary>
2339 </indexterm>
2340 The GNU library, <emphasis>gdbm</emphasis>, operates on a single file. If used via its <emphasis>ndbm</emphasis>
2341 compatibility interface it makes two different hard links to it with names
2342 <filename>dbmfile.dir</filename> and <filename>dbmfile.pag</filename>, but if used via its native interface, the
2343 filename is used unmodified.
2344 </para>
2345 </listitem>
2346 <listitem>
2347 <para>
2348 <indexterm role="concept">
2349 <primary>Berkeley DB library</primary>
2350 </indexterm>
2351 The Berkeley DB package, if called via its <emphasis>ndbm</emphasis> compatibility interface,
2352 operates on a single file called <filename>dbmfile.db</filename>, but otherwise looks to the
2353 programmer exactly the same as the traditional <emphasis>ndbm</emphasis> implementation.
2354 </para>
2355 </listitem>
2356 <listitem>
2357 <para>
2358 If the Berkeley package is used in its native mode, it operates on a single
2359 file called <filename>dbmfile</filename>; the programmer&#x2019;s interface is somewhat different to
2360 the traditional <emphasis>ndbm</emphasis> interface.
2361 </para>
2362 </listitem>
2363 <listitem>
2364 <para>
2365 To complicate things further, there are several very different versions of the
2366 Berkeley DB package. Version 1.85 was stable for a very long time, releases
2367 2.<emphasis>x</emphasis> and 3.<emphasis>x</emphasis> were current for a while, but the latest versions when Exim last revamped support were numbered 4.<emphasis>x</emphasis>.
2368 Maintenance of some of the earlier releases has ceased. All versions of
2369 Berkeley DB could be obtained from
2370 <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
2371 page with far newer versions listed.
2372 It is probably wise to plan to move your storage configurations away from
2373 Berkeley DB format, as today there are smaller and simpler alternatives more
2374 suited to Exim&#x2019;s usage model.
2375 </para>
2376 </listitem>
2377 <listitem>
2378 <para>
2379 <indexterm role="concept">
2380 <primary><emphasis>tdb</emphasis> DBM library</primary>
2381 </indexterm>
2382 Yet another DBM library, called <emphasis>tdb</emphasis>, is available from
2383 <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
2384 operates on a single file.
2385 </para>
2386 </listitem>
2387 </orderedlist>
2388 <para>
2389 <indexterm role="concept">
2390 <primary>USE_DB</primary>
2391 </indexterm>
2392 <indexterm role="concept">
2393 <primary>DBM libraries</primary>
2394 <secondary>configuration for building</secondary>
2395 </indexterm>
2396 Exim and its utilities can be compiled to use any of these interfaces. In order
2397 to use any version of the Berkeley DB package in native mode, you must set
2398 USE_DB in an appropriate configuration file (typically
2399 <filename>Local/Makefile</filename>). For example:
2400 </para>
2401 <literallayout class="monospaced">
2402 USE_DB=yes
2403 </literallayout>
2404 <para>
2405 Similarly, for gdbm you set USE_GDBM, and for tdb you set USE_TDB. An
2406 error is diagnosed if you set more than one of these.
2407 </para>
2408 <para>
2409 At the lowest level, the build-time configuration sets none of these options,
2410 thereby assuming an interface of type (1). However, some operating system
2411 configuration files (for example, those for the BSD operating systems and
2412 Linux) assume type (4) by setting USE_DB as their default, and the
2413 configuration files for Cygwin set USE_GDBM. Anything you set in
2414 <filename>Local/Makefile</filename>, however, overrides these system defaults.
2415 </para>
2416 <para>
2417 As well as setting USE_DB, USE_GDBM, or USE_TDB, it may also be
2418 necessary to set DBMLIB, to cause inclusion of the appropriate library, as
2419 in one of these lines:
2420 </para>
2421 <literallayout class="monospaced">
2422 DBMLIB = -ldb
2423 DBMLIB = -ltdb
2424 </literallayout>
2425 <para>
2426 Settings like that will work if the DBM library is installed in the standard
2427 place. Sometimes it is not, and the library&#x2019;s header file may also not be in
2428 the default path. You may need to set INCLUDE to specify where the header
2429 file is, and to specify the path to the library more fully in DBMLIB, as in
2430 this example:
2431 </para>
2432 <literallayout class="monospaced">
2433 INCLUDE=-I/usr/local/include/db-4.1
2434 DBMLIB=/usr/local/lib/db-4.1/libdb.a
2435 </literallayout>
2436 <para>
2437 There is further detailed discussion about the various DBM libraries in the
2438 file <filename>doc/dbm.discuss.txt</filename> in the Exim distribution.
2439 </para>
2440 </section>
2441 <section id="SECID25">
2442 <title>Pre-building configuration</title>
2443 <para>
2444 <indexterm role="concept">
2445 <primary>building Exim</primary>
2446 <secondary>pre-building configuration</secondary>
2447 </indexterm>
2448 <indexterm role="concept">
2449 <primary>configuration for building Exim</primary>
2450 </indexterm>
2451 <indexterm role="concept">
2452 <primary><filename>Local/Makefile</filename></primary>
2453 </indexterm>
2454 <indexterm role="concept">
2455 <primary><filename>src/EDITME</filename></primary>
2456 </indexterm>
2457 Before building Exim, a local configuration file that specifies options
2458 independent of any operating system has to be created with the name
2459 <filename>Local/Makefile</filename>. A template for this file is supplied as the file
2460 <filename>src/EDITME</filename>, and it contains full descriptions of all the option settings
2461 therein. These descriptions are therefore not repeated here. If you are
2462 building Exim for the first time, the simplest thing to do is to copy
2463 <filename>src/EDITME</filename> to <filename>Local/Makefile</filename>, then read it and edit it appropriately.
2464 </para>
2465 <para>
2466 There are three settings that you must supply, because Exim will not build
2467 without them. They are the location of the runtime configuration file
2468 (CONFIGURE_FILE), the directory in which Exim binaries will be installed
2469 (BIN_DIRECTORY), and the identity of the Exim user (EXIM_USER and
2470 maybe EXIM_GROUP as well). The value of CONFIGURE_FILE can in fact be
2471 a colon-separated list of filenames; Exim uses the first of them that exists.
2472 </para>
2473 <para>
2474 There are a few other parameters that can be specified either at build time or
2475 at runtime, to enable the same binary to be used on a number of different
2476 machines. However, if the locations of Exim&#x2019;s spool directory and log file
2477 directory (if not within the spool directory) are fixed, it is recommended that
2478 you specify them in <filename>Local/Makefile</filename> instead of at runtime, so that errors
2479 detected early in Exim&#x2019;s execution (such as a malformed configuration file) can
2480 be logged.
2481 </para>
2482 <para>
2483 <indexterm role="concept">
2484 <primary>content scanning</primary>
2485 <secondary>specifying at build time</secondary>
2486 </indexterm>
2487 Exim&#x2019;s interfaces for calling virus and spam scanning software directly from
2488 access control lists are not compiled by default. If you want to include these
2489 facilities, you need to set
2490 </para>
2491 <literallayout class="monospaced">
2492 WITH_CONTENT_SCAN=yes
2493 </literallayout>
2494 <para>
2495 in your <filename>Local/Makefile</filename>. For details of the facilities themselves, see
2496 chapter <xref linkend="CHAPexiscan"/>.
2497 </para>
2498 <para>
2499 <indexterm role="concept">
2500 <primary><filename>Local/eximon.conf</filename></primary>
2501 </indexterm>
2502 <indexterm role="concept">
2503 <primary><filename>exim_monitor/EDITME</filename></primary>
2504 </indexterm>
2505 If you are going to build the Exim monitor, a similar configuration process is
2506 required. The file <filename>exim_monitor/EDITME</filename> must be edited appropriately for
2507 your installation and saved under the name <filename>Local/eximon.conf</filename>. If you are
2508 happy with the default settings described in <filename>exim_monitor/EDITME</filename>,
2509 <filename>Local/eximon.conf</filename> can be empty, but it must exist.
2510 </para>
2511 <para>
2512 This is all the configuration that is needed in straightforward cases for known
2513 operating systems. However, the building process is set up so that it is easy
2514 to override options that are set by default or by operating-system-specific
2515 configuration files, for example, to change the C compiler, which
2516 defaults to <option>gcc</option>. See section <xref linkend="SECToverride"/> below for details of how to
2517 do this.
2518 </para>
2519 </section>
2520 <section id="SECID26">
2521 <title>Support for iconv()</title>
2522 <para>
2523 <indexterm role="concept">
2524 <primary><function>iconv()</function> support</primary>
2525 </indexterm>
2526 <indexterm role="concept">
2527 <primary>RFC 2047</primary>
2528 </indexterm>
2529 The contents of header lines in messages may be encoded according to the rules
2530 described RFC 2047. This makes it possible to transmit characters that are not
2531 in the ASCII character set, and to label them as being in a particular
2532 character set. When Exim is inspecting header lines by means of the <option>$h_</option>
2533 mechanism, it decodes them, and translates them into a specified character set
2534 (default is set at build time). The translation is possible only if the operating system
2535 supports the <function>iconv()</function> function.
2536 </para>
2537 <para>
2538 However, some of the operating systems that supply <function>iconv()</function> do not support
2539 very many conversions. The GNU <option>libiconv</option> library (available from
2540 <emphasis role="bold"><ulink url="https://www.gnu.org/software/libiconv/">https://www.gnu.org/software/libiconv/</ulink></emphasis>) can be installed on such
2541 systems to remedy this deficiency, as well as on systems that do not supply
2542 <function>iconv()</function> at all. After installing <option>libiconv</option>, you should add
2543 </para>
2544 <literallayout class="monospaced">
2545 HAVE_ICONV=yes
2546 </literallayout>
2547 <para>
2548 to your <filename>Local/Makefile</filename> and rebuild Exim.
2549 </para>
2550 </section>
2551 <section id="SECTinctlsssl">
2552 <title>Including TLS/SSL encryption support</title>
2553 <para>
2554 <indexterm role="concept">
2555 <primary>TLS</primary>
2556 <secondary>including support for TLS</secondary>
2557 </indexterm>
2558 <indexterm role="concept">
2559 <primary>encryption</primary>
2560 <secondary>including support for</secondary>
2561 </indexterm>
2562 <indexterm role="concept">
2563 <primary>SUPPORT_TLS</primary>
2564 </indexterm>
2565 <indexterm role="concept">
2566 <primary>OpenSSL</primary>
2567 <secondary>building Exim with</secondary>
2568 </indexterm>
2569 <indexterm role="concept">
2570 <primary>GnuTLS</primary>
2571 <secondary>building Exim with</secondary>
2572 </indexterm>
2573 Exim can be built to support encrypted SMTP connections, using the STARTTLS
2574 command as per RFC 2487. It can also support legacy clients that expect to
2575 start a TLS session immediately on connection to a non-standard port (see the
2576 <option>tls_on_connect_ports</option> runtime option and the <option>-tls-on-connect</option> command
2577 line option).
2578 </para>
2579 <para>
2580 If you want to build Exim with TLS support, you must first install either the
2581 OpenSSL or GnuTLS library. There is no cryptographic code in Exim itself for
2582 implementing SSL.
2583 </para>
2584 <para>
2585 If OpenSSL is installed, you should set
2586 </para>
2587 <literallayout class="monospaced">
2588 SUPPORT_TLS=yes
2589 TLS_LIBS=-lssl -lcrypto
2590 </literallayout>
2591 <para>
2592 in <filename>Local/Makefile</filename>. You may also need to specify the locations of the
2593 OpenSSL library and include files. For example:
2594 </para>
2595 <literallayout class="monospaced">
2596 SUPPORT_TLS=yes
2597 TLS_LIBS=-L/usr/local/openssl/lib -lssl -lcrypto
2598 TLS_INCLUDE=-I/usr/local/openssl/include/
2599 </literallayout>
2600 <para>
2601 <indexterm role="concept">
2602 <primary>pkg-config</primary>
2603 <secondary>OpenSSL</secondary>
2604 </indexterm>
2605 If you have <emphasis>pkg-config</emphasis> available, then instead you can just use:
2606 </para>
2607 <literallayout class="monospaced">
2608 SUPPORT_TLS=yes
2609 USE_OPENSSL_PC=openssl
2610 </literallayout>
2611 <para>
2612 <indexterm role="concept">
2613 <primary>USE_GNUTLS</primary>
2614 </indexterm>
2615 If GnuTLS is installed, you should set
2616 </para>
2617 <literallayout class="monospaced">
2618 SUPPORT_TLS=yes
2619 USE_GNUTLS=yes
2620 TLS_LIBS=-lgnutls -ltasn1 -lgcrypt
2621 </literallayout>
2622 <para>
2623 in <filename>Local/Makefile</filename>, and again you may need to specify the locations of the
2624 library and include files. For example:
2625 </para>
2626 <literallayout class="monospaced">
2627 SUPPORT_TLS=yes
2628 USE_GNUTLS=yes
2629 TLS_LIBS=-L/usr/gnu/lib -lgnutls -ltasn1 -lgcrypt
2630 TLS_INCLUDE=-I/usr/gnu/include
2631 </literallayout>
2632 <para>
2633 <indexterm role="concept">
2634 <primary>pkg-config</primary>
2635 <secondary>GnuTLS</secondary>
2636 </indexterm>
2637 If you have <emphasis>pkg-config</emphasis> available, then instead you can just use:
2638 </para>
2639 <literallayout class="monospaced">
2640 SUPPORT_TLS=yes
2641 USE_GNUTLS=yes
2642 USE_GNUTLS_PC=gnutls
2643 </literallayout>
2644 <para>
2645 You do not need to set TLS_INCLUDE if the relevant directory is already
2646 specified in INCLUDE. Details of how to configure Exim to make use of TLS are
2647 given in chapter <xref linkend="CHAPTLS"/>.
2648 </para>
2649 </section>
2650 <section id="SECID27">
2651 <title>Use of tcpwrappers</title>
2652 <para>
2653 <indexterm role="concept">
2654 <primary>tcpwrappers, building Exim to support</primary>
2655 </indexterm>
2656 <indexterm role="concept">
2657 <primary>USE_TCP_WRAPPERS</primary>
2658 </indexterm>
2659 <indexterm role="concept">
2660 <primary>TCP_WRAPPERS_DAEMON_NAME</primary>
2661 </indexterm>
2662 <indexterm role="concept">
2663 <primary>tcp_wrappers_daemon_name</primary>
2664 </indexterm>
2665 Exim can be linked with the <emphasis>tcpwrappers</emphasis> library in order to check incoming
2666 SMTP calls using the <emphasis>tcpwrappers</emphasis> control files. This may be a convenient
2667 alternative to Exim&#x2019;s own checking facilities for installations that are
2668 already making use of <emphasis>tcpwrappers</emphasis> for other purposes. To do this, you
2669 should set USE_TCP_WRAPPERS in <filename>Local/Makefile</filename>, arrange for the file
2670 <filename>tcpd.h</filename> to be available at compile time, and also ensure that the library
2671 <filename>libwrap.a</filename> is available at link time, typically by including <option>-lwrap</option> in
2672 EXTRALIBS_EXIM. For example, if <emphasis>tcpwrappers</emphasis> is installed in <filename>/usr/local</filename>,
2673 you might have
2674 </para>
2675 <literallayout class="monospaced">
2676 USE_TCP_WRAPPERS=yes
2677 CFLAGS=-O -I/usr/local/include
2678 EXTRALIBS_EXIM=-L/usr/local/lib -lwrap
2679 </literallayout>
2680 <para>
2681 in <filename>Local/Makefile</filename>. The daemon name to use in the <emphasis>tcpwrappers</emphasis> control
2682 files is <quote>exim</quote>. For example, the line
2683 </para>
2684 <literallayout class="monospaced">
2685 exim : LOCAL  192.168.1.  .friendly.domain.example
2686 </literallayout>
2687 <para>
2688 in your <filename>/etc/hosts.allow</filename> file allows connections from the local host, from
2689 the subnet 192.168.1.0/24, and from all hosts in <emphasis>friendly.domain.example</emphasis>.
2690 All other connections are denied. The daemon name used by <emphasis>tcpwrappers</emphasis>
2691 can be changed at build time by setting TCP_WRAPPERS_DAEMON_NAME in
2692 <filename>Local/Makefile</filename>, or by setting tcp_wrappers_daemon_name in the
2693 configure file. Consult the <emphasis>tcpwrappers</emphasis> documentation for
2694 further details.
2695 </para>
2696 </section>
2697 <section id="SECID28">
2698 <title>Including support for IPv6</title>
2699 <para>
2700 <indexterm role="concept">
2701 <primary>IPv6</primary>
2702 <secondary>including support for</secondary>
2703 </indexterm>
2704 Exim contains code for use on systems that have IPv6 support. Setting
2705 <literal>HAVE_IPV6=YES</literal> in <filename>Local/Makefile</filename> causes the IPv6 code to be included;
2706 it may also be necessary to set IPV6_INCLUDE and IPV6_LIBS on systems
2707 where the IPv6 support is not fully integrated into the normal include and
2708 library files.
2709 </para>
2710 <para>
2711 Two different types of DNS record for handling IPv6 addresses have been
2712 defined. AAAA records (analogous to A records for IPv4) are in use, and are
2713 currently seen as the mainstream. Another record type called A6 was proposed
2714 as better than AAAA because it had more flexibility. However, it was felt to be
2715 over-complex, and its status was reduced to <quote>experimental</quote>.
2716 Exim used to
2717 have a compile option for including A6 record support but this has now been
2718 withdrawn.
2719 </para>
2720 </section>
2721 <section id="SECTdynamicmodules">
2722 <title>Dynamically loaded lookup module support</title>
2723 <para>
2724 <indexterm role="concept">
2725 <primary>lookup modules</primary>
2726 </indexterm>
2727 <indexterm role="concept">
2728 <primary>dynamic modules</primary>
2729 </indexterm>
2730 <indexterm role="concept">
2731 <primary>.so building</primary>
2732 </indexterm>
2733 On some platforms, Exim supports not compiling all lookup types directly into
2734 the main binary, instead putting some into external modules which can be loaded
2735 on demand.
2736 This permits packagers to build Exim with support for lookups with extensive
2737 library dependencies without requiring all users to install all of those
2738 dependencies.
2739 Most, but not all, lookup types can be built this way.
2740 </para>
2741 <para>
2742 Set <literal>LOOKUP_MODULE_DIR</literal> to the directory into which the modules will be
2743 installed; Exim will only load modules from that directory, as a security
2744 measure.  You will need to set <literal>CFLAGS_DYNAMIC</literal> if not already defined
2745 for your OS; see <filename>OS/Makefile-Linux</filename> for an example.
2746 Some other requirements for adjusting <literal>EXTRALIBS</literal> may also be necessary,
2747 see <filename>src/EDITME</filename> for details.
2748 </para>
2749 <para>
2750 Then, for each module to be loaded dynamically, define the relevant
2751 <literal>LOOKUP_</literal>&lt;<emphasis>lookup_type</emphasis>&gt; flags to have the value "2" instead of "yes".
2752 For example, this will build in lsearch but load sqlite and mysql support
2753 on demand:
2754 </para>
2755 <literallayout class="monospaced">
2756 LOOKUP_LSEARCH=yes
2757 LOOKUP_SQLITE=2
2758 LOOKUP_MYSQL=2
2759 </literallayout>
2760 </section>
2761 <section id="SECID29">
2762 <title>The building process</title>
2763 <para>
2764 <indexterm role="concept">
2765 <primary>build directory</primary>
2766 </indexterm>
2767 Once <filename>Local/Makefile</filename> (and <filename>Local/eximon.conf</filename>, if required) have been
2768 created, run <emphasis>make</emphasis> at the top level. It determines the architecture and
2769 operating system types, and creates a build directory if one does not exist.
2770 For example, on a Sun system running Solaris 8, the directory
2771 <filename>build-SunOS5-5.8-sparc</filename> is created.
2772 <indexterm role="concept">
2773 <primary>symbolic link</primary>
2774 <secondary>to source files</secondary>
2775 </indexterm>
2776 Symbolic links to relevant source files are installed in the build directory.
2777 </para>
2778 <para>
2779 If this is the first time <emphasis>make</emphasis> has been run, it calls a script that builds
2780 a make file inside the build directory, using the configuration files from the
2781 <filename>Local</filename> directory. The new make file is then passed to another instance of
2782 <emphasis>make</emphasis>. This does the real work, building a number of utility scripts, and
2783 then compiling and linking the binaries for the Exim monitor (if configured), a
2784 number of utility programs, and finally Exim itself. The command <literal>make
2785 makefile</literal> can be used to force a rebuild of the make file in the build
2786 directory, should this ever be necessary.
2787 </para>
2788 <para>
2789 If you have problems building Exim, check for any comments there may be in the
2790 <filename>README</filename> file concerning your operating system, and also take a look at the
2791 FAQ, where some common problems are covered.
2792 </para>
2793 </section>
2794 <section id="SECID283">
2795 <title>Output from <quote>make</quote></title>
2796 <para>
2797 The output produced by the <emphasis>make</emphasis> process for compile lines is often very
2798 unreadable, because these lines can be very long. For this reason, the normal
2799 output is suppressed by default, and instead output similar to that which
2800 appears when compiling the 2.6 Linux kernel is generated: just a short line for
2801 each module that is being compiled or linked. However, it is still possible to
2802 get the full output, by calling <emphasis>make</emphasis> like this:
2803 </para>
2804 <literallayout class="monospaced">
2805 FULLECHO='' make -e
2806 </literallayout>
2807 <para>
2808 The value of FULLECHO defaults to <quote>@</quote>, the flag character that suppresses
2809 command reflection in <emphasis>make</emphasis>. When you ask for the full output, it is
2810 given in addition to the short output.
2811 </para>
2812 </section>
2813 <section id="SECToverride">
2814 <title>Overriding build-time options for Exim</title>
2815 <para>
2816 <indexterm role="concept">
2817 <primary>build-time options, overriding</primary>
2818 </indexterm>
2819 The main make file that is created at the beginning of the building process
2820 consists of the concatenation of a number of files which set configuration
2821 values, followed by a fixed set of <emphasis>make</emphasis> instructions. If a value is set
2822 more than once, the last setting overrides any previous ones. This provides a
2823 convenient way of overriding defaults. The files that are concatenated are, in
2824 order:
2825 </para>
2826 <literallayout>
2827 <filename>OS/Makefile-Default</filename>
2828 <filename>OS/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2829 <filename>Local/Makefile</filename>
2830 <filename>Local/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2831 <filename>Local/Makefile-</filename>&lt;<emphasis>archtype</emphasis>&gt;
2832 <filename>Local/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;-&lt;<emphasis>archtype</emphasis>&gt;
2833 <filename>OS/Makefile-Base</filename>
2834 </literallayout>
2835 <para>
2836 <indexterm role="concept">
2837 <primary><filename>Local/Makefile</filename></primary>
2838 </indexterm>
2839 <indexterm role="concept">
2840 <primary>building Exim</primary>
2841 <secondary>operating system type</secondary>
2842 </indexterm>
2843 <indexterm role="concept">
2844 <primary>building Exim</primary>
2845 <secondary>architecture type</secondary>
2846 </indexterm>
2847 where &lt;<emphasis>ostype</emphasis>&gt; is the operating system type and &lt;<emphasis>archtype</emphasis>&gt; is the
2848 architecture type. <filename>Local/Makefile</filename> is required to exist, and the building
2849 process fails if it is absent. The other three <filename>Local</filename> files are optional,
2850 and are often not needed.
2851 </para>
2852 <para>
2853 The values used for &lt;<emphasis>ostype</emphasis>&gt; and &lt;<emphasis>archtype</emphasis>&gt; are obtained from scripts
2854 called <filename>scripts/os-type</filename> and <filename>scripts/arch-type</filename> respectively. If either of
2855 the environment variables EXIM_OSTYPE or EXIM_ARCHTYPE is set, their
2856 values are used, thereby providing a means of forcing particular settings.
2857 Otherwise, the scripts try to get values from the <option>uname</option> command. If this
2858 fails, the shell variables OSTYPE and ARCHTYPE are inspected. A number
2859 of <emphasis>ad hoc</emphasis> transformations are then applied, to produce the standard names
2860 that Exim expects. You can run these scripts directly from the shell in order
2861 to find out what values are being used on your system.
2862 </para>
2863 <para>
2864 <filename>OS/Makefile-Default</filename> contains comments about the variables that are set
2865 therein. Some (but not all) are mentioned below. If there is something that
2866 needs changing, review the contents of this file and the contents of the make
2867 file for your operating system (<filename>OS/Makefile-&lt;ostype&gt;</filename>) to see what the
2868 default values are.
2869 </para>
2870 <para>
2871 <indexterm role="concept">
2872 <primary>building Exim</primary>
2873 <secondary>overriding default settings</secondary>
2874 </indexterm>
2875 If you need to change any of the values that are set in <filename>OS/Makefile-Default</filename>
2876 or in <filename>OS/Makefile-&lt;ostype&gt;</filename>, or to add any new definitions, you do not
2877 need to change the original files. Instead, you should make the changes by
2878 putting the new values in an appropriate <filename>Local</filename> file. For example,
2879 <indexterm role="concept">
2880 <primary>Tru64-Unix build-time settings</primary>
2881 </indexterm>
2882 when building Exim in many releases of the Tru64-Unix (formerly Digital UNIX,
2883 formerly DEC-OSF1) operating system, it is necessary to specify that the C
2884 compiler is called <emphasis>cc</emphasis> rather than <emphasis>gcc</emphasis>. Also, the compiler must be
2885 called with the option <option>-std1</option>, to make it recognize some of the features of
2886 Standard C that Exim uses. (Most other compilers recognize Standard C by
2887 default.) To do this, you should create a file called <filename>Local/Makefile-OSF1</filename>
2888 containing the lines
2889 </para>
2890 <literallayout class="monospaced">
2891 CC=cc
2892 CFLAGS=-std1
2893 </literallayout>
2894 <para>
2895 If you are compiling for just one operating system, it may be easier to put
2896 these lines directly into <filename>Local/Makefile</filename>.
2897 </para>
2898 <para>
2899 Keeping all your local configuration settings separate from the distributed
2900 files makes it easy to transfer them to new versions of Exim simply by copying
2901 the contents of the <filename>Local</filename> directory.
2902 </para>
2903 <para>
2904 <indexterm role="concept">
2905 <primary>NIS lookup type</primary>
2906 <secondary>including support for</secondary>
2907 </indexterm>
2908 <indexterm role="concept">
2909 <primary>NIS+ lookup type</primary>
2910 <secondary>including support for</secondary>
2911 </indexterm>
2912 <indexterm role="concept">
2913 <primary>LDAP</primary>
2914 <secondary>including support for</secondary>
2915 </indexterm>
2916 <indexterm role="concept">
2917 <primary>lookup</primary>
2918 <secondary>inclusion in binary</secondary>
2919 </indexterm>
2920 Exim contains support for doing LDAP, NIS, NIS+, and other kinds of file
2921 lookup, but not all systems have these components installed, so the default is
2922 not to include the relevant code in the binary. All the different kinds of file
2923 and database lookup that Exim supports are implemented as separate code modules
2924 which are included only if the relevant compile-time options are set. In the
2925 case of LDAP, NIS, and NIS+, the settings for <filename>Local/Makefile</filename> are:
2926 </para>
2927 <literallayout class="monospaced">
2928 LOOKUP_LDAP=yes
2929 LOOKUP_NIS=yes
2930 LOOKUP_NISPLUS=yes
2931 </literallayout>
2932 <para>
2933 and similar settings apply to the other lookup types. They are all listed in
2934 <filename>src/EDITME</filename>. In many cases the relevant include files and interface
2935 libraries need to be installed before compiling Exim.
2936 <indexterm role="concept">
2937 <primary>cdb</primary>
2938 <secondary>including support for</secondary>
2939 </indexterm>
2940 However, there are some optional lookup types (such as cdb) for which
2941 the code is entirely contained within Exim, and no external include
2942 files or libraries are required. When a lookup type is not included in the
2943 binary, attempts to configure Exim to use it cause runtime configuration
2944 errors.
2945 </para>
2946 <para>
2947 <indexterm role="concept">
2948 <primary>pkg-config</primary>
2949 <secondary>lookups</secondary>
2950 </indexterm>
2951 <indexterm role="concept">
2952 <primary>pkg-config</primary>
2953 <secondary>authenticators</secondary>
2954 </indexterm>
2955 Many systems now use a tool called <emphasis>pkg-config</emphasis> to encapsulate information
2956 about how to compile against a library; Exim has some initial support for
2957 being able to use pkg-config for lookups and authenticators.  For any given
2958 makefile variable which starts <literal>LOOKUP_</literal> or <literal>AUTH_</literal>, you can add a new
2959 variable with the <literal>_PC</literal> suffix in the name and assign as the value the
2960 name of the package to be queried.  The results of querying via the
2961 <emphasis>pkg-config</emphasis> command will be added to the appropriate Makefile variables
2962 with <literal>+=</literal> directives, so your version of <emphasis>make</emphasis> will need to support that
2963 syntax.  For instance:
2964 </para>
2965 <literallayout class="monospaced">
2966 LOOKUP_SQLITE=yes
2967 LOOKUP_SQLITE_PC=sqlite3
2968 AUTH_GSASL=yes
2969 AUTH_GSASL_PC=libgsasl
2970 AUTH_HEIMDAL_GSSAPI=yes
2971 AUTH_HEIMDAL_GSSAPI_PC=heimdal-gssapi
2972 </literallayout>
2973 <para>
2974 <indexterm role="concept">
2975 <primary>Perl</primary>
2976 <secondary>including support for</secondary>
2977 </indexterm>
2978 Exim can be linked with an embedded Perl interpreter, allowing Perl
2979 subroutines to be called during string expansion. To enable this facility,
2980 </para>
2981 <literallayout class="monospaced">
2982 EXIM_PERL=perl.o
2983 </literallayout>
2984 <para>
2985 must be defined in <filename>Local/Makefile</filename>. Details of this facility are given in
2986 chapter <xref linkend="CHAPperl"/>.
2987 </para>
2988 <para>
2989 <indexterm role="concept">
2990 <primary>X11 libraries, location of</primary>
2991 </indexterm>
2992 The location of the X11 libraries is something that varies a lot between
2993 operating systems, and there may be different versions of X11 to cope
2994 with. Exim itself makes no use of X11, but if you are compiling the Exim
2995 monitor, the X11 libraries must be available.
2996 The following three variables are set in <filename>OS/Makefile-Default</filename>:
2997 </para>
2998 <literallayout class="monospaced">
2999 X11=/usr/X11R6
3000 XINCLUDE=-I$(X11)/include
3001 XLFLAGS=-L$(X11)/lib
3002 </literallayout>
3003 <para>
3004 These are overridden in some of the operating-system configuration files. For
3005 example, in <filename>OS/Makefile-SunOS5</filename> there is
3006 </para>
3007 <literallayout class="monospaced">
3008 X11=/usr/openwin
3009 XINCLUDE=-I$(X11)/include
3010 XLFLAGS=-L$(X11)/lib -R$(X11)/lib
3011 </literallayout>
3012 <para>
3013 If you need to override the default setting for your operating system, place a
3014 definition of all three of these variables into your
3015 <filename>Local/Makefile-&lt;ostype&gt;</filename> file.
3016 </para>
3017 <para>
3018 <indexterm role="concept">
3019 <primary>EXTRALIBS</primary>
3020 </indexterm>
3021 If you need to add any extra libraries to the link steps, these can be put in a
3022 variable called EXTRALIBS, which appears in all the link commands, but by
3023 default is not defined. In contrast, EXTRALIBS_EXIM is used only on the
3024 command for linking the main Exim binary, and not for any associated utilities.
3025 </para>
3026 <para>
3027 <indexterm role="concept">
3028 <primary>DBM libraries</primary>
3029 <secondary>configuration for building</secondary>
3030 </indexterm>
3031 There is also DBMLIB, which appears in the link commands for binaries that
3032 use DBM functions (see also section <xref linkend="SECTdb"/>). Finally, there is
3033 EXTRALIBS_EXIMON, which appears only in the link step for the Exim monitor
3034 binary, and which can be used, for example, to include additional X11
3035 libraries.
3036 </para>
3037 <para>
3038 <indexterm role="concept">
3039 <primary>configuration file</primary>
3040 <secondary>editing</secondary>
3041 </indexterm>
3042 The make file copes with rebuilding Exim correctly if any of the configuration
3043 files are edited. However, if an optional configuration file is deleted, it is
3044 necessary to touch the associated non-optional file (that is,
3045 <filename>Local/Makefile</filename> or <filename>Local/eximon.conf</filename>) before rebuilding.
3046 </para>
3047 </section>
3048 <section id="SECID30">
3049 <title>OS-specific header files</title>
3050 <para>
3051 <indexterm role="concept">
3052 <primary><filename>os.h</filename></primary>
3053 </indexterm>
3054 <indexterm role="concept">
3055 <primary>building Exim</primary>
3056 <secondary>OS-specific C header files</secondary>
3057 </indexterm>
3058 The <filename>OS</filename> directory contains a number of files with names of the form
3059 <filename>os.h-&lt;ostype&gt;</filename>. These are system-specific C header files that should not
3060 normally need to be changed. There is a list of macro settings that are
3061 recognized in the file <filename>OS/os.configuring</filename>, which should be consulted if you
3062 are porting Exim to a new operating system.
3063 </para>
3064 </section>
3065 <section id="SECID31">
3066 <title>Overriding build-time options for the monitor</title>
3067 <para>
3068 <indexterm role="concept">
3069 <primary>building Eximon</primary>
3070 </indexterm>
3071 A similar process is used for overriding things when building the Exim monitor,
3072 where the files that are involved are
3073 </para>
3074 <literallayout>
3075 <filename>OS/eximon.conf-Default</filename>
3076 <filename>OS/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;
3077 <filename>Local/eximon.conf</filename>
3078 <filename>Local/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;
3079 <filename>Local/eximon.conf-</filename>&lt;<emphasis>archtype</emphasis>&gt;
3080 <filename>Local/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;-&lt;<emphasis>archtype</emphasis>&gt;
3081 </literallayout>
3082 <para>
3083 <indexterm role="concept">
3084 <primary><filename>Local/eximon.conf</filename></primary>
3085 </indexterm>
3086 As with Exim itself, the final three files need not exist, and in this case the
3087 <filename>OS/eximon.conf-&lt;ostype&gt;</filename> file is also optional. The default values in
3088 <filename>OS/eximon.conf-Default</filename> can be overridden dynamically by setting environment
3089 variables of the same name, preceded by EXIMON_. For example, setting
3090 EXIMON_LOG_DEPTH in the environment overrides the value of
3091 LOG_DEPTH at runtime.
3092 <indexterm role="concept" startref="IIDbuex" class="endofrange"/>
3093 </para>
3094 </section>
3095 <section id="SECID32">
3096 <title>Installing Exim binaries and scripts</title>
3097 <para>
3098 <indexterm role="concept">
3099 <primary>installing Exim</primary>
3100 </indexterm>
3101 <indexterm role="concept">
3102 <primary>BIN_DIRECTORY</primary>
3103 </indexterm>
3104 The command <literal>make install</literal> runs the <command>exim_install</command> script with no
3105 arguments. The script copies binaries and utility scripts into the directory
3106 whose name is specified by the BIN_DIRECTORY setting in <filename>Local/Makefile</filename>.
3107 <indexterm role="concept">
3108 <primary>setuid</primary>
3109 <secondary>installing Exim with</secondary>
3110 </indexterm>
3111 The install script copies files only if they are newer than the files they are
3112 going to replace. The Exim binary is required to be owned by root and have the
3113 <emphasis>setuid</emphasis> bit set, for normal configurations. Therefore, you must run <literal>make
3114 install</literal> as root so that it can set up the Exim binary in this way. However, in
3115 some special situations (for example, if a host is doing no local deliveries)
3116 it may be possible to run Exim without making the binary setuid root (see
3117 chapter <xref linkend="CHAPsecurity"/> for details).
3118 </para>
3119 <para>
3120 <indexterm role="concept">
3121 <primary>CONFIGURE_FILE</primary>
3122 </indexterm>
3123 Exim&#x2019;s runtime configuration file is named by the CONFIGURE_FILE setting
3124 in <filename>Local/Makefile</filename>. If this names a single file, and the file does not
3125 exist, the default configuration file <filename>src/configure.default</filename> is copied there
3126 by the installation script. If a runtime configuration file already exists, it
3127 is left alone. If CONFIGURE_FILE is a colon-separated list, naming several
3128 alternative files, no default is installed.
3129 </para>
3130 <para>
3131 <indexterm role="concept">
3132 <primary>system aliases file</primary>
3133 </indexterm>
3134 <indexterm role="concept">
3135 <primary><filename>/etc/aliases</filename></primary>
3136 </indexterm>
3137 One change is made to the default configuration file when it is installed: the
3138 default configuration contains a router that references a system aliases file.
3139 The path to this file is set to the value specified by
3140 SYSTEM_ALIASES_FILE in <filename>Local/Makefile</filename> (<filename>/etc/aliases</filename> by default).
3141 If the system aliases file does not exist, the installation script creates it,
3142 and outputs a comment to the user.
3143 </para>
3144 <para>
3145 The created file contains no aliases, but it does contain comments about the
3146 aliases a site should normally have. Mail aliases have traditionally been
3147 kept in <filename>/etc/aliases</filename>. However, some operating systems are now using
3148 <filename>/etc/mail/aliases</filename>. You should check if yours is one of these, and change
3149 Exim&#x2019;s configuration if necessary.
3150 </para>
3151 <para>
3152 The default configuration uses the local host&#x2019;s name as the only local domain,
3153 and is set up to do local deliveries into the shared directory <filename>/var/mail</filename>,
3154 running as the local user. System aliases and <filename>.forward</filename> files in users&#x2019; home
3155 directories are supported, but no NIS or NIS+ support is configured. Domains
3156 other than the name of the local host are routed using the DNS, with delivery
3157 over SMTP.
3158 </para>
3159 <para>
3160 It is possible to install Exim for special purposes (such as building a binary
3161 distribution) in a private part of the file system. You can do this by a
3162 command such as
3163 </para>
3164 <literallayout class="monospaced">
3165 make DESTDIR=/some/directory/ install
3166 </literallayout>
3167 <para>
3168 This has the effect of pre-pending the specified directory to all the file
3169 paths, except the name of the system aliases file that appears in the default
3170 configuration. (If a default alias file is created, its name <emphasis>is</emphasis> modified.)
3171 For backwards compatibility, ROOT is used if DESTDIR is not set,
3172 but this usage is deprecated.
3173 </para>
3174 <para>
3175 <indexterm role="concept">
3176 <primary>installing Exim</primary>
3177 <secondary>what is not installed</secondary>
3178 </indexterm>
3179 Running <emphasis>make install</emphasis> does not copy the Exim 4 conversion script
3180 <emphasis>convert4r4</emphasis>. You will probably run this only once if you are
3181 upgrading from Exim 3. None of the documentation files in the <filename>doc</filename>
3182 directory are copied, except for the info files when you have set
3183 INFO_DIRECTORY, as described in section <xref linkend="SECTinsinfdoc"/> below.
3184 </para>
3185 <para>
3186 For the utility programs, old versions are renamed by adding the suffix <filename>.O</filename>
3187 to their names. The Exim binary itself, however, is handled differently. It is
3188 installed under a name that includes the version number and the compile number,
3189 for example, <filename>exim-4.92.3-1</filename>. The script then arranges for a symbolic link
3190 called <filename>exim</filename> to point to the binary. If you are updating a previous version
3191 of Exim, the script takes care to ensure that the name <filename>exim</filename> is never absent
3192 from the directory (as seen by other processes).
3193 </para>
3194 <para>
3195 <indexterm role="concept">
3196 <primary>installing Exim</primary>
3197 <secondary>testing the script</secondary>
3198 </indexterm>
3199 If you want to see what the <emphasis>make install</emphasis> will do before running it for
3200 real, you can pass the <option>-n</option> option to the installation script by this
3201 command:
3202 </para>
3203 <literallayout class="monospaced">
3204 make INSTALL_ARG=-n install
3205 </literallayout>
3206 <para>
3207 The contents of the variable INSTALL_ARG are passed to the installation
3208 script. You do not need to be root to run this test. Alternatively, you can run
3209 the installation script directly, but this must be from within the build
3210 directory. For example, from the top-level Exim directory you could use this
3211 command:
3212 </para>
3213 <literallayout class="monospaced">
3214 (cd build-SunOS5-5.5.1-sparc; ../scripts/exim_install -n)
3215 </literallayout>
3216 <para>
3217 <indexterm role="concept">
3218 <primary>installing Exim</primary>
3219 <secondary>install script options</secondary>
3220 </indexterm>
3221 There are two other options that can be supplied to the installation script.
3222 </para>
3223 <itemizedlist>
3224 <listitem>
3225 <para>
3226 <option>-no_chown</option> bypasses the call to change the owner of the installed binary
3227 to root, and the call to make it a setuid binary.
3228 </para>
3229 </listitem>
3230 <listitem>
3231 <para>
3232 <option>-no_symlink</option> bypasses the setting up of the symbolic link <filename>exim</filename> to the
3233 installed binary.
3234 </para>
3235 </listitem>
3236 </itemizedlist>
3237 <para>
3238 INSTALL_ARG can be used to pass these options to the script. For example:
3239 </para>
3240 <literallayout class="monospaced">
3241 make INSTALL_ARG=-no_symlink install
3242 </literallayout>
3243 <para>
3244 The installation script can also be given arguments specifying which files are
3245 to be copied. For example, to install just the Exim binary, and nothing else,
3246 without creating the symbolic link, you could use:
3247 </para>
3248 <literallayout class="monospaced">
3249 make INSTALL_ARG='-no_symlink exim' install
3250 </literallayout>
3251 </section>
3252 <section id="SECTinsinfdoc">
3253 <title>Installing info documentation</title>
3254 <para>
3255 <indexterm role="concept">
3256 <primary>installing Exim</primary>
3257 <secondary><emphasis>info</emphasis> documentation</secondary>
3258 </indexterm>
3259 Not all systems use the GNU <emphasis>info</emphasis> system for documentation, and for this
3260 reason, the Texinfo source of Exim&#x2019;s documentation is not included in the main
3261 distribution. Instead it is available separately from the FTP site (see section
3262 <xref linkend="SECTavail"/>).
3263 </para>
3264 <para>
3265 If you have defined INFO_DIRECTORY in <filename>Local/Makefile</filename> and the Texinfo
3266 source of the documentation is found in the source tree, running <literal>make
3267 install</literal> automatically builds the info files and installs them.
3268 </para>
3269 </section>
3270 <section id="SECID33">
3271 <title>Setting up the spool directory</title>
3272 <para>
3273 <indexterm role="concept">
3274 <primary>spool directory</primary>
3275 <secondary>creating</secondary>
3276 </indexterm>
3277 When it starts up, Exim tries to create its spool directory if it does not
3278 exist. The Exim uid and gid are used for the owner and group of the spool
3279 directory. Sub-directories are automatically created in the spool directory as
3280 necessary.
3281 </para>
3282 </section>
3283 <section id="SECID34">
3284 <title>Testing</title>
3285 <para>
3286 <indexterm role="concept">
3287 <primary>testing</primary>
3288 <secondary>installation</secondary>
3289 </indexterm>
3290 Having installed Exim, you can check that the runtime configuration file is
3291 syntactically valid by running the following command, which assumes that the
3292 Exim binary directory is within your PATH environment variable:
3293 </para>
3294 <literallayout class="monospaced">
3295 exim -bV
3296 </literallayout>
3297 <para>
3298 If there are any errors in the configuration file, Exim outputs error messages.
3299 Otherwise it outputs the version number and build date,
3300 the DBM library that is being used, and information about which drivers and
3301 other optional code modules are included in the binary.
3302 Some simple routing tests can be done by using the address testing option. For
3303 example,
3304 </para>
3305 <literallayout>
3306 <literal>exim -bt</literal> &lt;<emphasis>local username</emphasis>&gt;
3307 </literallayout>
3308 <para>
3309 should verify that it recognizes a local mailbox, and
3310 </para>
3311 <literallayout>
3312 <literal>exim -bt</literal> &lt;<emphasis>remote address</emphasis>&gt;
3313 </literallayout>
3314 <para>
3315 a remote one. Then try getting it to deliver mail, both locally and remotely.
3316 This can be done by passing messages directly to Exim, without going through a
3317 user agent. For example:
3318 </para>
3319 <literallayout class="monospaced">
3320 exim -v postmaster@your.domain.example
3321 From: user@your.domain.example
3322 To: postmaster@your.domain.example
3323 Subject: Testing Exim
3324
3325 This is a test message.
3326 ^D
3327 </literallayout>
3328 <para>
3329 The <option>-v</option> option causes Exim to output some verification of what it is doing.
3330 In this case you should see copies of three log lines, one for the message&#x2019;s
3331 arrival, one for its delivery, and one containing <quote>Completed</quote>.
3332 </para>
3333 <para>
3334 <indexterm role="concept">
3335 <primary>delivery</primary>
3336 <secondary>problems with</secondary>
3337 </indexterm>
3338 If you encounter problems, look at Exim&#x2019;s log files (<emphasis>mainlog</emphasis> and
3339 <emphasis>paniclog</emphasis>) to see if there is any relevant information there. Another source
3340 of information is running Exim with debugging turned on, by specifying the
3341 <option>-d</option> option. If a message is stuck on Exim&#x2019;s spool, you can force a delivery
3342 with debugging turned on by a command of the form
3343 </para>
3344 <literallayout>
3345 <literal>exim -d -M</literal> &lt;<emphasis>exim-message-id</emphasis>&gt;
3346 </literallayout>
3347 <para>
3348 You must be root or an <quote>admin user</quote> in order to do this. The <option>-d</option> option
3349 produces rather a lot of output, but you can cut this down to specific areas.
3350 For example, if you use <option>-d-all+route</option> only the debugging information
3351 relevant to routing is included. (See the <option>-d</option> option in chapter
3352 <xref linkend="CHAPcommandline"/> for more details.)
3353 </para>
3354 <para>
3355 <indexterm role="concept">
3356 <primary><quote>sticky</quote> bit</primary>
3357 </indexterm>
3358 <indexterm role="concept">
3359 <primary>lock files</primary>
3360 </indexterm>
3361 One specific problem that has shown up on some sites is the inability to do
3362 local deliveries into a shared mailbox directory, because it does not have the
3363 <quote>sticky bit</quote> set on it. By default, Exim tries to create a lock file before
3364 writing to a mailbox file, and if it cannot create the lock file, the delivery
3365 is deferred. You can get round this either by setting the <quote>sticky bit</quote> on the
3366 directory, or by setting a specific group for local deliveries and allowing
3367 that group to create files in the directory (see the comments above the
3368 <command>local_delivery</command> transport in the default configuration file). Another
3369 approach is to configure Exim not to use lock files, but just to rely on
3370 <function>fcntl()</function> locking instead. However, you should do this only if all user
3371 agents also use <function>fcntl()</function> locking. For further discussion of locking issues,
3372 see chapter <xref linkend="CHAPappendfile"/>.
3373 </para>
3374 <para>
3375 One thing that cannot be tested on a system that is already running an MTA is
3376 the receipt of incoming SMTP mail on the standard SMTP port. However, the
3377 <option>-oX</option> option can be used to run an Exim daemon that listens on some other
3378 port, or <emphasis>inetd</emphasis> can be used to do this. The <option>-bh</option> option and the
3379 <emphasis>exim_checkaccess</emphasis> utility can be used to check out policy controls on
3380 incoming SMTP mail.
3381 </para>
3382 <para>
3383 Testing a new version on a system that is already running Exim can most easily
3384 be done by building a binary with a different CONFIGURE_FILE setting. From
3385 within the runtime configuration, all other file and directory names
3386 that Exim uses can be altered, in order to keep it entirely clear of the
3387 production version.
3388 </para>
3389 </section>
3390 <section id="SECID35">
3391 <title>Replacing another MTA with Exim</title>
3392 <para>
3393 <indexterm role="concept">
3394 <primary>replacing another MTA</primary>
3395 </indexterm>
3396 Building and installing Exim for the first time does not of itself put it in
3397 general use. The name by which the system&#x2019;s MTA is called by mail user agents
3398 is either <filename>/usr/sbin/sendmail</filename>, or <filename>/usr/lib/sendmail</filename> (depending on the
3399 operating system), and it is necessary to make this name point to the <emphasis>exim</emphasis>
3400 binary in order to get the user agents to pass messages to Exim. This is
3401 normally done by renaming any existing file and making <filename>/usr/sbin/sendmail</filename>
3402 or <filename>/usr/lib/sendmail</filename>
3403 <indexterm role="concept">
3404 <primary>symbolic link</primary>
3405 <secondary>to <emphasis>exim</emphasis> binary</secondary>
3406 </indexterm>
3407 a symbolic link to the <emphasis>exim</emphasis> binary. It is a good idea to remove any setuid
3408 privilege and executable status from the old MTA. It is then necessary to stop
3409 and restart the mailer daemon, if one is running.
3410 </para>
3411 <para>
3412 <indexterm role="concept">
3413 <primary>FreeBSD, MTA indirection</primary>
3414 </indexterm>
3415 <indexterm role="concept">
3416 <primary><filename>/etc/mail/mailer.conf</filename></primary>
3417 </indexterm>
3418 Some operating systems have introduced alternative ways of switching MTAs. For
3419 example, if you are running FreeBSD, you need to edit the file
3420 <filename>/etc/mail/mailer.conf</filename> instead of setting up a symbolic link as just
3421 described. A typical example of the contents of this file for running Exim is
3422 as follows:
3423 </para>
3424 <literallayout class="monospaced">
3425 sendmail            /usr/exim/bin/exim
3426 send-mail           /usr/exim/bin/exim
3427 mailq               /usr/exim/bin/exim -bp
3428 newaliases          /usr/bin/true
3429 </literallayout>
3430 <para>
3431 Once you have set up the symbolic link, or edited <filename>/etc/mail/mailer.conf</filename>,
3432 your Exim installation is <quote>live</quote>. Check it by sending a message from your
3433 favourite user agent.
3434 </para>
3435 <para>
3436 You should consider what to tell your users about the change of MTA. Exim may
3437 have different capabilities to what was previously running, and there are
3438 various operational differences such as the text of messages produced by
3439 command line options and in bounce messages. If you allow your users to make
3440 use of Exim&#x2019;s filtering capabilities, you should make the document entitled
3441 <emphasis>Exim&#x2019;s interface to mail filtering</emphasis> available to them.
3442 </para>
3443 </section>
3444 <section id="SECID36">
3445 <title>Upgrading Exim</title>
3446 <para>
3447 <indexterm role="concept">
3448 <primary>upgrading Exim</primary>
3449 </indexterm>
3450 If you are already running Exim on your host, building and installing a new
3451 version automatically makes it available to MUAs, or any other programs that
3452 call the MTA directly. However, if you are running an Exim daemon, you do need
3453 to send it a HUP signal, to make it re-execute itself, and thereby pick up the
3454 new binary. You do not need to stop processing mail in order to install a new
3455 version of Exim. The install script does not modify an existing runtime
3456 configuration file.
3457 </para>
3458 </section>
3459 <section id="SECID37">
3460 <title>Stopping the Exim daemon on Solaris</title>
3461 <para>
3462 <indexterm role="concept">
3463 <primary>Solaris</primary>
3464 <secondary>stopping Exim on</secondary>
3465 </indexterm>
3466 The standard command for stopping the mailer daemon on Solaris is
3467 </para>
3468 <literallayout class="monospaced">
3469 /etc/init.d/sendmail stop
3470 </literallayout>
3471 <para>
3472 If <filename>/usr/lib/sendmail</filename> has been turned into a symbolic link, this script
3473 fails to stop Exim because it uses the command <emphasis>ps -e</emphasis> and greps the output
3474 for the text <quote>sendmail</quote>; this is not present because the actual program name
3475 (that is, <quote>exim</quote>) is given by the <emphasis>ps</emphasis> command with these options. A
3476 solution is to replace the line that finds the process id with something like
3477 </para>
3478 <literallayout class="monospaced">
3479 pid=`cat /var/spool/exim/exim-daemon.pid`
3480 </literallayout>
3481 <para>
3482 to obtain the daemon&#x2019;s pid directly from the file that Exim saves it in.
3483 </para>
3484 <para>
3485 Note, however, that stopping the daemon does not <quote>stop Exim</quote>. Messages can
3486 still be received from local processes, and if automatic delivery is configured
3487 (the normal case), deliveries will still occur.
3488 </para>
3489 </section>
3490 </chapter>
3491
3492 <chapter id="CHAPcommandline">
3493 <title>The Exim command line</title>
3494 <para>
3495 <indexterm role="concept" id="IIDclo1" class="startofrange">
3496 <primary>command line</primary>
3497 <secondary>options</secondary>
3498 </indexterm>
3499 <indexterm role="concept" id="IIDclo2" class="startofrange">
3500 <primary>options</primary>
3501 <secondary>command line</secondary>
3502 </indexterm>
3503 Exim&#x2019;s command line takes the standard Unix form of a sequence of options,
3504 each starting with a hyphen character, followed by a number of arguments. The
3505 options are compatible with the main options of Sendmail, and there are also
3506 some additional options, some of which are compatible with Smail 3. Certain
3507 combinations of options do not make sense, and provoke an error if used.
3508 The form of the arguments depends on which options are set.
3509 </para>
3510 <section id="SECID38">
3511 <title>Setting options by program name</title>
3512 <para>
3513 <indexterm role="concept">
3514 <primary><emphasis>mailq</emphasis></primary>
3515 </indexterm>
3516 If Exim is called under the name <emphasis>mailq</emphasis>, it behaves as if the option <option>-bp</option>
3517 were present before any other options.
3518 The <option>-bp</option> option requests a listing of the contents of the mail queue on the
3519 standard output.
3520 This feature is for compatibility with some systems that contain a command of
3521 that name in one of the standard libraries, symbolically linked to
3522 <filename>/usr/sbin/sendmail</filename> or <filename>/usr/lib/sendmail</filename>.
3523 </para>
3524 <para>
3525 <indexterm role="concept">
3526 <primary><emphasis>rsmtp</emphasis></primary>
3527 </indexterm>
3528 If Exim is called under the name <emphasis>rsmtp</emphasis> it behaves as if the option <option>-bS</option>
3529 were present before any other options, for compatibility with Smail. The
3530 <option>-bS</option> option is used for reading in a number of messages in batched SMTP
3531 format.
3532 </para>
3533 <para>
3534 <indexterm role="concept">
3535 <primary><emphasis>rmail</emphasis></primary>
3536 </indexterm>
3537 If Exim is called under the name <emphasis>rmail</emphasis> it behaves as if the <option>-i</option> and
3538 <option>-oee</option> options were present before any other options, for compatibility with
3539 Smail. The name <emphasis>rmail</emphasis> is used as an interface by some UUCP systems.
3540 </para>
3541 <para>
3542 <indexterm role="concept">
3543 <primary><emphasis>runq</emphasis></primary>
3544 </indexterm>
3545 <indexterm role="concept">
3546 <primary>queue runner</primary>
3547 </indexterm>
3548 If Exim is called under the name <emphasis>runq</emphasis> it behaves as if the option <option>-q</option>
3549 were present before any other options, for compatibility with Smail. The <option>-q</option>
3550 option causes a single queue runner process to be started.
3551 </para>
3552 <para>
3553 <indexterm role="concept">
3554 <primary><emphasis>newaliases</emphasis></primary>
3555 </indexterm>
3556 <indexterm role="concept">
3557 <primary>alias file</primary>
3558 <secondary>building</secondary>
3559 </indexterm>
3560 <indexterm role="concept">
3561 <primary>Sendmail compatibility</primary>
3562 <secondary>calling Exim as <emphasis>newaliases</emphasis></secondary>
3563 </indexterm>
3564 If Exim is called under the name <emphasis>newaliases</emphasis> it behaves as if the option
3565 <option>-bi</option> were present before any other options, for compatibility with Sendmail.
3566 This option is used for rebuilding Sendmail&#x2019;s alias file. Exim does not have
3567 the concept of a single alias file, but can be configured to run a given
3568 command if called with the <option>-bi</option> option.
3569 </para>
3570 </section>
3571 <section id="SECTtrustedadmin">
3572 <title>Trusted and admin users</title>
3573 <para>
3574 Some Exim options are available only to <emphasis>trusted users</emphasis> and others are
3575 available only to <emphasis>admin users</emphasis>. In the description below, the phrases <quote>Exim
3576 user</quote> and <quote>Exim group</quote> mean the user and group defined by EXIM_USER and
3577 EXIM_GROUP in <filename>Local/Makefile</filename> or set by the <option>exim_user</option> and
3578 <option>exim_group</option> options. These do not necessarily have to use the name <quote>exim</quote>.
3579 </para>
3580 <itemizedlist>
3581 <listitem>
3582 <para>
3583 <indexterm role="concept">
3584 <primary>trusted users</primary>
3585 <secondary>definition of</secondary>
3586 </indexterm>
3587 <indexterm role="concept">
3588 <primary>user</primary>
3589 <secondary>trusted definition of</secondary>
3590 </indexterm>
3591 The trusted users are root, the Exim user, any user listed in the
3592 <option>trusted_users</option> configuration option, and any user whose current group or any
3593 supplementary group is one of those listed in the <option>trusted_groups</option>
3594 configuration option. Note that the Exim group is not automatically trusted.
3595 </para>
3596 <para>
3597 <indexterm role="concept">
3598 <primary><quote>From</quote> line</primary>
3599 </indexterm>
3600 <indexterm role="concept">
3601 <primary>envelope sender</primary>
3602 </indexterm>
3603 Trusted users are always permitted to use the <option>-f</option> option or a leading
3604 <quote>From&nbsp;</quote> line to specify the envelope sender of a message that is passed to
3605 Exim through the local interface (see the <option>-bm</option> and <option>-f</option> options below).
3606 See the <option>untrusted_set_sender</option> option for a way of permitting non-trusted
3607 users to set envelope senders.
3608 </para>
3609 <para>
3610 <indexterm role="concept">
3611 <primary><emphasis>From:</emphasis> header line</primary>
3612 </indexterm>
3613 <indexterm role="concept">
3614 <primary><emphasis>Sender:</emphasis> header line</primary>
3615 </indexterm>
3616 <indexterm role="concept">
3617 <primary>header lines</primary>
3618 <secondary>From:</secondary>
3619 </indexterm>
3620 <indexterm role="concept">
3621 <primary>header lines</primary>
3622 <secondary>Sender:</secondary>
3623 </indexterm>
3624 For a trusted user, there is never any check on the contents of the <emphasis>From:</emphasis>
3625 header line, and a <emphasis>Sender:</emphasis> line is never added. Furthermore, any existing
3626 <emphasis>Sender:</emphasis> line in incoming local (non-TCP/IP) messages is not removed.
3627 </para>
3628 <para>
3629 Trusted users may also specify a host name, host address, interface address,
3630 protocol name, ident value, and authentication data when submitting a message
3631 locally. Thus, they are able to insert messages into Exim&#x2019;s queue locally that
3632 have the characteristics of messages received from a remote host. Untrusted
3633 users may in some circumstances use <option>-f</option>, but can never set the other values
3634 that are available to trusted users.
3635 </para>
3636 </listitem>
3637 <listitem>
3638 <para>
3639 <indexterm role="concept">
3640 <primary>user</primary>
3641 <secondary>admin definition of</secondary>
3642 </indexterm>
3643 <indexterm role="concept">
3644 <primary>admin user</primary>
3645 <secondary>definition of</secondary>
3646 </indexterm>
3647 The admin users are root, the Exim user, and any user that is a member of the
3648 Exim group or of any group listed in the <option>admin_groups</option> configuration option.
3649 The current group does not have to be one of these groups.
3650 </para>
3651 <para>
3652 Admin users are permitted to list the queue, and to carry out certain
3653 operations on messages, for example, to force delivery failures. It is also
3654 necessary to be an admin user in order to see the full information provided by
3655 the Exim monitor, and full debugging output.
3656 </para>
3657 <para>
3658 By default, the use of the <option>-M</option>, <option>-q</option>, <option>-R</option>, and <option>-S</option> options to cause
3659 Exim to attempt delivery of messages on its queue is restricted to admin users.
3660 However, this restriction can be relaxed by setting the <option>prod_requires_admin</option>
3661 option false (that is, specifying <option>no_prod_requires_admin</option>).
3662 </para>
3663 <para>
3664 Similarly, the use of the <option>-bp</option> option to list all the messages in the queue
3665 is restricted to admin users unless <option>queue_list_requires_admin</option> is set
3666 false.
3667 </para>
3668 </listitem>
3669 </itemizedlist>
3670 <para>
3671 <emphasis role="bold">Warning</emphasis>: If you configure your system so that admin users are able to
3672 edit Exim&#x2019;s configuration file, you are giving those users an easy way of
3673 getting root. There is further discussion of this issue at the start of chapter
3674 <xref linkend="CHAPconf"/>.
3675 </para>
3676 </section>
3677 <section id="SECID39">
3678 <title>Command line options</title>
3679 <para>
3680 Exim&#x2019;s command line options are described in alphabetical order below. If none
3681 of the options that specifies a specific action (such as starting the daemon or
3682 a queue runner, or testing an address, or receiving a message in a specific
3683 format, or listing the queue) are present, and there is at least one argument
3684 on the command line, <option>-bm</option> (accept a local message on the standard input,
3685 with the arguments specifying the recipients) is assumed. Otherwise, Exim
3686 outputs a brief message about itself and exits.
3687 </para>
3688 <!-- === Start of command line options === -->
3689 <variablelist>
3690 <varlistentry>
3691 <term><option>--</option></term>
3692 <listitem>
3693 <para>
3694 <indexterm role="option">
3695 <primary>--</primary>
3696 </indexterm>
3697 <indexterm role="concept">
3698 <primary>options</primary>
3699 <secondary>command line; terminating</secondary>
3700 </indexterm>
3701 This is a pseudo-option whose only purpose is to terminate the options and
3702 therefore to cause subsequent command line items to be treated as arguments
3703 rather than options, even if they begin with hyphens.
3704 </para>
3705 </listitem></varlistentry>
3706 <varlistentry>
3707 <term><option>--help</option></term>
3708 <listitem>
3709 <para>
3710 <indexterm role="option">
3711 <primary><option>--help</option></primary>
3712 </indexterm>
3713 This option causes Exim to output a few sentences stating what it is.
3714 The same output is generated if the Exim binary is called with no options and
3715 no arguments.
3716 </para>
3717 </listitem></varlistentry>
3718 <varlistentry>
3719 <term><option>--version</option></term>
3720 <listitem>
3721 <para>
3722 <indexterm role="option">
3723 <primary><option>--version</option></primary>
3724 </indexterm>
3725 This option is an alias for <option>-bV</option> and causes version information to be
3726 displayed.
3727 </para>
3728 </listitem></varlistentry>
3729 <varlistentry>
3730 <term><option>-Ac</option></term>
3731 <term><option>-Am</option></term>
3732 <listitem>
3733 <para>
3734 <indexterm role="option">
3735 <primary><option>-Ac</option></primary>
3736 </indexterm>
3737 <indexterm role="option">
3738 <primary><option>-Am</option></primary>
3739 </indexterm>
3740 These options are used by Sendmail for selecting configuration files and are
3741 ignored by Exim.
3742 </para>
3743 </listitem></varlistentry>
3744 <varlistentry>
3745 <term><option>-B</option>&lt;<emphasis>type</emphasis>&gt;</term>
3746 <listitem>
3747 <para>
3748 <indexterm role="option">
3749 <primary><option>-B</option></primary>
3750 </indexterm>
3751 <indexterm role="concept">
3752 <primary>8-bit characters</primary>
3753 </indexterm>
3754 <indexterm role="concept">
3755 <primary>Sendmail compatibility</primary>
3756 <secondary>8-bit characters</secondary>
3757 </indexterm>
3758 This is a Sendmail option for selecting 7 or 8 bit processing. Exim is 8-bit
3759 clean; it ignores this option.
3760 </para>
3761 </listitem></varlistentry>
3762 <varlistentry>
3763 <term><option>-bd</option></term>
3764 <listitem>
3765 <para>
3766 <indexterm role="option">
3767 <primary><option>-bd</option></primary>
3768 </indexterm>
3769 <indexterm role="concept">
3770 <primary>daemon</primary>
3771 </indexterm>
3772 <indexterm role="concept">
3773 <primary>SMTP</primary>
3774 <secondary>listener</secondary>
3775 </indexterm>
3776 <indexterm role="concept">
3777 <primary>queue runner</primary>
3778 </indexterm>
3779 This option runs Exim as a daemon, awaiting incoming SMTP connections. Usually
3780 the <option>-bd</option> option is combined with the <option>-q</option>&lt;<emphasis>time</emphasis>&gt; option, to specify
3781 that the daemon should also initiate periodic queue runs.
3782 </para>
3783 <para>
3784 The <option>-bd</option> option can be used only by an admin user. If either of the <option>-d</option>
3785 (debugging) or <option>-v</option> (verifying) options are set, the daemon does not
3786 disconnect from the controlling terminal. When running this way, it can be
3787 stopped by pressing ctrl-C.
3788 </para>
3789 <para>
3790 By default, Exim listens for incoming connections to the standard SMTP port on
3791 all the host&#x2019;s running interfaces. However, it is possible to listen on other
3792 ports, on multiple ports, and only on specific interfaces. Chapter
3793 <xref linkend="CHAPinterfaces"/> contains a description of the options that control this.
3794 </para>
3795 <para>
3796 When a listening daemon
3797 <indexterm role="concept">
3798 <primary>daemon</primary>
3799 <secondary>process id (pid)</secondary>
3800 </indexterm>
3801 <indexterm role="concept">
3802 <primary>pid (process id)</primary>
3803 <secondary>of daemon</secondary>
3804 </indexterm>
3805 is started without the use of <option>-oX</option> (that is, without overriding the normal
3806 configuration), it writes its process id to a file called <filename>exim-daemon.pid</filename>
3807 in Exim&#x2019;s spool directory. This location can be overridden by setting
3808 PID_FILE_PATH in <filename>Local/Makefile</filename>. The file is written while Exim is still
3809 running as root.
3810 </para>
3811 <para>
3812 When <option>-oX</option> is used on the command line to start a listening daemon, the
3813 process id is not written to the normal pid file path. However, <option>-oP</option> can be
3814 used to specify a path on the command line if a pid file is required.
3815 </para>
3816 <para>
3817 The SIGHUP signal
3818 <indexterm role="concept">
3819 <primary>SIGHUP</primary>
3820 </indexterm>
3821 <indexterm role="concept">
3822 <primary>daemon</primary>
3823 <secondary>restarting</secondary>
3824 </indexterm>
3825 can be used to cause the daemon to re-execute itself. This should be done
3826 whenever Exim&#x2019;s configuration file, or any file that is incorporated into it by
3827 means of the <option>.include</option> facility, is changed, and also whenever a new version
3828 of Exim is installed. It is not necessary to do this when other files that are
3829 referenced from the configuration (for example, alias files) are changed,
3830 because these are reread each time they are used.
3831 </para>
3832 </listitem></varlistentry>
3833 <varlistentry>
3834 <term><option>-bdf</option></term>
3835 <listitem>
3836 <para>
3837 <indexterm role="option">
3838 <primary><option>-bdf</option></primary>
3839 </indexterm>
3840 This option has the same effect as <option>-bd</option> except that it never disconnects
3841 from the controlling terminal, even when no debugging is specified.
3842 </para>
3843 </listitem></varlistentry>
3844 <varlistentry>
3845 <term><option>-be</option></term>
3846 <listitem>
3847 <para>
3848 <indexterm role="option">
3849 <primary><option>-be</option></primary>
3850 </indexterm>
3851 <indexterm role="concept">
3852 <primary>testing</primary>
3853 <secondary>string expansion</secondary>
3854 </indexterm>
3855 <indexterm role="concept">
3856 <primary>expansion</primary>
3857 <secondary>testing</secondary>
3858 </indexterm>
3859 Run Exim in expansion testing mode. Exim discards its root privilege, to
3860 prevent ordinary users from using this mode to read otherwise inaccessible
3861 files. If no arguments are given, Exim runs interactively, prompting for lines
3862 of data. Otherwise, it processes each argument in turn.
3863 </para>
3864 <para>
3865 If Exim was built with USE_READLINE=yes in <filename>Local/Makefile</filename>, it tries
3866 to load the <option>libreadline</option> library dynamically whenever the <option>-be</option> option is
3867 used without command line arguments. If successful, it uses the <function>readline()</function>
3868 function, which provides extensive line-editing facilities, for reading the
3869 test data. A line history is supported.
3870 </para>
3871 <para>
3872 Long expansion expressions can be split over several lines by using backslash
3873 continuations. As in Exim&#x2019;s runtime configuration, white space at the start of
3874 continuation lines is ignored. Each argument or data line is passed through the
3875 string expansion mechanism, and the result is output. Variable values from the
3876 configuration file (for example, <varname>$qualify_domain</varname>) are available, but no
3877 message-specific values (such as <varname>$message_exim_id</varname>) are set, because no message
3878 is being processed (but see <option>-bem</option> and <option>-Mset</option>).
3879 </para>
3880 <para>
3881 <emphasis role="bold">Note</emphasis>: If you use this mechanism to test lookups, and you change the data
3882 files or databases you are using, you must exit and restart Exim before trying
3883 the same lookup again. Otherwise, because each Exim process caches the results
3884 of lookups, you will just get the same result as before.
3885 </para>
3886 <para>
3887 Macro processing is done on lines before string-expansion: new macros can be
3888 defined and macros will be expanded.
3889 Because macros in the config file are often used for secrets, those are only
3890 available to admin users.
3891 </para>
3892 </listitem></varlistentry>
3893 <varlistentry>
3894 <term><option>-bem</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3895 <listitem>
3896 <para>
3897 <indexterm role="option">
3898 <primary><option>-bem</option></primary>
3899 </indexterm>
3900 <indexterm role="concept">
3901 <primary>testing</primary>
3902 <secondary>string expansion</secondary>
3903 </indexterm>
3904 <indexterm role="concept">
3905 <primary>expansion</primary>
3906 <secondary>testing</secondary>
3907 </indexterm>
3908 This option operates like <option>-be</option> except that it must be followed by the name
3909 of a file. For example:
3910 </para>
3911 <literallayout class="monospaced">
3912 exim -bem /tmp/testmessage
3913 </literallayout>
3914 <para>
3915 The file is read as a message (as if receiving a locally-submitted non-SMTP
3916 message) before any of the test expansions are done. Thus, message-specific
3917 variables such as <varname>$message_size</varname> and <varname>$header_from:</varname> are available. However,
3918 no <emphasis>Received:</emphasis> header is added to the message. If the <option>-t</option> option is set,
3919 recipients are read from the headers in the normal way, and are shown in the
3920 <varname>$recipients</varname> variable. Note that recipients cannot be given on the command
3921 line, because further arguments are taken as strings to expand (just like
3922 <option>-be</option>).
3923 </para>
3924 </listitem></varlistentry>
3925 <varlistentry>
3926 <term><option>-bF</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3927 <listitem>
3928 <para>
3929 <indexterm role="option">
3930 <primary><option>-bF</option></primary>
3931 </indexterm>
3932 <indexterm role="concept">
3933 <primary>system filter</primary>
3934 <secondary>testing</secondary>
3935 </indexterm>
3936 <indexterm role="concept">
3937 <primary>testing</primary>
3938 <secondary>system filter</secondary>
3939 </indexterm>
3940 This option is the same as <option>-bf</option> except that it assumes that the filter being
3941 tested is a system filter. The additional commands that are available only in
3942 system filters are recognized.
3943 </para>
3944 </listitem></varlistentry>
3945 <varlistentry>
3946 <term><option>-bf</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3947 <listitem>
3948 <para>
3949 <indexterm role="option">
3950 <primary><option>-bf</option></primary>
3951 </indexterm>
3952 <indexterm role="concept">
3953 <primary>filter</primary>
3954 <secondary>testing</secondary>
3955 </indexterm>
3956 <indexterm role="concept">
3957 <primary>testing</primary>
3958 <secondary>filter file</secondary>
3959 </indexterm>
3960 <indexterm role="concept">
3961 <primary>forward file</primary>
3962 <secondary>testing</secondary>
3963 </indexterm>
3964 <indexterm role="concept">
3965 <primary>testing</primary>
3966 <secondary>forward file</secondary>
3967 </indexterm>
3968 <indexterm role="concept">
3969 <primary>Sieve filter</primary>
3970 <secondary>testing</secondary>
3971 </indexterm>
3972 This option runs Exim in user filter testing mode; the file is the filter file
3973 to be tested, and a test message must be supplied on the standard input. If
3974 there are no message-dependent tests in the filter, an empty file can be
3975 supplied.
3976 </para>
3977 <para>
3978 If you want to test a system filter file, use <option>-bF</option> instead of <option>-bf</option>. You
3979 can use both <option>-bF</option> and <option>-bf</option> on the same command, in order to test a system
3980 filter and a user filter in the same run. For example:
3981 </para>
3982 <literallayout class="monospaced">
3983 exim -bF /system/filter -bf /user/filter &lt;/test/message
3984 </literallayout>
3985 <para>
3986 This is helpful when the system filter adds header lines or sets filter
3987 variables that are used by the user filter.
3988 </para>
3989 <para>
3990 If the test filter file does not begin with one of the special lines
3991 </para>
3992 <literallayout class="monospaced">
3993 # Exim filter
3994 # Sieve filter
3995 </literallayout>
3996 <para>
3997 it is taken to be a normal <filename>.forward</filename> file, and is tested for validity under
3998 that interpretation. See sections <xref linkend="SECTitenonfilred"/> to
3999 <xref linkend="SECTspecitredli"/> for a description of the possible contents of non-filter
4000 redirection lists.
4001 </para>
4002 <para>
4003 The result of an Exim command that uses <option>-bf</option>, provided no errors are
4004 detected, is a list of the actions that Exim would try to take if presented
4005 with the message for real. More details of filter testing are given in the
4006 separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>.
4007 </para>
4008 <para>
4009 When testing a filter file,
4010 <indexterm role="concept">
4011 <primary><quote>From</quote> line</primary>
4012 </indexterm>
4013 <indexterm role="concept">
4014 <primary>envelope sender</primary>
4015 </indexterm>
4016 <indexterm role="option">
4017 <primary><option>-f</option></primary>
4018 <secondary>for filter testing</secondary>
4019 </indexterm>
4020 the envelope sender can be set by the <option>-f</option> option,
4021 or by a <quote>From&nbsp;</quote> line at the start of the test message. Various parameters
4022 that would normally be taken from the envelope recipient address of the message
4023 can be set by means of additional command line options (see the next four
4024 options).
4025 </para>
4026 </listitem></varlistentry>
4027 <varlistentry>
4028 <term><option>-bfd</option>&nbsp;&lt;<emphasis>domain</emphasis>&gt;</term>
4029 <listitem>
4030 <para>
4031 <indexterm role="option">
4032 <primary><option>-bfd</option></primary>
4033 </indexterm>
4034 <indexterm role="variable">
4035 <primary><varname>$qualify_domain</varname></primary>
4036 </indexterm>
4037 This sets the domain of the recipient address when a filter file is being
4038 tested by means of the <option>-bf</option> option. The default is the value of
4039 <varname>$qualify_domain</varname>.
4040 </para>
4041 </listitem></varlistentry>
4042 <varlistentry>
4043 <term><option>-bfl</option>&nbsp;&lt;<emphasis>local&nbsp;part</emphasis>&gt;</term>
4044 <listitem>
4045 <para>
4046 <indexterm role="option">
4047 <primary><option>-bfl</option></primary>
4048 </indexterm>
4049 This sets the local part of the recipient address when a filter file is being
4050 tested by means of the <option>-bf</option> option. The default is the username of the
4051 process that calls Exim. A local part should be specified with any prefix or
4052 suffix stripped, because that is how it appears to the filter when a message is
4053 actually being delivered.
4054 </para>
4055 </listitem></varlistentry>
4056 <varlistentry>
4057 <term><option>-bfp</option>&nbsp;&lt;<emphasis>prefix</emphasis>&gt;</term>
4058 <listitem>
4059 <para>
4060 <indexterm role="option">
4061 <primary><option>-bfp</option></primary>
4062 </indexterm>
4063 <indexterm role="concept">
4064 <primary>affix</primary>
4065 <secondary>filter testing</secondary>
4066 </indexterm>
4067 This sets the prefix of the local part of the recipient address when a filter
4068 file is being tested by means of the <option>-bf</option> option. The default is an empty
4069 prefix.
4070 </para>
4071 </listitem></varlistentry>
4072 <varlistentry>
4073 <term><option>-bfs</option>&nbsp;&lt;<emphasis>suffix</emphasis>&gt;</term>
4074 <listitem>
4075 <para>
4076 <indexterm role="option">
4077 <primary><option>-bfs</option></primary>
4078 </indexterm>
4079 <indexterm role="concept">
4080 <primary>affix</primary>
4081 <secondary>filter testing</secondary>
4082 </indexterm>
4083 This sets the suffix of the local part of the recipient address when a filter
4084 file is being tested by means of the <option>-bf</option> option. The default is an empty
4085 suffix.
4086 </para>
4087 </listitem></varlistentry>
4088 <varlistentry>
4089 <term><option>-bh</option>&nbsp;&lt;<emphasis>IP&nbsp;address</emphasis>&gt;</term>
4090 <listitem>
4091 <para>
4092 <indexterm role="option">
4093 <primary><option>-bh</option></primary>
4094 </indexterm>
4095 <indexterm role="concept">
4096 <primary>testing</primary>
4097 <secondary>incoming SMTP</secondary>
4098 </indexterm>
4099 <indexterm role="concept">
4100 <primary>SMTP</primary>
4101 <secondary>testing incoming</secondary>
4102 </indexterm>
4103 <indexterm role="concept">
4104 <primary>testing</primary>
4105 <secondary>relay control</secondary>
4106 </indexterm>
4107 <indexterm role="concept">
4108 <primary>relaying</primary>
4109 <secondary>testing configuration</secondary>
4110 </indexterm>
4111 <indexterm role="concept">
4112 <primary>policy control</primary>
4113 <secondary>testing</secondary>
4114 </indexterm>
4115 <indexterm role="concept">
4116 <primary>debugging</primary>
4117 <secondary><option>-bh</option> option</secondary>
4118 </indexterm>
4119 This option runs a fake SMTP session as if from the given IP address, using the
4120 standard input and output. The IP address may include a port number at the end,
4121 after a full stop. For example:
4122 </para>
4123 <literallayout class="monospaced">
4124 exim -bh 10.9.8.7.1234
4125 exim -bh fe80::a00:20ff:fe86:a061.5678
4126 </literallayout>
4127 <para>
4128 When an IPv6 address is given, it is converted into canonical form. In the case
4129 of the second example above, the value of <varname>$sender_host_address</varname> after
4130 conversion to the canonical form is
4131 <literal>fe80:0000:0000:0a00:20ff:fe86:a061.5678</literal>.
4132 </para>
4133 <para>
4134 Comments as to what is going on are written to the standard error file. These
4135 include lines beginning with <quote>LOG</quote> for anything that would have been logged.
4136 This facility is provided for testing configuration options for incoming
4137 messages, to make sure they implement the required policy. For example, you can
4138 test your relay controls using <option>-bh</option>.
4139 </para>
4140 <para>
4141 <emphasis role="bold">Warning 1</emphasis>:
4142 <indexterm role="concept">
4143 <primary>RFC 1413</primary>
4144 </indexterm>
4145 You can test features of the configuration that rely on ident (RFC 1413)
4146 information by using the <option>-oMt</option> option. However, Exim cannot actually perform
4147 an ident callout when testing using <option>-bh</option> because there is no incoming SMTP
4148 connection.
4149 </para>
4150 <para>
4151 <emphasis role="bold">Warning 2</emphasis>: Address verification callouts (see section <xref linkend="SECTcallver"/>)
4152 are also skipped when testing using <option>-bh</option>. If you want these callouts to
4153 occur, use <option>-bhc</option> instead.
4154 </para>
4155 <para>
4156 Messages supplied during the testing session are discarded, and nothing is
4157 written to any of the real log files. There may be pauses when DNS (and other)
4158 lookups are taking place, and of course these may time out. The <option>-oMi</option> option
4159 can be used to specify a specific IP interface and port if this is important,
4160 and <option>-oMaa</option> and <option>-oMai</option> can be used to set parameters as if the SMTP
4161 session were authenticated.
4162 </para>
4163 <para>
4164 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option> whose
4165 output just states whether a given recipient address from a given host is
4166 acceptable or not. See section <xref linkend="SECTcheckaccess"/>.
4167 </para>
4168 <para>
4169 Features such as authentication and encryption, where the client input is not
4170 plain text, cannot easily be tested with <option>-bh</option>. Instead, you should use a
4171 specialized SMTP test program such as
4172 <emphasis role="bold"><ulink url="https://www.jetmore.org/john/code/swaks/">swaks</ulink></emphasis>.
4173 </para>
4174 </listitem></varlistentry>
4175 <varlistentry>
4176 <term><option>-bhc</option>&nbsp;&lt;<emphasis>IP&nbsp;address</emphasis>&gt;</term>
4177 <listitem>
4178 <para>
4179 <indexterm role="option">
4180 <primary><option>-bhc</option></primary>
4181 </indexterm>
4182 This option operates in the same way as <option>-bh</option>, except that address
4183 verification callouts are performed if required. This includes consulting and
4184 updating the callout cache database.
4185 </para>
4186 </listitem></varlistentry>
4187 <varlistentry>
4188 <term><option>-bi</option></term>
4189 <listitem>
4190 <para>
4191 <indexterm role="option">
4192 <primary><option>-bi</option></primary>
4193 </indexterm>
4194 <indexterm role="concept">
4195 <primary>alias file</primary>
4196 <secondary>building</secondary>
4197 </indexterm>
4198 <indexterm role="concept">
4199 <primary>building alias file</primary>
4200 </indexterm>
4201 <indexterm role="concept">
4202 <primary>Sendmail compatibility</primary>
4203 <secondary><option>-bi</option> option</secondary>
4204 </indexterm>
4205 Sendmail interprets the <option>-bi</option> option as a request to rebuild its alias file.
4206 Exim does not have the concept of a single alias file, and so it cannot mimic
4207 this behaviour. However, calls to <filename>/usr/lib/sendmail</filename> with the <option>-bi</option> option
4208 tend to appear in various scripts such as NIS make files, so the option must be
4209 recognized.
4210 </para>
4211 <para>
4212 If <option>-bi</option> is encountered, the command specified by the <option>bi_command</option>
4213 configuration option is run, under the uid and gid of the caller of Exim. If
4214 the <option>-oA</option> option is used, its value is passed to the command as an argument.
4215 The command set by <option>bi_command</option> may not contain arguments. The command can
4216 use the <emphasis>exim_dbmbuild</emphasis> utility, or some other means, to rebuild alias files
4217 if this is required. If the <option>bi_command</option> option is not set, calling Exim with
4218 <option>-bi</option> is a no-op.
4219 </para>
4220 </listitem></varlistentry>
4221 <varlistentry>
4222 <term><option>-bI:help</option></term>
4223 <listitem>
4224 <para>
4225 <indexterm role="option">
4226 <primary><option>-bI:help</option></primary>
4227 </indexterm>
4228 <indexterm role="concept">
4229 <primary>querying exim information</primary>
4230 </indexterm>
4231 We shall provide various options starting <literal>-bI:</literal> for querying Exim for
4232 information.  The output of many of these will be intended for machine
4233 consumption.  This one is not.  The <option>-bI:help</option> option asks Exim for a
4234 synopsis of supported options beginning <literal>-bI:</literal>.  Use of any of these
4235 options shall cause Exim to exit after producing the requested output.
4236 </para>
4237 </listitem></varlistentry>
4238 <varlistentry>
4239 <term><option>-bI:dscp</option></term>
4240 <listitem>
4241 <para>
4242 <indexterm role="option">
4243 <primary><option>-bI:dscp</option></primary>
4244 </indexterm>
4245 <indexterm role="concept">
4246 <primary>DSCP</primary>
4247 <secondary>values</secondary>
4248 </indexterm>
4249 This option causes Exim to emit an alphabetically sorted list of all
4250 recognised DSCP names.
4251 </para>
4252 </listitem></varlistentry>
4253 <varlistentry>
4254 <term><option>-bI:sieve</option></term>
4255 <listitem>
4256 <para>
4257 <indexterm role="option">
4258 <primary><option>-bI:sieve</option></primary>
4259 </indexterm>
4260 <indexterm role="concept">
4261 <primary>Sieve filter</primary>
4262 <secondary>capabilities</secondary>
4263 </indexterm>
4264 This option causes Exim to emit an alphabetically sorted list of all supported
4265 Sieve protocol extensions on stdout, one per line.  This is anticipated to be
4266 useful for ManageSieve (RFC 5804) implementations, in providing that protocol&#x2019;s
4267 <literal>SIEVE</literal> capability response line.  As the precise list may depend upon
4268 compile-time build options, which this option will adapt to, this is the only
4269 way to guarantee a correct response.
4270 </para>
4271 </listitem></varlistentry>
4272 <varlistentry>
4273 <term><option>-bm</option></term>
4274 <listitem>
4275 <para>
4276 <indexterm role="option">
4277 <primary><option>-bm</option></primary>
4278 </indexterm>
4279 <indexterm role="concept">
4280 <primary>local message reception</primary>
4281 </indexterm>
4282 This option runs an Exim receiving process that accepts an incoming,
4283 locally-generated message on the standard input. The recipients are given as the
4284 command arguments (except when <option>-t</option> is also present &ndash; see below). Each
4285 argument can be a comma-separated list of RFC 2822 addresses. This is the
4286 default option for selecting the overall action of an Exim call; it is assumed
4287 if no other conflicting option is present.
4288 </para>
4289 <para>
4290 If any addresses in the message are unqualified (have no domain), they are
4291 qualified by the values of the <option>qualify_domain</option> or <option>qualify_recipient</option>
4292 options, as appropriate. The <option>-bnq</option> option (see below) provides a way of
4293 suppressing this for special cases.
4294 </para>
4295 <para>
4296 Policy checks on the contents of local messages can be enforced by means of
4297 the non-SMTP ACL. See chapter <xref linkend="CHAPACL"/> for details.
4298 </para>
4299 <para>
4300 <indexterm role="concept">
4301 <primary>return code</primary>
4302 <secondary>for <option>-bm</option></secondary>
4303 </indexterm>
4304 The return code is zero if the message is successfully accepted. Otherwise, the
4305 action is controlled by the <option>-oe</option><emphasis>x</emphasis> option setting &ndash; see below.
4306 </para>
4307 <para>
4308 The format
4309 <indexterm role="concept">
4310 <primary>message</primary>
4311 <secondary>format</secondary>
4312 </indexterm>
4313 <indexterm role="concept">
4314 <primary>format</primary>
4315 <secondary>message</secondary>
4316 </indexterm>
4317 <indexterm role="concept">
4318 <primary><quote>From</quote> line</primary>
4319 </indexterm>
4320 <indexterm role="concept">
4321 <primary>UUCP</primary>
4322 <secondary><quote>From</quote> line</secondary>
4323 </indexterm>
4324 <indexterm role="concept">
4325 <primary>Sendmail compatibility</primary>
4326 <secondary><quote>From</quote> line</secondary>
4327 </indexterm>
4328 of the message must be as defined in RFC 2822, except that, for
4329 compatibility with Sendmail and Smail, a line in one of the forms
4330 </para>
4331 <literallayout class="monospaced">
4332 From sender Fri Jan  5 12:55 GMT 1997
4333 From sender Fri, 5 Jan 97 12:55:01
4334 </literallayout>
4335 <para>
4336 (with the weekday optional, and possibly with additional text after the date)
4337 is permitted to appear at the start of the message. There appears to be no
4338 authoritative specification of the format of this line. Exim recognizes it by
4339 matching against the regular expression defined by the <option>uucp_from_pattern</option>
4340 option, which can be changed if necessary.
4341 </para>
4342 <para>
4343 <indexterm role="option">
4344 <primary><option>-f</option></primary>
4345 <secondary>overriding <quote>From</quote> line</secondary>
4346 </indexterm>
4347 The specified sender is treated as if it were given as the argument to the
4348 <option>-f</option> option, but if a <option>-f</option> option is also present, its argument is used in
4349 preference to the address taken from the message. The caller of Exim must be a
4350 trusted user for the sender of a message to be set in this way.
4351 </para>
4352 </listitem></varlistentry>
4353 <varlistentry>
4354 <term><option>-bmalware</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
4355 <listitem>
4356 <para>
4357 <indexterm role="option">
4358 <primary><option>-bmalware</option></primary>
4359 </indexterm>
4360 <indexterm role="concept">
4361 <primary>testing</primary>
4362 <secondary>,</secondary>
4363 </indexterm>
4364 <indexterm role="concept">
4365 <primary>malware scan test</primary>
4366 </indexterm>
4367 This debugging option causes Exim to scan the given file or directory
4368 (depending on the used scanner interface),
4369 using the malware scanning framework.  The option of <option>av_scanner</option> influences
4370 this option, so if <option>av_scanner</option>&#x2019;s value is dependent upon an expansion then
4371 the expansion should have defaults which apply to this invocation.  ACLs are
4372 not invoked, so if <option>av_scanner</option> references an ACL variable then that variable
4373 will never be populated and <option>-bmalware</option> will fail.
4374 </para>
4375 <para>
4376 Exim will have changed working directory before resolving the filename, so
4377 using fully qualified pathnames is advisable.  Exim will be running as the Exim
4378 user when it tries to open the file, rather than as the invoking user.
4379 This option requires admin privileges.
4380 </para>
4381 <para>
4382 The <option>-bmalware</option> option will not be extended to be more generally useful,
4383 there are better tools for file-scanning.  This option exists to help
4384 administrators verify their Exim and AV scanner configuration.
4385 </para>
4386 </listitem></varlistentry>
4387 <varlistentry>
4388 <term><option>-bnq</option></term>
4389 <listitem>
4390 <para>
4391 <indexterm role="option">
4392 <primary><option>-bnq</option></primary>
4393 </indexterm>
4394 <indexterm role="concept">
4395 <primary>address qualification, suppressing</primary>
4396 </indexterm>
4397 By default, Exim automatically qualifies unqualified addresses (those
4398 without domains) that appear in messages that are submitted locally (that
4399 is, not over TCP/IP). This qualification applies both to addresses in
4400 envelopes, and addresses in header lines. Sender addresses are qualified using
4401 <option>qualify_domain</option>, and recipient addresses using <option>qualify_recipient</option> (which
4402 defaults to the value of <option>qualify_domain</option>).
4403 </para>
4404 <para>
4405 Sometimes, qualification is not wanted. For example, if <option>-bS</option> (batch SMTP) is
4406 being used to re-submit messages that originally came from remote hosts after
4407 content scanning, you probably do not want to qualify unqualified addresses in
4408 header lines. (Such lines will be present only if you have not enabled a header
4409 syntax check in the appropriate ACL.)
4410 </para>
4411 <para>
4412 The <option>-bnq</option> option suppresses all qualification of unqualified addresses in
4413 messages that originate on the local host. When this is used, unqualified
4414 addresses in the envelope provoke errors (causing message rejection) and
4415 unqualified addresses in header lines are left alone.
4416 </para>
4417 </listitem></varlistentry>
4418 <varlistentry>
4419 <term><option>-bP</option></term>
4420 <listitem>
4421 <para>
4422 <indexterm role="option">
4423 <primary><option>-bP</option></primary>
4424 </indexterm>
4425 <indexterm role="concept">
4426 <primary>configuration options</primary>
4427 <secondary>extracting</secondary>
4428 </indexterm>
4429 <indexterm role="concept">
4430 <primary>options</primary>
4431 <secondary>configuration &ndash; extracting</secondary>
4432 </indexterm>
4433 If this option is given with no arguments, it causes the values of all Exim&#x2019;s
4434 main configuration options to be written to the standard output. The values
4435 of one or more specific options can be requested by giving their names as
4436 arguments, for example:
4437 </para>
4438 <literallayout class="monospaced">
4439 exim -bP qualify_domain hold_domains
4440 </literallayout>
4441 <para>
4442 <indexterm role="concept">
4443 <primary>hiding configuration option values</primary>
4444 </indexterm>
4445 <indexterm role="concept">
4446 <primary>configuration options</primary>
4447 <secondary>hiding value of</secondary>
4448 </indexterm>
4449 <indexterm role="concept">
4450 <primary>options</primary>
4451 <secondary>hiding value of</secondary>
4452 </indexterm>
4453 However, any option setting that is preceded by the word <quote>hide</quote> in the
4454 configuration file is not shown in full, except to an admin user. For other
4455 users, the output is as in this example:
4456 </para>
4457 <literallayout class="monospaced">
4458 mysql_servers = &lt;value not displayable&gt;
4459 </literallayout>
4460 <para>
4461 If <option>config</option> is given as an argument, the config is
4462 output, as it was parsed, any include file resolved, any comment removed.
4463 </para>
4464 <para>
4465 If <option>config_file</option> is given as an argument, the name of the runtime
4466 configuration file is output. (<option>configure_file</option> works too, for
4467 backward compatibility.)
4468 If a list of configuration files was supplied, the value that is output here
4469 is the name of the file that was actually used.
4470 </para>
4471 <para>
4472 <indexterm role="concept">
4473 <primary>options</primary>
4474 <secondary>hiding name of</secondary>
4475 </indexterm>
4476 If the <option>-n</option> flag is given, then for most modes of <option>-bP</option> operation the
4477 name will not be output.
4478 </para>
4479 <para>
4480 <indexterm role="concept">
4481 <primary>daemon</primary>
4482 <secondary>process id (pid)</secondary>
4483 </indexterm>
4484 <indexterm role="concept">
4485 <primary>pid (process id)</primary>
4486 <secondary>of daemon</secondary>
4487 </indexterm>
4488 If <option>log_file_path</option> or <option>pid_file_path</option> are given, the names of the
4489 directories where log files and daemon pid files are written are output,
4490 respectively. If these values are unset, log files are written in a
4491 sub-directory of the spool directory called <option>log</option>, and the pid file is
4492 written directly into the spool directory.
4493 </para>
4494 <para>
4495 If <option>-bP</option> is followed by a name preceded by <literal>+</literal>, for example,
4496 </para>
4497 <literallayout class="monospaced">
4498 exim -bP +local_domains
4499 </literallayout>
4500 <para>
4501 it searches for a matching named list of any type (domain, host, address, or
4502 local part) and outputs what it finds.
4503 </para>
4504 <para>
4505 <indexterm role="concept">
4506 <primary>options</primary>
4507 <secondary>router &ndash; extracting</secondary>
4508 </indexterm>
4509 <indexterm role="concept">
4510 <primary>options</primary>
4511 <secondary>transport &ndash; extracting</secondary>
4512 </indexterm>
4513 <indexterm role="concept">
4514 <primary>options</primary>
4515 <secondary>authenticator &ndash; extracting</secondary>
4516 </indexterm>
4517 If one of the words <option>router</option>, <option>transport</option>, or <option>authenticator</option> is given,
4518 followed by the name of an appropriate driver instance, the option settings for
4519 that driver are output. For example:
4520 </para>
4521 <literallayout class="monospaced">
4522 exim -bP transport local_delivery
4523 </literallayout>
4524 <para>
4525 The generic driver options are output first, followed by the driver&#x2019;s private
4526 options. A list of the names of drivers of a particular type can be obtained by
4527 using one of the words <option>router_list</option>, <option>transport_list</option>, or
4528 <option>authenticator_list</option>, and a complete list of all drivers with their option
4529 settings can be obtained by using <option>routers</option>, <option>transports</option>, or
4530 <option>authenticators</option>.
4531 </para>
4532 <para>
4533 <indexterm role="concept">
4534 <primary>environment</primary>
4535 </indexterm>
4536 If <option>environment</option> is given as an argument, the set of environment
4537 variables is output, line by line. Using the <option>-n</option> flag suppresses the value of the
4538 variables.
4539 </para>
4540 <para>
4541 <indexterm role="concept">
4542 <primary>options</primary>
4543 <secondary>macro &ndash; extracting</secondary>
4544 </indexterm>
4545 If invoked by an admin user, then <option>macro</option>, <option>macro_list</option> and <option>macros</option>
4546 are available, similarly to the drivers.  Because macros are sometimes used
4547 for storing passwords, this option is restricted.
4548 The output format is one item per line.
4549 For the "-bP macro &lt;name&gt;" form, if no such macro is found
4550 the exit status will be nonzero.
4551 </para>
4552 </listitem></varlistentry>
4553 <varlistentry>
4554 <term><option>-bp</option></term>
4555 <listitem>
4556 <para>
4557 <indexterm role="option">
4558 <primary><option>-bp</option></primary>
4559 </indexterm>
4560 <indexterm role="concept">
4561 <primary>queue</primary>
4562 <secondary>listing messages in</secondary>
4563 </indexterm>
4564 <indexterm role="concept">
4565 <primary>listing</primary>
4566 <secondary>messages in the queue</secondary>
4567 </indexterm>
4568 This option requests a listing of the contents of the mail queue on the
4569 standard output. If the <option>-bp</option> option is followed by a list of message ids,
4570 just those messages are listed. By default, this option can be used only by an
4571 admin user. However, the <option>queue_list_requires_admin</option> option can be set false
4572 to allow any user to see the queue.
4573 </para>
4574 <para>
4575 Each message in the queue is displayed as in the following example:
4576 </para>
4577 <literallayout class="monospaced">
4578 25m  2.9K 0t5C6f-0000c8-00 &lt;alice@wonderland.fict.example&gt;
4579           red.king@looking-glass.fict.example
4580           &lt;other addresses&gt;
4581 </literallayout>
4582 <para>
4583 <indexterm role="concept">
4584 <primary>message</primary>
4585 <secondary>size in queue listing</secondary>
4586 </indexterm>
4587 <indexterm role="concept">
4588 <primary>size</primary>
4589 <secondary>of message</secondary>
4590 </indexterm>
4591 The first line contains the length of time the message has been in the queue
4592 (in this case 25 minutes), the size of the message (2.9K), the unique local
4593 identifier for the message, and the message sender, as contained in the
4594 envelope. For bounce messages, the sender address is empty, and appears as
4595 <quote>&lt;&gt;</quote>. If the message was submitted locally by an untrusted user who overrode
4596 the default sender address, the user&#x2019;s login name is shown in parentheses
4597 before the sender address.
4598 </para>
4599 <para>
4600 <indexterm role="concept">
4601 <primary>frozen messages</primary>
4602 <secondary>in queue listing</secondary>
4603 </indexterm>
4604 If the message is frozen (attempts to deliver it are suspended) then the text
4605 <quote>*** frozen ***</quote> is displayed at the end of this line.
4606 </para>
4607 <para>
4608 The recipients of the message (taken from the envelope, not the headers) are
4609 displayed on subsequent lines. Those addresses to which the message has already
4610 been delivered are marked with the letter D. If an original address gets
4611 expanded into several addresses via an alias or forward file, the original is
4612 displayed with a D only when deliveries for all of its child addresses are
4613 complete.
4614 </para>
4615 </listitem></varlistentry>
4616 <varlistentry>
4617 <term><option>-bpa</option></term>
4618 <listitem>
4619 <para>
4620 <indexterm role="option">
4621 <primary><option>-bpa</option></primary>
4622 </indexterm>
4623 This option operates like <option>-bp</option>, but in addition it shows delivered addresses
4624 that were generated from the original top level address(es) in each message by
4625 alias or forwarding operations. These addresses are flagged with <quote>+D</quote> instead
4626 of just <quote>D</quote>.
4627 </para>
4628 </listitem></varlistentry>
4629 <varlistentry>
4630 <term><option>-bpc</option></term>
4631 <listitem>
4632 <para>
4633 <indexterm role="option">
4634 <primary><option>-bpc</option></primary>
4635 </indexterm>
4636 <indexterm role="concept">
4637 <primary>queue</primary>
4638 <secondary>count of messages on</secondary>
4639 </indexterm>
4640 This option counts the number of messages in the queue, and writes the total
4641 to the standard output. It is restricted to admin users, unless
4642 <option>queue_list_requires_admin</option> is set false.
4643 </para>
4644 </listitem></varlistentry>
4645 <varlistentry>
4646 <term><option>-bpr</option></term>
4647 <listitem>
4648 <para>
4649 <indexterm role="option">
4650 <primary><option>-bpr</option></primary>
4651 </indexterm>
4652 This option operates like <option>-bp</option>, but the output is not sorted into
4653 chronological order of message arrival. This can speed it up when there are
4654 lots of messages in the queue, and is particularly useful if the output is
4655 going to be post-processed in a way that doesn&#x2019;t need the sorting.
4656 </para>
4657 </listitem></varlistentry>
4658 <varlistentry>
4659 <term><option>-bpra</option></term>
4660 <listitem>
4661 <para>
4662 <indexterm role="option">
4663 <primary><option>-bpra</option></primary>
4664 </indexterm>
4665 This option is a combination of <option>-bpr</option> and <option>-bpa</option>.
4666 </para>
4667 </listitem></varlistentry>
4668 <varlistentry>
4669 <term><option>-bpru</option></term>
4670 <listitem>
4671 <para>
4672 <indexterm role="option">
4673 <primary><option>-bpru</option></primary>
4674 </indexterm>
4675 This option is a combination of <option>-bpr</option> and <option>-bpu</option>.
4676 </para>
4677 </listitem></varlistentry>
4678 <varlistentry>
4679 <term><option>-bpu</option></term>
4680 <listitem>
4681 <para>
4682 <indexterm role="option">
4683 <primary><option>-bpu</option></primary>
4684 </indexterm>
4685 This option operates like <option>-bp</option> but shows only undelivered top-level
4686 addresses for each message displayed. Addresses generated by aliasing or
4687 forwarding are not shown, unless the message was deferred after processing by a
4688 router with the <option>one_time</option> option set.
4689 </para>
4690 </listitem></varlistentry>
4691 <varlistentry>
4692 <term><option>-brt</option></term>
4693 <listitem>
4694 <para>
4695 <indexterm role="option">
4696 <primary><option>-brt</option></primary>
4697 </indexterm>
4698 <indexterm role="concept">
4699 <primary>testing</primary>
4700 <secondary>retry configuration</secondary>
4701 </indexterm>
4702 <indexterm role="concept">
4703 <primary>retry</primary>
4704 <secondary>configuration testing</secondary>
4705 </indexterm>
4706 This option is for testing retry rules, and it must be followed by up to three
4707 arguments. It causes Exim to look for a retry rule that matches the values
4708 and to write it to the standard output. For example:
4709 </para>
4710 <literallayout class="monospaced">
4711 exim -brt bach.comp.mus.example
4712 Retry rule: *.comp.mus.example  F,2h,15m; F,4d,30m;
4713 </literallayout>
4714 <para>
4715 See chapter <xref linkend="CHAPretry"/> for a description of Exim&#x2019;s retry rules. The first
4716 argument, which is required, can be a complete address in the form
4717 <emphasis>local_part@domain</emphasis>, or it can be just a domain name. If the second argument
4718 contains a dot, it is interpreted as an optional second domain name; if no
4719 retry rule is found for the first argument, the second is tried. This ties in
4720 with Exim&#x2019;s behaviour when looking for retry rules for remote hosts &ndash; if no
4721 rule is found that matches the host, one that matches the mail domain is
4722 sought. Finally, an argument that is the name of a specific delivery error, as
4723 used in setting up retry rules, can be given. For example:
4724 </para>
4725 <literallayout class="monospaced">
4726 exim -brt haydn.comp.mus.example quota_3d
4727 Retry rule: *@haydn.comp.mus.example quota_3d  F,1h,15m
4728 </literallayout>
4729 </listitem></varlistentry>
4730 <varlistentry>
4731 <term><option>-brw</option></term>
4732 <listitem>
4733 <para>
4734 <indexterm role="option">
4735 <primary><option>-brw</option></primary>
4736 </indexterm>
4737 <indexterm role="concept">
4738 <primary>testing</primary>
4739 <secondary>rewriting</secondary>
4740 </indexterm>
4741 <indexterm role="concept">
4742 <primary>rewriting</primary>
4743 <secondary>testing</secondary>
4744 </indexterm>
4745 This option is for testing address rewriting rules, and it must be followed by
4746 a single argument, consisting of either a local part without a domain, or a
4747 complete address with a fully qualified domain. Exim outputs how this address
4748 would be rewritten for each possible place it might appear. See chapter
4749 <xref linkend="CHAPrewrite"/> for further details.
4750 </para>
4751 </listitem></varlistentry>
4752 <varlistentry>
4753 <term><option>-bS</option></term>
4754 <listitem>
4755 <para>
4756 <indexterm role="option">
4757 <primary><option>-bS</option></primary>
4758 </indexterm>
4759 <indexterm role="concept">
4760 <primary>SMTP</primary>
4761 <secondary>batched incoming</secondary>
4762 </indexterm>
4763 <indexterm role="concept">
4764 <primary>batched SMTP input</primary>
4765 </indexterm>
4766 This option is used for batched SMTP input, which is an alternative interface
4767 for non-interactive local message submission. A number of messages can be
4768 submitted in a single run. However, despite its name, this is not really SMTP
4769 input. Exim reads each message&#x2019;s envelope from SMTP commands on the standard
4770 input, but generates no responses. If the caller is trusted, or
4771 <option>untrusted_set_sender</option> is set, the senders in the SMTP MAIL commands are
4772 believed; otherwise the sender is always the caller of Exim.
4773 </para>
4774 <para>
4775 The message itself is read from the standard input, in SMTP format (leading
4776 dots doubled), terminated by a line containing just a single dot. An error is
4777 provoked if the terminating dot is missing. A further message may then follow.
4778 </para>
4779 <para>
4780 As for other local message submissions, the contents of incoming batch SMTP
4781 messages can be checked using the non-SMTP ACL (see chapter <xref linkend="CHAPACL"/>).
4782 Unqualified addresses are automatically qualified using <option>qualify_domain</option> and
4783 <option>qualify_recipient</option>, as appropriate, unless the <option>-bnq</option> option is used.
4784 </para>
4785 <para>
4786 Some other SMTP commands are recognized in the input. HELO and EHLO act
4787 as RSET; VRFY, EXPN, ETRN, and HELP act as NOOP;
4788 QUIT quits, ignoring the rest of the standard input.
4789 </para>
4790 <para>
4791 <indexterm role="concept">
4792 <primary>return code</primary>
4793 <secondary>for <option>-bS</option></secondary>
4794 </indexterm>
4795 If any error is encountered, reports are written to the standard output and
4796 error streams, and Exim gives up immediately. The return code is 0 if no error
4797 was detected; it is 1 if one or more messages were accepted before the error
4798 was detected; otherwise it is 2.
4799 </para>
4800 <para>
4801 More details of input using batched SMTP are given in section
4802 <xref linkend="SECTincomingbatchedSMTP"/>.
4803 </para>
4804 </listitem></varlistentry>
4805 <varlistentry>
4806 <term><option>-bs</option></term>
4807 <listitem>
4808 <para>
4809 <indexterm role="option">
4810 <primary><option>-bs</option></primary>
4811 </indexterm>
4812 <indexterm role="concept">
4813 <primary>SMTP</primary>
4814 <secondary>local input</secondary>
4815 </indexterm>
4816 <indexterm role="concept">
4817 <primary>local SMTP input</primary>
4818 </indexterm>
4819 This option causes Exim to accept one or more messages by reading SMTP commands
4820 on the standard input, and producing SMTP replies on the standard output. SMTP
4821 policy controls, as defined in ACLs (see chapter <xref linkend="CHAPACL"/>) are applied.
4822 Some user agents use this interface as a way of passing locally-generated
4823 messages to the MTA.
4824 </para>
4825 <para>
4826 In
4827 <indexterm role="concept">
4828 <primary>sender</primary>
4829 <secondary>source of</secondary>
4830 </indexterm>
4831 this usage, if the caller of Exim is trusted, or <option>untrusted_set_sender</option> is
4832 set, the senders of messages are taken from the SMTP MAIL commands.
4833 Otherwise the content of these commands is ignored and the sender is set up as
4834 the calling user. Unqualified addresses are automatically qualified using
4835 <option>qualify_domain</option> and <option>qualify_recipient</option>, as appropriate, unless the
4836 <option>-bnq</option> option is used.
4837 </para>
4838 <para>
4839 <indexterm role="concept">
4840 <primary>inetd</primary>
4841 </indexterm>
4842 The
4843 <option>-bs</option> option is also used to run Exim from <emphasis>inetd</emphasis>, as an alternative to
4844 using a listening daemon. Exim can distinguish the two cases by checking
4845 whether the standard input is a TCP/IP socket. When Exim is called from
4846 <emphasis>inetd</emphasis>, the source of the mail is assumed to be remote, and the comments
4847 above concerning senders and qualification do not apply. In this situation,
4848 Exim behaves in exactly the same way as it does when receiving a message via
4849 the listening daemon.
4850 </para>
4851 </listitem></varlistentry>
4852 <varlistentry>
4853 <term><option>-bt</option></term>
4854 <listitem>
4855 <para>
4856 <indexterm role="option">
4857 <primary><option>-bt</option></primary>
4858 </indexterm>
4859 <indexterm role="concept">
4860 <primary>testing</primary>
4861 <secondary>addresses</secondary>
4862 </indexterm>
4863 <indexterm role="concept">
4864 <primary>address</primary>
4865 <secondary>testing</secondary>
4866 </indexterm>
4867 This option runs Exim in address testing mode, in which each argument is taken
4868 as a recipient address to be tested for deliverability. The results are
4869 written to the standard output. If a test fails, and the caller is not an admin
4870 user, no details of the failure are output, because these might contain
4871 sensitive information such as usernames and passwords for database lookups.
4872 </para>
4873 <para>
4874 If no arguments are given, Exim runs in an interactive manner, prompting with a
4875 right angle bracket for addresses to be tested.
4876 </para>
4877 <para>
4878 Unlike the <option>-be</option> test option, you cannot arrange for Exim to use the
4879 <function>readline()</function> function, because it is running as <emphasis>root</emphasis> and there are
4880 security issues.
4881 </para>
4882 <para>
4883 Each address is handled as if it were the recipient address of a message
4884 (compare the <option>-bv</option> option). It is passed to the routers and the result is
4885 written to the standard output. However, any router that has
4886 <option>no_address_test</option> set is bypassed. This can make <option>-bt</option> easier to use for
4887 genuine routing tests if your first router passes everything to a scanner
4888 program.
4889 </para>
4890 <para>
4891 <indexterm role="concept">
4892 <primary>return code</primary>
4893 <secondary>for <option>-bt</option></secondary>
4894 </indexterm>
4895 The return code is 2 if any address failed outright; it is 1 if no address
4896 failed outright but at least one could not be resolved for some reason. Return
4897 code 0 is given only when all addresses succeed.
4898 </para>
4899 <para>
4900 <indexterm role="concept">
4901 <primary>duplicate addresses</primary>
4902 </indexterm>
4903 <emphasis role="bold">Note</emphasis>: When actually delivering a message, Exim removes duplicate recipient
4904 addresses after routing is complete, so that only one delivery takes place.
4905 This does not happen when testing with <option>-bt</option>; the full results of routing are
4906 always shown.
4907 </para>
4908 <para>
4909 <emphasis role="bold">Warning</emphasis>: <option>-bt</option> can only do relatively simple testing. If any of the
4910 routers in the configuration makes any tests on the sender address of a
4911 message,
4912 <indexterm role="option">
4913 <primary><option>-f</option></primary>
4914 <secondary>for address testing</secondary>
4915 </indexterm>
4916 you can use the <option>-f</option> option to set an appropriate sender when running
4917 <option>-bt</option> tests. Without it, the sender is assumed to be the calling user at the
4918 default qualifying domain. However, if you have set up (for example) routers
4919 whose behaviour depends on the contents of an incoming message, you cannot test
4920 those conditions using <option>-bt</option>. The <option>-N</option> option provides a possible way of
4921 doing such tests.
4922 </para>
4923 </listitem></varlistentry>
4924 <varlistentry>
4925 <term><option>-bV</option></term>
4926 <listitem>
4927 <para>
4928 <indexterm role="option">
4929 <primary><option>-bV</option></primary>
4930 </indexterm>
4931 <indexterm role="concept">
4932 <primary>version number of Exim</primary>
4933 </indexterm>
4934 This option causes Exim to write the current version number, compilation
4935 number, and compilation date of the <emphasis>exim</emphasis> binary to the standard output.
4936 It also lists the DBM library that is being used, the optional modules (such as
4937 specific lookup types), the drivers that are included in the binary, and the
4938 name of the runtime configuration file that is in use.
4939 </para>
4940 <para>
4941 As part of its operation, <option>-bV</option> causes Exim to read and syntax check its
4942 configuration file. However, this is a static check only. It cannot check
4943 values that are to be expanded. For example, although a misspelt ACL verb is
4944 detected, an error in the verb&#x2019;s arguments is not. You cannot rely on <option>-bV</option>
4945 alone to discover (for example) all the typos in the configuration; some
4946 realistic testing is needed. The <option>-bh</option> and <option>-N</option> options provide more
4947 dynamic testing facilities.
4948 </para>
4949 </listitem></varlistentry>
4950 <varlistentry>
4951 <term><option>-bv</option></term>
4952 <listitem>
4953 <para>
4954 <indexterm role="option">
4955 <primary><option>-bv</option></primary>
4956 </indexterm>
4957 <indexterm role="concept">
4958 <primary>verifying address</primary>
4959 <secondary>using <option>-bv</option></secondary>
4960 </indexterm>
4961 <indexterm role="concept">
4962 <primary>address</primary>
4963 <secondary>verification</secondary>
4964 </indexterm>
4965 This option runs Exim in address verification mode, in which each argument is
4966 taken as a recipient address to be verified by the routers. (This does
4967 not involve any verification callouts). During normal operation, verification
4968 happens mostly as a consequence processing a <option>verify</option> condition in an ACL
4969 (see chapter <xref linkend="CHAPACL"/>). If you want to test an entire ACL, possibly
4970 including callouts, see the <option>-bh</option> and <option>-bhc</option> options.
4971 </para>
4972 <para>
4973 If verification fails, and the caller is not an admin user, no details of the
4974 failure are output, because these might contain sensitive information such as
4975 usernames and passwords for database lookups.
4976 </para>
4977 <para>
4978 If no arguments are given, Exim runs in an interactive manner, prompting with a
4979 right angle bracket for addresses to be verified.
4980 </para>
4981 <para>
4982 Unlike the <option>-be</option> test option, you cannot arrange for Exim to use the
4983 <function>readline()</function> function, because it is running as <emphasis>exim</emphasis> and there are
4984 security issues.
4985 </para>
4986 <para>
4987 Verification differs from address testing (the <option>-bt</option> option) in that routers
4988 that have <option>no_verify</option> set are skipped, and if the address is accepted by a
4989 router that has <option>fail_verify</option> set, verification fails. The address is
4990 verified as a recipient if <option>-bv</option> is used; to test verification for a sender
4991 address, <option>-bvs</option> should be used.
4992 </para>
4993 <para>
4994 If the <option>-v</option> option is not set, the output consists of a single line for each
4995 address, stating whether it was verified or not, and giving a reason in the
4996 latter case. Without <option>-v</option>, generating more than one address by redirection
4997 causes verification to end successfully, without considering the generated
4998 addresses. However, if just one address is generated, processing continues,
4999 and the generated address must verify successfully for the overall verification
5000 to succeed.
5001 </para>
5002 <para>
5003 When <option>-v</option> is set, more details are given of how the address has been handled,
5004 and in the case of address redirection, all the generated addresses are also
5005 considered. Verification may succeed for some and fail for others.
5006 </para>
5007 <para>
5008 The
5009 <indexterm role="concept">
5010 <primary>return code</primary>
5011 <secondary>for <option>-bv</option></secondary>
5012 </indexterm>
5013 return code is 2 if any address failed outright; it is 1 if no address
5014 failed outright but at least one could not be resolved for some reason. Return
5015 code 0 is given only when all addresses succeed.
5016 </para>
5017 <para>
5018 If any of the routers in the configuration makes any tests on the sender
5019 address of a message, you should use the <option>-f</option> option to set an appropriate
5020 sender when running <option>-bv</option> tests. Without it, the sender is assumed to be the
5021 calling user at the default qualifying domain.
5022 </para>
5023 </listitem></varlistentry>
5024 <varlistentry>
5025 <term><option>-bvs</option></term>
5026 <listitem>
5027 <para>
5028 <indexterm role="option">
5029 <primary><option>-bvs</option></primary>
5030 </indexterm>
5031 This option acts like <option>-bv</option>, but verifies the address as a sender rather
5032 than a recipient address. This affects any rewriting and qualification that
5033 might happen.
5034 </para>
5035 </listitem></varlistentry>
5036 <varlistentry>
5037 <term><option>-bw</option></term>
5038 <listitem>
5039 <para>
5040 <indexterm role="option">
5041 <primary><option>-bw</option></primary>
5042 </indexterm>
5043 <indexterm role="concept">
5044 <primary>daemon</primary>
5045 </indexterm>
5046 <indexterm role="concept">
5047 <primary>inetd</primary>
5048 </indexterm>
5049 <indexterm role="concept">
5050 <primary>inetd</primary>
5051 <secondary>wait mode</secondary>
5052 </indexterm>
5053 This option runs Exim as a daemon, awaiting incoming SMTP connections,
5054 similarly to the <option>-bd</option> option.  All port specifications on the command-line
5055 and in the configuration file are ignored.  Queue-running may not be specified.
5056 </para>
5057 <para>
5058 In this mode, Exim expects to be passed a socket as fd 0 (stdin) which is
5059 listening for connections.  This permits the system to start up and have
5060 inetd (or equivalent) listen on the SMTP ports, starting an Exim daemon for
5061 each port only when the first connection is received.
5062 </para>
5063 <para>
5064 If the option is given as <option>-bw</option>&lt;<emphasis>time</emphasis>&gt; then the time is a timeout, after
5065 which the daemon will exit, which should cause inetd to listen once more.
5066 </para>
5067 </listitem></varlistentry>
5068 <varlistentry>
5069 <term><option>-C</option>&nbsp;&lt;<emphasis>filelist</emphasis>&gt;</term>
5070 <listitem>
5071 <para>
5072 <indexterm role="option">
5073 <primary><option>-C</option></primary>
5074 </indexterm>
5075 <indexterm role="concept">
5076 <primary>configuration file</primary>
5077 <secondary>alternate</secondary>
5078 </indexterm>
5079 <indexterm role="concept">
5080 <primary>CONFIGURE_FILE</primary>
5081 </indexterm>
5082 <indexterm role="concept">
5083 <primary>alternate configuration file</primary>
5084 </indexterm>
5085 This option causes Exim to find the runtime configuration file from the given
5086 list instead of from the list specified by the CONFIGURE_FILE
5087 compile-time setting. Usually, the list will consist of just a single filename,
5088 but it can be a colon-separated list of names. In this case, the first
5089 file that exists is used. Failure to open an existing file stops Exim from
5090 proceeding any further along the list, and an error is generated.
5091 </para>
5092 <para>
5093 When this option is used by a caller other than root, and the list is different
5094 from the compiled-in list, Exim gives up its root privilege immediately, and
5095 runs with the real and effective uid and gid set to those of the caller.
5096 However, if a TRUSTED_CONFIG_LIST file is defined in <filename>Local/Makefile</filename>, that
5097 file contains a list of full pathnames, one per line, for configuration files
5098 which are trusted. Root privilege is retained for any configuration file so
5099 listed, as long as the caller is the Exim user (or the user specified in the
5100 CONFIGURE_OWNER option, if any), and as long as the configuration file is
5101 not writeable by inappropriate users or groups.
5102 </para>
5103 <para>
5104 Leaving TRUSTED_CONFIG_LIST unset precludes the possibility of testing a
5105 configuration using <option>-C</option> right through message reception and delivery,
5106 even if the caller is root. The reception works, but by that time, Exim is
5107 running as the Exim user, so when it re-executes to regain privilege for the
5108 delivery, the use of <option>-C</option> causes privilege to be lost. However, root can
5109 test reception and delivery using two separate commands (one to put a message
5110 in the queue, using <option>-odq</option>, and another to do the delivery, using <option>-M</option>).
5111 </para>
5112 <para>
5113 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
5114 prefix string with which any file named in a <option>-C</option> command line option
5115 must start. In addition, the filename must not contain the sequence <literal>/../</literal>.
5116 However, if the value of the <option>-C</option> option is identical to the value of
5117 CONFIGURE_FILE in <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as
5118 usual. There is no default setting for ALT_CONFIG_PREFIX; when it is
5119 unset, any filename can be used with <option>-C</option>.
5120 </para>
5121 <para>
5122 ALT_CONFIG_PREFIX can be used to confine alternative configuration files
5123 to a directory to which only root has access. This prevents someone who has
5124 broken into the Exim account from running a privileged Exim with an arbitrary
5125 configuration file.
5126 </para>
5127 <para>
5128 The <option>-C</option> facility is useful for ensuring that configuration files are
5129 syntactically correct, but cannot be used for test deliveries, unless the
5130 caller is privileged, or unless it is an exotic configuration that does not
5131 require privilege. No check is made on the owner or group of the files
5132 specified by this option.
5133 </para>
5134 </listitem></varlistentry>
5135 <varlistentry>
5136 <term><option>-D</option>&lt;<emphasis>macro</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt;</term>
5137 <listitem>
5138 <para>
5139 <indexterm role="option">
5140 <primary><option>-D</option></primary>
5141 </indexterm>
5142 <indexterm role="concept">
5143 <primary>macro</primary>
5144 <secondary>setting on command line</secondary>
5145 </indexterm>
5146 This option can be used to override macro definitions in the configuration file
5147 (see section <xref linkend="SECTmacrodefs"/>). However, like <option>-C</option>, if it is used by an
5148 unprivileged caller, it causes Exim to give up its root privilege.
5149 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
5150 completely disabled, and its use causes an immediate error exit.
5151 </para>
5152 <para>
5153 If WHITELIST_D_MACROS is defined in <filename>Local/Makefile</filename> then it should be a
5154 colon-separated list of macros which are considered safe and, if <option>-D</option> only
5155 supplies macros from this list, and the values are acceptable, then Exim will
5156 not give up root privilege if the caller is root, the Exim run-time user, or
5157 the CONFIGURE_OWNER, if set.  This is a transition mechanism and is expected
5158 to be removed in the future.  Acceptable values for the macros satisfy the
5159 regexp: <literal>^[A-Za-z0-9_/.-]*$</literal>
5160 </para>
5161 <para>
5162 The entire option (including equals sign if present) must all be within one
5163 command line item. <option>-D</option> can be used to set the value of a macro to the empty
5164 string, in which case the equals sign is optional. These two commands are
5165 synonymous:
5166 </para>
5167 <literallayout class="monospaced">
5168 exim -DABC  ...
5169 exim -DABC= ...
5170 </literallayout>
5171 <para>
5172 To include spaces in a macro definition item, quotes must be used. If you use
5173 quotes, spaces are permitted around the macro name and the equals sign. For
5174 example:
5175 </para>
5176 <literallayout class="monospaced">
5177 exim '-D ABC = something' ...
5178 </literallayout>
5179 <para>
5180 <option>-D</option> may be repeated up to 10 times on a command line.
5181 Only macro names up to 22 letters long can be set.
5182 </para>
5183 </listitem></varlistentry>
5184 <varlistentry>
5185 <term><option>-d</option>&lt;<emphasis>debug&nbsp;options</emphasis>&gt;</term>
5186 <listitem>
5187 <para>
5188 <indexterm role="option">
5189 <primary><option>-d</option></primary>
5190 </indexterm>
5191 <indexterm role="concept">
5192 <primary>debugging</primary>
5193 <secondary>list of selectors</secondary>
5194 </indexterm>
5195 <indexterm role="concept">
5196 <primary>debugging</primary>
5197 <secondary><option>-d</option> option</secondary>
5198 </indexterm>
5199 This option causes debugging information to be written to the standard
5200 error stream. It is restricted to admin users because debugging output may show
5201 database queries that contain password information. Also, the details of users&#x2019;
5202 filter files should be protected. If a non-admin user uses <option>-d</option>, Exim
5203 writes an error message to the standard error stream and exits with a non-zero
5204 return code.
5205 </para>
5206 <para>
5207 When <option>-d</option> is used, <option>-v</option> is assumed. If <option>-d</option> is given on its own, a lot of
5208 standard debugging data is output. This can be reduced, or increased to include
5209 some more rarely needed information, by directly following <option>-d</option> with a string
5210 made up of names preceded by plus or minus characters. These add or remove sets
5211 of debugging data, respectively. For example, <option>-d+filter</option> adds filter
5212 debugging, whereas <option>-d-all+filter</option> selects only filter debugging. Note that
5213 no spaces are allowed in the debug setting. The available debugging categories
5214 are:
5215 </para>
5216 <literallayout>
5217 <literal>acl            </literal> ACL interpretation
5218 <literal>auth           </literal> authenticators
5219 <literal>deliver        </literal> general delivery logic
5220 <literal>dns            </literal> DNS lookups (see also resolver)
5221 <literal>dnsbl          </literal> DNS black list (aka RBL) code
5222 <literal>exec           </literal> arguments for <function>execv()</function> calls
5223 <literal>expand         </literal> detailed debugging for string expansions
5224 <literal>filter         </literal> filter handling
5225 <literal>hints_lookup   </literal> hints data lookups
5226 <literal>host_lookup    </literal> all types of name-to-IP address handling
5227 <literal>ident          </literal> ident lookup
5228 <literal>interface      </literal> lists of local interfaces
5229 <literal>lists          </literal> matching things in lists
5230 <literal>load           </literal> system load checks
5231 <literal>local_scan     </literal> can be used by <function>local_scan()</function> (see chapter <xref linkend="CHAPlocalscan"/>)
5232 <literal>lookup         </literal> general lookup code and all lookups
5233 <literal>memory         </literal> memory handling
5234 <literal>noutf8         </literal> modifier: avoid UTF-8 line-drawing
5235 <literal>pid            </literal> modifier: add pid to debug output lines
5236 <literal>process_info   </literal> setting info for the process log
5237 <literal>queue_run      </literal> queue runs
5238 <literal>receive        </literal> general message reception logic
5239 <literal>resolver       </literal> turn on the DNS resolver&#x2019;s debugging output
5240 <literal>retry          </literal> retry handling
5241 <literal>rewrite        </literal> address rewriting
5242 <literal>route          </literal> address routing
5243 <literal>timestamp      </literal> modifier: add timestamp to debug output lines
5244 <literal>tls            </literal> TLS logic
5245 <literal>transport      </literal> transports
5246 <literal>uid            </literal> changes of uid/gid and looking up uid/gid
5247 <literal>verify         </literal> address verification logic
5248 <literal>all            </literal> almost all of the above (see below), and also <option>-v</option>
5249 </literallayout>
5250 <para>
5251 The <literal>all</literal> option excludes <literal>memory</literal> when used as <literal>+all</literal>, but includes it
5252 for <literal>-all</literal>. The reason for this is that <literal>+all</literal> is something that people
5253 tend to use when generating debug output for Exim maintainers. If <literal>+memory</literal>
5254 is included, an awful lot of output that is very rarely of interest is
5255 generated, so it now has to be explicitly requested. However, <literal>-all</literal> does
5256 turn everything off.
5257 </para>
5258 <para>
5259 <indexterm role="concept">
5260 <primary>resolver, debugging output</primary>
5261 </indexterm>
5262 <indexterm role="concept">
5263 <primary>DNS resolver, debugging output</primary>
5264 </indexterm>
5265 The <literal>resolver</literal> option produces output only if the DNS resolver was compiled
5266 with DEBUG enabled. This is not the case in some operating systems. Also,
5267 unfortunately, debugging output from the DNS resolver is written to stdout
5268 rather than stderr.
5269 </para>
5270 <para>
5271 The default (<option>-d</option> with no argument) omits <literal>expand</literal>, <literal>filter</literal>,
5272 <literal>interface</literal>, <literal>load</literal>, <literal>memory</literal>, <literal>pid</literal>, <literal>resolver</literal>, and <literal>timestamp</literal>.
5273 However, the <literal>pid</literal> selector is forced when debugging is turned on for a
5274 daemon, which then passes it on to any re-executed Exims. Exim also
5275 automatically adds the pid to debug lines when several remote deliveries are
5276 run in parallel.
5277 </para>
5278 <para>
5279 The <literal>timestamp</literal> selector causes the current time to be inserted at the start
5280 of all debug output lines. This can be useful when trying to track down delays
5281 in processing.
5282 </para>
5283 <para revisionflag="changed">
5284 <indexterm role="concept">
5285 <primary>debugging</primary>
5286 <secondary>UTF-8 in</secondary>
5287 </indexterm>
5288 <indexterm role="concept">
5289 <primary>UTF-8</primary>
5290 <secondary>in debug output</secondary>
5291 </indexterm>
5292 The <literal>noutf8</literal> selector disables the use of
5293 UTF-8 line-drawing characters to group related information.
5294 When disabled. ascii-art is used instead.
5295 Using the <literal>+all</literal> option does not set this modifier,
5296 </para>
5297 <para>
5298 If the <option>debug_print</option> option is set in any driver, it produces output whenever
5299 any debugging is selected, or if <option>-v</option> is used.
5300 </para>
5301 </listitem></varlistentry>
5302 <varlistentry>
5303 <term><option>-dd</option>&lt;<emphasis>debug&nbsp;options</emphasis>&gt;</term>
5304 <listitem>
5305 <para>
5306 <indexterm role="option">
5307 <primary><option>-dd</option></primary>
5308 </indexterm>
5309 This option behaves exactly like <option>-d</option> except when used on a command that
5310 starts a daemon process. In that case, debugging is turned off for the
5311 subprocesses that the daemon creates. Thus, it is useful for monitoring the
5312 behaviour of the daemon without creating as much output as full debugging does.
5313 </para>
5314 </listitem></varlistentry>
5315 <varlistentry>
5316 <term><option>-dropcr</option></term>
5317 <listitem>
5318 <para>
5319 <indexterm role="option">
5320 <primary><option>-dropcr</option></primary>
5321 </indexterm>
5322 This is an obsolete option that is now a no-op. It used to affect the way Exim
5323 handled CR and LF characters in incoming messages. What happens now is
5324 described in section <xref linkend="SECTlineendings"/>.
5325 </para>
5326 </listitem></varlistentry>
5327 <varlistentry>
5328 <term><option>-E</option></term>
5329 <listitem>
5330 <para>
5331 <indexterm role="option">
5332 <primary><option>-E</option></primary>
5333 </indexterm>
5334 <indexterm role="concept">
5335 <primary>bounce message</primary>
5336 <secondary>generating</secondary>
5337 </indexterm>
5338 This option specifies that an incoming message is a locally-generated delivery
5339 failure report. It is used internally by Exim when handling delivery failures
5340 and is not intended for external use. Its only effect is to stop Exim
5341 generating certain messages to the postmaster, as otherwise message cascades
5342 could occur in some situations. As part of the same option, a message id may
5343 follow the characters <option>-E</option>. If it does, the log entry for the receipt of the
5344 new message contains the id, following <quote>R=</quote>, as a cross-reference.
5345 </para>
5346 </listitem></varlistentry>
5347 <varlistentry>
5348 <term><option>-e</option><emphasis>x</emphasis></term>
5349 <listitem>
5350 <para>
5351 <indexterm role="option">
5352 <primary><option>-e</option><emphasis>x</emphasis></primary>
5353 </indexterm>
5354 There are a number of Sendmail options starting with <option>-oe</option> which seem to be
5355 called by various programs without the leading <option>o</option> in the option. For
5356 example, the <option>vacation</option> program uses <option>-eq</option>. Exim treats all options of the
5357 form <option>-e</option><emphasis>x</emphasis> as synonymous with the corresponding <option>-oe</option><emphasis>x</emphasis> options.
5358 </para>
5359 </listitem></varlistentry>
5360 <varlistentry>
5361 <term><option>-F</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
5362 <listitem>
5363 <para>
5364 <indexterm role="option">
5365 <primary><option>-F</option></primary>
5366 </indexterm>
5367 <indexterm role="concept">
5368 <primary>sender</primary>
5369 <secondary>name</secondary>
5370 </indexterm>
5371 <indexterm role="concept">
5372 <primary>name</primary>
5373 <secondary>of sender</secondary>
5374 </indexterm>
5375 This option sets the sender&#x2019;s full name for use when a locally-generated
5376 message is being accepted. In the absence of this option, the user&#x2019;s <emphasis>gecos</emphasis>
5377 entry from the password data is used. As users are generally permitted to alter
5378 their <emphasis>gecos</emphasis> entries, no security considerations are involved. White space
5379 between <option>-F</option> and the &lt;<emphasis>string</emphasis>&gt; is optional.
5380 </para>
5381 </listitem></varlistentry>
5382 <varlistentry>
5383 <term><option>-f</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
5384 <listitem>
5385 <para>
5386 <indexterm role="option">
5387 <primary><option>-f</option></primary>
5388 </indexterm>
5389 <indexterm role="concept">
5390 <primary>sender</primary>
5391 <secondary>address</secondary>
5392 </indexterm>
5393 <indexterm role="concept">
5394 <primary>address</primary>
5395 <secondary>sender</secondary>
5396 </indexterm>
5397 <indexterm role="concept">
5398 <primary>trusted users</primary>
5399 </indexterm>
5400 <indexterm role="concept">
5401 <primary>envelope sender</primary>
5402 </indexterm>
5403 <indexterm role="concept">
5404 <primary>user</primary>
5405 <secondary>trusted</secondary>
5406 </indexterm>
5407 This option sets the address of the envelope sender of a locally-generated
5408 message (also known as the return path). The option can normally be used only
5409 by a trusted user, but <option>untrusted_set_sender</option> can be set to allow untrusted
5410 users to use it.
5411 </para>
5412 <para>
5413 Processes running as root or the Exim user are always trusted. Other
5414 trusted users are defined by the <option>trusted_users</option> or <option>trusted_groups</option>
5415 options. In the absence of <option>-f</option>, or if the caller is not trusted, the sender
5416 of a local message is set to the caller&#x2019;s login name at the default qualify
5417 domain.
5418 </para>
5419 <para>
5420 There is one exception to the restriction on the use of <option>-f</option>: an empty sender
5421 can be specified by any user, trusted or not, to create a message that can
5422 never provoke a bounce. An empty sender can be specified either as an empty
5423 string, or as a pair of angle brackets with nothing between them, as in these
5424 examples of shell commands:
5425 </para>
5426 <literallayout class="monospaced">
5427 exim -f '&lt;&gt;' user@domain
5428 exim -f "" user@domain
5429 </literallayout>
5430 <para>
5431 In addition, the use of <option>-f</option> is not restricted when testing a filter file
5432 with <option>-bf</option> or when testing or verifying addresses using the <option>-bt</option> or
5433 <option>-bv</option> options.
5434 </para>
5435 <para>
5436 Allowing untrusted users to change the sender address does not of itself make
5437 it possible to send anonymous mail. Exim still checks that the <emphasis>From:</emphasis> header
5438 refers to the local user, and if it does not, it adds a <emphasis>Sender:</emphasis> header,
5439 though this can be overridden by setting <option>no_local_from_check</option>.
5440 </para>
5441 <para>
5442 White
5443 <indexterm role="concept">
5444 <primary><quote>From</quote> line</primary>
5445 </indexterm>
5446 space between <option>-f</option> and the &lt;<emphasis>address</emphasis>&gt; is optional (that is, they can be
5447 given as two arguments or one combined argument). The sender of a
5448 locally-generated message can also be set (when permitted) by an initial
5449 <quote>From&nbsp;</quote> line in the message &ndash; see the description of <option>-bm</option> above &ndash; but
5450 if <option>-f</option> is also present, it overrides <quote>From&nbsp;</quote>.
5451 </para>
5452 </listitem></varlistentry>
5453 <varlistentry>
5454 <term><option>-G</option></term>
5455 <listitem>
5456 <para>
5457 <indexterm role="option">
5458 <primary><option>-G</option></primary>
5459 </indexterm>
5460 <indexterm role="concept">
5461 <primary>submission fixups, suppressing (command-line)</primary>
5462 </indexterm>
5463 This option is equivalent to an ACL applying:
5464 </para>
5465 <literallayout class="monospaced">
5466 control = suppress_local_fixups
5467 </literallayout>
5468 <para>
5469 for every message received.  Note that Sendmail will complain about such
5470 bad formatting, where Exim silently just does not fix it up.  This may change
5471 in future.
5472 </para>
5473 <para>
5474 As this affects audit information, the caller must be a trusted user to use
5475 this option.
5476 </para>
5477 </listitem></varlistentry>
5478 <varlistentry>
5479 <term><option>-h</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
5480 <listitem>
5481 <para>
5482 <indexterm role="option">
5483 <primary><option>-h</option></primary>
5484 </indexterm>
5485 <indexterm role="concept">
5486 <primary>Sendmail compatibility</primary>
5487 <secondary><option>-h</option> option ignored</secondary>
5488 </indexterm>
5489 This option is accepted for compatibility with Sendmail, but has no effect. (In
5490 Sendmail it overrides the <quote>hop count</quote> obtained by counting <emphasis>Received:</emphasis>
5491 headers.)
5492 </para>
5493 </listitem></varlistentry>
5494 <varlistentry>
5495 <term><option>-i</option></term>
5496 <listitem>
5497 <para>
5498 <indexterm role="option">
5499 <primary><option>-i</option></primary>
5500 </indexterm>
5501 <indexterm role="concept">
5502 <primary>Solaris</primary>
5503 <secondary><emphasis>mail</emphasis> command</secondary>
5504 </indexterm>
5505 <indexterm role="concept">
5506 <primary>dot</primary>
5507 <secondary>in incoming non-SMTP message</secondary>
5508 </indexterm>
5509 This option, which has the same effect as <option>-oi</option>, specifies that a dot on a
5510 line by itself should not terminate an incoming, non-SMTP message. I can find
5511 no documentation for this option in Solaris 2.4 Sendmail, but the <emphasis>mailx</emphasis>
5512 command in Solaris 2.4 uses it. See also <option>-ti</option>.
5513 </para>
5514 </listitem></varlistentry>
5515 <varlistentry>
5516 <term><option>-L</option>&nbsp;&lt;<emphasis>tag</emphasis>&gt;</term>
5517 <listitem>
5518 <para>
5519 <indexterm role="option">
5520 <primary><option>-L</option></primary>
5521 </indexterm>
5522 <indexterm role="concept">
5523 <primary>syslog</primary>
5524 <secondary>process name; set with flag</secondary>
5525 </indexterm>
5526 This option is equivalent to setting <option>syslog_processname</option> in the config
5527 file and setting <option>log_file_path</option> to <literal>syslog</literal>.
5528 Its use is restricted to administrators.  The configuration file has to be
5529 read and parsed, to determine access rights, before this is set and takes
5530 effect, so early configuration file errors will not honour this flag.
5531 </para>
5532 <para>
5533 The tag should not be longer than 32 characters.
5534 </para>
5535 </listitem></varlistentry>
5536 <varlistentry>
5537 <term><option>-M</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5538 <listitem>
5539 <para>
5540 <indexterm role="option">
5541 <primary><option>-M</option></primary>
5542 </indexterm>
5543 <indexterm role="concept">
5544 <primary>forcing delivery</primary>
5545 </indexterm>
5546 <indexterm role="concept">
5547 <primary>delivery</primary>
5548 <secondary>forcing attempt</secondary>
5549 </indexterm>
5550 <indexterm role="concept">
5551 <primary>frozen messages</primary>
5552 <secondary>forcing delivery</secondary>
5553 </indexterm>
5554 This option requests Exim to run a delivery attempt on each message in turn. If
5555 any of the messages are frozen, they are automatically thawed before the
5556 delivery attempt. The settings of <option>queue_domains</option>, <option>queue_smtp_domains</option>,
5557 and <option>hold_domains</option> are ignored.
5558 </para>
5559 <para>
5560 Retry
5561 <indexterm role="concept">
5562 <primary>hints database</primary>
5563 <secondary>overriding retry hints</secondary>
5564 </indexterm>
5565 hints for any of the addresses are overridden &ndash; Exim tries to deliver even if
5566 the normal retry time has not yet been reached. This option requires the caller
5567 to be an admin user. However, there is an option called <option>prod_requires_admin</option>
5568 which can be set false to relax this restriction (and also the same requirement
5569 for the <option>-q</option>, <option>-R</option>, and <option>-S</option> options).
5570 </para>
5571 <para>
5572 The deliveries happen synchronously, that is, the original Exim process does
5573 not terminate until all the delivery attempts have finished. No output is
5574 produced unless there is a serious error. If you want to see what is happening,
5575 use the <option>-v</option> option as well, or inspect Exim&#x2019;s main log.
5576 </para>
5577 </listitem></varlistentry>
5578 <varlistentry>
5579 <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>
5580 <listitem>
5581 <para>
5582 <indexterm role="option">
5583 <primary><option>-Mar</option></primary>
5584 </indexterm>
5585 <indexterm role="concept">
5586 <primary>message</primary>
5587 <secondary>adding recipients</secondary>
5588 </indexterm>
5589 <indexterm role="concept">
5590 <primary>recipient</primary>
5591 <secondary>adding</secondary>
5592 </indexterm>
5593 This option requests Exim to add the addresses to the list of recipients of the
5594 message (<quote>ar</quote> for <quote>add recipients</quote>). The first argument must be a message
5595 id, and the remaining ones must be email addresses. However, if the message is
5596 active (in the middle of a delivery attempt), it is not altered. This option
5597 can be used only by an admin user.
5598 </para>
5599 </listitem></varlistentry>
5600 <varlistentry>
5601 <term><option>-MC</option>&nbsp;&lt;<emphasis>transport</emphasis>&gt;&nbsp;&lt;<emphasis>hostname</emphasis>&gt;&nbsp;&lt;<emphasis>sequence&nbsp;number</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5602 <listitem>
5603 <para>
5604 <indexterm role="option">
5605 <primary><option>-MC</option></primary>
5606 </indexterm>
5607 <indexterm role="concept">
5608 <primary>SMTP</primary>
5609 <secondary>passed connection</secondary>
5610 </indexterm>
5611 <indexterm role="concept">
5612 <primary>SMTP</primary>
5613 <secondary>multiple deliveries</secondary>
5614 </indexterm>
5615 <indexterm role="concept">
5616 <primary>multiple SMTP deliveries</primary>
5617 </indexterm>
5618 This option is not intended for use by external callers. It is used internally
5619 by Exim to invoke another instance of itself to deliver a waiting message using
5620 an existing SMTP connection, which is passed as the standard input. Details are
5621 given in chapter <xref linkend="CHAPSMTP"/>. This must be the final option, and the caller
5622 must be root or the Exim user in order to use it.
5623 </para>
5624 </listitem></varlistentry>
5625 <varlistentry>
5626 <term><option>-MCA</option></term>
5627 <listitem>
5628 <para>
5629 <indexterm role="option">
5630 <primary><option>-MCA</option></primary>
5631 </indexterm>
5632 This option is not intended for use by external callers. It is used internally
5633 by Exim in conjunction with the <option>-MC</option> option. It signifies that the
5634 connection to the remote host has been authenticated.
5635 </para>
5636 </listitem></varlistentry>
5637 <varlistentry>
5638 <term><option>-MCD</option></term>
5639 <listitem>
5640 <para>
5641 <indexterm role="option">
5642 <primary><option>-MCD</option></primary>
5643 </indexterm>
5644 This option is not intended for use by external callers. It is used internally
5645 by Exim in conjunction with the <option>-MC</option> option. It signifies that the
5646 remote host supports the ESMTP <filename>DSN</filename> extension.
5647 </para>
5648 </listitem></varlistentry>
5649 <varlistentry>
5650 <term><option>-MCG</option>&nbsp;&lt;<emphasis>queue&nbsp;name</emphasis>&gt;</term>
5651 <listitem>
5652 <para>
5653 <indexterm role="option">
5654 <primary><option>-MCG</option></primary>
5655 </indexterm>
5656 This option is not intended for use by external callers. It is used internally
5657 by Exim in conjunction with the <option>-MC</option> option. It signifies that an
5658 alternate queue is used, named by the following argument.
5659 </para>
5660 </listitem></varlistentry>
5661 <varlistentry>
5662 <term><option>-MCK</option></term>
5663 <listitem>
5664 <para>
5665 <indexterm role="option">
5666 <primary><option>-MCK</option></primary>
5667 </indexterm>
5668 This option is not intended for use by external callers. It is used internally
5669 by Exim in conjunction with the <option>-MC</option> option. It signifies that a
5670 remote host supports the ESMTP <filename>CHUNKING</filename> extension.
5671 </para>
5672 </listitem></varlistentry>
5673 <varlistentry>
5674 <term><option>-MCP</option></term>
5675 <listitem>
5676 <para>
5677 <indexterm role="option">
5678 <primary><option>-MCP</option></primary>
5679 </indexterm>
5680 This option is not intended for use by external callers. It is used internally
5681 by Exim in conjunction with the <option>-MC</option> option. It signifies that the server to
5682 which Exim is connected supports pipelining.
5683 </para>
5684 </listitem></varlistentry>
5685 <varlistentry>
5686 <term><option>-MCQ</option>&nbsp;&lt;<emphasis>process&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>pipe&nbsp;fd</emphasis>&gt;</term>
5687 <listitem>
5688 <para>
5689 <indexterm role="option">
5690 <primary><option>-MCQ</option></primary>
5691 </indexterm>
5692 This option is not intended for use by external callers. It is used internally
5693 by Exim in conjunction with the <option>-MC</option> option when the original delivery was
5694 started by a queue runner. It passes on the process id of the queue runner,
5695 together with the file descriptor number of an open pipe. Closure of the pipe
5696 signals the final completion of the sequence of processes that are passing
5697 messages through the same SMTP connection.
5698 </para>
5699 </listitem></varlistentry>
5700 <varlistentry>
5701 <term><option>-MCS</option></term>
5702 <listitem>
5703 <para>
5704 <indexterm role="option">
5705 <primary><option>-MCS</option></primary>
5706 </indexterm>
5707 This option is not intended for use by external callers. It is used internally
5708 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5709 SMTP SIZE option should be used on messages delivered down the existing
5710 connection.
5711 </para>
5712 </listitem></varlistentry>
5713 <varlistentry>
5714 <term><option>-MCT</option></term>
5715 <listitem>
5716 <para>
5717 <indexterm role="option">
5718 <primary><option>-MCT</option></primary>
5719 </indexterm>
5720 This option is not intended for use by external callers. It is used internally
5721 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5722 host to which Exim is connected supports TLS encryption.
5723 </para>
5724 </listitem></varlistentry>
5725 <varlistentry>
5726 <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>
5727 <listitem>
5728 <para>
5729 <indexterm role="option">
5730 <primary><option>-MCt</option></primary>
5731 </indexterm>
5732 This option is not intended for use by external callers. It is used internally
5733 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5734 connection is being proxied by a parent process for handling TLS encryption.
5735 The arguments give the local address and port being proxied, and the TLS cipher.
5736 </para>
5737 </listitem></varlistentry>
5738 <varlistentry>
5739 <term><option>-Mc</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5740 <listitem>
5741 <para>
5742 <indexterm role="option">
5743 <primary><option>-Mc</option></primary>
5744 </indexterm>
5745 <indexterm role="concept">
5746 <primary>hints database</primary>
5747 <secondary>not overridden by <option>-Mc</option></secondary>
5748 </indexterm>
5749 <indexterm role="concept">
5750 <primary>delivery</primary>
5751 <secondary>manually started &ndash; not forced</secondary>
5752 </indexterm>
5753 This option requests Exim to run a delivery attempt on each message, in turn,
5754 but unlike the <option>-M</option> option, it does check for retry hints, and respects any
5755 that are found. This option is not very useful to external callers. It is
5756 provided mainly for internal use by Exim when it needs to re-invoke itself in
5757 order to regain root privilege for a delivery (see chapter <xref linkend="CHAPsecurity"/>).
5758 However, <option>-Mc</option> can be useful when testing, in order to run a delivery that
5759 respects retry times and other options such as <option>hold_domains</option> that are
5760 overridden when <option>-M</option> is used. Such a delivery does not count as a queue run.
5761 If you want to run a specific delivery as if in a queue run, you should use
5762 <option>-q</option> with a message id argument. A distinction between queue run deliveries
5763 and other deliveries is made in one or two places.
5764 </para>
5765 </listitem></varlistentry>
5766 <varlistentry>
5767 <term><option>-Mes</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
5768 <listitem>
5769 <para>
5770 <indexterm role="option">
5771 <primary><option>-Mes</option></primary>
5772 </indexterm>
5773 <indexterm role="concept">
5774 <primary>message</primary>
5775 <secondary>changing sender</secondary>
5776 </indexterm>
5777 <indexterm role="concept">
5778 <primary>sender</primary>
5779 <secondary>changing</secondary>
5780 </indexterm>
5781 This option requests Exim to change the sender address in the message to the
5782 given address, which must be a fully qualified address or <quote>&lt;&gt;</quote> (<quote>es</quote> for
5783 <quote>edit sender</quote>). There must be exactly two arguments. The first argument must
5784 be a message id, and the second one an email address. However, if the message
5785 is active (in the middle of a delivery attempt), its status is not altered.
5786 This option can be used only by an admin user.
5787 </para>
5788 </listitem></varlistentry>
5789 <varlistentry>
5790 <term><option>-Mf</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5791 <listitem>
5792 <para>
5793 <indexterm role="option">
5794 <primary><option>-Mf</option></primary>
5795 </indexterm>
5796 <indexterm role="concept">
5797 <primary>freezing messages</primary>
5798 </indexterm>
5799 <indexterm role="concept">
5800 <primary>message</primary>
5801 <secondary>manually freezing</secondary>
5802 </indexterm>
5803 This option requests Exim to mark each listed message as <quote>frozen</quote>. This
5804 prevents any delivery attempts taking place until the message is <quote>thawed</quote>,
5805 either manually or as a result of the <option>auto_thaw</option> configuration option.
5806 However, if any of the messages are active (in the middle of a delivery
5807 attempt), their status is not altered. This option can be used only by an admin
5808 user.
5809 </para>
5810 </listitem></varlistentry>
5811 <varlistentry>
5812 <term><option>-Mg</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5813 <listitem>
5814 <para>
5815 <indexterm role="option">
5816 <primary><option>-Mg</option></primary>
5817 </indexterm>
5818 <indexterm role="concept">
5819 <primary>giving up on messages</primary>
5820 </indexterm>
5821 <indexterm role="concept">
5822 <primary>message</primary>
5823 <secondary>abandoning delivery attempts</secondary>
5824 </indexterm>
5825 <indexterm role="concept">
5826 <primary>delivery</primary>
5827 <secondary>abandoning further attempts</secondary>
5828 </indexterm>
5829 This option requests Exim to give up trying to deliver the listed messages,
5830 including any that are frozen. However, if any of the messages are active,
5831 their status is not altered. For non-bounce messages, a delivery error message
5832 is sent to the sender, containing the text <quote>cancelled by administrator</quote>.
5833 Bounce messages are just discarded. This option can be used only by an admin
5834 user.
5835 </para>
5836 </listitem></varlistentry>
5837 <varlistentry>
5838 <term><option>-Mmad</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5839 <listitem>
5840 <para>
5841 <indexterm role="option">
5842 <primary><option>-Mmad</option></primary>
5843 </indexterm>
5844 <indexterm role="concept">
5845 <primary>delivery</primary>
5846 <secondary>cancelling all</secondary>
5847 </indexterm>
5848 This option requests Exim to mark all the recipient addresses in the messages
5849 as already delivered (<quote>mad</quote> for <quote>mark all delivered</quote>). However, if any
5850 message is active (in the middle of a delivery attempt), its status is not
5851 altered. This option can be used only by an admin user.
5852 </para>
5853 </listitem></varlistentry>
5854 <varlistentry>
5855 <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>
5856 <listitem>
5857 <para>
5858 <indexterm role="option">
5859 <primary><option>-Mmd</option></primary>
5860 </indexterm>
5861 <indexterm role="concept">
5862 <primary>delivery</primary>
5863 <secondary>cancelling by address</secondary>
5864 </indexterm>
5865 <indexterm role="concept">
5866 <primary>recipient</primary>
5867 <secondary>removing</secondary>
5868 </indexterm>
5869 <indexterm role="concept">
5870 <primary>removing recipients</primary>
5871 </indexterm>
5872 This option requests Exim to mark the given addresses as already delivered
5873 (<quote>md</quote> for <quote>mark delivered</quote>). The first argument must be a message id, and
5874 the remaining ones must be email addresses. These are matched to recipient
5875 addresses in the message in a case-sensitive manner. If the message is active
5876 (in the middle of a delivery attempt), its status is not altered. This option
5877 can be used only by an admin user.
5878 </para>
5879 </listitem></varlistentry>
5880 <varlistentry>
5881 <term><option>-Mrm</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5882 <listitem>
5883 <para>
5884 <indexterm role="option">
5885 <primary><option>-Mrm</option></primary>
5886 </indexterm>
5887 <indexterm role="concept">
5888 <primary>removing messages</primary>
5889 </indexterm>
5890 <indexterm role="concept">
5891 <primary>abandoning mail</primary>
5892 </indexterm>
5893 <indexterm role="concept">
5894 <primary>message</primary>
5895 <secondary>manually discarding</secondary>
5896 </indexterm>
5897 This option requests Exim to remove the given messages from the queue. No
5898 bounce messages are sent; each message is simply forgotten. However, if any of
5899 the messages are active, their status is not altered. This option can be used
5900 only by an admin user or by the user who originally caused the message to be
5901 placed in the queue.
5902 </para>
5903 </listitem></varlistentry>
5904 <varlistentry>
5905 <term><option>-Mset</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5906 <listitem>
5907 <para>
5908 <indexterm role="option">
5909 <primary><option>-Mset</option></primary>
5910 </indexterm>
5911 <indexterm role="concept">
5912 <primary>testing</primary>
5913 <secondary>string expansion</secondary>
5914 </indexterm>
5915 <indexterm role="concept">
5916 <primary>expansion</primary>
5917 <secondary>testing</secondary>
5918 </indexterm>
5919 This option is useful only in conjunction with <option>-be</option> (that is, when testing
5920 string expansions). Exim loads the given message from its spool before doing
5921 the test expansions, thus setting message-specific variables such as
5922 <varname>$message_size</varname> and the header variables. The <varname>$recipients</varname> variable is made
5923 available. This feature is provided to make it easier to test expansions that
5924 make use of these variables. However, this option can be used only by an admin
5925 user. See also <option>-bem</option>.
5926 </para>
5927 </listitem></varlistentry>
5928 <varlistentry>
5929 <term><option>-Mt</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5930 <listitem>
5931 <para>
5932 <indexterm role="option">
5933 <primary><option>-Mt</option></primary>
5934 </indexterm>
5935 <indexterm role="concept">
5936 <primary>thawing messages</primary>
5937 </indexterm>
5938 <indexterm role="concept">
5939 <primary>unfreezing messages</primary>
5940 </indexterm>
5941 <indexterm role="concept">
5942 <primary>frozen messages</primary>
5943 <secondary>thawing</secondary>
5944 </indexterm>
5945 <indexterm role="concept">
5946 <primary>message</primary>
5947 <secondary>thawing frozen</secondary>
5948 </indexterm>
5949 This option requests Exim to <quote>thaw</quote> any of the listed messages that are
5950 <quote>frozen</quote>, so that delivery attempts can resume. However, if any of the
5951 messages are active, their status is not altered. This option can be used only
5952 by an admin user.
5953 </para>
5954 </listitem></varlistentry>
5955 <varlistentry>
5956 <term><option>-Mvb</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5957 <listitem>
5958 <para>
5959 <indexterm role="option">
5960 <primary><option>-Mvb</option></primary>
5961 </indexterm>
5962 <indexterm role="concept">
5963 <primary>listing</primary>
5964 <secondary>message body</secondary>
5965 </indexterm>
5966 <indexterm role="concept">
5967 <primary>message</primary>
5968 <secondary>listing body of</secondary>
5969 </indexterm>
5970 This option causes the contents of the message body (-D) spool file to be
5971 written to the standard output. This option can be used only by an admin user.
5972 </para>
5973 </listitem></varlistentry>
5974 <varlistentry>
5975 <term><option>-Mvc</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5976 <listitem>
5977 <para>
5978 <indexterm role="option">
5979 <primary><option>-Mvc</option></primary>
5980 </indexterm>
5981 <indexterm role="concept">
5982 <primary>message</primary>
5983 <secondary>listing in RFC 2822 format</secondary>
5984 </indexterm>
5985 <indexterm role="concept">
5986 <primary>listing</primary>
5987 <secondary>message in RFC 2822 format</secondary>
5988 </indexterm>
5989 This option causes a copy of the complete message (header lines plus body) to
5990 be written to the standard output in RFC 2822 format. This option can be used
5991 only by an admin user.
5992 </para>
5993 </listitem></varlistentry>
5994 <varlistentry>
5995 <term><option>-Mvh</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5996 <listitem>
5997 <para>
5998 <indexterm role="option">
5999 <primary><option>-Mvh</option></primary>
6000 </indexterm>
6001 <indexterm role="concept">
6002 <primary>listing</primary>
6003 <secondary>message headers</secondary>
6004 </indexterm>
6005 <indexterm role="concept">
6006 <primary>header lines</primary>
6007 <secondary>listing</secondary>
6008 </indexterm>
6009 <indexterm role="concept">
6010 <primary>message</primary>
6011 <secondary>listing header lines</secondary>
6012 </indexterm>
6013 This option causes the contents of the message headers (-H) spool file to be
6014 written to the standard output. This option can be used only by an admin user.
6015 </para>
6016 </listitem></varlistentry>
6017 <varlistentry>
6018 <term><option>-Mvl</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
6019 <listitem>
6020 <para>
6021 <indexterm role="option">
6022 <primary><option>-Mvl</option></primary>
6023 </indexterm>
6024 <indexterm role="concept">
6025 <primary>listing</primary>
6026 <secondary>message log</secondary>
6027 </indexterm>
6028 <indexterm role="concept">
6029 <primary>message</primary>
6030 <secondary>listing message log</secondary>
6031 </indexterm>
6032 This option causes the contents of the message log spool file to be written to
6033 the standard output. This option can be used only by an admin user.
6034 </para>
6035 </listitem></varlistentry>
6036 <varlistentry>
6037 <term><option>-m</option></term>
6038 <listitem>
6039 <para>
6040 <indexterm role="option">
6041 <primary><option>-m</option></primary>
6042 </indexterm>
6043 This is apparently a synonym for <option>-om</option> that is accepted by Sendmail, so Exim
6044 treats it that way too.
6045 </para>
6046 </listitem></varlistentry>
6047 <varlistentry>
6048 <term><option>-N</option></term>
6049 <listitem>
6050 <para>
6051 <indexterm role="option">
6052 <primary><option>-N</option></primary>
6053 </indexterm>
6054 <indexterm role="concept">
6055 <primary>debugging</primary>
6056 <secondary><option>-N</option> option</secondary>
6057 </indexterm>
6058 <indexterm role="concept">
6059 <primary>debugging</primary>
6060 <secondary>suppressing delivery</secondary>
6061 </indexterm>
6062 This is a debugging option that inhibits delivery of a message at the transport
6063 level. It implies <option>-v</option>. Exim goes through many of the motions of delivery &ndash;
6064 it just doesn&#x2019;t actually transport the message, but instead behaves as if it
6065 had successfully done so. However, it does not make any updates to the retry
6066 database, and the log entries for deliveries are flagged with <quote>*&gt;</quote> rather
6067 than <quote>=&gt;</quote>.
6068 </para>
6069 <para>
6070 Because <option>-N</option> discards any message to which it applies, only root or the Exim
6071 user are allowed to use it with <option>-bd</option>, <option>-q</option>, <option>-R</option> or <option>-M</option>. In other
6072 words, an ordinary user can use it only when supplying an incoming message to
6073 which it will apply. Although transportation never fails when <option>-N</option> is set, an
6074 address may be deferred because of a configuration problem on a transport, or a
6075 routing problem. Once <option>-N</option> has been used for a delivery attempt, it sticks to
6076 the message, and applies to any subsequent delivery attempts that may happen
6077 for that message.
6078 </para>
6079 </listitem></varlistentry>
6080 <varlistentry>
6081 <term><option>-n</option></term>
6082 <listitem>
6083 <para>
6084 <indexterm role="option">
6085 <primary><option>-n</option></primary>
6086 </indexterm>
6087 This option is interpreted by Sendmail to mean <quote>no aliasing</quote>.
6088 For normal modes of operation, it is ignored by Exim.
6089 When combined with <option>-bP</option> it makes the output more terse (suppresses
6090 option names, environment values and config pretty printing).
6091 </para>
6092 </listitem></varlistentry>
6093 <varlistentry>
6094 <term><option>-O</option>&nbsp;&lt;<emphasis>data</emphasis>&gt;</term>
6095 <listitem>
6096 <para>
6097 <indexterm role="option">
6098 <primary><option>-O</option></primary>
6099 </indexterm>
6100 This option is interpreted by Sendmail to mean <literal>set option</literal>. It is ignored by
6101 Exim.
6102 </para>
6103 </listitem></varlistentry>
6104 <varlistentry>
6105 <term><option>-oA</option>&nbsp;&lt;<emphasis>file&nbsp;name</emphasis>&gt;</term>
6106 <listitem>
6107 <para>
6108 <indexterm role="option">
6109 <primary><option>-oA</option></primary>
6110 </indexterm>
6111 <indexterm role="concept">
6112 <primary>Sendmail compatibility</primary>
6113 <secondary><option>-oA</option> option</secondary>
6114 </indexterm>
6115 This option is used by Sendmail in conjunction with <option>-bi</option> to specify an
6116 alternative alias filename. Exim handles <option>-bi</option> differently; see the
6117 description above.
6118 </para>
6119 </listitem></varlistentry>
6120 <varlistentry>
6121 <term><option>-oB</option>&nbsp;&lt;<emphasis>n</emphasis>&gt;</term>
6122 <listitem>
6123 <para>
6124 <indexterm role="option">
6125 <primary><option>-oB</option></primary>
6126 </indexterm>
6127 <indexterm role="concept">
6128 <primary>SMTP</primary>
6129 <secondary>passed connection</secondary>
6130 </indexterm>
6131 <indexterm role="concept">
6132 <primary>SMTP</primary>
6133 <secondary>multiple deliveries</secondary>
6134 </indexterm>
6135 <indexterm role="concept">
6136 <primary>multiple SMTP deliveries</primary>
6137 </indexterm>
6138 This is a debugging option which limits the maximum number of messages that can
6139 be delivered down one SMTP connection, overriding the value set in any <command>smtp</command>
6140 transport. If &lt;<emphasis>n</emphasis>&gt; is omitted, the limit is set to 1.
6141 </para>
6142 </listitem></varlistentry>
6143 <varlistentry>
6144 <term><option>-odb</option></term>
6145 <listitem>
6146 <para>
6147 <indexterm role="option">
6148 <primary><option>-odb</option></primary>
6149 </indexterm>
6150 <indexterm role="concept">
6151 <primary>background delivery</primary>
6152 </indexterm>
6153 <indexterm role="concept">
6154 <primary>delivery</primary>
6155 <secondary>in the background</secondary>
6156 </indexterm>
6157 This option applies to all modes in which Exim accepts incoming messages,
6158 including the listening daemon. It requests <quote>background</quote> delivery of such
6159 messages, which means that the accepting process automatically starts a
6160 delivery process for each message received, but does not wait for the delivery
6161 processes to finish.
6162 </para>
6163 <para>
6164 When all the messages have been received, the reception process exits,
6165 leaving the delivery processes to finish in their own time. The standard output
6166 and error streams are closed at the start of each delivery process.
6167 This is the default action if none of the <option>-od</option> options are present.
6168 </para>
6169 <para>
6170 If one of the queueing options in the configuration file
6171 (<option>queue_only</option> or <option>queue_only_file</option>, for example) is in effect, <option>-odb</option>
6172 overrides it if <option>queue_only_override</option> is set true, which is the default
6173 setting. If <option>queue_only_override</option> is set false, <option>-odb</option> has no effect.
6174 </para>
6175 </listitem></varlistentry>
6176 <varlistentry>
6177 <term><option>-odf</option></term>
6178 <listitem>
6179 <para>
6180 <indexterm role="option">
6181 <primary><option>-odf</option></primary>
6182 </indexterm>
6183 <indexterm role="concept">
6184 <primary>foreground delivery</primary>
6185 </indexterm>
6186 <indexterm role="concept">
6187 <primary>delivery</primary>
6188 <secondary>in the foreground</secondary>
6189 </indexterm>
6190 This option requests <quote>foreground</quote> (synchronous) delivery when Exim has
6191 accepted a locally-generated message. (For the daemon it is exactly the same as
6192 <option>-odb</option>.) A delivery process is automatically started to deliver the message,
6193 and Exim waits for it to complete before proceeding.
6194 </para>
6195 <para>
6196 The original Exim reception process does not finish until the delivery
6197 process for the final message has ended. The standard error stream is left open
6198 during deliveries.
6199 </para>
6200 <para>
6201 However, like <option>-odb</option>, this option has no effect if <option>queue_only_override</option> is
6202 false and one of the queueing options in the configuration file is in effect.
6203 </para>
6204 <para>
6205 If there is a temporary delivery error during foreground delivery, the
6206 message is left in the queue for later delivery, and the original reception
6207 process exits. See chapter <xref linkend="CHAPnonqueueing"/> for a way of setting up a
6208 restricted configuration that never queues messages.
6209 </para>
6210 </listitem></varlistentry>
6211 <varlistentry>
6212 <term><option>-odi</option></term>
6213 <listitem>
6214 <para>
6215 <indexterm role="option">
6216 <primary><option>-odi</option></primary>
6217 </indexterm>
6218 This option is synonymous with <option>-odf</option>. It is provided for compatibility with
6219 Sendmail.
6220 </para>
6221 </listitem></varlistentry>
6222 <varlistentry>
6223 <term><option>-odq</option></term>
6224 <listitem>
6225 <para>
6226 <indexterm role="option">
6227 <primary><option>-odq</option></primary>
6228 </indexterm>
6229 <indexterm role="concept">
6230 <primary>non-immediate delivery</primary>
6231 </indexterm>
6232 <indexterm role="concept">
6233 <primary>delivery</primary>
6234 <secondary>suppressing immediate</secondary>
6235 </indexterm>
6236 <indexterm role="concept">
6237 <primary>queueing incoming messages</primary>
6238 </indexterm>
6239 This option applies to all modes in which Exim accepts incoming messages,
6240 including the listening daemon. It specifies that the accepting process should
6241 not automatically start a delivery process for each message received. Messages
6242 are placed in the queue, and remain there until a subsequent queue runner
6243 process encounters them. There are several configuration options (such as
6244 <option>queue_only</option>) that can be used to queue incoming messages under certain
6245 conditions. This option overrides all of them and also <option>-odqs</option>. It always
6246 forces queueing.
6247 </para>
6248 </listitem></varlistentry>
6249 <varlistentry>
6250 <term><option>-odqs</option></term>
6251 <listitem>
6252 <para>
6253 <indexterm role="option">
6254 <primary><option>-odqs</option></primary>
6255 </indexterm>
6256 <indexterm role="concept">
6257 <primary>SMTP</primary>
6258 <secondary>delaying delivery</secondary>
6259 </indexterm>
6260 This option is a hybrid between <option>-odb</option>/<option>-odi</option> and <option>-odq</option>.
6261 However, like <option>-odb</option> and <option>-odi</option>, this option has no effect if
6262 <option>queue_only_override</option> is false and one of the queueing options in the
6263 configuration file is in effect.
6264 </para>
6265 <para>
6266 When <option>-odqs</option> does operate, a delivery process is started for each incoming
6267 message, in the background by default, but in the foreground if <option>-odi</option> is
6268 also present. The recipient addresses are routed, and local deliveries are done
6269 in the normal way. However, if any SMTP deliveries are required, they are not
6270 done at this time, so the message remains in the queue until a subsequent queue
6271 runner process encounters it. Because routing was done, Exim knows which
6272 messages are waiting for which hosts, and so a number of messages for the same
6273 host can be sent in a single SMTP connection. The <option>queue_smtp_domains</option>
6274 configuration option has the same effect for specific domains. See also the
6275 <option>-qq</option> option.
6276 </para>
6277 </listitem></varlistentry>
6278 <varlistentry>
6279 <term><option>-oee</option></term>
6280 <listitem>
6281 <para>
6282 <indexterm role="option">
6283 <primary><option>-oee</option></primary>
6284 </indexterm>
6285 <indexterm role="concept">
6286 <primary>error</primary>
6287 <secondary>reporting</secondary>
6288 </indexterm>
6289 If an error is detected while a non-SMTP message is being received (for
6290 example, a malformed address), the error is reported to the sender in a mail
6291 message.
6292 </para>
6293 <para>
6294 <indexterm role="concept">
6295 <primary>return code</primary>
6296 <secondary>for <option>-oee</option></secondary>
6297 </indexterm>
6298 Provided
6299 this error message is successfully sent, the Exim receiving process
6300 exits with a return code of zero. If not, the return code is 2 if the problem
6301 is that the original message has no recipients, or 1 for any other error.
6302 This is the default <option>-oe</option><emphasis>x</emphasis> option if Exim is called as <emphasis>rmail</emphasis>.
6303 </para>
6304 </listitem></varlistentry>
6305 <varlistentry>
6306 <term><option>-oem</option></term>
6307 <listitem>
6308 <para>
6309 <indexterm role="option">
6310 <primary><option>-oem</option></primary>
6311 </indexterm>
6312 <indexterm role="concept">
6313 <primary>error</primary>
6314 <secondary>reporting</secondary>
6315 </indexterm>
6316 <indexterm role="concept">
6317 <primary>return code</primary>
6318 <secondary>for <option>-oem</option></secondary>
6319 </indexterm>
6320 This is the same as <option>-oee</option>, except that Exim always exits with a non-zero
6321 return code, whether or not the error message was successfully sent.
6322 This is the default <option>-oe</option><emphasis>x</emphasis> option, unless Exim is called as <emphasis>rmail</emphasis>.
6323 </para>
6324 </listitem></varlistentry>
6325 <varlistentry>
6326 <term><option>-oep</option></term>
6327 <listitem>
6328 <para>
6329 <indexterm role="option">
6330 <primary><option>-oep</option></primary>
6331 </indexterm>
6332 <indexterm role="concept">
6333 <primary>error</primary>
6334 <secondary>reporting</secondary>
6335 </indexterm>
6336 If an error is detected while a non-SMTP message is being received, the
6337 error is reported by writing a message to the standard error file (stderr).
6338 <indexterm role="concept">
6339 <primary>return code</primary>
6340 <secondary>for <option>-oep</option></secondary>
6341 </indexterm>
6342 The return code is 1 for all errors.
6343 </para>
6344 </listitem></varlistentry>
6345 <varlistentry>
6346 <term><option>-oeq</option></term>
6347 <listitem>
6348 <para>
6349 <indexterm role="option">
6350 <primary><option>-oeq</option></primary>
6351 </indexterm>
6352 <indexterm role="concept">
6353 <primary>error</primary>
6354 <secondary>reporting</secondary>
6355 </indexterm>
6356 This option is supported for compatibility with Sendmail, but has the same
6357 effect as <option>-oep</option>.
6358 </para>
6359 </listitem></varlistentry>
6360 <varlistentry>
6361 <term><option>-oew</option></term>
6362 <listitem>
6363 <para>
6364 <indexterm role="option">
6365 <primary><option>-oew</option></primary>
6366 </indexterm>
6367 <indexterm role="concept">
6368 <primary>error</primary>
6369 <secondary>reporting</secondary>
6370 </indexterm>
6371 This option is supported for compatibility with Sendmail, but has the same
6372 effect as <option>-oem</option>.
6373 </para>
6374 </listitem></varlistentry>
6375 <varlistentry>
6376 <term><option>-oi</option></term>
6377 <listitem>
6378 <para>
6379 <indexterm role="option">
6380 <primary><option>-oi</option></primary>
6381 </indexterm>
6382 <indexterm role="concept">
6383 <primary>dot</primary>
6384 <secondary>in incoming non-SMTP message</secondary>
6385 </indexterm>
6386 This option, which has the same effect as <option>-i</option>, specifies that a dot on a
6387 line by itself should not terminate an incoming, non-SMTP message. Otherwise, a
6388 single dot does terminate, though Exim does no special processing for other
6389 lines that start with a dot. This option is set by default if Exim is called as
6390 <emphasis>rmail</emphasis>. See also <option>-ti</option>.
6391 </para>
6392 </listitem></varlistentry>
6393 <varlistentry>
6394 <term><option>-oitrue</option></term>
6395 <listitem>
6396 <para>
6397 <indexterm role="option">
6398 <primary><option>-oitrue</option></primary>
6399 </indexterm>
6400 This option is treated as synonymous with <option>-oi</option>.
6401 </para>
6402 </listitem></varlistentry>
6403 <varlistentry>
6404 <term><option>-oMa</option>&nbsp;&lt;<emphasis>host&nbsp;address</emphasis>&gt;</term>
6405 <listitem>
6406 <para>
6407 <indexterm role="option">
6408 <primary><option>-oMa</option></primary>
6409 </indexterm>
6410 <indexterm role="concept">
6411 <primary>sender</primary>
6412 <secondary>host address, specifying for local message</secondary>
6413 </indexterm>
6414 A number of options starting with <option>-oM</option> can be used to set values associated
6415 with remote hosts on locally-submitted messages (that is, messages not received
6416 over TCP/IP). These options can be used by any caller in conjunction with the
6417 <option>-bh</option>, <option>-be</option>, <option>-bf</option>, <option>-bF</option>, <option>-bt</option>, or <option>-bv</option> testing options. In
6418 other circumstances, they are ignored unless the caller is trusted.
6419 </para>
6420 <para>
6421 The <option>-oMa</option> option sets the sender host address. This may include a port
6422 number at the end, after a full stop (period). For example:
6423 </para>
6424 <literallayout class="monospaced">
6425 exim -bs -oMa 10.9.8.7.1234
6426 </literallayout>
6427 <para>
6428 An alternative syntax is to enclose the IP address in square brackets,
6429 followed by a colon and the port number:
6430 </para>
6431 <literallayout class="monospaced">
6432 exim -bs -oMa [10.9.8.7]:1234
6433 </literallayout>
6434 <para>
6435 The IP address is placed in the <varname>$sender_host_address</varname> variable, and the
6436 port, if present, in <varname>$sender_host_port</varname>. If both <option>-oMa</option> and <option>-bh</option>
6437 are present on the command line, the sender host IP address is taken from
6438 whichever one is last.
6439 </para>
6440 </listitem></varlistentry>
6441 <varlistentry>
6442 <term><option>-oMaa</option>&nbsp;&lt;<emphasis>name</emphasis>&gt;</term>
6443 <listitem>
6444 <para>
6445 <indexterm role="option">
6446 <primary><option>-oMaa</option></primary>
6447 </indexterm>
6448 <indexterm role="concept">
6449 <primary>authentication</primary>
6450 <secondary>name, specifying for local message</secondary>
6451 </indexterm>
6452 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMaa</option>
6453 option sets the value of <varname>$sender_host_authenticated</varname> (the authenticator
6454 name). See chapter <xref linkend="CHAPSMTPAUTH"/> for a discussion of SMTP authentication.
6455 This option can be used with <option>-bh</option> and <option>-bs</option> to set up an
6456 authenticated SMTP session without actually using the SMTP AUTH command.
6457 </para>
6458 </listitem></varlistentry>
6459 <varlistentry>
6460 <term><option>-oMai</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6461 <listitem>
6462 <para>
6463 <indexterm role="option">
6464 <primary><option>-oMai</option></primary>
6465 </indexterm>
6466 <indexterm role="concept">
6467 <primary>authentication</primary>
6468 <secondary>id, specifying for local message</secondary>
6469 </indexterm>
6470 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMai</option>
6471 option sets the value of <varname>$authenticated_id</varname> (the id that was authenticated).
6472 This overrides the default value (the caller&#x2019;s login id, except with <option>-bh</option>,
6473 where there is no default) for messages from local sources. See chapter
6474 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated ids.
6475 </para>
6476 </listitem></varlistentry>
6477 <varlistentry>
6478 <term><option>-oMas</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
6479 <listitem>
6480 <para>
6481 <indexterm role="option">
6482 <primary><option>-oMas</option></primary>
6483 </indexterm>
6484 <indexterm role="concept">
6485 <primary>authentication</primary>
6486 <secondary>sender, specifying for local message</secondary>
6487 </indexterm>
6488 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMas</option>
6489 option sets the authenticated sender value in <varname>$authenticated_sender</varname>. It
6490 overrides the sender address that is created from the caller&#x2019;s login id for
6491 messages from local sources, except when <option>-bh</option> is used, when there is no
6492 default. For both <option>-bh</option> and <option>-bs</option>, an authenticated sender that is
6493 specified on a MAIL command overrides this value. See chapter
6494 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated senders.
6495 </para>
6496 </listitem></varlistentry>
6497 <varlistentry>
6498 <term><option>-oMi</option>&nbsp;&lt;<emphasis>interface&nbsp;address</emphasis>&gt;</term>
6499 <listitem>
6500 <para>
6501 <indexterm role="option">
6502 <primary><option>-oMi</option></primary>
6503 </indexterm>
6504 <indexterm role="concept">
6505 <primary>interface</primary>
6506 <secondary>address, specifying for local message</secondary>
6507 </indexterm>
6508 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMi</option>
6509 option sets the IP interface address value. A port number may be included,
6510 using the same syntax as for <option>-oMa</option>. The interface address is placed in
6511 <varname>$received_ip_address</varname> and the port number, if present, in <varname>$received_port</varname>.
6512 </para>
6513 </listitem></varlistentry>
6514 <varlistentry>
6515 <term><option>-oMm</option>&nbsp;&lt;<emphasis>message&nbsp;reference</emphasis>&gt;</term>
6516 <listitem>
6517 <para>
6518 <indexterm role="option">
6519 <primary><option>-oMm</option></primary>
6520 </indexterm>
6521 <indexterm role="concept">
6522 <primary>message reference</primary>
6523 <secondary>message reference, specifying for local message</secondary>
6524 </indexterm>
6525 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMm</option>
6526 option sets the message reference, e.g. message-id, and is logged during
6527 delivery. This is useful when some kind of audit trail is required to tie
6528 messages together. The format of the message reference is checked and will
6529 abort if the format is invalid. The option will only be accepted if exim is
6530 running in trusted mode, not as any regular user.
6531 </para>
6532 <para>
6533 The best example of a message reference is when Exim sends a bounce message.
6534 The message reference is the message-id of the original message for which Exim
6535 is sending the bounce.
6536 </para>
6537 </listitem></varlistentry>
6538 <varlistentry>
6539 <term><option>-oMr</option>&nbsp;&lt;<emphasis>protocol&nbsp;name</emphasis>&gt;</term>
6540 <listitem>
6541 <para>
6542 <indexterm role="option">
6543 <primary><option>-oMr</option></primary>
6544 </indexterm>
6545 <indexterm role="concept">
6546 <primary>protocol, specifying for local message</primary>
6547 </indexterm>
6548 <indexterm role="variable">
6549 <primary><varname>$received_protocol</varname></primary>
6550 </indexterm>
6551 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMr</option>
6552 option sets the received protocol value that is stored in
6553 <varname>$received_protocol</varname>. However, it does not apply (and is ignored) when <option>-bh</option>
6554 or <option>-bs</option> is used. For <option>-bh</option>, the protocol is forced to one of the standard
6555 SMTP protocol names (see the description of <varname>$received_protocol</varname> in section
6556 <xref linkend="SECTexpvar"/>). For <option>-bs</option>, the protocol is always <quote>local-</quote> followed by
6557 one of those same names. For <option>-bS</option> (batched SMTP) however, the protocol can
6558 be set by <option>-oMr</option>. Repeated use of this option is not supported.
6559 </para>
6560 </listitem></varlistentry>
6561 <varlistentry>
6562 <term><option>-oMs</option>&nbsp;&lt;<emphasis>host&nbsp;name</emphasis>&gt;</term>
6563 <listitem>
6564 <para>
6565 <indexterm role="option">
6566 <primary><option>-oMs</option></primary>
6567 </indexterm>
6568 <indexterm role="concept">
6569 <primary>sender</primary>
6570 <secondary>host name, specifying for local message</secondary>
6571 </indexterm>
6572 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMs</option>
6573 option sets the sender host name in <varname>$sender_host_name</varname>. When this option is
6574 present, Exim does not attempt to look up a host name from an IP address; it
6575 uses the name it is given.
6576 </para>
6577 </listitem></varlistentry>
6578 <varlistentry>
6579 <term><option>-oMt</option>&nbsp;&lt;<emphasis>ident&nbsp;string</emphasis>&gt;</term>
6580 <listitem>
6581 <para>
6582 <indexterm role="option">
6583 <primary><option>-oMt</option></primary>
6584 </indexterm>
6585 <indexterm role="concept">
6586 <primary>sender</primary>
6587 <secondary>ident string, specifying for local message</secondary>
6588 </indexterm>
6589 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMt</option>
6590 option sets the sender ident value in <varname>$sender_ident</varname>. The default setting for
6591 local callers is the login id of the calling process, except when <option>-bh</option> is
6592 used, when there is no default.
6593 </para>
6594 </listitem></varlistentry>
6595 <varlistentry>
6596 <term><option>-om</option></term>
6597 <listitem>
6598 <para>
6599 <indexterm role="option">
6600 <primary><option>-om</option></primary>
6601 </indexterm>
6602 <indexterm role="concept">
6603 <primary>Sendmail compatibility</primary>
6604 <secondary><option>-om</option> option ignored</secondary>
6605 </indexterm>
6606 In Sendmail, this option means <quote>me too</quote>, indicating that the sender of a
6607 message should receive a copy of the message if the sender appears in an alias
6608 expansion. Exim always does this, so the option does nothing.
6609 </para>
6610 </listitem></varlistentry>
6611 <varlistentry>
6612 <term><option>-oo</option></term>
6613 <listitem>
6614 <para>
6615 <indexterm role="option">
6616 <primary><option>-oo</option></primary>
6617 </indexterm>
6618 <indexterm role="concept">
6619 <primary>Sendmail compatibility</primary>
6620 <secondary><option>-oo</option> option ignored</secondary>
6621 </indexterm>
6622 This option is ignored. In Sendmail it specifies <quote>old style headers</quote>,
6623 whatever that means.
6624 </para>
6625 </listitem></varlistentry>
6626 <varlistentry>
6627 <term><option>-oP</option>&nbsp;&lt;<emphasis>path</emphasis>&gt;</term>
6628 <listitem>
6629 <para>
6630 <indexterm role="option">
6631 <primary><option>-oP</option></primary>
6632 </indexterm>
6633 <indexterm role="concept">
6634 <primary>pid (process id)</primary>
6635 <secondary>of daemon</secondary>
6636 </indexterm>
6637 <indexterm role="concept">
6638 <primary>daemon</primary>
6639 <secondary>process id (pid)</secondary>
6640 </indexterm>
6641 This option is useful only in conjunction with <option>-bd</option> or <option>-q</option> with a time
6642 value. The option specifies the file to which the process id of the daemon is
6643 written. When <option>-oX</option> is used with <option>-bd</option>, or when <option>-q</option> with a time is used
6644 without <option>-bd</option>, this is the only way of causing Exim to write a pid file,
6645 because in those cases, the normal pid file is not used.
6646 </para>
6647 </listitem></varlistentry>
6648 <varlistentry>
6649 <term><option>-or</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
6650 <listitem>
6651 <para>
6652 <indexterm role="option">
6653 <primary><option>-or</option></primary>
6654 </indexterm>
6655 <indexterm role="concept">
6656 <primary>timeout</primary>
6657 <secondary>for non-SMTP input</secondary>
6658 </indexterm>
6659 This option sets a timeout value for incoming non-SMTP messages. If it is not
6660 set, Exim will wait forever for the standard input. The value can also be set
6661 by the <option>receive_timeout</option> option. The format used for specifying times is
6662 described in section <xref linkend="SECTtimeformat"/>.
6663 </para>
6664 </listitem></varlistentry>
6665 <varlistentry>
6666 <term><option>-os</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
6667 <listitem>
6668 <para>
6669 <indexterm role="option">
6670 <primary><option>-os</option></primary>
6671 </indexterm>
6672 <indexterm role="concept">
6673 <primary>timeout</primary>
6674 <secondary>for SMTP input</secondary>
6675 </indexterm>
6676 <indexterm role="concept">
6677 <primary>SMTP</primary>
6678 <secondary>input timeout</secondary>
6679 </indexterm>
6680 This option sets a timeout value for incoming SMTP messages. The timeout
6681 applies to each SMTP command and block of data. The value can also be set by
6682 the <option>smtp_receive_timeout</option> option; it defaults to 5 minutes. The format used
6683 for specifying times is described in section <xref linkend="SECTtimeformat"/>.
6684 </para>
6685 </listitem></varlistentry>
6686 <varlistentry>
6687 <term><option>-ov</option></term>
6688 <listitem>
6689 <para>
6690 <indexterm role="option">
6691 <primary><option>-ov</option></primary>
6692 </indexterm>
6693 This option has exactly the same effect as <option>-v</option>.
6694 </para>
6695 </listitem></varlistentry>
6696 <varlistentry>
6697 <term><option>-oX</option>&nbsp;&lt;<emphasis>number&nbsp;or&nbsp;string</emphasis>&gt;</term>
6698 <listitem>
6699 <para>
6700 <indexterm role="option">
6701 <primary><option>-oX</option></primary>
6702 </indexterm>
6703 <indexterm role="concept">
6704 <primary>TCP/IP</primary>
6705 <secondary>setting listening ports</secondary>
6706 </indexterm>
6707 <indexterm role="concept">
6708 <primary>TCP/IP</primary>
6709 <secondary>setting listening interfaces</secondary>
6710 </indexterm>
6711 <indexterm role="concept">
6712 <primary>port</primary>
6713 <secondary>receiving TCP/IP</secondary>
6714 </indexterm>
6715 This option is relevant only when the <option>-bd</option> (start listening daemon) option
6716 is also given. It controls which ports and interfaces the daemon uses. Details
6717 of the syntax, and how it interacts with configuration file options, are given
6718 in chapter <xref linkend="CHAPinterfaces"/>. When <option>-oX</option> is used to start a daemon, no pid
6719 file is written unless <option>-oP</option> is also present to specify a pid filename.
6720 </para>
6721 </listitem></varlistentry>
6722 <varlistentry>
6723 <term><option>-pd</option></term>
6724 <listitem>
6725 <para>
6726 <indexterm role="option">
6727 <primary><option>-pd</option></primary>
6728 </indexterm>
6729 <indexterm role="concept">
6730 <primary>Perl</primary>
6731 <secondary>starting the interpreter</secondary>
6732 </indexterm>
6733 This option applies when an embedded Perl interpreter is linked with Exim (see
6734 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
6735 option, forcing the starting of the interpreter to be delayed until it is
6736 needed.
6737 </para>
6738 </listitem></varlistentry>
6739 <varlistentry>
6740 <term><option>-ps</option></term>
6741 <listitem>
6742 <para>
6743 <indexterm role="option">
6744 <primary><option>-ps</option></primary>
6745 </indexterm>
6746 <indexterm role="concept">
6747 <primary>Perl</primary>
6748 <secondary>starting the interpreter</secondary>
6749 </indexterm>
6750 This option applies when an embedded Perl interpreter is linked with Exim (see
6751 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
6752 option, forcing the starting of the interpreter to occur as soon as Exim is
6753 started.
6754 </para>
6755 </listitem></varlistentry>
6756 <varlistentry>
6757 <term><option>-p</option>&lt;<emphasis>rval</emphasis>&gt;:&lt;<emphasis>sval</emphasis>&gt;</term>
6758 <listitem>
6759 <para>
6760 <indexterm role="option">
6761 <primary><option>-p</option></primary>
6762 </indexterm>
6763 For compatibility with Sendmail, this option is equivalent to
6764 </para>
6765 <literallayout>
6766 <literal>-oMr</literal> &lt;<emphasis>rval</emphasis>&gt; <literal>-oMs</literal> &lt;<emphasis>sval</emphasis>&gt;
6767 </literallayout>
6768 <para>
6769 It sets the incoming protocol and host name (for trusted callers). The
6770 host name and its colon can be omitted when only the protocol is to be set.
6771 Note the Exim already has two private options, <option>-pd</option> and <option>-ps</option>, that refer
6772 to embedded Perl. It is therefore impossible to set a protocol value of <literal>d</literal>
6773 or <literal>s</literal> using this option (but that does not seem a real limitation).
6774 Repeated use of this option is not supported.
6775 </para>
6776 </listitem></varlistentry>
6777 <varlistentry>
6778 <term><option>-q</option></term>
6779 <listitem>
6780 <para>
6781 <indexterm role="option">
6782 <primary><option>-q</option></primary>
6783 </indexterm>
6784 <indexterm role="concept">
6785 <primary>queue runner</primary>
6786 <secondary>starting manually</secondary>
6787 </indexterm>
6788 This option is normally restricted to admin users. However, there is a
6789 configuration option called <option>prod_requires_admin</option> which can be set false to
6790 relax this restriction (and also the same requirement for the <option>-M</option>, <option>-R</option>,
6791 and <option>-S</option> options).
6792 </para>
6793 <para>
6794 <indexterm role="concept">
6795 <primary>queue runner</primary>
6796 <secondary>description of operation</secondary>
6797 </indexterm>
6798 If other commandline options do not specify an action,
6799 the <option>-q</option> option starts one queue runner process. This scans the queue of
6800 waiting messages, and runs a delivery process for each one in turn. It waits
6801 for each delivery process to finish before starting the next one. A delivery
6802 process may not actually do any deliveries if the retry times for the addresses
6803 have not been reached. Use <option>-qf</option> (see below) if you want to override this.
6804 </para>
6805 <para>
6806 If
6807 <indexterm role="concept">
6808 <primary>SMTP</primary>
6809 <secondary>passed connection</secondary>
6810 </indexterm>
6811 <indexterm role="concept">
6812 <primary>SMTP</primary>
6813 <secondary>multiple deliveries</secondary>
6814 </indexterm>
6815 <indexterm role="concept">
6816 <primary>multiple SMTP deliveries</primary>
6817 </indexterm>
6818 the delivery process spawns other processes to deliver other messages down
6819 passed SMTP connections, the queue runner waits for these to finish before
6820 proceeding.
6821 </para>
6822 <para>
6823 When all the queued messages have been considered, the original queue runner
6824 process terminates. In other words, a single pass is made over the waiting
6825 mail, one message at a time. Use <option>-q</option> with a time (see below) if you want
6826 this to be repeated periodically.
6827 </para>
6828 <para>
6829 Exim processes the waiting messages in an unpredictable order. It isn&#x2019;t very
6830 random, but it is likely to be different each time, which is all that matters.
6831 If one particular message screws up a remote MTA, other messages to the same
6832 MTA have a chance of getting through if they get tried first.
6833 </para>
6834 <para>
6835 It is possible to cause the messages to be processed in lexical message id
6836 order, which is essentially the order in which they arrived, by setting the
6837 <option>queue_run_in_order</option> option, but this is not recommended for normal use.
6838 </para>
6839 </listitem></varlistentry>
6840 <varlistentry>
6841 <term><option>-q</option>&lt;<emphasis>qflags</emphasis>&gt;</term>
6842 <listitem>
6843 <para>
6844 The <option>-q</option> option may be followed by one or more flag letters that change its
6845 behaviour. They are all optional, but if more than one is present, they must
6846 appear in the correct order. Each flag is described in a separate item below.
6847 </para>
6848 </listitem></varlistentry>
6849 <varlistentry>
6850 <term><option>-qq...</option></term>
6851 <listitem>
6852 <para>
6853 <indexterm role="option">
6854 <primary><option>-qq</option></primary>
6855 </indexterm>
6856 <indexterm role="concept">
6857 <primary>queue</primary>
6858 <secondary>double scanning</secondary>
6859 </indexterm>
6860 <indexterm role="concept">
6861 <primary>queue</primary>
6862 <secondary>routing</secondary>
6863 </indexterm>
6864 <indexterm role="concept">
6865 <primary>routing</primary>
6866 <secondary>whole queue before delivery</secondary>
6867 </indexterm>
6868 An option starting with <option>-qq</option> requests a two-stage queue run. In the first
6869 stage, the queue is scanned as if the <option>queue_smtp_domains</option> option matched
6870 every domain. Addresses are routed, local deliveries happen, but no remote
6871 transports are run.
6872 </para>
6873 <para>
6874 <indexterm role="concept">
6875 <primary>hints database</primary>
6876 <secondary>remembering routing</secondary>
6877 </indexterm>
6878 The hints database that remembers which messages are waiting for specific hosts
6879 is updated, as if delivery to those hosts had been deferred. After this is
6880 complete, a second, normal queue scan happens, with routing and delivery taking
6881 place as normal. Messages that are routed to the same host should mostly be
6882 delivered down a single SMTP
6883 <indexterm role="concept">
6884 <primary>SMTP</primary>
6885 <secondary>passed connection</secondary>
6886 </indexterm>
6887 <indexterm role="concept">
6888 <primary>SMTP</primary>
6889 <secondary>multiple deliveries</secondary>
6890 </indexterm>
6891 <indexterm role="concept">
6892 <primary>multiple SMTP deliveries</primary>
6893 </indexterm>
6894 connection because of the hints that were set up during the first queue scan.
6895 This option may be useful for hosts that are connected to the Internet
6896 intermittently.
6897 </para>
6898 </listitem></varlistentry>
6899 <varlistentry>
6900 <term><option>-q[q]i...</option></term>
6901 <listitem>
6902 <para>
6903 <indexterm role="option">
6904 <primary><option>-qi</option></primary>
6905 </indexterm>
6906 <indexterm role="concept">
6907 <primary>queue</primary>
6908 <secondary>initial delivery</secondary>
6909 </indexterm>
6910 If the <emphasis>i</emphasis> flag is present, the queue runner runs delivery processes only for
6911 those messages that haven&#x2019;t previously been tried. (<emphasis>i</emphasis> stands for <quote>initial
6912 delivery</quote>.) This can be helpful if you are putting messages in the queue using
6913 <option>-odq</option> and want a queue runner just to process the new messages.
6914 </para>
6915 </listitem></varlistentry>
6916 <varlistentry>
6917 <term><option>-q[q][i]f...</option></term>
6918 <listitem>
6919 <para>
6920 <indexterm role="option">
6921 <primary><option>-qf</option></primary>
6922 </indexterm>
6923 <indexterm role="concept">
6924 <primary>queue</primary>
6925 <secondary>forcing delivery</secondary>
6926 </indexterm>
6927 <indexterm role="concept">
6928 <primary>delivery</primary>
6929 <secondary>forcing in queue run</secondary>
6930 </indexterm>
6931 If one <emphasis>f</emphasis> flag is present, a delivery attempt is forced for each non-frozen
6932 message, whereas without <emphasis>f</emphasis> only those non-frozen addresses that have passed
6933 their retry times are tried.
6934 </para>
6935 </listitem></varlistentry>
6936 <varlistentry>
6937 <term><option>-q[q][i]ff...</option></term>
6938 <listitem>
6939 <para>
6940 <indexterm role="option">
6941 <primary><option>-qff</option></primary>
6942 </indexterm>
6943 <indexterm role="concept">
6944 <primary>frozen messages</primary>
6945 <secondary>forcing delivery</secondary>
6946 </indexterm>
6947 If <emphasis>ff</emphasis> is present, a delivery attempt is forced for every message, whether
6948 frozen or not.
6949 </para>
6950 </listitem></varlistentry>
6951 <varlistentry>
6952 <term><option>-q[q][i][f[f]]l</option></term>
6953 <listitem>
6954 <para>
6955 <indexterm role="option">
6956 <primary><option>-ql</option></primary>
6957 </indexterm>
6958 <indexterm role="concept">
6959 <primary>queue</primary>
6960 <secondary>local deliveries only</secondary>
6961 </indexterm>
6962 The <emphasis>l</emphasis> (the letter <quote>ell</quote>) flag specifies that only local deliveries are to
6963 be done. If a message requires any remote deliveries, it remains in the queue
6964 for later delivery.
6965 </para>
6966 </listitem></varlistentry>
6967 <varlistentry>
6968 <term><option>-q[q][i][f[f]][l][G&lt;name&gt;[/&lt;time&gt;]]]</option></term>
6969 <listitem>
6970 <para>
6971 <indexterm role="option">
6972 <primary><option>-qG</option></primary>
6973 </indexterm>
6974 <indexterm role="concept">
6975 <primary>queue</primary>
6976 <secondary>named</secondary>
6977 </indexterm>
6978 <indexterm role="concept">
6979 <primary>named queues</primary>
6980 </indexterm>
6981 <indexterm role="concept">
6982 <primary>queue</primary>
6983 <secondary>delivering specific messages</secondary>
6984 </indexterm>
6985 If the <emphasis>G</emphasis> flag and a name is present, the queue runner operates on the
6986 queue with the given name rather than the default queue.
6987 The name should not contain a <emphasis>/</emphasis> character.
6988 For a periodic queue run (see below)
6989 append to the name a slash and a time value.
6990 </para>
6991 <para>
6992 If other commandline options specify an action, a <emphasis>-qG&lt;name&gt;</emphasis> option
6993 will specify a queue to operate on.
6994 For example:
6995 </para>
6996 <literallayout class="monospaced">
6997 exim -bp -qGquarantine
6998 mailq -qGquarantine
6999 exim -qGoffpeak -Rf @special.domain.example
7000 </literallayout>
7001 </listitem></varlistentry>
7002 <varlistentry>
7003 <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>
7004 <listitem>
7005 <para>
7006 When scanning the queue, Exim can be made to skip over messages whose ids are
7007 lexically less than a given value by following the <option>-q</option> option with a
7008 starting message id. For example:
7009 </para>
7010 <literallayout class="monospaced">
7011 exim -q 0t5C6f-0000c8-00
7012 </literallayout>
7013 <para>
7014 Messages that arrived earlier than <literal>0t5C6f-0000c8-00</literal> are not inspected. If a
7015 second message id is given, messages whose ids are lexically greater than it
7016 are also skipped. If the same id is given twice, for example,
7017 </para>
7018 <literallayout class="monospaced">
7019 exim -q 0t5C6f-0000c8-00 0t5C6f-0000c8-00
7020 </literallayout>
7021 <para>
7022 just one delivery process is started, for that message. This differs from
7023 <option>-M</option> in that retry data is respected, and it also differs from <option>-Mc</option> in
7024 that it counts as a delivery from a queue run. Note that the selection
7025 mechanism does not affect the order in which the messages are scanned. There
7026 are also other ways of selecting specific sets of messages for delivery in a
7027 queue run &ndash; see <option>-R</option> and <option>-S</option>.
7028 </para>
7029 </listitem></varlistentry>
7030 <varlistentry>
7031 <term><option>-q</option>&lt;<emphasis>qflags</emphasis>&gt;&lt;<emphasis>time</emphasis>&gt;</term>
7032 <listitem>
7033 <para>
7034 <indexterm role="concept">
7035 <primary>queue runner</primary>
7036 <secondary>starting periodically</secondary>
7037 </indexterm>
7038 <indexterm role="concept">
7039 <primary>periodic queue running</primary>
7040 </indexterm>
7041 When a time value is present, the <option>-q</option> option causes Exim to run as a daemon,
7042 starting a queue runner process at intervals specified by the given time value
7043 (whose format is described in section <xref linkend="SECTtimeformat"/>). This form of the
7044 <option>-q</option> option is commonly combined with the <option>-bd</option> option, in which case a
7045 single daemon process handles both functions. A common way of starting up a
7046 combined daemon at system boot time is to use a command such as
7047 </para>
7048 <literallayout class="monospaced">
7049 /usr/exim/bin/exim -bd -q30m
7050 </literallayout>
7051 <para>
7052 Such a daemon listens for incoming SMTP calls, and also starts a queue runner
7053 process every 30 minutes.
7054 </para>
7055 <para>
7056 When a daemon is started by <option>-q</option> with a time value, but without <option>-bd</option>, no
7057 pid file is written unless one is explicitly requested by the <option>-oP</option> option.
7058 </para>
7059 </listitem></varlistentry>
7060 <varlistentry>
7061 <term><option>-qR</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
7062 <listitem>
7063 <para>
7064 <indexterm role="option">
7065 <primary><option>-qR</option></primary>
7066 </indexterm>
7067 This option is synonymous with <option>-R</option>. It is provided for Sendmail
7068 compatibility.
7069 </para>
7070 </listitem></varlistentry>
7071 <varlistentry>
7072 <term><option>-qS</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
7073 <listitem>
7074 <para>
7075 <indexterm role="option">
7076 <primary><option>-qS</option></primary>
7077 </indexterm>
7078 This option is synonymous with <option>-S</option>.
7079 </para>
7080 </listitem></varlistentry>
7081 <varlistentry>
7082 <term><option>-R</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
7083 <listitem>
7084 <para>
7085 <indexterm role="option">
7086 <primary><option>-R</option></primary>
7087 </indexterm>
7088 <indexterm role="concept">
7089 <primary>queue runner</primary>
7090 <secondary>for specific recipients</secondary>
7091 </indexterm>
7092 <indexterm role="concept">
7093 <primary>delivery</primary>
7094 <secondary>to given domain</secondary>
7095 </indexterm>
7096 <indexterm role="concept">
7097 <primary>domain</primary>
7098 <secondary>delivery to</secondary>
7099 </indexterm>
7100 The &lt;<emphasis>rsflags</emphasis>&gt; may be empty, in which case the white space before the string
7101 is optional, unless the string is <emphasis>f</emphasis>, <emphasis>ff</emphasis>, <emphasis>r</emphasis>, <emphasis>rf</emphasis>, or <emphasis>rff</emphasis>,
7102 which are the possible values for &lt;<emphasis>rsflags</emphasis>&gt;. White space is required if
7103 &lt;<emphasis>rsflags</emphasis>&gt; is not empty.
7104 </para>
7105 <para>
7106 This option is similar to <option>-q</option> with no time value, that is, it causes Exim to
7107 perform a single queue run, except that, when scanning the messages on the
7108 queue, Exim processes only those that have at least one undelivered recipient
7109 address containing the given string, which is checked in a case-independent
7110 way. If the &lt;<emphasis>rsflags</emphasis>&gt; start with <emphasis>r</emphasis>, &lt;<emphasis>string</emphasis>&gt; is interpreted as a
7111 regular expression; otherwise it is a literal string.
7112 </para>
7113 <para>
7114 If you want to do periodic queue runs for messages with specific recipients,
7115 you can combine <option>-R</option> with <option>-q</option> and a time value. For example:
7116 </para>
7117 <literallayout class="monospaced">
7118 exim -q25m -R @special.domain.example
7119 </literallayout>
7120 <para>
7121 This example does a queue run for messages with recipients in the given domain
7122 every 25 minutes. Any additional flags that are specified with <option>-q</option> are
7123 applied to each queue run.
7124 </para>
7125 <para>
7126 Once a message is selected for delivery by this mechanism, all its addresses
7127 are processed. For the first selected message, Exim overrides any retry
7128 information and forces a delivery attempt for each undelivered address. This
7129 means that if delivery of any address in the first message is successful, any
7130 existing retry information is deleted, and so delivery attempts for that
7131 address in subsequently selected messages (which are processed without forcing)
7132 will run. However, if delivery of any address does not succeed, the retry
7133 information is updated, and in subsequently selected messages, the failing
7134 address will be skipped.
7135 </para>
7136 <para>
7137 <indexterm role="concept">
7138 <primary>frozen messages</primary>
7139 <secondary>forcing delivery</secondary>
7140 </indexterm>
7141 If the &lt;<emphasis>rsflags</emphasis>&gt; contain <emphasis>f</emphasis> or <emphasis>ff</emphasis>, the delivery forcing applies to
7142 all selected messages, not just the first; frozen messages are included when
7143 <emphasis>ff</emphasis> is present.
7144 </para>
7145 <para>
7146 The <option>-R</option> option makes it straightforward to initiate delivery of all messages
7147 to a given domain after a host has been down for some time. When the SMTP
7148 command ETRN is accepted by its ACL (see chapter <xref linkend="CHAPACL"/>), its default
7149 effect is to run Exim with the <option>-R</option> option, but it can be configured to run
7150 an arbitrary command instead.
7151 </para>
7152 </listitem></varlistentry>
7153 <varlistentry>
7154 <term><option>-r</option></term>
7155 <listitem>
7156 <para>
7157 <indexterm role="option">
7158 <primary><option>-r</option></primary>
7159 </indexterm>
7160 This is a documented (for Sendmail) obsolete alternative name for <option>-f</option>.
7161 </para>
7162 </listitem></varlistentry>
7163 <varlistentry>
7164 <term><option>-S</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
7165 <listitem>
7166 <para>
7167 <indexterm role="option">
7168 <primary><option>-S</option></primary>
7169 </indexterm>
7170 <indexterm role="concept">
7171 <primary>delivery</primary>
7172 <secondary>from given sender</secondary>
7173 </indexterm>
7174 <indexterm role="concept">
7175 <primary>queue runner</primary>
7176 <secondary>for specific senders</secondary>
7177 </indexterm>
7178 This option acts like <option>-R</option> except that it checks the string against each
7179 message&#x2019;s sender instead of against the recipients. If <option>-R</option> is also set, both
7180 conditions must be met for a message to be selected. If either of the options
7181 has <emphasis>f</emphasis> or <emphasis>ff</emphasis> in its flags, the associated action is taken.
7182 </para>
7183 </listitem></varlistentry>
7184 <varlistentry>
7185 <term><option>-Tqt</option>&nbsp;&lt;<emphasis>times</emphasis>&gt;</term>
7186 <listitem>
7187 <para>
7188 <indexterm role="option">
7189 <primary><option>-Tqt</option></primary>
7190 </indexterm>
7191 This is an option that is exclusively for use by the Exim testing suite. It is not
7192 recognized when Exim is run normally. It allows for the setting up of explicit
7193 <quote>queue times</quote> so that various warning/retry features can be tested.
7194 </para>
7195 </listitem></varlistentry>
7196 <varlistentry>
7197 <term><option>-t</option></term>
7198 <listitem>
7199 <para>
7200 <indexterm role="option">
7201 <primary><option>-t</option></primary>
7202 </indexterm>
7203 <indexterm role="concept">
7204 <primary>recipient</primary>
7205 <secondary>extracting from header lines</secondary>
7206 </indexterm>
7207 <indexterm role="concept">
7208 <primary><emphasis>Bcc:</emphasis> header line</primary>
7209 </indexterm>
7210 <indexterm role="concept">
7211 <primary><emphasis>Cc:</emphasis> header line</primary>
7212 </indexterm>
7213 <indexterm role="concept">
7214 <primary><emphasis>To:</emphasis> header line</primary>
7215 </indexterm>
7216 When Exim is receiving a locally-generated, non-SMTP message on its standard
7217 input, the <option>-t</option> option causes the recipients of the message to be obtained
7218 from the <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis> header lines in the message instead of
7219 from the command arguments. The addresses are extracted before any rewriting
7220 takes place and the <emphasis>Bcc:</emphasis> header line, if present, is then removed.
7221 </para>
7222 <para>
7223 <indexterm role="concept">
7224 <primary>Sendmail compatibility</primary>
7225 <secondary><option>-t</option> option</secondary>
7226 </indexterm>
7227 If the command has any arguments, they specify addresses to which the message
7228 is <emphasis>not</emphasis> to be delivered. That is, the argument addresses are removed from
7229 the recipients list obtained from the headers. This is compatible with Smail 3
7230 and in accordance with the documented behaviour of several versions of
7231 Sendmail, as described in man pages on a number of operating systems (e.g.
7232 Solaris 8, IRIX 6.5, HP-UX 11). However, some versions of Sendmail <emphasis>add</emphasis>
7233 argument addresses to those obtained from the headers, and the O&#x2019;Reilly
7234 Sendmail book documents it that way. Exim can be made to add argument addresses
7235 instead of subtracting them by setting the option
7236 <option>extract_addresses_remove_arguments</option> false.
7237 </para>
7238 <para>
7239 <indexterm role="concept">
7240 <primary><option>Resent-</option> header lines</primary>
7241 <secondary>with <option>-t</option></secondary>
7242 </indexterm>
7243 If there are any <option>Resent-</option> header lines in the message, Exim extracts
7244 recipients from all <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>, and <emphasis>Resent-Bcc:</emphasis> header
7245 lines instead of from <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis>. This is for compatibility
7246 with Sendmail and other MTAs. (Prior to release 4.20, Exim gave an error if
7247 <option>-t</option> was used in conjunction with <option>Resent-</option> header lines.)
7248 </para>
7249 <para>
7250 RFC 2822 talks about different sets of <option>Resent-</option> header lines (for when a
7251 message is resent several times). The RFC also specifies that they should be
7252 added at the front of the message, and separated by <emphasis>Received:</emphasis> lines. It is
7253 not at all clear how <option>-t</option> should operate in the present of multiple sets,
7254 nor indeed exactly what constitutes a <quote>set</quote>.
7255 In practice, it seems that MUAs do not follow the RFC. The <option>Resent-</option> lines
7256 are often added at the end of the header, and if a message is resent more than
7257 once, it is common for the original set of <option>Resent-</option> headers to be renamed as
7258 <option>X-Resent-</option> when a new set is added. This removes any possible ambiguity.
7259 </para>
7260 </listitem></varlistentry>
7261 <varlistentry>
7262 <term><option>-ti</option></term>
7263 <listitem>
7264 <para>
7265 <indexterm role="option">
7266 <primary><option>-ti</option></primary>
7267 </indexterm>
7268 This option is exactly equivalent to <option>-t</option> <option>-i</option>. It is provided for
7269 compatibility with Sendmail.
7270 </para>
7271 </listitem></varlistentry>
7272 <varlistentry>
7273 <term><option>-tls-on-connect</option></term>
7274 <listitem>
7275 <para>
7276 <indexterm role="option">
7277 <primary><option>-tls-on-connect</option></primary>
7278 </indexterm>
7279 <indexterm role="concept">
7280 <primary>TLS</primary>
7281 <secondary>use without STARTTLS</secondary>
7282 </indexterm>
7283 <indexterm role="concept">
7284 <primary>TLS</primary>
7285 <secondary>automatic start</secondary>
7286 </indexterm>
7287 This option is available when Exim is compiled with TLS support. It forces all
7288 incoming SMTP connections to behave as if the incoming port is listed in the
7289 <option>tls_on_connect_ports</option> option. See section <xref linkend="SECTsupobssmt"/> and chapter
7290 <xref linkend="CHAPTLS"/> for further details.
7291 </para>
7292 </listitem></varlistentry>
7293 <varlistentry>
7294 <term><option>-U</option></term>
7295 <listitem>
7296 <para>
7297 <indexterm role="option">
7298 <primary><option>-U</option></primary>
7299 </indexterm>
7300 <indexterm role="concept">
7301 <primary>Sendmail compatibility</primary>
7302 <secondary><option>-U</option> option ignored</secondary>
7303 </indexterm>
7304 Sendmail uses this option for <quote>initial message submission</quote>, and its
7305 documentation states that in future releases, it may complain about
7306 syntactically invalid messages rather than fixing them when this flag is not
7307 set. Exim ignores this option.
7308 </para>
7309 </listitem></varlistentry>
7310 <varlistentry>
7311 <term><option>-v</option></term>
7312 <listitem>
7313 <para>
7314 <indexterm role="option">
7315 <primary><option>-v</option></primary>
7316 </indexterm>
7317 This option causes Exim to write information to the standard error stream,
7318 describing what it is doing. In particular, it shows the log lines for
7319 receiving and delivering a message, and if an SMTP connection is made, the SMTP
7320 dialogue is shown. Some of the log lines shown may not actually be written to
7321 the log if the setting of <option>log_selector</option> discards them. Any relevant
7322 selectors are shown with each log line. If none are shown, the logging is
7323 unconditional.
7324 </para>
7325 </listitem></varlistentry>
7326 <varlistentry>
7327 <term><option>-x</option></term>
7328 <listitem>
7329 <para>
7330 <indexterm role="option">
7331 <primary><option>-x</option></primary>
7332 </indexterm>
7333 AIX uses <option>-x</option> for a private purpose (<quote>mail from a local mail program has
7334 National Language Support extended characters in the body of the mail item</quote>).
7335 It sets <option>-x</option> when calling the MTA from its <option>mail</option> command. Exim ignores
7336 this option.
7337 </para>
7338 </listitem></varlistentry>
7339 <varlistentry>
7340 <term><option>-X</option>&nbsp;&lt;<emphasis>logfile</emphasis>&gt;</term>
7341 <listitem>
7342 <para>
7343 <indexterm role="option">
7344 <primary><option>-X</option></primary>
7345 </indexterm>
7346 This option is interpreted by Sendmail to cause debug information to be sent
7347 to the named file.  It is ignored by Exim.
7348 </para>
7349 </listitem></varlistentry>
7350 <varlistentry>
7351 <term><option>-z</option>&nbsp;&lt;<emphasis>log-line</emphasis>&gt;</term>
7352 <listitem>
7353 <para>
7354 <indexterm role="option">
7355 <primary><option>-z</option></primary>
7356 </indexterm>
7357 This option writes its argument to Exim&#x2019;s logfile.
7358 Use is restricted to administrators; the intent is for operational notes.
7359 Quotes should be used to maintain a multi-word item as a single argument,
7360 under most shells.
7361 </para>
7362 </listitem></varlistentry>
7363 </variablelist>
7364 <para>
7365 <indexterm role="concept" startref="IIDclo1" class="endofrange"/>
7366 <indexterm role="concept" startref="IIDclo2" class="endofrange"/>
7367 </para>
7368 <!-- === End of command line options === -->
7369 </section>
7370 </chapter>
7371
7372 <chapter id="CHAPconf">
7373 <title>The Exim runtime configuration file</title>
7374 <titleabbrev>The runtime configuration file</titleabbrev>
7375 <para>
7376 <indexterm role="concept">
7377 <primary>runtime configuration</primary>
7378 </indexterm>
7379 <indexterm role="concept">
7380 <primary>configuration file</primary>
7381 <secondary>general description</secondary>
7382 </indexterm>
7383 <indexterm role="concept">
7384 <primary>CONFIGURE_FILE</primary>
7385 </indexterm>
7386 <indexterm role="concept">
7387 <primary>configuration file</primary>
7388 <secondary>errors in</secondary>
7389 </indexterm>
7390 <indexterm role="concept">
7391 <primary>error</primary>
7392 <secondary>in configuration file</secondary>
7393 </indexterm>
7394 <indexterm role="concept">
7395 <primary>return code</primary>
7396 <secondary>for bad configuration</secondary>
7397 </indexterm>
7398 Exim uses a single runtime configuration file that is read whenever an Exim
7399 binary is executed. Note that in normal operation, this happens frequently,
7400 because Exim is designed to operate in a distributed manner, without central
7401 control.
7402 </para>
7403 <para>
7404 If a syntax error is detected while reading the configuration file, Exim
7405 writes a message on the standard error, and exits with a non-zero return code.
7406 The message is also written to the panic log. <emphasis role="bold">Note</emphasis>: Only simple syntax
7407 errors can be detected at this time. The values of any expanded options are
7408 not checked until the expansion happens, even when the expansion does not
7409 actually alter the string.
7410 </para>
7411 <para>
7412 The name of the configuration file is compiled into the binary for security
7413 reasons, and is specified by the CONFIGURE_FILE compilation option. In
7414 most configurations, this specifies a single file. However, it is permitted to
7415 give a colon-separated list of filenames, in which case Exim uses the first
7416 existing file in the list.
7417 </para>
7418 <para>
7419 <indexterm role="concept">
7420 <primary>EXIM_USER</primary>
7421 </indexterm>
7422 <indexterm role="concept">
7423 <primary>EXIM_GROUP</primary>
7424 </indexterm>
7425 <indexterm role="concept">
7426 <primary>CONFIGURE_OWNER</primary>
7427 </indexterm>
7428 <indexterm role="concept">
7429 <primary>CONFIGURE_GROUP</primary>
7430 </indexterm>
7431 <indexterm role="concept">
7432 <primary>configuration file</primary>
7433 <secondary>ownership</secondary>
7434 </indexterm>
7435 <indexterm role="concept">
7436 <primary>ownership</primary>
7437 <secondary>configuration file</secondary>
7438 </indexterm>
7439 The runtime configuration file must be owned by root or by the user that is
7440 specified at compile time by the CONFIGURE_OWNER option (if set). The
7441 configuration file must not be world-writeable, or group-writeable unless its
7442 group is the root group or the one specified at compile time by the
7443 CONFIGURE_GROUP option.
7444 </para>
7445 <para>
7446 <emphasis role="bold">Warning</emphasis>: In a conventional configuration, where the Exim binary is setuid
7447 to root, anybody who is able to edit the runtime configuration file has an
7448 easy way to run commands as root. If you specify a user or group in the
7449 CONFIGURE_OWNER or CONFIGURE_GROUP options, then that user and/or any users
7450 who are members of that group will trivially be able to obtain root privileges.
7451 </para>
7452 <para>
7453 Up to Exim version 4.72, the runtime configuration file was also permitted to
7454 be writeable by the Exim user and/or group. That has been changed in Exim 4.73
7455 since it offered a simple privilege escalation for any attacker who managed to
7456 compromise the Exim user account.
7457 </para>
7458 <para>
7459 A default configuration file, which will work correctly in simple situations,
7460 is provided in the file <filename>src/configure.default</filename>. If CONFIGURE_FILE
7461 defines just one filename, the installation process copies the default
7462 configuration to a new file of that name if it did not previously exist. If
7463 CONFIGURE_FILE is a list, no default is automatically installed. Chapter
7464 <xref linkend="CHAPdefconfil"/> is a <quote>walk-through</quote> discussion of the default
7465 configuration.
7466 </para>
7467 <section id="SECID40">
7468 <title>Using a different configuration file</title>
7469 <para>
7470 <indexterm role="concept">
7471 <primary>configuration file</primary>
7472 <secondary>alternate</secondary>
7473 </indexterm>
7474 A one-off alternate configuration can be specified by the <option>-C</option> command line
7475 option, which may specify a single file or a list of files. However, when
7476 <option>-C</option> is used, Exim gives up its root privilege, unless called by root (or
7477 unless the argument for <option>-C</option> is identical to the built-in value from
7478 CONFIGURE_FILE), or is listed in the TRUSTED_CONFIG_LIST file and the caller
7479 is the Exim user or the user specified in the CONFIGURE_OWNER setting. <option>-C</option>
7480 is useful mainly for checking the syntax of configuration files before
7481 installing them. No owner or group checks are done on a configuration file
7482 specified by <option>-C</option>, if root privilege has been dropped.
7483 </para>
7484 <para>
7485 Even the Exim user is not trusted to specify an arbitrary configuration file
7486 with the <option>-C</option> option to be used with root privileges, unless that file is
7487 listed in the TRUSTED_CONFIG_LIST file. This locks out the possibility of
7488 testing a configuration using <option>-C</option> right through message reception and
7489 delivery, even if the caller is root. The reception works, but by that time,
7490 Exim is running as the Exim user, so when it re-execs to regain privilege for
7491 the delivery, the use of <option>-C</option> causes privilege to be lost. However, root
7492 can test reception and delivery using two separate commands (one to put a
7493 message in the queue, using <option>-odq</option>, and another to do the delivery, using
7494 <option>-M</option>).
7495 </para>
7496 <para>
7497 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
7498 prefix string with which any file named in a <option>-C</option> command line option must
7499 start. In addition, the filename must not contain the sequence <quote><literal>/../</literal></quote>.
7500 There is no default setting for ALT_CONFIG_PREFIX; when it is unset, any
7501 filename can be used with <option>-C</option>.
7502 </para>
7503 <para>
7504 One-off changes to a configuration can be specified by the <option>-D</option> command line
7505 option, which defines and overrides values for macros used inside the
7506 configuration file. However, like <option>-C</option>, the use of this option by a
7507 non-privileged user causes Exim to discard its root privilege.
7508 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
7509 completely disabled, and its use causes an immediate error exit.
7510 </para>
7511 <para>
7512 The WHITELIST_D_MACROS option in <filename>Local/Makefile</filename> permits the binary builder
7513 to declare certain macro names trusted, such that root privilege will not
7514 necessarily be discarded.
7515 WHITELIST_D_MACROS defines a colon-separated list of macros which are
7516 considered safe and, if <option>-D</option> only supplies macros from this list, and the
7517 values are acceptable, then Exim will not give up root privilege if the caller
7518 is root, the Exim run-time user, or the CONFIGURE_OWNER, if set.  This is a
7519 transition mechanism and is expected to be removed in the future.  Acceptable
7520 values for the macros satisfy the regexp: <literal>^[A-Za-z0-9_/.-]*$</literal>
7521 </para>
7522 <para>
7523 Some sites may wish to use the same Exim binary on different machines that
7524 share a file system, but to use different configuration files on each machine.
7525 If CONFIGURE_FILE_USE_NODE is defined in <filename>Local/Makefile</filename>, Exim first
7526 looks for a file whose name is the configuration filename followed by a dot
7527 and the machine&#x2019;s node name, as obtained from the <function>uname()</function> function. If this
7528 file does not exist, the standard name is tried. This processing occurs for
7529 each filename in the list given by CONFIGURE_FILE or <option>-C</option>.
7530 </para>
7531 <para>
7532 In some esoteric situations different versions of Exim may be run under
7533 different effective uids and the CONFIGURE_FILE_USE_EUID is defined to
7534 help with this. See the comments in <filename>src/EDITME</filename> for details.
7535 </para>
7536 </section>
7537 <section id="SECTconffilfor">
7538 <title>Configuration file format</title>
7539 <para>
7540 <indexterm role="concept">
7541 <primary>configuration file</primary>
7542 <secondary>format of</secondary>
7543 </indexterm>
7544 <indexterm role="concept">
7545 <primary>format</primary>
7546 <secondary>configuration file</secondary>
7547 </indexterm>
7548 Exim&#x2019;s configuration file is divided into a number of different parts. General
7549 option settings must always appear at the start of the file. The other parts
7550 are all optional, and may appear in any order. Each part other than the first
7551 is introduced by the word <quote>begin</quote> followed by at least one literal
7552 space, and the name of the part. The optional parts are:
7553 </para>
7554 <itemizedlist>
7555 <listitem>
7556 <para>
7557 <emphasis>ACL</emphasis>: Access control lists for controlling incoming SMTP mail (see chapter
7558 <xref linkend="CHAPACL"/>).
7559 </para>
7560 </listitem>
7561 <listitem>
7562 <para>
7563 <indexterm role="concept">
7564 <primary>AUTH</primary>
7565 <secondary>configuration</secondary>
7566 </indexterm>
7567 <emphasis>authenticators</emphasis>: Configuration settings for the authenticator drivers. These
7568 are concerned with the SMTP AUTH command (see chapter <xref linkend="CHAPSMTPAUTH"/>).
7569 </para>
7570 </listitem>
7571 <listitem>
7572 <para>
7573 <emphasis>routers</emphasis>: Configuration settings for the router drivers. Routers process
7574 addresses and determine how the message is to be delivered (see chapters
7575 <xref linkend="CHAProutergeneric"/>&ndash;<xref linkend="CHAPredirect"/>).
7576 </para>
7577 </listitem>
7578 <listitem>
7579 <para>
7580 <emphasis>transports</emphasis>: Configuration settings for the transport drivers. Transports
7581 define mechanisms for copying messages to destinations (see chapters
7582 <xref linkend="CHAPtransportgeneric"/>&ndash;<xref linkend="CHAPsmtptrans"/>).
7583 </para>
7584 </listitem>
7585 <listitem>
7586 <para>
7587 <emphasis>retry</emphasis>: Retry rules, for use when a message cannot be delivered immediately.
7588 If there is no retry section, or if it is empty (that is, no retry rules are
7589 defined), Exim will not retry deliveries. In this situation, temporary errors
7590 are treated the same as permanent errors. Retry rules are discussed in chapter
7591 <xref linkend="CHAPretry"/>.
7592 </para>
7593 </listitem>
7594 <listitem>
7595 <para>
7596 <emphasis>rewrite</emphasis>: Global address rewriting rules, for use when a message arrives and
7597 when new addresses are generated during delivery. Rewriting is discussed in
7598 chapter <xref linkend="CHAPrewrite"/>.
7599 </para>
7600 </listitem>
7601 <listitem>
7602 <para>
7603 <emphasis>local_scan</emphasis>: Private options for the <function>local_scan()</function> function. If you
7604 want to use this feature, you must set
7605 </para>
7606 <literallayout class="monospaced">
7607 LOCAL_SCAN_HAS_OPTIONS=yes
7608 </literallayout>
7609 <para>
7610 in <filename>Local/Makefile</filename> before building Exim. Details of the <function>local_scan()</function>
7611 facility are given in chapter <xref linkend="CHAPlocalscan"/>.
7612 </para>
7613 </listitem>
7614 </itemizedlist>
7615 <para>
7616 <indexterm role="concept">
7617 <primary>configuration file</primary>
7618 <secondary>leading white space in</secondary>
7619 </indexterm>
7620 <indexterm role="concept">
7621 <primary>configuration file</primary>
7622 <secondary>trailing white space in</secondary>
7623 </indexterm>
7624 <indexterm role="concept">
7625 <primary>white space</primary>
7626 <secondary>in configuration file</secondary>
7627 </indexterm>
7628 Leading and trailing white space in configuration lines is always ignored.
7629 </para>
7630 <para>
7631 Blank lines in the file, and lines starting with a # character (ignoring
7632 leading white space) are treated as comments and are ignored. <emphasis role="bold">Note</emphasis>: A
7633 # character other than at the beginning of a line is not treated specially,
7634 and does not introduce a comment.
7635 </para>
7636 <para>
7637 Any non-comment line can be continued by ending it with a backslash. Note that
7638 the general rule for white space means that trailing white space after the
7639 backslash and leading white space at the start of continuation
7640 lines is ignored. Comment lines beginning with # (but not empty lines) may
7641 appear in the middle of a sequence of continuation lines.
7642 </para>
7643 <para>
7644 A convenient way to create a configuration file is to start from the
7645 default, which is supplied in <filename>src/configure.default</filename>, and add, delete, or
7646 change settings as required.
7647 </para>
7648 <para>
7649 The ACLs, retry rules, and rewriting rules have their own syntax which is
7650 described in chapters <xref linkend="CHAPACL"/>, <xref linkend="CHAPretry"/>, and <xref linkend="CHAPrewrite"/>,
7651 respectively. The other parts of the configuration file have some syntactic
7652 items in common, and these are described below, from section <xref linkend="SECTcos"/>
7653 onwards. Before that, the inclusion, macro, and conditional facilities are
7654 described.
7655 </para>
7656 </section>
7657 <section id="SECID41">
7658 <title>File inclusions in the configuration file</title>
7659 <para>
7660 <indexterm role="concept">
7661 <primary>inclusions in configuration file</primary>
7662 </indexterm>
7663 <indexterm role="concept">
7664 <primary>configuration file</primary>
7665 <secondary>including other files</secondary>
7666 </indexterm>
7667 <indexterm role="concept">
7668 <primary><literal>.include</literal> in configuration file</primary>
7669 </indexterm>
7670 <indexterm role="concept">
7671 <primary><literal>.include_if_exists</literal> in configuration file</primary>
7672 </indexterm>
7673 You can include other files inside Exim&#x2019;s runtime configuration file by
7674 using this syntax:
7675 </para>
7676 <literallayout>
7677 <literal>.include</literal> &lt;<emphasis>filename</emphasis>&gt;
7678 <literal>.include_if_exists</literal> &lt;<emphasis>filename</emphasis>&gt;
7679 </literallayout>
7680 <para>
7681 on a line by itself. Double quotes round the filename are optional. If you use
7682 the first form, a configuration error occurs if the file does not exist; the
7683 second form does nothing for non-existent files.
7684 The first form allows a relative name. It is resolved relative to
7685 the directory of the including file. For the second form an absolute filename
7686 is required.
7687 </para>
7688 <para>
7689 Includes may be nested to any depth, but remember that Exim reads its
7690 configuration file often, so it is a good idea to keep them to a minimum.
7691 If you change the contents of an included file, you must HUP the daemon,
7692 because an included file is read only when the configuration itself is read.
7693 </para>
7694 <para>
7695 The processing of inclusions happens early, at a physical line level, so, like
7696 comment lines, an inclusion can be used in the middle of an option setting,
7697 for example:
7698 </para>
7699 <literallayout class="monospaced">
7700 hosts_lookup = a.b.c \
7701                .include /some/file
7702 </literallayout>
7703 <para>
7704 Include processing happens after macro processing (see below). Its effect is to
7705 process the lines of the included file as if they occurred inline where the
7706 inclusion appears.
7707 </para>
7708 </section>
7709 <section id="SECTmacrodefs">
7710 <title>Macros in the configuration file</title>
7711 <para>
7712 <indexterm role="concept">
7713 <primary>macro</primary>
7714 <secondary>description of</secondary>
7715 </indexterm>
7716 <indexterm role="concept">
7717 <primary>configuration file</primary>
7718 <secondary>macros</secondary>
7719 </indexterm>
7720 If a line in the main part of the configuration (that is, before the first
7721 <quote>begin</quote> line) begins with an upper case letter, it is taken as a macro
7722 definition, and must be of the form
7723 </para>
7724 <literallayout>
7725 &lt;<emphasis>name</emphasis>&gt; = &lt;<emphasis>rest of line</emphasis>&gt;
7726 </literallayout>
7727 <para>
7728 The name must consist of letters, digits, and underscores, and need not all be
7729 in upper case, though that is recommended. The rest of the line, including any
7730 continuations, is the replacement text, and has leading and trailing white
7731 space removed. Quotes are not removed. The replacement text can never end with
7732 a backslash character, but this doesn&#x2019;t seem to be a serious limitation.
7733 </para>
7734 <para>
7735 Macros may also be defined between router, transport, authenticator, or ACL
7736 definitions. They may not, however, be defined within an individual driver or
7737 ACL, or in the <option>local_scan</option>, retry, or rewrite sections of the configuration.
7738 </para>
7739 </section>
7740 <section id="SECID42">
7741 <title>Macro substitution</title>
7742 <para>
7743 Once a macro is defined, all subsequent lines in the file (and any included
7744 files) are scanned for the macro name; if there are several macros, the line is
7745 scanned for each, in turn, in the order in which the macros are defined. The
7746 replacement text is not re-scanned for the current macro, though it is scanned
7747 for subsequently defined macros. For this reason, a macro name may not contain
7748 the name of a previously defined macro as a substring. You could, for example,
7749 define
7750 </para>
7751 <literallayout>
7752 <literal>ABCD_XYZ = </literal>&lt;<emphasis>something</emphasis>&gt;
7753 <literal>ABCD = </literal>&lt;<emphasis>something else</emphasis>&gt;
7754 </literallayout>
7755 <para>
7756 but putting the definitions in the opposite order would provoke a configuration
7757 error. Macro expansion is applied to individual physical lines from the file,
7758 before checking for line continuation or file inclusion (see above). If a line
7759 consists solely of a macro name, and the expansion of the macro is empty, the
7760 line is ignored. A macro at the start of a line may turn the line into a
7761 comment line or a <literal>.include</literal> line.
7762 </para>
7763 </section>
7764 <section id="SECID43">
7765 <title>Redefining macros</title>
7766 <para>
7767 Once defined, the value of a macro can be redefined later in the configuration
7768 (or in an included file). Redefinition is specified by using <emphasis>==</emphasis> instead of
7769 <emphasis>=</emphasis>. For example:
7770 </para>
7771 <literallayout class="monospaced">
7772 MAC =  initial value
7773 ...
7774 MAC == updated value
7775 </literallayout>
7776 <para>
7777 Redefinition does not alter the order in which the macros are applied to the
7778 subsequent lines of the configuration file. It is still the same order in which
7779 the macros were originally defined. All that changes is the macro&#x2019;s value.
7780 Redefinition makes it possible to accumulate values. For example:
7781 </para>
7782 <literallayout class="monospaced">
7783 MAC =  initial value
7784 ...
7785 MAC == MAC and something added
7786 </literallayout>
7787 <para>
7788 This can be helpful in situations where the configuration file is built
7789 from a number of other files.
7790 </para>
7791 </section>
7792 <section id="SECID44">
7793 <title>Overriding macro values</title>
7794 <para>
7795 The values set for macros in the configuration file can be overridden by the
7796 <option>-D</option> command line option, but Exim gives up its root privilege when <option>-D</option> is
7797 used, unless called by root or the Exim user. A definition on the command line
7798 using the <option>-D</option> option causes all definitions and redefinitions within the
7799 file to be ignored.
7800 </para>
7801 </section>
7802 <section id="SECID45">
7803 <title>Example of macro usage</title>
7804 <para>
7805 As an example of macro usage, consider a configuration where aliases are looked
7806 up in a MySQL database. It helps to keep the file less cluttered if long
7807 strings such as SQL statements are defined separately as macros, for example:
7808 </para>
7809 <literallayout class="monospaced">
7810 ALIAS_QUERY = select mailbox from user where \
7811               login='${quote_mysql:$local_part}';
7812 </literallayout>
7813 <para>
7814 This can then be used in a <command>redirect</command> router setting like this:
7815 </para>
7816 <literallayout class="monospaced">
7817 data = ${lookup mysql{ALIAS_QUERY}}
7818 </literallayout>
7819 <para>
7820 In earlier versions of Exim macros were sometimes used for domain, host, or
7821 address lists. In Exim 4 these are handled better by named lists &ndash; see
7822 section <xref linkend="SECTnamedlists"/>.
7823 </para>
7824 </section>
7825 <section id="SECTbuiltinmacros">
7826 <title>Builtin macros</title>
7827 <para>
7828 Exim defines some macros depending on facilities available, which may
7829 differ due to build-time definitions and from one release to another.
7830 All of these macros start with an underscore.
7831 They can be used to conditionally include parts of a configuration
7832 (see below).
7833 </para>
7834 <para>
7835 The following classes of macros are defined:
7836 </para>
7837 <literallayout>
7838 <literal> _HAVE_*                    </literal>  build-time defines
7839 <literal> _DRIVER_ROUTER_*           </literal>  router drivers
7840 <literal> _DRIVER_TRANSPORT_*        </literal>  transport drivers
7841 <literal> _DRIVER_AUTHENTICATOR_*    </literal>  authenticator drivers
7842 <literal> _LOG_*                     </literal>  log_selector values
7843 <literal> _OPT_MAIN_*                </literal>  main config options
7844 <literal> _OPT_ROUTERS_*             </literal>  generic router options
7845 <literal> _OPT_TRANSPORTS_*          </literal>  generic transport options
7846 <literal> _OPT_AUTHENTICATORS_*      </literal>  generic authenticator options
7847 <literal> _OPT_ROUTER_*_*            </literal>  private router options
7848 <literal> _OPT_TRANSPORT_*_*         </literal>  private transport options
7849 <literal> _OPT_AUTHENTICATOR_*_*     </literal>  private authenticator options
7850 </literallayout>
7851 <para>
7852 Use an <quote>exim -bP macros</quote> command to get the list of macros.
7853 </para>
7854 </section>
7855 <section id="SECID46">
7856 <title>Conditional skips in the configuration file</title>
7857 <para>
7858 <indexterm role="concept">
7859 <primary>configuration file</primary>
7860 <secondary>conditional skips</secondary>
7861 </indexterm>
7862 <indexterm role="concept">
7863 <primary><literal>.ifdef</literal></primary>
7864 </indexterm>
7865 You can use the directives <literal>.ifdef</literal>, <literal>.ifndef</literal>, <literal>.elifdef</literal>,
7866 <literal>.elifndef</literal>, <literal>.else</literal>, and <literal>.endif</literal> to dynamically include or exclude
7867 portions of the configuration file. The processing happens whenever the file is
7868 read (that is, when an Exim binary starts to run).
7869 </para>
7870 <para>
7871 The implementation is very simple. Instances of the first four directives must
7872 be followed by text that includes the names of one or macros. The condition
7873 that is tested is whether or not any macro substitution has taken place in the
7874 line. Thus:
7875 </para>
7876 <literallayout class="monospaced">
7877 .ifdef AAA
7878 message_size_limit = 50M
7879 .else
7880 message_size_limit = 100M
7881 .endif
7882 </literallayout>
7883 <para>
7884 sets a message size limit of 50M if the macro <literal>AAA</literal> is defined
7885 (or <literal>A</literal> or <literal>AA</literal>), and 100M
7886 otherwise. If there is more than one macro named on the line, the condition
7887 is true if any of them are defined. That is, it is an <quote>or</quote> condition. To
7888 obtain an <quote>and</quote> condition, you need to use nested <literal>.ifdef</literal>s.
7889 </para>
7890 <para>
7891 Although you can use a macro expansion to generate one of these directives,
7892 it is not very useful, because the condition <quote>there was a macro substitution
7893 in this line</quote> will always be true.
7894 </para>
7895 <para>
7896 Text following <literal>.else</literal> and <literal>.endif</literal> is ignored, and can be used as comment
7897 to clarify complicated nestings.
7898 </para>
7899 </section>
7900 <section id="SECTcos">
7901 <title>Common option syntax</title>
7902 <para>
7903 <indexterm role="concept">
7904 <primary>common option syntax</primary>
7905 </indexterm>
7906 <indexterm role="concept">
7907 <primary>syntax of common options</primary>
7908 </indexterm>
7909 <indexterm role="concept">
7910 <primary>configuration file</primary>
7911 <secondary>common option syntax</secondary>
7912 </indexterm>
7913 For the main set of options, driver options, and <function>local_scan()</function> options,
7914 each setting is on a line by itself, and starts with a name consisting of
7915 lower-case letters and underscores. Many options require a data value, and in
7916 these cases the name must be followed by an equals sign (with optional white
7917 space) and then the value. For example:
7918 </para>
7919 <literallayout class="monospaced">
7920 qualify_domain = mydomain.example.com
7921 </literallayout>
7922 <para>
7923 <indexterm role="concept">
7924 <primary>hiding configuration option values</primary>
7925 </indexterm>
7926 <indexterm role="concept">
7927 <primary>configuration options</primary>
7928 <secondary>hiding value of</secondary>
7929 </indexterm>
7930 <indexterm role="concept">
7931 <primary>options</primary>
7932 <secondary>hiding value of</secondary>
7933 </indexterm>
7934 Some option settings may contain sensitive data, for example, passwords for
7935 accessing databases. To stop non-admin users from using the <option>-bP</option> command
7936 line option to read these values, you can precede the option settings with the
7937 word <quote>hide</quote>. For example:
7938 </para>
7939 <literallayout class="monospaced">
7940 hide mysql_servers = localhost/users/admin/secret-password
7941 </literallayout>
7942 <para>
7943 For non-admin users, such options are displayed like this:
7944 </para>
7945 <literallayout class="monospaced">
7946 mysql_servers = &lt;value not displayable&gt;
7947 </literallayout>
7948 <para>
7949 If <quote>hide</quote> is used on a driver option, it hides the value of that option on
7950 all instances of the same driver.
7951 </para>
7952 <para>
7953 The following sections describe the syntax used for the different data types
7954 that are found in option settings.
7955 </para>
7956 </section>
7957 <section id="SECID47">
7958 <title>Boolean options</title>
7959 <para>
7960 <indexterm role="concept">
7961 <primary>format</primary>
7962 <secondary>boolean</secondary>
7963 </indexterm>
7964 <indexterm role="concept">
7965 <primary>boolean configuration values</primary>
7966 </indexterm>
7967 <indexterm role="option">
7968 <primary><option>no_</option><emphasis>xxx</emphasis></primary>
7969 </indexterm>
7970 <indexterm role="option">
7971 <primary><option>not_</option><emphasis>xxx</emphasis></primary>
7972 </indexterm>
7973 Options whose type is given as boolean are on/off switches. There are two
7974 different ways of specifying such options: with and without a data value. If
7975 the option name is specified on its own without data, the switch is turned on;
7976 if it is preceded by <quote>no_</quote> or <quote>not_</quote> the switch is turned off. However,
7977 boolean options may be followed by an equals sign and one of the words
7978 <quote>true</quote>, <quote>false</quote>, <quote>yes</quote>, or <quote>no</quote>, as an alternative syntax. For example,
7979 the following two settings have exactly the same effect:
7980 </para>
7981 <literallayout class="monospaced">
7982 queue_only
7983 queue_only = true
7984 </literallayout>
7985 <para>
7986 The following two lines also have the same (opposite) effect:
7987 </para>
7988 <literallayout class="monospaced">
7989 no_queue_only
7990 queue_only = false
7991 </literallayout>
7992 <para>
7993 You can use whichever syntax you prefer.
7994 </para>
7995 </section>
7996 <section id="SECID48">
7997 <title>Integer values</title>
7998 <para>
7999 <indexterm role="concept">
8000 <primary>integer configuration values</primary>
8001 </indexterm>
8002 <indexterm role="concept">
8003 <primary>format</primary>
8004 <secondary>integer</secondary>
8005 </indexterm>
8006 If an option&#x2019;s type is given as <quote>integer</quote>, the value can be given in decimal,
8007 hexadecimal, or octal. If it starts with a digit greater than zero, a decimal
8008 number is assumed. Otherwise, it is treated as an octal number unless it starts
8009 with the characters <quote>0x</quote>, in which case the remainder is interpreted as a
8010 hexadecimal number.
8011 </para>
8012 <para>
8013 If an integer value is followed by the letter K, it is multiplied by 1024; if
8014 it is followed by the letter M, it is multiplied by 1024x1024;
8015 if by the letter G, 1024x1024x1024.
8016 When the values
8017 of integer option settings are output, values which are an exact multiple of
8018 1024 or 1024x1024 are sometimes, but not always, printed using the letters K
8019 and M. The printing style is independent of the actual input format that was
8020 used.
8021 </para>
8022 </section>
8023 <section id="SECID49">
8024 <title>Octal integer values</title>
8025 <para>
8026 <indexterm role="concept">
8027 <primary>integer format</primary>
8028 </indexterm>
8029 <indexterm role="concept">
8030 <primary>format</primary>
8031 <secondary>octal integer</secondary>
8032 </indexterm>
8033 If an option&#x2019;s type is given as <quote>octal integer</quote>, its value is always
8034 interpreted as an octal number, whether or not it starts with the digit zero.
8035 Such options are always output in octal.
8036 </para>
8037 </section>
8038 <section id="SECID50">
8039 <title>Fixed point numbers</title>
8040 <para>
8041 <indexterm role="concept">
8042 <primary>fixed point configuration values</primary>
8043 </indexterm>
8044 <indexterm role="concept">
8045 <primary>format</primary>
8046 <secondary>fixed point</secondary>
8047 </indexterm>
8048 If an option&#x2019;s type is given as <quote>fixed-point</quote>, its value must be a decimal
8049 integer, optionally followed by a decimal point and up to three further digits.
8050 </para>
8051 </section>
8052 <section id="SECTtimeformat">
8053 <title>Time intervals</title>
8054 <para>
8055 <indexterm role="concept">
8056 <primary>time interval</primary>
8057 <secondary>specifying in configuration</secondary>
8058 </indexterm>
8059 <indexterm role="concept">
8060 <primary>format</primary>
8061 <secondary>time interval</secondary>
8062 </indexterm>
8063 A time interval is specified as a sequence of numbers, each followed by one of
8064 the following letters, with no intervening white space:
8065 </para>
8066 <informaltable frame="none">
8067 <tgroup cols="2" colsep="0" rowsep="0">
8068 <colspec colwidth="30pt" align="left"/>
8069 <colspec colwidth="254pt" align="left"/>
8070 <tbody>
8071 <row>
8072 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>s</option></entry>
8073 <entry>seconds</entry>
8074 </row>
8075 <row>
8076 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>m</option></entry>
8077 <entry>minutes</entry>
8078 </row>
8079 <row>
8080 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>h</option></entry>
8081 <entry>hours</entry>
8082 </row>
8083 <row>
8084 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>d</option></entry>
8085 <entry>days</entry>
8086 </row>
8087 <row>
8088 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>w</option></entry>
8089 <entry>weeks</entry>
8090 </row>
8091 </tbody>
8092 </tgroup>
8093 </informaltable>
8094 <para>
8095 For example, <quote>3h50m</quote> specifies 3 hours and 50 minutes. The values of time
8096 intervals are output in the same format. Exim does not restrict the values; it
8097 is perfectly acceptable, for example, to specify <quote>90m</quote> instead of <quote>1h30m</quote>.
8098 </para>
8099 </section>
8100 <section id="SECTstrings">
8101 <title>String values</title>
8102 <para>
8103 <indexterm role="concept">
8104 <primary>string</primary>
8105 <secondary>format of configuration values</secondary>
8106 </indexterm>
8107 <indexterm role="concept">
8108 <primary>format</primary>
8109 <secondary>string</secondary>
8110 </indexterm>
8111 If an option&#x2019;s type is specified as <quote>string</quote>, the value can be specified with
8112 or without double-quotes. If it does not start with a double-quote, the value
8113 consists of the remainder of the line plus any continuation lines, starting at
8114 the first character after any leading white space, with trailing white space
8115 removed, and with no interpretation of the characters in the string. Because
8116 Exim removes comment lines (those beginning with #) at an early stage, they can
8117 appear in the middle of a multi-line string. The following two settings are
8118 therefore equivalent:
8119 </para>
8120 <literallayout class="monospaced">
8121 trusted_users = uucp:mail
8122 trusted_users = uucp:\
8123                 # This comment line is ignored
8124                 mail
8125 </literallayout>
8126 <para>
8127 <indexterm role="concept">
8128 <primary>string</primary>
8129 <secondary>quoted</secondary>
8130 </indexterm>
8131 <indexterm role="concept">
8132 <primary>escape characters in quoted strings</primary>
8133 </indexterm>
8134 If a string does start with a double-quote, it must end with a closing
8135 double-quote, and any backslash characters other than those used for line
8136 continuation are interpreted as escape characters, as follows:
8137 </para>
8138 <informaltable frame="none">
8139 <tgroup cols="2" colsep="0" rowsep="0">
8140 <colspec colwidth="100pt" align="left"/>
8141 <colspec colwidth="254pt" align="left"/>
8142 <tbody>
8143 <row>
8144 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\\</literal></entry>
8145 <entry>single backslash</entry>
8146 </row>
8147 <row>
8148 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\n</literal></entry>
8149 <entry>newline</entry>
8150 </row>
8151 <row>
8152 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\r</literal></entry>
8153 <entry>carriage return</entry>
8154 </row>
8155 <row>
8156 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\t</literal></entry>
8157 <entry>tab</entry>
8158 </row>
8159 <row>
8160 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\</literal>&lt;<emphasis>octal digits</emphasis>&gt;</entry>
8161 <entry>up to 3 octal digits specify one character</entry>
8162 </row>
8163 <row>
8164 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\x</literal>&lt;<emphasis>hex digits</emphasis>&gt;</entry>
8165 <entry>up to 2 hexadecimal digits specify one character</entry>
8166 </row>
8167 </tbody>
8168 </tgroup>
8169 </informaltable>
8170 <para>
8171 If a backslash is followed by some other character, including a double-quote
8172 character, that character replaces the pair.
8173 </para>
8174 <para>
8175 Quoting is necessary only if you want to make use of the backslash escapes to
8176 insert special characters, or if you need to specify a value with leading or
8177 trailing spaces. These cases are rare, so quoting is almost never needed in
8178 current versions of Exim. In versions of Exim before 3.14, quoting was required
8179 in order to continue lines, so you may come across older configuration files
8180 and examples that apparently quote unnecessarily.
8181 </para>
8182 </section>
8183 <section id="SECID51">
8184 <title>Expanded strings</title>
8185 <para>
8186 <indexterm role="concept">
8187 <primary>expansion</primary>
8188 <secondary>definition of</secondary>
8189 </indexterm>
8190 Some strings in the configuration file are subjected to <emphasis>string expansion</emphasis>,
8191 by which means various parts of the string may be changed according to the
8192 circumstances (see chapter <xref linkend="CHAPexpand"/>). The input syntax for such strings
8193 is as just described; in particular, the handling of backslashes in quoted
8194 strings is done as part of the input process, before expansion takes place.
8195 However, backslash is also an escape character for the expander, so any
8196 backslashes that are required for that reason must be doubled if they are
8197 within a quoted configuration string.
8198 </para>
8199 </section>
8200 <section id="SECID52">
8201 <title>User and group names</title>
8202 <para>
8203 <indexterm role="concept">
8204 <primary>user name</primary>
8205 <secondary>format of</secondary>
8206 </indexterm>
8207 <indexterm role="concept">
8208 <primary>format</primary>
8209 <secondary>user name</secondary>
8210 </indexterm>
8211 <indexterm role="concept">
8212 <primary>groups</primary>
8213 <secondary>name format</secondary>
8214 </indexterm>
8215 <indexterm role="concept">
8216 <primary>format</primary>
8217 <secondary>group name</secondary>
8218 </indexterm>
8219 User and group names are specified as strings, using the syntax described
8220 above, but the strings are interpreted specially. A user or group name must
8221 either consist entirely of digits, or be a name that can be looked up using the
8222 <function>getpwnam()</function> or <function>getgrnam()</function> function, as appropriate.
8223 </para>
8224 </section>
8225 <section id="SECTlistconstruct">
8226 <title>List construction</title>
8227 <para>
8228 <indexterm role="concept">
8229 <primary>list</primary>
8230 <secondary>syntax of in configuration</secondary>
8231 </indexterm>
8232 <indexterm role="concept">
8233 <primary>format</primary>
8234 <secondary>list item in configuration</secondary>
8235 </indexterm>
8236 <indexterm role="concept">
8237 <primary>string</primary>
8238 <secondary>list, definition of</secondary>
8239 </indexterm>
8240 The data for some configuration options is a list of items, with colon as the
8241 default separator. Many of these options are shown with type <quote>string list</quote> in
8242 the descriptions later in this document. Others are listed as <quote>domain list</quote>,
8243 <quote>host list</quote>, <quote>address list</quote>, or <quote>local part list</quote>. Syntactically, they
8244 are all the same; however, those other than <quote>string list</quote> are subject to
8245 particular kinds of interpretation, as described in chapter
8246 <xref linkend="CHAPdomhosaddlists"/>.
8247 </para>
8248 <para>
8249 In all these cases, the entire list is treated as a single string as far as the
8250 input syntax is concerned. The <option>trusted_users</option> setting in section
8251 <xref linkend="SECTstrings"/> above is an example. If a colon is actually needed in an item
8252 in a list, it must be entered as two colons. Leading and trailing white space
8253 on each item in a list is ignored. This makes it possible to include items that
8254 start with a colon, and in particular, certain forms of IPv6 address. For
8255 example, the list
8256 </para>
8257 <literallayout class="monospaced">
8258 local_interfaces = 127.0.0.1 : ::::1
8259 </literallayout>
8260 <para>
8261 contains two IP addresses, the IPv4 address 127.0.0.1 and the IPv6 address ::1.
8262 </para>
8263 <para>
8264 <emphasis role="bold">Note</emphasis>: Although leading and trailing white space is ignored in individual
8265 list items, it is not ignored when parsing the list. The space after the first
8266 colon in the example above is necessary. If it were not there, the list would
8267 be interpreted as the two items 127.0.0.1:: and 1.
8268 </para>
8269 </section>
8270 <section id="SECTlistsepchange">
8271 <title>Changing list separators</title>
8272 <para>
8273 <indexterm role="concept">
8274 <primary>list separator</primary>
8275 <secondary>changing</secondary>
8276 </indexterm>
8277 <indexterm role="concept">
8278 <primary>IPv6</primary>
8279 <secondary>addresses in lists</secondary>
8280 </indexterm>
8281 Doubling colons in IPv6 addresses is an unwelcome chore, so a mechanism was
8282 introduced to allow the separator character to be changed. If a list begins
8283 with a left angle bracket, followed by any punctuation character, that
8284 character is used instead of colon as the list separator. For example, the list
8285 above can be rewritten to use a semicolon separator like this:
8286 </para>
8287 <literallayout class="monospaced">
8288 local_interfaces = &lt;; 127.0.0.1 ; ::1
8289 </literallayout>
8290 <para>
8291 This facility applies to all lists, with the exception of the list in
8292 <option>log_file_path</option>. It is recommended that the use of non-colon separators be
8293 confined to circumstances where they really are needed.
8294 </para>
8295 <para>
8296 <indexterm role="concept">
8297 <primary>list separator</primary>
8298 <secondary>newline as</secondary>
8299 </indexterm>
8300 <indexterm role="concept">
8301 <primary>newline</primary>
8302 <secondary>as list separator</secondary>
8303 </indexterm>
8304 It is also possible to use newline and other control characters (those with
8305 code values less than 32, plus DEL) as separators in lists. Such separators
8306 must be provided literally at the time the list is processed. For options that
8307 are string-expanded, you can write the separator using a normal escape
8308 sequence. This will be processed by the expander before the string is
8309 interpreted as a list. For example, if a newline-separated list of domains is
8310 generated by a lookup, you can process it directly by a line such as this:
8311 </para>
8312 <literallayout class="monospaced">
8313 domains = &lt;\n ${lookup mysql{.....}}
8314 </literallayout>
8315 <para>
8316 This avoids having to change the list separator in such data. You are unlikely
8317 to want to use a control character as a separator in an option that is not
8318 expanded, because the value is literal text. However, it can be done by giving
8319 the value in quotes. For example:
8320 </para>
8321 <literallayout class="monospaced">
8322 local_interfaces = "&lt;\n 127.0.0.1 \n ::1"
8323 </literallayout>
8324 <para>
8325 Unlike printing character separators, which can be included in list items by
8326 doubling, it is not possible to include a control character as data when it is
8327 set as the separator. Two such characters in succession are interpreted as
8328 enclosing an empty list item.
8329 </para>
8330 </section>
8331 <section id="SECTempitelis">
8332 <title>Empty items in lists</title>
8333 <para>
8334 <indexterm role="concept">
8335 <primary>list</primary>
8336 <secondary>empty item in</secondary>
8337 </indexterm>
8338 An empty item at the end of a list is always ignored. In other words, trailing
8339 separator characters are ignored. Thus, the list in
8340 </para>
8341 <literallayout class="monospaced">
8342 senders = user@domain :
8343 </literallayout>
8344 <para>
8345 contains only a single item. If you want to include an empty string as one item
8346 in a list, it must not be the last item. For example, this list contains three
8347 items, the second of which is empty:
8348 </para>
8349 <literallayout class="monospaced">
8350 senders = user1@domain : : user2@domain
8351 </literallayout>
8352 <para>
8353 <emphasis role="bold">Note</emphasis>: There must be white space between the two colons, as otherwise they
8354 are interpreted as representing a single colon data character (and the list
8355 would then contain just one item). If you want to specify a list that contains
8356 just one, empty item, you can do it as in this example:
8357 </para>
8358 <literallayout class="monospaced">
8359 senders = :
8360 </literallayout>
8361 <para>
8362 In this case, the first item is empty, and the second is discarded because it
8363 is at the end of the list.
8364 </para>
8365 </section>
8366 <section id="SECTfordricon">
8367 <title>Format of driver configurations</title>
8368 <para>
8369 <indexterm role="concept">
8370 <primary>drivers</primary>
8371 <secondary>configuration format</secondary>
8372 </indexterm>
8373 There are separate parts in the configuration for defining routers, transports,
8374 and authenticators. In each part, you are defining a number of driver
8375 instances, each with its own set of options. Each driver instance is defined by
8376 a sequence of lines like this:
8377 </para>
8378 <literallayout>
8379 &lt;<emphasis>instance name</emphasis>&gt;:
8380   &lt;<emphasis>option</emphasis>&gt;
8381   ...
8382   &lt;<emphasis>option</emphasis>&gt;
8383 </literallayout>
8384 <para>
8385 In the following example, the instance name is <command>localuser</command>, and it is
8386 followed by three options settings:
8387 </para>
8388 <literallayout class="monospaced">
8389 localuser:
8390   driver = accept
8391   check_local_user
8392   transport = local_delivery
8393 </literallayout>
8394 <para>
8395 For each driver instance, you specify which Exim code module it uses &ndash; by the
8396 setting of the <option>driver</option> option &ndash; and (optionally) some configuration
8397 settings. For example, in the case of transports, if you want a transport to
8398 deliver with SMTP you would use the <command>smtp</command> driver; if you want to deliver to
8399 a local file you would use the <command>appendfile</command> driver. Each of the drivers is
8400 described in detail in its own separate chapter later in this manual.
8401 </para>
8402 <para>
8403 You can have several routers, transports, or authenticators that are based on
8404 the same underlying driver (each must have a different instance name).
8405 </para>
8406 <para>
8407 The order in which routers are defined is important, because addresses are
8408 passed to individual routers one by one, in order. The order in which
8409 transports are defined does not matter at all. The order in which
8410 authenticators are defined is used only when Exim, as a client, is searching
8411 them to find one that matches an authentication mechanism offered by the
8412 server.
8413 </para>
8414 <para>
8415 <indexterm role="concept">
8416 <primary>generic options</primary>
8417 </indexterm>
8418 <indexterm role="concept">
8419 <primary>options</primary>
8420 <secondary>generic &ndash; definition of</secondary>
8421 </indexterm>
8422 Within a driver instance definition, there are two kinds of option: <emphasis>generic</emphasis>
8423 and <emphasis>private</emphasis>. The generic options are those that apply to all drivers of the
8424 same type (that is, all routers, all transports or all authenticators). The
8425 <option>driver</option> option is a generic option that must appear in every definition.
8426 <indexterm role="concept">
8427 <primary>private options</primary>
8428 </indexterm>
8429 The private options are special for each driver, and none need appear, because
8430 they all have default values.
8431 </para>
8432 <para>
8433 The options may appear in any order, except that the <option>driver</option> option must
8434 precede any private options, since these depend on the particular driver. For
8435 this reason, it is recommended that <option>driver</option> always be the first option.
8436 </para>
8437 <para>
8438 Driver instance names, which are used for reference in log entries and
8439 elsewhere, can be any sequence of letters, digits, and underscores (starting
8440 with a letter) and must be unique among drivers of the same type. A router and
8441 a transport (for example) can each have the same name, but no two router
8442 instances can have the same name. The name of a driver instance should not be
8443 confused with the name of the underlying driver module. For example, the
8444 configuration lines:
8445 </para>
8446 <literallayout class="monospaced">
8447 remote_smtp:
8448   driver = smtp
8449 </literallayout>
8450 <para>
8451 create an instance of the <command>smtp</command> transport driver whose name is
8452 <command>remote_smtp</command>. The same driver code can be used more than once, with
8453 different instance names and different option settings each time. A second
8454 instance of the <command>smtp</command> transport, with different options, might be defined
8455 thus:
8456 </para>
8457 <literallayout class="monospaced">
8458 special_smtp:
8459   driver = smtp
8460   port = 1234
8461   command_timeout = 10s
8462 </literallayout>
8463 <para>
8464 The names <command>remote_smtp</command> and <command>special_smtp</command> would be used to reference
8465 these transport instances from routers, and these names would appear in log
8466 lines.
8467 </para>
8468 <para>
8469 Comment lines may be present in the middle of driver specifications. The full
8470 list of option settings for any particular driver instance, including all the
8471 defaulted values, can be extracted by making use of the <option>-bP</option> command line
8472 option.
8473 </para>
8474 </section>
8475 </chapter>
8476
8477 <chapter id="CHAPdefconfil">
8478 <title>The default configuration file</title>
8479 <para>
8480 <indexterm role="concept" id="IIDconfiwal" class="startofrange">
8481 <primary>configuration file</primary>
8482 <secondary>default <quote>walk through</quote></secondary>
8483 </indexterm>
8484 <indexterm role="concept">
8485 <primary>default</primary>
8486 <secondary>configuration file <quote>walk through</quote></secondary>
8487 </indexterm>
8488 The default configuration file supplied with Exim as <filename>src/configure.default</filename>
8489 is sufficient for a host with simple mail requirements. As an introduction to
8490 the way Exim is configured, this chapter <quote>walks through</quote> the default
8491 configuration, giving brief explanations of the settings. Detailed descriptions
8492 of the options are given in subsequent chapters. The default configuration file
8493 itself contains extensive comments about ways you might want to modify the
8494 initial settings. However, note that there are many options that are not
8495 mentioned at all in the default configuration.
8496 </para>
8497 <section id="SECTdefconfmacros">
8498 <title>Macros</title>
8499 <para>
8500 All macros should be defined before any options.
8501 </para>
8502 <para>
8503 One macro is specified, but commented out, in the default configuration:
8504 </para>
8505 <literallayout class="monospaced">
8506 # ROUTER_SMARTHOST=MAIL.HOSTNAME.FOR.CENTRAL.SERVER.EXAMPLE
8507 </literallayout>
8508 <para>
8509 If all off-site mail is expected to be delivered to a "smarthost", then set the
8510 hostname here and uncomment the macro.  This will affect which router is used
8511 later on.  If this is left commented out, then Exim will perform direct-to-MX
8512 deliveries using a <command>dnslookup</command> router.
8513 </para>
8514 <para>
8515 In addition to macros defined here, Exim includes a number of built-in macros
8516 to enable configuration to be guarded by a binary built with support for a
8517 given feature.  See section <xref linkend="SECTbuiltinmacros"/> for more details.
8518 </para>
8519 </section>
8520 <section id="SECTdefconfmain">
8521 <title>Main configuration settings</title>
8522 <para>
8523 The main (global) configuration option settings section must always come first
8524 in the file, after the macros.
8525 The first thing you&#x2019;ll see in the file, after some initial comments, is the line
8526 </para>
8527 <literallayout class="monospaced">
8528 # primary_hostname =
8529 </literallayout>
8530 <para>
8531 This is a commented-out setting of the <option>primary_hostname</option> option. Exim needs
8532 to know the official, fully qualified name of your host, and this is where you
8533 can specify it. However, in most cases you do not need to set this option. When
8534 it is unset, Exim uses the <function>uname()</function> system function to obtain the host name.
8535 </para>
8536 <para>
8537 The first three non-comment configuration lines are as follows:
8538 </para>
8539 <literallayout class="monospaced">
8540 domainlist local_domains    = @
8541 domainlist relay_to_domains =
8542 hostlist   relay_from_hosts = 127.0.0.1
8543 </literallayout>
8544 <para>
8545 These are not, in fact, option settings. They are definitions of two named
8546 domain lists and one named host list. Exim allows you to give names to lists of
8547 domains, hosts, and email addresses, in order to make it easier to manage the
8548 configuration file (see section <xref linkend="SECTnamedlists"/>).
8549 </para>
8550 <para>
8551 The first line defines a domain list called <emphasis>local_domains</emphasis>; this is used
8552 later in the configuration to identify domains that are to be delivered
8553 on the local host.
8554 </para>
8555 <para>
8556 <indexterm role="concept">
8557 <primary>@ in a domain list</primary>
8558 </indexterm>
8559 There is just one item in this list, the string <quote>@</quote>. This is a special form
8560 of entry which means <quote>the name of the local host</quote>. Thus, if the local host is
8561 called <emphasis>a.host.example</emphasis>, mail to <emphasis>any.user@a.host.example</emphasis> is expected to
8562 be delivered locally. Because the local host&#x2019;s name is referenced indirectly,
8563 the same configuration file can be used on different hosts.
8564 </para>
8565 <para>
8566 The second line defines a domain list called <emphasis>relay_to_domains</emphasis>, but the
8567 list itself is empty. Later in the configuration we will come to the part that
8568 controls mail relaying through the local host; it allows relaying to any
8569 domains in this list. By default, therefore, no relaying on the basis of a mail
8570 domain is permitted.
8571 </para>
8572 <para>
8573 The third line defines a host list called <emphasis>relay_from_hosts</emphasis>. This list is
8574 used later in the configuration to permit relaying from any host or IP address
8575 that matches the list. The default contains just the IP address of the IPv4
8576 loopback interface, which means that processes on the local host are able to
8577 submit mail for relaying by sending it over TCP/IP to that interface. No other
8578 hosts are permitted to submit messages for relaying.
8579 </para>
8580 <para>
8581 Just to be sure there&#x2019;s no misunderstanding: at this point in the configuration
8582 we aren&#x2019;t actually setting up any controls. We are just defining some domains
8583 and hosts that will be used in the controls that are specified later.
8584 </para>
8585 <para>
8586 The next two configuration lines are genuine option settings:
8587 </para>
8588 <literallayout class="monospaced">
8589 acl_smtp_rcpt = acl_check_rcpt
8590 acl_smtp_data = acl_check_data
8591 </literallayout>
8592 <para>
8593 These options specify <emphasis>Access Control Lists</emphasis> (ACLs) that are to be used
8594 during an incoming SMTP session for every recipient of a message (every RCPT
8595 command), and after the contents of the message have been received,
8596 respectively. The names of the lists are <emphasis>acl_check_rcpt</emphasis> and
8597 <emphasis>acl_check_data</emphasis>, and we will come to their definitions below, in the ACL
8598 section of the configuration. The RCPT ACL controls which recipients are
8599 accepted for an incoming message &ndash; if a configuration does not provide an ACL
8600 to check recipients, no SMTP mail can be accepted. The DATA ACL allows the
8601 contents of a message to be checked.
8602 </para>
8603 <para>
8604 Two commented-out option settings are next:
8605 </para>
8606 <literallayout class="monospaced">
8607 # av_scanner = clamd:/tmp/clamd
8608 # spamd_address = 127.0.0.1 783
8609 </literallayout>
8610 <para>
8611 These are example settings that can be used when Exim is compiled with the
8612 content-scanning extension. The first specifies the interface to the virus
8613 scanner, and the second specifies the interface to SpamAssassin. Further
8614 details are given in chapter <xref linkend="CHAPexiscan"/>.
8615 </para>
8616 <para>
8617 Three more commented-out option settings follow:
8618 </para>
8619 <literallayout class="monospaced">
8620 # tls_advertise_hosts = *
8621 # tls_certificate = /etc/ssl/exim.crt
8622 # tls_privatekey = /etc/ssl/exim.pem
8623 </literallayout>
8624 <para>
8625 These are example settings that can be used when Exim is compiled with
8626 support for TLS (aka SSL) as described in section <xref linkend="SECTinctlsssl"/>. The
8627 first one specifies the list of clients that are allowed to use TLS when
8628 connecting to this server; in this case, the wildcard means all clients. The
8629 other options specify where Exim should find its TLS certificate and private
8630 key, which together prove the server&#x2019;s identity to any clients that connect.
8631 More details are given in chapter <xref linkend="CHAPTLS"/>.
8632 </para>
8633 <para>
8634 Another two commented-out option settings follow:
8635 </para>
8636 <literallayout class="monospaced">
8637 # daemon_smtp_ports = 25 : 465 : 587
8638 # tls_on_connect_ports = 465
8639 </literallayout>
8640 <para>
8641 <indexterm role="concept">
8642 <primary>port</primary>
8643 <secondary>465 and 587</secondary>
8644 </indexterm>
8645 <indexterm role="concept">
8646 <primary>port</primary>
8647 <secondary>for message submission</secondary>
8648 </indexterm>
8649 <indexterm role="concept">
8650 <primary>message</primary>
8651 <secondary>submission, ports for</secondary>
8652 </indexterm>
8653 <indexterm role="concept">
8654 <primary>submissions protocol</primary>
8655 </indexterm>
8656 <indexterm role="concept">
8657 <primary>smtps protocol</primary>
8658 </indexterm>
8659 <indexterm role="concept">
8660 <primary>ssmtp protocol</primary>
8661 </indexterm>
8662 <indexterm role="concept">
8663 <primary>SMTP</primary>
8664 <secondary>submissions protocol</secondary>
8665 </indexterm>
8666 <indexterm role="concept">
8667 <primary>SMTP</primary>
8668 <secondary>ssmtp protocol</secondary>
8669 </indexterm>
8670 <indexterm role="concept">
8671 <primary>SMTP</primary>
8672 <secondary>smtps protocol</secondary>
8673 </indexterm>
8674 These options provide better support for roaming users who wish to use this
8675 server for message submission. They are not much use unless you have turned on
8676 TLS (as described in the previous paragraph) and authentication (about which
8677 more in section <xref linkend="SECTdefconfauth"/>).
8678 Mail submission from mail clients (MUAs) should be separate from inbound mail
8679 to your domain (MX delivery) for various good reasons (eg, ability to impose
8680 much saner TLS protocol and ciphersuite requirements without unintended
8681 consequences).
8682 RFC 6409 (previously 4409) specifies use of port 587 for SMTP Submission,
8683 which uses STARTTLS, so this is the <quote>submission</quote> port.
8684 RFC 8314 specifies use of port 465 as the <quote>submissions</quote> protocol,
8685 which should be used in preference to 587.
8686 You should also consider deploying SRV records to help clients find
8687 these ports.
8688 Older names for <quote>submissions</quote> are <quote>smtps</quote> and <quote>ssmtp</quote>.
8689 </para>
8690 <para>
8691 Two more commented-out options settings follow:
8692 </para>
8693 <literallayout class="monospaced">
8694 # qualify_domain =
8695 # qualify_recipient =
8696 </literallayout>
8697 <para>
8698 The first of these specifies a domain that Exim uses when it constructs a
8699 complete email address from a local login name. This is often needed when Exim
8700 receives a message from a local process. If you do not set <option>qualify_domain</option>,
8701 the value of <option>primary_hostname</option> is used. If you set both of these options,
8702 you can have different qualification domains for sender and recipient
8703 addresses. If you set only the first one, its value is used in both cases.
8704 </para>
8705 <para>
8706 <indexterm role="concept">
8707 <primary>domain literal</primary>
8708 <secondary>recognizing format</secondary>
8709 </indexterm>
8710 The following line must be uncommented if you want Exim to recognize
8711 addresses of the form <emphasis>user@[10.11.12.13]</emphasis> that is, with a <quote>domain literal</quote>
8712 (an IP address within square brackets) instead of a named domain.
8713 </para>
8714 <literallayout class="monospaced">
8715 # allow_domain_literals
8716 </literallayout>
8717 <para>
8718 The RFCs still require this form, but many people think that in the modern
8719 Internet it makes little sense to permit mail to be sent to specific hosts by
8720 quoting their IP addresses. This ancient format has been used by people who
8721 try to abuse hosts by using them for unwanted relaying. However, some
8722 people believe there are circumstances (for example, messages addressed to
8723 <emphasis>postmaster</emphasis>) where domain literals are still useful.
8724 </para>
8725 <para>
8726 The next configuration line is a kind of trigger guard:
8727 </para>
8728 <literallayout class="monospaced">
8729 never_users = root
8730 </literallayout>
8731 <para>
8732 It specifies that no delivery must ever be run as the root user. The normal
8733 convention is to set up <emphasis>root</emphasis> as an alias for the system administrator. This
8734 setting is a guard against slips in the configuration.
8735 The list of users specified by <option>never_users</option> is not, however, the complete
8736 list; the build-time configuration in <filename>Local/Makefile</filename> has an option called
8737 FIXED_NEVER_USERS specifying a list that cannot be overridden. The
8738 contents of <option>never_users</option> are added to this list. By default
8739 FIXED_NEVER_USERS also specifies root.
8740 </para>
8741 <para>
8742 When a remote host connects to Exim in order to send mail, the only information
8743 Exim has about the host&#x2019;s identity is its IP address. The next configuration
8744 line,
8745 </para>
8746 <literallayout class="monospaced">
8747 host_lookup = *
8748 </literallayout>
8749 <para>
8750 specifies that Exim should do a reverse DNS lookup on all incoming connections,
8751 in order to get a host name. This improves the quality of the logging
8752 information, but if you feel it is too expensive, you can remove it entirely,
8753 or restrict the lookup to hosts on <quote>nearby</quote> networks.
8754 Note that it is not always possible to find a host name from an IP address,
8755 because not all DNS reverse zones are maintained, and sometimes DNS servers are
8756 unreachable.
8757 </para>
8758 <para>
8759 The next two lines are concerned with <emphasis>ident</emphasis> callbacks, as defined by RFC
8760 1413 (hence their names):
8761 </para>
8762 <literallayout class="monospaced">
8763 rfc1413_hosts = *
8764 rfc1413_query_timeout = 0s
8765 </literallayout>
8766 <para>
8767 These settings cause Exim to avoid ident callbacks for all incoming SMTP calls.
8768 Few hosts offer RFC1413 service these days; calls have to be
8769 terminated by a timeout and this needlessly delays the startup
8770 of an incoming SMTP connection.
8771 If you have hosts for which you trust RFC1413 and need this
8772 information, you can change this.
8773 </para>
8774 <para>
8775 This line enables an efficiency SMTP option.  It is negotiated by clients
8776 and not expected to cause problems but can be disabled if needed.
8777 </para>
8778 <literallayout class="monospaced">
8779 prdr_enable = true
8780 </literallayout>
8781 <para>
8782 When Exim receives messages over SMTP connections, it expects all addresses to
8783 be fully qualified with a domain, as required by the SMTP definition. However,
8784 if you are running a server to which simple clients submit messages, you may
8785 find that they send unqualified addresses. The two commented-out options:
8786 </para>
8787 <literallayout class="monospaced">
8788 # sender_unqualified_hosts =
8789 # recipient_unqualified_hosts =
8790 </literallayout>
8791 <para>
8792 show how you can specify hosts that are permitted to send unqualified sender
8793 and recipient addresses, respectively.
8794 </para>
8795 <para>
8796 The <option>log_selector</option> option is used to increase the detail of logging
8797 over the default:
8798 </para>
8799 <literallayout class="monospaced">
8800 log_selector = +smtp_protocol_error +smtp_syntax_error \
8801                +tls_certificate_verified
8802 </literallayout>
8803 <para>
8804 The <option>percent_hack_domains</option> option is also commented out:
8805 </para>
8806 <literallayout class="monospaced">
8807 # percent_hack_domains =
8808 </literallayout>
8809 <para>
8810 It provides a list of domains for which the <quote>percent hack</quote> is to operate.
8811 This is an almost obsolete form of explicit email routing. If you do not know
8812 anything about it, you can safely ignore this topic.
8813 </para>
8814 <para>
8815 The next two settings in the main part of the default configuration are
8816 concerned with messages that have been <quote>frozen</quote> on Exim&#x2019;s queue. When a
8817 message is frozen, Exim no longer continues to try to deliver it. Freezing
8818 occurs when a bounce message encounters a permanent failure because the sender
8819 address of the original message that caused the bounce is invalid, so the
8820 bounce cannot be delivered. This is probably the most common case, but there
8821 are also other conditions that cause freezing, and frozen messages are not
8822 always bounce messages.
8823 </para>
8824 <literallayout class="monospaced">
8825 ignore_bounce_errors_after = 2d
8826 timeout_frozen_after = 7d
8827 </literallayout>
8828 <para>
8829 The first of these options specifies that failing bounce messages are to be
8830 discarded after 2 days in the queue. The second specifies that any frozen
8831 message (whether a bounce message or not) is to be timed out (and discarded)
8832 after a week. In this configuration, the first setting ensures that no failing
8833 bounce message ever lasts a week.
8834 </para>
8835 <para>
8836 Exim queues it&#x2019;s messages in a spool directory. If you expect to have
8837 large queues, you may consider using this option. It splits the spool
8838 directory into subdirectories to avoid file system degradation from
8839 many files in a single directory, resulting in better performance.
8840 Manual manipulation of queued messages becomes more complex (though fortunately
8841 not often needed).
8842 </para>
8843 <literallayout class="monospaced">
8844 # split_spool_directory = true
8845 </literallayout>
8846 <para>
8847 In an ideal world everybody follows the standards. For non-ASCII
8848 messages RFC 2047 is a standard, allowing a maximum line length of 76
8849 characters. Exim adheres that standard and won&#x2019;t process messages which
8850 violate this standard. (Even ${rfc2047:...} expansions will fail.)
8851 In particular, the Exim maintainers have had multiple reports of
8852 problems from Russian administrators of issues until they disable this
8853 check, because of some popular, yet buggy, mail composition software.
8854 </para>
8855 <literallayout class="monospaced">
8856 # check_rfc2047_length = false
8857 </literallayout>
8858 <para>
8859 If you need to be strictly RFC compliant you may wish to disable the
8860 8BITMIME advertisement. Use this, if you exchange mails with systems
8861 that are not 8-bit clean.
8862 </para>
8863 <literallayout class="monospaced">
8864 # accept_8bitmime = false
8865 </literallayout>
8866 <para>
8867 Libraries you use may depend on specific environment settings.  This
8868 imposes a security risk (e.g. PATH). There are two lists:
8869 <option>keep_environment</option> for the variables to import as they are, and
8870 <option>add_environment</option> for variables we want to set to a fixed value.
8871 Note that TZ is handled separately, by the $%timezone%$ runtime
8872 option and by the TIMEZONE_DEFAULT buildtime option.
8873 </para>
8874 <literallayout class="monospaced">
8875 # keep_environment = ^LDAP
8876 # add_environment = PATH=/usr/bin::/bin
8877 </literallayout>
8878 </section>
8879 <section id="SECID54">
8880 <title>ACL configuration</title>
8881 <para>
8882 <indexterm role="concept">
8883 <primary>default</primary>
8884 <secondary>ACLs</secondary>
8885 </indexterm>
8886 <indexterm role="concept">
8887 <primary>access control lists (ACLs)</primary>
8888 <secondary>default configuration</secondary>
8889 </indexterm>
8890 In the default configuration, the ACL section follows the main configuration.
8891 It starts with the line
8892 </para>
8893 <literallayout class="monospaced">
8894 begin acl
8895 </literallayout>
8896 <para>
8897 and it contains the definitions of two ACLs, called <emphasis>acl_check_rcpt</emphasis> and
8898 <emphasis>acl_check_data</emphasis>, that were referenced in the settings of <option>acl_smtp_rcpt</option>
8899 and <option>acl_smtp_data</option> above.
8900 </para>
8901 <para>
8902 <indexterm role="concept">
8903 <primary>RCPT</primary>
8904 <secondary>ACL for</secondary>
8905 </indexterm>
8906 The first ACL is used for every RCPT command in an incoming SMTP message. Each
8907 RCPT command specifies one of the message&#x2019;s recipients. The ACL statements
8908 are considered in order, until the recipient address is either accepted or
8909 rejected. The RCPT command is then accepted or rejected, according to the
8910 result of the ACL processing.
8911 </para>
8912 <literallayout class="monospaced">
8913 acl_check_rcpt:
8914 </literallayout>
8915 <para>
8916 This line, consisting of a name terminated by a colon, marks the start of the
8917 ACL, and names it.
8918 </para>
8919 <literallayout class="monospaced">
8920 accept  hosts = :
8921 </literallayout>
8922 <para>
8923 This ACL statement accepts the recipient if the sending host matches the list.
8924 But what does that strange list mean? It doesn&#x2019;t actually contain any host
8925 names or IP addresses. The presence of the colon puts an empty item in the
8926 list; Exim matches this only if the incoming message did not come from a remote
8927 host, because in that case, the remote hostname is empty. The colon is
8928 important. Without it, the list itself is empty, and can never match anything.
8929 </para>
8930 <para>
8931 What this statement is doing is to accept unconditionally all recipients in
8932 messages that are submitted by SMTP from local processes using the standard
8933 input and output (that is, not using TCP/IP). A number of MUAs operate in this
8934 manner.
8935 </para>
8936 <literallayout class="monospaced">
8937 deny    message       = Restricted characters in address
8938         domains       = +local_domains
8939         local_parts   = ^[.] : ^.*[@%!/|]
8940
8941 deny    message       = Restricted characters in address
8942         domains       = !+local_domains
8943         local_parts   = ^[./|] : ^.*[@%!] : ^.*/\\.\\./
8944 </literallayout>
8945 <para>
8946 These statements are concerned with local parts that contain any of the
8947 characters <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>, <quote>|</quote>, or dots in unusual places.
8948 Although these characters are entirely legal in local parts (in the case of
8949 <quote>@</quote> and leading dots, only if correctly quoted), they do not commonly occur
8950 in Internet mail addresses.
8951 </para>
8952 <para>
8953 The first three have in the past been associated with explicitly routed
8954 addresses (percent is still sometimes used &ndash; see the <option>percent_hack_domains</option>
8955 option). Addresses containing these characters are regularly tried by spammers
8956 in an attempt to bypass relaying restrictions, and also by open relay testing
8957 programs. Unless you really need them it is safest to reject these characters
8958 at this early stage. This configuration is heavy-handed in rejecting these
8959 characters for all messages it accepts from remote hosts. This is a deliberate
8960 policy of being as safe as possible.
8961 </para>
8962 <para>
8963 The first rule above is stricter, and is applied to messages that are addressed
8964 to one of the local domains handled by this host. This is implemented by the
8965 first condition, which restricts it to domains that are listed in the
8966 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
8967 reference to a named list. In this configuration, there is just one domain in
8968 <emphasis>local_domains</emphasis>, but in general there may be many.
8969 </para>
8970 <para>
8971 The second condition on the first statement uses two regular expressions to
8972 block local parts that begin with a dot or contain <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>,
8973 or <quote>|</quote>. If you have local accounts that include these characters, you will
8974 have to modify this rule.
8975 </para>
8976 <para>
8977 Empty components (two dots in a row) are not valid in RFC 2822, but Exim
8978 allows them because they have been encountered in practice. (Consider the
8979 common convention of local parts constructed as
8980 <quote><emphasis>first-initial.second-initial.family-name</emphasis></quote> when applied to someone like
8981 the author of Exim, who has no second initial.) However, a local part starting
8982 with a dot or containing <quote>/../</quote> can cause trouble if it is used as part of a
8983 filename (for example, for a mailing list). This is also true for local parts
8984 that contain slashes. A pipe symbol can also be troublesome if the local part
8985 is incorporated unthinkingly into a shell command line.
8986 </para>
8987 <para>
8988 The second rule above applies to all other domains, and is less strict. This
8989 allows your own users to send outgoing messages to sites that use slashes
8990 and vertical bars in their local parts. It blocks local parts that begin
8991 with a dot, slash, or vertical bar, but allows these characters within the
8992 local part. However, the sequence <quote>/../</quote> is barred. The use of <quote>@</quote>, <quote>%</quote>,
8993 and <quote>!</quote> is blocked, as before. The motivation here is to prevent your users
8994 (or your users&#x2019; viruses) from mounting certain kinds of attack on remote sites.
8995 </para>
8996 <literallayout class="monospaced">
8997 accept  local_parts   = postmaster
8998         domains       = +local_domains
8999 </literallayout>
9000 <para>
9001 This statement, which has two conditions, accepts an incoming address if the
9002 local part is <emphasis>postmaster</emphasis> and the domain is one of those listed in the
9003 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
9004 reference to a named list. In this configuration, there is just one domain in
9005 <emphasis>local_domains</emphasis>, but in general there may be many.
9006 </para>
9007 <para>
9008 The presence of this statement means that mail to postmaster is never blocked
9009 by any of the subsequent tests. This can be helpful while sorting out problems
9010 in cases where the subsequent tests are incorrectly denying access.
9011 </para>
9012 <literallayout class="monospaced">
9013 require verify        = sender
9014 </literallayout>
9015 <para>
9016 This statement requires the sender address to be verified before any subsequent
9017 ACL statement can be used. If verification fails, the incoming recipient
9018 address is refused. Verification consists of trying to route the address, to
9019 see if a bounce message could be delivered to it. In the case of remote
9020 addresses, basic verification checks only the domain, but <emphasis>callouts</emphasis> can be
9021 used for more verification if required. Section <xref linkend="SECTaddressverification"/>
9022 discusses the details of address verification.
9023 </para>
9024 <literallayout class="monospaced">
9025 accept  hosts         = +relay_from_hosts
9026         control       = submission
9027 </literallayout>
9028 <para>
9029 This statement accepts the address if the message is coming from one of the
9030 hosts that are defined as being allowed to relay through this host. Recipient
9031 verification is omitted here, because in many cases the clients are dumb MUAs
9032 that do not cope well with SMTP error responses. For the same reason, the
9033 second line specifies <quote>submission mode</quote> for messages that are accepted. This
9034 is described in detail in section <xref linkend="SECTsubmodnon"/>; it causes Exim to fix
9035 messages that are deficient in some way, for example, because they lack a
9036 <emphasis>Date:</emphasis> header line. If you are actually relaying out from MTAs, you should
9037 probably add recipient verification here, and disable submission mode.
9038 </para>
9039 <literallayout class="monospaced">
9040 accept  authenticated = *
9041         control       = submission
9042 </literallayout>
9043 <para>
9044 This statement accepts the address if the client host has authenticated itself.
9045 Submission mode is again specified, on the grounds that such messages are most
9046 likely to come from MUAs. The default configuration does not define any
9047 authenticators, though it does include some nearly complete commented-out
9048 examples described in <xref linkend="SECTdefconfauth"/>. This means that no client can in
9049 fact authenticate until you complete the authenticator definitions.
9050 </para>
9051 <literallayout class="monospaced">
9052 require message = relay not permitted
9053         domains = +local_domains : +relay_to_domains
9054 </literallayout>
9055 <para>
9056 This statement rejects the address if its domain is neither a local domain nor
9057 one of the domains for which this host is a relay.
9058 </para>
9059 <literallayout class="monospaced">
9060 require verify = recipient
9061 </literallayout>
9062 <para>
9063 This statement requires the recipient address to be verified; if verification
9064 fails, the address is rejected.
9065 </para>
9066 <literallayout class="monospaced">
9067 # deny    message     = rejected because $sender_host_address \
9068 #                       is in a black list at $dnslist_domain\n\
9069 #                       $dnslist_text
9070 #         dnslists    = black.list.example
9071 #
9072 # warn    dnslists    = black.list.example
9073 #         add_header  = X-Warning: $sender_host_address is in \
9074 #                       a black list at $dnslist_domain
9075 #         log_message = found in $dnslist_domain
9076 </literallayout>
9077 <para>
9078 These commented-out lines are examples of how you could configure Exim to check
9079 sending hosts against a DNS black list. The first statement rejects messages
9080 from blacklisted hosts, whereas the second just inserts a warning header
9081 line.
9082 </para>
9083 <literallayout class="monospaced">
9084 # require verify = csa
9085 </literallayout>
9086 <para>
9087 This commented-out line is an example of how you could turn on client SMTP
9088 authorization (CSA) checking. Such checks do DNS lookups for special SRV
9089 records.
9090 </para>
9091 <literallayout class="monospaced">
9092 accept
9093 </literallayout>
9094 <para>
9095 The final statement in the first ACL unconditionally accepts any recipient
9096 address that has successfully passed all the previous tests.
9097 </para>
9098 <literallayout class="monospaced">
9099 acl_check_data:
9100 </literallayout>
9101 <para>
9102 This line marks the start of the second ACL, and names it. Most of the contents
9103 of this ACL are commented out:
9104 </para>
9105 <literallayout class="monospaced">
9106 # deny    malware   = *
9107 #         message   = This message contains a virus \
9108 #                     ($malware_name).
9109 </literallayout>
9110 <para>
9111 These lines are examples of how to arrange for messages to be scanned for
9112 viruses when Exim has been compiled with the content-scanning extension, and a
9113 suitable virus scanner is installed. If the message is found to contain a
9114 virus, it is rejected with the given custom error message.
9115 </para>
9116 <literallayout class="monospaced">
9117 # warn    spam      = nobody
9118 #         message   = X-Spam_score: $spam_score\n\
9119 #                     X-Spam_score_int: $spam_score_int\n\
9120 #                     X-Spam_bar: $spam_bar\n\
9121 #                     X-Spam_report: $spam_report
9122 </literallayout>
9123 <para>
9124 These lines are an example of how to arrange for messages to be scanned by
9125 SpamAssassin when Exim has been compiled with the content-scanning extension,
9126 and SpamAssassin has been installed. The SpamAssassin check is run with
9127 <literal>nobody</literal> as its user parameter, and the results are added to the message as a
9128 series of extra header line. In this case, the message is not rejected,
9129 whatever the spam score.
9130 </para>
9131 <literallayout class="monospaced">
9132 accept
9133 </literallayout>
9134 <para>
9135 This final line in the DATA ACL accepts the message unconditionally.
9136 </para>
9137 </section>
9138 <section id="SECID55">
9139 <title>Router configuration</title>
9140 <para>
9141 <indexterm role="concept">
9142 <primary>default</primary>
9143 <secondary>routers</secondary>
9144 </indexterm>
9145 <indexterm role="concept">
9146 <primary>routers</primary>
9147 <secondary>default</secondary>
9148 </indexterm>
9149 The router configuration comes next in the default configuration, introduced
9150 by the line
9151 </para>
9152 <literallayout class="monospaced">
9153 begin routers
9154 </literallayout>
9155 <para>
9156 Routers are the modules in Exim that make decisions about where to send
9157 messages. An address is passed to each router, in turn, until it is either
9158 accepted, or failed. This means that the order in which you define the routers
9159 matters. Each router is fully described in its own chapter later in this
9160 manual. Here we give only brief overviews.
9161 </para>
9162 <literallayout class="monospaced">
9163 # domain_literal:
9164 #   driver = ipliteral
9165 #   domains = !+local_domains
9166 #   transport = remote_smtp
9167 </literallayout>
9168 <para>
9169 <indexterm role="concept">
9170 <primary>domain literal</primary>
9171 <secondary>default router</secondary>
9172 </indexterm>
9173 This router is commented out because the majority of sites do not want to
9174 support domain literal addresses (those of the form <emphasis>user@[10.9.8.7]</emphasis>). If
9175 you uncomment this router, you also need to uncomment the setting of
9176 <option>allow_domain_literals</option> in the main part of the configuration.
9177 </para>
9178 <para>
9179 Which router is used next depends upon whether or not the ROUTER_SMARTHOST
9180 macro has been defined, per
9181 </para>
9182 <literallayout class="monospaced">
9183 .ifdef ROUTER_SMARTHOST
9184 smarthost:
9185 #...
9186 .else
9187 dnslookup:
9188 #...
9189 .endif
9190 </literallayout>
9191 <para>
9192 If ROUTER_SMARTHOST has been defined, either at the top of the file or on the
9193 command-line, then we route all non-local mail to that smarthost; otherwise, we&#x2019;ll
9194 perform DNS lookups for direct-to-MX lookup.  Any mail which is to a local domain will
9195 skip these routers because of the <option>domains</option> option.
9196 </para>
9197 <literallayout class="monospaced">
9198 smarthost:
9199   driver = manualroute
9200   domains = ! +local_domains
9201   transport = smarthost_smtp
9202   route_data = ROUTER_SMARTHOST
9203   ignore_target_hosts = &lt;; 0.0.0.0 ; 127.0.0.0/8 ; ::1
9204   no_more
9205 </literallayout>
9206 <para>
9207 This router only handles mail which is not to any local domains; this is
9208 specified by the line
9209 </para>
9210 <literallayout class="monospaced">
9211 domains = ! +local_domains
9212 </literallayout>
9213 <para>
9214 The <option>domains</option> option lists the domains to which this router applies, but the
9215 exclamation mark is a negation sign, so the router is used only for domains
9216 that are not in the domain list called <emphasis>local_domains</emphasis> (which was defined at
9217 the start of the configuration). The plus sign before <emphasis>local_domains</emphasis>
9218 indicates that it is referring to a named list. Addresses in other domains are
9219 passed on to the following routers.
9220 </para>
9221 <para>
9222 The name of the router driver is <command>manualroute</command> because we are manually
9223 specifying how mail should be routed onwards, instead of using DNS MX.
9224 While the name of this router instance is arbitrary, the <option>driver</option> option must
9225 be one of the driver modules that is in the Exim binary.
9226 </para>
9227 <para>
9228 With no pre-conditions other than <option>domains</option>, all mail for non-local domains
9229 will be handled by this router, and the <option>no_more</option> setting will ensure that no
9230 other routers will be used for messages matching the pre-conditions.  See
9231 <xref linkend="SECTrouprecon"/> for more on how the pre-conditions apply.  For messages which
9232 are handled by this router, we provide a hostname to deliver to in <option>route_data</option>
9233 and the macro supplies the value; the address is then queued for the
9234 <command>smarthost_smtp</command> transport.
9235 </para>
9236 <literallayout class="monospaced">
9237 dnslookup:
9238   driver = dnslookup
9239   domains = ! +local_domains
9240   transport = remote_smtp
9241   ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
9242   no_more
9243 </literallayout>
9244 <para>
9245 The <option>domains</option> option behaves as per smarthost, above.
9246 </para>
9247 <para>
9248 The name of the router driver is <command>dnslookup</command>,
9249 and is specified by the <option>driver</option> option. Do not be confused by the fact that
9250 the name of this router instance is the same as the name of the driver. The
9251 instance name is arbitrary, but the name set in the <option>driver</option> option must be
9252 one of the driver modules that is in the Exim binary.
9253 </para>
9254 <para>
9255 The <command>dnslookup</command> router routes addresses by looking up their domains in the
9256 DNS in order to obtain a list of hosts to which the address is routed. If the
9257 router succeeds, the address is queued for the <command>remote_smtp</command> transport, as
9258 specified by the <option>transport</option> option. If the router does not find the domain
9259 in the DNS, no further routers are tried because of the <option>no_more</option> setting, so
9260 the address fails and is bounced.
9261 </para>
9262 <para>
9263 The <option>ignore_target_hosts</option> option specifies a list of IP addresses that are to
9264 be entirely ignored. This option is present because a number of cases have been
9265 encountered where MX records in the DNS point to host names
9266 whose IP addresses are 0.0.0.0 or are in the 127 subnet (typically 127.0.0.1).
9267 Completely ignoring these IP addresses causes Exim to fail to route the
9268 email address, so it bounces. Otherwise, Exim would log a routing problem, and
9269 continue to try to deliver the message periodically until the address timed
9270 out.
9271 </para>
9272 <literallayout class="monospaced">
9273 system_aliases:
9274   driver = redirect
9275   allow_fail
9276   allow_defer
9277   data = ${lookup{$local_part}lsearch{/etc/aliases}}
9278 # user = exim
9279   file_transport = address_file
9280   pipe_transport = address_pipe
9281 </literallayout>
9282 <para>
9283 Control reaches this and subsequent routers only for addresses in the local
9284 domains. This router checks to see whether the local part is defined as an
9285 alias in the <filename>/etc/aliases</filename> file, and if so, redirects it according to the
9286 data that it looks up from that file. If no data is found for the local part,
9287 the value of the <option>data</option> option is empty, causing the address to be passed to
9288 the next router.
9289 </para>
9290 <para>
9291 <filename>/etc/aliases</filename> is a conventional name for the system aliases file that is
9292 often used. That is why it is referenced by from the default configuration
9293 file. However, you can change this by setting SYSTEM_ALIASES_FILE in
9294 <filename>Local/Makefile</filename> before building Exim.
9295 </para>
9296 <literallayout class="monospaced">
9297 userforward:
9298   driver = redirect
9299   check_local_user
9300 # local_part_suffix = +* : -*
9301 # local_part_suffix_optional
9302   file = $home/.forward
9303 # allow_filter
9304   no_verify
9305   no_expn
9306   check_ancestor
9307   file_transport = address_file
9308   pipe_transport = address_pipe
9309   reply_transport = address_reply
9310 </literallayout>
9311 <para>
9312 This is the most complicated router in the default configuration. It is another
9313 redirection router, but this time it is looking for forwarding data set up by
9314 individual users. The <option>check_local_user</option> setting specifies a check that the
9315 local part of the address is the login name of a local user. If it is not, the
9316 router is skipped. The two commented options that follow <option>check_local_user</option>,
9317 namely:
9318 </para>
9319 <literallayout class="monospaced">
9320 # local_part_suffix = +* : -*
9321 # local_part_suffix_optional
9322 </literallayout>
9323 <para>
9324 <indexterm role="variable">
9325 <primary><varname>$local_part_suffix</varname></primary>
9326 </indexterm>
9327 show how you can specify the recognition of local part suffixes. If the first
9328 is uncommented, a suffix beginning with either a plus or a minus sign, followed
9329 by any sequence of characters, is removed from the local part and placed in the
9330 variable <varname>$local_part_suffix</varname>. The second suffix option specifies that the
9331 presence of a suffix in the local part is optional. When a suffix is present,
9332 the check for a local login uses the local part with the suffix removed.
9333 </para>
9334 <para>
9335 When a local user account is found, the file called <filename>.forward</filename> in the user&#x2019;s
9336 home directory is consulted. If it does not exist, or is empty, the router
9337 declines. Otherwise, the contents of <filename>.forward</filename> are interpreted as
9338 redirection data (see chapter <xref linkend="CHAPredirect"/> for more details).
9339 </para>
9340 <para>
9341 <indexterm role="concept">
9342 <primary>Sieve filter</primary>
9343 <secondary>enabling in default router</secondary>
9344 </indexterm>
9345 Traditional <filename>.forward</filename> files contain just a list of addresses, pipes, or
9346 files. Exim supports this by default. However, if <option>allow_filter</option> is set (it
9347 is commented out by default), the contents of the file are interpreted as a set
9348 of Exim or Sieve filtering instructions, provided the file begins with <quote>#Exim
9349 filter</quote> or <quote>#Sieve filter</quote>, respectively. User filtering is discussed in the
9350 separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>.
9351 </para>
9352 <para>
9353 The <option>no_verify</option> and <option>no_expn</option> options mean that this router is skipped when
9354 verifying addresses, or when running as a consequence of an SMTP EXPN command.
9355 There are two reasons for doing this:
9356 </para>
9357 <orderedlist numeration="arabic">
9358 <listitem>
9359 <para>
9360 Whether or not a local user has a <filename>.forward</filename> file is not really relevant when
9361 checking an address for validity; it makes sense not to waste resources doing
9362 unnecessary work.
9363 </para>
9364 </listitem>
9365 <listitem>
9366 <para>
9367 More importantly, when Exim is verifying addresses or handling an EXPN
9368 command during an SMTP session, it is running as the Exim user, not as root.
9369 The group is the Exim group, and no additional groups are set up.
9370 It may therefore not be possible for Exim to read users&#x2019; <filename>.forward</filename> files at
9371 this time.
9372 </para>
9373 </listitem>
9374 </orderedlist>
9375 <para>
9376 The setting of <option>check_ancestor</option> prevents the router from generating a new
9377 address that is the same as any previous address that was redirected. (This
9378 works round a problem concerning a bad interaction between aliasing and
9379 forwarding &ndash; see section <xref linkend="SECTredlocmai"/>).
9380 </para>
9381 <para>
9382 The final three option settings specify the transports that are to be used when
9383 forwarding generates a direct delivery to a file, or to a pipe, or sets up an
9384 auto-reply, respectively. For example, if a <filename>.forward</filename> file contains
9385 </para>
9386 <literallayout class="monospaced">
9387 a.nother@elsewhere.example, /home/spqr/archive
9388 </literallayout>
9389 <para>
9390 the delivery to <filename>/home/spqr/archive</filename> is done by running the <option>address_file</option>
9391 transport.
9392 </para>
9393 <literallayout class="monospaced">
9394 localuser:
9395   driver = accept
9396   check_local_user
9397 # local_part_suffix = +* : -*
9398 # local_part_suffix_optional
9399   transport = local_delivery
9400 </literallayout>
9401 <para>
9402 The final router sets up delivery into local mailboxes, provided that the local
9403 part is the name of a local login, by accepting the address and assigning it to
9404 the <command>local_delivery</command> transport. Otherwise, we have reached the end of the
9405 routers, so the address is bounced. The commented suffix settings fulfil the
9406 same purpose as they do for the <command>userforward</command> router.
9407 </para>
9408 </section>
9409 <section id="SECID56">
9410 <title>Transport configuration</title>
9411 <para>
9412 <indexterm role="concept">
9413 <primary>default</primary>
9414 <secondary>transports</secondary>
9415 </indexterm>
9416 <indexterm role="concept">
9417 <primary>transports</primary>
9418 <secondary>default</secondary>
9419 </indexterm>
9420 Transports define mechanisms for actually delivering messages. They operate
9421 only when referenced from routers, so the order in which they are defined does
9422 not matter. The transports section of the configuration starts with
9423 </para>
9424 <literallayout class="monospaced">
9425 begin transports
9426 </literallayout>
9427 <para>
9428 Two remote transports and four local transports are defined.
9429 </para>
9430 <literallayout class="monospaced">
9431 remote_smtp:
9432   driver = smtp
9433   message_size_limit = ${if &gt; {$max_received_linelength}{998} {1}{0}}
9434 .ifdef _HAVE_DANE
9435   dnssec_request_domains = *
9436   hosts_try_dane = *
9437 .endif
9438 .ifdef _HAVE_PRDR
9439   hosts_try_prdr = *
9440 .endif
9441 </literallayout>
9442 <para>
9443 This transport is used for delivering messages over SMTP connections.
9444 The list of remote hosts comes from the router.
9445 The <option>message_size_limit</option> usage is a hack to avoid sending on messages
9446 with over-long lines.  The built-in macro _HAVE_DANE guards configuration
9447 to try to use DNSSEC for all queries and to use DANE for delivery;
9448 see section <xref linkend="SECDANE"/> for more details.
9449 </para>
9450 <para>
9451 The <option>hosts_try_prdr</option> option enables an efficiency SMTP option.  It is
9452 negotiated between client and server and not expected to cause problems
9453 but can be disabled if needed.  The built-in macro _HAVE_PRDR guards the
9454 use of the <option>hosts_try_prdr</option> configuration option.
9455 </para>
9456 <para>
9457 The other remote transport is used when delivering to a specific smarthost
9458 with whom there must be some kind of existing relationship, instead of the
9459 usual federated system.
9460 </para>
9461 <literallayout class="monospaced">
9462 smarthost_smtp:
9463   driver = smtp
9464   message_size_limit = ${if &gt; {$max_received_linelength}{998} {1}{0}}
9465   multi_domain
9466   #
9467 .ifdef _HAVE_TLS
9468   # Comment out any of these which you have to, then file a Support
9469   # request with your smarthost provider to get things fixed:
9470   hosts_require_tls = *
9471   tls_verify_hosts = *
9472   # As long as tls_verify_hosts is enabled, this won't matter, but if you
9473   # have to comment it out then this will at least log whether you succeed
9474   # or not:
9475   tls_try_verify_hosts = *
9476   #
9477   # The SNI name should match the name which we'll expect to verify;
9478   # many mail systems don't use SNI and this doesn't matter, but if it does,
9479   # we need to send a name which the remote site will recognize.
9480   # This _should_ be the name which the smarthost operators specified as
9481   # the hostname for sending your mail to.
9482   tls_sni = ROUTER_SMARTHOST
9483   #
9484 .ifdef _HAVE_OPENSSL
9485   tls_require_ciphers = HIGH:!aNULL:@STRENGTH
9486 .endif
9487 .ifdef _HAVE_GNUTLS
9488   tls_require_ciphers = SECURE192:-VERS-SSL3.0:-VERS-TLS1.0:-VERS-TLS1.1
9489 .endif
9490 .endif
9491 .ifdef _HAVE_PRDR
9492   hosts_try_prdr = *
9493 .endif
9494 </literallayout>
9495 <para>
9496 After the same <option>message_size_limit</option> hack, we then specify that this Transport
9497 can handle messages to multiple domains in one run.  The assumption here is
9498 that you&#x2019;re routing all non-local mail to the same place and that place is
9499 happy to take all messages from you as quickly as possible.
9500 All other options depend upon built-in macros; if Exim was built without TLS support
9501 then no other options are defined.
9502 If TLS is available, then we configure "stronger than default" TLS ciphersuites
9503 and versions using the <option>tls_require_ciphers</option> option, where the value to be
9504 used depends upon the library providing TLS.
9505 Beyond that, the options adopt the stance that you should have TLS support available
9506 from your smarthost on today&#x2019;s Internet, so we turn on requiring TLS for the
9507 mail to be delivered, and requiring that the certificate be valid, and match
9508 the expected hostname.  The <option>tls_sni</option> option can be used by service providers
9509 to select an appropriate certificate to present to you and here we re-use the
9510 ROUTER_SMARTHOST macro, because that is unaffected by CNAMEs present in DNS.
9511 You want to specify the hostname which you&#x2019;ll expect to validate for, and that
9512 should not be subject to insecure tampering via DNS results.
9513 </para>
9514 <para>
9515 For the <option>hosts_try_prdr</option> option see the previous transport.
9516 </para>
9517 <para>
9518 All other options are defaulted.
9519 </para>
9520 <literallayout class="monospaced">
9521 local_delivery:
9522   driver = appendfile
9523   file = /var/mail/$local_part
9524   delivery_date_add
9525   envelope_to_add
9526   return_path_add
9527 # group = mail
9528 # mode = 0660
9529 </literallayout>
9530 <para>
9531 This <command>appendfile</command> transport is used for local delivery to user mailboxes in
9532 traditional BSD mailbox format. By default it runs under the uid and gid of the
9533 local user, which requires the sticky bit to be set on the <filename>/var/mail</filename>
9534 directory. Some systems use the alternative approach of running mail deliveries
9535 under a particular group instead of using the sticky bit. The commented options
9536 show how this can be done.
9537 </para>
9538 <para>
9539 Exim adds three headers to the message as it delivers it: <emphasis>Delivery-date:</emphasis>,
9540 <emphasis>Envelope-to:</emphasis> and <emphasis>Return-path:</emphasis>. This action is requested by the three
9541 similarly-named options above.
9542 </para>
9543 <literallayout class="monospaced">
9544 address_pipe:
9545   driver = pipe
9546   return_output
9547 </literallayout>
9548 <para>
9549 This transport is used for handling deliveries to pipes that are generated by
9550 redirection (aliasing or users&#x2019; <filename>.forward</filename> files). The <option>return_output</option>
9551 option specifies that any output on stdout or stderr generated by the pipe is to
9552 be returned to the sender.
9553 </para>
9554 <literallayout class="monospaced">
9555 address_file:
9556   driver = appendfile
9557   delivery_date_add
9558   envelope_to_add
9559   return_path_add
9560 </literallayout>
9561 <para>
9562 This transport is used for handling deliveries to files that are generated by
9563 redirection. The name of the file is not specified in this instance of
9564 <command>appendfile</command>, because it comes from the <command>redirect</command> router.
9565 </para>
9566 <literallayout class="monospaced">
9567 address_reply:
9568   driver = autoreply
9569 </literallayout>
9570 <para>
9571 This transport is used for handling automatic replies generated by users&#x2019;
9572 filter files.
9573 </para>
9574 </section>
9575 <section id="SECID57">
9576 <title>Default retry rule</title>
9577 <para>
9578 <indexterm role="concept">
9579 <primary>retry</primary>
9580 <secondary>default rule</secondary>
9581 </indexterm>
9582 <indexterm role="concept">
9583 <primary>default</primary>
9584 <secondary>retry rule</secondary>
9585 </indexterm>
9586 The retry section of the configuration file contains rules which affect the way
9587 Exim retries deliveries that cannot be completed at the first attempt. It is
9588 introduced by the line
9589 </para>
9590 <literallayout class="monospaced">
9591 begin retry
9592 </literallayout>
9593 <para>
9594 In the default configuration, there is just one rule, which applies to all
9595 errors:
9596 </para>
9597 <literallayout class="monospaced">
9598 *   *   F,2h,15m; G,16h,1h,1.5; F,4d,6h
9599 </literallayout>
9600 <para>
9601 This causes any temporarily failing address to be retried every 15 minutes for
9602 2 hours, then at intervals starting at one hour and increasing by a factor of
9603 1.5 until 16 hours have passed, then every 6 hours up to 4 days. If an address
9604 is not delivered after 4 days of temporary failure, it is bounced. The time is
9605 measured from first failure, not from the time the message was received.
9606 </para>
9607 <para>
9608 If the retry section is removed from the configuration, or is empty (that is,
9609 if no retry rules are defined), Exim will not retry deliveries. This turns
9610 temporary errors into permanent errors.
9611 </para>
9612 </section>
9613 <section id="SECID58">
9614 <title>Rewriting configuration</title>
9615 <para>
9616 The rewriting section of the configuration, introduced by
9617 </para>
9618 <literallayout class="monospaced">
9619 begin rewrite
9620 </literallayout>
9621 <para>
9622 contains rules for rewriting addresses in messages as they arrive. There are no
9623 rewriting rules in the default configuration file.
9624 </para>
9625 </section>
9626 <section id="SECTdefconfauth">
9627 <title>Authenticators configuration</title>
9628 <para>
9629 <indexterm role="concept">
9630 <primary>AUTH</primary>
9631 <secondary>configuration</secondary>
9632 </indexterm>
9633 The authenticators section of the configuration, introduced by
9634 </para>
9635 <literallayout class="monospaced">
9636 begin authenticators
9637 </literallayout>
9638 <para>
9639 defines mechanisms for the use of the SMTP AUTH command. The default
9640 configuration file contains two commented-out example authenticators
9641 which support plaintext username/password authentication using the
9642 standard PLAIN mechanism and the traditional but non-standard LOGIN
9643 mechanism, with Exim acting as the server. PLAIN and LOGIN are enough
9644 to support most MUA software.
9645 </para>
9646 <para>
9647 The example PLAIN authenticator looks like this:
9648 </para>
9649 <literallayout class="monospaced">
9650 #PLAIN:
9651 #  driver                  = plaintext
9652 #  server_set_id           = $auth2
9653 #  server_prompts          = :
9654 #  server_condition        = Authentication is not yet configured
9655 #  server_advertise_condition = ${if def:tls_in_cipher }
9656 </literallayout>
9657 <para>
9658 And the example LOGIN authenticator looks like this:
9659 </para>
9660 <literallayout class="monospaced">
9661 #LOGIN:
9662 #  driver                  = plaintext
9663 #  server_set_id           = $auth1
9664 #  server_prompts          = &lt;| Username: | Password:
9665 #  server_condition        = Authentication is not yet configured
9666 #  server_advertise_condition = ${if def:tls_in_cipher }
9667 </literallayout>
9668 <para>
9669 The <option>server_set_id</option> option makes Exim remember the authenticated username
9670 in <varname>$authenticated_id</varname>, which can be used later in ACLs or routers. The
9671 <option>server_prompts</option> option configures the <command>plaintext</command> authenticator so
9672 that it implements the details of the specific authentication mechanism,
9673 i.e. PLAIN or LOGIN. The <option>server_advertise_condition</option> setting controls
9674 when Exim offers authentication to clients; in the examples, this is only
9675 when TLS or SSL has been started, so to enable the authenticators you also
9676 need to add support for TLS as described in section <xref linkend="SECTdefconfmain"/>.
9677 </para>
9678 <para>
9679 The <option>server_condition</option> setting defines how to verify that the username and
9680 password are correct. In the examples it just produces an error message.
9681 To make the authenticators work, you can use a string expansion
9682 expression like one of the examples in chapter <xref linkend="CHAPplaintext"/>.
9683 </para>
9684 <para>
9685 Beware that the sequence of the parameters to PLAIN and LOGIN differ; the
9686 usercode and password are in different positions.
9687 Chapter <xref linkend="CHAPplaintext"/> covers both.
9688 </para>
9689 <para>
9690 <indexterm role="concept" startref="IIDconfiwal" class="endofrange"/>
9691 </para>
9692 </section>
9693 </chapter>
9694
9695 <chapter id="CHAPregexp">
9696 <title>Regular expressions</title>
9697 <para>
9698 <indexterm role="concept">
9699 <primary>regular expressions</primary>
9700 <secondary>library</secondary>
9701 </indexterm>
9702 <indexterm role="concept">
9703 <primary>PCRE</primary>
9704 </indexterm>
9705 Exim supports the use of regular expressions in many of its options. It
9706 uses the PCRE regular expression library; this provides regular expression
9707 matching that is compatible with Perl 5. The syntax and semantics of
9708 regular expressions is discussed in
9709 online Perl manpages, in
9710 many Perl reference books, and also in
9711 Jeffrey Friedl&#x2019;s <emphasis>Mastering Regular Expressions</emphasis>, which is published by
9712 O&#x2019;Reilly (see <emphasis role="bold"><ulink url="http://www.oreilly.com/catalog/regex2/">http://www.oreilly.com/catalog/regex2/</ulink></emphasis>).
9713 </para>
9714 <para>
9715 The documentation for the syntax and semantics of the regular expressions that
9716 are supported by PCRE is included in the PCRE distribution, and no further
9717 description is included here. The PCRE functions are called from Exim using
9718 the default option settings (that is, with no PCRE options set), except that
9719 the PCRE_CASELESS option is set when the matching is required to be
9720 case-insensitive.
9721 </para>
9722 <para>
9723 In most cases, when a regular expression is required in an Exim configuration,
9724 it has to start with a circumflex, in order to distinguish it from plain text
9725 or an <quote>ends with</quote> wildcard. In this example of a configuration setting, the
9726 second item in the colon-separated list is a regular expression.
9727 </para>
9728 <literallayout class="monospaced">
9729 domains = a.b.c : ^\\d{3} : *.y.z : ...
9730 </literallayout>
9731 <para>
9732 The doubling of the backslash is required because of string expansion that
9733 precedes interpretation &ndash; see section <xref linkend="SECTlittext"/> for more discussion
9734 of this issue, and a way of avoiding the need for doubling backslashes. The
9735 regular expression that is eventually used in this example contains just one
9736 backslash. The circumflex is included in the regular expression, and has the
9737 normal effect of <quote>anchoring</quote> it to the start of the string that is being
9738 matched.
9739 </para>
9740 <para>
9741 There are, however, two cases where a circumflex is not required for the
9742 recognition of a regular expression: these are the <option>match</option> condition in a
9743 string expansion, and the <option>matches</option> condition in an Exim filter file. In
9744 these cases, the relevant string is always treated as a regular expression; if
9745 it does not start with a circumflex, the expression is not anchored, and can
9746 match anywhere in the subject string.
9747 </para>
9748 <para>
9749 In all cases, if you want a regular expression to match at the end of a string,
9750 you must code the $ metacharacter to indicate this. For example:
9751 </para>
9752 <literallayout class="monospaced">
9753 domains = ^\\d{3}\\.example
9754 </literallayout>
9755 <para>
9756 matches the domain <emphasis>123.example</emphasis>, but it also matches <emphasis>123.example.com</emphasis>.
9757 You need to use:
9758 </para>
9759 <literallayout class="monospaced">
9760 domains = ^\\d{3}\\.example\$
9761 </literallayout>
9762 <para>
9763 if you want <emphasis>example</emphasis> to be the top-level domain. The backslash before the
9764 $ is needed because string expansion also interprets dollar characters.
9765 </para>
9766 </chapter>
9767
9768 <chapter id="CHAPfdlookup">
9769 <title>File and database lookups</title>
9770 <para>
9771 <indexterm role="concept" id="IIDfidalo1" class="startofrange">
9772 <primary>file</primary>
9773 <secondary>lookups</secondary>
9774 </indexterm>
9775 <indexterm role="concept" id="IIDfidalo2" class="startofrange">
9776 <primary>database</primary>
9777 <secondary>lookups</secondary>
9778 </indexterm>
9779 <indexterm role="concept">
9780 <primary>lookup</primary>
9781 <secondary>description of</secondary>
9782 </indexterm>
9783 Exim can be configured to look up data in files or databases as it processes
9784 messages. Two different kinds of syntax are used:
9785 </para>
9786 <orderedlist numeration="arabic">
9787 <listitem>
9788 <para>
9789 A string that is to be expanded may contain explicit lookup requests. These
9790 cause parts of the string to be replaced by data that is obtained from the
9791 lookup. Lookups of this type are conditional expansion items. Different results
9792 can be defined for the cases of lookup success and failure. See chapter
9793 <xref linkend="CHAPexpand"/>, where string expansions are described in detail.
9794 The key for the lookup is specified as part of the string expansion.
9795 </para>
9796 </listitem>
9797 <listitem>
9798 <para>
9799 Lists of domains, hosts, and email addresses can contain lookup requests as a
9800 way of avoiding excessively long linear lists. In this case, the data that is
9801 returned by the lookup is often (but not always) discarded; whether the lookup
9802 succeeds or fails is what really counts. These kinds of list are described in
9803 chapter <xref linkend="CHAPdomhosaddlists"/>.
9804 The key for the lookup is given by the context in which the list is expanded.
9805 </para>
9806 </listitem>
9807 </orderedlist>
9808 <para>
9809 String expansions, lists, and lookups interact with each other in such a way
9810 that there is no order in which to describe any one of them that does not
9811 involve references to the others. Each of these three chapters makes more sense
9812 if you have read the other two first. If you are reading this for the first
9813 time, be aware that some of it will make a lot more sense after you have read
9814 chapters <xref linkend="CHAPdomhosaddlists"/> and <xref linkend="CHAPexpand"/>.
9815 </para>
9816 <section id="SECID60">
9817 <title>Examples of different lookup syntax</title>
9818 <para>
9819 It is easy to confuse the two different kinds of lookup, especially as the
9820 lists that may contain the second kind are always expanded before being
9821 processed as lists. Therefore, they may also contain lookups of the first kind.
9822 Be careful to distinguish between the following two examples:
9823 </para>
9824 <literallayout class="monospaced">
9825 domains = ${lookup{$sender_host_address}lsearch{/some/file}}
9826 domains = lsearch;/some/file
9827 </literallayout>
9828 <para>
9829 The first uses a string expansion, the result of which must be a domain list.
9830 No strings have been specified for a successful or a failing lookup; the
9831 defaults in this case are the looked-up data and an empty string, respectively.
9832 The expansion takes place before the string is processed as a list, and the
9833 file that is searched could contain lines like this:
9834 </para>
9835 <literallayout class="monospaced">
9836 192.168.3.4: domain1:domain2:...
9837 192.168.1.9: domain3:domain4:...
9838 </literallayout>
9839 <para>
9840 When the lookup succeeds, the result of the expansion is a list of domains (and
9841 possibly other types of item that are allowed in domain lists).
9842 </para>
9843 <para>
9844 In the second example, the lookup is a single item in a domain list. It causes
9845 Exim to use a lookup to see if the domain that is being processed can be found
9846 in the file. The file could contains lines like this:
9847 </para>
9848 <literallayout class="monospaced">
9849 domain1:
9850 domain2:
9851 </literallayout>
9852 <para>
9853 Any data that follows the keys is not relevant when checking that the domain
9854 matches the list item.
9855 </para>
9856 <para>
9857 It is possible, though no doubt confusing, to use both kinds of lookup at once.
9858 Consider a file containing lines like this:
9859 </para>
9860 <literallayout class="monospaced">
9861 192.168.5.6: lsearch;/another/file
9862 </literallayout>
9863 <para>
9864 If the value of <varname>$sender_host_address</varname> is 192.168.5.6, expansion of the
9865 first <option>domains</option> setting above generates the second setting, which therefore
9866 causes a second lookup to occur.
9867 </para>
9868 <para>
9869 The rest of this chapter describes the different lookup types that are
9870 available. Any of them can be used in any part of the configuration where a
9871 lookup is permitted.
9872 </para>
9873 </section>
9874 <section id="SECID61">
9875 <title>Lookup types</title>
9876 <para>
9877 <indexterm role="concept">
9878 <primary>lookup</primary>
9879 <secondary>types of</secondary>
9880 </indexterm>
9881 <indexterm role="concept">
9882 <primary>single-key lookup</primary>
9883 <secondary>definition of</secondary>
9884 </indexterm>
9885 Two different types of data lookup are implemented:
9886 </para>
9887 <itemizedlist>
9888 <listitem>
9889 <para>
9890 The <emphasis>single-key</emphasis> type requires the specification of a file in which to look,
9891 and a single key to search for. The key must be a non-empty string for the
9892 lookup to succeed. The lookup type determines how the file is searched.
9893 </para>
9894 </listitem>
9895 <listitem>
9896 <para>
9897 <indexterm role="concept">
9898 <primary>query-style lookup</primary>
9899 <secondary>definition of</secondary>
9900 </indexterm>
9901 The <emphasis>query-style</emphasis> type accepts a generalized database query. No particular
9902 key value is assumed by Exim for query-style lookups. You can use whichever
9903 Exim variables you need to construct the database query.
9904 </para>
9905 </listitem>
9906 </itemizedlist>
9907 <para>
9908 The code for each lookup type is in a separate source file that is included in
9909 the binary of Exim only if the corresponding compile-time option is set. The
9910 default settings in <filename>src/EDITME</filename> are:
9911 </para>
9912 <literallayout class="monospaced">
9913 LOOKUP_DBM=yes
9914 LOOKUP_LSEARCH=yes
9915 </literallayout>
9916 <para>
9917 which means that only linear searching and DBM lookups are included by default.
9918 For some types of lookup (e.g. SQL databases), you need to install appropriate
9919 libraries and header files before building Exim.
9920 </para>
9921 </section>
9922 <section id="SECTsinglekeylookups">
9923 <title>Single-key lookup types</title>
9924 <para>
9925 <indexterm role="concept">
9926 <primary>lookup</primary>
9927 <secondary>single-key types</secondary>
9928 </indexterm>
9929 <indexterm role="concept">
9930 <primary>single-key lookup</primary>
9931 <secondary>list of types</secondary>
9932 </indexterm>
9933 The following single-key lookup types are implemented:
9934 </para>
9935 <itemizedlist>
9936 <listitem>
9937 <para>
9938 <indexterm role="concept">
9939 <primary>cdb</primary>
9940 <secondary>description of</secondary>
9941 </indexterm>
9942 <indexterm role="concept">
9943 <primary>lookup</primary>
9944 <secondary>cdb</secondary>
9945 </indexterm>
9946 <indexterm role="concept">
9947 <primary>binary zero</primary>
9948 <secondary>in lookup key</secondary>
9949 </indexterm>
9950 <command>cdb</command>: The given file is searched as a Constant DataBase file, using the key
9951 string without a terminating binary zero. The cdb format is designed for
9952 indexed files that are read frequently and never updated, except by total
9953 re-creation. As such, it is particularly suitable for large files containing
9954 aliases or other indexed data referenced by an MTA. Information about cdb and
9955 tools for building the files can be found in several places:
9956 </para>
9957 <literallayout>
9958 <emphasis role="bold"><ulink url="https://cr.yp.to/cdb.html">https://cr.yp.to/cdb.html</ulink></emphasis>
9959 <emphasis role="bold"><ulink url="http://www.corpit.ru/mjt/tinycdb.html">http://www.corpit.ru/mjt/tinycdb.html</ulink></emphasis>
9960 <emphasis role="bold"><ulink url="https://packages.debian.org/stable/utils/freecdb">https://packages.debian.org/stable/utils/freecdb</ulink></emphasis>
9961 <emphasis role="bold"><ulink url="https://github.com/philpennock/cdbtools">https://github.com/philpennock/cdbtools</ulink></emphasis> (in Go)
9962 </literallayout>
9963 <para>
9964 A cdb distribution is not needed in order to build Exim with cdb support,
9965 because the code for reading cdb files is included directly in Exim itself.
9966 However, no means of building or testing cdb files is provided with Exim, so
9967 you need to obtain a cdb distribution in order to do this.
9968 </para>
9969 </listitem>
9970 <listitem>
9971 <para>
9972 <indexterm role="concept">
9973 <primary>DBM</primary>
9974 <secondary>lookup type</secondary>
9975 </indexterm>
9976 <indexterm role="concept">
9977 <primary>lookup</primary>
9978 <secondary>dbm</secondary>
9979 </indexterm>
9980 <indexterm role="concept">
9981 <primary>binary zero</primary>
9982 <secondary>in lookup key</secondary>
9983 </indexterm>
9984 <command>dbm</command>: Calls to DBM library functions are used to extract data from the given
9985 DBM file by looking up the record with the given key. A terminating binary
9986 zero is included in the key that is passed to the DBM library. See section
9987 <xref linkend="SECTdb"/> for a discussion of DBM libraries.
9988 </para>
9989 <para>
9990 <indexterm role="concept">
9991 <primary>Berkeley DB library</primary>
9992 <secondary>file format</secondary>
9993 </indexterm>
9994 For all versions of Berkeley DB, Exim uses the DB_HASH style of database
9995 when building DBM files using the <option>exim_dbmbuild</option> utility. However, when
9996 using Berkeley DB versions 3 or 4, it opens existing databases for reading with
9997 the DB_UNKNOWN option. This enables it to handle any of the types of database
9998 that the library supports, and can be useful for accessing DBM files created by
9999 other applications. (For earlier DB versions, DB_HASH is always used.)
10000 </para>
10001 </listitem>
10002 <listitem>
10003 <para>
10004 <indexterm role="concept">
10005 <primary>lookup</primary>
10006 <secondary>dbmjz</secondary>
10007 </indexterm>
10008 <indexterm role="concept">
10009 <primary>lookup</primary>
10010 <secondary>dbm &ndash; embedded NULs</secondary>
10011 </indexterm>
10012 <indexterm role="concept">
10013 <primary>sasldb2</primary>
10014 </indexterm>
10015 <indexterm role="concept">
10016 <primary>dbmjz lookup type</primary>
10017 </indexterm>
10018 <command>dbmjz</command>: This is the same as <command>dbm</command>, except that the lookup key is
10019 interpreted as an Exim list; the elements of the list are joined together with
10020 ASCII NUL characters to form the lookup key.  An example usage would be to
10021 authenticate incoming SMTP calls using the passwords from Cyrus SASL&#x2019;s
10022 <filename>/etc/sasldb2</filename> file with the <command>gsasl</command> authenticator or Exim&#x2019;s own
10023 <command>cram_md5</command> authenticator.
10024 </para>
10025 </listitem>
10026 <listitem>
10027 <para>
10028 <indexterm role="concept">
10029 <primary>lookup</primary>
10030 <secondary>dbmnz</secondary>
10031 </indexterm>
10032 <indexterm role="concept">
10033 <primary>lookup</primary>
10034 <secondary>dbm &ndash; terminating zero</secondary>
10035 </indexterm>
10036 <indexterm role="concept">
10037 <primary>binary zero</primary>
10038 <secondary>in lookup key</secondary>
10039 </indexterm>
10040 <indexterm role="concept">
10041 <primary>Courier</primary>
10042 </indexterm>
10043 <indexterm role="concept">
10044 <primary><filename>/etc/userdbshadow.dat</filename></primary>
10045 </indexterm>
10046 <indexterm role="concept">
10047 <primary>dbmnz lookup type</primary>
10048 </indexterm>
10049 <command>dbmnz</command>: This is the same as <command>dbm</command>, except that a terminating binary zero
10050 is not included in the key that is passed to the DBM library. You may need this
10051 if you want to look up data in files that are created by or shared with some
10052 other application that does not use terminating zeros. For example, you need to
10053 use <command>dbmnz</command> rather than <command>dbm</command> if you want to authenticate incoming SMTP
10054 calls using the passwords from Courier&#x2019;s <filename>/etc/userdbshadow.dat</filename> file. Exim&#x2019;s
10055 utility program for creating DBM files (<emphasis>exim_dbmbuild</emphasis>) includes the zeros
10056 by default, but has an option to omit them (see section <xref linkend="SECTdbmbuild"/>).
10057 </para>
10058 </listitem>
10059 <listitem>
10060 <para>
10061 <indexterm role="concept">
10062 <primary>lookup</primary>
10063 <secondary>dsearch</secondary>
10064 </indexterm>
10065 <indexterm role="concept">
10066 <primary>dsearch lookup type</primary>
10067 </indexterm>
10068 <command>dsearch</command>: The given file must be a directory; this is searched for an entry
10069 whose name is the key by calling the <function>lstat()</function> function. The key may not
10070 contain any forward slash characters. If <function>lstat()</function> succeeds, the result of
10071 the lookup is the name of the entry, which may be a file, directory,
10072 symbolic link, or any other kind of directory entry. An example of how this
10073 lookup can be used to support virtual domains is given in section
10074 <xref linkend="SECTvirtualdomains"/>.
10075 </para>
10076 </listitem>
10077 <listitem>
10078 <para>
10079 <indexterm role="concept">
10080 <primary>lookup</primary>
10081 <secondary>iplsearch</secondary>
10082 </indexterm>
10083 <indexterm role="concept">
10084 <primary>iplsearch lookup type</primary>
10085 </indexterm>
10086 <command>iplsearch</command>: The given file is a text file containing keys and data. A key is
10087 terminated by a colon or white space or the end of the line. The keys in the
10088 file must be IP addresses, or IP addresses with CIDR masks. Keys that involve
10089 IPv6 addresses must be enclosed in quotes to prevent the first internal colon
10090 being interpreted as a key terminator. For example:
10091 </para>
10092 <literallayout class="monospaced">
10093 1.2.3.4:           data for 1.2.3.4
10094 192.168.0.0/16:    data for 192.168.0.0/16
10095 "abcd::cdab":      data for abcd::cdab
10096 "abcd:abcd::/32"   data for abcd:abcd::/32
10097 </literallayout>
10098 <para>
10099 The key for an <command>iplsearch</command> lookup must be an IP address (without a mask). The
10100 file is searched linearly, using the CIDR masks where present, until a matching
10101 key is found. The first key that matches is used; there is no attempt to find a
10102 <quote>best</quote> match. Apart from the way the keys are matched, the processing for
10103 <command>iplsearch</command> is the same as for <command>lsearch</command>.
10104 </para>
10105 <para>
10106 <emphasis role="bold">Warning 1</emphasis>: Unlike most other single-key lookup types, a file of data for
10107 <command>iplsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
10108 lookup types support only literal keys.
10109 </para>
10110 <para>
10111 <emphasis role="bold">Warning 2</emphasis>: In a host list, you must always use <command>net-iplsearch</command> so that
10112 the implicit key is the host&#x2019;s IP address rather than its name (see section
10113 <xref linkend="SECThoslispatsikey"/>).
10114 </para>
10115 </listitem>
10116 <listitem>
10117 <para>
10118 <indexterm role="concept">
10119 <primary>linear search</primary>
10120 </indexterm>
10121 <indexterm role="concept">
10122 <primary>lookup</primary>
10123 <secondary>lsearch</secondary>
10124 </indexterm>
10125 <indexterm role="concept">
10126 <primary>lsearch lookup type</primary>
10127 </indexterm>
10128 <indexterm role="concept">
10129 <primary>case sensitivity</primary>
10130 <secondary>in lsearch lookup</secondary>
10131 </indexterm>
10132 <command>lsearch</command>: The given file is a text file that is searched linearly for a
10133 line beginning with the search key, terminated by a colon or white space or the
10134 end of the line. The search is case-insensitive; that is, upper and lower case
10135 letters are treated as the same. The first occurrence of the key that is found
10136 in the file is used.
10137 </para>
10138 <para>
10139 White space between the key and the colon is permitted. The remainder of the
10140 line, with leading and trailing white space removed, is the data. This can be
10141 continued onto subsequent lines by starting them with any amount of white
10142 space, but only a single space character is included in the data at such a
10143 junction. If the data begins with a colon, the key must be terminated by a
10144 colon, for example:
10145 </para>
10146 <literallayout class="monospaced">
10147 baduser:  :fail:
10148 </literallayout>
10149 <para>
10150 Empty lines and lines beginning with # are ignored, even if they occur in the
10151 middle of an item. This is the traditional textual format of alias files. Note
10152 that the keys in an <command>lsearch</command> file are literal strings. There is no
10153 wildcarding of any kind.
10154 </para>
10155 <para>
10156 <indexterm role="concept">
10157 <primary>lookup</primary>
10158 <secondary>lsearch &ndash; colons in keys</secondary>
10159 </indexterm>
10160 <indexterm role="concept">
10161 <primary>white space</primary>
10162 <secondary>in lsearch key</secondary>
10163 </indexterm>
10164 In most <command>lsearch</command> files, keys are not required to contain colons or #
10165 characters, or white space. However, if you need this feature, it is available.
10166 If a key begins with a doublequote character, it is terminated only by a
10167 matching quote (or end of line), and the normal escaping rules apply to its
10168 contents (see section <xref linkend="SECTstrings"/>). An optional colon is permitted after
10169 quoted keys (exactly as for unquoted keys). There is no special handling of
10170 quotes for the data part of an <command>lsearch</command> line.
10171 </para>
10172 </listitem>
10173 <listitem>
10174 <para>
10175 <indexterm role="concept">
10176 <primary>NIS lookup type</primary>
10177 </indexterm>
10178 <indexterm role="concept">
10179 <primary>lookup</primary>
10180 <secondary>NIS</secondary>
10181 </indexterm>
10182 <indexterm role="concept">
10183 <primary>binary zero</primary>
10184 <secondary>in lookup key</secondary>
10185 </indexterm>
10186 <command>nis</command>: The given file is the name of a NIS map, and a NIS lookup is done with
10187 the given key, without a terminating binary zero. There is a variant called
10188 <command>nis0</command> which does include the terminating binary zero in the key. This is
10189 reportedly needed for Sun-style alias files. Exim does not recognize NIS
10190 aliases; the full map names must be used.
10191 </para>
10192 </listitem>
10193 <listitem>
10194 <para>
10195 <indexterm role="concept">
10196 <primary>wildlsearch lookup type</primary>
10197 </indexterm>
10198 <indexterm role="concept">
10199 <primary>lookup</primary>
10200 <secondary>wildlsearch</secondary>
10201 </indexterm>
10202 <indexterm role="concept">
10203 <primary>nwildlsearch lookup type</primary>
10204 </indexterm>
10205 <indexterm role="concept">
10206 <primary>lookup</primary>
10207 <secondary>nwildlsearch</secondary>
10208 </indexterm>
10209 <command>wildlsearch</command> or <command>nwildlsearch</command>: These search a file linearly, like
10210 <command>lsearch</command>, but instead of being interpreted as a literal string, each key in
10211 the file may be wildcarded. The difference between these two lookup types is
10212 that for <command>wildlsearch</command>, each key in the file is string-expanded before being
10213 used, whereas for <command>nwildlsearch</command>, no expansion takes place.
10214 </para>
10215 <para>
10216 <indexterm role="concept">
10217 <primary>case sensitivity</primary>
10218 <secondary>in (n)wildlsearch lookup</secondary>
10219 </indexterm>
10220 Like <command>lsearch</command>, the testing is done case-insensitively. However, keys in the
10221 file that are regular expressions can be made case-sensitive by the use of
10222 <literal>(-i)</literal> within the pattern. The following forms of wildcard are recognized:
10223 </para>
10224 <orderedlist numeration="arabic">
10225 <listitem>
10226 <para>
10227 The string may begin with an asterisk to mean <quote>ends with</quote>. For example:
10228 </para>
10229 <literallayout class="monospaced">
10230     *.a.b.c       data for anything.a.b.c
10231     *fish         data for anythingfish
10232 </literallayout>
10233 </listitem>
10234 <listitem>
10235 <para>
10236 The string may begin with a circumflex to indicate a regular expression. For
10237 example, for <command>wildlsearch</command>:
10238 </para>
10239 <literallayout class="monospaced">
10240     ^\N\d+\.a\.b\N    data for &lt;digits&gt;.a.b
10241 </literallayout>
10242 <para>
10243 Note the use of <literal>\N</literal> to disable expansion of the contents of the regular
10244 expression. If you are using <command>nwildlsearch</command>, where the keys are not
10245 string-expanded, the equivalent entry is:
10246 </para>
10247 <literallayout class="monospaced">
10248     ^\d+\.a\.b        data for &lt;digits&gt;.a.b
10249 </literallayout>
10250 <para>
10251 The case-insensitive flag is set at the start of compiling the regular
10252 expression, but it can be turned off by using <literal>(-i)</literal> at an appropriate point.
10253 For example, to make the entire pattern case-sensitive:
10254 </para>
10255 <literallayout class="monospaced">
10256     ^(?-i)\d+\.a\.b        data for &lt;digits&gt;.a.b
10257 </literallayout>
10258 <para>
10259 If the regular expression contains white space or colon characters, you must
10260 either quote it (see <command>lsearch</command> above), or represent these characters in other
10261 ways. For example, <literal>\s</literal> can be used for white space and <literal>\x3A</literal> for a
10262 colon. This may be easier than quoting, because if you quote, you have to
10263 escape all the backslashes inside the quotes.
10264 </para>
10265 <para>
10266 <emphasis role="bold">Note</emphasis>: It is not possible to capture substrings in a regular expression
10267 match for later use, because the results of all lookups are cached. If a lookup
10268 is repeated, the result is taken from the cache, and no actual pattern matching
10269 takes place. The values of all the numeric variables are unset after a
10270 <command>(n)wildlsearch</command> match.
10271 </para>
10272 </listitem>
10273 <listitem>
10274 <para>
10275 Although I cannot see it being of much use, the general matching function that
10276 is used to implement <command>(n)wildlsearch</command> means that the string may begin with a
10277 lookup name terminated by a semicolon, and followed by lookup data. For
10278 example:
10279 </para>
10280 <literallayout class="monospaced">
10281     cdb;/some/file  data for keys that match the file
10282 </literallayout>
10283 <para>
10284 The data that is obtained from the nested lookup is discarded.
10285 </para>
10286 </listitem>
10287 </orderedlist>
10288 <para>
10289 Keys that do not match any of these patterns are interpreted literally. The
10290 continuation rules for the data are the same as for <command>lsearch</command>, and keys may
10291 be followed by optional colons.
10292 </para>
10293 <para>
10294 <emphasis role="bold">Warning</emphasis>: Unlike most other single-key lookup types, a file of data for
10295 <command>(n)wildlsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
10296 lookup types support only literal keys.
10297 </para>
10298 </listitem>
10299 <listitem>
10300 <para>
10301 <indexterm role="concept">
10302 <primary>lookup</primary>
10303 <secondary>spf</secondary>
10304 </indexterm>
10305 If Exim is built with SPF support, manual lookups can be done
10306 (as opposed to the standard ACL condition method.
10307 For details see section <xref linkend="SECSPF"/>.
10308 </para>
10309 </listitem>
10310 </itemizedlist>
10311 </section>
10312 <section id="SECTquerystylelookups">
10313 <title>Query-style lookup types</title>
10314 <para>
10315 <indexterm role="concept">
10316 <primary>lookup</primary>
10317 <secondary>query-style types</secondary>
10318 </indexterm>
10319 <indexterm role="concept">
10320 <primary>query-style lookup</primary>
10321 <secondary>list of types</secondary>
10322 </indexterm>
10323 The supported query-style lookup types are listed below. Further details about
10324 many of them are given in later sections.
10325 </para>
10326 <itemizedlist>
10327 <listitem>
10328 <para>
10329 <indexterm role="concept">
10330 <primary>DNS</primary>
10331 <secondary>as a lookup type</secondary>
10332 </indexterm>
10333 <indexterm role="concept">
10334 <primary>lookup</primary>
10335 <secondary>DNS</secondary>
10336 </indexterm>
10337 <command>dnsdb</command>: This does a DNS search for one or more records whose domain names
10338 are given in the supplied query. The resulting data is the contents of the
10339 records. See section <xref linkend="SECTdnsdb"/>.
10340 </para>
10341 </listitem>
10342 <listitem>
10343 <para>
10344 <indexterm role="concept">
10345 <primary>InterBase lookup type</primary>
10346 </indexterm>
10347 <indexterm role="concept">
10348 <primary>lookup</primary>
10349 <secondary>InterBase</secondary>
10350 </indexterm>
10351 <command>ibase</command>: This does a lookup in an InterBase database.
10352 </para>
10353 </listitem>
10354 <listitem>
10355 <para>
10356 <indexterm role="concept">
10357 <primary>LDAP</primary>
10358 <secondary>lookup type</secondary>
10359 </indexterm>
10360 <indexterm role="concept">
10361 <primary>lookup</primary>
10362 <secondary>LDAP</secondary>
10363 </indexterm>
10364 <command>ldap</command>: This does an LDAP lookup using a query in the form of a URL, and
10365 returns attributes from a single entry. There is a variant called <command>ldapm</command>
10366 that permits values from multiple entries to be returned. A third variant
10367 called <command>ldapdn</command> returns the Distinguished Name of a single entry instead of
10368 any attribute values. See section <xref linkend="SECTldap"/>.
10369 </para>
10370 </listitem>
10371 <listitem>
10372 <para>
10373 <indexterm role="concept">
10374 <primary>MySQL</primary>
10375 <secondary>lookup type</secondary>
10376 </indexterm>
10377 <indexterm role="concept">
10378 <primary>lookup</primary>
10379 <secondary>MySQL</secondary>
10380 </indexterm>
10381 <command>mysql</command>: The format of the query is an SQL statement that is passed to a
10382 MySQL database. See section <xref linkend="SECTsql"/>.
10383 </para>
10384 </listitem>
10385 <listitem>
10386 <para>
10387 <indexterm role="concept">
10388 <primary>NIS+ lookup type</primary>
10389 </indexterm>
10390 <indexterm role="concept">
10391 <primary>lookup</primary>
10392 <secondary>NIS+</secondary>
10393 </indexterm>
10394 <command>nisplus</command>: This does a NIS+ lookup using a query that can specify the name of
10395 the field to be returned. See section <xref linkend="SECTnisplus"/>.
10396 </para>
10397 </listitem>
10398 <listitem>
10399 <para>
10400 <indexterm role="concept">
10401 <primary>Oracle</primary>
10402 <secondary>lookup type</secondary>
10403 </indexterm>
10404 <indexterm role="concept">
10405 <primary>lookup</primary>
10406 <secondary>Oracle</secondary>
10407 </indexterm>
10408 <command>oracle</command>: The format of the query is an SQL statement that is passed to an
10409 Oracle database. See section <xref linkend="SECTsql"/>.
10410 </para>
10411 </listitem>
10412 <listitem>
10413 <para>
10414 <indexterm role="concept">
10415 <primary>lookup</primary>
10416 <secondary>passwd</secondary>
10417 </indexterm>
10418 <indexterm role="concept">
10419 <primary>passwd lookup type</primary>
10420 </indexterm>
10421 <indexterm role="concept">
10422 <primary><filename>/etc/passwd</filename></primary>
10423 </indexterm>
10424 <command>passwd</command> is a query-style lookup with queries that are just user names. The
10425 lookup calls <function>getpwnam()</function> to interrogate the system password data, and on
10426 success, the result string is the same as you would get from an <command>lsearch</command>
10427 lookup on a traditional <filename>/etc/passwd file</filename>, though with <literal>*</literal> for the
10428 password value. For example:
10429 </para>
10430 <literallayout class="monospaced">
10431 *:42:42:King Rat:/home/kr:/bin/bash
10432 </literallayout>
10433 </listitem>
10434 <listitem>
10435 <para>
10436 <indexterm role="concept">
10437 <primary>PostgreSQL lookup type</primary>
10438 </indexterm>
10439 <indexterm role="concept">
10440 <primary>lookup</primary>
10441 <secondary>PostgreSQL</secondary>
10442 </indexterm>
10443 <command>pgsql</command>: The format of the query is an SQL statement that is passed to a
10444 PostgreSQL database. See section <xref linkend="SECTsql"/>.
10445 </para>
10446 </listitem>
10447 <listitem>
10448 <para>
10449 <indexterm role="concept">
10450 <primary>Redis lookup type</primary>
10451 </indexterm>
10452 <indexterm role="concept">
10453 <primary>lookup</primary>
10454 <secondary>Redis</secondary>
10455 </indexterm>
10456 <command>redis</command>: The format of the query is either a simple get or simple set,
10457 passed to a Redis database. See section <xref linkend="SECTsql"/>.
10458 </para>
10459 </listitem>
10460 <listitem>
10461 <para>
10462 <indexterm role="concept">
10463 <primary>sqlite lookup type</primary>
10464 </indexterm>
10465 <indexterm role="concept">
10466 <primary>lookup</primary>
10467 <secondary>sqlite</secondary>
10468 </indexterm>
10469 <command>sqlite</command>: The format of the query is a filename followed by an SQL statement
10470 that is passed to an SQLite database. See section <xref linkend="SECTsqlite"/>.
10471 </para>
10472 </listitem>
10473 <listitem>
10474 <para>
10475 <command>testdb</command>: This is a lookup type that is used for testing Exim. It is
10476 not likely to be useful in normal operation.
10477 </para>
10478 </listitem>
10479 <listitem>
10480 <para>
10481 <indexterm role="concept">
10482 <primary>whoson lookup type</primary>
10483 </indexterm>
10484 <indexterm role="concept">
10485 <primary>lookup</primary>
10486 <secondary>whoson</secondary>
10487 </indexterm>
10488 <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
10489 allows a server to check whether a particular (dynamically allocated) IP
10490 address is currently allocated to a known (trusted) user and, optionally, to
10491 obtain the identity of the said user. For SMTP servers, <emphasis>Whoson</emphasis> was popular
10492 at one time for <quote>POP before SMTP</quote> authentication, but that approach has been
10493 superseded by SMTP authentication. In Exim, <emphasis>Whoson</emphasis> can be used to implement
10494 <quote>POP before SMTP</quote> checking using ACL statements such as
10495 </para>
10496 <literallayout class="monospaced">
10497 require condition = \
10498   ${lookup whoson {$sender_host_address}{yes}{no}}
10499 </literallayout>
10500 <para>
10501 The query consists of a single IP address. The value returned is the name of
10502 the authenticated user, which is stored in the variable <varname>$value</varname>. However, in
10503 this example, the data in <varname>$value</varname> is not used; the result of the lookup is
10504 one of the fixed strings <quote>yes</quote> or <quote>no</quote>.
10505 </para>
10506 </listitem>
10507 </itemizedlist>
10508 </section>
10509 <section id="SECID63">
10510 <title>Temporary errors in lookups</title>
10511 <para>
10512 <indexterm role="concept">
10513 <primary>lookup</primary>
10514 <secondary>temporary error in</secondary>
10515 </indexterm>
10516 Lookup functions can return temporary error codes if the lookup cannot be
10517 completed. For example, an SQL or LDAP database might be unavailable. For this
10518 reason, it is not advisable to use a lookup that might do this for critical
10519 options such as a list of local domains.
10520 </para>
10521 <para>
10522 When a lookup cannot be completed in a router or transport, delivery
10523 of the message (to the relevant address) is deferred, as for any other
10524 temporary error. In other circumstances Exim may assume the lookup has failed,
10525 or may give up altogether.
10526 </para>
10527 </section>
10528 <section id="SECTdefaultvaluelookups">
10529 <title>Default values in single-key lookups</title>
10530 <para>
10531 <indexterm role="concept">
10532 <primary>wildcard lookups</primary>
10533 </indexterm>
10534 <indexterm role="concept">
10535 <primary>lookup</primary>
10536 <secondary>default values</secondary>
10537 </indexterm>
10538 <indexterm role="concept">
10539 <primary>lookup</primary>
10540 <secondary>wildcard</secondary>
10541 </indexterm>
10542 <indexterm role="concept">
10543 <primary>lookup</primary>
10544 <secondary>* added to type</secondary>
10545 </indexterm>
10546 <indexterm role="concept">
10547 <primary>default</primary>
10548 <secondary>in single-key lookups</secondary>
10549 </indexterm>
10550 In this context, a <quote>default value</quote> is a value specified by the administrator
10551 that is to be used if a lookup fails.
10552 </para>
10553 <para>
10554 <emphasis role="bold">Note:</emphasis> This section applies only to single-key lookups. For query-style
10555 lookups, the facilities of the query language must be used. An attempt to
10556 specify a default for a query-style lookup provokes an error.
10557 </para>
10558 <para>
10559 If <quote>*</quote> is added to a single-key lookup type (for example, <option>lsearch*</option>)
10560 and the initial lookup fails, the key <quote>*</quote> is looked up in the file to
10561 provide a default value. See also the section on partial matching below.
10562 </para>
10563 <para>
10564 <indexterm role="concept">
10565 <primary>*@ with single-key lookup</primary>
10566 </indexterm>
10567 <indexterm role="concept">
10568 <primary>lookup</primary>
10569 <secondary>*@ added to type</secondary>
10570 </indexterm>
10571 <indexterm role="concept">
10572 <primary>alias file</primary>
10573 <secondary>per-domain default</secondary>
10574 </indexterm>
10575 Alternatively, if <quote>*@</quote> is added to a single-key lookup type (for example
10576 <option>dbm*@</option>) then, if the initial lookup fails and the key contains an @
10577 character, a second lookup is done with everything before the last @ replaced
10578 by *. This makes it possible to provide per-domain defaults in alias files
10579 that include the domains in the keys. If the second lookup fails (or doesn&#x2019;t
10580 take place because there is no @ in the key), <quote>*</quote> is looked up.
10581 For example, a <command>redirect</command> router might contain:
10582 </para>
10583 <literallayout class="monospaced">
10584 data = ${lookup{$local_part@$domain}lsearch*@{/etc/mix-aliases}}
10585 </literallayout>
10586 <para>
10587 Suppose the address that is being processed is <emphasis>jane@eyre.example</emphasis>. Exim
10588 looks up these keys, in this order:
10589 </para>
10590 <literallayout class="monospaced">
10591 jane@eyre.example
10592 *@eyre.example
10593 *
10594 </literallayout>
10595 <para>
10596 The data is taken from whichever key it finds first. <emphasis role="bold">Note</emphasis>: In an
10597 <command>lsearch</command> file, this does not mean the first of these keys in the file. A
10598 complete scan is done for each key, and only if it is not found at all does
10599 Exim move on to try the next key.
10600 </para>
10601 </section>
10602 <section id="SECTpartiallookup">
10603 <title>Partial matching in single-key lookups</title>
10604 <para>
10605 <indexterm role="concept">
10606 <primary>partial matching</primary>
10607 </indexterm>
10608 <indexterm role="concept">
10609 <primary>wildcard lookups</primary>
10610 </indexterm>
10611 <indexterm role="concept">
10612 <primary>lookup</primary>
10613 <secondary>partial matching</secondary>
10614 </indexterm>
10615 <indexterm role="concept">
10616 <primary>lookup</primary>
10617 <secondary>wildcard</secondary>
10618 </indexterm>
10619 <indexterm role="concept">
10620 <primary>asterisk</primary>
10621 <secondary>in search type</secondary>
10622 </indexterm>
10623 The normal operation of a single-key lookup is to search the file for an exact
10624 match with the given key. However, in a number of situations where domains are
10625 being looked up, it is useful to be able to do partial matching. In this case,
10626 information in the file that has a key starting with <quote>*.</quote> is matched by any
10627 domain that ends with the components that follow the full stop. For example, if
10628 a key in a DBM file is
10629 </para>
10630 <literallayout class="monospaced">
10631 *.dates.fict.example
10632 </literallayout>
10633 <para>
10634 then when partial matching is enabled this is matched by (amongst others)
10635 <emphasis>2001.dates.fict.example</emphasis> and <emphasis>1984.dates.fict.example</emphasis>. It is also matched
10636 by <emphasis>dates.fict.example</emphasis>, if that does not appear as a separate key in the
10637 file.
10638 </para>
10639 <para>
10640 <emphasis role="bold">Note</emphasis>: Partial matching is not available for query-style lookups. It is
10641 also not available for any lookup items in address lists (see section
10642 <xref linkend="SECTaddresslist"/>).
10643 </para>
10644 <para>
10645 Partial matching is implemented by doing a series of separate lookups using
10646 keys constructed by modifying the original subject key. This means that it can
10647 be used with any of the single-key lookup types, provided that
10648 partial matching keys
10649 beginning with a special prefix (default <quote>*.</quote>) are included in the data file.
10650 Keys in the file that do not begin with the prefix are matched only by
10651 unmodified subject keys when partial matching is in use.
10652 </para>
10653 <para>
10654 Partial matching is requested by adding the string <quote>partial-</quote> to the front of
10655 the name of a single-key lookup type, for example, <option>partial-dbm</option>. When this
10656 is done, the subject key is first looked up unmodified; if that fails, <quote>*.</quote>
10657 is added at the start of the subject key, and it is looked up again. If that
10658 fails, further lookups are tried with dot-separated components removed from the
10659 start of the subject key, one-by-one, and <quote>*.</quote> added on the front of what
10660 remains.
10661 </para>
10662 <para>
10663 A minimum number of two non-* components are required. This can be adjusted
10664 by including a number before the hyphen in the search type. For example,
10665 <option>partial3-lsearch</option> specifies a minimum of three non-* components in the
10666 modified keys. Omitting the number is equivalent to <quote>partial2-</quote>. If the
10667 subject key is <emphasis>2250.dates.fict.example</emphasis> then the following keys are looked
10668 up when the minimum number of non-* components is two:
10669 </para>
10670 <literallayout class="monospaced">
10671 2250.dates.fict.example
10672 *.2250.dates.fict.example
10673 *.dates.fict.example
10674 *.fict.example
10675 </literallayout>
10676 <para>
10677 As soon as one key in the sequence is successfully looked up, the lookup
10678 finishes.
10679 </para>
10680 <para>
10681 <indexterm role="concept">
10682 <primary>lookup</primary>
10683 <secondary>partial matching &ndash; changing prefix</secondary>
10684 </indexterm>
10685 <indexterm role="concept">
10686 <primary>prefix</primary>
10687 <secondary>for partial matching</secondary>
10688 </indexterm>
10689 The use of <quote>*.</quote> as the partial matching prefix is a default that can be
10690 changed. The motivation for this feature is to allow Exim to operate with file
10691 formats that are used by other MTAs. A different prefix can be supplied in
10692 parentheses instead of the hyphen after <quote>partial</quote>. For example:
10693 </para>
10694 <literallayout class="monospaced">
10695 domains = partial(.)lsearch;/some/file
10696 </literallayout>
10697 <para>
10698 In this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
10699 <literal>a.b.c</literal>, <literal>.a.b.c</literal>, and <literal>.b.c</literal> (the default minimum of 2 non-wild
10700 components is unchanged). The prefix may consist of any punctuation characters
10701 other than a closing parenthesis. It may be empty, for example:
10702 </para>
10703 <literallayout class="monospaced">
10704 domains = partial1()cdb;/some/file
10705 </literallayout>
10706 <para>
10707 For this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
10708 <literal>a.b.c</literal>, <literal>b.c</literal>, and <literal>c</literal>.
10709 </para>
10710 <para>
10711 If <quote>partial0</quote> is specified, what happens at the end (when the lookup with
10712 just one non-wild component has failed, and the original key is shortened right
10713 down to the null string) depends on the prefix:
10714 </para>
10715 <itemizedlist>
10716 <listitem>
10717 <para>
10718 If the prefix has zero length, the whole lookup fails.
10719 </para>
10720 </listitem>
10721 <listitem>
10722 <para>
10723 If the prefix has length 1, a lookup for just the prefix is done. For
10724 example, the final lookup for <quote>partial0(.)</quote> is for <literal>.</literal> alone.
10725 </para>
10726 </listitem>
10727 <listitem>
10728 <para>
10729 Otherwise, if the prefix ends in a dot, the dot is removed, and the
10730 remainder is looked up. With the default prefix, therefore, the final lookup is
10731 for <quote>*</quote> on its own.
10732 </para>
10733 </listitem>
10734 <listitem>
10735 <para>
10736 Otherwise, the whole prefix is looked up.
10737 </para>
10738 </listitem>
10739 </itemizedlist>
10740 <para>
10741 If the search type ends in <quote>*</quote> or <quote>*@</quote> (see section
10742 <xref linkend="SECTdefaultvaluelookups"/> above), the search for an ultimate default that
10743 this implies happens after all partial lookups have failed. If <quote>partial0</quote> is
10744 specified, adding <quote>*</quote> to the search type has no effect with the default
10745 prefix, because the <quote>*</quote> key is already included in the sequence of partial
10746 lookups. However, there might be a use for lookup types such as
10747 <quote>partial0(.)lsearch*</quote>.
10748 </para>
10749 <para>
10750 The use of <quote>*</quote> in lookup partial matching differs from its use as a wildcard
10751 in domain lists and the like. Partial matching works only in terms of
10752 dot-separated components; a key such as <literal>*fict.example</literal>
10753 in a database file is useless, because the asterisk in a partial matching
10754 subject key is always followed by a dot.
10755 </para>
10756 </section>
10757 <section id="SECID64">
10758 <title>Lookup caching</title>
10759 <para>
10760 <indexterm role="concept">
10761 <primary>lookup</primary>
10762 <secondary>caching</secondary>
10763 </indexterm>
10764 <indexterm role="concept">
10765 <primary>caching</primary>
10766 <secondary>lookup data</secondary>
10767 </indexterm>
10768 Exim caches all lookup results in order to avoid needless repetition of
10769 lookups. However, because (apart from the daemon) Exim operates as a collection
10770 of independent, short-lived processes, this caching applies only within a
10771 single Exim process. There is no inter-process lookup caching facility.
10772 </para>
10773 <para>
10774 For single-key lookups, Exim keeps the relevant files open in case there is
10775 another lookup that needs them. In some types of configuration this can lead to
10776 many files being kept open for messages with many recipients. To avoid hitting
10777 the operating system limit on the number of simultaneously open files, Exim
10778 closes the least recently used file when it needs to open more files than its
10779 own internal limit, which can be changed via the <option>lookup_open_max</option> option.
10780 </para>
10781 <para>
10782 The single-key lookup files are closed and the lookup caches are flushed at
10783 strategic points during delivery &ndash; for example, after all routing is
10784 complete.
10785 </para>
10786 </section>
10787 <section id="SECID65">
10788 <title>Quoting lookup data</title>
10789 <para>
10790 <indexterm role="concept">
10791 <primary>lookup</primary>
10792 <secondary>quoting</secondary>
10793 </indexterm>
10794 <indexterm role="concept">
10795 <primary>quoting</primary>
10796 <secondary>in lookups</secondary>
10797 </indexterm>
10798 When data from an incoming message is included in a query-style lookup, there
10799 is the possibility of special characters in the data messing up the syntax of
10800 the query. For example, a NIS+ query that contains
10801 </para>
10802 <literallayout class="monospaced">
10803 [name=$local_part]
10804 </literallayout>
10805 <para>
10806 will be broken if the local part happens to contain a closing square bracket.
10807 For NIS+, data can be enclosed in double quotes like this:
10808 </para>
10809 <literallayout class="monospaced">
10810 [name="$local_part"]
10811 </literallayout>
10812 <para>
10813 but this still leaves the problem of a double quote in the data. The rule for
10814 NIS+ is that double quotes must be doubled. Other lookup types have different
10815 rules, and to cope with the differing requirements, an expansion operator
10816 of the following form is provided:
10817 </para>
10818 <literallayout class="monospaced">
10819 ${quote_&lt;lookup-type&gt;:&lt;string&gt;}
10820 </literallayout>
10821 <para>
10822 For example, the safest way to write the NIS+ query is
10823 </para>
10824 <literallayout class="monospaced">
10825 [name="${quote_nisplus:$local_part}"]
10826 </literallayout>
10827 <para>
10828 See chapter <xref linkend="CHAPexpand"/> for full coverage of string expansions. The quote
10829 operator can be used for all lookup types, but has no effect for single-key
10830 lookups, since no quoting is ever needed in their key strings.
10831 </para>
10832 </section>
10833 <section id="SECTdnsdb">
10834 <title>More about dnsdb</title>
10835 <para>
10836 <indexterm role="concept">
10837 <primary>dnsdb lookup</primary>
10838 </indexterm>
10839 <indexterm role="concept">
10840 <primary>lookup</primary>
10841 <secondary>dnsdb</secondary>
10842 </indexterm>
10843 <indexterm role="concept">
10844 <primary>DNS</primary>
10845 <secondary>as a lookup type</secondary>
10846 </indexterm>
10847 The <command>dnsdb</command> lookup type uses the DNS as its database. A simple query consists
10848 of a record type and a domain name, separated by an equals sign. For example,
10849 an expansion string could contain:
10850 </para>
10851 <literallayout class="monospaced">
10852 ${lookup dnsdb{mx=a.b.example}{$value}fail}
10853 </literallayout>
10854 <para>
10855 If the lookup succeeds, the result is placed in <varname>$value</varname>, which in this case
10856 is used on its own as the result. If the lookup does not succeed, the
10857 <literal>fail</literal> keyword causes a <emphasis>forced expansion failure</emphasis> &ndash; see section
10858 <xref linkend="SECTforexpfai"/> for an explanation of what this means.
10859 </para>
10860 <para>
10861 The supported DNS record types are A, CNAME, MX, NS, PTR, SOA, SPF, SRV, TLSA
10862 and TXT, and, when Exim is compiled with IPv6 support, AAAA.
10863 If no type is given, TXT is assumed.
10864 </para>
10865 <para>
10866 For any record type, if multiple records are found, the data is returned as a
10867 concatenation, with newline as the default separator. The order, of course,
10868 depends on the DNS resolver. You can specify a different separator character
10869 between multiple records by putting a right angle-bracket followed immediately
10870 by the new separator at the start of the query. For example:
10871 </para>
10872 <literallayout class="monospaced">
10873 ${lookup dnsdb{&gt;: a=host1.example}}
10874 </literallayout>
10875 <para>
10876 It is permitted to specify a space as the separator character. Further
10877 white space is ignored.
10878 For lookup types that return multiple fields per record,
10879 an alternate field separator can be specified using a comma after the main
10880 separator character, followed immediately by the field separator.
10881 </para>
10882 <para>
10883 <indexterm role="concept">
10884 <primary>PTR record</primary>
10885 <secondary>in <command>dnsdb</command> lookup</secondary>
10886 </indexterm>
10887 When the type is PTR,
10888 the data can be an IP address, written as normal; inversion and the addition of
10889 <option>in-addr.arpa</option> or <option>ip6.arpa</option> happens automatically. For example:
10890 </para>
10891 <literallayout class="monospaced">
10892 ${lookup dnsdb{ptr=192.168.4.5}{$value}fail}
10893 </literallayout>
10894 <para>
10895 If the data for a PTR record is not a syntactically valid IP address, it is not
10896 altered and nothing is added.
10897 </para>
10898 <para>
10899 <indexterm role="concept">
10900 <primary>MX record</primary>
10901 <secondary>in <command>dnsdb</command> lookup</secondary>
10902 </indexterm>
10903 <indexterm role="concept">
10904 <primary>SRV record</primary>
10905 <secondary>in <command>dnsdb</command> lookup</secondary>
10906 </indexterm>
10907 For an MX lookup, both the preference value and the host name are returned for
10908 each record, separated by a space. For an SRV lookup, the priority, weight,
10909 port, and host name are returned for each record, separated by spaces.
10910 The field separator can be modified as above.
10911 </para>
10912 <para>
10913 <indexterm role="concept">
10914 <primary>TXT record</primary>
10915 <secondary>in <command>dnsdb</command> lookup</secondary>
10916 </indexterm>
10917 <indexterm role="concept">
10918 <primary>SPF record</primary>
10919 <secondary>in <command>dnsdb</command> lookup</secondary>
10920 </indexterm>
10921 For TXT records with multiple items of data, only the first item is returned,
10922 unless a field separator is specified.
10923 To concatenate items without a separator, use a semicolon instead.
10924 For SPF records the
10925 default behaviour is to concatenate multiple items without using a separator.
10926 </para>
10927 <literallayout class="monospaced">
10928 ${lookup dnsdb{&gt;\n,: txt=a.b.example}}
10929 ${lookup dnsdb{&gt;\n; txt=a.b.example}}
10930 ${lookup dnsdb{spf=example.org}}
10931 </literallayout>
10932 <para>
10933 It is permitted to specify a space as the separator character. Further
10934 white space is ignored.
10935 </para>
10936 <para>
10937 <indexterm role="concept">
10938 <primary>SOA record</primary>
10939 <secondary>in <command>dnsdb</command> lookup</secondary>
10940 </indexterm>
10941 For an SOA lookup, while no result is obtained the lookup is redone with
10942 successively more leading components dropped from the given domain.
10943 Only the primary-nameserver field is returned unless a field separator is
10944 specified.
10945 </para>
10946 <literallayout class="monospaced">
10947 ${lookup dnsdb{&gt;:,; soa=a.b.example.com}}
10948 </literallayout>
10949 </section>
10950 <section id="SECTdnsdb_mod">
10951 <title>Dnsdb lookup modifiers</title>
10952 <para>
10953 <indexterm role="concept">
10954 <primary>dnsdb modifiers</primary>
10955 </indexterm>
10956 <indexterm role="concept">
10957 <primary>modifiers</primary>
10958 <secondary>dnsdb</secondary>
10959 </indexterm>
10960 <indexterm role="concept">
10961 <primary>options</primary>
10962 <secondary>dnsdb</secondary>
10963 </indexterm>
10964 Modifiers for <command>dnsdb</command> lookups are given by optional keywords,
10965 each followed by a comma,
10966 that may appear before the record type.
10967 </para>
10968 <para>
10969 The <command>dnsdb</command> lookup fails only if all the DNS lookups fail. If there is a
10970 temporary DNS error for any of them, the behaviour is controlled by
10971 a defer-option modifier.
10972 The possible keywords are
10973 <quote>defer_strict</quote>, <quote>defer_never</quote>, and <quote>defer_lax</quote>.
10974 With <quote>strict</quote> behaviour, any temporary DNS error causes the
10975 whole lookup to defer. With <quote>never</quote> behaviour, a temporary DNS error is
10976 ignored, and the behaviour is as if the DNS lookup failed to find anything.
10977 With <quote>lax</quote> behaviour, all the queries are attempted, but a temporary DNS
10978 error causes the whole lookup to defer only if none of the other lookups
10979 succeed. The default is <quote>lax</quote>, so the following lookups are equivalent:
10980 </para>
10981 <literallayout class="monospaced">
10982 ${lookup dnsdb{defer_lax,a=one.host.com:two.host.com}}
10983 ${lookup dnsdb{a=one.host.com:two.host.com}}
10984 </literallayout>
10985 <para>
10986 Thus, in the default case, as long as at least one of the DNS lookups
10987 yields some data, the lookup succeeds.
10988 </para>
10989 <para>
10990 <indexterm role="concept">
10991 <primary>DNSSEC</primary>
10992 <secondary>dns lookup</secondary>
10993 </indexterm>
10994 Use of <command>DNSSEC</command> is controlled by a dnssec modifier.
10995 The possible keywords are
10996 <quote>dnssec_strict</quote>, <quote>dnssec_lax</quote>, and <quote>dnssec_never</quote>.
10997 With <quote>strict</quote> or <quote>lax</quote> DNSSEC information is requested
10998 with the lookup.
10999 With <quote>strict</quote> a response from the DNS resolver that
11000 is not labelled as authenticated data
11001 is treated as equivalent to a temporary DNS error.
11002 The default is <quote>never</quote>.
11003 </para>
11004 <para>
11005 See also the <varname>$lookup_dnssec_authenticated</varname> variable.
11006 </para>
11007 <para>
11008 <indexterm role="concept">
11009 <primary>timeout</primary>
11010 <secondary>dns lookup</secondary>
11011 </indexterm>
11012 <indexterm role="concept">
11013 <primary>DNS</primary>
11014 <secondary>timeout</secondary>
11015 </indexterm>
11016 Timeout for the dnsdb lookup can be controlled by a retrans modifier.
11017 The form is <quote>retrans_VAL</quote> where VAL is an Exim time specification
11018 (e.g. <quote>5s</quote>).
11019 The default value is set by the main configuration option <option>dns_retrans</option>.
11020 </para>
11021 <para>
11022 Retries for the dnsdb lookup can be controlled by a retry modifier.
11023 The form if <quote>retry_VAL</quote> where VAL is an integer.
11024 The default count is set by the main configuration option <option>dns_retry</option>.
11025 </para>
11026 <para>
11027 <indexterm role="concept">
11028 <primary>caching</primary>
11029 <secondary>of dns lookup</secondary>
11030 </indexterm>
11031 <indexterm role="concept">
11032 <primary>TTL</primary>
11033 <secondary>of dns lookup</secondary>
11034 </indexterm>
11035 <indexterm role="concept">
11036 <primary>DNS</primary>
11037 <secondary>TTL</secondary>
11038 </indexterm>
11039 Dnsdb lookup results are cached within a single process (and its children).
11040 The cache entry lifetime is limited to the smallest time-to-live (TTL)
11041 value of the set of returned DNS records.
11042 </para>
11043 </section>
11044 <section id="SECID66">
11045 <title>Pseudo dnsdb record types</title>
11046 <para>
11047 <indexterm role="concept">
11048 <primary>MX record</primary>
11049 <secondary>in <command>dnsdb</command> lookup</secondary>
11050 </indexterm>
11051 By default, both the preference value and the host name are returned for
11052 each MX record, separated by a space. If you want only host names, you can use
11053 the pseudo-type MXH:
11054 </para>
11055 <literallayout class="monospaced">
11056 ${lookup dnsdb{mxh=a.b.example}}
11057 </literallayout>
11058 <para>
11059 In this case, the preference values are omitted, and just the host names are
11060 returned.
11061 </para>
11062 <para>
11063 <indexterm role="concept">
11064 <primary>name server for enclosing domain</primary>
11065 </indexterm>
11066 Another pseudo-type is ZNS (for <quote>zone NS</quote>). It performs a lookup for NS
11067 records on the given domain, but if none are found, it removes the first
11068 component of the domain name, and tries again. This process continues until NS
11069 records are found or there are no more components left (or there is a DNS
11070 error). In other words, it may return the name servers for a top-level domain,
11071 but it never returns the root name servers. If there are no NS records for the
11072 top-level domain, the lookup fails. Consider these examples:
11073 </para>
11074 <literallayout class="monospaced">
11075 ${lookup dnsdb{zns=xxx.quercite.com}}
11076 ${lookup dnsdb{zns=xxx.edu}}
11077 </literallayout>
11078 <para>
11079 Assuming that in each case there are no NS records for the full domain name,
11080 the first returns the name servers for <option>quercite.com</option>, and the second returns
11081 the name servers for <option>edu</option>.
11082 </para>
11083 <para>
11084 You should be careful about how you use this lookup because, unless the
11085 top-level domain does not exist, the lookup always returns some host names. The
11086 sort of use to which this might be put is for seeing if the name servers for a
11087 given domain are on a blacklist. You can probably assume that the name servers
11088 for the high-level domains such as <option>com</option> or <option>co.uk</option> are not going to be on
11089 such a list.
11090 </para>
11091 <para>
11092 <indexterm role="concept">
11093 <primary>CSA</primary>
11094 <secondary>in <command>dnsdb</command> lookup</secondary>
11095 </indexterm>
11096 A third pseudo-type is CSA (Client SMTP Authorization). This looks up SRV
11097 records according to the CSA rules, which are described in section
11098 <xref linkend="SECTverifyCSA"/>. Although <command>dnsdb</command> supports SRV lookups directly, this is
11099 not sufficient because of the extra parent domain search behaviour of CSA. The
11100 result of a successful lookup such as:
11101 </para>
11102 <literallayout class="monospaced">
11103 ${lookup dnsdb {csa=$sender_helo_name}}
11104 </literallayout>
11105 <para>
11106 has two space-separated fields: an authorization code and a target host name.
11107 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
11108 authorization required but absent, or <quote>?</quote> for unknown.
11109 </para>
11110 <para>
11111 <indexterm role="concept">
11112 <primary>A+</primary>
11113 <secondary>in <command>dnsdb</command> lookup</secondary>
11114 </indexterm>
11115 The pseudo-type A+ performs an AAAA
11116 and then an A lookup.  All results are returned; defer processing
11117 (see below) is handled separately for each lookup.  Example:
11118 </para>
11119 <literallayout class="monospaced">
11120 ${lookup dnsdb {&gt;; a+=$sender_helo_name}}
11121 </literallayout>
11122 </section>
11123 <section id="SECID67">
11124 <title>Multiple dnsdb lookups</title>
11125 <para>
11126 In the previous sections, <command>dnsdb</command> lookups for a single domain are described.
11127 However, you can specify a list of domains or IP addresses in a single
11128 <command>dnsdb</command> lookup. The list is specified in the normal Exim way, with colon as
11129 the default separator, but with the ability to change this. For example:
11130 </para>
11131 <literallayout class="monospaced">
11132 ${lookup dnsdb{one.domain.com:two.domain.com}}
11133 ${lookup dnsdb{a=one.host.com:two.host.com}}
11134 ${lookup dnsdb{ptr = &lt;; 1.2.3.4 ; 4.5.6.8}}
11135 </literallayout>
11136 <para>
11137 In order to retain backwards compatibility, there is one special case: if
11138 the lookup type is PTR and no change of separator is specified, Exim looks
11139 to see if the rest of the string is precisely one IPv6 address. In this
11140 case, it does not treat it as a list.
11141 </para>
11142 <para>
11143 The data from each lookup is concatenated, with newline separators by default,
11144 in the same way that multiple DNS records for a single item are handled. A
11145 different separator can be specified, as described above.
11146 </para>
11147 </section>
11148 <section id="SECTldap">
11149 <title>More about LDAP</title>
11150 <para>
11151 <indexterm role="concept">
11152 <primary>LDAP</primary>
11153 <secondary>lookup, more about</secondary>
11154 </indexterm>
11155 <indexterm role="concept">
11156 <primary>lookup</primary>
11157 <secondary>LDAP</secondary>
11158 </indexterm>
11159 <indexterm role="concept">
11160 <primary>Solaris</primary>
11161 <secondary>LDAP</secondary>
11162 </indexterm>
11163 The original LDAP implementation came from the University of Michigan; this has
11164 become <quote>Open LDAP</quote>, and there are now two different releases. Another
11165 implementation comes from Netscape, and Solaris 7 and subsequent releases
11166 contain inbuilt LDAP support. Unfortunately, though these are all compatible at
11167 the lookup function level, their error handling is different. For this reason
11168 it is necessary to set a compile-time variable when building Exim with LDAP, to
11169 indicate which LDAP library is in use. One of the following should appear in
11170 your <filename>Local/Makefile</filename>:
11171 </para>
11172 <literallayout class="monospaced">
11173 LDAP_LIB_TYPE=UMICHIGAN
11174 LDAP_LIB_TYPE=OPENLDAP1
11175 LDAP_LIB_TYPE=OPENLDAP2
11176 LDAP_LIB_TYPE=NETSCAPE
11177 LDAP_LIB_TYPE=SOLARIS
11178 </literallayout>
11179 <para>
11180 If LDAP_LIB_TYPE is not set, Exim assumes <literal>OPENLDAP1</literal>, which has the
11181 same interface as the University of Michigan version.
11182 </para>
11183 <para>
11184 There are three LDAP lookup types in Exim. These behave slightly differently in
11185 the way they handle the results of a query:
11186 </para>
11187 <itemizedlist>
11188 <listitem>
11189 <para>
11190 <command>ldap</command> requires the result to contain just one entry; if there are more, it
11191 gives an error.
11192 </para>
11193 </listitem>
11194 <listitem>
11195 <para>
11196 <command>ldapdn</command> also requires the result to contain just one entry, but it is the
11197 Distinguished Name that is returned rather than any attribute values.
11198 </para>
11199 </listitem>
11200 <listitem>
11201 <para>
11202 <command>ldapm</command> permits the result to contain more than one entry; the attributes
11203 from all of them are returned.
11204 </para>
11205 </listitem>
11206 </itemizedlist>
11207 <para>
11208 For <command>ldap</command> and <command>ldapm</command>, if a query finds only entries with no attributes,
11209 Exim behaves as if the entry did not exist, and the lookup fails. The format of
11210 the data returned by a successful lookup is described in the next section.
11211 First we explain how LDAP queries are coded.
11212 </para>
11213 </section>
11214 <section id="SECTforldaque">
11215 <title>Format of LDAP queries</title>
11216 <para>
11217 <indexterm role="concept">
11218 <primary>LDAP</primary>
11219 <secondary>query format</secondary>
11220 </indexterm>
11221 An LDAP query takes the form of a URL as defined in RFC 2255. For example, in
11222 the configuration of a <command>redirect</command> router one might have this setting:
11223 </para>
11224 <literallayout class="monospaced">
11225 data = ${lookup ldap \
11226   {ldap:///cn=$local_part,o=University%20of%20Cambridge,\
11227   c=UK?mailbox?base?}}
11228 </literallayout>
11229 <para>
11230 <indexterm role="concept">
11231 <primary>LDAP</primary>
11232 <secondary>with TLS</secondary>
11233 </indexterm>
11234 The URL may begin with <literal>ldap</literal> or <literal>ldaps</literal> if your LDAP library supports
11235 secure (encrypted) LDAP connections. The second of these ensures that an
11236 encrypted TLS connection is used.
11237 </para>
11238 <para>
11239 With sufficiently modern LDAP libraries, Exim supports forcing TLS over regular
11240 LDAP connections, rather than the SSL-on-connect <literal>ldaps</literal>.
11241 See the <option>ldap_start_tls</option> option.
11242 </para>
11243 <para>
11244 Starting with Exim 4.83, the initialization of LDAP with TLS is more tightly
11245 controlled. Every part of the TLS configuration can be configured by settings in
11246 <filename>exim.conf</filename>. Depending on the version of the client libraries installed on
11247 your system, some of the initialization may have required setting options in
11248 <filename>/etc/ldap.conf</filename> or <filename>~/.ldaprc</filename> to get TLS working with self-signed
11249 certificates. This revealed a nuance where the current UID that exim was
11250 running as could affect which config files it read. With Exim 4.83, these
11251 methods become optional, only taking effect if not specifically set in
11252 <filename>exim.conf</filename>.
11253 </para>
11254 </section>
11255 <section id="SECID68">
11256 <title>LDAP quoting</title>
11257 <para>
11258 <indexterm role="concept">
11259 <primary>LDAP</primary>
11260 <secondary>quoting</secondary>
11261 </indexterm>
11262 Two levels of quoting are required in LDAP queries, the first for LDAP itself
11263 and the second because the LDAP query is represented as a URL. Furthermore,
11264 within an LDAP query, two different kinds of quoting are required. For this
11265 reason, there are two different LDAP-specific quoting operators.
11266 </para>
11267 <para>
11268 The <option>quote_ldap</option> operator is designed for use on strings that are part of
11269 filter specifications. Conceptually, it first does the following conversions on
11270 the string:
11271 </para>
11272 <literallayout class="monospaced">
11273 *   =&gt;   \2A
11274 (   =&gt;   \28
11275 )   =&gt;   \29
11276 \   =&gt;   \5C
11277 </literallayout>
11278 <para>
11279 in accordance with RFC 2254. The resulting string is then quoted according
11280 to the rules for URLs, that is, all non-alphanumeric characters except
11281 </para>
11282 <literallayout class="monospaced">
11283 ! $ ' - . _ ( ) * +
11284 </literallayout>
11285 <para>
11286 are converted to their hex values, preceded by a percent sign. For example:
11287 </para>
11288 <literallayout class="monospaced">
11289 ${quote_ldap: a(bc)*, a&lt;yz&gt;; }
11290 </literallayout>
11291 <para>
11292 yields
11293 </para>
11294 <literallayout class="monospaced">
11295 %20a%5C28bc%5C29%5C2A%2C%20a%3Cyz%3E%3B%20
11296 </literallayout>
11297 <para>
11298 Removing the URL quoting, this is (with a leading and a trailing space):
11299 </para>
11300 <literallayout class="monospaced">
11301 a\28bc\29\2A, a&lt;yz&gt;;
11302 </literallayout>
11303 <para>
11304 The <option>quote_ldap_dn</option> operator is designed for use on strings that are part of
11305 base DN specifications in queries. Conceptually, it first converts the string
11306 by inserting a backslash in front of any of the following characters:
11307 </para>
11308 <literallayout class="monospaced">
11309 , + " \ &lt; &gt; ;
11310 </literallayout>
11311 <para>
11312 It also inserts a backslash before any leading spaces or # characters, and
11313 before any trailing spaces. (These rules are in RFC 2253.) The resulting string
11314 is then quoted according to the rules for URLs. For example:
11315 </para>
11316 <literallayout class="monospaced">
11317 ${quote_ldap_dn: a(bc)*, a&lt;yz&gt;; }
11318 </literallayout>
11319 <para>
11320 yields
11321 </para>
11322 <literallayout class="monospaced">
11323 %5C%20a(bc)*%5C%2C%20a%5C%3Cyz%5C%3E%5C%3B%5C%20
11324 </literallayout>
11325 <para>
11326 Removing the URL quoting, this is (with a trailing space):
11327 </para>
11328 <literallayout class="monospaced">
11329 \ a(bc)*\, a\&lt;yz\&gt;\;\
11330 </literallayout>
11331 <para>
11332 There are some further comments about quoting in the section on LDAP
11333 authentication below.
11334 </para>
11335 </section>
11336 <section id="SECID69">
11337 <title>LDAP connections</title>
11338 <para>
11339 <indexterm role="concept">
11340 <primary>LDAP</primary>
11341 <secondary>connections</secondary>
11342 </indexterm>
11343 The connection to an LDAP server may either be over TCP/IP, or, when OpenLDAP
11344 is in use, via a Unix domain socket. The example given above does not specify
11345 an LDAP server. A server that is reached by TCP/IP can be specified in a query
11346 by starting it with
11347 </para>
11348 <literallayout class="monospaced">
11349 ldap://&lt;hostname&gt;:&lt;port&gt;/...
11350 </literallayout>
11351 <para>
11352 If the port (and preceding colon) are omitted, the standard LDAP port (389) is
11353 used. When no server is specified in a query, a list of default servers is
11354 taken from the <option>ldap_default_servers</option> configuration option. This supplies a
11355 colon-separated list of servers which are tried in turn until one successfully
11356 handles a query, or there is a serious error. Successful handling either
11357 returns the requested data, or indicates that it does not exist. Serious errors
11358 are syntactical, or multiple values when only a single value is expected.
11359 Errors which cause the next server to be tried are connection failures, bind
11360 failures, and timeouts.
11361 </para>
11362 <para>
11363 For each server name in the list, a port number can be given. The standard way
11364 of specifying a host and port is to use a colon separator (RFC 1738). Because
11365 <option>ldap_default_servers</option> is a colon-separated list, such colons have to be
11366 doubled. For example
11367 </para>
11368 <literallayout class="monospaced">
11369 ldap_default_servers = ldap1.example.com::145:ldap2.example.com
11370 </literallayout>
11371 <para>
11372 If <option>ldap_default_servers</option> is unset, a URL with no server name is passed
11373 to the LDAP library with no server name, and the library&#x2019;s default (normally
11374 the local host) is used.
11375 </para>
11376 <para>
11377 If you are using the OpenLDAP library, you can connect to an LDAP server using
11378 a Unix domain socket instead of a TCP/IP connection. This is specified by using
11379 <literal>ldapi</literal> instead of <literal>ldap</literal> in LDAP queries. What follows here applies only
11380 to OpenLDAP. If Exim is compiled with a different LDAP library, this feature is
11381 not available.
11382 </para>
11383 <para>
11384 For this type of connection, instead of a host name for the server, a pathname
11385 for the socket is required, and the port number is not relevant. The pathname
11386 can be specified either as an item in <option>ldap_default_servers</option>, or inline in
11387 the query. In the former case, you can have settings such as
11388 </para>
11389 <literallayout class="monospaced">
11390 ldap_default_servers = /tmp/ldap.sock : backup.ldap.your.domain
11391 </literallayout>
11392 <para>
11393 When the pathname is given in the query, you have to escape the slashes as
11394 <literal>%2F</literal> to fit in with the LDAP URL syntax. For example:
11395 </para>
11396 <literallayout class="monospaced">
11397 ${lookup ldap {ldapi://%2Ftmp%2Fldap.sock/o=...
11398 </literallayout>
11399 <para>
11400 When Exim processes an LDAP lookup and finds that the <quote>hostname</quote> is really
11401 a pathname, it uses the Unix domain socket code, even if the query actually
11402 specifies <literal>ldap</literal> or <literal>ldaps</literal>. In particular, no encryption is used for a
11403 socket connection. This behaviour means that you can use a setting of
11404 <option>ldap_default_servers</option> such as in the example above with traditional <literal>ldap</literal>
11405 or <literal>ldaps</literal> queries, and it will work. First, Exim tries a connection via
11406 the Unix domain socket; if that fails, it tries a TCP/IP connection to the
11407 backup host.
11408 </para>
11409 <para>
11410 If an explicit <literal>ldapi</literal> type is given in a query when a host name is
11411 specified, an error is diagnosed. However, if there are more items in
11412 <option>ldap_default_servers</option>, they are tried. In other words:
11413 </para>
11414 <itemizedlist>
11415 <listitem>
11416 <para>
11417 Using a pathname with <literal>ldap</literal> or <literal>ldaps</literal> forces the use of the Unix domain
11418 interface.
11419 </para>
11420 </listitem>
11421 <listitem>
11422 <para>
11423 Using <literal>ldapi</literal> with a host name causes an error.
11424 </para>
11425 </listitem>
11426 </itemizedlist>
11427 <para>
11428 Using <literal>ldapi</literal> with no host or path in the query, and no setting of
11429 <option>ldap_default_servers</option>, does whatever the library does by default.
11430 </para>
11431 </section>
11432 <section id="SECID70">
11433 <title>LDAP authentication and control information</title>
11434 <para>
11435 <indexterm role="concept">
11436 <primary>LDAP</primary>
11437 <secondary>authentication</secondary>
11438 </indexterm>
11439 The LDAP URL syntax provides no way of passing authentication and other control
11440 information to the server. To make this possible, the URL in an LDAP query may
11441 be preceded by any number of &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt; settings, separated by
11442 spaces. If a value contains spaces it must be enclosed in double quotes, and
11443 when double quotes are used, backslash is interpreted in the usual way inside
11444 them. The following names are recognized:
11445 </para>
11446 <literallayout>
11447 <literal>DEREFERENCE</literal>  set the dereferencing parameter
11448 <literal>NETTIME    </literal>  set a timeout for a network operation
11449 <literal>USER       </literal>  set the DN, for authenticating the LDAP bind
11450 <literal>PASS       </literal>  set the password, likewise
11451 <literal>REFERRALS  </literal>  set the referrals parameter
11452 <literal>SERVERS    </literal>  set alternate server list for this query only
11453 <literal>SIZE       </literal>  set the limit for the number of entries returned
11454 <literal>TIME       </literal>  set the maximum waiting time for a query
11455 </literallayout>
11456 <para>
11457 The value of the DEREFERENCE parameter must be one of the words <quote>never</quote>,
11458 <quote>searching</quote>, <quote>finding</quote>, or <quote>always</quote>. The value of the REFERRALS parameter
11459 must be <quote>follow</quote> (the default) or <quote>nofollow</quote>. The latter stops the LDAP
11460 library from trying to follow referrals issued by the LDAP server.
11461 </para>
11462 <para>
11463 <indexterm role="concept">
11464 <primary>LDAP</primary>
11465 <secondary>timeout</secondary>
11466 </indexterm>
11467 <indexterm role="concept">
11468 <primary>timeout</primary>
11469 <secondary>LDAP lookup</secondary>
11470 </indexterm>
11471 The name CONNECT is an obsolete name for NETTIME, retained for
11472 backwards compatibility. This timeout (specified as a number of seconds) is
11473 enforced from the client end for operations that can be carried out over a
11474 network. Specifically, it applies to network connections and calls to the
11475 <emphasis>ldap_result()</emphasis> function. If the value is greater than zero, it is used if
11476 LDAP_OPT_NETWORK_TIMEOUT is defined in the LDAP headers (OpenLDAP), or
11477 if LDAP_X_OPT_CONNECT_TIMEOUT is defined in the LDAP headers (Netscape
11478 SDK 4.1). A value of zero forces an explicit setting of <quote>no timeout</quote> for
11479 Netscape SDK; for OpenLDAP no action is taken.
11480 </para>
11481 <para>
11482 The TIME parameter (also a number of seconds) is passed to the server to
11483 set a server-side limit on the time taken to complete a search.
11484 </para>
11485 <para>
11486 The SERVERS parameter allows you to specify an alternate list of ldap servers
11487 to use for an individual lookup.  The global <option>ldap_default_servers</option> option provides a
11488 default list of ldap servers, and a single lookup can specify a single ldap
11489 server to use.  But when you need to do a lookup with a list of servers that is
11490 different than the default list (maybe different order, maybe a completely
11491 different set of servers), the SERVERS parameter allows you to specify this
11492 alternate list (colon-separated).
11493 </para>
11494 <para>
11495 Here is an example of an LDAP query in an Exim lookup that uses some of these
11496 values. This is a single line, folded to fit on the page:
11497 </para>
11498 <literallayout class="monospaced">
11499 ${lookup ldap
11500   {user="cn=manager,o=University of Cambridge,c=UK" pass=secret
11501   ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=foo)}
11502   {$value}fail}
11503 </literallayout>
11504 <para>
11505 The encoding of spaces as <literal>%20</literal> is a URL thing which should not be done for
11506 any of the auxiliary data. Exim configuration settings that include lookups
11507 which contain password information should be preceded by <quote>hide</quote> to prevent
11508 non-admin users from using the <option>-bP</option> option to see their values.
11509 </para>
11510 <para>
11511 The auxiliary data items may be given in any order. The default is no
11512 connection timeout (the system timeout is used), no user or password, no limit
11513 on the number of entries returned, and no time limit on queries.
11514 </para>
11515 <para>
11516 When a DN is quoted in the USER= setting for LDAP authentication, Exim
11517 removes any URL quoting that it may contain before passing it LDAP. Apparently
11518 some libraries do this for themselves, but some do not. Removing the URL
11519 quoting has two advantages:
11520 </para>
11521 <itemizedlist>
11522 <listitem>
11523 <para>
11524 It makes it possible to use the same <option>quote_ldap_dn</option> expansion for USER=
11525 DNs as with DNs inside actual queries.
11526 </para>
11527 </listitem>
11528 <listitem>
11529 <para>
11530 It permits spaces inside USER= DNs.
11531 </para>
11532 </listitem>
11533 </itemizedlist>
11534 <para>
11535 For example, a setting such as
11536 </para>
11537 <literallayout class="monospaced">
11538 USER=cn=${quote_ldap_dn:$1}
11539 </literallayout>
11540 <para>
11541 should work even if <varname>$1</varname> contains spaces.
11542 </para>
11543 <para>
11544 Expanded data for the PASS= value should be quoted using the <option>quote</option>
11545 expansion operator, rather than the LDAP quote operators. The only reason this
11546 field needs quoting is to ensure that it conforms to the Exim syntax, which
11547 does not allow unquoted spaces. For example:
11548 </para>
11549 <literallayout class="monospaced">
11550 PASS=${quote:$3}
11551 </literallayout>
11552 <para>
11553 The LDAP authentication mechanism can be used to check passwords as part of
11554 SMTP authentication. See the <option>ldapauth</option> expansion string condition in chapter
11555 <xref linkend="CHAPexpand"/>.
11556 </para>
11557 </section>
11558 <section id="SECID71">
11559 <title>Format of data returned by LDAP</title>
11560 <para>
11561 <indexterm role="concept">
11562 <primary>LDAP</primary>
11563 <secondary>returned data formats</secondary>
11564 </indexterm>
11565 The <command>ldapdn</command> lookup type returns the Distinguished Name from a single entry
11566 as a sequence of values, for example
11567 </para>
11568 <literallayout class="monospaced">
11569 cn=manager,o=University of Cambridge,c=UK
11570 </literallayout>
11571 <para>
11572 The <command>ldap</command> lookup type generates an error if more than one entry matches the
11573 search filter, whereas <command>ldapm</command> permits this case, and inserts a newline in
11574 the result between the data from different entries. It is possible for multiple
11575 values to be returned for both <command>ldap</command> and <command>ldapm</command>, but in the former case
11576 you know that whatever values are returned all came from a single entry in the
11577 directory.
11578 </para>
11579 <para>
11580 In the common case where you specify a single attribute in your LDAP query, the
11581 result is not quoted, and does not contain the attribute name. If the attribute
11582 has multiple values, they are separated by commas. Any comma that is
11583 part of an attribute&#x2019;s value is doubled.
11584 </para>
11585 <para>
11586 If you specify multiple attributes, the result contains space-separated, quoted
11587 strings, each preceded by the attribute name and an equals sign. Within the
11588 quotes, the quote character, backslash, and newline are escaped with
11589 backslashes, and commas are used to separate multiple values for the attribute.
11590 Any commas in attribute values are doubled
11591 (permitting treatment of the values as a comma-separated list).
11592 Apart from the escaping, the string within quotes takes the same form as the
11593 output when a single attribute is requested. Specifying no attributes is the
11594 same as specifying all of an entry&#x2019;s attributes.
11595 </para>
11596 <para>
11597 Here are some examples of the output format. The first line of each pair is an
11598 LDAP query, and the second is the data that is returned. The attribute called
11599 <option>attr1</option> has two values, one of them with an embedded comma, whereas
11600 <option>attr2</option> has only one value. Both attributes are derived from <option>attr</option>
11601 (they have SUP <option>attr</option> in their schema definitions).
11602 </para>
11603 <literallayout class="monospaced">
11604 ldap:///o=base?attr1?sub?(uid=fred)
11605 value1.1,value1,,2
11606
11607 ldap:///o=base?attr2?sub?(uid=fred)
11608 value two
11609
11610 ldap:///o=base?attr?sub?(uid=fred)
11611 value1.1,value1,,2,value two
11612
11613 ldap:///o=base?attr1,attr2?sub?(uid=fred)
11614 attr1="value1.1,value1,,2" attr2="value two"
11615
11616 ldap:///o=base??sub?(uid=fred)
11617 objectClass="top" attr1="value1.1,value1,,2" attr2="value two"
11618 </literallayout>
11619 <para>
11620 You can
11621 make use of Exim&#x2019;s <option>-be</option> option to run expansion tests and thereby check the
11622 results of LDAP lookups.
11623 The <option>extract</option> operator in string expansions can be used to pick out
11624 individual fields from data that consists of <emphasis>key</emphasis>=<emphasis>value</emphasis> pairs.
11625 The <option>listextract</option> operator should be used to pick out individual values
11626 of attributes, even when only a single value is expected.
11627 The doubling of embedded commas allows you to use the returned data as a
11628 comma separated list (using the "&lt;," syntax for changing the input list separator).
11629 </para>
11630 </section>
11631 <section id="SECTnisplus">
11632 <title>More about NIS+</title>
11633 <para>
11634 <indexterm role="concept">
11635 <primary>NIS+ lookup type</primary>
11636 </indexterm>
11637 <indexterm role="concept">
11638 <primary>lookup</primary>
11639 <secondary>NIS+</secondary>
11640 </indexterm>
11641 NIS+ queries consist of a NIS+ <emphasis>indexed name</emphasis> followed by an optional colon
11642 and field name. If this is given, the result of a successful query is the
11643 contents of the named field; otherwise the result consists of a concatenation
11644 of <emphasis>field-name=field-value</emphasis> pairs, separated by spaces. Empty values and
11645 values containing spaces are quoted. For example, the query
11646 </para>
11647 <literallayout class="monospaced">
11648 [name=mg1456],passwd.org_dir
11649 </literallayout>
11650 <para>
11651 might return the string
11652 </para>
11653 <literallayout class="monospaced">
11654 name=mg1456 passwd="" uid=999 gid=999 gcos="Martin Guerre"
11655 home=/home/mg1456 shell=/bin/bash shadow=""
11656 </literallayout>
11657 <para>
11658 (split over two lines here to fit on the page), whereas
11659 </para>
11660 <literallayout class="monospaced">
11661 [name=mg1456],passwd.org_dir:gcos
11662 </literallayout>
11663 <para>
11664 would just return
11665 </para>
11666 <literallayout class="monospaced">
11667 Martin Guerre
11668 </literallayout>
11669 <para>
11670 with no quotes. A NIS+ lookup fails if NIS+ returns more than one table entry
11671 for the given indexed key. The effect of the <option>quote_nisplus</option> expansion
11672 operator is to double any quote characters within the text.
11673 </para>
11674 </section>
11675 <section id="SECTsql">
11676 <title>SQL lookups</title>
11677 <para>
11678 <indexterm role="concept">
11679 <primary>SQL lookup types</primary>
11680 </indexterm>
11681 <indexterm role="concept">
11682 <primary>MySQL</primary>
11683 <secondary>lookup type</secondary>
11684 </indexterm>
11685 <indexterm role="concept">
11686 <primary>PostgreSQL lookup type</primary>
11687 </indexterm>
11688 <indexterm role="concept">
11689 <primary>lookup</primary>
11690 <secondary>MySQL</secondary>
11691 </indexterm>
11692 <indexterm role="concept">
11693 <primary>lookup</primary>
11694 <secondary>PostgreSQL</secondary>
11695 </indexterm>
11696 <indexterm role="concept">
11697 <primary>Oracle</primary>
11698 <secondary>lookup type</secondary>
11699 </indexterm>
11700 <indexterm role="concept">
11701 <primary>lookup</primary>
11702 <secondary>Oracle</secondary>
11703 </indexterm>
11704 <indexterm role="concept">
11705 <primary>InterBase lookup type</primary>
11706 </indexterm>
11707 <indexterm role="concept">
11708 <primary>lookup</primary>
11709 <secondary>InterBase</secondary>
11710 </indexterm>
11711 <indexterm role="concept">
11712 <primary>Redis lookup type</primary>
11713 </indexterm>
11714 <indexterm role="concept">
11715 <primary>lookup</primary>
11716 <secondary>Redis</secondary>
11717 </indexterm>
11718 Exim can support lookups in InterBase, MySQL, Oracle, PostgreSQL, Redis,
11719 and SQLite
11720 databases. Queries for these databases contain SQL statements, so an example
11721 might be
11722 </para>
11723 <literallayout class="monospaced">
11724 ${lookup mysql{select mailbox from users where id='userx'}\
11725   {$value}fail}
11726 </literallayout>
11727 <para>
11728 If the result of the query contains more than one field, the data for each
11729 field in the row is returned, preceded by its name, so the result of
11730 </para>
11731 <literallayout class="monospaced">
11732 ${lookup pgsql{select home,name from users where id='userx'}\
11733   {$value}}
11734 </literallayout>
11735 <para>
11736 might be
11737 </para>
11738 <literallayout class="monospaced">
11739 home=/home/userx name="Mister X"
11740 </literallayout>
11741 <para>
11742 Empty values and values containing spaces are double quoted, with embedded
11743 quotes escaped by a backslash. If the result of the query contains just one
11744 field, the value is passed back verbatim, without a field name, for example:
11745 </para>
11746 <literallayout class="monospaced">
11747 Mister X
11748 </literallayout>
11749 <para>
11750 If the result of the query yields more than one row, it is all concatenated,
11751 with a newline between the data for each row.
11752 </para>
11753 </section>
11754 <section id="SECID72">
11755 <title>More about MySQL, PostgreSQL, Oracle, InterBase, and Redis</title>
11756 <para>
11757 <indexterm role="concept">
11758 <primary>MySQL</primary>
11759 <secondary>lookup type</secondary>
11760 </indexterm>
11761 <indexterm role="concept">
11762 <primary>PostgreSQL lookup type</primary>
11763 </indexterm>
11764 <indexterm role="concept">
11765 <primary>lookup</primary>
11766 <secondary>MySQL</secondary>
11767 </indexterm>
11768 <indexterm role="concept">
11769 <primary>lookup</primary>
11770 <secondary>PostgreSQL</secondary>
11771 </indexterm>
11772 <indexterm role="concept">
11773 <primary>Oracle</primary>
11774 <secondary>lookup type</secondary>
11775 </indexterm>
11776 <indexterm role="concept">
11777 <primary>lookup</primary>
11778 <secondary>Oracle</secondary>
11779 </indexterm>
11780 <indexterm role="concept">
11781 <primary>InterBase lookup type</primary>
11782 </indexterm>
11783 <indexterm role="concept">
11784 <primary>lookup</primary>
11785 <secondary>InterBase</secondary>
11786 </indexterm>
11787 <indexterm role="concept">
11788 <primary>Redis lookup type</primary>
11789 </indexterm>
11790 <indexterm role="concept">
11791 <primary>lookup</primary>
11792 <secondary>Redis</secondary>
11793 </indexterm>
11794 If any MySQL, PostgreSQL, Oracle, InterBase or Redis lookups are used, the
11795 <option>mysql_servers</option>, <option>pgsql_servers</option>, <option>oracle_servers</option>, <option>ibase_servers</option>,
11796 or <option>redis_servers</option>
11797 option (as appropriate) must be set to a colon-separated list of server
11798 information.
11799 (For MySQL and PostgreSQL, the global option need not be set if all
11800 queries contain their own server information &ndash; see section
11801 <xref linkend="SECTspeserque"/>.)
11802 For all but Redis
11803 each item in the list is a slash-separated list of four
11804 items: host name, database name, user name, and password. In the case of
11805 Oracle, the host name field is used for the <quote>service name</quote>, and the database
11806 name field is not used and should be empty. For example:
11807 </para>
11808 <literallayout class="monospaced">
11809 hide oracle_servers = oracle.plc.example//userx/abcdwxyz
11810 </literallayout>
11811 <para>
11812 Because password data is sensitive, you should always precede the setting with
11813 <quote>hide</quote>, to prevent non-admin users from obtaining the setting via the <option>-bP</option>
11814 option. Here is an example where two MySQL servers are listed:
11815 </para>
11816 <literallayout class="monospaced">
11817 hide mysql_servers = localhost/users/root/secret:\
11818                      otherhost/users/root/othersecret
11819 </literallayout>
11820 <para>
11821 For MySQL and PostgreSQL, a host may be specified as &lt;<emphasis>name</emphasis>&gt;:&lt;<emphasis>port</emphasis>&gt; but
11822 because this is a colon-separated list, the colon has to be doubled. For each
11823 query, these parameter groups are tried in order until a connection is made and
11824 a query is successfully processed. The result of a query may be that no data is
11825 found, but that is still a successful query. In other words, the list of
11826 servers provides a backup facility, not a list of different places to look.
11827 </para>
11828 <para>
11829 For Redis the global option need not be specified if all queries contain their
11830 own server information &ndash; see section <xref linkend="SECTspeserque"/>.
11831 If specified, the option must be set to a colon-separated list of server
11832 information.
11833 Each item in the list is a slash-separated list of three items:
11834 host, database number, and password.
11835 </para>
11836 <orderedlist numeration="arabic">
11837 <listitem>
11838 <para>
11839 The host is required and may be either an IPv4 address and optional
11840 port number (separated by a colon, which needs doubling due to the
11841 higher-level list), or a Unix socket pathname enclosed in parentheses
11842 </para>
11843 </listitem>
11844 <listitem>
11845 <para>
11846 The database number is optional; if present that number is selected in the backend
11847 </para>
11848 </listitem>
11849 <listitem>
11850 <para>
11851 The password is optional; if present it is used to authenticate to the backend
11852 </para>
11853 </listitem>
11854 </orderedlist>
11855 <para>
11856 The <option>quote_mysql</option>, <option>quote_pgsql</option>, and <option>quote_oracle</option> expansion operators
11857 convert newline, tab, carriage return, and backspace to \n, \t, \r, and \b
11858 respectively, and the characters single-quote, double-quote, and backslash
11859 itself are escaped with backslashes.
11860 </para>
11861 <para>
11862 The <option>quote_redis</option> expansion operator
11863 escapes whitespace and backslash characters with a backslash.
11864 </para>
11865 </section>
11866 <section id="SECTspeserque">
11867 <title>Specifying the server in the query</title>
11868 <para>
11869 For MySQL, PostgreSQL and Redis lookups (but not currently for Oracle and InterBase),
11870 it is possible to specify a list of servers with an individual query. This is
11871 done by starting the query with
11872 </para>
11873 <literallayout>
11874 <literal>servers=</literal><emphasis>server1:server2:server3:...</emphasis><literal>;</literal>
11875 </literallayout>
11876 <para>
11877 Each item in the list may take one of two forms:
11878 </para>
11879 <orderedlist numeration="arabic">
11880 <listitem>
11881 <para>
11882 If it contains no slashes it is assumed to be just a host name. The appropriate
11883 global option (<option>mysql_servers</option> or <option>pgsql_servers</option>) is searched for a host
11884 of the same name, and the remaining parameters (database, user, password) are
11885 taken from there.
11886 </para>
11887 </listitem>
11888 <listitem>
11889 <para>
11890 If it contains any slashes, it is taken as a complete parameter set.
11891 </para>
11892 </listitem>
11893 </orderedlist>
11894 <para>
11895 The list of servers is used in exactly the same way as the global list.
11896 Once a connection to a server has happened and a query has been
11897 successfully executed, processing of the lookup ceases.
11898 </para>
11899 <para>
11900 This feature is intended for use in master/slave situations where updates
11901 are occurring and you want to update the master rather than a slave. If the
11902 master is in the list as a backup for reading, you might have a global setting
11903 like this:
11904 </para>
11905 <literallayout class="monospaced">
11906 mysql_servers = slave1/db/name/pw:\
11907                 slave2/db/name/pw:\
11908                 master/db/name/pw
11909 </literallayout>
11910 <para>
11911 In an updating lookup, you could then write:
11912 </para>
11913 <literallayout class="monospaced">
11914 ${lookup mysql{servers=master; UPDATE ...} }
11915 </literallayout>
11916 <para>
11917 That query would then be sent only to the master server. If, on the other hand,
11918 the master is not to be used for reading, and so is not present in the global
11919 option, you can still update it by a query of this form:
11920 </para>
11921 <literallayout class="monospaced">
11922 ${lookup pgsql{servers=master/db/name/pw; UPDATE ...} }
11923 </literallayout>
11924 </section>
11925 <section id="SECID73">
11926 <title>Special MySQL features</title>
11927 <para>
11928 For MySQL, an empty host name or the use of <quote>localhost</quote> in <option>mysql_servers</option>
11929 causes a connection to the server on the local host by means of a Unix domain
11930 socket. An alternate socket can be specified in parentheses.
11931 An option group name for MySQL option files can be specified in square brackets;
11932 the default value is <quote>exim</quote>.
11933 The full syntax of each item in <option>mysql_servers</option> is:
11934 </para>
11935 <literallayout>
11936 &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;
11937 </literallayout>
11938 <para>
11939 Any of the four sub-parts of the first field can be omitted. For normal use on
11940 the local host it can be left blank or set to just <quote>localhost</quote>.
11941 </para>
11942 <para>
11943 No database need be supplied &ndash; but if it is absent here, it must be given in
11944 the queries.
11945 </para>
11946 <para>
11947 If a MySQL query is issued that does not request any data (an insert, update,
11948 or delete command), the result of the lookup is the number of rows affected.
11949 </para>
11950 <para>
11951 <emphasis role="bold">Warning</emphasis>: This can be misleading. If an update does not actually change
11952 anything (for example, setting a field to the value it already has), the result
11953 is zero because no rows are affected.
11954 </para>
11955 </section>
11956 <section id="SECID74">
11957 <title>Special PostgreSQL features</title>
11958 <para>
11959 PostgreSQL lookups can also use Unix domain socket connections to the database.
11960 This is usually faster and costs less CPU time than a TCP/IP connection.
11961 However it can be used only if the mail server runs on the same machine as the
11962 database server. A configuration line for PostgreSQL via Unix domain sockets
11963 looks like this:
11964 </para>
11965 <literallayout class="monospaced">
11966 hide pgsql_servers = (/tmp/.s.PGSQL.5432)/db/user/password : ...
11967 </literallayout>
11968 <para>
11969 In other words, instead of supplying a host name, a path to the socket is
11970 given. The path name is enclosed in parentheses so that its slashes aren&#x2019;t
11971 visually confused with the delimiters for the other server parameters.
11972 </para>
11973 <para>
11974 If a PostgreSQL query is issued that does not request any data (an insert,
11975 update, or delete command), the result of the lookup is the number of rows
11976 affected.
11977 </para>
11978 </section>
11979 <section id="SECTsqlite">
11980 <title>More about SQLite</title>
11981 <para>
11982 <indexterm role="concept">
11983 <primary>lookup</primary>
11984 <secondary>SQLite</secondary>
11985 </indexterm>
11986 <indexterm role="concept">
11987 <primary>sqlite lookup type</primary>
11988 </indexterm>
11989 SQLite is different to the other SQL lookups because a filename is required in
11990 addition to the SQL query. An SQLite database is a single file, and there is no
11991 daemon as in the other SQL databases. The interface to Exim requires the name
11992 of the file, as an absolute path, to be given at the start of the query. It is
11993 separated from the query by white space. This means that the path name cannot
11994 contain white space. Here is a lookup expansion example:
11995 </para>
11996 <literallayout class="monospaced">
11997 ${lookup sqlite {/some/thing/sqlitedb \
11998   select name from aliases where id='userx';}}
11999 </literallayout>
12000 <para>
12001 In a list, the syntax is similar. For example:
12002 </para>
12003 <literallayout class="monospaced">
12004 domainlist relay_to_domains = sqlite;/some/thing/sqlitedb \
12005    select * from relays where ip='$sender_host_address';
12006 </literallayout>
12007 <para>
12008 The only character affected by the <option>quote_sqlite</option> operator is a single
12009 quote, which it doubles.
12010 </para>
12011 <para>
12012 <indexterm role="concept">
12013 <primary>timeout</primary>
12014 <secondary>SQLite</secondary>
12015 </indexterm>
12016 <indexterm role="concept">
12017 <primary>sqlite</primary>
12018 <secondary>lookup timeout</secondary>
12019 </indexterm>
12020 The SQLite library handles multiple simultaneous accesses to the database
12021 internally. Multiple readers are permitted, but only one process can
12022 update at once. Attempts to access the database while it is being updated
12023 are rejected after a timeout period, during which the SQLite library
12024 waits for the lock to be released. In Exim, the default timeout is set
12025 to 5 seconds, but it can be changed by means of the <option>sqlite_lock_timeout</option>
12026 option.
12027 </para>
12028 </section>
12029 <section id="SECTredis">
12030 <title>More about Redis</title>
12031 <para>
12032 <indexterm role="concept">
12033 <primary>lookup</primary>
12034 <secondary>Redis</secondary>
12035 </indexterm>
12036 <indexterm role="concept">
12037 <primary>redis lookup type</primary>
12038 </indexterm>
12039 Redis is a non-SQL database. Commands are simple get and set.
12040 Examples:
12041 </para>
12042 <literallayout class="monospaced">
12043 ${lookup redis{set keyname ${quote_redis:objvalue plus}}}
12044 ${lookup redis{get keyname}}
12045 </literallayout>
12046 <para>
12047 As of release 4.91, "lightweight" support for Redis Cluster is available.
12048 Requires <option>redis_servers</option> list to contain all the servers in the cluster, all
12049 of which must be reachable from the running exim instance. If the cluster has
12050 master/slave replication, the list must contain all the master and slave
12051 servers.
12052 </para>
12053 <para>
12054 When the Redis Cluster returns a "MOVED" response to a query, Exim does not
12055 immediately follow the redirection but treats the response as a DEFER, moving on
12056 to the next server in the <option>redis_servers</option> list until the correct server is
12057 reached.
12058 </para>
12059 <para>
12060 <indexterm role="concept" startref="IIDfidalo1" class="endofrange"/>
12061 <indexterm role="concept" startref="IIDfidalo2" class="endofrange"/>
12062 </para>
12063 </section>
12064 </chapter>
12065
12066 <chapter id="CHAPdomhosaddlists">
12067 <title>Domain, host, address, and local part lists</title>
12068 <titleabbrev>Domain, host, and address lists</titleabbrev>
12069 <para>
12070 <indexterm role="concept" id="IIDdohoadli" class="startofrange">
12071 <primary>lists of domains; hosts; etc.</primary>
12072 </indexterm>
12073 A number of Exim configuration options contain lists of domains, hosts,
12074 email addresses, or local parts. For example, the <option>hold_domains</option> option
12075 contains a list of domains whose delivery is currently suspended. These lists
12076 are also used as data in ACL statements (see chapter <xref linkend="CHAPACL"/>), and as
12077 arguments to expansion conditions such as <option>match_domain</option>.
12078 </para>
12079 <para>
12080 Each item in one of these lists is a pattern to be matched against a domain,
12081 host, email address, or local part, respectively. In the sections below, the
12082 different types of pattern for each case are described, but first we cover some
12083 general facilities that apply to all four kinds of list.
12084 </para>
12085 <para>
12086 Note that other parts of Exim use a <emphasis>string list</emphasis> which does not
12087 support all the complexity available in
12088 domain, host, address and local part lists.
12089 </para>
12090 <section id="SECTlistexpand">
12091 <title>Expansion of lists</title>
12092 <para>
12093 <indexterm role="concept">
12094 <primary>expansion</primary>
12095 <secondary>of lists</secondary>
12096 </indexterm>
12097 Each list is expanded as a single string before it is used.
12098 </para>
12099 <para>
12100 <emphasis>Exception: the router headers_remove option, where list-item
12101 splitting is done before string-expansion.</emphasis>
12102 </para>
12103 <para>
12104 The result of
12105 expansion must be a list, possibly containing empty items, which is split up
12106 into separate items for matching. By default, colon is the separator character,
12107 but this can be varied if necessary. See sections <xref linkend="SECTlistconstruct"/> and
12108 <xref linkend="SECTempitelis"/> for details of the list syntax; the second of these
12109 discusses the way to specify empty list items.
12110 </para>
12111 <para>
12112 If the string expansion is forced to fail, Exim behaves as if the item it is
12113 testing (domain, host, address, or local part) is not in the list. Other
12114 expansion failures cause temporary errors.
12115 </para>
12116 <para>
12117 If an item in a list is a regular expression, backslashes, dollars and possibly
12118 other special characters in the expression must be protected against
12119 misinterpretation by the string expander. The easiest way to do this is to use
12120 the <literal>\N</literal> expansion feature to indicate that the contents of the regular
12121 expression should not be expanded. For example, in an ACL you might have:
12122 </para>
12123 <literallayout class="monospaced">
12124 deny senders = \N^\d{8}\w@.*\.baddomain\.example$\N : \
12125                ${lookup{$domain}lsearch{/badsenders/bydomain}}
12126 </literallayout>
12127 <para>
12128 The first item is a regular expression that is protected from expansion by
12129 <literal>\N</literal>, whereas the second uses the expansion to obtain a list of unwanted
12130 senders based on the receiving domain.
12131 </para>
12132 </section>
12133 <section id="SECID76">
12134 <title>Negated items in lists</title>
12135 <para>
12136 <indexterm role="concept">
12137 <primary>list</primary>
12138 <secondary>negation</secondary>
12139 </indexterm>
12140 <indexterm role="concept">
12141 <primary>negation</primary>
12142 <secondary>in lists</secondary>
12143 </indexterm>
12144 Items in a list may be positive or negative. Negative items are indicated by a
12145 leading exclamation mark, which may be followed by optional white space. A list
12146 defines a set of items (domains, etc). When Exim processes one of these lists,
12147 it is trying to find out whether a domain, host, address, or local part
12148 (respectively) is in the set that is defined by the list. It works like this:
12149 </para>
12150 <para>
12151 The list is scanned from left to right. If a positive item is matched, the
12152 subject that is being checked is in the set; if a negative item is matched, the
12153 subject is not in the set. If the end of the list is reached without the
12154 subject having matched any of the patterns, it is in the set if the last item
12155 was a negative one, but not if it was a positive one. For example, the list in
12156 </para>
12157 <literallayout class="monospaced">
12158 domainlist relay_to_domains = !a.b.c : *.b.c
12159 </literallayout>
12160 <para>
12161 matches any domain ending in <emphasis>.b.c</emphasis> except for <emphasis>a.b.c</emphasis>. Domains that match
12162 neither <emphasis>a.b.c</emphasis> nor <emphasis>*.b.c</emphasis> do not match, because the last item in the
12163 list is positive. However, if the setting were
12164 </para>
12165 <literallayout class="monospaced">
12166 domainlist relay_to_domains = !a.b.c
12167 </literallayout>
12168 <para>
12169 then all domains other than <emphasis>a.b.c</emphasis> would match because the last item in the
12170 list is negative. In other words, a list that ends with a negative item behaves
12171 as if it had an extra item <literal>:*</literal> on the end.
12172 </para>
12173 <para>
12174 Another way of thinking about positive and negative items in lists is to read
12175 the connector as <quote>or</quote> after a positive item and as <quote>and</quote> after a negative
12176 item.
12177 </para>
12178 </section>
12179 <section id="SECTfilnamlis">
12180 <title>File names in lists</title>
12181 <para>
12182 <indexterm role="concept">
12183 <primary>list</primary>
12184 <secondary>filename in</secondary>
12185 </indexterm>
12186 If an item in a domain, host, address, or local part list is an absolute
12187 filename (beginning with a slash character), each line of the file is read and
12188 processed as if it were an independent item in the list, except that further
12189 filenames are not allowed,
12190 and no expansion of the data from the file takes place.
12191 Empty lines in the file are ignored, and the file may also contain comment
12192 lines:
12193 </para>
12194 <itemizedlist>
12195 <listitem>
12196 <para>
12197 For domain and host lists, if a # character appears anywhere in a line of the
12198 file, it and all following characters are ignored.
12199 </para>
12200 </listitem>
12201 <listitem>
12202 <para>
12203 Because local parts may legitimately contain # characters, a comment in an
12204 address list or local part list file is recognized only if # is preceded by
12205 white space or the start of the line. For example:
12206 </para>
12207 <literallayout class="monospaced">
12208 not#comment@x.y.z   # but this is a comment
12209 </literallayout>
12210 </listitem>
12211 </itemizedlist>
12212 <para>
12213 Putting a filename in a list has the same effect as inserting each line of the
12214 file as an item in the list (blank lines and comments excepted). However, there
12215 is one important difference: the file is read each time the list is processed,
12216 so if its contents vary over time, Exim&#x2019;s behaviour changes.
12217 </para>
12218 <para>
12219 If a filename is preceded by an exclamation mark, the sense of any match
12220 within the file is inverted. For example, if
12221 </para>
12222 <literallayout class="monospaced">
12223 hold_domains = !/etc/nohold-domains
12224 </literallayout>
12225 <para>
12226 and the file contains the lines
12227 </para>
12228 <literallayout class="monospaced">
12229 !a.b.c
12230 *.b.c
12231 </literallayout>
12232 <para>
12233 then <emphasis>a.b.c</emphasis> is in the set of domains defined by <option>hold_domains</option>, whereas
12234 any domain matching <literal>*.b.c</literal> is not.
12235 </para>
12236 </section>
12237 <section id="SECID77">
12238 <title>An lsearch file is not an out-of-line list</title>
12239 <para>
12240 As will be described in the sections that follow, lookups can be used in lists
12241 to provide indexed methods of checking list membership. There has been some
12242 confusion about the way <command>lsearch</command> lookups work in lists. Because
12243 an <command>lsearch</command> file contains plain text and is scanned sequentially, it is
12244 sometimes thought that it is allowed to contain wild cards and other kinds of
12245 non-constant pattern. This is not the case. The keys in an <command>lsearch</command> file are
12246 always fixed strings, just as for any other single-key lookup type.
12247 </para>
12248 <para>
12249 If you want to use a file to contain wild-card patterns that form part of a
12250 list, just give the filename on its own, without a search type, as described
12251 in the previous section. You could also use the <command>wildlsearch</command> or
12252 <command>nwildlsearch</command>, but there is no advantage in doing this.
12253 </para>
12254 </section>
12255 <section id="SECTnamedlists">
12256 <title>Named lists</title>
12257 <para>
12258 <indexterm role="concept">
12259 <primary>named lists</primary>
12260 </indexterm>
12261 <indexterm role="concept">
12262 <primary>list</primary>
12263 <secondary>named</secondary>
12264 </indexterm>
12265 A list of domains, hosts, email addresses, or local parts can be given a name
12266 which is then used to refer to the list elsewhere in the configuration. This is
12267 particularly convenient if the same list is required in several different
12268 places. It also allows lists to be given meaningful names, which can improve
12269 the readability of the configuration. For example, it is conventional to define
12270 a domain list called <emphasis>local_domains</emphasis> for all the domains that are handled
12271 locally on a host, using a configuration line such as
12272 </para>
12273 <literallayout class="monospaced">
12274 domainlist local_domains = localhost:my.dom.example
12275 </literallayout>
12276 <para>
12277 Named lists are referenced by giving their name preceded by a plus sign, so,
12278 for example, a router that is intended to handle local domains would be
12279 configured with the line
12280 </para>
12281 <literallayout class="monospaced">
12282 domains = +local_domains
12283 </literallayout>
12284 <para>
12285 The first router in a configuration is often one that handles all domains
12286 except the local ones, using a configuration with a negated item like this:
12287 </para>
12288 <literallayout class="monospaced">
12289 dnslookup:
12290   driver = dnslookup
12291   domains = ! +local_domains
12292   transport = remote_smtp
12293   no_more
12294 </literallayout>
12295 <para>
12296 The four kinds of named list are created by configuration lines starting with
12297 the words <option>domainlist</option>, <option>hostlist</option>, <option>addresslist</option>, or <option>localpartlist</option>,
12298 respectively. Then there follows the name that you are defining, followed by an
12299 equals sign and the list itself. For example:
12300 </para>
12301 <literallayout class="monospaced">
12302 hostlist    relay_from_hosts = 192.168.23.0/24 : my.friend.example
12303 addresslist bad_senders = cdb;/etc/badsenders
12304 </literallayout>
12305 <para>
12306 A named list may refer to other named lists:
12307 </para>
12308 <literallayout class="monospaced">
12309 domainlist  dom1 = first.example : second.example
12310 domainlist  dom2 = +dom1 : third.example
12311 domainlist  dom3 = fourth.example : +dom2 : fifth.example
12312 </literallayout>
12313 <para>
12314 <emphasis role="bold">Warning</emphasis>: If the last item in a referenced list is a negative one, the
12315 effect may not be what you intended, because the negation does not propagate
12316 out to the higher level. For example, consider:
12317 </para>
12318 <literallayout class="monospaced">
12319 domainlist  dom1 = !a.b
12320 domainlist  dom2 = +dom1 : *.b
12321 </literallayout>
12322 <para>
12323 The second list specifies <quote>either in the <option>dom1</option> list or <emphasis>*.b</emphasis></quote>. The first
12324 list specifies just <quote>not <emphasis>a.b</emphasis></quote>, so the domain <emphasis>x.y</emphasis> matches it. That
12325 means it matches the second list as well. The effect is not the same as
12326 </para>
12327 <literallayout class="monospaced">
12328 domainlist  dom2 = !a.b : *.b
12329 </literallayout>
12330 <para>
12331 where <emphasis>x.y</emphasis> does not match. It&#x2019;s best to avoid negation altogether in
12332 referenced lists if you can.
12333 </para>
12334 <para>
12335 Named lists may have a performance advantage. When Exim is routing an
12336 address or checking an incoming message, it caches the result of tests on named
12337 lists. So, if you have a setting such as
12338 </para>
12339 <literallayout class="monospaced">
12340 domains = +local_domains
12341 </literallayout>
12342 <para>
12343 on several of your routers
12344 or in several ACL statements,
12345 the actual test is done only for the first one. However, the caching works only
12346 if there are no expansions within the list itself or any sublists that it
12347 references. In other words, caching happens only for lists that are known to be
12348 the same each time they are referenced.
12349 </para>
12350 <para>
12351 By default, there may be up to 16 named lists of each type. This limit can be
12352 extended by changing a compile-time variable. The use of domain and host lists
12353 is recommended for concepts such as local domains, relay domains, and relay
12354 hosts. The default configuration is set up like this.
12355 </para>
12356 </section>
12357 <section id="SECID78">
12358 <title>Named lists compared with macros</title>
12359 <para>
12360 <indexterm role="concept">
12361 <primary>list</primary>
12362 <secondary>named compared with macro</secondary>
12363 </indexterm>
12364 <indexterm role="concept">
12365 <primary>macro</primary>
12366 <secondary>compared with named list</secondary>
12367 </indexterm>
12368 At first sight, named lists might seem to be no different from macros in the
12369 configuration file. However, macros are just textual substitutions. If you
12370 write
12371 </para>
12372 <literallayout class="monospaced">
12373 ALIST = host1 : host2
12374 auth_advertise_hosts = !ALIST
12375 </literallayout>
12376 <para>
12377 it probably won&#x2019;t do what you want, because that is exactly the same as
12378 </para>
12379 <literallayout class="monospaced">
12380 auth_advertise_hosts = !host1 : host2
12381 </literallayout>
12382 <para>
12383 Notice that the second host name is not negated. However, if you use a host
12384 list, and write
12385 </para>
12386 <literallayout class="monospaced">
12387 hostlist alist = host1 : host2
12388 auth_advertise_hosts = ! +alist
12389 </literallayout>
12390 <para>
12391 the negation applies to the whole list, and so that is equivalent to
12392 </para>
12393 <literallayout class="monospaced">
12394 auth_advertise_hosts = !host1 : !host2
12395 </literallayout>
12396 </section>
12397 <section id="SECID79">
12398 <title>Named list caching</title>
12399 <para>
12400 <indexterm role="concept">
12401 <primary>list</primary>
12402 <secondary>caching of named</secondary>
12403 </indexterm>
12404 <indexterm role="concept">
12405 <primary>caching</primary>
12406 <secondary>named lists</secondary>
12407 </indexterm>
12408 While processing a message, Exim caches the result of checking a named list if
12409 it is sure that the list is the same each time. In practice, this means that
12410 the cache operates only if the list contains no $ characters, which guarantees
12411 that it will not change when it is expanded. Sometimes, however, you may have
12412 an expanded list that you know will be the same each time within a given
12413 message. For example:
12414 </para>
12415 <literallayout class="monospaced">
12416 domainlist special_domains = \
12417            ${lookup{$sender_host_address}cdb{/some/file}}
12418 </literallayout>
12419 <para>
12420 This provides a list of domains that depends only on the sending host&#x2019;s IP
12421 address. If this domain list is referenced a number of times (for example,
12422 in several ACL lines, or in several routers) the result of the check is not
12423 cached by default, because Exim does not know that it is going to be the
12424 same list each time.
12425 </para>
12426 <para>
12427 By appending <literal>_cache</literal> to <literal>domainlist</literal> you can tell Exim to go ahead and
12428 cache the result anyway. For example:
12429 </para>
12430 <literallayout class="monospaced">
12431 domainlist_cache special_domains = ${lookup{...
12432 </literallayout>
12433 <para>
12434 If you do this, you should be absolutely sure that caching is going to do
12435 the right thing in all cases. When in doubt, leave it out.
12436 </para>
12437 </section>
12438 <section id="SECTdomainlist">
12439 <title>Domain lists</title>
12440 <para>
12441 <indexterm role="concept">
12442 <primary>domain list</primary>
12443 <secondary>patterns for</secondary>
12444 </indexterm>
12445 <indexterm role="concept">
12446 <primary>list</primary>
12447 <secondary>domain list</secondary>
12448 </indexterm>
12449 Domain lists contain patterns that are to be matched against a mail domain.
12450 The following types of item may appear in domain lists:
12451 </para>
12452 <itemizedlist>
12453 <listitem>
12454 <para>
12455 <indexterm role="concept">
12456 <primary>primary host name</primary>
12457 </indexterm>
12458 <indexterm role="concept">
12459 <primary>host name</primary>
12460 <secondary>matched in domain list</secondary>
12461 </indexterm>
12462 <indexterm role="option">
12463 <primary><option>primary_hostname</option></primary>
12464 </indexterm>
12465 <indexterm role="concept">
12466 <primary>domain list</primary>
12467 <secondary>matching primary host name</secondary>
12468 </indexterm>
12469 <indexterm role="concept">
12470 <primary>@ in a domain list</primary>
12471 </indexterm>
12472 If a pattern consists of a single @ character, it matches the local host name,
12473 as set by the <option>primary_hostname</option> option (or defaulted). This makes it
12474 possible to use the same configuration file on several different hosts that
12475 differ only in their names.
12476 </para>
12477 </listitem>
12478 <listitem>
12479 <para>
12480 <indexterm role="concept">
12481 <primary>@[] in a domain list</primary>
12482 </indexterm>
12483 <indexterm role="concept">
12484 <primary>domain list</primary>
12485 <secondary>matching local IP interfaces</secondary>
12486 </indexterm>
12487 <indexterm role="concept">
12488 <primary>domain literal</primary>
12489 </indexterm>
12490 If a pattern consists of the string <literal>@[]</literal> it matches an IP address enclosed
12491 in square brackets (as in an email address that contains a domain literal), but
12492 only if that IP address is recognized as local for email routing purposes. The
12493 <option>local_interfaces</option> and <option>extra_local_interfaces</option> options can be used to
12494 control which of a host&#x2019;s several IP addresses are treated as local.
12495 In today&#x2019;s Internet, the use of domain literals is controversial.
12496 </para>
12497 </listitem>
12498 <listitem>
12499 <para>
12500 <indexterm role="concept">
12501 <primary>@mx_any</primary>
12502 </indexterm>
12503 <indexterm role="concept">
12504 <primary>@mx_primary</primary>
12505 </indexterm>
12506 <indexterm role="concept">
12507 <primary>@mx_secondary</primary>
12508 </indexterm>
12509 <indexterm role="concept">
12510 <primary>domain list</primary>
12511 <secondary>matching MX pointers to local host</secondary>
12512 </indexterm>
12513 If a pattern consists of the string <literal>@mx_any</literal> it matches any domain that
12514 has an MX record pointing to the local host or to any host that is listed in
12515 <indexterm role="option">
12516 <primary><option>hosts_treat_as_local</option></primary>
12517 </indexterm>
12518 <option>hosts_treat_as_local</option>. The items <literal>@mx_primary</literal> and <literal>@mx_secondary</literal>
12519 are similar, except that the first matches only when a primary MX target is the
12520 local host, and the second only when no primary MX target is the local host,
12521 but a secondary MX target is. <quote>Primary</quote> means an MX record with the lowest
12522 preference value &ndash; there may of course be more than one of them.
12523 </para>
12524 <para>
12525 The MX lookup that takes place when matching a pattern of this type is
12526 performed with the resolver options for widening names turned off. Thus, for
12527 example, a single-component domain will <emphasis>not</emphasis> be expanded by adding the
12528 resolver&#x2019;s default domain. See the <option>qualify_single</option> and <option>search_parents</option>
12529 options of the <command>dnslookup</command> router for a discussion of domain widening.
12530 </para>
12531 <para>
12532 Sometimes you may want to ignore certain IP addresses when using one of these
12533 patterns. You can specify this by following the pattern with <literal>/ignore=</literal>&lt;<emphasis>ip
12534 list</emphasis>&gt;, where &lt;<emphasis>ip list</emphasis>&gt; is a list of IP addresses. These addresses are
12535 ignored when processing the pattern (compare the <option>ignore_target_hosts</option> option
12536 on a router). For example:
12537 </para>
12538 <literallayout class="monospaced">
12539 domains = @mx_any/ignore=127.0.0.1
12540 </literallayout>
12541 <para>
12542 This example matches any domain that has an MX record pointing to one of
12543 the local host&#x2019;s IP addresses other than 127.0.0.1.
12544 </para>
12545 <para>
12546 The list of IP addresses is in fact processed by the same code that processes
12547 host lists, so it may contain CIDR-coded network specifications and it may also
12548 contain negative items.
12549 </para>
12550 <para>
12551 Because the list of IP addresses is a sublist within a domain list, you have to
12552 be careful about delimiters if there is more than one address. Like any other
12553 list, the default delimiter can be changed. Thus, you might have:
12554 </para>
12555 <literallayout class="monospaced">
12556 domains = @mx_any/ignore=&lt;;127.0.0.1;0.0.0.0 : \
12557           an.other.domain : ...
12558 </literallayout>
12559 <para>
12560 so that the sublist uses semicolons for delimiters. When IPv6 addresses are
12561 involved, it is easiest to change the delimiter for the main list as well:
12562 </para>
12563 <literallayout class="monospaced">
12564 domains = &lt;? @mx_any/ignore=&lt;;127.0.0.1;::1 ? \
12565           an.other.domain ? ...
12566 </literallayout>
12567 </listitem>
12568 <listitem>
12569 <para>
12570 <indexterm role="concept">
12571 <primary>asterisk</primary>
12572 <secondary>in domain list</secondary>
12573 </indexterm>
12574 <indexterm role="concept">
12575 <primary>domain list</primary>
12576 <secondary>asterisk in</secondary>
12577 </indexterm>
12578 <indexterm role="concept">
12579 <primary>domain list</primary>
12580 <secondary>matching <quote>ends with</quote></secondary>
12581 </indexterm>
12582 If a pattern starts with an asterisk, the remaining characters of the pattern
12583 are compared with the terminating characters of the domain. The use of <quote>*</quote> in
12584 domain lists differs from its use in partial matching lookups. In a domain
12585 list, the character following the asterisk need not be a dot, whereas partial
12586 matching works only in terms of dot-separated components. For example, a domain
12587 list item such as <literal>*key.ex</literal> matches <emphasis>donkey.ex</emphasis> as well as
12588 <emphasis>cipher.key.ex</emphasis>.
12589 </para>
12590 </listitem>
12591 <listitem>
12592 <para>
12593 <indexterm role="concept">
12594 <primary>regular expressions</primary>
12595 <secondary>in domain list</secondary>
12596 </indexterm>
12597 <indexterm role="concept">
12598 <primary>domain list</primary>
12599 <secondary>matching regular expression</secondary>
12600 </indexterm>
12601 If a pattern starts with a circumflex character, it is treated as a regular
12602 expression, and matched against the domain using a regular expression matching
12603 function. The circumflex is treated as part of the regular expression.
12604 Email domains are case-independent, so this regular expression match is by
12605 default case-independent, but you can make it case-dependent by starting it
12606 with <literal>(?-i)</literal>. References to descriptions of the syntax of regular expressions
12607 are given in chapter <xref linkend="CHAPregexp"/>.
12608 </para>
12609 <para>
12610 <emphasis role="bold">Warning</emphasis>: Because domain lists are expanded before being processed, you
12611 must escape any backslash and dollar characters in the regular expression, or
12612 use the special <literal>\N</literal> sequence (see chapter <xref linkend="CHAPexpand"/>) to specify that
12613 it is not to be expanded (unless you really do want to build a regular
12614 expression by expansion, of course).
12615 </para>
12616 </listitem>
12617 <listitem>
12618 <para>
12619 <indexterm role="concept">
12620 <primary>lookup</primary>
12621 <secondary>in domain list</secondary>
12622 </indexterm>
12623 <indexterm role="concept">
12624 <primary>domain list</primary>
12625 <secondary>matching by lookup</secondary>
12626 </indexterm>
12627 If a pattern starts with the name of a single-key lookup type followed by a
12628 semicolon (for example, <quote>dbm;</quote> or <quote>lsearch;</quote>), the remainder of the pattern
12629 must be a filename in a suitable format for the lookup type. For example, for
12630 <quote>cdb;</quote> it must be an absolute path:
12631 </para>
12632 <literallayout class="monospaced">
12633 domains = cdb;/etc/mail/local_domains.cdb
12634 </literallayout>
12635 <para>
12636 The appropriate type of lookup is done on the file using the domain name as the
12637 key. In most cases, the data that is looked up is not used; Exim is interested
12638 only in whether or not the key is present in the file. However, when a lookup
12639 is used for the <option>domains</option> option on a router
12640 or a <option>domains</option> condition in an ACL statement, the data is preserved in the
12641 <varname>$domain_data</varname> variable and can be referred to in other router options or
12642 other statements in the same ACL.
12643 </para>
12644 </listitem>
12645 <listitem>
12646 <para>
12647 Any of the single-key lookup type names may be preceded by
12648 <literal>partial</literal>&lt;<emphasis>n</emphasis>&gt;<literal>-</literal>, where the &lt;<emphasis>n</emphasis>&gt; is optional, for example,
12649 </para>
12650 <literallayout class="monospaced">
12651 domains = partial-dbm;/partial/domains
12652 </literallayout>
12653 <para>
12654 This causes partial matching logic to be invoked; a description of how this
12655 works is given in section <xref linkend="SECTpartiallookup"/>.
12656 </para>
12657 </listitem>
12658 <listitem>
12659 <para>
12660 <indexterm role="concept">
12661 <primary>asterisk</primary>
12662 <secondary>in lookup type</secondary>
12663 </indexterm>
12664 Any of the single-key lookup types may be followed by an asterisk. This causes
12665 a default lookup for a key consisting of a single asterisk to be done if the
12666 original lookup fails. This is not a useful feature when using a domain list to
12667 select particular domains (because any domain would match), but it might have
12668 value if the result of the lookup is being used via the <varname>$domain_data</varname>
12669 expansion variable.
12670 </para>
12671 </listitem>
12672 <listitem>
12673 <para>
12674 If the pattern starts with the name of a query-style lookup type followed by a
12675 semicolon (for example, <quote>nisplus;</quote> or <quote>ldap;</quote>), the remainder of the
12676 pattern must be an appropriate query for the lookup type, as described in
12677 chapter <xref linkend="CHAPfdlookup"/>. For example:
12678 </para>
12679 <literallayout class="monospaced">
12680 hold_domains = mysql;select domain from holdlist \
12681   where domain = '${quote_mysql:$domain}';
12682 </literallayout>
12683 <para>
12684 In most cases, the data that is looked up is not used (so for an SQL query, for
12685 example, it doesn&#x2019;t matter what field you select). Exim is interested only in
12686 whether or not the query succeeds. However, when a lookup is used for the
12687 <option>domains</option> option on a router, the data is preserved in the <varname>$domain_data</varname>
12688 variable and can be referred to in other options.
12689 </para>
12690 </listitem>
12691 <listitem>
12692 <para>
12693 <indexterm role="concept">
12694 <primary>domain list</primary>
12695 <secondary>matching literal domain name</secondary>
12696 </indexterm>
12697 If none of the above cases apply, a caseless textual comparison is made
12698 between the pattern and the domain.
12699 </para>
12700 </listitem>
12701 </itemizedlist>
12702 <para>
12703 Here is an example that uses several different kinds of pattern:
12704 </para>
12705 <literallayout class="monospaced">
12706 domainlist funny_domains = \
12707   @ : \
12708   lib.unseen.edu : \
12709   *.foundation.fict.example : \
12710   \N^[1-2]\d{3}\.fict\.example$\N : \
12711   partial-dbm;/opt/data/penguin/book : \
12712   nis;domains.byname : \
12713   nisplus;[name=$domain,status=local],domains.org_dir
12714 </literallayout>
12715 <para>
12716 There are obvious processing trade-offs among the various matching modes. Using
12717 an asterisk is faster than a regular expression, and listing a few names
12718 explicitly probably is too. The use of a file or database lookup is expensive,
12719 but may be the only option if hundreds of names are required. Because the
12720 patterns are tested in order, it makes sense to put the most commonly matched
12721 patterns earlier.
12722 </para>
12723 </section>
12724 <section id="SECThostlist">
12725 <title>Host lists</title>
12726 <para>
12727 <indexterm role="concept">
12728 <primary>host list</primary>
12729 <secondary>patterns in</secondary>
12730 </indexterm>
12731 <indexterm role="concept">
12732 <primary>list</primary>
12733 <secondary>host list</secondary>
12734 </indexterm>
12735 Host lists are used to control what remote hosts are allowed to do. For
12736 example, some hosts may be allowed to use the local host as a relay, and some
12737 may be permitted to use the SMTP ETRN command. Hosts can be identified in
12738 two different ways, by name or by IP address. In a host list, some types of
12739 pattern are matched to a host name, and some are matched to an IP address.
12740 You need to be particularly careful with this when single-key lookups are
12741 involved, to ensure that the right value is being used as the key.
12742 </para>
12743 </section>
12744 <section id="SECID80">
12745 <title>Special host list patterns</title>
12746 <para>
12747 <indexterm role="concept">
12748 <primary>empty item in hosts list</primary>
12749 </indexterm>
12750 <indexterm role="concept">
12751 <primary>host list</primary>
12752 <secondary>empty string in</secondary>
12753 </indexterm>
12754 If a host list item is the empty string, it matches only when no remote host is
12755 involved. This is the case when a message is being received from a local
12756 process using SMTP on the standard input, that is, when a TCP/IP connection is
12757 not used.
12758 </para>
12759 <para>
12760 <indexterm role="concept">
12761 <primary>asterisk</primary>
12762 <secondary>in host list</secondary>
12763 </indexterm>
12764 The special pattern <quote>*</quote> in a host list matches any host or no host. Neither
12765 the IP address nor the name is actually inspected.
12766 </para>
12767 </section>
12768 <section id="SECThoslispatip">
12769 <title>Host list patterns that match by IP address</title>
12770 <para>
12771 <indexterm role="concept">
12772 <primary>host list</primary>
12773 <secondary>matching IP addresses</secondary>
12774 </indexterm>
12775 If an IPv4 host calls an IPv6 host and the call is accepted on an IPv6 socket,
12776 the incoming address actually appears in the IPv6 host as
12777 <literal>::ffff:</literal>&lt;<emphasis>v4address</emphasis>&gt;. When such an address is tested against a host
12778 list, it is converted into a traditional IPv4 address first. (Not all operating
12779 systems accept IPv4 calls on IPv6 sockets, as there have been some security
12780 concerns.)
12781 </para>
12782 <para>
12783 The following types of pattern in a host list check the remote host by
12784 inspecting its IP address:
12785 </para>
12786 <itemizedlist>
12787 <listitem>
12788 <para>
12789 If the pattern is a plain domain name (not a regular expression, not starting
12790 with *, not a lookup of any kind), Exim calls the operating system function
12791 to find the associated IP address(es). Exim uses the newer
12792 <function>getipnodebyname()</function> function when available, otherwise <function>gethostbyname()</function>.
12793 This typically causes a forward DNS lookup of the name. The result is compared
12794 with the IP address of the subject host.
12795 </para>
12796 <para>
12797 If there is a temporary problem (such as a DNS timeout) with the host name
12798 lookup, a temporary error occurs. For example, if the list is being used in an
12799 ACL condition, the ACL gives a <quote>defer</quote> response, usually leading to a
12800 temporary SMTP error code. If no IP address can be found for the host name,
12801 what happens is described in section <xref linkend="SECTbehipnot"/> below.
12802 </para>
12803 </listitem>
12804 <listitem>
12805 <para>
12806 <indexterm role="concept">
12807 <primary>@ in a host list</primary>
12808 </indexterm>
12809 If the pattern is <quote>@</quote>, the primary host name is substituted and used as a
12810 domain name, as just described.
12811 </para>
12812 </listitem>
12813 <listitem>
12814 <para>
12815 If the pattern is an IP address, it is matched against the IP address of the
12816 subject host. IPv4 addresses are given in the normal <quote>dotted-quad</quote> notation.
12817 IPv6 addresses can be given in colon-separated format, but the colons have to
12818 be doubled so as not to be taken as item separators when the default list
12819 separator is used. IPv6 addresses are recognized even when Exim is compiled
12820 without IPv6 support. This means that if they appear in a host list on an
12821 IPv4-only host, Exim will not treat them as host names. They are just addresses
12822 that can never match a client host.
12823 </para>
12824 </listitem>
12825 <listitem>
12826 <para>
12827 <indexterm role="concept">
12828 <primary>@[] in a host list</primary>
12829 </indexterm>
12830 If the pattern is <quote>@[]</quote>, it matches the IP address of any IP interface on
12831 the local host. For example, if the local host is an IPv4 host with one
12832 interface address 10.45.23.56, these two ACL statements have the same effect:
12833 </para>
12834 <literallayout class="monospaced">
12835 accept hosts = 127.0.0.1 : 10.45.23.56
12836 accept hosts = @[]
12837 </literallayout>
12838 </listitem>
12839 <listitem>
12840 <para>
12841 <indexterm role="concept">
12842 <primary>CIDR notation</primary>
12843 </indexterm>
12844 If the pattern is an IP address followed by a slash and a mask length (for
12845 example 10.11.42.0/24), it is matched against the IP address of the subject
12846 host under the given mask. This allows, an entire network of hosts to be
12847 included (or excluded) by a single item. The mask uses CIDR notation; it
12848 specifies the number of address bits that must match, starting from the most
12849 significant end of the address.
12850 </para>
12851 <para>
12852 <emphasis role="bold">Note</emphasis>: The mask is <emphasis>not</emphasis> a count of addresses, nor is it the high number
12853 of a range of addresses. It is the number of bits in the network portion of the
12854 address. The above example specifies a 24-bit netmask, so it matches all 256
12855 addresses in the 10.11.42.0 network. An item such as
12856 </para>
12857 <literallayout class="monospaced">
12858 192.168.23.236/31
12859 </literallayout>
12860 <para>
12861 matches just two addresses, 192.168.23.236 and 192.168.23.237. A mask value of
12862 32 for an IPv4 address is the same as no mask at all; just a single address
12863 matches.
12864 </para>
12865 <para>
12866 Here is another example which shows an IPv4 and an IPv6 network:
12867 </para>
12868 <literallayout class="monospaced">
12869 recipient_unqualified_hosts = 192.168.0.0/16: \
12870                               3ffe::ffff::836f::::/48
12871 </literallayout>
12872 <para>
12873 The doubling of list separator characters applies only when these items
12874 appear inline in a host list. It is not required when indirecting via a file.
12875 For example:
12876 </para>
12877 <literallayout class="monospaced">
12878 recipient_unqualified_hosts = /opt/exim/unqualnets
12879 </literallayout>
12880 <para>
12881 could make use of a file containing
12882 </para>
12883 <literallayout class="monospaced">
12884 172.16.0.0/12
12885 3ffe:ffff:836f::/48
12886 </literallayout>
12887 <para>
12888 to have exactly the same effect as the previous example. When listing IPv6
12889 addresses inline, it is usually more convenient to use the facility for
12890 changing separator characters. This list contains the same two networks:
12891 </para>
12892 <literallayout class="monospaced">
12893 recipient_unqualified_hosts = &lt;; 172.16.0.0/12; \
12894                                  3ffe:ffff:836f::/48
12895 </literallayout>
12896 <para>
12897 The separator is changed to semicolon by the leading <quote>&lt;;</quote> at the start of the
12898 list.
12899 </para>
12900 </listitem>
12901 </itemizedlist>
12902 </section>
12903 <section id="SECThoslispatsikey">
12904 <title>Host list patterns for single-key lookups by host address</title>
12905 <para>
12906 <indexterm role="concept">
12907 <primary>host list</primary>
12908 <secondary>lookup of IP address</secondary>
12909 </indexterm>
12910 When a host is to be identified by a single-key lookup of its complete IP
12911 address, the pattern takes this form:
12912 </para>
12913 <literallayout>
12914 <literal>net-&lt;</literal><emphasis>single-key-search-type</emphasis><literal>&gt;;&lt;</literal><emphasis>search-data</emphasis><literal>&gt;</literal>
12915 </literallayout>
12916 <para>
12917 For example:
12918 </para>
12919 <literallayout class="monospaced">
12920 hosts_lookup = net-cdb;/hosts-by-ip.db
12921 </literallayout>
12922 <para>
12923 The text form of the IP address of the subject host is used as the lookup key.
12924 IPv6 addresses are converted to an unabbreviated form, using lower case
12925 letters, with dots as separators because colon is the key terminator in
12926 <command>lsearch</command> files. [Colons can in fact be used in keys in <command>lsearch</command> files by
12927 quoting the keys, but this is a facility that was added later.] The data
12928 returned by the lookup is not used.
12929 </para>
12930 <para>
12931 <indexterm role="concept">
12932 <primary>IP address</primary>
12933 <secondary>masking</secondary>
12934 </indexterm>
12935 <indexterm role="concept">
12936 <primary>host list</primary>
12937 <secondary>masked IP address</secondary>
12938 </indexterm>
12939 Single-key lookups can also be performed using masked IP addresses, using
12940 patterns of this form:
12941 </para>
12942 <literallayout>
12943 <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>
12944 </literallayout>
12945 <para>
12946 For example:
12947 </para>
12948 <literallayout class="monospaced">
12949 net24-dbm;/networks.db
12950 </literallayout>
12951 <para>
12952 The IP address of the subject host is masked using &lt;<emphasis>number</emphasis>&gt; as the mask
12953 length. A textual string is constructed from the masked value, followed by the
12954 mask, and this is used as the lookup key. For example, if the host&#x2019;s IP address
12955 is 192.168.34.6, the key that is looked up for the above example is
12956 <quote>192.168.34.0/24</quote>.
12957 </para>
12958 <para>
12959 When an IPv6 address is converted to a string, dots are normally used instead
12960 of colons, so that keys in <command>lsearch</command> files need not contain colons (which
12961 terminate <command>lsearch</command> keys). This was implemented some time before the ability
12962 to quote keys was made available in <command>lsearch</command> files. However, the more
12963 recently implemented <command>iplsearch</command> files do require colons in IPv6 keys
12964 (notated using the quoting facility) so as to distinguish them from IPv4 keys.
12965 For this reason, when the lookup type is <command>iplsearch</command>, IPv6 addresses are
12966 converted using colons and not dots. In all cases, full, unabbreviated IPv6
12967 addresses are always used.
12968 </para>
12969 <para>
12970 Ideally, it would be nice to tidy up this anomalous situation by changing to
12971 colons in all cases, given that quoting is now available for <command>lsearch</command>.
12972 However, this would be an incompatible change that might break some existing
12973 configurations.
12974 </para>
12975 <para>
12976 <emphasis role="bold">Warning</emphasis>: Specifying <option>net32-</option> (for an IPv4 address) or <option>net128-</option> (for an
12977 IPv6 address) is not the same as specifying just <option>net-</option> without a number. In
12978 the former case the key strings include the mask value, whereas in the latter
12979 case the IP address is used on its own.
12980 </para>
12981 </section>
12982 <section id="SECThoslispatnam">
12983 <title>Host list patterns that match by host name</title>
12984 <para>
12985 <indexterm role="concept">
12986 <primary>host</primary>
12987 <secondary>lookup failures</secondary>
12988 </indexterm>
12989 <indexterm role="concept">
12990 <primary>unknown host name</primary>
12991 </indexterm>
12992 <indexterm role="concept">
12993 <primary>host list</primary>
12994 <secondary>matching host name</secondary>
12995 </indexterm>
12996 There are several types of pattern that require Exim to know the name of the
12997 remote host. These are either wildcard patterns or lookups by name. (If a
12998 complete hostname is given without any wildcarding, it is used to find an IP
12999 address to match against, as described in section <xref linkend="SECThoslispatip"/>
13000 above.)
13001 </para>
13002 <para>
13003 If the remote host name is not already known when Exim encounters one of these
13004 patterns, it has to be found from the IP address.
13005 Although many sites on the Internet are conscientious about maintaining reverse
13006 DNS data for their hosts, there are also many that do not do this.
13007 Consequently, a name cannot always be found, and this may lead to unwanted
13008 effects. Take care when configuring host lists with wildcarded name patterns.
13009 Consider what will happen if a name cannot be found.
13010 </para>
13011 <para>
13012 Because of the problems of determining host names from IP addresses, matching
13013 against host names is not as common as matching against IP addresses.
13014 </para>
13015 <para>
13016 By default, in order to find a host name, Exim first does a reverse DNS lookup;
13017 if no name is found in the DNS, the system function (<function>gethostbyaddr()</function> or
13018 <function>getipnodebyaddr()</function> if available) is tried. The order in which these lookups
13019 are done can be changed by setting the <option>host_lookup_order</option> option. For
13020 security, once Exim has found one or more names, it looks up the IP addresses
13021 for these names and compares them with the IP address that it started with.
13022 Only those names whose IP addresses match are accepted. Any other names are
13023 discarded. If no names are left, Exim behaves as if the host name cannot be
13024 found. In the most common case there is only one name and one IP address.
13025 </para>
13026 <para>
13027 There are some options that control what happens if a host name cannot be
13028 found. These are described in section <xref linkend="SECTbehipnot"/> below.
13029 </para>
13030 <para>
13031 <indexterm role="concept">
13032 <primary>host</primary>
13033 <secondary>alias for</secondary>
13034 </indexterm>
13035 <indexterm role="concept">
13036 <primary>alias for host</primary>
13037 </indexterm>
13038 As a result of aliasing, hosts may have more than one name. When processing any
13039 of the following types of pattern, all the host&#x2019;s names are checked:
13040 </para>
13041 <itemizedlist>
13042 <listitem>
13043 <para>
13044 <indexterm role="concept">
13045 <primary>asterisk</primary>
13046 <secondary>in host list</secondary>
13047 </indexterm>
13048 If a pattern starts with <quote>*</quote> the remainder of the item must match the end of
13049 the host name. For example, <literal>*.b.c</literal> matches all hosts whose names end in
13050 <emphasis>.b.c</emphasis>. This special simple form is provided because this is a very common
13051 requirement. Other kinds of wildcarding require the use of a regular
13052 expression.
13053 </para>
13054 </listitem>
13055 <listitem>
13056 <para>
13057 <indexterm role="concept">
13058 <primary>regular expressions</primary>
13059 <secondary>in host list</secondary>
13060 </indexterm>
13061 <indexterm role="concept">
13062 <primary>host list</primary>
13063 <secondary>regular expression in</secondary>
13064 </indexterm>
13065 If the item starts with <quote>^</quote> it is taken to be a regular expression which is
13066 matched against the host name. Host names are case-independent, so this regular
13067 expression match is by default case-independent, but you can make it
13068 case-dependent by starting it with <literal>(?-i)</literal>. References to descriptions of the
13069 syntax of regular expressions are given in chapter <xref linkend="CHAPregexp"/>. For
13070 example,
13071 </para>
13072 <literallayout class="monospaced">
13073 ^(a|b)\.c\.d$
13074 </literallayout>
13075 <para>
13076 is a regular expression that matches either of the two hosts <emphasis>a.c.d</emphasis> or
13077 <emphasis>b.c.d</emphasis>. When a regular expression is used in a host list, you must take care
13078 that backslash and dollar characters are not misinterpreted as part of the
13079 string expansion. The simplest way to do this is to use <literal>\N</literal> to mark that
13080 part of the string as non-expandable. For example:
13081 </para>
13082 <literallayout class="monospaced">
13083 sender_unqualified_hosts = \N^(a|b)\.c\.d$\N : ....
13084 </literallayout>
13085 <para>
13086 <emphasis role="bold">Warning</emphasis>: If you want to match a complete host name, you must include the
13087 <literal>$</literal> terminating metacharacter in the regular expression, as in the above
13088 example. Without it, a match at the start of the host name is all that is
13089 required.
13090 </para>
13091 </listitem>
13092 </itemizedlist>
13093 </section>
13094 <section id="SECTbehipnot">
13095 <title>Behaviour when an IP address or name cannot be found</title>
13096 <para>
13097 <indexterm role="concept">
13098 <primary>host</primary>
13099 <secondary>lookup failures, permanent</secondary>
13100 </indexterm>
13101 While processing a host list, Exim may need to look up an IP address from a
13102 name (see section <xref linkend="SECThoslispatip"/>), or it may need to look up a host name
13103 from an IP address (see section <xref linkend="SECThoslispatnam"/>). In either case, the
13104 behaviour when it fails to find the information it is seeking is the same.
13105 </para>
13106 <para>
13107 <emphasis role="bold">Note</emphasis>: This section applies to permanent lookup failures. It does <emphasis>not</emphasis>
13108 apply to temporary DNS errors, whose handling is described in the next section.
13109 </para>
13110 <para>
13111 <indexterm role="concept">
13112 <primary><literal>+include_unknown</literal></primary>
13113 </indexterm>
13114 <indexterm role="concept">
13115 <primary><literal>+ignore_unknown</literal></primary>
13116 </indexterm>
13117 Exim parses a host list from left to right. If it encounters a permanent
13118 lookup failure in any item in the host list before it has found a match,
13119 Exim treats it as a failure and the default behavior is as if the host
13120 does not match the list. This may not always be what you want to happen.
13121 To change Exim&#x2019;s behaviour, the special items <literal>+include_unknown</literal> or
13122 <literal>+ignore_unknown</literal> may appear in the list (at top level &ndash; they are
13123 not recognized in an indirected file).
13124 </para>
13125 <itemizedlist>
13126 <listitem>
13127 <para>
13128 If any item that follows <literal>+include_unknown</literal> requires information that
13129 cannot found, Exim behaves as if the host does match the list. For example,
13130 </para>
13131 <literallayout class="monospaced">
13132 host_reject_connection = +include_unknown:*.enemy.ex
13133 </literallayout>
13134 <para>
13135 rejects connections from any host whose name matches <literal>*.enemy.ex</literal>, and also
13136 any hosts whose name it cannot find.
13137 </para>
13138 </listitem>
13139 <listitem>
13140 <para>
13141 If any item that follows <literal>+ignore_unknown</literal> requires information that cannot
13142 be found, Exim ignores that item and proceeds to the rest of the list. For
13143 example:
13144 </para>
13145 <literallayout class="monospaced">
13146 accept hosts = +ignore_unknown : friend.example : \
13147                192.168.4.5
13148 </literallayout>
13149 <para>
13150 accepts from any host whose name is <emphasis>friend.example</emphasis> and from 192.168.4.5,
13151 whether or not its host name can be found. Without <literal>+ignore_unknown</literal>, if no
13152 name can be found for 192.168.4.5, it is rejected.
13153 </para>
13154 </listitem>
13155 </itemizedlist>
13156 <para>
13157 Both <literal>+include_unknown</literal> and <literal>+ignore_unknown</literal> may appear in the same
13158 list. The effect of each one lasts until the next, or until the end of the
13159 list.
13160 </para>
13161 </section>
13162 <section id="SECTmixwilhos">
13163 <title>Mixing wildcarded host names and addresses in host lists</title>
13164 <para>
13165 <indexterm role="concept">
13166 <primary>host list</primary>
13167 <secondary>mixing names and addresses in</secondary>
13168 </indexterm>
13169 </para>
13170 <para>
13171 This section explains the host/ip processing logic with the same concepts
13172 as the previous section, but specifically addresses what happens when a
13173 wildcarded hostname is one of the items in the hostlist.
13174 </para>
13175 <itemizedlist>
13176 <listitem>
13177 <para>
13178 If you have name lookups or wildcarded host names and
13179 IP addresses in the same host list, you should normally put the IP
13180 addresses first. For example, in an ACL you could have:
13181 </para>
13182 <literallayout class="monospaced">
13183 accept hosts = 10.9.8.7 : *.friend.example
13184 </literallayout>
13185 <para>
13186 The reason you normally would order it this way lies in the
13187 left-to-right way that Exim processes lists.  It can test IP addresses
13188 without doing any DNS lookups, but when it reaches an item that requires
13189 a host name, it fails if it cannot find a host name to compare with the
13190 pattern. If the above list is given in the opposite order, the
13191 <option>accept</option> statement fails for a host whose name cannot be found, even
13192 if its IP address is 10.9.8.7.
13193 </para>
13194 </listitem>
13195 <listitem>
13196 <para>
13197 If you really do want to do the name check first, and still recognize the IP
13198 address, you can rewrite the ACL like this:
13199 </para>
13200 <literallayout class="monospaced">
13201 accept hosts = *.friend.example
13202 accept hosts = 10.9.8.7
13203 </literallayout>
13204 <para>
13205 If the first <option>accept</option> fails, Exim goes on to try the second one. See chapter
13206 <xref linkend="CHAPACL"/> for details of ACLs. Alternatively, you can use
13207 <literal>+ignore_unknown</literal>, which was discussed in depth in the first example in
13208 this section.
13209 </para>
13210 </listitem>
13211 </itemizedlist>
13212 </section>
13213 <section id="SECTtemdnserr">
13214 <title>Temporary DNS errors when looking up host information</title>
13215 <para>
13216 <indexterm role="concept">
13217 <primary>host</primary>
13218 <secondary>lookup failures, temporary</secondary>
13219 </indexterm>
13220 <indexterm role="concept">
13221 <primary><literal>+include_defer</literal></primary>
13222 </indexterm>
13223 <indexterm role="concept">
13224 <primary><literal>+ignore_defer</literal></primary>
13225 </indexterm>
13226 A temporary DNS lookup failure normally causes a defer action (except when
13227 <option>dns_again_means_nonexist</option> converts it into a permanent error). However,
13228 host lists can include <literal>+ignore_defer</literal> and <literal>+include_defer</literal>, analogous to
13229 <literal>+ignore_unknown</literal> and <literal>+include_unknown</literal>, as described in the previous
13230 section. These options should be used with care, probably only in non-critical
13231 host lists such as whitelists.
13232 </para>
13233 </section>
13234 <section id="SECThoslispatnamsk">
13235 <title>Host list patterns for single-key lookups by host name</title>
13236 <para>
13237 <indexterm role="concept">
13238 <primary>unknown host name</primary>
13239 </indexterm>
13240 <indexterm role="concept">
13241 <primary>host list</primary>
13242 <secondary>matching host name</secondary>
13243 </indexterm>
13244 If a pattern is of the form
13245 </para>
13246 <literallayout>
13247 &lt;<emphasis>single-key-search-type</emphasis>&gt;;&lt;<emphasis>search-data</emphasis>&gt;
13248 </literallayout>
13249 <para>
13250 for example
13251 </para>
13252 <literallayout class="monospaced">
13253 dbm;/host/accept/list
13254 </literallayout>
13255 <para>
13256 a single-key lookup is performed, using the host name as its key. If the
13257 lookup succeeds, the host matches the item. The actual data that is looked up
13258 is not used.
13259 </para>
13260 <para>
13261 <emphasis role="bold">Reminder</emphasis>: With this kind of pattern, you must have host <emphasis>names</emphasis> as
13262 keys in the file, not IP addresses. If you want to do lookups based on IP
13263 addresses, you must precede the search type with <quote>net-</quote> (see section
13264 <xref linkend="SECThoslispatsikey"/>). There is, however, no reason why you could not use
13265 two items in the same list, one doing an address lookup and one doing a name
13266 lookup, both using the same file.
13267 </para>
13268 </section>
13269 <section id="SECID81">
13270 <title>Host list patterns for query-style lookups</title>
13271 <para>
13272 If a pattern is of the form
13273 </para>
13274 <literallayout>
13275 &lt;<emphasis>query-style-search-type</emphasis>&gt;;&lt;<emphasis>query</emphasis>&gt;
13276 </literallayout>
13277 <para>
13278 the query is obeyed, and if it succeeds, the host matches the item. The actual
13279 data that is looked up is not used. The variables <varname>$sender_host_address</varname> and
13280 <varname>$sender_host_name</varname> can be used in the query. For example:
13281 </para>
13282 <literallayout class="monospaced">
13283 hosts_lookup = pgsql;\
13284   select ip from hostlist where ip='$sender_host_address'
13285 </literallayout>
13286 <para>
13287 The value of <varname>$sender_host_address</varname> for an IPv6 address contains colons. You
13288 can use the <option>sg</option> expansion item to change this if you need to. If you want to
13289 use masked IP addresses in database queries, you can use the <option>mask</option> expansion
13290 operator.
13291 </para>
13292 <para>
13293 If the query contains a reference to <varname>$sender_host_name</varname>, Exim automatically
13294 looks up the host name if it has not already done so. (See section
13295 <xref linkend="SECThoslispatnam"/> for comments on finding host names.)
13296 </para>
13297 <para>
13298 Historical note: prior to release 4.30, Exim would always attempt to find a
13299 host name before running the query, unless the search type was preceded by
13300 <literal>net-</literal>. This is no longer the case. For backwards compatibility, <literal>net-</literal> is
13301 still recognized for query-style lookups, but its presence or absence has no
13302 effect. (Of course, for single-key lookups, <literal>net-</literal> <emphasis>is</emphasis> important.
13303 See section <xref linkend="SECThoslispatsikey"/>.)
13304 </para>
13305 </section>
13306 <section id="SECTaddresslist">
13307 <title>Address lists</title>
13308 <para>
13309 <indexterm role="concept">
13310 <primary>list</primary>
13311 <secondary>address list</secondary>
13312 </indexterm>
13313 <indexterm role="concept">
13314 <primary>address list</primary>
13315 <secondary>empty item</secondary>
13316 </indexterm>
13317 <indexterm role="concept">
13318 <primary>address list</primary>
13319 <secondary>patterns</secondary>
13320 </indexterm>
13321 Address lists contain patterns that are matched against mail addresses. There
13322 is one special case to be considered: the sender address of a bounce message is
13323 always empty. You can test for this by providing an empty item in an address
13324 list. For example, you can set up a router to process bounce messages by
13325 using this option setting:
13326 </para>
13327 <literallayout class="monospaced">
13328 senders = :
13329 </literallayout>
13330 <para>
13331 The presence of the colon creates an empty item. If you do not provide any
13332 data, the list is empty and matches nothing. The empty sender can also be
13333 detected by a regular expression that matches an empty string,
13334 and by a query-style lookup that succeeds when <varname>$sender_address</varname> is empty.
13335 </para>
13336 <para>
13337 Non-empty items in an address list can be straightforward email addresses. For
13338 example:
13339 </para>
13340 <literallayout class="monospaced">
13341 senders = jbc@askone.example : hs@anacreon.example
13342 </literallayout>
13343 <para>
13344 A certain amount of wildcarding is permitted. If a pattern contains an @
13345 character, but is not a regular expression and does not begin with a
13346 semicolon-terminated lookup type (described below), the local part of the
13347 subject address is compared with the local part of the pattern, which may start
13348 with an asterisk. If the local parts match, the domain is checked in exactly
13349 the same way as for a pattern in a domain list. For example, the domain can be
13350 wildcarded, refer to a named list, or be a lookup:
13351 </para>
13352 <literallayout class="monospaced">
13353 deny senders = *@*.spamming.site:\
13354                *@+hostile_domains:\
13355                bozo@partial-lsearch;/list/of/dodgy/sites:\
13356                *@dbm;/bad/domains.db
13357 </literallayout>
13358 <para>
13359 <indexterm role="concept">
13360 <primary>local part</primary>
13361 <secondary>starting with !</secondary>
13362 </indexterm>
13363 <indexterm role="concept">
13364 <primary>address list</primary>
13365 <secondary>local part starting with !</secondary>
13366 </indexterm>
13367 If a local part that begins with an exclamation mark is required, it has to be
13368 specified using a regular expression, because otherwise the exclamation mark is
13369 treated as a sign of negation, as is standard in lists.
13370 </para>
13371 <para>
13372 If a non-empty pattern that is not a regular expression or a lookup does not
13373 contain an @ character, it is matched against the domain part of the subject
13374 address. The only two formats that are recognized this way are a literal
13375 domain, or a domain pattern that starts with *. In both these cases, the effect
13376 is the same as if <literal>*@</literal> preceded the pattern. For example:
13377 </para>
13378 <literallayout class="monospaced">
13379 deny senders = enemy.domain : *.enemy.domain
13380 </literallayout>
13381 <para>
13382 The following kinds of more complicated address list pattern can match any
13383 address, including the empty address that is characteristic of bounce message
13384 senders:
13385 </para>
13386 <itemizedlist>
13387 <listitem>
13388 <para>
13389 <indexterm role="concept">
13390 <primary>regular expressions</primary>
13391 <secondary>in address list</secondary>
13392 </indexterm>
13393 <indexterm role="concept">
13394 <primary>address list</primary>
13395 <secondary>regular expression in</secondary>
13396 </indexterm>
13397 If (after expansion) a pattern starts with <quote>^</quote>, a regular expression match is
13398 done against the complete address, with the pattern as the regular expression.
13399 You must take care that backslash and dollar characters are not misinterpreted
13400 as part of the string expansion. The simplest way to do this is to use <literal>\N</literal>
13401 to mark that part of the string as non-expandable. For example:
13402 </para>
13403 <literallayout class="monospaced">
13404 deny senders = \N^.*this.*@example\.com$\N : \
13405                \N^\d{8}.+@spamhaus.example$\N : ...
13406 </literallayout>
13407 <para>
13408 The <literal>\N</literal> sequences are removed by the expansion, so these items do indeed
13409 start with <quote>^</quote> by the time they are being interpreted as address patterns.
13410 </para>
13411 </listitem>
13412 <listitem>
13413 <para>
13414 <indexterm role="concept">
13415 <primary>address list</primary>
13416 <secondary>lookup for complete address</secondary>
13417 </indexterm>
13418 Complete addresses can be looked up by using a pattern that starts with a
13419 lookup type terminated by a semicolon, followed by the data for the lookup. For
13420 example:
13421 </para>
13422 <literallayout class="monospaced">
13423 deny senders = cdb;/etc/blocked.senders : \
13424   mysql;select address from blocked where \
13425   address='${quote_mysql:$sender_address}'
13426 </literallayout>
13427 <para>
13428 Both query-style and single-key lookup types can be used. For a single-key
13429 lookup type, Exim uses the complete address as the key. However, empty keys are
13430 not supported for single-key lookups, so a match against the empty address
13431 always fails. This restriction does not apply to query-style lookups.
13432 </para>
13433 <para>
13434 Partial matching for single-key lookups (section <xref linkend="SECTpartiallookup"/>)
13435 cannot be used, and is ignored if specified, with an entry being written to the
13436 panic log.
13437 <indexterm role="concept">
13438 <primary>*@ with single-key lookup</primary>
13439 </indexterm>
13440 However, you can configure lookup defaults, as described in section
13441 <xref linkend="SECTdefaultvaluelookups"/>, but this is useful only for the <quote>*@</quote> type of
13442 default. For example, with this lookup:
13443 </para>
13444 <literallayout class="monospaced">
13445 accept senders = lsearch*@;/some/file
13446 </literallayout>
13447 <para>
13448 the file could contains lines like this:
13449 </para>
13450 <literallayout class="monospaced">
13451 user1@domain1.example
13452 *@domain2.example
13453 </literallayout>
13454 <para>
13455 and for the sender address <emphasis>nimrod@jaeger.example</emphasis>, the sequence of keys
13456 that are tried is:
13457 </para>
13458 <literallayout class="monospaced">
13459 nimrod@jaeger.example
13460 *@jaeger.example
13461 *
13462 </literallayout>
13463 <para>
13464 <emphasis role="bold">Warning 1</emphasis>: Do not include a line keyed by <quote>*</quote> in the file, because that
13465 would mean that every address matches, thus rendering the test useless.
13466 </para>
13467 <para>
13468 <emphasis role="bold">Warning 2</emphasis>: Do not confuse these two kinds of item:
13469 </para>
13470 <literallayout class="monospaced">
13471 deny recipients = dbm*@;/some/file
13472 deny recipients = *@dbm;/some/file
13473 </literallayout>
13474 <para>
13475 The first does a whole address lookup, with defaulting, as just described,
13476 because it starts with a lookup type. The second matches the local part and
13477 domain independently, as described in a bullet point below.
13478 </para>
13479 </listitem>
13480 </itemizedlist>
13481 <para>
13482 The following kinds of address list pattern can match only non-empty addresses.
13483 If the subject address is empty, a match against any of these pattern types
13484 always fails.
13485 </para>
13486 <itemizedlist>
13487 <listitem>
13488 <para>
13489 <indexterm role="concept">
13490 <primary>@@ with single-key lookup</primary>
13491 </indexterm>
13492 <indexterm role="concept">
13493 <primary>address list</primary>
13494 <secondary>@@ lookup type</secondary>
13495 </indexterm>
13496 <indexterm role="concept">
13497 <primary>address list</primary>
13498 <secondary>split local part and domain</secondary>
13499 </indexterm>
13500 If a pattern starts with <quote>@@</quote> followed by a single-key lookup item
13501 (for example, <literal>@@lsearch;/some/file</literal>), the address that is being checked is
13502 split into a local part and a domain. The domain is looked up in the file. If
13503 it is not found, there is no match. If it is found, the data that is looked up
13504 from the file is treated as a colon-separated list of local part patterns, each
13505 of which is matched against the subject local part in turn.
13506 </para>
13507 <para>
13508 <indexterm role="concept">
13509 <primary>asterisk</primary>
13510 <secondary>in address list</secondary>
13511 </indexterm>
13512 The lookup may be a partial one, and/or one involving a search for a default
13513 keyed by <quote>*</quote> (see section <xref linkend="SECTdefaultvaluelookups"/>). The local part
13514 patterns that are looked up can be regular expressions or begin with <quote>*</quote>, or
13515 even be further lookups. They may also be independently negated. For example,
13516 with
13517 </para>
13518 <literallayout class="monospaced">
13519 deny senders = @@dbm;/etc/reject-by-domain
13520 </literallayout>
13521 <para>
13522 the data from which the DBM file is built could contain lines like
13523 </para>
13524 <literallayout class="monospaced">
13525 baddomain.com:  !postmaster : *
13526 </literallayout>
13527 <para>
13528 to reject all senders except <option>postmaster</option> from that domain.
13529 </para>
13530 <para>
13531 <indexterm role="concept">
13532 <primary>local part</primary>
13533 <secondary>starting with !</secondary>
13534 </indexterm>
13535 If a local part that actually begins with an exclamation mark is required, it
13536 has to be specified using a regular expression. In <command>lsearch</command> files, an entry
13537 may be split over several lines by indenting the second and subsequent lines,
13538 but the separating colon must still be included at line breaks. White space
13539 surrounding the colons is ignored. For example:
13540 </para>
13541 <literallayout class="monospaced">
13542 aol.com:  spammer1 : spammer2 : ^[0-9]+$ :
13543   spammer3 : spammer4
13544 </literallayout>
13545 <para>
13546 As in all colon-separated lists in Exim, a colon can be included in an item by
13547 doubling.
13548 </para>
13549 <para>
13550 If the last item in the list starts with a right angle-bracket, the remainder
13551 of the item is taken as a new key to look up in order to obtain a continuation
13552 list of local parts. The new key can be any sequence of characters. Thus one
13553 might have entries like
13554 </para>
13555 <literallayout class="monospaced">
13556 aol.com: spammer1 : spammer 2 : &gt;*
13557 xyz.com: spammer3 : &gt;*
13558 *:       ^\d{8}$
13559 </literallayout>
13560 <para>
13561 in a file that was searched with <option>@@dbm*</option>, to specify a match for 8-digit
13562 local parts for all domains, in addition to the specific local parts listed for
13563 each domain. Of course, using this feature costs another lookup each time a
13564 chain is followed, but the effort needed to maintain the data is reduced.
13565 </para>
13566 <para>
13567 <indexterm role="concept">
13568 <primary>loop</primary>
13569 <secondary>in lookups</secondary>
13570 </indexterm>
13571 It is possible to construct loops using this facility, and in order to catch
13572 them, the chains may be no more than fifty items long.
13573 </para>
13574 </listitem>
13575 <listitem>
13576 <para>
13577 The @@&lt;<emphasis>lookup</emphasis>&gt; style of item can also be used with a query-style
13578 lookup, but in this case, the chaining facility is not available. The lookup
13579 can only return a single list of local parts.
13580 </para>
13581 </listitem>
13582 </itemizedlist>
13583 <para>
13584 <emphasis role="bold">Warning</emphasis>: There is an important difference between the address list items
13585 in these two examples:
13586 </para>
13587 <literallayout class="monospaced">
13588 senders = +my_list
13589 senders = *@+my_list
13590 </literallayout>
13591 <para>
13592 In the first one, <literal>my_list</literal> is a named address list, whereas in the second
13593 example it is a named domain list.
13594 </para>
13595 </section>
13596 <section id="SECTcasletadd">
13597 <title>Case of letters in address lists</title>
13598 <para>
13599 <indexterm role="concept">
13600 <primary>case of local parts</primary>
13601 </indexterm>
13602 <indexterm role="concept">
13603 <primary>address list</primary>
13604 <secondary>case forcing</secondary>
13605 </indexterm>
13606 <indexterm role="concept">
13607 <primary>case forcing in address lists</primary>
13608 </indexterm>
13609 Domains in email addresses are always handled caselessly, but for local parts
13610 case may be significant on some systems (see <option>caseful_local_part</option> for how
13611 Exim deals with this when routing addresses). However, RFC 2505 (<emphasis>Anti-Spam
13612 Recommendations for SMTP MTAs</emphasis>) suggests that matching of addresses to
13613 blocking lists should be done in a case-independent manner. Since most address
13614 lists in Exim are used for this kind of control, Exim attempts to do this by
13615 default.
13616 </para>
13617 <para>
13618 The domain portion of an address is always lowercased before matching it to an
13619 address list. The local part is lowercased by default, and any string
13620 comparisons that take place are done caselessly. This means that the data in
13621 the address list itself, in files included as plain filenames, and in any file
13622 that is looked up using the <quote>@@</quote> mechanism, can be in any case. However, the
13623 keys in files that are looked up by a search type other than <command>lsearch</command> (which
13624 works caselessly) must be in lower case, because these lookups are not
13625 case-independent.
13626 </para>
13627 <para>
13628 <indexterm role="concept">
13629 <primary><literal>+caseful</literal></primary>
13630 </indexterm>
13631 To allow for the possibility of caseful address list matching, if an item in
13632 an address list is the string <quote>+caseful</quote>, the original case of the local
13633 part is restored for any comparisons that follow, and string comparisons are no
13634 longer case-independent. This does not affect the domain, which remains in
13635 lower case. However, although independent matches on the domain alone are still
13636 performed caselessly, regular expressions that match against an entire address
13637 become case-sensitive after <quote>+caseful</quote> has been seen.
13638 </para>
13639 </section>
13640 <section id="SECTlocparlis">
13641 <title>Local part lists</title>
13642 <para>
13643 <indexterm role="concept">
13644 <primary>list</primary>
13645 <secondary>local part list</secondary>
13646 </indexterm>
13647 <indexterm role="concept">
13648 <primary>local part</primary>
13649 <secondary>list</secondary>
13650 </indexterm>
13651 Case-sensitivity in local part lists is handled in the same way as for address
13652 lists, as just described. The <quote>+caseful</quote> item can be used if required. In a
13653 setting of the <option>local_parts</option> option in a router with <option>caseful_local_part</option>
13654 set false, the subject is lowercased and the matching is initially
13655 case-insensitive. In this case, <quote>+caseful</quote> will restore case-sensitive
13656 matching in the local part list, but not elsewhere in the router. If
13657 <option>caseful_local_part</option> is set true in a router, matching in the <option>local_parts</option>
13658 option is case-sensitive from the start.
13659 </para>
13660 <para>
13661 If a local part list is indirected to a file (see section <xref linkend="SECTfilnamlis"/>),
13662 comments are handled in the same way as address lists &ndash; they are recognized
13663 only if the # is preceded by white space or the start of the line.
13664 Otherwise, local part lists are matched in the same way as domain lists, except
13665 that the special items that refer to the local host (<literal>@</literal>, <literal>@[]</literal>,
13666 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal>) are not recognized.
13667 Refer to section <xref linkend="SECTdomainlist"/> for details of the other available item
13668 types.
13669 <indexterm role="concept" startref="IIDdohoadli" class="endofrange"/>
13670 </para>
13671 </section>
13672 </chapter>
13673
13674 <chapter id="CHAPexpand">
13675 <title>String expansions</title>
13676 <para>
13677 <indexterm role="concept" id="IIDstrexp" class="startofrange">
13678 <primary>expansion</primary>
13679 <secondary>of strings</secondary>
13680 </indexterm>
13681 Many strings in Exim&#x2019;s runtime configuration are expanded before use. Some of
13682 them are expanded every time they are used; others are expanded only once.
13683 </para>
13684 <para>
13685 When a string is being expanded it is copied verbatim from left to right except
13686 when a dollar or backslash character is encountered. A dollar specifies the
13687 start of a portion of the string that is interpreted and replaced as described
13688 below in section <xref linkend="SECTexpansionitems"/> onwards. Backslash is used as an
13689 escape character, as described in the following section.
13690 </para>
13691 <para>
13692 Whether a string is expanded depends upon the context.  Usually this is solely
13693 dependent upon the option for which a value is sought; in this documentation,
13694 options for which string expansion is performed are marked with &dagger; after
13695 the data type.  ACL rules always expand strings.  A couple of expansion
13696 conditions do not expand some of the brace-delimited branches, for security
13697 reasons.
13698 </para>
13699 <section id="SECTlittext">
13700 <title>Literal text in expanded strings</title>
13701 <para>
13702 <indexterm role="concept">
13703 <primary>expansion</primary>
13704 <secondary>including literal text</secondary>
13705 </indexterm>
13706 An uninterpreted dollar can be included in an expanded string by putting a
13707 backslash in front of it. A backslash can be used to prevent any special
13708 character being treated specially in an expansion, including backslash itself.
13709 If the string appears in quotes in the configuration file, two backslashes are
13710 required because the quotes themselves cause interpretation of backslashes when
13711 the string is read in (see section <xref linkend="SECTstrings"/>).
13712 </para>
13713 <para>
13714 <indexterm role="concept">
13715 <primary>expansion</primary>
13716 <secondary>non-expandable substrings</secondary>
13717 </indexterm>
13718 A portion of the string can specified as non-expandable by placing it between
13719 two occurrences of <literal>\N</literal>. This is particularly useful for protecting regular
13720 expressions, which often contain backslashes and dollar signs. For example:
13721 </para>
13722 <literallayout class="monospaced">
13723 deny senders = \N^\d{8}[a-z]@some\.site\.example$\N
13724 </literallayout>
13725 <para>
13726 On encountering the first <literal>\N</literal>, the expander copies subsequent characters
13727 without interpretation until it reaches the next <literal>\N</literal> or the end of the
13728 string.
13729 </para>
13730 </section>
13731 <section id="SECID82">
13732 <title>Character escape sequences in expanded strings</title>
13733 <para>
13734 <indexterm role="concept">
13735 <primary>expansion</primary>
13736 <secondary>escape sequences</secondary>
13737 </indexterm>
13738 A backslash followed by one of the letters <quote>n</quote>, <quote>r</quote>, or <quote>t</quote> in an
13739 expanded string is recognized as an escape sequence for the character newline,
13740 carriage return, or tab, respectively. A backslash followed by up to three
13741 octal digits is recognized as an octal encoding for a single character, and a
13742 backslash followed by <quote>x</quote> and up to two hexadecimal digits is a hexadecimal
13743 encoding.
13744 </para>
13745 <para>
13746 These escape sequences are also recognized in quoted strings when they are read
13747 in. Their interpretation in expansions as well is useful for unquoted strings,
13748 and for other cases such as looked-up strings that are then expanded.
13749 </para>
13750 </section>
13751 <section id="SECID83">
13752 <title>Testing string expansions</title>
13753 <para>
13754 <indexterm role="concept">
13755 <primary>expansion</primary>
13756 <secondary>testing</secondary>
13757 </indexterm>
13758 <indexterm role="concept">
13759 <primary>testing</primary>
13760 <secondary>string expansion</secondary>
13761 </indexterm>
13762 <indexterm role="option">
13763 <primary><option>-be</option></primary>
13764 </indexterm>
13765 Many expansions can be tested by calling Exim with the <option>-be</option> option. This
13766 takes the command arguments, or lines from the standard input if there are no
13767 arguments, runs them through the string expansion code, and writes the results
13768 to the standard output. Variables based on configuration values are set up, but
13769 since no message is being processed, variables such as <varname>$local_part</varname> have no
13770 value. Nevertheless the <option>-be</option> option can be useful for checking out file and
13771 database lookups, and the use of expansion operators such as <option>sg</option>, <option>substr</option>
13772 and <option>nhash</option>.
13773 </para>
13774 <para>
13775 Exim gives up its root privilege when it is called with the <option>-be</option> option, and
13776 instead runs under the uid and gid it was called with, to prevent users from
13777 using <option>-be</option> for reading files to which they do not have access.
13778 </para>
13779 <para>
13780 <indexterm role="option">
13781 <primary><option>-bem</option></primary>
13782 </indexterm>
13783 If you want to test expansions that include variables whose values are taken
13784 from a message, there are two other options that can be used. The <option>-bem</option>
13785 option is like <option>-be</option> except that it is followed by a filename. The file is
13786 read as a message before doing the test expansions. For example:
13787 </para>
13788 <literallayout class="monospaced">
13789 exim -bem /tmp/test.message '$h_subject:'
13790 </literallayout>
13791 <para>
13792 The <option>-Mset</option> option is used in conjunction with <option>-be</option> and is followed by an
13793 Exim message identifier. For example:
13794 </para>
13795 <literallayout class="monospaced">
13796 exim -be -Mset 1GrA8W-0004WS-LQ '$recipients'
13797 </literallayout>
13798 <para>
13799 This loads the message from Exim&#x2019;s spool before doing the test expansions, and
13800 is therefore restricted to admin users.
13801 </para>
13802 </section>
13803 <section id="SECTforexpfai">
13804 <title>Forced expansion failure</title>
13805 <para>
13806 <indexterm role="concept">
13807 <primary>expansion</primary>
13808 <secondary>forced failure</secondary>
13809 </indexterm>
13810 A number of expansions that are described in the following section have
13811 alternative <quote>true</quote> and <quote>false</quote> substrings, enclosed in brace characters
13812 (which are sometimes called <quote>curly brackets</quote>). Which of the two strings is
13813 used depends on some condition that is evaluated as part of the expansion. If,
13814 instead of a <quote>false</quote> substring, the word <quote>fail</quote> is used (not in braces),
13815 the entire string expansion fails in a way that can be detected by the code
13816 that requested the expansion. This is called <quote>forced expansion failure</quote>, and
13817 its consequences depend on the circumstances. In some cases it is no different
13818 from any other expansion failure, but in others a different action may be
13819 taken. Such variations are mentioned in the documentation of the option that is
13820 being expanded.
13821 </para>
13822 </section>
13823 <section id="SECTexpansionitems">
13824 <title>Expansion items</title>
13825 <para>
13826 The following items are recognized in expanded strings. White space may be used
13827 between sub-items that are keywords or substrings enclosed in braces inside an
13828 outer set of braces, to improve readability. <emphasis role="bold">Warning</emphasis>: Within braces,
13829 white space is significant.
13830 </para>
13831 <variablelist>
13832 <varlistentry>
13833 <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>
13834 <listitem>
13835 <para>
13836 <indexterm role="concept">
13837 <primary>expansion</primary>
13838 <secondary>variables</secondary>
13839 </indexterm>
13840 Substitute the contents of the named variable, for example:
13841 </para>
13842 <literallayout class="monospaced">
13843 $local_part
13844 ${domain}
13845 </literallayout>
13846 <para>
13847 The second form can be used to separate the name from subsequent alphanumeric
13848 characters. This form (using braces) is available only for variables; it does
13849 <emphasis>not</emphasis> apply to message headers. The names of the variables are given in
13850 section <xref linkend="SECTexpvar"/> below. If the name of a non-existent variable is
13851 given, the expansion fails.
13852 </para>
13853 </listitem></varlistentry>
13854 <varlistentry>
13855 <term><emphasis role="bold">${</emphasis>&lt;<emphasis>op</emphasis>&gt;<emphasis role="bold">:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13856 <listitem>
13857 <para>
13858 <indexterm role="concept">
13859 <primary>expansion</primary>
13860 <secondary>operators</secondary>
13861 </indexterm>
13862 The string is first itself expanded, and then the operation specified by
13863 &lt;<emphasis>op</emphasis>&gt; is applied to it. For example:
13864 </para>
13865 <literallayout class="monospaced">
13866 ${lc:$local_part}
13867 </literallayout>
13868 <para>
13869 The string starts with the first character after the colon, which may be
13870 leading white space. A list of operators is given in section <xref linkend="SECTexpop"/>
13871 below. The operator notation is used for simple expansion items that have just
13872 one argument, because it reduces the number of braces and therefore makes the
13873 string easier to understand.
13874 </para>
13875 </listitem></varlistentry>
13876 <varlistentry>
13877 <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>
13878 <listitem>
13879 <para>
13880 This item inserts <quote>basic</quote> header lines. It is described with the <option>header</option>
13881 expansion item below.
13882 </para>
13883 </listitem></varlistentry>
13884 <varlistentry>
13885 <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>
13886 <listitem>
13887 <para>
13888 <indexterm role="concept">
13889 <primary>expansion</primary>
13890 <secondary>calling an acl</secondary>
13891 </indexterm>
13892 <indexterm role="concept">
13893 <primary><option>acl</option></primary>
13894 <secondary>call from expansion</secondary>
13895 </indexterm>
13896 The name and zero to nine argument strings are first expanded separately.  The expanded
13897 arguments are assigned to the variables <varname>$acl_arg1</varname> to <varname>$acl_arg9</varname> in order.
13898 Any unused are made empty.  The variable <varname>$acl_narg</varname> is set to the number of
13899 arguments.  The named ACL (see chapter <xref linkend="CHAPACL"/>) is called
13900 and may use the variables; if another acl expansion is used the values
13901 are restored after it returns.  If the ACL sets
13902 a value using a "message =" modifier and returns accept or deny, the value becomes
13903 the result of the expansion.
13904 If no message is set and the ACL returns accept or deny
13905 the expansion result is an empty string.
13906 If the ACL returns defer the result is a forced-fail.  Otherwise the expansion fails.
13907 </para>
13908 </listitem></varlistentry>
13909 <varlistentry>
13910 <term><emphasis role="bold">${authresults{</emphasis>&lt;<emphasis>authserv-id</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
13911 <listitem>
13912 <para>
13913 <indexterm role="concept">
13914 <primary>authentication</primary>
13915 <secondary>results header</secondary>
13916 </indexterm>
13917 <indexterm role="concept">
13918 <primary>headers</primary>
13919 <secondary>authentication-results:</secondary>
13920 </indexterm>
13921 <indexterm role="concept">
13922 <primary>authentication</primary>
13923 <secondary>expansion item</secondary>
13924 </indexterm>
13925 This item returns a string suitable for insertion as an
13926 <emphasis>Authentication-Results"</emphasis>
13927 header line.
13928 The given &lt;<emphasis>authserv-id</emphasis>&gt; is included in the result; typically this
13929 will be a domain name identifying the system performing the authentications.
13930 Methods that might be present in the result include:
13931 </para>
13932 <literallayout class="monospaced">
13933 none
13934 iprev
13935 auth
13936 spf
13937 dkim
13938 </literallayout>
13939 <para>
13940 Example use (as an ACL modifier):
13941 </para>
13942 <literallayout class="monospaced">
13943       add_header = :at_start:${authresults {$primary_hostname}}
13944 </literallayout>
13945 <para>
13946 This is safe even if no authentication results are available.
13947 </para>
13948 </listitem></varlistentry>
13949 <varlistentry>
13950 <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>
13951 <listitem>
13952 <para>
13953 <indexterm role="concept">
13954 <primary>expansion</primary>
13955 <secondary>extracting certificate fields</secondary>
13956 </indexterm>
13957 <indexterm role="concept">
13958 <primary><option>certextract</option></primary>
13959 <secondary>certificate fields</secondary>
13960 </indexterm>
13961 <indexterm role="concept">
13962 <primary>certificate</primary>
13963 <secondary>extracting fields</secondary>
13964 </indexterm>
13965 The &lt;<emphasis>certificate</emphasis>&gt; must be a variable of type certificate.
13966 The field name is expanded and used to retrieve the relevant field from
13967 the certificate.  Supported fields are:
13968 </para>
13969 <literallayout>
13970 <literal>version        </literal>
13971 <literal>serial_number  </literal>
13972 <literal>subject        </literal> RFC4514 DN
13973 <literal>issuer         </literal> RFC4514 DN
13974 <literal>notbefore      </literal> time
13975 <literal>notafter       </literal> time
13976 <literal>sig_algorithm  </literal>
13977 <literal>signature      </literal>
13978 <literal>subj_altname   </literal> tagged list
13979 <literal>ocsp_uri       </literal> list
13980 <literal>crl_uri        </literal> list
13981 </literallayout>
13982 <para>
13983 If the field is found,
13984 &lt;<emphasis>string2</emphasis>&gt; is expanded, and replaces the whole item;
13985 otherwise &lt;<emphasis>string3</emphasis>&gt; is used. During the expansion of &lt;<emphasis>string2</emphasis>&gt; the
13986 variable <varname>$value</varname> contains the value that has been extracted. Afterwards, it
13987 is restored to any previous value it might have had.
13988 </para>
13989 <para>
13990 If {&lt;<emphasis>string3</emphasis>&gt;} is omitted, the item is replaced by an empty string if the
13991 key is not found. If {&lt;<emphasis>string2</emphasis>&gt;} is also omitted, the value that was
13992 extracted is used.
13993 </para>
13994 <para>
13995 Some field names take optional modifiers, appended and separated by commas.
13996 </para>
13997 <para>
13998 The field selectors marked as "RFC4514" above
13999 output a Distinguished Name string which is
14000 not quite
14001 parseable by Exim as a comma-separated tagged list
14002 (the exceptions being elements containing commas).
14003 RDN elements of a single type may be selected by
14004 a modifier of the type label; if so the expansion
14005 result is a list (newline-separated by default).
14006 The separator may be changed by another modifier of
14007 a right angle-bracket followed immediately by the new separator.
14008 Recognised RDN type labels include "CN", "O", "OU" and "DC".
14009 </para>
14010 <para>
14011 The field selectors marked as "time" above
14012 take an optional modifier of "int"
14013 for which the result is the number of seconds since epoch.
14014 Otherwise the result is a human-readable string
14015 in the timezone selected by the main "timezone" option.
14016 </para>
14017 <para>
14018 The field selectors marked as "list" above return a list,
14019 newline-separated by default,
14020 (embedded separator characters in elements are doubled).
14021 The separator may be changed by a modifier of
14022 a right angle-bracket followed immediately by the new separator.
14023 </para>
14024 <para>
14025 The field selectors marked as "tagged" above
14026 prefix each list element with a type string and an equals sign.
14027 Elements of only one type may be selected by a modifier
14028 which is one of "dns", "uri" or "mail";
14029 if so the element tags are omitted.
14030 </para>
14031 <para>
14032 If not otherwise noted field values are presented in human-readable form.
14033 </para>
14034 </listitem></varlistentry>
14035 <varlistentry>
14036 <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>
14037 <listitem>
14038 <para>
14039 <indexterm role="concept">
14040 <primary><option>dlfunc</option></primary>
14041 </indexterm>
14042 This expansion dynamically loads and then calls a locally-written C function.
14043 This functionality is available only if Exim is compiled with
14044 </para>
14045 <literallayout class="monospaced">
14046 EXPAND_DLFUNC=yes
14047 </literallayout>
14048 <para>
14049 set in <filename>Local/Makefile</filename>. Once loaded, Exim remembers the dynamically loaded
14050 object so that it doesn&#x2019;t reload the same object file in the same Exim process
14051 (but of course Exim does start new processes frequently).
14052 </para>
14053 <para>
14054 There may be from zero to eight arguments to the function. When compiling
14055 a local function that is to be called in this way, <filename>local_scan.h</filename> should be
14056 included. The Exim variables and functions that are defined by that API
14057 are also available for dynamically loaded functions. The function itself
14058 must have the following type:
14059 </para>
14060 <literallayout class="monospaced">
14061 int dlfunction(uschar **yield, int argc, uschar *argv[])
14062 </literallayout>
14063 <para>
14064 Where <literal>uschar</literal> is a typedef for <literal>unsigned char</literal> in <filename>local_scan.h</filename>. The
14065 function should return one of the following values:
14066 </para>
14067 <para>
14068 <literal>OK</literal>: Success. The string that is placed in the variable <emphasis>yield</emphasis> is put
14069 into the expanded string that is being built.
14070 </para>
14071 <para>
14072 <literal>FAIL</literal>: A non-forced expansion failure occurs, with the error message taken
14073 from <emphasis>yield</emphasis>, if it is set.
14074 </para>
14075 <para>
14076 <literal>FAIL_FORCED</literal>: A forced expansion failure occurs, with the error message
14077 taken from <emphasis>yield</emphasis> if it is set.
14078 </para>
14079 <para>
14080 <literal>ERROR</literal>: Same as <literal>FAIL</literal>, except that a panic log entry is written.
14081 </para>
14082 <para>
14083 When compiling a function that is to be used in this way with gcc,
14084 you need to add <option>-shared</option> to the gcc command. Also, in the Exim build-time
14085 configuration, you must add <option>-export-dynamic</option> to EXTRALIBS.
14086 </para>
14087 </listitem></varlistentry>
14088 <varlistentry>
14089 <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>
14090 <listitem>
14091 <para>
14092 <indexterm role="concept">
14093 <primary>expansion</primary>
14094 <secondary>extracting value from environment</secondary>
14095 </indexterm>
14096 <indexterm role="concept">
14097 <primary>environment</primary>
14098 <secondary>values from</secondary>
14099 </indexterm>
14100 The key is first expanded separately, and leading and trailing white space
14101 removed.
14102 This is then searched for as a name in the environment.
14103 If a variable is found then its value is placed in <varname>$value</varname>
14104 and &lt;<emphasis>string1</emphasis>&gt; is expanded, otherwise &lt;<emphasis>string2</emphasis>&gt; is expanded.
14105 </para>
14106 <para>
14107 Instead of {&lt;<emphasis>string2</emphasis>&gt;} the word <quote>fail</quote> (not in curly brackets) can
14108 appear, for example:
14109 </para>
14110 <literallayout class="monospaced">
14111 ${env{USER}{$value} fail }
14112 </literallayout>
14113 <para>
14114 This forces an expansion failure (see section <xref linkend="SECTforexpfai"/>);
14115 {&lt;<emphasis>string1</emphasis>&gt;} must be present for <quote>fail</quote> to be recognized.
14116 </para>
14117 <para>
14118 If {&lt;<emphasis>string2</emphasis>&gt;} is omitted an empty string is substituted on
14119 search failure.
14120 If {&lt;<emphasis>string1</emphasis>&gt;} is omitted the search result is substituted on
14121 search success.
14122 </para>
14123 <para>
14124 The environment is adjusted by the <option>keep_environment</option> and
14125 <option>add_environment</option> main section options.
14126 </para>
14127 </listitem></varlistentry>
14128 <varlistentry>
14129 <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>
14130 <listitem>
14131 <para>
14132 <indexterm role="concept">
14133 <primary>expansion</primary>
14134 <secondary>extracting substrings by key</secondary>
14135 </indexterm>
14136 <indexterm role="concept">
14137 <primary><option>extract</option></primary>
14138 <secondary>substrings by key</secondary>
14139 </indexterm>
14140 The key and &lt;<emphasis>string1</emphasis>&gt; are first expanded separately. Leading and trailing
14141 white space is removed from the key (but not from any of the strings). The key
14142 must not be empty and must not consist entirely of digits.
14143 The expanded &lt;<emphasis>string1</emphasis>&gt; must be of the form:
14144 </para>
14145 <literallayout>
14146 &lt;<emphasis>key1</emphasis>&gt; = &lt;<emphasis>value1</emphasis>&gt;  &lt;<emphasis>key2</emphasis>&gt; = &lt;<emphasis>value2</emphasis>&gt; ...
14147 </literallayout>
14148 <para>
14149 <indexterm role="variable">
14150 <primary><varname>$value</varname></primary>
14151 </indexterm>
14152 where the equals signs and spaces (but not both) are optional. If any of the
14153 values contain white space, they must be enclosed in double quotes, and any
14154 values that are enclosed in double quotes are subject to escape processing as
14155 described in section <xref linkend="SECTstrings"/>. The expanded &lt;<emphasis>string1</emphasis>&gt; is searched
14156 for the value that corresponds to the key. The search is case-insensitive. If
14157 the key is found, &lt;<emphasis>string2</emphasis>&gt; is expanded, and replaces the whole item;
14158 otherwise &lt;<emphasis>string3</emphasis>&gt; is used. During the expansion of &lt;<emphasis>string2</emphasis>&gt; the
14159 variable <varname>$value</varname> contains the value that has been extracted. Afterwards, it
14160 is restored to any previous value it might have had.
14161 </para>
14162 <para>
14163 If {&lt;<emphasis>string3</emphasis>&gt;} is omitted, the item is replaced by an empty string if the
14164 key is not found. If {&lt;<emphasis>string2</emphasis>&gt;} is also omitted, the value that was
14165 extracted is used. Thus, for example, these two expansions are identical, and
14166 yield <quote>2001</quote>:
14167 </para>
14168 <literallayout class="monospaced">
14169 ${extract{gid}{uid=1984 gid=2001}}
14170 ${extract{gid}{uid=1984 gid=2001}{$value}}
14171 </literallayout>
14172 <para>
14173 Instead of {&lt;<emphasis>string3</emphasis>&gt;} the word <quote>fail</quote> (not in curly brackets) can
14174 appear, for example:
14175 </para>
14176 <literallayout class="monospaced">
14177 ${extract{Z}{A=... B=...}{$value} fail }
14178 </literallayout>
14179 <para>
14180 This forces an expansion failure (see section <xref linkend="SECTforexpfai"/>);
14181 {&lt;<emphasis>string2</emphasis>&gt;} must be present for <quote>fail</quote> to be recognized.
14182 </para>
14183 </listitem></varlistentry>
14184 <varlistentry revisionflag="changed">
14185 <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>
14186 <listitem>
14187 <para revisionflag="changed">
14188 <indexterm role="concept">
14189 <primary>expansion</primary>
14190 <secondary>extracting from JSON object</secondary>
14191 </indexterm>
14192 <indexterm role="concept">
14193 <primary>JSON</primary>
14194 <secondary>expansions</secondary>
14195 </indexterm>
14196 The key and &lt;<emphasis>string1</emphasis>&gt; are first expanded separately. Leading and trailing
14197 white space is removed from the key (but not from any of the strings). The key
14198 must not be empty and must not consist entirely of digits.
14199 The expanded &lt;<emphasis>string1</emphasis>&gt; must be of the form:
14200 </para>
14201 <literallayout revisionflag="changed">
14202 { &lt;<emphasis>"key1"</emphasis>&gt; : &lt;<emphasis>value1</emphasis>&gt; ,  &lt;<emphasis>"key2"</emphasis>&gt; , &lt;<emphasis>value2</emphasis>&gt; ... }
14203 </literallayout>
14204 <para revisionflag="changed">
14205 <indexterm role="variable">
14206 <primary><varname>$value</varname></primary>
14207 </indexterm>
14208 The braces, commas and colons, and the quoting of the member name are required;
14209 the spaces are optional.
14210 Matching of the key against the member names is done case-sensitively.
14211 </para>
14212 <para revisionflag="changed">
14213 The results of matching are handled as above.
14214 </para>
14215 </listitem></varlistentry>
14216 <varlistentry>
14217 <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>
14218 <listitem>
14219 <para>
14220 <indexterm role="concept">
14221 <primary>expansion</primary>
14222 <secondary>extracting substrings by number</secondary>
14223 </indexterm>
14224 <indexterm role="concept">
14225 <primary><option>extract</option></primary>
14226 <secondary>substrings by number</secondary>
14227 </indexterm>
14228 The &lt;<emphasis>number</emphasis>&gt; argument must consist entirely of decimal digits,
14229 apart from leading and trailing white space, which is ignored.
14230 This is what distinguishes this form of <option>extract</option> from the previous kind. It
14231 behaves in the same way, except that, instead of extracting a named field, it
14232 extracts from &lt;<emphasis>string1</emphasis>&gt; the field whose number is given as the first
14233 argument. You can use <varname>$value</varname> in &lt;<emphasis>string2</emphasis>&gt; or <literal>fail</literal> instead of
14234 &lt;<emphasis>string3</emphasis>&gt; as before.
14235 </para>
14236 <para>
14237 The fields in the string are separated by any one of the characters in the
14238 separator string. These may include space or tab characters.
14239 The first field is numbered one. If the number is negative, the fields are
14240 counted from the end of the string, with the rightmost one numbered -1. If the
14241 number given is zero, the entire string is returned. If the modulus of the
14242 number is greater than the number of fields in the string, the result is the
14243 expansion of &lt;<emphasis>string3</emphasis>&gt;, or the empty string if &lt;<emphasis>string3</emphasis>&gt; is not
14244 provided. For example:
14245 </para>
14246 <literallayout class="monospaced">
14247 ${extract{2}{:}{x:42:99:&amp; Mailer::/bin/bash}}
14248 </literallayout>
14249 <para>
14250 yields <quote>42</quote>, and
14251 </para>
14252 <literallayout class="monospaced">
14253 ${extract{-4}{:}{x:42:99:&amp; Mailer::/bin/bash}}
14254 </literallayout>
14255 <para>
14256 yields <quote>99</quote>. Two successive separators mean that the field between them is
14257 empty (for example, the fifth field above).
14258 </para>
14259 </listitem></varlistentry>
14260 <varlistentry revisionflag="changed">
14261 <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>
14262 <listitem>
14263 <para revisionflag="changed">
14264 <indexterm role="concept">
14265 <primary>expansion</primary>
14266 <secondary>extracting from JSON array</secondary>
14267 </indexterm>
14268 <indexterm role="concept">
14269 <primary>JSON</primary>
14270 <secondary>expansions</secondary>
14271 </indexterm>
14272 The &lt;<emphasis>number</emphasis>&gt; argument must consist entirely of decimal digits,
14273 apart from leading and trailing white space, which is ignored.
14274 </para>
14275 <para revisionflag="changed">
14276 Field selection and result handling is as above;
14277 there is no choice of field separator.
14278 </para>
14279 </listitem></varlistentry>
14280 <varlistentry>
14281 <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>
14282 <listitem>
14283 <para>
14284 <indexterm role="concept">
14285 <primary>list</primary>
14286 <secondary>selecting by condition</secondary>
14287 </indexterm>
14288 <indexterm role="concept">
14289 <primary>expansion</primary>
14290 <secondary>selecting from list by condition</secondary>
14291 </indexterm>
14292 <indexterm role="variable">
14293 <primary><varname>$item</varname></primary>
14294 </indexterm>
14295 After expansion, &lt;<emphasis>string</emphasis>&gt; is interpreted as a list, colon-separated by
14296 default, but the separator can be changed in the usual way (<xref linkend="SECTlistsepchange"/>).
14297 For each item
14298 in this list, its value is place in <varname>$item</varname>, and then the condition is
14299 evaluated. If the condition is true, <varname>$item</varname> is added to the output as an
14300 item in a new list; if the condition is false, the item is discarded. The
14301 separator used for the output list is the same as the one used for the
14302 input, but a separator setting is not included in the output. For example:
14303 </para>
14304 <literallayout class="monospaced">
14305 ${filter{a:b:c}{!eq{$item}{b}}}
14306 </literallayout>
14307 <para>
14308 yields <literal>a:c</literal>. At the end of the expansion, the value of <varname>$item</varname> is restored
14309 to what it was before. See also the <emphasis role="bold">map</emphasis> and <emphasis role="bold">reduce</emphasis> expansion items.
14310 </para>
14311 </listitem></varlistentry>
14312 <varlistentry>
14313 <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>
14314 <listitem>
14315 <para>
14316 <indexterm role="concept">
14317 <primary>hash function</primary>
14318 <secondary>textual</secondary>
14319 </indexterm>
14320 <indexterm role="concept">
14321 <primary>expansion</primary>
14322 <secondary>textual hash</secondary>
14323 </indexterm>
14324 This is a textual hashing function, and was the first to be implemented in
14325 early versions of Exim. In current releases, there are other hashing functions
14326 (numeric, MD5, and SHA-1), which are described below.
14327 </para>
14328 <para>
14329 The first two strings, after expansion, must be numbers. Call them &lt;<emphasis>m</emphasis>&gt; and
14330 &lt;<emphasis>n</emphasis>&gt;. If you are using fixed values for these numbers, that is, if
14331 &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you can
14332 use the simpler operator notation that avoids some of the braces:
14333 </para>
14334 <literallayout class="monospaced">
14335 ${hash_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
14336 </literallayout>
14337 <para>
14338 The second number is optional (in both notations). If &lt;<emphasis>n</emphasis>&gt; is greater than
14339 or equal to the length of the string, the expansion item returns the string.
14340 Otherwise it computes a new string of length &lt;<emphasis>n</emphasis>&gt; by applying a hashing
14341 function to the string. The new string consists of characters taken from the
14342 first &lt;<emphasis>m</emphasis>&gt; characters of the string
14343 </para>
14344 <literallayout class="monospaced">
14345 abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQWRSTUVWXYZ0123456789
14346 </literallayout>
14347 <para>
14348 If &lt;<emphasis>m</emphasis>&gt; is not present the value 26 is used, so that only lower case
14349 letters appear. For example:
14350 </para>
14351 <literallayout>
14352 <literal>$hash{3}{monty}}           </literal>   yields  <literal>jmg</literal>
14353 <literal>$hash{5}{monty}}           </literal>   yields  <literal>monty</literal>
14354 <literal>$hash{4}{62}{monty python}}</literal>   yields  <literal>fbWx</literal>
14355 </literallayout>
14356 </listitem></varlistentry>
14357 <varlistentry>
14358 <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>
14359 <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>
14360 <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>
14361 <listitem>
14362 <para>
14363        "<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>"
14364 <indexterm role="concept">
14365 <primary>expansion</primary>
14366 <secondary>header insertion</secondary>
14367 </indexterm>
14368 <indexterm role="variable">
14369 <primary><varname>$header_</varname></primary>
14370 </indexterm>
14371 <indexterm role="variable">
14372 <primary><varname>$bheader_</varname></primary>
14373 </indexterm>
14374 <indexterm role="variable">
14375 <primary><varname>$lheader_</varname></primary>
14376 </indexterm>
14377 <indexterm role="variable">
14378 <primary><varname>$rheader_</varname></primary>
14379 </indexterm>
14380 <indexterm role="concept">
14381 <primary>header lines</primary>
14382 <secondary>in expansion strings</secondary>
14383 </indexterm>
14384 <indexterm role="concept">
14385 <primary>header lines</primary>
14386 <secondary>character sets</secondary>
14387 </indexterm>
14388 <indexterm role="concept">
14389 <primary>header lines</primary>
14390 <secondary>decoding</secondary>
14391 </indexterm>
14392 Substitute the contents of the named message header line, for example
14393 </para>
14394 <literallayout class="monospaced">
14395 $header_reply-to:
14396 </literallayout>
14397 <para>
14398 The newline that terminates a header line is not included in the expansion, but
14399 internal newlines (caused by splitting the header line over several physical
14400 lines) may be present.
14401 </para>
14402 <para>
14403 The difference between the four pairs of expansions is in the way
14404 the data in the header line is interpreted.
14405 </para>
14406 <itemizedlist>
14407 <listitem>
14408 <para>
14409 <indexterm role="concept">
14410 <primary>white space</primary>
14411 <secondary>in header lines</secondary>
14412 </indexterm>
14413 <option>rheader</option> gives the original <quote>raw</quote> content of the header line, with no
14414 processing at all, and without the removal of leading and trailing white space.
14415 </para>
14416 </listitem>
14417 <listitem>
14418 <para>
14419 <indexterm role="concept">
14420 <primary>list</primary>
14421 <secondary>of header lines</secondary>
14422 </indexterm>
14423 <option>lheader</option> gives a colon-separated list, one element per header when there
14424 are multiple headers with a given name.
14425 Any embedded colon characters within an element are doubled, so normal Exim
14426 list-processing facilities can be used.
14427 The terminating newline of each element is removed; in other respects
14428 the content is <quote>raw</quote>.
14429 </para>
14430 </listitem>
14431 <listitem>
14432 <para>
14433 <indexterm role="concept">
14434 <primary>base64 encoding</primary>
14435 <secondary>in header lines</secondary>
14436 </indexterm>
14437 <option>bheader</option> removes leading and trailing white space, and then decodes base64
14438 or quoted-printable MIME <quote>words</quote> within the header text, but does no
14439 character set translation. If decoding of what looks superficially like a MIME
14440 <quote>word</quote> fails, the raw string is returned. If decoding
14441 <indexterm role="concept">
14442 <primary>binary zero</primary>
14443 <secondary>in header line</secondary>
14444 </indexterm>
14445 produces a binary zero character, it is replaced by a question mark &ndash; this is
14446 what Exim does for binary zeros that are actually received in header lines.
14447 </para>
14448 </listitem>
14449 <listitem>
14450 <para>
14451 <option>header</option> tries to translate the string as decoded by <option>bheader</option> to a
14452 standard character set. This is an attempt to produce the same string as would
14453 be displayed on a user&#x2019;s MUA. If translation fails, the <option>bheader</option> string is
14454 returned. Translation is attempted only on operating systems that support the
14455 <function>iconv()</function> function. This is indicated by the compile-time macro HAVE_ICONV in
14456 a system Makefile or in <filename>Local/Makefile</filename>.
14457 </para>
14458 </listitem>
14459 </itemizedlist>
14460 <para>
14461 In a filter file, the target character set for <option>header</option> can be specified by a
14462 command of the following form:
14463 </para>
14464 <literallayout class="monospaced">
14465 headers charset "UTF-8"
14466 </literallayout>
14467 <para>
14468 This command affects all references to <varname>$h_</varname> (or <varname>$header_</varname>) expansions in
14469 subsequently obeyed filter commands. In the absence of this command, the target
14470 character set in a filter is taken from the setting of the <option>headers_charset</option>
14471 option in the runtime configuration. The value of this option defaults to the
14472 value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The ultimate default is
14473 ISO-8859-1.
14474 </para>
14475 <para>
14476 Header names follow the syntax of RFC 2822, which states that they may contain
14477 any printing characters except space and colon. Consequently, curly brackets
14478 <emphasis>do not</emphasis> terminate header names, and should not be used to enclose them as
14479 if they were variables. Attempting to do so causes a syntax error.
14480 </para>
14481 <para>
14482 Only header lines that are common to all copies of a message are visible to
14483 this mechanism. These are the original header lines that are received with the
14484 message, and any that are added by an ACL statement or by a system
14485 filter. Header lines that are added to a particular copy of a message by a
14486 router or transport are not accessible.
14487 </para>
14488 <para>
14489 For incoming SMTP messages, no header lines are visible in
14490 ACLs that are obeyed before the data phase completes,
14491 because the header structure is not set up until the message is received.
14492 They are visible in DKIM, PRDR and DATA ACLs.
14493 Header lines that are added in a RCPT ACL (for example)
14494 are saved until the message&#x2019;s incoming header lines are available, at which
14495 point they are added.
14496 When any of the above ACLs ar
14497 running, however, header lines added by earlier ACLs are visible.
14498 </para>
14499 <para>
14500 Upper case and lower case letters are synonymous in header names. If the
14501 following character is white space, the terminating colon may be omitted, but
14502 this is not recommended, because you may then forget it when it is needed. When
14503 white space terminates the header name, this white space is included in the
14504 expanded string.  If the message does not contain the given header, the
14505 expansion item is replaced by an empty string. (See the <option>def</option> condition in
14506 section <xref linkend="SECTexpcond"/> for a means of testing for the existence of a
14507 header.)
14508 </para>
14509 <para>
14510 If there is more than one header with the same name, they are all concatenated
14511 to form the substitution string, up to a maximum length of 64K. Unless
14512 <option>rheader</option> is being used, leading and trailing white space is removed from
14513 each header before concatenation, and a completely empty header is ignored. A
14514 newline character is then inserted between non-empty headers, but there is no
14515 newline at the very end. For the <option>header</option> and <option>bheader</option> expansion, for
14516 those headers that contain lists of addresses, a comma is also inserted at the
14517 junctions between headers. This does not happen for the <option>rheader</option> expansion.
14518 </para>
14519 </listitem></varlistentry>
14520 <varlistentry>
14521 <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>
14522 <listitem>
14523 <para>
14524 <indexterm role="concept">
14525 <primary>expansion</primary>
14526 <secondary>hmac hashing</secondary>
14527 </indexterm>
14528 <indexterm role="concept">
14529 <primary><option>hmac</option></primary>
14530 </indexterm>
14531 This function uses cryptographic hashing (either MD5 or SHA-1) to convert a
14532 shared secret and some text into a message authentication code, as specified in
14533 RFC 2104. This differs from <literal>${md5:secret_text...}</literal> or
14534 <literal>${sha1:secret_text...}</literal> in that the hmac step adds a signature to the
14535 cryptographic hash, allowing for authentication that is not possible with MD5
14536 or SHA-1 alone. The hash name must expand to either <literal>md5</literal> or <literal>sha1</literal> at
14537 present. For example:
14538 </para>
14539 <literallayout class="monospaced">
14540 ${hmac{md5}{somesecret}{$primary_hostname $tod_log}}
14541 </literallayout>
14542 <para>
14543 For the hostname <emphasis>mail.example.com</emphasis> and time 2002-10-17 11:30:59, this
14544 produces:
14545 </para>
14546 <literallayout class="monospaced">
14547 dd97e3ba5d1a61b5006108f8c8252953
14548 </literallayout>
14549 <para>
14550 As an example of how this might be used, you might put in the main part of
14551 an Exim configuration:
14552 </para>
14553 <literallayout class="monospaced">
14554 SPAMSCAN_SECRET=cohgheeLei2thahw
14555 </literallayout>
14556 <para>
14557 In a router or a transport you could then have:
14558 </para>
14559 <literallayout class="monospaced">
14560 headers_add = \
14561   X-Spam-Scanned: ${primary_hostname} ${message_exim_id} \
14562   ${hmac{md5}{SPAMSCAN_SECRET}\
14563   {${primary_hostname},${message_exim_id},$h_message-id:}}
14564 </literallayout>
14565 <para>
14566 Then given a message, you can check where it was scanned by looking at the
14567 <emphasis>X-Spam-Scanned:</emphasis> header line. If you know the secret, you can check that
14568 this header line is authentic by recomputing the authentication code from the
14569 host name, message ID and the <emphasis>Message-id:</emphasis> header line. This can be done
14570 using Exim&#x2019;s <option>-be</option> option, or by other means, for example, by using the
14571 <emphasis>hmac_md5_hex()</emphasis> function in Perl.
14572 </para>
14573 </listitem></varlistentry>
14574 <varlistentry>
14575 <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>
14576 <listitem>
14577 <para>
14578 <indexterm role="concept">
14579 <primary>expansion</primary>
14580 <secondary>conditional</secondary>
14581 </indexterm>
14582 <indexterm role="concept">
14583 <primary><option>if</option>, expansion item</primary>
14584 </indexterm>
14585 If &lt;<emphasis>condition</emphasis>&gt; is true, &lt;<emphasis>string1</emphasis>&gt; is expanded and replaces the whole
14586 item; otherwise &lt;<emphasis>string2</emphasis>&gt; is used. The available conditions are described
14587 in section <xref linkend="SECTexpcond"/> below. For example:
14588 </para>
14589 <literallayout class="monospaced">
14590 ${if eq {$local_part}{postmaster} {yes}{no} }
14591 </literallayout>
14592 <para>
14593 The second string need not be present; if it is not and the condition is not
14594 true, the item is replaced with nothing. Alternatively, the word <quote>fail</quote> may
14595 be present instead of the second string (without any curly brackets). In this
14596 case, the expansion is forced to fail if the condition is not true (see section
14597 <xref linkend="SECTforexpfai"/>).
14598 </para>
14599 <para>
14600 If both strings are omitted, the result is the string <literal>true</literal> if the condition
14601 is true, and the empty string if the condition is false. This makes it less
14602 cumbersome to write custom ACL and router conditions. For example, instead of
14603 </para>
14604 <literallayout class="monospaced">
14605 condition = ${if &gt;{$acl_m4}{3}{true}{false}}
14606 </literallayout>
14607 <para>
14608 you can use
14609 </para>
14610 <literallayout class="monospaced">
14611 condition = ${if &gt;{$acl_m4}{3}}
14612 </literallayout>
14613 </listitem></varlistentry>
14614 <varlistentry>
14615 <term><emphasis role="bold">${imapfolder{</emphasis>&lt;<emphasis>foldername</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
14616 <listitem>
14617 <para>
14618 <indexterm role="concept">
14619 <primary>expansion</primary>
14620 <secondary>imap folder</secondary>
14621 </indexterm>
14622 <indexterm role="concept">
14623 <primary><option>imapfolder</option> expansion item</primary>
14624 </indexterm>
14625 This item converts a (possibly multilevel, or with non-ASCII characters)
14626 folder specification to a Maildir name for filesystem use.
14627 For information on internationalisation support see <xref linkend="SECTi18nMDA"/>.
14628 </para>
14629 </listitem></varlistentry>
14630 <varlistentry>
14631 <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>
14632 <listitem>
14633 <para>
14634 <indexterm role="concept">
14635 <primary>expansion</primary>
14636 <secondary>string truncation</secondary>
14637 </indexterm>
14638 <indexterm role="concept">
14639 <primary><option>length</option> expansion item</primary>
14640 </indexterm>
14641 The <option>length</option> item is used to extract the initial portion of a string. Both
14642 strings are expanded, and the first one must yield a number, &lt;<emphasis>n</emphasis>&gt;, say. If
14643 you are using a fixed value for the number, that is, if &lt;<emphasis>string1</emphasis>&gt; does not
14644 change when expanded, you can use the simpler operator notation that avoids
14645 some of the braces:
14646 </para>
14647 <literallayout class="monospaced">
14648 ${length_&lt;n&gt;:&lt;string&gt;}
14649 </literallayout>
14650 <para>
14651 The result of this item is either the first &lt;<emphasis>n</emphasis>&gt; bytes or the whole
14652 of &lt;<emphasis>string2</emphasis>&gt;, whichever is the shorter. Do not confuse <option>length</option> with
14653 <option>strlen</option>, which gives the length of a string.
14654 All measurement is done in bytes and is not UTF-8 aware.
14655 </para>
14656 </listitem></varlistentry>
14657 <varlistentry>
14658 <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>
14659 <listitem>
14660 <para>
14661 <indexterm role="concept">
14662 <primary>expansion</primary>
14663 <secondary>extracting list elements by number</secondary>
14664 </indexterm>
14665 <indexterm role="concept">
14666 <primary><option>listextract</option></primary>
14667 <secondary>extract list elements by number</secondary>
14668 </indexterm>
14669 <indexterm role="concept">
14670 <primary>list</primary>
14671 <secondary>extracting elements by number</secondary>
14672 </indexterm>
14673 The &lt;<emphasis>number</emphasis>&gt; argument must consist entirely of decimal digits,
14674 apart from an optional leading minus,
14675 and leading and trailing white space (which is ignored).
14676 </para>
14677 <para>
14678 After expansion, &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by
14679 default, but the separator can be changed in the usual way (<xref linkend="SECTlistsepchange"/>).
14680 </para>
14681 <para>
14682 The first field of the list is numbered one.
14683 If the number is negative, the fields are
14684 counted from the end of the list, with the rightmost one numbered -1.
14685 The numbered element of the list is extracted and placed in <varname>$value</varname>,
14686 then &lt;<emphasis>string2</emphasis>&gt; is expanded as the result.
14687 </para>
14688 <para>
14689 If the modulus of the
14690 number is zero or greater than the number of fields in the string,
14691 the result is the expansion of &lt;<emphasis>string3</emphasis>&gt;.
14692 </para>
14693 <para>
14694 For example:
14695 </para>
14696 <literallayout class="monospaced">
14697 ${listextract{2}{x:42:99}}
14698 </literallayout>
14699 <para>
14700 yields <quote>42</quote>, and
14701 </para>
14702 <literallayout class="monospaced">
14703 ${listextract{-3}{&lt;, x,42,99,&amp; Mailer,,/bin/bash}{result: $value}}
14704 </literallayout>
14705 <para>
14706 yields <quote>result: 42</quote>.
14707 </para>
14708 <para>
14709 If {&lt;<emphasis>string3</emphasis>&gt;} is omitted, an empty string is used for string3.
14710 If {&lt;<emphasis>string2</emphasis>&gt;} is also omitted, the value that was
14711 extracted is used.
14712 You can use <literal>fail</literal> instead of {&lt;<emphasis>string3</emphasis>&gt;} as in a string extract.
14713 </para>
14714 </listitem></varlistentry>
14715 <varlistentry>
14716 <term><emphasis role="bold">${lookup{</emphasis>&lt;<emphasis>key</emphasis>&gt;<emphasis role="bold">}&nbsp;</emphasis>&lt;<emphasis>search&nbsp;type</emphasis>&gt;<emphasis role="bold">&nbsp;{</emphasis>&lt;<emphasis>file</emphasis>&gt;<emphasis role="bold">}&nbsp;{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}&nbsp;{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
14717 <listitem>
14718 <para>
14719 This is the first of one of two different types of lookup item, which are both
14720 described in the next item.
14721 </para>
14722 </listitem></varlistentry>
14723 <varlistentry>
14724 <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>
14725 <listitem>
14726 <para>
14727 <indexterm role="concept">
14728 <primary>expansion</primary>
14729 <secondary>lookup in</secondary>
14730 </indexterm>
14731 <indexterm role="concept">
14732 <primary>file</primary>
14733 <secondary>lookups</secondary>
14734 </indexterm>
14735 <indexterm role="concept">
14736 <primary>lookup</primary>
14737 <secondary>in expanded string</secondary>
14738 </indexterm>
14739 The two forms of lookup item specify data lookups in files and databases, as
14740 discussed in chapter <xref linkend="CHAPfdlookup"/>. The first form is used for single-key
14741 lookups, and the second is used for query-style lookups. The &lt;<emphasis>key</emphasis>&gt;,
14742 &lt;<emphasis>file</emphasis>&gt;, and &lt;<emphasis>query</emphasis>&gt; strings are expanded before use.
14743 </para>
14744 <para>
14745 If there is any white space in a lookup item which is part of a filter command,
14746 a retry or rewrite rule, a routing rule for the <command>manualroute</command> router, or any
14747 other place where white space is significant, the lookup item must be enclosed
14748 in double quotes. The use of data lookups in users&#x2019; filter files may be locked
14749 out by the system administrator.
14750 </para>
14751 <para>
14752 <indexterm role="variable">
14753 <primary><varname>$value</varname></primary>
14754 </indexterm>
14755 If the lookup succeeds, &lt;<emphasis>string1</emphasis>&gt; is expanded and replaces the entire item.
14756 During its expansion, the variable <varname>$value</varname> contains the data returned by the
14757 lookup. Afterwards it reverts to the value it had previously (at the outer
14758 level it is empty). If the lookup fails, &lt;<emphasis>string2</emphasis>&gt; is expanded and replaces
14759 the entire item. If {&lt;<emphasis>string2</emphasis>&gt;} is omitted, the replacement is the empty
14760 string on failure. If &lt;<emphasis>string2</emphasis>&gt; is provided, it can itself be a nested
14761 lookup, thus providing a mechanism for looking up a default value when the
14762 original lookup fails.
14763 </para>
14764 <para>
14765 If a nested lookup is used as part of &lt;<emphasis>string1</emphasis>&gt;, <varname>$value</varname> contains the
14766 data for the outer lookup while the parameters of the second lookup are
14767 expanded, and also while &lt;<emphasis>string2</emphasis>&gt; of the second lookup is expanded, should
14768 the second lookup fail. Instead of {&lt;<emphasis>string2</emphasis>&gt;} the word <quote>fail</quote> can
14769 appear, and in this case, if the lookup fails, the entire expansion is forced
14770 to fail (see section <xref linkend="SECTforexpfai"/>). If both {&lt;<emphasis>string1</emphasis>&gt;} and
14771 {&lt;<emphasis>string2</emphasis>&gt;} are omitted, the result is the looked up value in the case of a
14772 successful lookup, and nothing in the case of failure.
14773 </para>
14774 <para>
14775 For single-key lookups, the string <quote>partial</quote> is permitted to precede the
14776 search type in order to do partial matching, and * or *@ may follow a search
14777 type to request default lookups if the key does not match (see sections
14778 <xref linkend="SECTdefaultvaluelookups"/> and <xref linkend="SECTpartiallookup"/> for details).
14779 </para>
14780 <para>
14781 <indexterm role="concept">
14782 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
14783 <secondary>in lookup expansion</secondary>
14784 </indexterm>
14785 If a partial search is used, the variables <varname>$1</varname> and <varname>$2</varname> contain the wild
14786 and non-wild parts of the key during the expansion of the replacement text.
14787 They return to their previous values at the end of the lookup item.
14788 </para>
14789 <para>
14790 This example looks up the postmaster alias in the conventional alias file:
14791 </para>
14792 <literallayout class="monospaced">
14793 ${lookup {postmaster} lsearch {/etc/aliases} {$value}}
14794 </literallayout>
14795 <para>
14796 This example uses NIS+ to look up the full name of the user corresponding to
14797 the local part of an address, forcing the expansion to fail if it is not found:
14798 </para>
14799 <literallayout class="monospaced">
14800 ${lookup nisplus {[name=$local_part],passwd.org_dir:gcos} \
14801   {$value}fail}
14802 </literallayout>
14803 </listitem></varlistentry>
14804 <varlistentry>
14805 <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>
14806 <listitem>
14807 <para>
14808 <indexterm role="concept">
14809 <primary>expansion</primary>
14810 <secondary>list creation</secondary>
14811 </indexterm>
14812 <indexterm role="variable">
14813 <primary><varname>$item</varname></primary>
14814 </indexterm>
14815 After expansion, &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by
14816 default, but the separator can be changed in the usual way (<xref linkend="SECTlistsepchange"/>).
14817 For each item
14818 in this list, its value is place in <varname>$item</varname>, and then &lt;<emphasis>string2</emphasis>&gt; is
14819 expanded and added to the output as an item in a new list. The separator used
14820 for the output list is the same as the one used for the input, but a separator
14821 setting is not included in the output. For example:
14822 </para>
14823 <literallayout class="monospaced">
14824 ${map{a:b:c}{[$item]}} ${map{&lt;- x-y-z}{($item)}}
14825 </literallayout>
14826 <para>
14827 expands to <literal>[a]:[b]:[c] (x)-(y)-(z)</literal>. At the end of the expansion, the
14828 value of <varname>$item</varname> is restored to what it was before. See also the <emphasis role="bold">filter</emphasis>
14829 and <emphasis role="bold">reduce</emphasis> expansion items.
14830 </para>
14831 </listitem></varlistentry>
14832 <varlistentry>
14833 <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>
14834 <listitem>
14835 <para>
14836 <indexterm role="concept">
14837 <primary>expansion</primary>
14838 <secondary>numeric hash</secondary>
14839 </indexterm>
14840 <indexterm role="concept">
14841 <primary>hash function</primary>
14842 <secondary>numeric</secondary>
14843 </indexterm>
14844 The three strings are expanded; the first two must yield numbers. Call them
14845 &lt;<emphasis>n</emphasis>&gt; and &lt;<emphasis>m</emphasis>&gt;. If you are using fixed values for these numbers, that is,
14846 if &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you
14847 can use the simpler operator notation that avoids some of the braces:
14848 </para>
14849 <literallayout class="monospaced">
14850 ${nhash_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
14851 </literallayout>
14852 <para>
14853 The second number is optional (in both notations). If there is only one number,
14854 the result is a number in the range 0&ndash;&lt;<emphasis>n</emphasis>&gt;-1. Otherwise, the string is
14855 processed by a div/mod hash function that returns two numbers, separated by a
14856 slash, in the ranges 0 to &lt;<emphasis>n</emphasis>&gt;-1 and 0 to &lt;<emphasis>m</emphasis>&gt;-1, respectively. For
14857 example,
14858 </para>
14859 <literallayout class="monospaced">
14860 ${nhash{8}{64}{supercalifragilisticexpialidocious}}
14861 </literallayout>
14862 <para>
14863 returns the string <quote>6/33</quote>.
14864 </para>
14865 </listitem></varlistentry>
14866 <varlistentry>
14867 <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>
14868 <listitem>
14869 <para>
14870 <indexterm role="concept">
14871 <primary>Perl</primary>
14872 <secondary>use in expanded string</secondary>
14873 </indexterm>
14874 <indexterm role="concept">
14875 <primary>expansion</primary>
14876 <secondary>calling Perl from</secondary>
14877 </indexterm>
14878 This item is available only if Exim has been built to include an embedded Perl
14879 interpreter. The subroutine name and the arguments are first separately
14880 expanded, and then the Perl subroutine is called with those arguments. No
14881 additional arguments need be given; the maximum number permitted, including the
14882 name of the subroutine, is nine.
14883 </para>
14884 <para>
14885 The return value of the subroutine is inserted into the expanded string, unless
14886 the return value is <option>undef</option>. In that case, the expansion fails in the same
14887 way as an explicit <quote>fail</quote> on a lookup item. The return value is a scalar.
14888 Whatever you return is evaluated in a scalar context. For example, if you
14889 return the name of a Perl vector, the return value is the size of the vector,
14890 not its contents.
14891 </para>
14892 <para>
14893 If the subroutine exits by calling Perl&#x2019;s <option>die</option> function, the expansion fails
14894 with the error message that was passed to <option>die</option>. More details of the embedded
14895 Perl facility are given in chapter <xref linkend="CHAPperl"/>.
14896 </para>
14897 <para>
14898 The <command>redirect</command> router has an option called <option>forbid_filter_perl</option> which locks
14899 out the use of this expansion item in filter files.
14900 </para>
14901 </listitem></varlistentry>
14902 <varlistentry>
14903 <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>
14904 <listitem>
14905 <para>
14906 <indexterm role="concept">
14907 <primary><option>prvs</option> expansion item</primary>
14908 </indexterm>
14909 The first argument is a complete email address and the second is secret
14910 keystring. The third argument, specifying a key number, is optional. If absent,
14911 it defaults to 0. The result of the expansion is a prvs-signed email address,
14912 to be typically used with the <option>return_path</option> option on an <command>smtp</command> transport
14913 as part of a bounce address tag validation (BATV) scheme. For more discussion
14914 and an example, see section <xref linkend="SECTverifyPRVS"/>.
14915 </para>
14916 </listitem></varlistentry>
14917 <varlistentry>
14918 <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>
14919 <listitem>
14920 <para>
14921 <indexterm role="concept">
14922 <primary><option>prvscheck</option> expansion item</primary>
14923 </indexterm>
14924 This expansion item is the complement of the <option>prvs</option> item. It is used for
14925 checking prvs-signed addresses. If the expansion of the first argument does not
14926 yield a syntactically valid prvs-signed address, the whole item expands to the
14927 empty string. When the first argument does expand to a syntactically valid
14928 prvs-signed address, the second argument is expanded, with the prvs-decoded
14929 version of the address and the key number extracted from the address in the
14930 variables <varname>$prvscheck_address</varname> and <varname>$prvscheck_keynum</varname>, respectively.
14931 </para>
14932 <para>
14933 These two variables can be used in the expansion of the second argument to
14934 retrieve the secret. The validity of the prvs-signed address is then checked
14935 against the secret. The result is stored in the variable <varname>$prvscheck_result</varname>,
14936 which is empty for failure or <quote>1</quote> for success.
14937 </para>
14938 <para>
14939 The third argument is optional; if it is missing, it defaults to an empty
14940 string. This argument is now expanded. If the result is an empty string, the
14941 result of the expansion is the decoded version of the address. This is the case
14942 whether or not the signature was valid. Otherwise, the result of the expansion
14943 is the expansion of the third argument.
14944 </para>
14945 <para>
14946 All three variables can be used in the expansion of the third argument.
14947 However, once the expansion is complete, only <varname>$prvscheck_result</varname> remains set.
14948 For more discussion and an example, see section <xref linkend="SECTverifyPRVS"/>.
14949 </para>
14950 </listitem></varlistentry>
14951 <varlistentry>
14952 <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>
14953 <listitem>
14954 <para>
14955 <indexterm role="concept">
14956 <primary>expansion</primary>
14957 <secondary>inserting an entire file</secondary>
14958 </indexterm>
14959 <indexterm role="concept">
14960 <primary>file</primary>
14961 <secondary>inserting into expansion</secondary>
14962 </indexterm>
14963 <indexterm role="concept">
14964 <primary><option>readfile</option> expansion item</primary>
14965 </indexterm>
14966 The filename and end-of-line string are first expanded separately. The file is
14967 then read, and its contents replace the entire item. All newline characters in
14968 the file are replaced by the end-of-line string if it is present. Otherwise,
14969 newlines are left in the string.
14970 String expansion is not applied to the contents of the file. If you want this,
14971 you must wrap the item in an <option>expand</option> operator. If the file cannot be read,
14972 the string expansion fails.
14973 </para>
14974 <para>
14975 The <command>redirect</command> router has an option called <option>forbid_filter_readfile</option> which
14976 locks out the use of this expansion item in filter files.
14977 </para>
14978 </listitem></varlistentry>
14979 <varlistentry>
14980 <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>
14981 <listitem>
14982 <para>
14983 <indexterm role="concept">
14984 <primary>expansion</primary>
14985 <secondary>inserting from a socket</secondary>
14986 </indexterm>
14987 <indexterm role="concept">
14988 <primary>socket, use of in expansion</primary>
14989 </indexterm>
14990 <indexterm role="concept">
14991 <primary><option>readsocket</option> expansion item</primary>
14992 </indexterm>
14993 This item inserts data from a Unix domain or TCP socket into the expanded
14994 string. The minimal way of using it uses just two arguments, as in these
14995 examples:
14996 </para>
14997 <literallayout class="monospaced">
14998 ${readsocket{/socket/name}{request string}}
14999 ${readsocket{inet:some.host:1234}{request string}}
15000 </literallayout>
15001 <para>
15002 For a Unix domain socket, the first substring must be the path to the socket.
15003 For an Internet socket, the first substring must contain <literal>inet:</literal> followed by
15004 a host name or IP address, followed by a colon and a port, which can be a
15005 number or the name of a TCP port in <filename>/etc/services</filename>. An IP address may
15006 optionally be enclosed in square brackets. This is best for IPv6 addresses. For
15007 example:
15008 </para>
15009 <literallayout class="monospaced">
15010 ${readsocket{inet:[::1]:1234}{request string}}
15011 </literallayout>
15012 <para>
15013 Only a single host name may be given, but if looking it up yields more than
15014 one IP address, they are each tried in turn until a connection is made. For
15015 both kinds of socket, Exim makes a connection, writes the request string
15016 unless it is an empty string; and no terminating NUL is ever sent)
15017 and reads from the socket until an end-of-file
15018 is read. A timeout of 5 seconds is applied. Additional, optional arguments
15019 extend what can be done. Firstly, you can vary the timeout. For example:
15020 </para>
15021 <literallayout class="monospaced">
15022 ${readsocket{/socket/name}{request string}{3s}}
15023 </literallayout>
15024 <para>
15025 The third argument is a list of options, of which the first element is the timeout
15026 and must be present if the argument is given.
15027 Further elements are options of form <emphasis>name=value</emphasis>.
15028 Two option types is currently recognised: shutdown and tls.
15029 The first defines whether (the default)
15030 or not a shutdown is done on the connection after sending the request.
15031 Example, to not do so (preferred, eg. by some webservers):
15032 </para>
15033 <literallayout class="monospaced">
15034 ${readsocket{/socket/name}{request string}{3s:shutdown=no}}
15035 </literallayout>
15036 <para revisionflag="changed">
15037 The second, tls, controls the use of TLS on the connection.  Example:
15038 </para>
15039 <literallayout class="monospaced" revisionflag="changed">
15040 ${readsocket{/socket/name}{request string}{3s:tls=yes}}
15041 </literallayout>
15042 <para revisionflag="changed">
15043 The default is to not use TLS.
15044 If it is enabled, a shutdown as descripbed above is never done.
15045 </para>
15046 <para>
15047 A fourth argument allows you to change any newlines that are in the data
15048 that is read, in the same way as for <option>readfile</option> (see above). This example
15049 turns them into spaces:
15050 </para>
15051 <literallayout class="monospaced">
15052 ${readsocket{inet:127.0.0.1:3294}{request string}{3s}{ }}
15053 </literallayout>
15054 <para>
15055 As with all expansions, the substrings are expanded before the processing
15056 happens. Errors in these sub-expansions cause the expansion to fail. In
15057 addition, the following errors can occur:
15058 </para>
15059 <itemizedlist>
15060 <listitem>
15061 <para>
15062 Failure to create a socket file descriptor;
15063 </para>
15064 </listitem>
15065 <listitem>
15066 <para>
15067 Failure to connect the socket;
15068 </para>
15069 </listitem>
15070 <listitem>
15071 <para>
15072 Failure to write the request string;
15073 </para>
15074 </listitem>
15075 <listitem>
15076 <para>
15077 Timeout on reading from the socket.
15078 </para>
15079 </listitem>
15080 </itemizedlist>
15081 <para>
15082 By default, any of these errors causes the expansion to fail. However, if
15083 you supply a fifth substring, it is expanded and used when any of the above
15084 errors occurs. For example:
15085 </para>
15086 <literallayout class="monospaced">
15087 ${readsocket{/socket/name}{request string}{3s}{\n}\
15088   {socket failure}}
15089 </literallayout>
15090 <para>
15091 You can test for the existence of a Unix domain socket by wrapping this
15092 expansion in <literal>${if exists</literal>, but there is a race condition between that test
15093 and the actual opening of the socket, so it is safer to use the fifth argument
15094 if you want to be absolutely sure of avoiding an expansion error for a
15095 non-existent Unix domain socket, or a failure to connect to an Internet socket.
15096 </para>
15097 <para>
15098 The <command>redirect</command> router has an option called <option>forbid_filter_readsocket</option> which
15099 locks out the use of this expansion item in filter files.
15100 </para>
15101 </listitem></varlistentry>
15102 <varlistentry>
15103 <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>
15104 <listitem>
15105 <para>
15106 <indexterm role="concept">
15107 <primary>expansion</primary>
15108 <secondary>reducing a list to a scalar</secondary>
15109 </indexterm>
15110 <indexterm role="concept">
15111 <primary>list</primary>
15112 <secondary>reducing to a scalar</secondary>
15113 </indexterm>
15114 <indexterm role="variable">
15115 <primary><varname>$value</varname></primary>
15116 </indexterm>
15117 <indexterm role="variable">
15118 <primary><varname>$item</varname></primary>
15119 </indexterm>
15120 This operation reduces a list to a single, scalar string. After expansion,
15121 &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by default, but the
15122 separator can be changed in the usual way (<xref linkend="SECTlistsepchange"/>).
15123 Then &lt;<emphasis>string2</emphasis>&gt; is expanded and
15124 assigned to the <varname>$value</varname> variable. After this, each item in the &lt;<emphasis>string1</emphasis>&gt;
15125 list is assigned to <varname>$item</varname>, in turn, and &lt;<emphasis>string3</emphasis>&gt; is expanded for each of
15126 them. The result of that expansion is assigned to <varname>$value</varname> before the next
15127 iteration. When the end of the list is reached, the final value of <varname>$value</varname> is
15128 added to the expansion output. The <emphasis role="bold">reduce</emphasis> expansion item can be used in a
15129 number of ways. For example, to add up a list of numbers:
15130 </para>
15131 <literallayout class="monospaced">
15132 ${reduce {&lt;, 1,2,3}{0}{${eval:$value+$item}}}
15133 </literallayout>
15134 <para>
15135 The result of that expansion would be <literal>6</literal>. The maximum of a list of numbers
15136 can be found:
15137 </para>
15138 <literallayout class="monospaced">
15139 ${reduce {3:0:9:4:6}{0}{${if &gt;{$item}{$value}{$item}{$value}}}}
15140 </literallayout>
15141 <para>
15142 At the end of a <emphasis role="bold">reduce</emphasis> expansion, the values of <varname>$item</varname> and <varname>$value</varname> are
15143 restored to what they were before. See also the <emphasis role="bold">filter</emphasis> and <emphasis role="bold">map</emphasis>
15144 expansion items.
15145 </para>
15146 </listitem></varlistentry>
15147 <varlistentry>
15148 <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>
15149 <listitem>
15150 <para>
15151 This item inserts <quote>raw</quote> header lines. It is described with the <option>header</option>
15152 expansion item in section <xref linkend="SECTexpansionitems"/> above.
15153 </para>
15154 </listitem></varlistentry>
15155 <varlistentry>
15156 <term><emphasis role="bold">${run{</emphasis>&lt;<emphasis>command</emphasis>&gt;<emphasis role="bold">&nbsp;</emphasis>&lt;<emphasis>args</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
15157 <listitem>
15158 <para>
15159 <indexterm role="concept">
15160 <primary>expansion</primary>
15161 <secondary>running a command</secondary>
15162 </indexterm>
15163 <indexterm role="concept">
15164 <primary><option>run</option> expansion item</primary>
15165 </indexterm>
15166 The command and its arguments are first expanded as one string. The string is
15167 split apart into individual arguments by spaces, and then the command is run
15168 in a separate process, but under the same uid and gid.  As in other command
15169 executions from Exim, a shell is not used by default. If the command requires
15170 a shell, you must explicitly code it.
15171 </para>
15172 <para>
15173 Since the arguments are split by spaces, when there is a variable expansion
15174 which has an empty result, it will cause the situation that the argument will
15175 simply be omitted when the program is actually executed by Exim. If the
15176 script/program requires a specific number of arguments and the expanded
15177 variable could possibly result in this empty expansion, the variable must be
15178 quoted. This is more difficult if the expanded variable itself could result
15179 in a string containing quotes, because it would interfere with the quotes
15180 around the command arguments. A possible guard against this is to wrap the
15181 variable in the <option>sg</option> operator to change any quote marks to some other
15182 character.
15183 </para>
15184 <para>
15185 The standard input for the command exists, but is empty. The standard output
15186 and standard error are set to the same file descriptor.
15187 <indexterm role="concept">
15188 <primary>return code</primary>
15189 <secondary>from <option>run</option> expansion</secondary>
15190 </indexterm>
15191 <indexterm role="variable">
15192 <primary><varname>$value</varname></primary>
15193 </indexterm>
15194 If the command succeeds (gives a zero return code) &lt;<emphasis>string1</emphasis>&gt; is expanded
15195 and replaces the entire item; during this expansion, the standard output/error
15196 from the command is in the variable <varname>$value</varname>. If the command fails,
15197 &lt;<emphasis>string2</emphasis>&gt;, if present, is expanded and used. Once again, during the
15198 expansion, the standard output/error from the command is in the variable
15199 <varname>$value</varname>.
15200 </para>
15201 <para>
15202 If &lt;<emphasis>string2</emphasis>&gt; is absent, the result is empty. Alternatively, &lt;<emphasis>string2</emphasis>&gt;
15203 can be the word <quote>fail</quote> (not in braces) to force expansion failure if the
15204 command does not succeed. If both strings are omitted, the result is contents
15205 of the standard output/error on success, and nothing on failure.
15206 </para>
15207 <para>
15208 <indexterm role="variable">
15209 <primary><varname>$run_in_acl</varname></primary>
15210 </indexterm>
15211 The standard output/error of the command is put in the variable <varname>$value</varname>.
15212 In this ACL example, the output of a command is logged for the admin to
15213 troubleshoot:
15214 </para>
15215 <literallayout class="monospaced">
15216 warn  condition    = ${run{/usr/bin/id}{yes}{no}}
15217       log_message  = Output of id: $value
15218 </literallayout>
15219 <para>
15220 If the command requires shell idioms, such as the &gt; redirect operator, the
15221 shell must be invoked directly, such as with:
15222 </para>
15223 <literallayout class="monospaced">
15224 ${run{/bin/bash -c "/usr/bin/id &gt;/tmp/id"}{yes}{yes}}
15225 </literallayout>
15226 <para>
15227 <indexterm role="variable">
15228 <primary><varname>$runrc</varname></primary>
15229 </indexterm>
15230 The return code from the command is put in the variable <varname>$runrc</varname>, and this
15231 remains set afterwards, so in a filter file you can do things like this:
15232 </para>
15233 <literallayout class="monospaced">
15234 if "${run{x y z}{}}$runrc" is 1 then ...
15235   elif $runrc is 2 then ...
15236   ...
15237 endif
15238 </literallayout>
15239 <para>
15240 If execution of the command fails (for example, the command does not exist),
15241 the return code is 127 &ndash; the same code that shells use for non-existent
15242 commands.
15243 </para>
15244 <para>
15245 <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot assume the order in which
15246 option values are expanded, except for those preconditions whose order of
15247 testing is documented. Therefore, you cannot reliably expect to set <varname>$runrc</varname>
15248 by the expansion of one option, and use it in another.
15249 </para>
15250 <para>
15251 The <command>redirect</command> router has an option called <option>forbid_filter_run</option> which locks
15252 out the use of this expansion item in filter files.
15253 </para>
15254 </listitem></varlistentry>
15255 <varlistentry>
15256 <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>
15257 <listitem>
15258 <para>
15259 <indexterm role="concept">
15260 <primary>expansion</primary>
15261 <secondary>string substitution</secondary>
15262 </indexterm>
15263 <indexterm role="concept">
15264 <primary><option>sg</option> expansion item</primary>
15265 </indexterm>
15266 This item works like Perl&#x2019;s substitution operator (s) with the global (/g)
15267 option; hence its name. However, unlike the Perl equivalent, Exim does not
15268 modify the subject string; instead it returns the modified string for insertion
15269 into the overall expansion. The item takes three arguments: the subject string,
15270 a regular expression, and a substitution string. For example:
15271 </para>
15272 <literallayout class="monospaced">
15273 ${sg{abcdefabcdef}{abc}{xyz}}
15274 </literallayout>
15275 <para>
15276 yields <quote>xyzdefxyzdef</quote>. Because all three arguments are expanded before use,
15277 if any $, } or \ characters are required in the regular expression or in the
15278 substitution string, they have to be escaped. For example:
15279 </para>
15280 <literallayout class="monospaced">
15281 ${sg{abcdef}{^(...)(...)\$}{\$2\$1}}
15282 </literallayout>
15283 <para>
15284 yields <quote>defabc</quote>, and
15285 </para>
15286 <literallayout class="monospaced">
15287 ${sg{1=A 4=D 3=C}{\N(\d+)=\N}{K\$1=}}
15288 </literallayout>
15289 <para>
15290 yields <quote>K1=A K4=D K3=C</quote>. Note the use of <literal>\N</literal> to protect the contents of
15291 the regular expression from string expansion.
15292 </para>
15293 <para>
15294 The regular expression is compiled in 8-bit mode, working against bytes
15295 rather than any Unicode-aware character handling.
15296 </para>
15297 </listitem></varlistentry>
15298 <varlistentry>
15299 <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>
15300 <listitem>
15301 <para>
15302 <indexterm role="concept">
15303 <primary>sorting</primary>
15304 <secondary>a list</secondary>
15305 </indexterm>
15306 <indexterm role="concept">
15307 <primary>list</primary>
15308 <secondary>sorting</secondary>
15309 </indexterm>
15310 <indexterm role="concept">
15311 <primary>expansion</primary>
15312 <secondary>list sorting</secondary>
15313 </indexterm>
15314 After expansion, &lt;<emphasis>string</emphasis>&gt; is interpreted as a list, colon-separated by
15315 default, but the separator can be changed in the usual way (<xref linkend="SECTlistsepchange"/>).
15316 The &lt;<emphasis>comparator</emphasis>&gt; argument is interpreted as the operator
15317 of a two-argument expansion condition.
15318 The numeric operators plus ge, gt, le, lt (and ~i variants) are supported.
15319 The comparison should return true when applied to two values
15320 if the first value should sort before the second value.
15321 The &lt;<emphasis>extractor</emphasis>&gt; expansion is applied repeatedly to elements of the list,
15322 the element being placed in <varname>$item</varname>,
15323 to give values for comparison.
15324 </para>
15325 <para>
15326 The item result is a sorted list,
15327 with the original list separator,
15328 of the list elements (in full) of the original.
15329 </para>
15330 <para>
15331 Examples:
15332 </para>
15333 <literallayout class="monospaced">
15334 ${sort{3:2:1:4}{&lt;}{$item}}
15335 </literallayout>
15336 <para>
15337 sorts a list of numbers, and
15338 </para>
15339 <literallayout class="monospaced">
15340 ${sort {${lookup dnsdb{&gt;:,,mx=example.com}}} {&lt;} {${listextract{1}{&lt;,$item}}}}
15341 </literallayout>
15342 <para>
15343 will sort an MX lookup into priority order.
15344 </para>
15345 </listitem></varlistentry>
15346 <varlistentry>
15347 <term><emphasis role="bold">${substr{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string3</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
15348 <listitem>
15349 <para>
15350 <indexterm role="concept">
15351 <primary><option>substr</option> expansion item</primary>
15352 </indexterm>
15353 <indexterm role="concept">
15354 <primary>substring extraction</primary>
15355 </indexterm>
15356 <indexterm role="concept">
15357 <primary>expansion</primary>
15358 <secondary>substring extraction</secondary>
15359 </indexterm>
15360 The three strings are expanded; the first two must yield numbers. Call them
15361 &lt;<emphasis>n</emphasis>&gt; and &lt;<emphasis>m</emphasis>&gt;. If you are using fixed values for these numbers, that is,
15362 if &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you
15363 can use the simpler operator notation that avoids some of the braces:
15364 </para>
15365 <literallayout class="monospaced">
15366 ${substr_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
15367 </literallayout>
15368 <para>
15369 The second number is optional (in both notations).
15370 If it is absent in the simpler format, the preceding underscore must also be
15371 omitted.
15372 </para>
15373 <para>
15374 The <option>substr</option> item can be used to extract more general substrings than
15375 <option>length</option>. The first number, &lt;<emphasis>n</emphasis>&gt;, is a starting offset, and &lt;<emphasis>m</emphasis>&gt; is the
15376 length required. For example
15377 </para>
15378 <literallayout class="monospaced">
15379 ${substr{3}{2}{$local_part}}
15380 </literallayout>
15381 <para>
15382 If the starting offset is greater than the string length the result is the
15383 null string; if the length plus starting offset is greater than the string
15384 length, the result is the right-hand part of the string, starting from the
15385 given offset. The first byte (character) in the string has offset zero.
15386 </para>
15387 <para>
15388 The <option>substr</option> expansion item can take negative offset values to count
15389 from the right-hand end of its operand. The last byte (character) is offset -1,
15390 the second-last is offset -2, and so on. Thus, for example,
15391 </para>
15392 <literallayout class="monospaced">
15393 ${substr{-5}{2}{1234567}}
15394 </literallayout>
15395 <para>
15396 yields <quote>34</quote>. If the absolute value of a negative offset is greater than the
15397 length of the string, the substring starts at the beginning of the string, and
15398 the length is reduced by the amount of overshoot. Thus, for example,
15399 </para>
15400 <literallayout class="monospaced">
15401 ${substr{-5}{2}{12}}
15402 </literallayout>
15403 <para>
15404 yields an empty string, but
15405 </para>
15406 <literallayout class="monospaced">
15407 ${substr{-3}{2}{12}}
15408 </literallayout>
15409 <para>
15410 yields <quote>1</quote>.
15411 </para>
15412 <para>
15413 When the second number is omitted from <option>substr</option>, the remainder of the string
15414 is taken if the offset is positive. If it is negative, all bytes (characters) in the
15415 string preceding the offset point are taken. For example, an offset of -1 and
15416 no length, as in these semantically identical examples:
15417 </para>
15418 <literallayout class="monospaced">
15419 ${substr_-1:abcde}
15420 ${substr{-1}{abcde}}
15421 </literallayout>
15422 <para>
15423 yields all but the last character of the string, that is, <quote>abcd</quote>.
15424 </para>
15425 <para>
15426 All measurement is done in bytes and is not UTF-8 aware.
15427 </para>
15428 </listitem></varlistentry>
15429 <varlistentry>
15430 <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>
15431 <listitem>
15432 <para>
15433 <indexterm role="concept">
15434 <primary>expansion</primary>
15435 <secondary>character translation</secondary>
15436 </indexterm>
15437 <indexterm role="concept">
15438 <primary><option>tr</option> expansion item</primary>
15439 </indexterm>
15440 This item does single-character (in bytes) translation on its subject string. The second
15441 argument is a list of characters to be translated in the subject string. Each
15442 matching character is replaced by the corresponding character from the
15443 replacement list. For example
15444 </para>
15445 <literallayout class="monospaced">
15446 ${tr{abcdea}{ac}{13}}
15447 </literallayout>
15448 <para>
15449 yields <literal>1b3de1</literal>. If there are duplicates in the second character string, the
15450 last occurrence is used. If the third string is shorter than the second, its
15451 last character is replicated. However, if it is empty, no translation takes
15452 place.
15453 </para>
15454 <para>
15455 All character handling is done in bytes and is not UTF-8 aware.
15456 </para>
15457 </listitem></varlistentry>
15458 </variablelist>
15459 </section>
15460 <section id="SECTexpop">
15461 <title>Expansion operators</title>
15462 <para>
15463 <indexterm role="concept">
15464 <primary>expansion</primary>
15465 <secondary>operators</secondary>
15466 </indexterm>
15467 For expansion items that perform transformations on a single argument string,
15468 the <quote>operator</quote> notation is used because it is simpler and uses fewer braces.
15469 The substring is first expanded before the operation is applied to it. The
15470 following operations can be performed:
15471 </para>
15472 <variablelist>
15473 <varlistentry>
15474 <term><emphasis role="bold">${address:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15475 <listitem>
15476 <para>
15477 <indexterm role="concept">
15478 <primary>expansion</primary>
15479 <secondary>RFC 2822 address handling</secondary>
15480 </indexterm>
15481 <indexterm role="concept">
15482 <primary><option>address</option> expansion item</primary>
15483 </indexterm>
15484 The string is interpreted as an RFC 2822 address, as it might appear in a
15485 header line, and the effective address is extracted from it. If the string does
15486 not parse successfully, the result is empty.
15487 </para>
15488 <para>
15489 The parsing correctly handles SMTPUTF8 Unicode in the string.
15490 </para>
15491 </listitem></varlistentry>
15492 <varlistentry>
15493 <term><emphasis role="bold">${addresses:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15494 <listitem>
15495 <para>
15496 <indexterm role="concept">
15497 <primary>expansion</primary>
15498 <secondary>RFC 2822 address handling</secondary>
15499 </indexterm>
15500 <indexterm role="concept">
15501 <primary><option>addresses</option> expansion item</primary>
15502 </indexterm>
15503 The string (after expansion) is interpreted as a list of addresses in RFC
15504 2822 format, such as can be found in a <emphasis>To:</emphasis> or <emphasis>Cc:</emphasis> header line. The
15505 operative address (<emphasis>local-part@domain</emphasis>) is extracted from each item, and the
15506 result of the expansion is a colon-separated list, with appropriate
15507 doubling of colons should any happen to be present in the email addresses.
15508 Syntactically invalid RFC2822 address items are omitted from the output.
15509 </para>
15510 <para>
15511 It is possible to specify a character other than colon for the output
15512 separator by starting the string with &gt; followed by the new separator
15513 character. For example:
15514 </para>
15515 <literallayout class="monospaced">
15516 ${addresses:&gt;&amp; Chief &lt;ceo@up.stairs&gt;, sec@base.ment (dogsbody)}
15517 </literallayout>
15518 <para>
15519 expands to <literal>ceo@up.stairs&amp;sec@base.ment</literal>. The string is expanded
15520 first, so if the expanded string starts with &gt;, it may change the output
15521 separator unintentionally. This can be avoided by setting the output
15522 separator explicitly:
15523 </para>
15524 <literallayout class="monospaced">
15525 ${addresses:&gt;:$h_from:}
15526 </literallayout>
15527 <para>
15528 Compare the <emphasis role="bold">address</emphasis> (singular)
15529 expansion item, which extracts the working address from a single RFC2822
15530 address. See the <emphasis role="bold">filter</emphasis>, <emphasis role="bold">map</emphasis>, and <emphasis role="bold">reduce</emphasis> items for ways of
15531 processing lists.
15532 </para>
15533 <para>
15534 To clarify "list of addresses in RFC 2822 format" mentioned above, Exim follows
15535 a strict interpretation of header line formatting.  Exim parses the bare,
15536 unquoted portion of an email address and if it finds a comma, treats it as an
15537 email address separator. For the example header line:
15538 </para>
15539 <literallayout class="monospaced">
15540 From: =?iso-8859-2?Q?Last=2C_First?= &lt;user@example.com&gt;
15541 </literallayout>
15542 <para>
15543 The first example below demonstrates that Q-encoded email addresses are parsed
15544 properly if it is given the raw header (in this example, <literal>$rheader_from:</literal>).
15545 It does not see the comma because it&#x2019;s still encoded as "=2C".  The second
15546 example below is passed the contents of <literal>$header_from:</literal>, meaning it gets
15547 de-mimed. Exim sees the decoded "," so it treats it as <emphasis role="bold">two</emphasis> email addresses.
15548 The third example shows that the presence of a comma is skipped when it is
15549 quoted.  The fourth example shows SMTPUTF8 handling.
15550 </para>
15551 <literallayout class="monospaced">
15552 # exim -be '${addresses:From: \
15553 =?iso-8859-2?Q?Last=2C_First?= &lt;user@example.com&gt;}'
15554 user@example.com
15555 # exim -be '${addresses:From: Last, First &lt;user@example.com&gt;}'
15556 Last:user@example.com
15557 # exim -be '${addresses:From: "Last, First" &lt;user@example.com&gt;}'
15558 user@example.com
15559 # exim -be '${addresses:フィル &lt;フィリップ@example.jp&gt;}'
15560 フィリップ@example.jp
15561 </literallayout>
15562 </listitem></varlistentry>
15563 <varlistentry>
15564 <term><emphasis role="bold">${base32:</emphasis>&lt;<emphasis>digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15565 <listitem>
15566 <para>
15567 <indexterm role="concept">
15568 <primary><option>base32</option> expansion item</primary>
15569 </indexterm>
15570 <indexterm role="concept">
15571 <primary>expansion</primary>
15572 <secondary>conversion to base 32</secondary>
15573 </indexterm>
15574 The string must consist entirely of decimal digits. The number is converted to
15575 base 32 and output as a (empty, for zero) string of characters.
15576 Only lowercase letters are used.
15577 </para>
15578 </listitem></varlistentry>
15579 <varlistentry>
15580 <term><emphasis role="bold">${base32d:</emphasis>&lt;<emphasis>base-32&nbsp;digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15581 <listitem>
15582 <para>
15583 <indexterm role="concept">
15584 <primary><option>base32d</option> expansion item</primary>
15585 </indexterm>
15586 <indexterm role="concept">
15587 <primary>expansion</primary>
15588 <secondary>conversion to base 32</secondary>
15589 </indexterm>
15590 The string must consist entirely of base-32 digits.
15591 The number is converted to decimal and output as a string.
15592 </para>
15593 </listitem></varlistentry>
15594 <varlistentry>
15595 <term><emphasis role="bold">${base62:</emphasis>&lt;<emphasis>digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15596 <listitem>
15597 <para>
15598 <indexterm role="concept">
15599 <primary><option>base62</option> expansion item</primary>
15600 </indexterm>
15601 <indexterm role="concept">
15602 <primary>expansion</primary>
15603 <secondary>conversion to base 62</secondary>
15604 </indexterm>
15605 The string must consist entirely of decimal digits. The number is converted to
15606 base 62 and output as a string of six characters, including leading zeros. In
15607 the few operating environments where Exim uses base 36 instead of base 62 for
15608 its message identifiers (because those systems do not have case-sensitive
15609 filenames), base 36 is used by this operator, despite its name. <emphasis role="bold">Note</emphasis>: Just
15610 to be absolutely clear: this is <emphasis>not</emphasis> base64 encoding.
15611 </para>
15612 </listitem></varlistentry>
15613 <varlistentry>
15614 <term><emphasis role="bold">${base62d:</emphasis>&lt;<emphasis>base-62&nbsp;digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15615 <listitem>
15616 <para>
15617 <indexterm role="concept">
15618 <primary><option>base62d</option> expansion item</primary>
15619 </indexterm>
15620 <indexterm role="concept">
15621 <primary>expansion</primary>
15622 <secondary>conversion to base 62</secondary>
15623 </indexterm>
15624 The string must consist entirely of base-62 digits, or, in operating
15625 environments where Exim uses base 36 instead of base 62 for its message
15626 identifiers, base-36 digits. The number is converted to decimal and output as a
15627 string.
15628 </para>
15629 </listitem></varlistentry>
15630 <varlistentry>
15631 <term><emphasis role="bold">${base64:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15632 <listitem>
15633 <para>
15634 <indexterm role="concept">
15635 <primary>expansion</primary>
15636 <secondary>base64 encoding</secondary>
15637 </indexterm>
15638 <indexterm role="concept">
15639 <primary>base64 encoding</primary>
15640 <secondary>in string expansion</secondary>
15641 </indexterm>
15642 <indexterm role="concept">
15643 <primary><option>base64</option> expansion item</primary>
15644 </indexterm>
15645 <indexterm role="concept">
15646 <primary>certificate</primary>
15647 <secondary>base64 of DER</secondary>
15648 </indexterm>
15649 This operator converts a string into one that is base64 encoded.
15650 </para>
15651 <para>
15652 If the string is a single variable of type certificate,
15653 returns the base64 encoding of the DER form of the certificate.
15654 </para>
15655 </listitem></varlistentry>
15656 <varlistentry>
15657 <term><emphasis role="bold">${base64d:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15658 <listitem>
15659 <para>
15660 <indexterm role="concept">
15661 <primary>expansion</primary>
15662 <secondary>base64 decoding</secondary>
15663 </indexterm>
15664 <indexterm role="concept">
15665 <primary>base64 decoding</primary>
15666 <secondary>in string expansion</secondary>
15667 </indexterm>
15668 <indexterm role="concept">
15669 <primary><option>base64d</option> expansion item</primary>
15670 </indexterm>
15671 This operator converts a base64-encoded string into the un-coded form.
15672 </para>
15673 </listitem></varlistentry>
15674 <varlistentry>
15675 <term><emphasis role="bold">${domain:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15676 <listitem>
15677 <para>
15678 <indexterm role="concept">
15679 <primary>domain</primary>
15680 <secondary>extraction</secondary>
15681 </indexterm>
15682 <indexterm role="concept">
15683 <primary>expansion</primary>
15684 <secondary>domain extraction</secondary>
15685 </indexterm>
15686 The string is interpreted as an RFC 2822 address and the domain is extracted
15687 from it. If the string does not parse successfully, the result is empty.
15688 </para>
15689 </listitem></varlistentry>
15690 <varlistentry>
15691 <term><emphasis role="bold">${escape:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15692 <listitem>
15693 <para>
15694 <indexterm role="concept">
15695 <primary>expansion</primary>
15696 <secondary>escaping non-printing characters</secondary>
15697 </indexterm>
15698 <indexterm role="concept">
15699 <primary><option>escape</option> expansion item</primary>
15700 </indexterm>
15701 If the string contains any non-printing characters, they are converted to
15702 escape sequences starting with a backslash. Whether characters with the most
15703 significant bit set (so-called <quote>8-bit characters</quote>) count as printing or not
15704 is controlled by the <option>print_topbitchars</option> option.
15705 </para>
15706 </listitem></varlistentry>
15707 <varlistentry>
15708 <term><emphasis role="bold">${escape8bit:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15709 <listitem>
15710 <para>
15711 <indexterm role="concept">
15712 <primary>expansion</primary>
15713 <secondary>escaping 8-bit characters</secondary>
15714 </indexterm>
15715 <indexterm role="concept">
15716 <primary><option>escape8bit</option> expansion item</primary>
15717 </indexterm>
15718 If the string contains and characters with the most significant bit set,
15719 they are converted to escape sequences starting with a backslash.
15720 Backslashes and DEL characters are also converted.
15721 </para>
15722 </listitem></varlistentry>
15723 <varlistentry>
15724 <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>
15725 <listitem>
15726 <para>
15727 <indexterm role="concept">
15728 <primary>expansion</primary>
15729 <secondary>expression evaluation</secondary>
15730 </indexterm>
15731 <indexterm role="concept">
15732 <primary>expansion</primary>
15733 <secondary>arithmetic expression</secondary>
15734 </indexterm>
15735 <indexterm role="concept">
15736 <primary><option>eval</option> expansion item</primary>
15737 </indexterm>
15738 These items supports simple arithmetic and bitwise logical operations in
15739 expansion strings. The string (after expansion) must be a conventional
15740 arithmetic expression, but it is limited to basic arithmetic operators, bitwise
15741 logical operators, and parentheses. All operations are carried out using
15742 integer arithmetic. The operator priorities are as follows (the same as in the
15743 C programming language):
15744 </para>
15745 <informaltable frame="none">
15746 <tgroup cols="2" colsep="0" rowsep="0">
15747 <colspec colwidth="70pt" align="left"/>
15748 <colspec colwidth="300pt" align="left"/>
15749 <tbody>
15750 <row>
15751 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>highest:</emphasis></entry>
15752 <entry>not (~), negate (-)</entry>
15753 </row>
15754 <row>
15755 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
15756 <entry>multiply (*), divide (/), remainder (%)</entry>
15757 </row>
15758 <row>
15759 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
15760 <entry>plus (+), minus (-)</entry>
15761 </row>
15762 <row>
15763 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
15764 <entry>shift-left (&lt;&lt;), shift-right (&gt;&gt;)</entry>
15765 </row>
15766 <row>
15767 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
15768 <entry>and (&amp;)</entry>
15769 </row>
15770 <row>
15771 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
15772 <entry>xor (^)</entry>
15773 </row>
15774 <row>
15775 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>lowest:</emphasis></entry>
15776 <entry>or (|)</entry>
15777 </row>
15778 </tbody>
15779 </tgroup>
15780 </informaltable>
15781 <para>
15782 Binary operators with the same priority are evaluated from left to right. White
15783 space is permitted before or after operators.
15784 </para>
15785 <para>
15786 For <option>eval</option>, numbers may be decimal, octal (starting with <quote>0</quote>) or
15787 hexadecimal (starting with <quote>0x</quote>). For <option>eval10</option>, all numbers are taken as
15788 decimal, even if they start with a leading zero; hexadecimal numbers are not
15789 permitted. This can be useful when processing numbers extracted from dates or
15790 times, which often do have leading zeros.
15791 </para>
15792 <para>
15793 A number may be followed by <quote>K</quote>, <quote>M</quote> or <quote>G</quote> to multiply it by 1024, 1024*1024
15794 or 1024*1024*1024,
15795 respectively. Negative numbers are supported. The result of the computation is
15796 a decimal representation of the answer (without <quote>K</quote>, <quote>M</quote> or <quote>G</quote>). For example:
15797 </para>
15798 <literallayout>
15799 <literal>${eval:1+1}            </literal>  yields 2
15800 <literal>${eval:1+2*3}          </literal>  yields 7
15801 <literal>${eval:(1+2)*3}        </literal>  yields 9
15802 <literal>${eval:2+42%5}         </literal>  yields 4
15803 <literal>${eval:0xc&amp;5}          </literal>  yields 4
15804 <literal>${eval:0xc|5}          </literal>  yields 13
15805 <literal>${eval:0xc^5}          </literal>  yields 9
15806 <literal>${eval:0xc&gt;&gt;1}         </literal>  yields 6
15807 <literal>${eval:0xc&lt;&lt;1}         </literal>  yields 24
15808 <literal>${eval:~255&amp;0x1234}    </literal>  yields 4608
15809 <literal>${eval:-(~255&amp;0x1234)} </literal>  yields -4608
15810 </literallayout>
15811 <para>
15812 As a more realistic example, in an ACL you might have
15813 </para>
15814 <literallayout class="monospaced">
15815 deny   message = Too many bad recipients
15816        condition =                    \
15817          ${if and {                   \
15818            {&gt;{$rcpt_count}{10}}       \
15819            {                          \
15820            &lt;                          \
15821              {$recipients_count}      \
15822              {${eval:$rcpt_count/2}}  \
15823            }                          \
15824          }{yes}{no}}
15825 </literallayout>
15826 <para>
15827 The condition is true if there have been more than 10 RCPT commands and
15828 fewer than half of them have resulted in a valid recipient.
15829 </para>
15830 </listitem></varlistentry>
15831 <varlistentry>
15832 <term><emphasis role="bold">${expand:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15833 <listitem>
15834 <para>
15835 <indexterm role="concept">
15836 <primary>expansion</primary>
15837 <secondary>re-expansion of substring</secondary>
15838 </indexterm>
15839 The <option>expand</option> operator causes a string to be expanded for a second time. For
15840 example,
15841 </para>
15842 <literallayout class="monospaced">
15843 ${expand:${lookup{$domain}dbm{/some/file}{$value}}}
15844 </literallayout>
15845 <para>
15846 first looks up a string in a file while expanding the operand for <option>expand</option>,
15847 and then re-expands what it has found.
15848 </para>
15849 </listitem></varlistentry>
15850 <varlistentry>
15851 <term><emphasis role="bold">${from_utf8:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15852 <listitem>
15853 <para>
15854 <indexterm role="concept">
15855 <primary>Unicode</primary>
15856 </indexterm>
15857 <indexterm role="concept">
15858 <primary>UTF-8</primary>
15859 <secondary>conversion from</secondary>
15860 </indexterm>
15861 <indexterm role="concept">
15862 <primary>expansion</primary>
15863 <secondary>UTF-8 conversion</secondary>
15864 </indexterm>
15865 <indexterm role="concept">
15866 <primary><option>from_utf8</option> expansion item</primary>
15867 </indexterm>
15868 The world is slowly moving towards Unicode, although there are no standards for
15869 email yet. However, other applications (including some databases) are starting
15870 to store data in Unicode, using UTF-8 encoding. This operator converts from a
15871 UTF-8 string to an ISO-8859-1 string. UTF-8 code values greater than 255 are
15872 converted to underscores. The input must be a valid UTF-8 string. If it is not,
15873 the result is an undefined sequence of bytes.
15874 </para>
15875 <para>
15876 Unicode code points with values less than 256 are compatible with ASCII and
15877 ISO-8859-1 (also known as Latin-1).
15878 For example, character 169 is the copyright symbol in both cases, though the
15879 way it is encoded is different. In UTF-8, more than one byte is needed for
15880 characters with code values greater than 127, whereas ISO-8859-1 is a
15881 single-byte encoding (but thereby limited to 256 characters). This makes
15882 translation from UTF-8 to ISO-8859-1 straightforward.
15883 </para>
15884 </listitem></varlistentry>
15885 <varlistentry>
15886 <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>
15887 <listitem>
15888 <para>
15889 <indexterm role="concept">
15890 <primary>hash function</primary>
15891 <secondary>textual</secondary>
15892 </indexterm>
15893 <indexterm role="concept">
15894 <primary>expansion</primary>
15895 <secondary>textual hash</secondary>
15896 </indexterm>
15897 The <option>hash</option> operator is a simpler interface to the hashing function that can
15898 be used when the two parameters are fixed numbers (as opposed to strings that
15899 change when expanded). The effect is the same as
15900 </para>
15901 <literallayout class="monospaced">
15902 ${hash{&lt;n&gt;}{&lt;m&gt;}{&lt;string&gt;}}
15903 </literallayout>
15904 <para>
15905 See the description of the general <option>hash</option> item above for details. The
15906 abbreviation <option>h</option> can be used when <option>hash</option> is used as an operator.
15907 </para>
15908 </listitem></varlistentry>
15909 <varlistentry>
15910 <term><emphasis role="bold">${hex2b64:</emphasis>&lt;<emphasis>hexstring</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15911 <listitem>
15912 <para>
15913 <indexterm role="concept">
15914 <primary>base64 encoding</primary>
15915 <secondary>conversion from hex</secondary>
15916 </indexterm>
15917 <indexterm role="concept">
15918 <primary>expansion</primary>
15919 <secondary>hex to base64</secondary>
15920 </indexterm>
15921 <indexterm role="concept">
15922 <primary><option>hex2b64</option> expansion item</primary>
15923 </indexterm>
15924 This operator converts a hex string into one that is base64 encoded. This can
15925 be useful for processing the output of the various hashing functions.
15926 </para>
15927 </listitem></varlistentry>
15928 <varlistentry>
15929 <term><emphasis role="bold">${hexquote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15930 <listitem>
15931 <para>
15932 <indexterm role="concept">
15933 <primary>quoting</primary>
15934 <secondary>hex-encoded unprintable characters</secondary>
15935 </indexterm>
15936 <indexterm role="concept">
15937 <primary><option>hexquote</option> expansion item</primary>
15938 </indexterm>
15939 This operator converts non-printable characters in a string into a hex
15940 escape form. Byte values between 33 (!) and 126 (~) inclusive are left
15941 as is, and other byte values are converted to <literal>\xNN</literal>, for example, a
15942 byte value 127 is converted to <literal>\x7f</literal>.
15943 </para>
15944 </listitem></varlistentry>
15945 <varlistentry>
15946 <term><emphasis role="bold">${ipv6denorm:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15947 <listitem>
15948 <para>
15949 <indexterm role="concept">
15950 <primary><option>ipv6denorm</option> expansion item</primary>
15951 </indexterm>
15952 <indexterm role="concept">
15953 <primary>IP address</primary>
15954 <secondary>normalisation</secondary>
15955 </indexterm>
15956 This expands an IPv6 address to a full eight-element colon-separated set
15957 of hex digits including leading zeroes.
15958 A trailing ipv4-style dotted-decimal set is converted to hex.
15959 Pure IPv4 addresses are converted to IPv4-mapped IPv6.
15960 </para>
15961 </listitem></varlistentry>
15962 <varlistentry>
15963 <term><emphasis role="bold">${ipv6norm:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15964 <listitem>
15965 <para>
15966 <indexterm role="concept">
15967 <primary><option>ipv6norm</option> expansion item</primary>
15968 </indexterm>
15969 <indexterm role="concept">
15970 <primary>IP address</primary>
15971 <secondary>normalisation</secondary>
15972 </indexterm>
15973 <indexterm role="concept">
15974 <primary>IP address</primary>
15975 <secondary>canonical form</secondary>
15976 </indexterm>
15977 This converts an IPv6 address to canonical form.
15978 Leading zeroes of groups are omitted, and the longest
15979 set of zero-valued groups is replaced with a double colon.
15980 A trailing ipv4-style dotted-decimal set is converted to hex.
15981 Pure IPv4 addresses are converted to IPv4-mapped IPv6.
15982 </para>
15983 </listitem></varlistentry>
15984 <varlistentry>
15985 <term><emphasis role="bold">${lc:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15986 <listitem>
15987 <para>
15988 <indexterm role="concept">
15989 <primary>case forcing in strings</primary>
15990 </indexterm>
15991 <indexterm role="concept">
15992 <primary>string</primary>
15993 <secondary>case forcing</secondary>
15994 </indexterm>
15995 <indexterm role="concept">
15996 <primary>lower casing</primary>
15997 </indexterm>
15998 <indexterm role="concept">
15999 <primary>expansion</primary>
16000 <secondary>case forcing</secondary>
16001 </indexterm>
16002 <indexterm role="concept">
16003 <primary><option>lc</option> expansion item</primary>
16004 </indexterm>
16005 This forces the letters in the string into lower-case, for example:
16006 </para>
16007 <literallayout class="monospaced">
16008 ${lc:$local_part}
16009 </literallayout>
16010 <para>
16011 Case is defined per the system C locale.
16012 </para>
16013 </listitem></varlistentry>
16014 <varlistentry>
16015 <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>
16016 <listitem>
16017 <para>
16018 <indexterm role="concept">
16019 <primary>expansion</primary>
16020 <secondary>string truncation</secondary>
16021 </indexterm>
16022 <indexterm role="concept">
16023 <primary><option>length</option> expansion item</primary>
16024 </indexterm>
16025 The <option>length</option> operator is a simpler interface to the <option>length</option> function that
16026 can be used when the parameter is a fixed number (as opposed to a string that
16027 changes when expanded). The effect is the same as
16028 </para>
16029 <literallayout class="monospaced">
16030 ${length{&lt;number&gt;}{&lt;string&gt;}}
16031 </literallayout>
16032 <para>
16033 See the description of the general <option>length</option> item above for details. Note that
16034 <option>length</option> is not the same as <option>strlen</option>. The abbreviation <option>l</option> can be used
16035 when <option>length</option> is used as an operator.
16036 All measurement is done in bytes and is not UTF-8 aware.
16037 </para>
16038 </listitem></varlistentry>
16039 <varlistentry>
16040 <term><emphasis role="bold">${listcount:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16041 <listitem>
16042 <para>
16043 <indexterm role="concept">
16044 <primary>expansion</primary>
16045 <secondary>list item count</secondary>
16046 </indexterm>
16047 <indexterm role="concept">
16048 <primary>list</primary>
16049 <secondary>item count</secondary>
16050 </indexterm>
16051 <indexterm role="concept">
16052 <primary>list</primary>
16053 <secondary>count of items</secondary>
16054 </indexterm>
16055 <indexterm role="concept">
16056 <primary><option>listcount</option> expansion item</primary>
16057 </indexterm>
16058 The string is interpreted as a list and the number of items is returned.
16059 </para>
16060 </listitem></varlistentry>
16061 <varlistentry>
16062 <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>
16063 <listitem>
16064 <para>
16065 <indexterm role="concept">
16066 <primary>expansion</primary>
16067 <secondary>named list</secondary>
16068 </indexterm>
16069 <indexterm role="concept">
16070 <primary><option>listnamed</option> expansion item</primary>
16071 </indexterm>
16072 The name is interpreted as a named list and the content of the list is returned,
16073 expanding any referenced lists, re-quoting as needed for colon-separation.
16074 If the optional type is given it must be one of "a", "d", "h" or "l"
16075 and selects address-, domain-, host- or localpart- lists to search among respectively.
16076 Otherwise all types are searched in an undefined order and the first
16077 matching list is returned.
16078 </para>
16079 </listitem></varlistentry>
16080 <varlistentry>
16081 <term><emphasis role="bold">${local_part:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16082 <listitem>
16083 <para>
16084 <indexterm role="concept">
16085 <primary>expansion</primary>
16086 <secondary>local part extraction</secondary>
16087 </indexterm>
16088 <indexterm role="concept">
16089 <primary><option>local_part</option> expansion item</primary>
16090 </indexterm>
16091 The string is interpreted as an RFC 2822 address and the local part is
16092 extracted from it. If the string does not parse successfully, the result is
16093 empty.
16094 The parsing correctly handles SMTPUTF8 Unicode in the string.
16095 </para>
16096 </listitem></varlistentry>
16097 <varlistentry>
16098 <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>
16099 <listitem>
16100 <para>
16101 <indexterm role="concept">
16102 <primary>masked IP address</primary>
16103 </indexterm>
16104 <indexterm role="concept">
16105 <primary>IP address</primary>
16106 <secondary>masking</secondary>
16107 </indexterm>
16108 <indexterm role="concept">
16109 <primary>CIDR notation</primary>
16110 </indexterm>
16111 <indexterm role="concept">
16112 <primary>expansion</primary>
16113 <secondary>IP address masking</secondary>
16114 </indexterm>
16115 <indexterm role="concept">
16116 <primary><option>mask</option> expansion item</primary>
16117 </indexterm>
16118 If the form of the string to be operated on is not an IP address followed by a
16119 slash and an integer (that is, a network address in CIDR notation), the
16120 expansion fails. Otherwise, this operator converts the IP address to binary,
16121 masks off the least significant bits according to the bit count, and converts
16122 the result back to text, with mask appended. For example,
16123 </para>
16124 <literallayout class="monospaced">
16125 ${mask:10.111.131.206/28}
16126 </literallayout>
16127 <para>
16128 returns the string <quote>10.111.131.192/28</quote>. Since this operation is expected to
16129 be mostly used for looking up masked addresses in files, the result for an IPv6
16130 address uses dots to separate components instead of colons, because colon
16131 terminates a key string in lsearch files. So, for example,
16132 </para>
16133 <literallayout class="monospaced">
16134 ${mask:3ffe:ffff:836f:0a00:000a:0800:200a:c031/99}
16135 </literallayout>
16136 <para>
16137 returns the string
16138 </para>
16139 <literallayout class="monospaced">
16140 3ffe.ffff.836f.0a00.000a.0800.2000.0000/99
16141 </literallayout>
16142 <para>
16143 Letters in IPv6 addresses are always output in lower case.
16144 </para>
16145 </listitem></varlistentry>
16146 <varlistentry>
16147 <term><emphasis role="bold">${md5:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16148 <listitem>
16149 <para>
16150 <indexterm role="concept">
16151 <primary>MD5 hash</primary>
16152 </indexterm>
16153 <indexterm role="concept">
16154 <primary>expansion</primary>
16155 <secondary>MD5 hash</secondary>
16156 </indexterm>
16157 <indexterm role="concept">
16158 <primary>certificate</primary>
16159 <secondary>fingerprint</secondary>
16160 </indexterm>
16161 <indexterm role="concept">
16162 <primary><option>md5</option> expansion item</primary>
16163 </indexterm>
16164 The <option>md5</option> operator computes the MD5 hash value of the string, and returns it
16165 as a 32-digit hexadecimal number, in which any letters are in lower case.
16166 </para>
16167 <para>
16168 If the string is a single variable of type certificate,
16169 returns the MD5 hash fingerprint of the certificate.
16170 </para>
16171 </listitem></varlistentry>
16172 <varlistentry>
16173 <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>
16174 <listitem>
16175 <para>
16176 <indexterm role="concept">
16177 <primary>expansion</primary>
16178 <secondary>numeric hash</secondary>
16179 </indexterm>
16180 <indexterm role="concept">
16181 <primary>hash function</primary>
16182 <secondary>numeric</secondary>
16183 </indexterm>
16184 The <option>nhash</option> operator is a simpler interface to the numeric hashing function
16185 that can be used when the two parameters are fixed numbers (as opposed to
16186 strings that change when expanded). The effect is the same as
16187 </para>
16188 <literallayout class="monospaced">
16189 ${nhash{&lt;n&gt;}{&lt;m&gt;}{&lt;string&gt;}}
16190 </literallayout>
16191 <para>
16192 See the description of the general <option>nhash</option> item above for details.
16193 </para>
16194 </listitem></varlistentry>
16195 <varlistentry>
16196 <term><emphasis role="bold">${quote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16197 <listitem>
16198 <para>
16199 <indexterm role="concept">
16200 <primary>quoting</primary>
16201 <secondary>in string expansions</secondary>
16202 </indexterm>
16203 <indexterm role="concept">
16204 <primary>expansion</primary>
16205 <secondary>quoting</secondary>
16206 </indexterm>
16207 <indexterm role="concept">
16208 <primary><option>quote</option> expansion item</primary>
16209 </indexterm>
16210 The <option>quote</option> operator puts its argument into double quotes if it
16211 is an empty string or
16212 contains anything other than letters, digits, underscores, dots, and hyphens.
16213 Any occurrences of double quotes and backslashes are escaped with a backslash.
16214 Newlines and carriage returns are converted to <literal>\n</literal> and <literal>\r</literal>,
16215 respectively For example,
16216 </para>
16217 <literallayout class="monospaced">
16218 ${quote:ab"*"cd}
16219 </literallayout>
16220 <para>
16221 becomes
16222 </para>
16223 <literallayout class="monospaced">
16224 "ab\"*\"cd"
16225 </literallayout>
16226 <para>
16227 The place where this is useful is when the argument is a substitution from a
16228 variable or a message header.
16229 </para>
16230 </listitem></varlistentry>
16231 <varlistentry>
16232 <term><emphasis role="bold">${quote_local_part:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16233 <listitem>
16234 <para>
16235 <indexterm role="concept">
16236 <primary><option>quote_local_part</option> expansion item</primary>
16237 </indexterm>
16238 This operator is like <option>quote</option>, except that it quotes the string only if
16239 required to do so by the rules of RFC 2822 for quoting local parts. For
16240 example, a plus sign would not cause quoting (but it would for <option>quote</option>).
16241 If you are creating a new email address from the contents of <varname>$local_part</varname>
16242 (or any other unknown data), you should always use this operator.
16243 </para>
16244 <para>
16245 This quoting determination is not SMTPUTF8-aware, thus quoting non-ASCII data
16246 will likely use the quoting form.
16247 Thus <emphasis>${quote_local_part:フィル}</emphasis> will always become <emphasis>"フィル"</emphasis>.
16248 </para>
16249 </listitem></varlistentry>
16250 <varlistentry>
16251 <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>
16252 <listitem>
16253 <para>
16254 <indexterm role="concept">
16255 <primary>quoting</primary>
16256 <secondary>lookup-specific</secondary>
16257 </indexterm>
16258 This operator applies lookup-specific quoting rules to the string. Each
16259 query-style lookup type has its own quoting rules which are described with
16260 the lookups in chapter <xref linkend="CHAPfdlookup"/>. For example,
16261 </para>
16262 <literallayout class="monospaced">
16263 ${quote_ldap:two * two}
16264 </literallayout>
16265 <para>
16266 returns
16267 </para>
16268 <literallayout class="monospaced">
16269 two%20%5C2A%20two
16270 </literallayout>
16271 <para>
16272 For single-key lookup types, no quoting is ever necessary and this operator
16273 yields an unchanged string.
16274 </para>
16275 </listitem></varlistentry>
16276 <varlistentry>
16277 <term><emphasis role="bold">${randint:</emphasis>&lt;<emphasis>n</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16278 <listitem>
16279 <para>
16280 <indexterm role="concept">
16281 <primary>random number</primary>
16282 </indexterm>
16283 This operator returns a somewhat random number which is less than the
16284 supplied number and is at least 0.  The quality of this randomness depends
16285 on how Exim was built; the values are not suitable for keying material.
16286 If Exim is linked against OpenSSL then RAND_pseudo_bytes() is used.
16287 If Exim is linked against GnuTLS then gnutls_rnd(GNUTLS_RND_NONCE) is used,
16288 for versions of GnuTLS with that function.
16289 Otherwise, the implementation may be arc4random(), random() seeded by
16290 srandomdev() or srandom(), or a custom implementation even weaker than
16291 random().
16292 </para>
16293 </listitem></varlistentry>
16294 <varlistentry>
16295 <term><emphasis role="bold">${reverse_ip:</emphasis>&lt;<emphasis>ipaddr</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16296 <listitem>
16297 <para>
16298 <indexterm role="concept">
16299 <primary>expansion</primary>
16300 <secondary>IP address</secondary>
16301 </indexterm>
16302 This operator reverses an IP address; for IPv4 addresses, the result is in
16303 dotted-quad decimal form, while for IPv6 addresses the result is in
16304 dotted-nibble hexadecimal form.  In both cases, this is the "natural" form
16305 for DNS.  For example,
16306 </para>
16307 <literallayout class="monospaced">
16308 ${reverse_ip:192.0.2.4}
16309 ${reverse_ip:2001:0db8:c42:9:1:abcd:192.0.2.127}
16310 </literallayout>
16311 <para>
16312 returns
16313 </para>
16314 <literallayout class="monospaced">
16315 4.2.0.192
16316 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
16317 </literallayout>
16318 </listitem></varlistentry>
16319 <varlistentry>
16320 <term><emphasis role="bold">${rfc2047:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16321 <listitem>
16322 <para>
16323 <indexterm role="concept">
16324 <primary>expansion</primary>
16325 <secondary>RFC 2047</secondary>
16326 </indexterm>
16327 <indexterm role="concept">
16328 <primary>RFC 2047</primary>
16329 <secondary>expansion operator</secondary>
16330 </indexterm>
16331 <indexterm role="concept">
16332 <primary><option>rfc2047</option> expansion item</primary>
16333 </indexterm>
16334 This operator encodes text according to the rules of RFC 2047. This is an
16335 encoding that is used in header lines to encode non-ASCII characters. It is
16336 assumed that the input string is in the encoding specified by the
16337 <option>headers_charset</option> option, which gets its default at build time. If the string
16338 contains only characters in the range 33&ndash;126, and no instances of the
16339 characters
16340 </para>
16341 <literallayout class="monospaced">
16342 ? = ( ) &lt; &gt; @ , ; : \ " . [ ] _
16343 </literallayout>
16344 <para>
16345 it is not modified. Otherwise, the result is the RFC 2047 encoding of the
16346 string, using as many <quote>encoded words</quote> as necessary to encode all the
16347 characters.
16348 </para>
16349 </listitem></varlistentry>
16350 <varlistentry>
16351 <term><emphasis role="bold">${rfc2047d:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16352 <listitem>
16353 <para>
16354 <indexterm role="concept">
16355 <primary>expansion</primary>
16356 <secondary>RFC 2047</secondary>
16357 </indexterm>
16358 <indexterm role="concept">
16359 <primary>RFC 2047</primary>
16360 <secondary>decoding</secondary>
16361 </indexterm>
16362 <indexterm role="concept">
16363 <primary><option>rfc2047d</option> expansion item</primary>
16364 </indexterm>
16365 This operator decodes strings that are encoded as per RFC 2047. Binary zero
16366 bytes are replaced by question marks. Characters are converted into the
16367 character set defined by <option>headers_charset</option>. Overlong RFC 2047 <quote>words</quote> are
16368 not recognized unless <option>check_rfc2047_length</option> is set false.
16369 </para>
16370 <para>
16371 <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
16372 access a header line, RFC 2047 decoding is done automatically. You do not need
16373 to use this operator as well.
16374 </para>
16375 </listitem></varlistentry>
16376 <varlistentry>
16377 <term><emphasis role="bold">${rxquote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16378 <listitem>
16379 <para>
16380 <indexterm role="concept">
16381 <primary>quoting</primary>
16382 <secondary>in regular expressions</secondary>
16383 </indexterm>
16384 <indexterm role="concept">
16385 <primary>regular expressions</primary>
16386 <secondary>quoting</secondary>
16387 </indexterm>
16388 <indexterm role="concept">
16389 <primary><option>rxquote</option> expansion item</primary>
16390 </indexterm>
16391 The <option>rxquote</option> operator inserts a backslash before any non-alphanumeric
16392 characters in its argument. This is useful when substituting the values of
16393 variables or headers inside regular expressions.
16394 </para>
16395 </listitem></varlistentry>
16396 <varlistentry>
16397 <term><emphasis role="bold">${sha1:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16398 <listitem>
16399 <para>
16400 <indexterm role="concept">
16401 <primary>SHA-1 hash</primary>
16402 </indexterm>
16403 <indexterm role="concept">
16404 <primary>expansion</primary>
16405 <secondary>SHA-1 hashing</secondary>
16406 </indexterm>
16407 <indexterm role="concept">
16408 <primary>certificate</primary>
16409 <secondary>fingerprint</secondary>
16410 </indexterm>
16411 <indexterm role="concept">
16412 <primary><option>sha1</option> expansion item</primary>
16413 </indexterm>
16414 The <option>sha1</option> operator computes the SHA-1 hash value of the string, and returns
16415 it as a 40-digit hexadecimal number, in which any letters are in upper case.
16416 </para>
16417 <para>
16418 If the string is a single variable of type certificate,
16419 returns the SHA-1 hash fingerprint of the certificate.
16420 </para>
16421 </listitem></varlistentry>
16422 <varlistentry>
16423 <term><emphasis role="bold">${sha256:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16424 <listitem>
16425 <para>
16426 <indexterm role="concept">
16427 <primary>SHA-256 hash</primary>
16428 </indexterm>
16429 <indexterm role="concept">
16430 <primary>certificate</primary>
16431 <secondary>fingerprint</secondary>
16432 </indexterm>
16433 <indexterm role="concept">
16434 <primary>expansion</primary>
16435 <secondary>SHA-256 hashing</secondary>
16436 </indexterm>
16437 <indexterm role="concept">
16438 <primary><option>sha256</option> expansion item</primary>
16439 </indexterm>
16440 The <option>sha256</option> operator computes the SHA-256 hash value of the string
16441 and returns
16442 it as a 64-digit hexadecimal number, in which any letters are in upper case.
16443 </para>
16444 <para>
16445 If the string is a single variable of type certificate,
16446 returns the SHA-256 hash fingerprint of the certificate.
16447 </para>
16448 </listitem></varlistentry>
16449 <varlistentry>
16450 <term><emphasis role="bold">${sha3:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16451 <term><emphasis role="bold">${sha3_&lt;n&gt;:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16452 <listitem>
16453 <para>
16454 <indexterm role="concept">
16455 <primary>SHA3 hash</primary>
16456 </indexterm>
16457 <indexterm role="concept">
16458 <primary>expansion</primary>
16459 <secondary>SHA3 hashing</secondary>
16460 </indexterm>
16461 <indexterm role="concept">
16462 <primary><option>sha3</option> expansion item</primary>
16463 </indexterm>
16464 The <option>sha3</option> operator computes the SHA3-256 hash value of the string
16465 and returns
16466 it as a 64-digit hexadecimal number, in which any letters are in upper case.
16467 </para>
16468 <para>
16469 If a number is appended, separated by an underbar, it specifies
16470 the output length.  Values of 224, 256, 384 and 512 are accepted;
16471 with 256 being the default.
16472 </para>
16473 <para>
16474 The <option>sha3</option> expansion item is only supported if Exim has been
16475 compiled with GnuTLS 3.5.0 or later,
16476 or OpenSSL 1.1.1 or later.
16477 The macro "_CRYPTO_HASH_SHA3" will be defined if it is supported.
16478 </para>
16479 </listitem></varlistentry>
16480 <varlistentry>
16481 <term><emphasis role="bold">${stat:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16482 <listitem>
16483 <para>
16484 <indexterm role="concept">
16485 <primary>expansion</primary>
16486 <secondary>statting a file</secondary>
16487 </indexterm>
16488 <indexterm role="concept">
16489 <primary>file</primary>
16490 <secondary>extracting characteristics</secondary>
16491 </indexterm>
16492 <indexterm role="concept">
16493 <primary><option>stat</option> expansion item</primary>
16494 </indexterm>
16495 The string, after expansion, must be a file path. A call to the <function>stat()</function>
16496 function is made for this path. If <function>stat()</function> fails, an error occurs and the
16497 expansion fails. If it succeeds, the data from the stat replaces the item, as a
16498 series of &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt; pairs, where the values are all numerical,
16499 except for the value of <quote>smode</quote>. The names are: <quote>mode</quote> (giving the mode as
16500 a 4-digit octal number), <quote>smode</quote> (giving the mode in symbolic format as a
16501 10-character string, as for the <emphasis>ls</emphasis> command), <quote>inode</quote>, <quote>device</quote>,
16502 <quote>links</quote>, <quote>uid</quote>, <quote>gid</quote>, <quote>size</quote>, <quote>atime</quote>, <quote>mtime</quote>, and <quote>ctime</quote>. You
16503 can extract individual fields using the <option>extract</option> expansion item.
16504 </para>
16505 <para>
16506 The use of the <option>stat</option> expansion in users&#x2019; filter files can be locked out by
16507 the system administrator. <emphasis role="bold">Warning</emphasis>: The file size may be incorrect on 32-bit
16508 systems for files larger than 2GB.
16509 </para>
16510 </listitem></varlistentry>
16511 <varlistentry>
16512 <term><emphasis role="bold">${str2b64:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16513 <listitem>
16514 <para>
16515 <indexterm role="concept">
16516 <primary><option>str2b64</option> expansion item</primary>
16517 </indexterm>
16518 Now deprecated, a synonym for the <option>base64</option> expansion operator.
16519 </para>
16520 </listitem></varlistentry>
16521 <varlistentry>
16522 <term><emphasis role="bold">${strlen:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16523 <listitem>
16524 <para>
16525 <indexterm role="concept">
16526 <primary>expansion</primary>
16527 <secondary>string length</secondary>
16528 </indexterm>
16529 <indexterm role="concept">
16530 <primary>string</primary>
16531 <secondary>length in expansion</secondary>
16532 </indexterm>
16533 <indexterm role="concept">
16534 <primary><option>strlen</option> expansion item</primary>
16535 </indexterm>
16536 The item is replace by the length of the expanded string, expressed as a
16537 decimal number. <emphasis role="bold">Note</emphasis>: Do not confuse <option>strlen</option> with <option>length</option>.
16538 All measurement is done in bytes and is not UTF-8 aware.
16539 </para>
16540 </listitem></varlistentry>
16541 <varlistentry>
16542 <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>
16543 <listitem>
16544 <para>
16545 <indexterm role="concept">
16546 <primary><option>substr</option> expansion item</primary>
16547 </indexterm>
16548 <indexterm role="concept">
16549 <primary>substring extraction</primary>
16550 </indexterm>
16551 <indexterm role="concept">
16552 <primary>expansion</primary>
16553 <secondary>substring expansion</secondary>
16554 </indexterm>
16555 The <option>substr</option> operator is a simpler interface to the <option>substr</option> function that
16556 can be used when the two parameters are fixed numbers (as opposed to strings
16557 that change when expanded). The effect is the same as
16558 </para>
16559 <literallayout class="monospaced">
16560 ${substr{&lt;start&gt;}{&lt;length&gt;}{&lt;string&gt;}}
16561 </literallayout>
16562 <para>
16563 See the description of the general <option>substr</option> item above for details. The
16564 abbreviation <option>s</option> can be used when <option>substr</option> is used as an operator.
16565 All measurement is done in bytes and is not UTF-8 aware.
16566 </para>
16567 </listitem></varlistentry>
16568 <varlistentry>
16569 <term><emphasis role="bold">${time_eval:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16570 <listitem>
16571 <para>
16572 <indexterm role="concept">
16573 <primary><option>time_eval</option> expansion item</primary>
16574 </indexterm>
16575 <indexterm role="concept">
16576 <primary>time interval</primary>
16577 <secondary>decoding</secondary>
16578 </indexterm>
16579 This item converts an Exim time interval such as <literal>2d4h5m</literal> into a number of
16580 seconds.
16581 </para>
16582 </listitem></varlistentry>
16583 <varlistentry>
16584 <term><emphasis role="bold">${time_interval:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16585 <listitem>
16586 <para>
16587 <indexterm role="concept">
16588 <primary><option>time_interval</option> expansion item</primary>
16589 </indexterm>
16590 <indexterm role="concept">
16591 <primary>time interval</primary>
16592 <secondary>formatting</secondary>
16593 </indexterm>
16594 The argument (after sub-expansion) must be a sequence of decimal digits that
16595 represents an interval of time as a number of seconds. It is converted into a
16596 number of larger units and output in Exim&#x2019;s normal time format, for example,
16597 <literal>1w3d4h2m6s</literal>.
16598 </para>
16599 </listitem></varlistentry>
16600 <varlistentry>
16601 <term><emphasis role="bold">${uc:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16602 <listitem>
16603 <para>
16604 <indexterm role="concept">
16605 <primary>case forcing in strings</primary>
16606 </indexterm>
16607 <indexterm role="concept">
16608 <primary>string</primary>
16609 <secondary>case forcing</secondary>
16610 </indexterm>
16611 <indexterm role="concept">
16612 <primary>upper casing</primary>
16613 </indexterm>
16614 <indexterm role="concept">
16615 <primary>expansion</primary>
16616 <secondary>case forcing</secondary>
16617 </indexterm>
16618 <indexterm role="concept">
16619 <primary><option>uc</option> expansion item</primary>
16620 </indexterm>
16621 This forces the letters in the string into upper-case.
16622 Case is defined per the system C locale.
16623 </para>
16624 </listitem></varlistentry>
16625 <varlistentry>
16626 <term><emphasis role="bold">${utf8clean:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16627 <listitem>
16628 <para>
16629 <indexterm role="concept">
16630 <primary>correction of invalid utf-8 sequences in strings</primary>
16631 </indexterm>
16632 <indexterm role="concept">
16633 <primary>utf-8</primary>
16634 <secondary>utf-8 sequences</secondary>
16635 </indexterm>
16636 <indexterm role="concept">
16637 <primary>incorrect utf-8</primary>
16638 </indexterm>
16639 <indexterm role="concept">
16640 <primary>expansion</primary>
16641 <secondary>utf-8 forcing</secondary>
16642 </indexterm>
16643 <indexterm role="concept">
16644 <primary><option>utf8clean</option> expansion item</primary>
16645 </indexterm>
16646 This replaces any invalid utf-8 sequence in the string by the character <literal>?</literal>.
16647 </para>
16648 <para revisionflag="changed">
16649 In versions of Exim before 4.92, this did not correctly do so for a truncated
16650 final codepoint&#x2019;s encoding, and the character would be silently dropped.
16651 If you must handle detection of this scenario across both sets of Exim behavior,
16652 the complexity will depend upon the task.
16653 For instance, to detect if the first character is multibyte and a 1-byte
16654 extraction can be successfully used as a path component (as is common for
16655 dividing up delivery folders), you might use:
16656 </para>
16657 <literallayout class="monospaced" revisionflag="changed">
16658 condition = ${if inlist{${utf8clean:${length_1:$local_part}}}{:?}{yes}{no}}
16659 </literallayout>
16660 <para revisionflag="changed">
16661 (which will false-positive if the first character of the local part is a
16662 literal question mark).
16663 </para>
16664 </listitem></varlistentry>
16665 <varlistentry>
16666 <term><emphasis role="bold">${utf8_domain_to_alabel:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16667 <term><emphasis role="bold">${utf8_domain_from_alabel:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16668 <term><emphasis role="bold">${utf8_localpart_to_alabel:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16669 <term><emphasis role="bold">${utf8_localpart_from_alabel:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16670 <listitem>
16671 <para>
16672 <indexterm role="concept">
16673 <primary>expansion</primary>
16674 <secondary>UTF-8</secondary>
16675 </indexterm>
16676 <indexterm role="concept">
16677 <primary>UTF-8</primary>
16678 <secondary>expansion</secondary>
16679 </indexterm>
16680 <indexterm role="concept">
16681 <primary>EAI</primary>
16682 </indexterm>
16683 <indexterm role="concept">
16684 <primary>internationalisation</primary>
16685 </indexterm>
16686 <indexterm role="concept">
16687 <primary><option>utf8_domain_to_alabel</option> expansion item</primary>
16688 </indexterm>
16689 <indexterm role="concept">
16690 <primary><option>utf8_domain_from_alabel</option> expansion item</primary>
16691 </indexterm>
16692 <indexterm role="concept">
16693 <primary><option>utf8_localpart_to_alabel</option> expansion item</primary>
16694 </indexterm>
16695 <indexterm role="concept">
16696 <primary><option>utf8_localpart_from_alabel</option> expansion item</primary>
16697 </indexterm>
16698 These convert EAI mail name components between UTF-8 and a-label forms.
16699 For information on internationalisation support see <xref linkend="SECTi18nMTA"/>.
16700 </para>
16701 </listitem></varlistentry>
16702 </variablelist>
16703 </section>
16704 <section id="SECTexpcond">
16705 <title>Expansion conditions</title>
16706 <para>
16707 <indexterm role="concept" id="IIDexpcond" class="startofrange">
16708 <primary>expansion</primary>
16709 <secondary>conditions</secondary>
16710 </indexterm>
16711 The following conditions are available for testing by the <option>${if</option> construct
16712 while expanding strings:
16713 </para>
16714 <variablelist>
16715 <varlistentry>
16716 <term><emphasis role="bold">!</emphasis>&lt;<emphasis>condition</emphasis>&gt;</term>
16717 <listitem>
16718 <para>
16719 <indexterm role="concept">
16720 <primary>expansion</primary>
16721 <secondary>negating a condition</secondary>
16722 </indexterm>
16723 <indexterm role="concept">
16724 <primary>negation</primary>
16725 <secondary>in expansion condition</secondary>
16726 </indexterm>
16727 Preceding any condition with an exclamation mark negates the result of the
16728 condition.
16729 </para>
16730 </listitem></varlistentry>
16731 <varlistentry>
16732 <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>
16733 <listitem>
16734 <para>
16735 <indexterm role="concept">
16736 <primary>numeric comparison</primary>
16737 </indexterm>
16738 <indexterm role="concept">
16739 <primary>expansion</primary>
16740 <secondary>numeric comparison</secondary>
16741 </indexterm>
16742 There are a number of symbolic operators for doing numeric comparisons. They
16743 are:
16744 </para>
16745 <literallayout>
16746 <literal>=   </literal>   equal
16747 <literal>==  </literal>   equal
16748 <literal>&gt;   </literal>   greater
16749 <literal>&gt;=  </literal>   greater or equal
16750 <literal>&lt;   </literal>   less
16751 <literal>&lt;=  </literal>   less or equal
16752 </literallayout>
16753 <para>
16754 For example:
16755 </para>
16756 <literallayout class="monospaced">
16757 ${if &gt;{$message_size}{10M} ...
16758 </literallayout>
16759 <para>
16760 Note that the general negation operator provides for inequality testing. The
16761 two strings must take the form of optionally signed decimal integers,
16762 optionally followed by one of the letters <quote>K</quote>, <quote>M</quote> or <quote>G</quote> (in either upper or
16763 lower case), signifying multiplication by 1024, 1024*1024 or 1024*1024*1024, respectively.
16764 As a special case, the numerical value of an empty string is taken as
16765 zero.
16766 </para>
16767 <para>
16768 In all cases, a relative comparator OP is testing if &lt;<emphasis>string1</emphasis>&gt; OP
16769 &lt;<emphasis>string2</emphasis>&gt;; the above example is checking if <varname>$message_size</varname> is larger than
16770 10M, not if 10M is larger than <varname>$message_size</varname>.
16771 </para>
16772 </listitem></varlistentry>
16773 <varlistentry>
16774 <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>
16775 <listitem>
16776 <para>
16777 <indexterm role="concept">
16778 <primary>expansion</primary>
16779 <secondary>calling an acl</secondary>
16780 </indexterm>
16781 <indexterm role="concept">
16782 <primary><option>acl</option></primary>
16783 <secondary>expansion condition</secondary>
16784 </indexterm>
16785 The name and zero to nine argument strings are first expanded separately.  The expanded
16786 arguments are assigned to the variables <varname>$acl_arg1</varname> to <varname>$acl_arg9</varname> in order.
16787 Any unused are made empty.  The variable <varname>$acl_narg</varname> is set to the number of
16788 arguments.  The named ACL (see chapter <xref linkend="CHAPACL"/>) is called
16789 and may use the variables; if another acl expansion is used the values
16790 are restored after it returns.  If the ACL sets
16791 a value using a "message =" modifier the variable $value becomes
16792 the result of the expansion, otherwise it is empty.
16793 If the ACL returns accept the condition is true; if deny, false.
16794 If the ACL returns defer the result is a forced-fail.
16795 </para>
16796 </listitem></varlistentry>
16797 <varlistentry>
16798 <term><emphasis role="bold">bool&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16799 <listitem>
16800 <para>
16801 <indexterm role="concept">
16802 <primary>expansion</primary>
16803 <secondary>boolean parsing</secondary>
16804 </indexterm>
16805 <indexterm role="concept">
16806 <primary><option>bool</option> expansion condition</primary>
16807 </indexterm>
16808 This condition turns a string holding a true or false representation into
16809 a boolean state.  It parses <quote>true</quote>, <quote>false</quote>, <quote>yes</quote> and <quote>no</quote>
16810 (case-insensitively); also integer numbers map to true if non-zero,
16811 false if zero.
16812 An empty string is treated as false.
16813 Leading and trailing whitespace is ignored;
16814 thus a string consisting only of whitespace is false.
16815 All other string values will result in expansion failure.
16816 </para>
16817 <para>
16818 When combined with ACL variables, this expansion condition will let you
16819 make decisions in one place and act on those decisions in another place.
16820 For example:
16821 </para>
16822 <literallayout class="monospaced">
16823 ${if bool{$acl_m_privileged_sender} ...
16824 </literallayout>
16825 </listitem></varlistentry>
16826 <varlistentry>
16827 <term><emphasis role="bold">bool_lax&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16828 <listitem>
16829 <para>
16830 <indexterm role="concept">
16831 <primary>expansion</primary>
16832 <secondary>boolean parsing</secondary>
16833 </indexterm>
16834 <indexterm role="concept">
16835 <primary><option>bool_lax</option> expansion condition</primary>
16836 </indexterm>
16837 Like <option>bool</option>, this condition turns a string into a boolean state.  But
16838 where <option>bool</option> accepts a strict set of strings, <option>bool_lax</option> uses the same
16839 loose definition that the Router <option>condition</option> option uses.  The empty string
16840 and the values <quote>false</quote>, <quote>no</quote> and <quote>0</quote> map to false, all others map to
16841 true.  Leading and trailing whitespace is ignored.
16842 </para>
16843 <para>
16844 Note that where <quote>bool{00}</quote> is false, <quote>bool_lax{00}</quote> is true.
16845 </para>
16846 </listitem></varlistentry>
16847 <varlistentry>
16848 <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>
16849 <listitem>
16850 <para>
16851 <indexterm role="concept">
16852 <primary>expansion</primary>
16853 <secondary>encrypted comparison</secondary>
16854 </indexterm>
16855 <indexterm role="concept">
16856 <primary>encrypted strings, comparing</primary>
16857 </indexterm>
16858 <indexterm role="concept">
16859 <primary><option>crypteq</option> expansion condition</primary>
16860 </indexterm>
16861 This condition is included in the Exim binary if it is built to support any
16862 authentication mechanisms (see chapter <xref linkend="CHAPSMTPAUTH"/>). Otherwise, it is
16863 necessary to define SUPPORT_CRYPTEQ in <filename>Local/Makefile</filename> to get <option>crypteq</option>
16864 included in the binary.
16865 </para>
16866 <para>
16867 The <option>crypteq</option> condition has two arguments. The first is encrypted and
16868 compared against the second, which is already encrypted. The second string may
16869 be in the LDAP form for storing encrypted strings, which starts with the
16870 encryption type in curly brackets, followed by the data. If the second string
16871 does not begin with <quote>{</quote> it is assumed to be encrypted with <function>crypt()</function> or
16872 <function>crypt16()</function> (see below), since such strings cannot begin with <quote>{</quote>.
16873 Typically this will be a field from a password file. An example of an encrypted
16874 string in LDAP form is:
16875 </para>
16876 <literallayout class="monospaced">
16877 {md5}CY9rzUYh03PK3k6DJie09g==
16878 </literallayout>
16879 <para>
16880 If such a string appears directly in an expansion, the curly brackets have to
16881 be quoted, because they are part of the expansion syntax. For example:
16882 </para>
16883 <literallayout class="monospaced">
16884 ${if crypteq {test}{\{md5\}CY9rzUYh03PK3k6DJie09g==}{yes}{no}}
16885 </literallayout>
16886 <para>
16887 The following encryption types (whose names are matched case-independently) are
16888 supported:
16889 </para>
16890 <itemizedlist>
16891 <listitem>
16892 <para>
16893 <indexterm role="concept">
16894 <primary>MD5 hash</primary>
16895 </indexterm>
16896 <indexterm role="concept">
16897 <primary>base64 encoding</primary>
16898 <secondary>in encrypted password</secondary>
16899 </indexterm>
16900 <option>{md5}</option> computes the MD5 digest of the first string, and expresses this as
16901 printable characters to compare with the remainder of the second string. If the
16902 length of the comparison string is 24, Exim assumes that it is base64 encoded
16903 (as in the above example). If the length is 32, Exim assumes that it is a
16904 hexadecimal encoding of the MD5 digest. If the length not 24 or 32, the
16905 comparison fails.
16906 </para>
16907 </listitem>
16908 <listitem>
16909 <para>
16910 <indexterm role="concept">
16911 <primary>SHA-1 hash</primary>
16912 </indexterm>
16913 <option>{sha1}</option> computes the SHA-1 digest of the first string, and expresses this as
16914 printable characters to compare with the remainder of the second string. If the
16915 length of the comparison string is 28, Exim assumes that it is base64 encoded.
16916 If the length is 40, Exim assumes that it is a hexadecimal encoding of the
16917 SHA-1 digest. If the length is not 28 or 40, the comparison fails.
16918 </para>
16919 </listitem>
16920 <listitem>
16921 <para>
16922 <indexterm role="concept">
16923 <primary><function>crypt()</function></primary>
16924 </indexterm>
16925 <option>{crypt}</option> calls the <function>crypt()</function> function, which traditionally used to use
16926 only the first eight characters of the password. However, in modern operating
16927 systems this is no longer true, and in many cases the entire password is used,
16928 whatever its length.
16929 </para>
16930 </listitem>
16931 <listitem>
16932 <para>
16933 <indexterm role="concept">
16934 <primary><function>crypt16()</function></primary>
16935 </indexterm>
16936 <option>{crypt16}</option> calls the <function>crypt16()</function> function, which was originally created to
16937 use up to 16 characters of the password in some operating systems. Again, in
16938 modern operating systems, more characters may be used.
16939 </para>
16940 </listitem>
16941 </itemizedlist>
16942 <para>
16943 Exim has its own version of <function>crypt16()</function>, which is just a double call to
16944 <function>crypt()</function>. For operating systems that have their own version, setting
16945 HAVE_CRYPT16 in <filename>Local/Makefile</filename> when building Exim causes it to use the
16946 operating system version instead of its own. This option is set by default in
16947 the OS-dependent <filename>Makefile</filename> for those operating systems that are known to
16948 support <function>crypt16()</function>.
16949 </para>
16950 <para>
16951 Some years after Exim&#x2019;s <function>crypt16()</function> was implemented, a user discovered that
16952 it was not using the same algorithm as some operating systems&#x2019; versions. It
16953 turns out that as well as <function>crypt16()</function> there is a function called
16954 <function>bigcrypt()</function> in some operating systems. This may or may not use the same
16955 algorithm, and both of them may be different to Exim&#x2019;s built-in <function>crypt16()</function>.
16956 </para>
16957 <para>
16958 However, since there is now a move away from the traditional <function>crypt()</function>
16959 functions towards using SHA1 and other algorithms, tidying up this area of
16960 Exim is seen as very low priority.
16961 </para>
16962 <para>
16963 If you do not put a encryption type (in curly brackets) in a <option>crypteq</option>
16964 comparison, the default is usually either <literal>{crypt}</literal> or <literal>{crypt16}</literal>, as
16965 determined by the setting of DEFAULT_CRYPT in <filename>Local/Makefile</filename>. The default
16966 default is <literal>{crypt}</literal>. Whatever the default, you can always use either
16967 function by specifying it explicitly in curly brackets.
16968 </para>
16969 </listitem></varlistentry>
16970 <varlistentry>
16971 <term><emphasis role="bold">def:</emphasis>&lt;<emphasis>variable&nbsp;name</emphasis>&gt;</term>
16972 <listitem>
16973 <para>
16974 <indexterm role="concept">
16975 <primary>expansion</primary>
16976 <secondary>checking for empty variable</secondary>
16977 </indexterm>
16978 <indexterm role="concept">
16979 <primary><option>def</option> expansion condition</primary>
16980 </indexterm>
16981 The <option>def</option> condition must be followed by the name of one of the expansion
16982 variables defined in section <xref linkend="SECTexpvar"/>. The condition is true if the
16983 variable does not contain the empty string. For example:
16984 </para>
16985 <literallayout class="monospaced">
16986 ${if def:sender_ident {from $sender_ident}}
16987 </literallayout>
16988 <para>
16989 Note that the variable name is given without a leading <option>$</option> character. If the
16990 variable does not exist, the expansion fails.
16991 </para>
16992 </listitem></varlistentry>
16993 <varlistentry>
16994 <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>
16995 <listitem>
16996 <para>
16997 <indexterm role="concept">
16998 <primary>expansion</primary>
16999 <secondary>checking header line existence</secondary>
17000 </indexterm>
17001 This condition is true if a message is being processed and the named header
17002 exists in the message. For example,
17003 </para>
17004 <literallayout class="monospaced">
17005 ${if def:header_reply-to:{$h_reply-to:}{$h_from:}}
17006 </literallayout>
17007 <para>
17008 <emphasis role="bold">Note</emphasis>: No <option>$</option> appears before <option>header_</option> or <option>h_</option> in the condition, and
17009 the header name must be terminated by a colon if white space does not follow.
17010 </para>
17011 </listitem></varlistentry>
17012 <varlistentry>
17013 <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>
17014 <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>
17015 <listitem>
17016 <para>
17017 <indexterm role="concept">
17018 <primary>string</primary>
17019 <secondary>comparison</secondary>
17020 </indexterm>
17021 <indexterm role="concept">
17022 <primary>expansion</primary>
17023 <secondary>string comparison</secondary>
17024 </indexterm>
17025 <indexterm role="concept">
17026 <primary><option>eq</option> expansion condition</primary>
17027 </indexterm>
17028 <indexterm role="concept">
17029 <primary><option>eqi</option> expansion condition</primary>
17030 </indexterm>
17031 The two substrings are first expanded. The condition is true if the two
17032 resulting strings are identical. For <option>eq</option> the comparison includes the case of
17033 letters, whereas for <option>eqi</option> the comparison is case-independent, where
17034 case is defined per the system C locale.
17035 </para>
17036 </listitem></varlistentry>
17037 <varlistentry>
17038 <term><emphasis role="bold">exists&nbsp;{</emphasis>&lt;<emphasis>file&nbsp;name</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17039 <listitem>
17040 <para>
17041 <indexterm role="concept">
17042 <primary>expansion</primary>
17043 <secondary>file existence test</secondary>
17044 </indexterm>
17045 <indexterm role="concept">
17046 <primary>file</primary>
17047 <secondary>existence test</secondary>
17048 </indexterm>
17049 <indexterm role="concept">
17050 <primary><option>exists</option>, expansion condition</primary>
17051 </indexterm>
17052 The substring is first expanded and then interpreted as an absolute path. The
17053 condition is true if the named file (or directory) exists. The existence test
17054 is done by calling the <function>stat()</function> function. The use of the <option>exists</option> test in
17055 users&#x2019; filter files may be locked out by the system administrator.
17056 </para>
17057 </listitem></varlistentry>
17058 <varlistentry>
17059 <term><emphasis role="bold">first_delivery</emphasis></term>
17060 <listitem>
17061 <para>
17062 <indexterm role="concept">
17063 <primary>delivery</primary>
17064 <secondary>first</secondary>
17065 </indexterm>
17066 <indexterm role="concept">
17067 <primary>first delivery</primary>
17068 </indexterm>
17069 <indexterm role="concept">
17070 <primary>expansion</primary>
17071 <secondary>first delivery test</secondary>
17072 </indexterm>
17073 <indexterm role="concept">
17074 <primary><option>first_delivery</option> expansion condition</primary>
17075 </indexterm>
17076 This condition, which has no data, is true during a message&#x2019;s first delivery
17077 attempt. It is false during any subsequent delivery attempts.
17078 </para>
17079 </listitem></varlistentry>
17080 <varlistentry>
17081 <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>
17082 <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>
17083 <listitem>
17084 <para>
17085 <indexterm role="concept">
17086 <primary>list</primary>
17087 <secondary>iterative conditions</secondary>
17088 </indexterm>
17089 <indexterm role="concept">
17090 <primary>expansion</primary>
17091 <secondary><emphasis role="bold">forall</emphasis> condition</secondary>
17092 </indexterm>
17093 <indexterm role="concept">
17094 <primary>expansion</primary>
17095 <secondary><emphasis role="bold">forany</emphasis> condition</secondary>
17096 </indexterm>
17097 <indexterm role="variable">
17098 <primary><varname>$item</varname></primary>
17099 </indexterm>
17100 These conditions iterate over a list. The first argument is expanded to form
17101 the list. By default, the list separator is a colon, but it can be changed by
17102 the normal method (<xref linkend="SECTlistsepchange"/>).
17103 The second argument is interpreted as a condition that is to
17104 be applied to each item in the list in turn. During the interpretation of the
17105 condition, the current list item is placed in a variable called <varname>$item</varname>.
17106 </para>
17107 <itemizedlist>
17108 <listitem>
17109 <para>
17110 For <emphasis role="bold">forany</emphasis>, interpretation stops if the condition is true for any item, and
17111 the result of the whole condition is true. If the condition is false for all
17112 items in the list, the overall condition is false.
17113 </para>
17114 </listitem>
17115 <listitem>
17116 <para>
17117 For <emphasis role="bold">forall</emphasis>, interpretation stops if the condition is false for any item,
17118 and the result of the whole condition is false. If the condition is true for
17119 all items in the list, the overall condition is true.
17120 </para>
17121 </listitem>
17122 </itemizedlist>
17123 <para>
17124 Note that negation of <emphasis role="bold">forany</emphasis> means that the condition must be false for all
17125 items for the overall condition to succeed, and negation of <emphasis role="bold">forall</emphasis> means
17126 that the condition must be false for at least one item. In this example, the
17127 list separator is changed to a comma:
17128 </para>
17129 <literallayout class="monospaced">
17130 ${if forany{&lt;, $recipients}{match{$item}{^user3@}}{yes}{no}}
17131 </literallayout>
17132 <para>
17133 The value of <varname>$item</varname> is saved and restored while <emphasis role="bold">forany</emphasis> or <emphasis role="bold">forall</emphasis> is
17134 being processed, to enable these expansion items to be nested.
17135 </para>
17136 <para>
17137 To scan a named list, expand it with the <emphasis role="bold">listnamed</emphasis> operator.
17138 </para>
17139 </listitem></varlistentry>
17140 <varlistentry>
17141 <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>
17142 <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>
17143 <listitem>
17144 <para>
17145 <indexterm role="concept">
17146 <primary>string</primary>
17147 <secondary>comparison</secondary>
17148 </indexterm>
17149 <indexterm role="concept">
17150 <primary>expansion</primary>
17151 <secondary>string comparison</secondary>
17152 </indexterm>
17153 <indexterm role="concept">
17154 <primary><option>ge</option> expansion condition</primary>
17155 </indexterm>
17156 <indexterm role="concept">
17157 <primary><option>gei</option> expansion condition</primary>
17158 </indexterm>
17159 The two substrings are first expanded. The condition is true if the first
17160 string is lexically greater than or equal to the second string. For <option>ge</option> the
17161 comparison includes the case of letters, whereas for <option>gei</option> the comparison is
17162 case-independent.
17163 Case and collation order are defined per the system C locale.
17164 </para>
17165 </listitem></varlistentry>
17166 <varlistentry>
17167 <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>
17168 <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>
17169 <listitem>
17170 <para>
17171 <indexterm role="concept">
17172 <primary>string</primary>
17173 <secondary>comparison</secondary>
17174 </indexterm>
17175 <indexterm role="concept">
17176 <primary>expansion</primary>
17177 <secondary>string comparison</secondary>
17178 </indexterm>
17179 <indexterm role="concept">
17180 <primary><option>gt</option> expansion condition</primary>
17181 </indexterm>
17182 <indexterm role="concept">
17183 <primary><option>gti</option> expansion condition</primary>
17184 </indexterm>
17185 The two substrings are first expanded. The condition is true if the first
17186 string is lexically greater than the second string. For <option>gt</option> the comparison
17187 includes the case of letters, whereas for <option>gti</option> the comparison is
17188 case-independent.
17189 Case and collation order are defined per the system C locale.
17190 </para>
17191 </listitem></varlistentry>
17192 <varlistentry>
17193 <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>
17194 <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>
17195 <listitem>
17196 <para>
17197 <indexterm role="concept">
17198 <primary>string</primary>
17199 <secondary>comparison</secondary>
17200 </indexterm>
17201 <indexterm role="concept">
17202 <primary>list</primary>
17203 <secondary>iterative conditions</secondary>
17204 </indexterm>
17205 Both strings are expanded; the second string is treated as a list of simple
17206 strings; if the first string is a member of the second, then the condition
17207 is true.
17208 For the case-independent <option>inlisti</option> condition, case is defined per the system C locale.
17209 </para>
17210 <para>
17211 These are simpler to use versions of the more powerful <emphasis role="bold">forany</emphasis> condition.
17212 Examples, and the <emphasis role="bold">forany</emphasis> equivalents:
17213 </para>
17214 <literallayout class="monospaced">
17215 ${if inlist{needle}{foo:needle:bar}}
17216   ${if forany{foo:needle:bar}{eq{$item}{needle}}}
17217 ${if inlisti{Needle}{fOo:NeeDLE:bAr}}
17218   ${if forany{fOo:NeeDLE:bAr}{eqi{$item}{Needle}}}
17219 </literallayout>
17220 </listitem></varlistentry>
17221 <varlistentry>
17222 <term><emphasis role="bold">isip&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17223 <term><emphasis role="bold">isip4&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17224 <term><emphasis role="bold">isip6&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17225 <listitem>
17226 <para>
17227 <indexterm role="concept">
17228 <primary>IP address</primary>
17229 <secondary>testing string format</secondary>
17230 </indexterm>
17231 <indexterm role="concept">
17232 <primary>string</primary>
17233 <secondary>testing for IP address</secondary>
17234 </indexterm>
17235 <indexterm role="concept">
17236 <primary><option>isip</option> expansion condition</primary>
17237 </indexterm>
17238 <indexterm role="concept">
17239 <primary><option>isip4</option> expansion condition</primary>
17240 </indexterm>
17241 <indexterm role="concept">
17242 <primary><option>isip6</option> expansion condition</primary>
17243 </indexterm>
17244 The substring is first expanded, and then tested to see if it has the form of
17245 an IP address. Both IPv4 and IPv6 addresses are valid for <option>isip</option>, whereas
17246 <option>isip4</option> and <option>isip6</option> test specifically for IPv4 or IPv6 addresses.
17247 </para>
17248 <para>
17249 For an IPv4 address, the test is for four dot-separated components, each of
17250 which consists of from one to three digits. For an IPv6 address, up to eight
17251 colon-separated components are permitted, each containing from one to four
17252 hexadecimal digits. There may be fewer than eight components if an empty
17253 component (adjacent colons) is present. Only one empty component is permitted.
17254 </para>
17255 <para>
17256 <emphasis role="bold">Note</emphasis>: The checks used to be just on the form of the address; actual numerical
17257 values were not considered. Thus, for example, 999.999.999.999 passed the IPv4
17258 check.
17259 This is no longer the case.
17260 </para>
17261 <para>
17262 The main use of these tests is to distinguish between IP addresses and
17263 host names, or between IPv4 and IPv6 addresses. For example, you could use
17264 </para>
17265 <literallayout class="monospaced">
17266 ${if isip4{$sender_host_address}...
17267 </literallayout>
17268 <para>
17269 to test which IP version an incoming SMTP connection is using.
17270 </para>
17271 </listitem></varlistentry>
17272 <varlistentry>
17273 <term><emphasis role="bold">ldapauth&nbsp;{</emphasis>&lt;<emphasis>ldap&nbsp;query</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17274 <listitem>
17275 <para>
17276 <indexterm role="concept">
17277 <primary>LDAP</primary>
17278 <secondary>use for authentication</secondary>
17279 </indexterm>
17280 <indexterm role="concept">
17281 <primary>expansion</primary>
17282 <secondary>LDAP authentication test</secondary>
17283 </indexterm>
17284 <indexterm role="concept">
17285 <primary><option>ldapauth</option> expansion condition</primary>
17286 </indexterm>
17287 This condition supports user authentication using LDAP. See section
17288 <xref linkend="SECTldap"/> for details of how to use LDAP in lookups and the syntax of
17289 queries. For this use, the query must contain a user name and password. The
17290 query itself is not used, and can be empty. The condition is true if the
17291 password is not empty, and the user name and password are accepted by the LDAP
17292 server. An empty password is rejected without calling LDAP because LDAP binds
17293 with an empty password are considered anonymous regardless of the username, and
17294 will succeed in most configurations. See chapter <xref linkend="CHAPSMTPAUTH"/> for details
17295 of SMTP authentication, and chapter <xref linkend="CHAPplaintext"/> for an example of how
17296 this can be used.
17297 </para>
17298 </listitem></varlistentry>
17299 <varlistentry>
17300 <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>
17301 <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>
17302 <listitem>
17303 <para>
17304 <indexterm role="concept">
17305 <primary>string</primary>
17306 <secondary>comparison</secondary>
17307 </indexterm>
17308 <indexterm role="concept">
17309 <primary>expansion</primary>
17310 <secondary>string comparison</secondary>
17311 </indexterm>
17312 <indexterm role="concept">
17313 <primary><option>le</option> expansion condition</primary>
17314 </indexterm>
17315 <indexterm role="concept">
17316 <primary><option>lei</option> expansion condition</primary>
17317 </indexterm>
17318 The two substrings are first expanded. The condition is true if the first
17319 string is lexically less than or equal to the second string. For <option>le</option> the
17320 comparison includes the case of letters, whereas for <option>lei</option> the comparison is
17321 case-independent.
17322 Case and collation order are defined per the system C locale.
17323 </para>
17324 </listitem></varlistentry>
17325 <varlistentry>
17326 <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>
17327 <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>
17328 <listitem>
17329 <para>
17330 <indexterm role="concept">
17331 <primary>string</primary>
17332 <secondary>comparison</secondary>
17333 </indexterm>
17334 <indexterm role="concept">
17335 <primary>expansion</primary>
17336 <secondary>string comparison</secondary>
17337 </indexterm>
17338 <indexterm role="concept">
17339 <primary><option>lt</option> expansion condition</primary>
17340 </indexterm>
17341 <indexterm role="concept">
17342 <primary><option>lti</option> expansion condition</primary>
17343 </indexterm>
17344 The two substrings are first expanded. The condition is true if the first
17345 string is lexically less than the second string. For <option>lt</option> the comparison
17346 includes the case of letters, whereas for <option>lti</option> the comparison is
17347 case-independent.
17348 Case and collation order are defined per the system C locale.
17349 </para>
17350 </listitem></varlistentry>
17351 <varlistentry>
17352 <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>
17353 <listitem>
17354 <para>
17355 <indexterm role="concept">
17356 <primary>expansion</primary>
17357 <secondary>regular expression comparison</secondary>
17358 </indexterm>
17359 <indexterm role="concept">
17360 <primary>regular expressions</primary>
17361 <secondary>match in expanded string</secondary>
17362 </indexterm>
17363 <indexterm role="concept">
17364 <primary><option>match</option> expansion condition</primary>
17365 </indexterm>
17366 The two substrings are first expanded. The second is then treated as a regular
17367 expression and applied to the first. Because of the pre-expansion, if the
17368 regular expression contains dollar, or backslash characters, they must be
17369 escaped. Care must also be taken if the regular expression contains braces
17370 (curly brackets). A closing brace must be escaped so that it is not taken as a
17371 premature termination of &lt;<emphasis>string2</emphasis>&gt;. The easiest approach is to use the
17372 <literal>\N</literal> feature to disable expansion of the regular expression.
17373 For example,
17374 </para>
17375 <literallayout class="monospaced">
17376 ${if match {$local_part}{\N^\d{3}\N} ...
17377 </literallayout>
17378 <para>
17379 If the whole expansion string is in double quotes, further escaping of
17380 backslashes is also required.
17381 </para>
17382 <para>
17383 The condition is true if the regular expression match succeeds.
17384 The regular expression is not required to begin with a circumflex
17385 metacharacter, but if there is no circumflex, the expression is not anchored,
17386 and it may match anywhere in the subject, not just at the start. If you want
17387 the pattern to match at the end of the subject, you must include the <literal>$</literal>
17388 metacharacter at an appropriate point.
17389 All character handling is done in bytes and is not UTF-8 aware,
17390 but we might change this in a future Exim release.
17391 </para>
17392 <para>
17393 <indexterm role="concept">
17394 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
17395 <secondary>in <option>if</option> expansion</secondary>
17396 </indexterm>
17397 At the start of an <option>if</option> expansion the values of the numeric variable
17398 substitutions <varname>$1</varname> etc. are remembered. Obeying a <option>match</option> condition that
17399 succeeds causes them to be reset to the substrings of that condition and they
17400 will have these values during the expansion of the success string. At the end
17401 of the <option>if</option> expansion, the previous values are restored. After testing a
17402 combination of conditions using <option>or</option>, the subsequent values of the numeric
17403 variables are those of the condition that succeeded.
17404 </para>
17405 </listitem></varlistentry>
17406 <varlistentry>
17407 <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>
17408 <listitem>
17409 <para>
17410 <indexterm role="concept">
17411 <primary><option>match_address</option> expansion condition</primary>
17412 </indexterm>
17413 See <emphasis role="bold">match_local_part</emphasis>.
17414 </para>
17415 </listitem></varlistentry>
17416 <varlistentry>
17417 <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>
17418 <listitem>
17419 <para>
17420 <indexterm role="concept">
17421 <primary><option>match_domain</option> expansion condition</primary>
17422 </indexterm>
17423 See <emphasis role="bold">match_local_part</emphasis>.
17424 </para>
17425 </listitem></varlistentry>
17426 <varlistentry>
17427 <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>
17428 <listitem>
17429 <para>
17430 <indexterm role="concept">
17431 <primary><option>match_ip</option> expansion condition</primary>
17432 </indexterm>
17433 This condition matches an IP address to a list of IP address patterns. It must
17434 be followed by two argument strings. The first (after expansion) must be an IP
17435 address or an empty string. The second (not expanded) is a restricted host
17436 list that can match only an IP address, not a host name. For example:
17437 </para>
17438 <literallayout class="monospaced">
17439 ${if match_ip{$sender_host_address}{1.2.3.4:5.6.7.8}{...}{...}}
17440 </literallayout>
17441 <para>
17442 The specific types of host list item that are permitted in the list are:
17443 </para>
17444 <itemizedlist>
17445 <listitem>
17446 <para>
17447 An IP address, optionally with a CIDR mask.
17448 </para>
17449 </listitem>
17450 <listitem>
17451 <para>
17452 A single asterisk, which matches any IP address.
17453 </para>
17454 </listitem>
17455 <listitem>
17456 <para>
17457 An empty item, which matches only if the IP address is empty. This could be
17458 useful for testing for a locally submitted message or one from specific hosts
17459 in a single test such as
17460 </para>
17461 <literallayout class="monospaced">
17462   ${if match_ip{$sender_host_address}{:4.3.2.1:...}{...}{...}}
17463 </literallayout>
17464 <para>
17465 where the first item in the list is the empty string.
17466 </para>
17467 </listitem>
17468 <listitem>
17469 <para>
17470 The item @[] matches any of the local host&#x2019;s interface addresses.
17471 </para>
17472 </listitem>
17473 <listitem>
17474 <para>
17475 Single-key lookups are assumed to be like <quote>net-</quote> style lookups in host lists,
17476 even if <literal>net-</literal> is not specified. There is never any attempt to turn the IP
17477 address into a host name. The most common type of linear search for
17478 <emphasis role="bold">match_ip</emphasis> is likely to be <emphasis role="bold">iplsearch</emphasis>, in which the file can contain CIDR
17479 masks. For example:
17480 </para>
17481 <literallayout class="monospaced">
17482   ${if match_ip{$sender_host_address}{iplsearch;/some/file}...
17483 </literallayout>
17484 <para>
17485 It is of course possible to use other kinds of lookup, and in such a case, you
17486 do need to specify the <literal>net-</literal> prefix if you want to specify a specific
17487 address mask, for example:
17488 </para>
17489 <literallayout class="monospaced">
17490   ${if match_ip{$sender_host_address}{net24-dbm;/some/file}...
17491 </literallayout>
17492 <para>
17493 However, unless you are combining a <option>match_ip</option> condition with others, it is
17494 just as easy to use the fact that a lookup is itself a condition, and write:
17495 </para>
17496 <literallayout class="monospaced">
17497   ${lookup{${mask:$sender_host_address/24}}dbm{/a/file}...
17498 </literallayout>
17499 </listitem>
17500 </itemizedlist>
17501 <para>
17502 Note that &lt;<emphasis>string2</emphasis>&gt; is not itself subject to string expansion, unless
17503 Exim was built with the EXPAND_LISTMATCH_RHS option.
17504 </para>
17505 <para>
17506 Consult section <xref linkend="SECThoslispatip"/> for further details of these patterns.
17507 </para>
17508 </listitem></varlistentry>
17509 <varlistentry>
17510 <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>
17511 <listitem>
17512 <para>
17513 <indexterm role="concept">
17514 <primary>domain list</primary>
17515 <secondary>in expansion condition</secondary>
17516 </indexterm>
17517 <indexterm role="concept">
17518 <primary>address list</primary>
17519 <secondary>in expansion condition</secondary>
17520 </indexterm>
17521 <indexterm role="concept">
17522 <primary>local part</primary>
17523 <secondary>list, in expansion condition</secondary>
17524 </indexterm>
17525 <indexterm role="concept">
17526 <primary><option>match_local_part</option> expansion condition</primary>
17527 </indexterm>
17528 This condition, together with <option>match_address</option> and <option>match_domain</option>, make it
17529 possible to test domain, address, and local part lists within expansions. Each
17530 condition requires two arguments: an item and a list to match. A trivial
17531 example is:
17532 </para>
17533 <literallayout class="monospaced">
17534 ${if match_domain{a.b.c}{x.y.z:a.b.c:p.q.r}{yes}{no}}
17535 </literallayout>
17536 <para>
17537 In each case, the second argument may contain any of the allowable items for a
17538 list of the appropriate type. Also, because the second argument
17539 is a standard form of list, it is possible to refer to a named list.
17540 Thus, you can use conditions like this:
17541 </para>
17542 <literallayout class="monospaced">
17543 ${if match_domain{$domain}{+local_domains}{...
17544 </literallayout>
17545 <para>
17546 <indexterm role="concept">
17547 <primary><literal>+caseful</literal></primary>
17548 </indexterm>
17549 For address lists, the matching starts off caselessly, but the <literal>+caseful</literal>
17550 item can be used, as in all address lists, to cause subsequent items to
17551 have their local parts matched casefully. Domains are always matched
17552 caselessly.
17553 </para>
17554 <para>
17555 Note that &lt;<emphasis>string2</emphasis>&gt; is not itself subject to string expansion, unless
17556 Exim was built with the EXPAND_LISTMATCH_RHS option.
17557 </para>
17558 <para>
17559 <emphasis role="bold">Note</emphasis>: Host lists are <emphasis>not</emphasis> supported in this way. This is because
17560 hosts have two identities: a name and an IP address, and it is not clear
17561 how to specify cleanly how such a test would work. However, IP addresses can be
17562 matched using <option>match_ip</option>.
17563 </para>
17564 </listitem></varlistentry>
17565 <varlistentry>
17566 <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>
17567 <listitem>
17568 <para>
17569 <indexterm role="concept">
17570 <primary>PAM authentication</primary>
17571 </indexterm>
17572 <indexterm role="concept">
17573 <primary>AUTH</primary>
17574 <secondary>with PAM</secondary>
17575 </indexterm>
17576 <indexterm role="concept">
17577 <primary>Solaris</primary>
17578 <secondary>PAM support</secondary>
17579 </indexterm>
17580 <indexterm role="concept">
17581 <primary>expansion</primary>
17582 <secondary>PAM authentication test</secondary>
17583 </indexterm>
17584 <indexterm role="concept">
17585 <primary><option>pam</option> expansion condition</primary>
17586 </indexterm>
17587 <emphasis>Pluggable Authentication Modules</emphasis>
17588 (<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
17589 available in the latest releases of Solaris and in some GNU/Linux
17590 distributions. The Exim support, which is intended for use in conjunction with
17591 the SMTP AUTH command, is available only if Exim is compiled with
17592 </para>
17593 <literallayout class="monospaced">
17594 SUPPORT_PAM=yes
17595 </literallayout>
17596 <para>
17597 in <filename>Local/Makefile</filename>. You probably need to add <option>-lpam</option> to EXTRALIBS, and
17598 in some releases of GNU/Linux <option>-ldl</option> is also needed.
17599 </para>
17600 <para>
17601 The argument string is first expanded, and the result must be a
17602 colon-separated list of strings. Leading and trailing white space is ignored.
17603 The PAM module is initialized with the service name <quote>exim</quote> and the user name
17604 taken from the first item in the colon-separated data string (&lt;<emphasis>string1</emphasis>&gt;).
17605 The remaining items in the data string are passed over in response to requests
17606 from the authentication function. In the simple case there will only be one
17607 request, for a password, so the data consists of just two strings.
17608 </para>
17609 <para>
17610 There can be problems if any of the strings are permitted to contain colon
17611 characters. In the usual way, these have to be doubled to avoid being taken as
17612 separators. If the data is being inserted from a variable, the <option>sg</option> expansion
17613 item can be used to double any existing colons. For example, the configuration
17614 of a LOGIN authenticator might contain this setting:
17615 </para>
17616 <literallayout class="monospaced">
17617 server_condition = ${if pam{$auth1:${sg{$auth2}{:}{::}}}}
17618 </literallayout>
17619 <para>
17620 For a PLAIN authenticator you could use:
17621 </para>
17622 <literallayout class="monospaced">
17623 server_condition = ${if pam{$auth2:${sg{$auth3}{:}{::}}}}
17624 </literallayout>
17625 <para>
17626 In some operating systems, PAM authentication can be done only from a process
17627 running as root. Since Exim is running as the Exim user when receiving
17628 messages, this means that PAM cannot be used directly in those systems.
17629 </para>
17630 </listitem></varlistentry>
17631 <varlistentry>
17632 <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>
17633 <listitem>
17634 <para>
17635 <indexterm role="concept">
17636 <primary><emphasis>pwcheck</emphasis> daemon</primary>
17637 </indexterm>
17638 <indexterm role="concept">
17639 <primary>Cyrus</primary>
17640 </indexterm>
17641 <indexterm role="concept">
17642 <primary>expansion</primary>
17643 <secondary><emphasis>pwcheck</emphasis> authentication test</secondary>
17644 </indexterm>
17645 <indexterm role="concept">
17646 <primary><option>pwcheck</option> expansion condition</primary>
17647 </indexterm>
17648 This condition supports user authentication using the Cyrus <emphasis>pwcheck</emphasis> daemon.
17649 This is one way of making it possible for passwords to be checked by a process
17650 that is not running as root. <emphasis role="bold">Note</emphasis>: The use of <emphasis>pwcheck</emphasis> is now
17651 deprecated. Its replacement is <emphasis>saslauthd</emphasis> (see below).
17652 </para>
17653 <para>
17654 The pwcheck support is not included in Exim by default. You need to specify
17655 the location of the pwcheck daemon&#x2019;s socket in <filename>Local/Makefile</filename> before
17656 building Exim. For example:
17657 </para>
17658 <literallayout class="monospaced">
17659 CYRUS_PWCHECK_SOCKET=/var/pwcheck/pwcheck
17660 </literallayout>
17661 <para>
17662 You do not need to install the full Cyrus software suite in order to use
17663 the pwcheck daemon. You can compile and install just the daemon alone
17664 from the Cyrus SASL library. Ensure that <emphasis>exim</emphasis> is the only user that has
17665 access to the <filename>/var/pwcheck</filename> directory.
17666 </para>
17667 <para>
17668 The <option>pwcheck</option> condition takes one argument, which must be the user name and
17669 password, separated by a colon. For example, in a LOGIN authenticator
17670 configuration, you might have this:
17671 </para>
17672 <literallayout class="monospaced">
17673 server_condition = ${if pwcheck{$auth1:$auth2}}
17674 </literallayout>
17675 <para>
17676 Again, for a PLAIN authenticator configuration, this would be:
17677 </para>
17678 <literallayout class="monospaced">
17679 server_condition = ${if pwcheck{$auth2:$auth3}}
17680 </literallayout>
17681 </listitem></varlistentry>
17682 <varlistentry>
17683 <term><emphasis role="bold">queue_running</emphasis></term>
17684 <listitem>
17685 <para>
17686 <indexterm role="concept">
17687 <primary>queue runner</primary>
17688 <secondary>detecting when delivering from</secondary>
17689 </indexterm>
17690 <indexterm role="concept">
17691 <primary>expansion</primary>
17692 <secondary>queue runner test</secondary>
17693 </indexterm>
17694 <indexterm role="concept">
17695 <primary><option>queue_running</option> expansion condition</primary>
17696 </indexterm>
17697 This condition, which has no data, is true during delivery attempts that are
17698 initiated by queue runner processes, and false otherwise.
17699 </para>
17700 </listitem></varlistentry>
17701 <varlistentry>
17702 <term><emphasis role="bold">radius&nbsp;{</emphasis>&lt;<emphasis>authentication&nbsp;string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17703 <listitem>
17704 <para>
17705 <indexterm role="concept">
17706 <primary>Radius</primary>
17707 </indexterm>
17708 <indexterm role="concept">
17709 <primary>expansion</primary>
17710 <secondary>Radius authentication</secondary>
17711 </indexterm>
17712 <indexterm role="concept">
17713 <primary><option>radius</option> expansion condition</primary>
17714 </indexterm>
17715 Radius authentication (RFC 2865) is supported in a similar way to PAM. You must
17716 set RADIUS_CONFIG_FILE in <filename>Local/Makefile</filename> to specify the location of
17717 the Radius client configuration file in order to build Exim with Radius
17718 support.
17719 </para>
17720 <para>
17721 With just that one setting, Exim expects to be linked with the <option>radiusclient</option>
17722 library, using the original API. If you are using release 0.4.0 or later of
17723 this library, you need to set
17724 </para>
17725 <literallayout class="monospaced">
17726 RADIUS_LIB_TYPE=RADIUSCLIENTNEW
17727 </literallayout>
17728 <para>
17729 in <filename>Local/Makefile</filename> when building Exim. You can also link Exim with the
17730 <option>libradius</option> library that comes with FreeBSD. To do this, set
17731 </para>
17732 <literallayout class="monospaced">
17733 RADIUS_LIB_TYPE=RADLIB
17734 </literallayout>
17735 <para>
17736 in <filename>Local/Makefile</filename>, in addition to setting RADIUS_CONFIGURE_FILE.
17737 You may also have to supply a suitable setting in EXTRALIBS so that the
17738 Radius library can be found when Exim is linked.
17739 </para>
17740 <para>
17741 The string specified by RADIUS_CONFIG_FILE is expanded and passed to the
17742 Radius client library, which calls the Radius server. The condition is true if
17743 the authentication is successful. For example:
17744 </para>
17745 <literallayout class="monospaced">
17746 server_condition = ${if radius{&lt;arguments&gt;}}
17747 </literallayout>
17748 </listitem></varlistentry>
17749 <varlistentry>
17750 <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>
17751 <listitem>
17752 <para>
17753 <indexterm role="concept">
17754 <primary><emphasis>saslauthd</emphasis> daemon</primary>
17755 </indexterm>
17756 <indexterm role="concept">
17757 <primary>Cyrus</primary>
17758 </indexterm>
17759 <indexterm role="concept">
17760 <primary>expansion</primary>
17761 <secondary><emphasis>saslauthd</emphasis> authentication test</secondary>
17762 </indexterm>
17763 <indexterm role="concept">
17764 <primary><option>saslauthd</option> expansion condition</primary>
17765 </indexterm>
17766 This condition supports user authentication using the Cyrus <emphasis>saslauthd</emphasis>
17767 daemon. This replaces the older <emphasis>pwcheck</emphasis> daemon, which is now deprecated.
17768 Using this daemon is one way of making it possible for passwords to be checked
17769 by a process that is not running as root.
17770 </para>
17771 <para>
17772 The saslauthd support is not included in Exim by default. You need to specify
17773 the location of the saslauthd daemon&#x2019;s socket in <filename>Local/Makefile</filename> before
17774 building Exim. For example:
17775 </para>
17776 <literallayout class="monospaced">
17777 CYRUS_SASLAUTHD_SOCKET=/var/state/saslauthd/mux
17778 </literallayout>
17779 <para>
17780 You do not need to install the full Cyrus software suite in order to use
17781 the saslauthd daemon. You can compile and install just the daemon alone
17782 from the Cyrus SASL library.
17783 </para>
17784 <para>
17785 Up to four arguments can be supplied to the <option>saslauthd</option> condition, but only
17786 two are mandatory. For example:
17787 </para>
17788 <literallayout class="monospaced">
17789 server_condition = ${if saslauthd{{$auth1}{$auth2}}}
17790 </literallayout>
17791 <para>
17792 The service and the realm are optional (which is why the arguments are enclosed
17793 in their own set of braces). For details of the meaning of the service and
17794 realm, and how to run the daemon, consult the Cyrus documentation.
17795 </para>
17796 </listitem></varlistentry>
17797 </variablelist>
17798 </section>
17799 <section id="SECID84">
17800 <title>Combining expansion conditions</title>
17801 <para>
17802 <indexterm role="concept">
17803 <primary>expansion</primary>
17804 <secondary>combining conditions</secondary>
17805 </indexterm>
17806 Several conditions can be tested at once by combining them using the <option>and</option>
17807 and <option>or</option> combination conditions. Note that <option>and</option> and <option>or</option> are complete
17808 conditions on their own, and precede their lists of sub-conditions. Each
17809 sub-condition must be enclosed in braces within the overall braces that contain
17810 the list. No repetition of <option>if</option> is used.
17811 </para>
17812 <variablelist>
17813 <varlistentry>
17814 <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>
17815 <listitem>
17816 <para>
17817 <indexterm role="concept">
17818 <primary><quote>or</quote> expansion condition</primary>
17819 </indexterm>
17820 <indexterm role="concept">
17821 <primary>expansion</primary>
17822 <secondary><quote>or</quote> of conditions</secondary>
17823 </indexterm>
17824 The sub-conditions are evaluated from left to right. The condition is true if
17825 any one of the sub-conditions is true.
17826 For example,
17827 </para>
17828 <literallayout class="monospaced">
17829 ${if or {{eq{$local_part}{spqr}}{eq{$domain}{testing.com}}}...
17830 </literallayout>
17831 <para>
17832 When a true sub-condition is found, the following ones are parsed but not
17833 evaluated. If there are several <quote>match</quote> sub-conditions the values of the
17834 numeric variables afterwards are taken from the first one that succeeds.
17835 </para>
17836 </listitem></varlistentry>
17837 <varlistentry>
17838 <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>
17839 <listitem>
17840 <para>
17841 <indexterm role="concept">
17842 <primary><quote>and</quote> expansion condition</primary>
17843 </indexterm>
17844 <indexterm role="concept">
17845 <primary>expansion</primary>
17846 <secondary><quote>and</quote> of conditions</secondary>
17847 </indexterm>
17848 The sub-conditions are evaluated from left to right. The condition is true if
17849 all of the sub-conditions are true. If there are several <quote>match</quote>
17850 sub-conditions, the values of the numeric variables afterwards are taken from
17851 the last one. When a false sub-condition is found, the following ones are
17852 parsed but not evaluated.
17853 </para>
17854 </listitem></varlistentry>
17855 </variablelist>
17856 <para>
17857 <indexterm role="concept" startref="IIDexpcond" class="endofrange"/>
17858 </para>
17859 </section>
17860 <section id="SECTexpvar">
17861 <title>Expansion variables</title>
17862 <para>
17863 <indexterm role="concept">
17864 <primary>expansion</primary>
17865 <secondary>variables, list of</secondary>
17866 </indexterm>
17867 This section contains an alphabetical list of all the expansion variables. Some
17868 of them are available only when Exim is compiled with specific options such as
17869 support for TLS or the content scanning extension.
17870 </para>
17871 <variablelist>
17872 <varlistentry>
17873 <term><varname>$0</varname>, <varname>$1</varname>, etc</term>
17874 <listitem>
17875 <para>
17876 <indexterm role="concept">
17877 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
17878 </indexterm>
17879 When a <option>match</option> expansion condition succeeds, these variables contain the
17880 captured substrings identified by the regular expression during subsequent
17881 processing of the success string of the containing <option>if</option> expansion item.
17882 In the expansion condition case
17883 they do not retain their values afterwards; in fact, their previous
17884 values are restored at the end of processing an <option>if</option> item. The numerical
17885 variables may also be set externally by some other matching process which
17886 precedes the expansion of the string. For example, the commands available in
17887 Exim filter files include an <option>if</option> command with its own regular expression
17888 matching condition.
17889 </para>
17890 </listitem></varlistentry>
17891 <varlistentry>
17892 <term><varname>$acl_arg1</varname>, <varname>$acl_arg2</varname>, etc</term>
17893 <listitem>
17894 <para>
17895 Within an acl condition, expansion condition or expansion item
17896 any arguments are copied to these variables,
17897 any unused variables being made empty.
17898 </para>
17899 </listitem></varlistentry>
17900 <varlistentry>
17901 <term><varname>$acl_c...</varname></term>
17902 <listitem>
17903 <para>
17904 Values can be placed in these variables by the <option>set</option> modifier in an ACL. They
17905 can be given any name that starts with <varname>$acl_c</varname> and is at least six characters
17906 long, but the sixth character must be either a digit or an underscore. For
17907 example: <varname>$acl_c5</varname>, <varname>$acl_c_mycount</varname>. The values of the <varname>$acl_c...</varname>
17908 variables persist throughout the lifetime of an SMTP connection. They can be
17909 used to pass information between ACLs and between different invocations of the
17910 same ACL. When a message is received, the values of these variables are saved
17911 with the message, and can be accessed by filters, routers, and transports
17912 during subsequent delivery.
17913 </para>
17914 </listitem></varlistentry>
17915 <varlistentry>
17916 <term><varname>$acl_m...</varname></term>
17917 <listitem>
17918 <para>
17919 These variables are like the <varname>$acl_c...</varname> variables, except that their values
17920 are reset after a message has been received. Thus, if several messages are
17921 received in one SMTP connection, <varname>$acl_m...</varname> values are not passed on from one
17922 message to the next, as <varname>$acl_c...</varname> values are. The <varname>$acl_m...</varname> variables are
17923 also reset by MAIL, RSET, EHLO, HELO, and after starting a TLS session. When a
17924 message is received, the values of these variables are saved with the message,
17925 and can be accessed by filters, routers, and transports during subsequent
17926 delivery.
17927 </para>
17928 </listitem></varlistentry>
17929 <varlistentry>
17930 <term><varname>$acl_narg</varname></term>
17931 <listitem>
17932 <para>
17933 Within an acl condition, expansion condition or expansion item
17934 this variable has the number of arguments.
17935 </para>
17936 </listitem></varlistentry>
17937 <varlistentry>
17938 <term><varname>$acl_verify_message</varname></term>
17939 <listitem>
17940 <para>
17941 <indexterm role="variable">
17942 <primary><varname>$acl_verify_message</varname></primary>
17943 </indexterm>
17944 After an address verification has failed, this variable contains the failure
17945 message. It retains its value for use in subsequent modifiers. The message can
17946 be preserved by coding like this:
17947 </para>
17948 <literallayout class="monospaced">
17949 warn !verify = sender
17950      set acl_m0 = $acl_verify_message
17951 </literallayout>
17952 <para>
17953 You can use <varname>$acl_verify_message</varname> during the expansion of the <option>message</option> or
17954 <option>log_message</option> modifiers, to include information about the verification
17955 failure.
17956 </para>
17957 </listitem></varlistentry>
17958 <varlistentry>
17959 <term><varname>$address_data</varname></term>
17960 <listitem>
17961 <para>
17962 <indexterm role="variable">
17963 <primary><varname>$address_data</varname></primary>
17964 </indexterm>
17965 This variable is set by means of the <option>address_data</option> option in routers. The
17966 value then remains with the address while it is processed by subsequent routers
17967 and eventually a transport. If the transport is handling multiple addresses,
17968 the value from the first address is used. See chapter <xref linkend="CHAProutergeneric"/>
17969 for more details. <emphasis role="bold">Note</emphasis>: The contents of <varname>$address_data</varname> are visible in
17970 user filter files.
17971 </para>
17972 <para>
17973 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify
17974 a recipient address, the final value is still in the variable for subsequent
17975 conditions and modifiers of the ACL statement. If routing the address caused it
17976 to be redirected to just one address, the child address is also routed as part
17977 of the verification, and in this case the final value of <varname>$address_data</varname> is
17978 from the child&#x2019;s routing.
17979 </para>
17980 <para>
17981 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
17982 sender address, the final value is also preserved, but this time in
17983 <varname>$sender_address_data</varname>, to distinguish it from data from a recipient
17984 address.
17985 </para>
17986 <para>
17987 In both cases (recipient and sender verification), the value does not persist
17988 after the end of the current ACL statement. If you want to preserve
17989 these values for longer, you can save them in ACL variables.
17990 </para>
17991 </listitem></varlistentry>
17992 <varlistentry>
17993 <term><varname>$address_file</varname></term>
17994 <listitem>
17995 <para>
17996 <indexterm role="variable">
17997 <primary><varname>$address_file</varname></primary>
17998 </indexterm>
17999 When, as a result of aliasing, forwarding, or filtering, a message is directed
18000 to a specific file, this variable holds the name of the file when the transport
18001 is running. At other times, the variable is empty. For example, using the
18002 default configuration, if user <option>r2d2</option> has a <filename>.forward</filename> file containing
18003 </para>
18004 <literallayout class="monospaced">
18005 /home/r2d2/savemail
18006 </literallayout>
18007 <para>
18008 then when the <command>address_file</command> transport is running, <varname>$address_file</varname>
18009 contains the text string <literal>/home/r2d2/savemail</literal>.
18010 <indexterm role="concept">
18011 <primary>Sieve filter</primary>
18012 <secondary>value of <varname>$address_file</varname></secondary>
18013 </indexterm>
18014 For Sieve filters, the value may be <quote>inbox</quote> or a relative folder name. It is
18015 then up to the transport configuration to generate an appropriate absolute path
18016 to the relevant file.
18017 </para>
18018 </listitem></varlistentry>
18019 <varlistentry>
18020 <term><varname>$address_pipe</varname></term>
18021 <listitem>
18022 <para>
18023 <indexterm role="variable">
18024 <primary><varname>$address_pipe</varname></primary>
18025 </indexterm>
18026 When, as a result of aliasing or forwarding, a message is directed to a pipe,
18027 this variable holds the pipe command when the transport is running.
18028 </para>
18029 </listitem></varlistentry>
18030 <varlistentry>
18031 <term><varname>$auth1</varname> &ndash; <varname>$auth3</varname></term>
18032 <listitem>
18033 <para>
18034 <indexterm role="variable">
18035 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
18036 </indexterm>
18037 These variables are used in SMTP authenticators (see chapters
18038 <xref linkend="CHAPplaintext"/>&ndash;<xref linkend="CHAPtlsauth"/>). Elsewhere, they are empty.
18039 </para>
18040 </listitem></varlistentry>
18041 <varlistentry>
18042 <term><varname>$authenticated_id</varname></term>
18043 <listitem>
18044 <para>
18045 <indexterm role="concept">
18046 <primary>authentication</primary>
18047 <secondary>id</secondary>
18048 </indexterm>
18049 <indexterm role="variable">
18050 <primary><varname>$authenticated_id</varname></primary>
18051 </indexterm>
18052 When a server successfully authenticates a client it may be configured to
18053 preserve some of the authentication information in the variable
18054 <varname>$authenticated_id</varname> (see chapter <xref linkend="CHAPSMTPAUTH"/>). For example, a
18055 user/password authenticator configuration might preserve the user name for use
18056 in the routers. Note that this is not the same information that is saved in
18057 <varname>$sender_host_authenticated</varname>.
18058 </para>
18059 <para>
18060 When a message is submitted locally (that is, not over a TCP connection)
18061 the value of <varname>$authenticated_id</varname> is normally the login name of the calling
18062 process. However, a trusted user can override this by means of the <option>-oMai</option>
18063 command line option.
18064 This second case also sets up information used by the
18065 <varname>$authresults</varname> expansion item.
18066 </para>
18067 </listitem></varlistentry>
18068 <varlistentry>
18069 <term><varname>$authenticated_fail_id</varname></term>
18070 <listitem>
18071 <para>
18072 <indexterm role="concept">
18073 <primary>authentication</primary>
18074 <secondary>fail</secondary>
18075 </indexterm>
18076 <indexterm role="variable">
18077 <primary><varname>$authenticated_fail_id</varname></primary>
18078 </indexterm>
18079 When an authentication attempt fails, the variable <varname>$authenticated_fail_id</varname>
18080 will contain the failed authentication id. If more than one authentication
18081 id is attempted, it will contain only the last one. The variable is
18082 available for processing in the ACL&#x2019;s, generally the quit or notquit ACL.
18083 A message to a local recipient could still be accepted without requiring
18084 authentication, which means this variable could also be visible in all of
18085 the ACL&#x2019;s as well.
18086 </para>
18087 </listitem></varlistentry>
18088 <varlistentry>
18089 <term><varname>$authenticated_sender</varname></term>
18090 <listitem>
18091 <para>
18092 <indexterm role="concept">
18093 <primary>sender</primary>
18094 <secondary>authenticated</secondary>
18095 </indexterm>
18096 <indexterm role="concept">
18097 <primary>authentication</primary>
18098 <secondary>sender</secondary>
18099 </indexterm>
18100 <indexterm role="concept">
18101 <primary>AUTH</primary>
18102 <secondary>on MAIL command</secondary>
18103 </indexterm>
18104 <indexterm role="variable">
18105 <primary><varname>$authenticated_sender</varname></primary>
18106 </indexterm>
18107 When acting as a server, Exim takes note of the AUTH= parameter on an incoming
18108 SMTP MAIL command if it believes the sender is sufficiently trusted, as
18109 described in section <xref linkend="SECTauthparamail"/>. Unless the data is the string
18110 <quote>&lt;&gt;</quote>, it is set as the authenticated sender of the message, and the value is
18111 available during delivery in the <varname>$authenticated_sender</varname> variable. If the
18112 sender is not trusted, Exim accepts the syntax of AUTH=, but ignores the data.
18113 </para>
18114 <para>
18115 <indexterm role="variable">
18116 <primary><varname>$qualify_domain</varname></primary>
18117 </indexterm>
18118 When a message is submitted locally (that is, not over a TCP connection), the
18119 value of <varname>$authenticated_sender</varname> is an address constructed from the login
18120 name of the calling process and <varname>$qualify_domain</varname>, except that a trusted user
18121 can override this by means of the <option>-oMas</option> command line option.
18122 </para>
18123 </listitem></varlistentry>
18124 <varlistentry>
18125 <term><varname>$authentication_failed</varname></term>
18126 <listitem>
18127 <para>
18128 <indexterm role="concept">
18129 <primary>authentication</primary>
18130 <secondary>failure</secondary>
18131 </indexterm>
18132 <indexterm role="variable">
18133 <primary><varname>$authentication_failed</varname></primary>
18134 </indexterm>
18135 This variable is set to <quote>1</quote> in an Exim server if a client issues an AUTH
18136 command that does not succeed. Otherwise it is set to <quote>0</quote>. This makes it
18137 possible to distinguish between <quote>did not try to authenticate</quote>
18138 (<varname>$sender_host_authenticated</varname> is empty and <varname>$authentication_failed</varname> is set to
18139 <quote>0</quote>) and <quote>tried to authenticate but failed</quote> (<varname>$sender_host_authenticated</varname>
18140 is empty and <varname>$authentication_failed</varname> is set to <quote>1</quote>). Failure includes any
18141 negative response to an AUTH command, including (for example) an attempt to use
18142 an undefined mechanism.
18143 </para>
18144 </listitem></varlistentry>
18145 <varlistentry>
18146 <term><varname>$av_failed</varname></term>
18147 <listitem>
18148 <para>
18149 <indexterm role="concept">
18150 <primary>content scanning</primary>
18151 <secondary>AV scanner failure</secondary>
18152 </indexterm>
18153 This variable is available when Exim is compiled with the content-scanning
18154 extension. It is set to <quote>0</quote> by default, but will be set to <quote>1</quote> if any
18155 problem occurs with the virus scanner (specified by <option>av_scanner</option>) during
18156 the ACL malware condition.
18157 </para>
18158 </listitem></varlistentry>
18159 <varlistentry>
18160 <term><varname>$body_linecount</varname></term>
18161 <listitem>
18162 <para>
18163 <indexterm role="concept">
18164 <primary>message body</primary>
18165 <secondary>line count</secondary>
18166 </indexterm>
18167 <indexterm role="concept">
18168 <primary>body of message</primary>
18169 <secondary>line count</secondary>
18170 </indexterm>
18171 <indexterm role="variable">
18172 <primary><varname>$body_linecount</varname></primary>
18173 </indexterm>
18174 When a message is being received or delivered, this variable contains the
18175 number of lines in the message&#x2019;s body. See also <varname>$message_linecount</varname>.
18176 </para>
18177 </listitem></varlistentry>
18178 <varlistentry>
18179 <term><varname>$body_zerocount</varname></term>
18180 <listitem>
18181 <para>
18182 <indexterm role="concept">
18183 <primary>message body</primary>
18184 <secondary>binary zero count</secondary>
18185 </indexterm>
18186 <indexterm role="concept">
18187 <primary>body of message</primary>
18188 <secondary>binary zero count</secondary>
18189 </indexterm>
18190 <indexterm role="concept">
18191 <primary>binary zero</primary>
18192 <secondary>in message body</secondary>
18193 </indexterm>
18194 <indexterm role="variable">
18195 <primary><varname>$body_zerocount</varname></primary>
18196 </indexterm>
18197 When a message is being received or delivered, this variable contains the
18198 number of binary zero bytes (ASCII NULs) in the message&#x2019;s body.
18199 </para>
18200 </listitem></varlistentry>
18201 <varlistentry>
18202 <term><varname>$bounce_recipient</varname></term>
18203 <listitem>
18204 <para>
18205 <indexterm role="variable">
18206 <primary><varname>$bounce_recipient</varname></primary>
18207 </indexterm>
18208 This is set to the recipient address of a bounce message while Exim is creating
18209 it. It is useful if a customized bounce message text file is in use (see
18210 chapter <xref linkend="CHAPemsgcust"/>).
18211 </para>
18212 </listitem></varlistentry>
18213 <varlistentry>
18214 <term><varname>$bounce_return_size_limit</varname></term>
18215 <listitem>
18216 <para>
18217 <indexterm role="variable">
18218 <primary><varname>$bounce_return_size_limit</varname></primary>
18219 </indexterm>
18220 This contains the value set in the <option>bounce_return_size_limit</option> option, rounded
18221 up to a multiple of 1000. It is useful when a customized error message text
18222 file is in use (see chapter <xref linkend="CHAPemsgcust"/>).
18223 </para>
18224 </listitem></varlistentry>
18225 <varlistentry>
18226 <term><varname>$caller_gid</varname></term>
18227 <listitem>
18228 <para>
18229 <indexterm role="concept">
18230 <primary>gid (group id)</primary>
18231 <secondary>caller</secondary>
18232 </indexterm>
18233 <indexterm role="variable">
18234 <primary><varname>$caller_gid</varname></primary>
18235 </indexterm>
18236 The real group id under which the process that called Exim was running. This is
18237 not the same as the group id of the originator of a message (see
18238 <varname>$originator_gid</varname>). If Exim re-execs itself, this variable in the new
18239 incarnation normally contains the Exim gid.
18240 </para>
18241 </listitem></varlistentry>
18242 <varlistentry>
18243 <term><varname>$caller_uid</varname></term>
18244 <listitem>
18245 <para>
18246 <indexterm role="concept">
18247 <primary>uid (user id)</primary>
18248 <secondary>caller</secondary>
18249 </indexterm>
18250 <indexterm role="variable">
18251 <primary><varname>$caller_uid</varname></primary>
18252 </indexterm>
18253 The real user id under which the process that called Exim was running. This is
18254 not the same as the user id of the originator of a message (see
18255 <varname>$originator_uid</varname>). If Exim re-execs itself, this variable in the new
18256 incarnation normally contains the Exim uid.
18257 </para>
18258 </listitem></varlistentry>
18259 <varlistentry>
18260 <term><varname>$callout_address</varname></term>
18261 <listitem>
18262 <para>
18263 <indexterm role="variable">
18264 <primary><varname>$callout_address</varname></primary>
18265 </indexterm>
18266 After a callout for verification, spamd or malware daemon service, the
18267 address that was connected to.
18268 </para>
18269 </listitem></varlistentry>
18270 <varlistentry>
18271 <term><varname>$compile_number</varname></term>
18272 <listitem>
18273 <para>
18274 <indexterm role="variable">
18275 <primary><varname>$compile_number</varname></primary>
18276 </indexterm>
18277 The building process for Exim keeps a count of the number
18278 of times it has been compiled. This serves to distinguish different
18279 compilations of the same version of Exim.
18280 </para>
18281 </listitem></varlistentry>
18282 <varlistentry>
18283 <term><varname>$config_dir</varname></term>
18284 <listitem>
18285 <para>
18286 <indexterm role="variable">
18287 <primary><varname>$config_dir</varname></primary>
18288 </indexterm>
18289 The directory name of the main configuration file. That is, the content of
18290 <varname>$config_file</varname> with the last component stripped. The value does not
18291 contain the trailing slash. If <varname>$config_file</varname> does not contain a slash,
18292 <varname>$config_dir</varname> is ".".
18293 </para>
18294 </listitem></varlistentry>
18295 <varlistentry>
18296 <term><varname>$config_file</varname></term>
18297 <listitem>
18298 <para>
18299 <indexterm role="variable">
18300 <primary><varname>$config_file</varname></primary>
18301 </indexterm>
18302 The name of the main configuration file Exim is using.
18303 </para>
18304 </listitem></varlistentry>
18305 <varlistentry>
18306 <term><varname>$dkim_verify_status</varname></term>
18307 <listitem>
18308 <para>
18309 Results of DKIM verification.
18310 For details see section <xref linkend="SECDKIMVFY"/>.
18311 </para>
18312 </listitem></varlistentry>
18313 <varlistentry>
18314 <term><varname>$dkim_cur_signer</varname></term>
18315 <term><varname>$dkim_verify_reason</varname></term>
18316 <term><varname>$dkim_domain</varname></term>
18317 <term><varname>$dkim_identity</varname></term>
18318 <term><varname>$dkim_selector</varname></term>
18319 <term><varname>$dkim_algo</varname></term>
18320 <term><varname>$dkim_canon_body</varname></term>
18321 <term><varname>$dkim_canon_headers</varname></term>
18322 <term><varname>$dkim_copiedheaders</varname></term>
18323 <term><varname>$dkim_bodylength</varname></term>
18324 <term><varname>$dkim_created</varname></term>
18325 <term><varname>$dkim_expires</varname></term>
18326 <term><varname>$dkim_headernames</varname></term>
18327 <term><varname>$dkim_key_testing</varname></term>
18328 <term><varname>$dkim_key_nosubdomains</varname></term>
18329 <term><varname>$dkim_key_srvtype</varname></term>
18330 <term><varname>$dkim_key_granularity</varname></term>
18331 <term><varname>$dkim_key_notes</varname></term>
18332 <term><varname>$dkim_key_length</varname></term>
18333 <listitem>
18334 <para>
18335 These variables are only available within the DKIM ACL.
18336 For details see section <xref linkend="SECDKIMVFY"/>.
18337 </para>
18338 </listitem></varlistentry>
18339 <varlistentry>
18340 <term><varname>$dkim_signers</varname></term>
18341 <listitem>
18342 <para>
18343 <indexterm role="variable">
18344 <primary><varname>$dkim_signers</varname></primary>
18345 </indexterm>
18346 When a message has been received this variable contains
18347 a colon-separated list of signer domains and identities for the message.
18348 For details see section <xref linkend="SECDKIMVFY"/>.
18349 </para>
18350 </listitem></varlistentry>
18351 <varlistentry>
18352 <term><varname>$dnslist_domain</varname></term>
18353 <term><varname>$dnslist_matched</varname></term>
18354 <term><varname>$dnslist_text</varname></term>
18355 <term><varname>$dnslist_value</varname></term>
18356 <listitem>
18357 <para>
18358 <indexterm role="variable">
18359 <primary><varname>$dnslist_domain</varname></primary>
18360 </indexterm>
18361 <indexterm role="variable">
18362 <primary><varname>$dnslist_matched</varname></primary>
18363 </indexterm>
18364 <indexterm role="variable">
18365 <primary><varname>$dnslist_text</varname></primary>
18366 </indexterm>
18367 <indexterm role="variable">
18368 <primary><varname>$dnslist_value</varname></primary>
18369 </indexterm>
18370 <indexterm role="concept">
18371 <primary>black list (DNS)</primary>
18372 </indexterm>
18373 When a DNS (black) list lookup succeeds, these variables are set to contain
18374 the following data from the lookup: the list&#x2019;s domain name, the key that was
18375 looked up, the contents of any associated TXT record, and the value from the
18376 main A record. See section <xref linkend="SECID204"/> for more details.
18377 </para>
18378 </listitem></varlistentry>
18379 <varlistentry>
18380 <term><varname>$domain</varname></term>
18381 <listitem>
18382 <para>
18383 <indexterm role="variable">
18384 <primary><varname>$domain</varname></primary>
18385 </indexterm>
18386 When an address is being routed, or delivered on its own, this variable
18387 contains the domain. Uppercase letters in the domain are converted into lower
18388 case for <varname>$domain</varname>.
18389 </para>
18390 <para>
18391 Global address rewriting happens when a message is received, so the value of
18392 <varname>$domain</varname> during routing and delivery is the value after rewriting. <varname>$domain</varname>
18393 is set during user filtering, but not during system filtering, because a
18394 message may have many recipients and the system filter is called just once.
18395 </para>
18396 <para>
18397 When more than one address is being delivered at once (for example, several
18398 RCPT commands in one SMTP delivery), <varname>$domain</varname> is set only if they all
18399 have the same domain. Transports can be restricted to handling only one domain
18400 at a time if the value of <varname>$domain</varname> is required at transport time &ndash; this is
18401 the default for local transports. For further details of the environment in
18402 which local transports are run, see chapter <xref linkend="CHAPenvironment"/>.
18403 </para>
18404 <para>
18405 <indexterm role="option">
18406 <primary><option>delay_warning_condition</option></primary>
18407 </indexterm>
18408 At the end of a delivery, if all deferred addresses have the same domain, it is
18409 set in <varname>$domain</varname> during the expansion of <option>delay_warning_condition</option>.
18410 </para>
18411 <para>
18412 The <varname>$domain</varname> variable is also used in some other circumstances:
18413 </para>
18414 <itemizedlist>
18415 <listitem>
18416 <para>
18417 When an ACL is running for a RCPT command, <varname>$domain</varname> contains the domain of
18418 the recipient address. The domain of the <emphasis>sender</emphasis> address is in
18419 <varname>$sender_address_domain</varname> at both MAIL time and at RCPT time. <varname>$domain</varname> is not
18420 normally set during the running of the MAIL ACL. However, if the sender address
18421 is verified with a callout during the MAIL ACL, the sender domain is placed in
18422 <varname>$domain</varname> during the expansions of <option>hosts</option>, <option>interface</option>, and <option>port</option> in
18423 the <command>smtp</command> transport.
18424 </para>
18425 </listitem>
18426 <listitem>
18427 <para>
18428 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
18429 <varname>$domain</varname> contains the domain portion of the address that is being rewritten;
18430 it can be used in the expansion of the replacement address, for example, to
18431 rewrite domains by file lookup.
18432 </para>
18433 </listitem>
18434 <listitem>
18435 <para>
18436 With one important exception, whenever a domain list is being scanned,
18437 <varname>$domain</varname> contains the subject domain. <emphasis role="bold">Exception</emphasis>: When a domain list in
18438 a <option>sender_domains</option> condition in an ACL is being processed, the subject domain
18439 is in <varname>$sender_address_domain</varname> and not in <varname>$domain</varname>. It works this way so
18440 that, in a RCPT ACL, the sender domain list can be dependent on the
18441 recipient domain (which is what is in <varname>$domain</varname> at this time).
18442 </para>
18443 </listitem>
18444 <listitem>
18445 <para>
18446 <indexterm role="concept">
18447 <primary>ETRN</primary>
18448 <secondary>value of <varname>$domain</varname></secondary>
18449 </indexterm>
18450 <indexterm role="option">
18451 <primary><option>smtp_etrn_command</option></primary>
18452 </indexterm>
18453 When the <option>smtp_etrn_command</option> option is being expanded, <varname>$domain</varname> contains
18454 the complete argument of the ETRN command (see section <xref linkend="SECTETRN"/>).
18455 </para>
18456 </listitem>
18457 </itemizedlist>
18458 </listitem></varlistentry>
18459 <varlistentry>
18460 <term><varname>$domain_data</varname></term>
18461 <listitem>
18462 <para>
18463 <indexterm role="variable">
18464 <primary><varname>$domain_data</varname></primary>
18465 </indexterm>
18466 When the <option>domains</option> option on a router matches a domain by
18467 means of a lookup, the data read by the lookup is available during the running
18468 of the router as <varname>$domain_data</varname>. In addition, if the driver routes the
18469 address to a transport, the value is available in that transport. If the
18470 transport is handling multiple addresses, the value from the first address is
18471 used.
18472 </para>
18473 <para>
18474 <varname>$domain_data</varname> is also set when the <option>domains</option> condition in an ACL matches a
18475 domain by means of a lookup. The data read by the lookup is available during
18476 the rest of the ACL statement. In all other situations, this variable expands
18477 to nothing.
18478 </para>
18479 </listitem></varlistentry>
18480 <varlistentry>
18481 <term><varname>$exim_gid</varname></term>
18482 <listitem>
18483 <para>
18484 <indexterm role="variable">
18485 <primary><varname>$exim_gid</varname></primary>
18486 </indexterm>
18487 This variable contains the numerical value of the Exim group id.
18488 </para>
18489 </listitem></varlistentry>
18490 <varlistentry>
18491 <term><varname>$exim_path</varname></term>
18492 <listitem>
18493 <para>
18494 <indexterm role="variable">
18495 <primary><varname>$exim_path</varname></primary>
18496 </indexterm>
18497 This variable contains the path to the Exim binary.
18498 </para>
18499 </listitem></varlistentry>
18500 <varlistentry>
18501 <term><varname>$exim_uid</varname></term>
18502 <listitem>
18503 <para>
18504 <indexterm role="variable">
18505 <primary><varname>$exim_uid</varname></primary>
18506 </indexterm>
18507 This variable contains the numerical value of the Exim user id.
18508 </para>
18509 </listitem></varlistentry>
18510 <varlistentry>
18511 <term><varname>$exim_version</varname></term>
18512 <listitem>
18513 <para>
18514 <indexterm role="variable">
18515 <primary><varname>$exim_version</varname></primary>
18516 </indexterm>
18517 This variable contains the version string of the Exim build.
18518 The first character is a major version number, currently 4.
18519 Then after a dot, the next group of digits is a minor version number.
18520 There may be other characters following the minor version.
18521 </para>
18522 </listitem></varlistentry>
18523 <varlistentry>
18524 <term><varname>$header_</varname>&lt;<emphasis>name</emphasis>&gt;</term>
18525 <listitem>
18526 <para>
18527 This is not strictly an expansion variable. It is expansion syntax for
18528 inserting the message header line with the given name. Note that the name must
18529 be terminated by colon or white space, because it may contain a wide variety of
18530 characters. Note also that braces must <emphasis>not</emphasis> be used.
18531 See the full description in section <xref linkend="SECTexpansionitems"/> above.
18532 </para>
18533 </listitem></varlistentry>
18534 <varlistentry>
18535 <term><varname>$headers_added</varname></term>
18536 <listitem>
18537 <para>
18538 <indexterm role="variable">
18539 <primary><varname>$headers_added</varname></primary>
18540 </indexterm>
18541 Within an ACL this variable contains the headers added so far by
18542 the ACL modifier add_header (section <xref linkend="SECTaddheadacl"/>).
18543 The headers are a newline-separated list.
18544 </para>
18545 </listitem></varlistentry>
18546 <varlistentry>
18547 <term><varname>$home</varname></term>
18548 <listitem>
18549 <para>
18550 <indexterm role="variable">
18551 <primary><varname>$home</varname></primary>
18552 </indexterm>
18553 When the <option>check_local_user</option> option is set for a router, the user&#x2019;s home
18554 directory is placed in <varname>$home</varname> when the check succeeds. In particular, this
18555 means it is set during the running of users&#x2019; filter files. A router may also
18556 explicitly set a home directory for use by a transport; this can be overridden
18557 by a setting on the transport itself.
18558 </para>
18559 <para>
18560 When running a filter test via the <option>-bf</option> option, <varname>$home</varname> is set to the value
18561 of the environment variable HOME, which is subject to the
18562 <option>keep_environment</option> and <option>add_environment</option> main config options.
18563 </para>
18564 </listitem></varlistentry>
18565 <varlistentry>
18566 <term><varname>$host</varname></term>
18567 <listitem>
18568 <para>
18569 <indexterm role="variable">
18570 <primary><varname>$host</varname></primary>
18571 </indexterm>
18572 If a router assigns an address to a transport (any transport), and passes a
18573 list of hosts with the address, the value of <varname>$host</varname> when the transport starts
18574 to run is the name of the first host on the list. Note that this applies both
18575 to local and remote transports.
18576 </para>
18577 <para>
18578 <indexterm role="concept">
18579 <primary>transport</primary>
18580 <secondary>filter</secondary>
18581 </indexterm>
18582 <indexterm role="concept">
18583 <primary>filter</primary>
18584 <secondary>transport filter</secondary>
18585 </indexterm>
18586 For the <command>smtp</command> transport, if there is more than one host, the value of
18587 <varname>$host</varname> changes as the transport works its way through the list. In
18588 particular, when the <command>smtp</command> transport is expanding its options for encryption
18589 using TLS, or for specifying a transport filter (see chapter
18590 <xref linkend="CHAPtransportgeneric"/>), <varname>$host</varname> contains the name of the host to which it
18591 is connected.
18592 </para>
18593 <para>
18594 When used in the client part of an authenticator configuration (see chapter
18595 <xref linkend="CHAPSMTPAUTH"/>), <varname>$host</varname> contains the name of the server to which the
18596 client is connected.
18597 </para>
18598 </listitem></varlistentry>
18599 <varlistentry>
18600 <term><varname>$host_address</varname></term>
18601 <listitem>
18602 <para>
18603 <indexterm role="variable">
18604 <primary><varname>$host_address</varname></primary>
18605 </indexterm>
18606 This variable is set to the remote host&#x2019;s IP address whenever <varname>$host</varname> is set
18607 for a remote connection. It is also set to the IP address that is being checked
18608 when the <option>ignore_target_hosts</option> option is being processed.
18609 </para>
18610 </listitem></varlistentry>
18611 <varlistentry>
18612 <term><varname>$host_data</varname></term>
18613 <listitem>
18614 <para>
18615 <indexterm role="variable">
18616 <primary><varname>$host_data</varname></primary>
18617 </indexterm>
18618 If a <option>hosts</option> condition in an ACL is satisfied by means of a lookup, the
18619 result of the lookup is made available in the <varname>$host_data</varname> variable. This
18620 allows you, for example, to do things like this:
18621 </para>
18622 <literallayout class="monospaced">
18623 deny  hosts = net-lsearch;/some/file
18624 message = $host_data
18625 </literallayout>
18626 </listitem></varlistentry>
18627 <varlistentry>
18628 <term><varname>$host_lookup_deferred</varname></term>
18629 <listitem>
18630 <para>
18631 <indexterm role="concept">
18632 <primary>host name</primary>
18633 <secondary>lookup, failure of</secondary>
18634 </indexterm>
18635 <indexterm role="variable">
18636 <primary><varname>$host_lookup_deferred</varname></primary>
18637 </indexterm>
18638 This variable normally contains <quote>0</quote>, as does <varname>$host_lookup_failed</varname>. When a
18639 message comes from a remote host and there is an attempt to look up the host&#x2019;s
18640 name from its IP address, and the attempt is not successful, one of these
18641 variables is set to <quote>1</quote>.
18642 </para>
18643 <itemizedlist>
18644 <listitem>
18645 <para>
18646 If the lookup receives a definite negative response (for example, a DNS lookup
18647 succeeded, but no records were found), <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
18648 </para>
18649 </listitem>
18650 <listitem>
18651 <para>
18652 If there is any kind of problem during the lookup, such that Exim cannot
18653 tell whether or not the host name is defined (for example, a timeout for a DNS
18654 lookup), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>.
18655 </para>
18656 </listitem>
18657 </itemizedlist>
18658 <para>
18659 Looking up a host&#x2019;s name from its IP address consists of more than just a
18660 single reverse lookup. Exim checks that a forward lookup of at least one of the
18661 names it receives from a reverse lookup yields the original IP address. If this
18662 is not the case, Exim does not accept the looked up name(s), and
18663 <varname>$host_lookup_failed</varname> is set to <quote>1</quote>. Thus, being able to find a name from an
18664 IP address (for example, the existence of a PTR record in the DNS) is not
18665 sufficient on its own for the success of a host name lookup. If the reverse
18666 lookup succeeds, but there is a lookup problem such as a timeout when checking
18667 the result, the name is not accepted, and <varname>$host_lookup_deferred</varname> is set to
18668 <quote>1</quote>. See also <varname>$sender_host_name</varname>.
18669 </para>
18670 <para>
18671 <indexterm role="concept">
18672 <primary>authentication</primary>
18673 <secondary>expansion item</secondary>
18674 </indexterm>
18675 Performing these checks sets up information used by the
18676 <varname>$authresults</varname> expansion item.
18677 </para>
18678 </listitem></varlistentry>
18679 <varlistentry>
18680 <term><varname>$host_lookup_failed</varname></term>
18681 <listitem>
18682 <para>
18683 <indexterm role="variable">
18684 <primary><varname>$host_lookup_failed</varname></primary>
18685 </indexterm>
18686 See <varname>$host_lookup_deferred</varname>.
18687 </para>
18688 </listitem></varlistentry>
18689 <varlistentry>
18690 <term><varname>$host_port</varname></term>
18691 <listitem>
18692 <para>
18693 <indexterm role="variable">
18694 <primary><varname>$host_port</varname></primary>
18695 </indexterm>
18696 This variable is set to the remote host&#x2019;s TCP port whenever <varname>$host</varname> is set
18697 for an outbound connection.
18698 </para>
18699 </listitem></varlistentry>
18700 <varlistentry>
18701 <term><varname>$initial_cwd</varname></term>
18702 <listitem>
18703 <para>
18704 <indexterm role="variable">
18705 <primary><varname>$initial_cwd</varname></primary>
18706 </indexterm>
18707 This variable contains the full path name of the initial working
18708 directory of the current Exim process. This may differ from the current
18709 working directory, as Exim changes this to "/" during early startup, and
18710 to <varname>$spool_directory</varname> later.
18711 </para>
18712 </listitem></varlistentry>
18713 <varlistentry>
18714 <term><varname>$inode</varname></term>
18715 <listitem>
18716 <para>
18717 <indexterm role="variable">
18718 <primary><varname>$inode</varname></primary>
18719 </indexterm>
18720 The only time this variable is set is while expanding the <option>directory_file</option>
18721 option in the <command>appendfile</command> transport. The variable contains the inode number
18722 of the temporary file which is about to be renamed. It can be used to construct
18723 a unique name for the file.
18724 </para>
18725 </listitem></varlistentry>
18726 <varlistentry>
18727 <term><varname>$interface_address</varname></term>
18728 <listitem>
18729 <para>
18730 <indexterm role="variable">
18731 <primary><varname>$interface_address</varname></primary>
18732 </indexterm>
18733 This is an obsolete name for <varname>$received_ip_address</varname>.
18734 </para>
18735 </listitem></varlistentry>
18736 <varlistentry>
18737 <term><varname>$interface_port</varname></term>
18738 <listitem>
18739 <para>
18740 <indexterm role="variable">
18741 <primary><varname>$interface_port</varname></primary>
18742 </indexterm>
18743 This is an obsolete name for <varname>$received_port</varname>.
18744 </para>
18745 </listitem></varlistentry>
18746 <varlistentry>
18747 <term><varname>$item</varname></term>
18748 <listitem>
18749 <para>
18750 <indexterm role="variable">
18751 <primary><varname>$item</varname></primary>
18752 </indexterm>
18753 This variable is used during the expansion of <emphasis role="bold">forall</emphasis> and <emphasis role="bold">forany</emphasis>
18754 conditions (see section <xref linkend="SECTexpcond"/>), and <emphasis role="bold">filter</emphasis>, <emphasis role="bold">map</emphasis>, and
18755 <emphasis role="bold">reduce</emphasis> items (see section <xref linkend="SECTexpcond"/>). In other circumstances, it is
18756 empty.
18757 </para>
18758 </listitem></varlistentry>
18759 <varlistentry>
18760 <term><varname>$ldap_dn</varname></term>
18761 <listitem>
18762 <para>
18763 <indexterm role="variable">
18764 <primary><varname>$ldap_dn</varname></primary>
18765 </indexterm>
18766 This variable, which is available only when Exim is compiled with LDAP support,
18767 contains the DN from the last entry in the most recently successful LDAP
18768 lookup.
18769 </para>
18770 </listitem></varlistentry>
18771 <varlistentry>
18772 <term><varname>$load_average</varname></term>
18773 <listitem>
18774 <para>
18775 <indexterm role="variable">
18776 <primary><varname>$load_average</varname></primary>
18777 </indexterm>
18778 This variable contains the system load average, multiplied by 1000 so that it
18779 is an integer. For example, if the load average is 0.21, the value of the
18780 variable is 210. The value is recomputed every time the variable is referenced.
18781 </para>
18782 </listitem></varlistentry>
18783 <varlistentry>
18784 <term><varname>$local_part</varname></term>
18785 <listitem>
18786 <para>
18787 <indexterm role="variable">
18788 <primary><varname>$local_part</varname></primary>
18789 </indexterm>
18790 When an address is being routed, or delivered on its own, this
18791 variable contains the local part. When a number of addresses are being
18792 delivered together (for example, multiple RCPT commands in an SMTP
18793 session), <varname>$local_part</varname> is not set.
18794 </para>
18795 <para>
18796 Global address rewriting happens when a message is received, so the value of
18797 <varname>$local_part</varname> during routing and delivery is the value after rewriting.
18798 <varname>$local_part</varname> is set during user filtering, but not during system filtering,
18799 because a message may have many recipients and the system filter is called just
18800 once.
18801 </para>
18802 <para>
18803 <indexterm role="variable">
18804 <primary><varname>$local_part_prefix</varname></primary>
18805 </indexterm>
18806 <indexterm role="variable">
18807 <primary><varname>$local_part_suffix</varname></primary>
18808 </indexterm>
18809 <indexterm role="concept">
18810 <primary>affix</primary>
18811 <secondary>variables</secondary>
18812 </indexterm>
18813 If a local part prefix or suffix has been recognized, it is not included in the
18814 value of <varname>$local_part</varname> during routing and subsequent delivery. The values of
18815 any prefix or suffix are in <varname>$local_part_prefix</varname> and
18816 <varname>$local_part_suffix</varname>, respectively.
18817 </para>
18818 <para>
18819 When a message is being delivered to a file, pipe, or autoreply transport as a
18820 result of aliasing or forwarding, <varname>$local_part</varname> is set to the local part of
18821 the parent address, not to the filename or command (see <varname>$address_file</varname> and
18822 <varname>$address_pipe</varname>).
18823 </para>
18824 <para>
18825 When an ACL is running for a RCPT command, <varname>$local_part</varname> contains the
18826 local part of the recipient address.
18827 </para>
18828 <para>
18829 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
18830 <varname>$local_part</varname> contains the local part of the address that is being rewritten;
18831 it can be used in the expansion of the replacement address, for example.
18832 </para>
18833 <para>
18834 In all cases, all quoting is removed from the local part. For example, for both
18835 the addresses
18836 </para>
18837 <literallayout class="monospaced">
18838 "abc:xyz"@test.example
18839 abc\:xyz@test.example
18840 </literallayout>
18841 <para>
18842 the value of <varname>$local_part</varname> is
18843 </para>
18844 <literallayout class="monospaced">
18845 abc:xyz
18846 </literallayout>
18847 <para>
18848 If you use <varname>$local_part</varname> to create another address, you should always wrap it
18849 inside a quoting operator. For example, in a <command>redirect</command> router you could
18850 have:
18851 </para>
18852 <literallayout class="monospaced">
18853 data = ${quote_local_part:$local_part}@new.domain.example
18854 </literallayout>
18855 <para>
18856 <emphasis role="bold">Note</emphasis>: The value of <varname>$local_part</varname> is normally lower cased. If you want
18857 to process local parts in a case-dependent manner in a router, you can set the
18858 <option>caseful_local_part</option> option (see chapter <xref linkend="CHAProutergeneric"/>).
18859 </para>
18860 </listitem></varlistentry>
18861 <varlistentry>
18862 <term><varname>$local_part_data</varname></term>
18863 <listitem>
18864 <para>
18865 <indexterm role="variable">
18866 <primary><varname>$local_part_data</varname></primary>
18867 </indexterm>
18868 When the <option>local_parts</option> option on a router matches a local part by means of a
18869 lookup, the data read by the lookup is available during the running of the
18870 router as <varname>$local_part_data</varname>. In addition, if the driver routes the address
18871 to a transport, the value is available in that transport. If the transport is
18872 handling multiple addresses, the value from the first address is used.
18873 </para>
18874 <para>
18875 <varname>$local_part_data</varname> is also set when the <option>local_parts</option> condition in an ACL
18876 matches a local part by means of a lookup. The data read by the lookup is
18877 available during the rest of the ACL statement. In all other situations, this
18878 variable expands to nothing.
18879 </para>
18880 </listitem></varlistentry>
18881 <varlistentry>
18882 <term><varname>$local_part_prefix</varname></term>
18883 <listitem>
18884 <para>
18885 <indexterm role="variable">
18886 <primary><varname>$local_part_prefix</varname></primary>
18887 </indexterm>
18888 <indexterm role="concept">
18889 <primary>affix</primary>
18890 <secondary>variables</secondary>
18891 </indexterm>
18892 When an address is being routed or delivered, and a
18893 specific prefix for the local part was recognized, it is available in this
18894 variable, having been removed from <varname>$local_part</varname>.
18895 </para>
18896 </listitem></varlistentry>
18897 <varlistentry>
18898 <term><varname>$local_part_suffix</varname></term>
18899 <listitem>
18900 <para>
18901 <indexterm role="variable">
18902 <primary><varname>$local_part_suffix</varname></primary>
18903 </indexterm>
18904 When an address is being routed or delivered, and a
18905 specific suffix for the local part was recognized, it is available in this
18906 variable, having been removed from <varname>$local_part</varname>.
18907 </para>
18908 </listitem></varlistentry>
18909 <varlistentry>
18910 <term><varname>$local_scan_data</varname></term>
18911 <listitem>
18912 <para>
18913 <indexterm role="variable">
18914 <primary><varname>$local_scan_data</varname></primary>
18915 </indexterm>
18916 This variable contains the text returned by the <function>local_scan()</function> function when
18917 a message is received. See chapter <xref linkend="CHAPlocalscan"/> for more details.
18918 </para>
18919 </listitem></varlistentry>
18920 <varlistentry>
18921 <term><varname>$local_user_gid</varname></term>
18922 <listitem>
18923 <para>
18924 <indexterm role="variable">
18925 <primary><varname>$local_user_gid</varname></primary>
18926 </indexterm>
18927 See <varname>$local_user_uid</varname>.
18928 </para>
18929 </listitem></varlistentry>
18930 <varlistentry>
18931 <term><varname>$local_user_uid</varname></term>
18932 <listitem>
18933 <para>
18934 <indexterm role="variable">
18935 <primary><varname>$local_user_uid</varname></primary>
18936 </indexterm>
18937 This variable and <varname>$local_user_gid</varname> are set to the uid and gid after the
18938 <option>check_local_user</option> router precondition succeeds. This means that their values
18939 are available for the remaining preconditions (<option>senders</option>, <option>require_files</option>,
18940 and <option>condition</option>), for the <option>address_data</option> expansion, and for any
18941 router-specific expansions. At all other times, the values in these variables
18942 are <literal>(uid_t)(-1)</literal> and <literal>(gid_t)(-1)</literal>, respectively.
18943 </para>
18944 </listitem></varlistentry>
18945 <varlistentry>
18946 <term><varname>$localhost_number</varname></term>
18947 <listitem>
18948 <para>
18949 <indexterm role="variable">
18950 <primary><varname>$localhost_number</varname></primary>
18951 </indexterm>
18952 This contains the expanded value of the
18953 <option>localhost_number</option> option. The expansion happens after the main options have
18954 been read.
18955 </para>
18956 </listitem></varlistentry>
18957 <varlistentry>
18958 <term><varname>$log_inodes</varname></term>
18959 <listitem>
18960 <para>
18961 <indexterm role="variable">
18962 <primary><varname>$log_inodes</varname></primary>
18963 </indexterm>
18964 The number of free inodes in the disk partition where Exim&#x2019;s
18965 log files are being written. The value is recalculated whenever the variable is
18966 referenced. If the relevant file system does not have the concept of inodes,
18967 the value of is -1. See also the <option>check_log_inodes</option> option.
18968 </para>
18969 </listitem></varlistentry>
18970 <varlistentry>
18971 <term><varname>$log_space</varname></term>
18972 <listitem>
18973 <para>
18974 <indexterm role="variable">
18975 <primary><varname>$log_space</varname></primary>
18976 </indexterm>
18977 The amount of free space (as a number of kilobytes) in the disk
18978 partition where Exim&#x2019;s log files are being written. The value is recalculated
18979 whenever the variable is referenced. If the operating system does not have the
18980 ability to find the amount of free space (only true for experimental systems),
18981 the space value is -1. See also the <option>check_log_space</option> option.
18982 </para>
18983 </listitem></varlistentry>
18984 <varlistentry>
18985 <term><varname>$lookup_dnssec_authenticated</varname></term>
18986 <listitem>
18987 <para>
18988 <indexterm role="variable">
18989 <primary><varname>$lookup_dnssec_authenticated</varname></primary>
18990 </indexterm>
18991 This variable is set after a DNS lookup done by
18992 a dnsdb lookup expansion, dnslookup router or smtp transport.
18993 <indexterm role="concept">
18994 <primary>DNS</primary>
18995 <secondary>DNSSEC</secondary>
18996 </indexterm>
18997 It will be empty if <command>DNSSEC</command> was not requested,
18998 <quote>no</quote> if the result was not labelled as authenticated data
18999 and <quote>yes</quote> if it was.
19000 Results that are labelled as authoritative answer that match
19001 the <option>dns_trust_aa</option> configuration variable count also
19002 as authenticated data.
19003 </para>
19004 </listitem></varlistentry>
19005 <varlistentry>
19006 <term><varname>$mailstore_basename</varname></term>
19007 <listitem>
19008 <para>
19009 <indexterm role="variable">
19010 <primary><varname>$mailstore_basename</varname></primary>
19011 </indexterm>
19012 This variable is set only when doing deliveries in <quote>mailstore</quote> format in the
19013 <command>appendfile</command> transport. During the expansion of the <option>mailstore_prefix</option>,
19014 <option>mailstore_suffix</option>, <option>message_prefix</option>, and <option>message_suffix</option> options, it
19015 contains the basename of the files that are being written, that is, the name
19016 without the <quote>.tmp</quote>, <quote>.env</quote>, or <quote>.msg</quote> suffix. At all other times, this
19017 variable is empty.
19018 </para>
19019 </listitem></varlistentry>
19020 <varlistentry>
19021 <term><varname>$malware_name</varname></term>
19022 <listitem>
19023 <para>
19024 <indexterm role="variable">
19025 <primary><varname>$malware_name</varname></primary>
19026 </indexterm>
19027 This variable is available when Exim is compiled with the
19028 content-scanning extension. It is set to the name of the virus that was found
19029 when the ACL <option>malware</option> condition is true (see section <xref linkend="SECTscanvirus"/>).
19030 </para>
19031 </listitem></varlistentry>
19032 <varlistentry>
19033 <term><varname>$max_received_linelength</varname></term>
19034 <listitem>
19035 <para>
19036 <indexterm role="variable">
19037 <primary><varname>$max_received_linelength</varname></primary>
19038 </indexterm>
19039 <indexterm role="concept">
19040 <primary>maximum</primary>
19041 <secondary>line length</secondary>
19042 </indexterm>
19043 <indexterm role="concept">
19044 <primary>line length</primary>
19045 <secondary>maximum</secondary>
19046 </indexterm>
19047 This variable contains the number of bytes in the longest line that was
19048 received as part of the message, not counting the line termination
19049 character(s).
19050 It is not valid if the <option>spool_files_wireformat</option> option is used.
19051 </para>
19052 </listitem></varlistentry>
19053 <varlistentry>
19054 <term><varname>$message_age</varname></term>
19055 <listitem>
19056 <para>
19057 <indexterm role="concept">
19058 <primary>message</primary>
19059 <secondary>age of</secondary>
19060 </indexterm>
19061 <indexterm role="variable">
19062 <primary><varname>$message_age</varname></primary>
19063 </indexterm>
19064 This variable is set at the start of a delivery attempt to contain the number
19065 of seconds since the message was received. It does not change during a single
19066 delivery attempt.
19067 </para>
19068 </listitem></varlistentry>
19069 <varlistentry>
19070 <term><varname>$message_body</varname></term>
19071 <listitem>
19072 <para>
19073 <indexterm role="concept">
19074 <primary>body of message</primary>
19075 <secondary>expansion variable</secondary>
19076 </indexterm>
19077 <indexterm role="concept">
19078 <primary>message body</primary>
19079 <secondary>in expansion</secondary>
19080 </indexterm>
19081 <indexterm role="concept">
19082 <primary>binary zero</primary>
19083 <secondary>in message body</secondary>
19084 </indexterm>
19085 <indexterm role="variable">
19086 <primary><varname>$message_body</varname></primary>
19087 </indexterm>
19088 <indexterm role="option">
19089 <primary><option>message_body_visible</option></primary>
19090 </indexterm>
19091 This variable contains the initial portion of a message&#x2019;s body while it is
19092 being delivered, and is intended mainly for use in filter files. The maximum
19093 number of characters of the body that are put into the variable is set by the
19094 <option>message_body_visible</option> configuration option; the default is 500.
19095 </para>
19096 <para>
19097 <indexterm role="option">
19098 <primary><option>message_body_newlines</option></primary>
19099 </indexterm>
19100 By default, newlines are converted into spaces in <varname>$message_body</varname>, to make it
19101 easier to search for phrases that might be split over a line break. However,
19102 this can be disabled by setting <option>message_body_newlines</option> to be true. Binary
19103 zeros are always converted into spaces.
19104 </para>
19105 </listitem></varlistentry>
19106 <varlistentry>
19107 <term><varname>$message_body_end</varname></term>
19108 <listitem>
19109 <para>
19110 <indexterm role="concept">
19111 <primary>body of message</primary>
19112 <secondary>expansion variable</secondary>
19113 </indexterm>
19114 <indexterm role="concept">
19115 <primary>message body</primary>
19116 <secondary>in expansion</secondary>
19117 </indexterm>
19118 <indexterm role="variable">
19119 <primary><varname>$message_body_end</varname></primary>
19120 </indexterm>
19121 This variable contains the final portion of a message&#x2019;s
19122 body while it is being delivered. The format and maximum size are as for
19123 <varname>$message_body</varname>.
19124 </para>
19125 </listitem></varlistentry>
19126 <varlistentry>
19127 <term><varname>$message_body_size</varname></term>
19128 <listitem>
19129 <para>
19130 <indexterm role="concept">
19131 <primary>body of message</primary>
19132 <secondary>size</secondary>
19133 </indexterm>
19134 <indexterm role="concept">
19135 <primary>message body</primary>
19136 <secondary>size</secondary>
19137 </indexterm>
19138 <indexterm role="variable">
19139 <primary><varname>$message_body_size</varname></primary>
19140 </indexterm>
19141 When a message is being delivered, this variable contains the size of the body
19142 in bytes. The count starts from the character after the blank line that
19143 separates the body from the header. Newlines are included in the count. See
19144 also <varname>$message_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
19145 </para>
19146 <para>
19147 If the spool file is wireformat
19148 (see the <option>spool_files_wireformat</option> main option)
19149 the CRLF line-terminators are included in the count.
19150 </para>
19151 </listitem></varlistentry>
19152 <varlistentry>
19153 <term><varname>$message_exim_id</varname></term>
19154 <listitem>
19155 <para>
19156 <indexterm role="variable">
19157 <primary><varname>$message_exim_id</varname></primary>
19158 </indexterm>
19159 When a message is being received or delivered, this variable contains the
19160 unique message id that is generated and used by Exim to identify the message.
19161 An id is not created for a message until after its header has been successfully
19162 received. <emphasis role="bold">Note</emphasis>: This is <emphasis>not</emphasis> the contents of the <emphasis>Message-ID:</emphasis> header
19163 line; it is the local id that Exim assigns to the message, for example:
19164 <literal>1BXTIK-0001yO-VA</literal>.
19165 </para>
19166 </listitem></varlistentry>
19167 <varlistentry>
19168 <term><varname>$message_headers</varname></term>
19169 <listitem>
19170 <para>
19171 <indexterm role="variable">
19172 <primary><varname>$message_headers</varname></primary>
19173 </indexterm>
19174 This variable contains a concatenation of all the header lines when a message
19175 is being processed, except for lines added by routers or transports. The header
19176 lines are separated by newline characters. Their contents are decoded in the
19177 same way as a header line that is inserted by <option>bheader</option>.
19178 </para>
19179 </listitem></varlistentry>
19180 <varlistentry>
19181 <term><varname>$message_headers_raw</varname></term>
19182 <listitem>
19183 <para>
19184 <indexterm role="variable">
19185 <primary><varname>$message_headers_raw</varname></primary>
19186 </indexterm>
19187 This variable is like <varname>$message_headers</varname> except that no processing of the
19188 contents of header lines is done.
19189 </para>
19190 </listitem></varlistentry>
19191 <varlistentry>
19192 <term><varname>$message_id</varname></term>
19193 <listitem>
19194 <para>
19195 This is an old name for <varname>$message_exim_id</varname>. It is now deprecated.
19196 </para>
19197 </listitem></varlistentry>
19198 <varlistentry>
19199 <term><varname>$message_linecount</varname></term>
19200 <listitem>
19201 <para>
19202 <indexterm role="variable">
19203 <primary><varname>$message_linecount</varname></primary>
19204 </indexterm>
19205 This variable contains the total number of lines in the header and body of the
19206 message. Compare <varname>$body_linecount</varname>, which is the count for the body only.
19207 During the DATA and content-scanning ACLs, <varname>$message_linecount</varname> contains the
19208 number of lines received. Before delivery happens (that is, before filters,
19209 routers, and transports run) the count is increased to include the
19210 <emphasis>Received:</emphasis> header line that Exim standardly adds, and also any other header
19211 lines that are added by ACLs. The blank line that separates the message header
19212 from the body is not counted.
19213 </para>
19214 <para>
19215 As with the special case of <varname>$message_size</varname>, during the expansion of the
19216 appendfile transport&#x2019;s maildir_tag option in maildir format, the value of
19217 <varname>$message_linecount</varname> is the precise size of the number of newlines in the
19218 file that has been written (minus one for the blank line between the
19219 header and the body).
19220 </para>
19221 <para>
19222 Here is an example of the use of this variable in a DATA ACL:
19223 </para>
19224 <literallayout class="monospaced">
19225 deny message   = Too many lines in message header
19226      condition = \
19227       ${if &lt;{250}{${eval:$message_linecount - $body_linecount}}}
19228 </literallayout>
19229 <para>
19230 In the MAIL and RCPT ACLs, the value is zero because at that stage the
19231 message has not yet been received.
19232 </para>
19233 <para>
19234 This variable is not valid if the <option>spool_files_wireformat</option> option is used.
19235 </para>
19236 </listitem></varlistentry>
19237 <varlistentry>
19238 <term><varname>$message_size</varname></term>
19239 <listitem>
19240 <para>
19241 <indexterm role="concept">
19242 <primary>size</primary>
19243 <secondary>of message</secondary>
19244 </indexterm>
19245 <indexterm role="concept">
19246 <primary>message</primary>
19247 <secondary>size</secondary>
19248 </indexterm>
19249 <indexterm role="variable">
19250 <primary><varname>$message_size</varname></primary>
19251 </indexterm>
19252 When a message is being processed, this variable contains its size in bytes. In
19253 most cases, the size includes those headers that were received with the
19254 message, but not those (such as <emphasis>Envelope-to:</emphasis>) that are added to individual
19255 deliveries as they are written. However, there is one special case: during the
19256 expansion of the <option>maildir_tag</option> option in the <command>appendfile</command> transport while
19257 doing a delivery in maildir format, the value of <varname>$message_size</varname> is the
19258 precise size of the file that has been written. See also
19259 <varname>$message_body_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
19260 </para>
19261 <para>
19262 <indexterm role="concept">
19263 <primary>RCPT</primary>
19264 <secondary>value of <varname>$message_size</varname></secondary>
19265 </indexterm>
19266 While running a per message ACL (mail/rcpt/predata), <varname>$message_size</varname>
19267 contains the size supplied on the MAIL command, or -1 if no size was given. The
19268 value may not, of course, be truthful.
19269 </para>
19270 </listitem></varlistentry>
19271 <varlistentry>
19272 <term><varname>$mime_</varname><emphasis>xxx</emphasis></term>
19273 <listitem>
19274 <para>
19275 A number of variables whose names start with <varname>$mime</varname> are
19276 available when Exim is compiled with the content-scanning extension. For
19277 details, see section <xref linkend="SECTscanmimepart"/>.
19278 </para>
19279 </listitem></varlistentry>
19280 <varlistentry>
19281 <term><varname>$n0</varname> &ndash; <varname>$n9</varname></term>
19282 <listitem>
19283 <para>
19284 These variables are counters that can be incremented by means
19285 of the <option>add</option> command in filter files.
19286 </para>
19287 </listitem></varlistentry>
19288 <varlistentry>
19289 <term><varname>$original_domain</varname></term>
19290 <listitem>
19291 <para>
19292 <indexterm role="variable">
19293 <primary><varname>$domain</varname></primary>
19294 </indexterm>
19295 <indexterm role="variable">
19296 <primary><varname>$original_domain</varname></primary>
19297 </indexterm>
19298 When a top-level address is being processed for delivery, this contains the
19299 same value as <varname>$domain</varname>. However, if a <quote>child</quote> address (for example,
19300 generated by an alias, forward, or filter file) is being processed, this
19301 variable contains the domain of the original address (lower cased). This
19302 differs from <varname>$parent_domain</varname> only when there is more than one level of
19303 aliasing or forwarding. When more than one address is being delivered in a
19304 single transport run, <varname>$original_domain</varname> is not set.
19305 </para>
19306 <para>
19307 If a new address is created by means of a <option>deliver</option> command in a system
19308 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
19309 part <emphasis>system-filter</emphasis> and the default qualify domain.
19310 </para>
19311 </listitem></varlistentry>
19312 <varlistentry>
19313 <term><varname>$original_local_part</varname></term>
19314 <listitem>
19315 <para>
19316 <indexterm role="variable">
19317 <primary><varname>$local_part</varname></primary>
19318 </indexterm>
19319 <indexterm role="variable">
19320 <primary><varname>$original_local_part</varname></primary>
19321 </indexterm>
19322 When a top-level address is being processed for delivery, this contains the
19323 same value as <varname>$local_part</varname>, unless a prefix or suffix was removed from the
19324 local part, because <varname>$original_local_part</varname> always contains the full local
19325 part. When a <quote>child</quote> address (for example, generated by an alias, forward, or
19326 filter file) is being processed, this variable contains the full local part of
19327 the original address.
19328 </para>
19329 <para>
19330 If the router that did the redirection processed the local part
19331 case-insensitively, the value in <varname>$original_local_part</varname> is in lower case.
19332 This variable differs from <varname>$parent_local_part</varname> only when there is more than
19333 one level of aliasing or forwarding. When more than one address is being
19334 delivered in a single transport run, <varname>$original_local_part</varname> is not set.
19335 </para>
19336 <para>
19337 If a new address is created by means of a <option>deliver</option> command in a system
19338 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
19339 part <emphasis>system-filter</emphasis> and the default qualify domain.
19340 </para>
19341 </listitem></varlistentry>
19342 <varlistentry>
19343 <term><varname>$originator_gid</varname></term>
19344 <listitem>
19345 <para>
19346 <indexterm role="concept">
19347 <primary>gid (group id)</primary>
19348 <secondary>of originating user</secondary>
19349 </indexterm>
19350 <indexterm role="concept">
19351 <primary>sender</primary>
19352 <secondary>gid</secondary>
19353 </indexterm>
19354 <indexterm role="variable">
19355 <primary><varname>$caller_gid</varname></primary>
19356 </indexterm>
19357 <indexterm role="variable">
19358 <primary><varname>$originator_gid</varname></primary>
19359 </indexterm>
19360 This variable contains the value of <varname>$caller_gid</varname> that was set when the
19361 message was received. For messages received via the command line, this is the
19362 gid of the sending user. For messages received by SMTP over TCP/IP, this is
19363 normally the gid of the Exim user.
19364 </para>
19365 </listitem></varlistentry>
19366 <varlistentry>
19367 <term><varname>$originator_uid</varname></term>
19368 <listitem>
19369 <para>
19370 <indexterm role="concept">
19371 <primary>uid (user id)</primary>
19372 <secondary>of originating user</secondary>
19373 </indexterm>
19374 <indexterm role="concept">
19375 <primary>sender</primary>
19376 <secondary>uid</secondary>
19377 </indexterm>
19378 <indexterm role="variable">
19379 <primary><varname>$caller_uid</varname></primary>
19380 </indexterm>
19381 <indexterm role="variable">
19382 <primary><varname>$originator_uid</varname></primary>
19383 </indexterm>
19384 The value of <varname>$caller_uid</varname> that was set when the message was received. For
19385 messages received via the command line, this is the uid of the sending user.
19386 For messages received by SMTP over TCP/IP, this is normally the uid of the Exim
19387 user.
19388 </para>
19389 </listitem></varlistentry>
19390 <varlistentry>
19391 <term><varname>$parent_domain</varname></term>
19392 <listitem>
19393 <para>
19394 <indexterm role="variable">
19395 <primary><varname>$parent_domain</varname></primary>
19396 </indexterm>
19397 This variable is similar to <varname>$original_domain</varname> (see
19398 above), except that it refers to the immediately preceding parent address.
19399 </para>
19400 </listitem></varlistentry>
19401 <varlistentry>
19402 <term><varname>$parent_local_part</varname></term>
19403 <listitem>
19404 <para>
19405 <indexterm role="variable">
19406 <primary><varname>$parent_local_part</varname></primary>
19407 </indexterm>
19408 This variable is similar to <varname>$original_local_part</varname>
19409 (see above), except that it refers to the immediately preceding parent address.
19410 </para>
19411 </listitem></varlistentry>
19412 <varlistentry>
19413 <term><varname>$pid</varname></term>
19414 <listitem>
19415 <para>
19416 <indexterm role="concept">
19417 <primary>pid (process id)</primary>
19418 <secondary>of current process</secondary>
19419 </indexterm>
19420 <indexterm role="variable">
19421 <primary><varname>$pid</varname></primary>
19422 </indexterm>
19423 This variable contains the current process id.
19424 </para>
19425 </listitem></varlistentry>
19426 <varlistentry>
19427 <term><varname>$pipe_addresses</varname></term>
19428 <listitem>
19429 <para>
19430 <indexterm role="concept">
19431 <primary>filter</primary>
19432 <secondary>transport filter</secondary>
19433 </indexterm>
19434 <indexterm role="concept">
19435 <primary>transport</primary>
19436 <secondary>filter</secondary>
19437 </indexterm>
19438 <indexterm role="variable">
19439 <primary><varname>$pipe_addresses</varname></primary>
19440 </indexterm>
19441 This is not an expansion variable, but is mentioned here because the string
19442 <literal>$pipe_addresses</literal> is handled specially in the command specification for the
19443 <command>pipe</command> transport (chapter <xref linkend="CHAPpipetransport"/>) and in transport filters
19444 (described under <option>transport_filter</option> in chapter <xref linkend="CHAPtransportgeneric"/>).
19445 It cannot be used in general expansion strings, and provokes an <quote>unknown
19446 variable</quote> error if encountered.
19447 </para>
19448 </listitem></varlistentry>
19449 <varlistentry>
19450 <term><varname>$primary_hostname</varname></term>
19451 <listitem>
19452 <para>
19453 <indexterm role="variable">
19454 <primary><varname>$primary_hostname</varname></primary>
19455 </indexterm>
19456 This variable contains the value set by <option>primary_hostname</option> in the
19457 configuration file, or read by the <function>uname()</function> function. If <function>uname()</function> returns
19458 a single-component name, Exim calls <function>gethostbyname()</function> (or
19459 <function>getipnodebyname()</function> where available) in an attempt to acquire a fully
19460 qualified host name. See also <varname>$smtp_active_hostname</varname>.
19461 </para>
19462 </listitem></varlistentry>
19463 <varlistentry>
19464 <term><varname>$proxy_external_address</varname></term>
19465 <term><varname>$proxy_external_port</varname></term>
19466 <term><varname>$proxy_local_address</varname></term>
19467 <term><varname>$proxy_local_port</varname></term>
19468 <term><varname>$proxy_session</varname></term>
19469 <listitem>
19470 <para>
19471 These variables are only available when built with Proxy Protocol
19472 or SOCKS5 support.
19473 For details see chapter <xref linkend="SECTproxyInbound"/>.
19474 </para>
19475 </listitem></varlistentry>
19476 <varlistentry>
19477 <term><varname>$prdr_requested</varname></term>
19478 <listitem>
19479 <para>
19480 <indexterm role="concept">
19481 <primary>PRDR</primary>
19482 <secondary>variable for</secondary>
19483 </indexterm>
19484 This variable is set to <quote>yes</quote> if PRDR was requested by the client for the
19485 current message, otherwise <quote>no</quote>.
19486 </para>
19487 </listitem></varlistentry>
19488 <varlistentry>
19489 <term><varname>$prvscheck_address</varname></term>
19490 <listitem>
19491 <para>
19492 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
19493 which is described in sections <xref linkend="SECTexpansionitems"/> and
19494 <xref linkend="SECTverifyPRVS"/>.
19495 </para>
19496 </listitem></varlistentry>
19497 <varlistentry>
19498 <term><varname>$prvscheck_keynum</varname></term>
19499 <listitem>
19500 <para>
19501 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
19502 which is described in sections <xref linkend="SECTexpansionitems"/> and
19503 <xref linkend="SECTverifyPRVS"/>.
19504 </para>
19505 </listitem></varlistentry>
19506 <varlistentry>
19507 <term><varname>$prvscheck_result</varname></term>
19508 <listitem>
19509 <para>
19510 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
19511 which is described in sections <xref linkend="SECTexpansionitems"/> and
19512 <xref linkend="SECTverifyPRVS"/>.
19513 </para>
19514 </listitem></varlistentry>
19515 <varlistentry>
19516 <term><varname>$qualify_domain</varname></term>
19517 <listitem>
19518 <para>
19519 <indexterm role="variable">
19520 <primary><varname>$qualify_domain</varname></primary>
19521 </indexterm>
19522 The value set for the <option>qualify_domain</option> option in the configuration file.
19523 </para>
19524 </listitem></varlistentry>
19525 <varlistentry>
19526 <term><varname>$qualify_recipient</varname></term>
19527 <listitem>
19528 <para>
19529 <indexterm role="variable">
19530 <primary><varname>$qualify_recipient</varname></primary>
19531 </indexterm>
19532 The value set for the <option>qualify_recipient</option> option in the configuration file,
19533 or if not set, the value of <varname>$qualify_domain</varname>.
19534 </para>
19535 </listitem></varlistentry>
19536 <varlistentry>
19537 <term><varname>$queue_name</varname></term>
19538 <listitem>
19539 <para>
19540 <indexterm role="variable">
19541 <primary><varname>$queue_name</varname></primary>
19542 </indexterm>
19543 <indexterm role="concept">
19544 <primary>named queues</primary>
19545 </indexterm>
19546 <indexterm role="concept">
19547 <primary>queues</primary>
19548 <secondary>named</secondary>
19549 </indexterm>
19550 The name of the spool queue in use; empty for the default queue.
19551 </para>
19552 </listitem></varlistentry>
19553 <varlistentry>
19554 <term><varname>$rcpt_count</varname></term>
19555 <listitem>
19556 <para>
19557 <indexterm role="variable">
19558 <primary><varname>$rcpt_count</varname></primary>
19559 </indexterm>
19560 When a message is being received by SMTP, this variable contains the number of
19561 RCPT commands received for the current message. If this variable is used in a
19562 RCPT ACL, its value includes the current command.
19563 </para>
19564 </listitem></varlistentry>
19565 <varlistentry>
19566 <term><varname>$rcpt_defer_count</varname></term>
19567 <listitem>
19568 <para>
19569 <indexterm role="variable">
19570 <primary><varname>$rcpt_defer_count</varname></primary>
19571 </indexterm>
19572 <indexterm role="concept">
19573 <primary>4<emphasis>xx</emphasis> responses</primary>
19574 <secondary>count of</secondary>
19575 </indexterm>
19576 When a message is being received by SMTP, this variable contains the number of
19577 RCPT commands in the current message that have previously been rejected with a
19578 temporary (4<emphasis>xx</emphasis>) response.
19579 </para>
19580 </listitem></varlistentry>
19581 <varlistentry>
19582 <term><varname>$rcpt_fail_count</varname></term>
19583 <listitem>
19584 <para>
19585 <indexterm role="variable">
19586 <primary><varname>$rcpt_fail_count</varname></primary>
19587 </indexterm>
19588 When a message is being received by SMTP, this variable contains the number of
19589 RCPT commands in the current message that have previously been rejected with a
19590 permanent (5<emphasis>xx</emphasis>) response.
19591 </para>
19592 </listitem></varlistentry>
19593 <varlistentry>
19594 <term><varname>$received_count</varname></term>
19595 <listitem>
19596 <para>
19597 <indexterm role="variable">
19598 <primary><varname>$received_count</varname></primary>
19599 </indexterm>
19600 This variable contains the number of <emphasis>Received:</emphasis> header lines in the message,
19601 including the one added by Exim (so its value is always greater than zero). It
19602 is available in the DATA ACL, the non-SMTP ACL, and while routing and
19603 delivering.
19604 </para>
19605 </listitem></varlistentry>
19606 <varlistentry>
19607 <term><varname>$received_for</varname></term>
19608 <listitem>
19609 <para>
19610 <indexterm role="variable">
19611 <primary><varname>$received_for</varname></primary>
19612 </indexterm>
19613 If there is only a single recipient address in an incoming message, this
19614 variable contains that address when the <emphasis>Received:</emphasis> header line is being
19615 built. The value is copied after recipient rewriting has happened, but before
19616 the <function>local_scan()</function> function is run.
19617 </para>
19618 </listitem></varlistentry>
19619 <varlistentry>
19620 <term><varname>$received_ip_address</varname></term>
19621 <listitem>
19622 <para>
19623 <indexterm role="variable">
19624 <primary><varname>$received_ip_address</varname></primary>
19625 </indexterm>
19626 As soon as an Exim server starts processing an incoming TCP/IP connection, this
19627 variable is set to the address of the local IP interface, and <varname>$received_port</varname>
19628 is set to the local port number. (The remote IP address and port are in
19629 <varname>$sender_host_address</varname> and <varname>$sender_host_port</varname>.) When testing with <option>-bh</option>,
19630 the port value is -1 unless it has been set using the <option>-oMi</option> command line
19631 option.
19632 </para>
19633 <para>
19634 As well as being useful in ACLs (including the <quote>connect</quote> ACL), these variable
19635 could be used, for example, to make the filename for a TLS certificate depend
19636 on which interface and/or port is being used for the incoming connection. The
19637 values of <varname>$received_ip_address</varname> and <varname>$received_port</varname> are saved with any
19638 messages that are received, thus making these variables available at delivery
19639 time.
19640 For outbound connections see <varname>$sending_ip_address</varname>.
19641 </para>
19642 </listitem></varlistentry>
19643 <varlistentry>
19644 <term><varname>$received_port</varname></term>
19645 <listitem>
19646 <para>
19647 <indexterm role="variable">
19648 <primary><varname>$received_port</varname></primary>
19649 </indexterm>
19650 See <varname>$received_ip_address</varname>.
19651 </para>
19652 </listitem></varlistentry>
19653 <varlistentry>
19654 <term><varname>$received_protocol</varname></term>
19655 <listitem>
19656 <para>
19657 <indexterm role="variable">
19658 <primary><varname>$received_protocol</varname></primary>
19659 </indexterm>
19660 When a message is being processed, this variable contains the name of the
19661 protocol by which it was received. Most of the names used by Exim are defined
19662 by RFCs 821, 2821, and 3848. They start with <quote>smtp</quote> (the client used HELO) or
19663 <quote>esmtp</quote> (the client used EHLO). This can be followed by <quote>s</quote> for secure
19664 (encrypted) and/or <quote>a</quote> for authenticated. Thus, for example, if the protocol
19665 is set to <quote>esmtpsa</quote>, the message was received over an encrypted SMTP
19666 connection and the client was successfully authenticated.
19667 </para>
19668 <para>
19669 Exim uses the protocol name <quote>smtps</quote> for the case when encryption is
19670 automatically set up on connection without the use of STARTTLS (see
19671 <option>tls_on_connect_ports</option>), and the client uses HELO to initiate the
19672 encrypted SMTP session. The name <quote>smtps</quote> is also used for the rare situation
19673 where the client initially uses EHLO, sets up an encrypted connection using
19674 STARTTLS, and then uses HELO afterwards.
19675 </para>
19676 <para>
19677 The <option>-oMr</option> option provides a way of specifying a custom protocol name for
19678 messages that are injected locally by trusted callers. This is commonly used to
19679 identify messages that are being re-injected after some kind of scanning.
19680 </para>
19681 </listitem></varlistentry>
19682 <varlistentry>
19683 <term><varname>$received_time</varname></term>
19684 <listitem>
19685 <para>
19686 <indexterm role="variable">
19687 <primary><varname>$received_time</varname></primary>
19688 </indexterm>
19689 This variable contains the date and time when the current message was received,
19690 as a number of seconds since the start of the Unix epoch.
19691 </para>
19692 </listitem></varlistentry>
19693 <varlistentry>
19694 <term><varname>$recipient_data</varname></term>
19695 <listitem>
19696 <para>
19697 <indexterm role="variable">
19698 <primary><varname>$recipient_data</varname></primary>
19699 </indexterm>
19700 This variable is set after an indexing lookup success in an ACL <option>recipients</option>
19701 condition. It contains the data from the lookup, and the value remains set
19702 until the next <option>recipients</option> test. Thus, you can do things like this:
19703 </para>
19704 <literallayout>
19705 <literal>require recipients  = cdb*@;/some/file</literal>
19706 <literal>deny    </literal><emphasis>some further test involving</emphasis> <literal>$recipient_data</literal>
19707 </literallayout>
19708 <para>
19709 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
19710 method in the address list, using the semicolon syntax as in the example above.
19711 The variable is not set for a lookup that is used as part of the string
19712 expansion that all such lists undergo before being interpreted.
19713 </para>
19714 </listitem></varlistentry>
19715 <varlistentry>
19716 <term><varname>$recipient_verify_failure</varname></term>
19717 <listitem>
19718 <para>
19719 <indexterm role="variable">
19720 <primary><varname>$recipient_verify_failure</varname></primary>
19721 </indexterm>
19722 In an ACL, when a recipient verification fails, this variable contains
19723 information about the failure. It is set to one of the following words:
19724 </para>
19725 <itemizedlist>
19726 <listitem>
19727 <para>
19728 <quote>qualify</quote>: The address was unqualified (no domain), and the message
19729 was neither local nor came from an exempted host.
19730 </para>
19731 </listitem>
19732 <listitem>
19733 <para>
19734 <quote>route</quote>: Routing failed.
19735 </para>
19736 </listitem>
19737 <listitem>
19738 <para>
19739 <quote>mail</quote>: Routing succeeded, and a callout was attempted; rejection occurred at
19740 or before the MAIL command (that is, on initial connection, HELO, or
19741 MAIL).
19742 </para>
19743 </listitem>
19744 <listitem>
19745 <para>
19746 <quote>recipient</quote>: The RCPT command in a callout was rejected.
19747 </para>
19748 </listitem>
19749 <listitem>
19750 <para>
19751 <quote>postmaster</quote>: The postmaster check in a callout was rejected.
19752 </para>
19753 </listitem>
19754 </itemizedlist>
19755 <para>
19756 The main use of this variable is expected to be to distinguish between
19757 rejections of MAIL and rejections of RCPT.
19758 </para>
19759 </listitem></varlistentry>
19760 <varlistentry>
19761 <term><varname>$recipients</varname></term>
19762 <listitem>
19763 <para>
19764 <indexterm role="variable">
19765 <primary><varname>$recipients</varname></primary>
19766 </indexterm>
19767 This variable contains a list of envelope recipients for a message. A comma and
19768 a space separate the addresses in the replacement text. However, the variable
19769 is not generally available, to prevent exposure of Bcc recipients in
19770 unprivileged users&#x2019; filter files. You can use <varname>$recipients</varname> only in these
19771 cases:
19772 </para>
19773 <orderedlist numeration="arabic">
19774 <listitem>
19775 <para>
19776 In a system filter file.
19777 </para>
19778 </listitem>
19779 <listitem>
19780 <para>
19781 In the ACLs associated with the DATA command and with non-SMTP messages, that
19782 is, the ACLs defined by <option>acl_smtp_predata</option>, <option>acl_smtp_data</option>,
19783 <option>acl_smtp_mime</option>, <option>acl_not_smtp_start</option>, <option>acl_not_smtp</option>, and
19784 <option>acl_not_smtp_mime</option>.
19785 </para>
19786 </listitem>
19787 <listitem>
19788 <para>
19789 From within a <function>local_scan()</function> function.
19790 </para>
19791 </listitem>
19792 </orderedlist>
19793 </listitem></varlistentry>
19794 <varlistentry>
19795 <term><varname>$recipients_count</varname></term>
19796 <listitem>
19797 <para>
19798 <indexterm role="variable">
19799 <primary><varname>$recipients_count</varname></primary>
19800 </indexterm>
19801 When a message is being processed, this variable contains the number of
19802 envelope recipients that came with the message. Duplicates are not excluded
19803 from the count. While a message is being received over SMTP, the number
19804 increases for each accepted recipient. It can be referenced in an ACL.
19805 </para>
19806 </listitem></varlistentry>
19807 <varlistentry>
19808 <term><varname>$regex_match_string</varname></term>
19809 <listitem>
19810 <para>
19811 <indexterm role="variable">
19812 <primary><varname>$regex_match_string</varname></primary>
19813 </indexterm>
19814 This variable is set to contain the matching regular expression after a
19815 <option>regex</option> ACL condition has matched (see section <xref linkend="SECTscanregex"/>).
19816 </para>
19817 </listitem></varlistentry>
19818 <varlistentry>
19819 <term><varname>$regex1</varname>, <varname>$regex2</varname>, etc</term>
19820 <listitem>
19821 <para>
19822 <indexterm role="concept">
19823 <primary>regex submatch variables (<varname>$1regex</varname> <varname>$2regex</varname> etc)</primary>
19824 </indexterm>
19825 When a <option>regex</option> or <option>mime_regex</option> ACL condition succeeds,
19826 these variables contain the
19827 captured substrings identified by the regular expression.
19828 </para>
19829 </listitem></varlistentry>
19830 <varlistentry>
19831 <term><varname>$reply_address</varname></term>
19832 <listitem>
19833 <para>
19834 <indexterm role="variable">
19835 <primary><varname>$reply_address</varname></primary>
19836 </indexterm>
19837 When a message is being processed, this variable contains the contents of the
19838 <emphasis>Reply-To:</emphasis> header line if one exists and it is not empty, or otherwise the
19839 contents of the <emphasis>From:</emphasis> header line. Apart from the removal of leading
19840 white space, the value is not processed in any way. In particular, no RFC 2047
19841 decoding or character code translation takes place.
19842 </para>
19843 </listitem></varlistentry>
19844 <varlistentry>
19845 <term><varname>$return_path</varname></term>
19846 <listitem>
19847 <para>
19848 <indexterm role="variable">
19849 <primary><varname>$return_path</varname></primary>
19850 </indexterm>
19851 When a message is being delivered, this variable contains the return path &ndash;
19852 the sender field that will be sent as part of the envelope. It is not enclosed
19853 in &lt;&gt; characters. At the start of routing an address, <varname>$return_path</varname> has the
19854 same value as <varname>$sender_address</varname>, but if, for example, an incoming message to a
19855 mailing list has been expanded by a router which specifies a different address
19856 for bounce messages, <varname>$return_path</varname> subsequently contains the new bounce
19857 address, whereas <varname>$sender_address</varname> always contains the original sender address
19858 that was received with the message. In other words, <varname>$sender_address</varname> contains
19859 the incoming envelope sender, and <varname>$return_path</varname> contains the outgoing
19860 envelope sender.
19861 </para>
19862 </listitem></varlistentry>
19863 <varlistentry>
19864 <term><varname>$return_size_limit</varname></term>
19865 <listitem>
19866 <para>
19867 <indexterm role="variable">
19868 <primary><varname>$return_size_limit</varname></primary>
19869 </indexterm>
19870 This is an obsolete name for <varname>$bounce_return_size_limit</varname>.
19871 </para>
19872 </listitem></varlistentry>
19873 <varlistentry>
19874 <term><varname>$router_name</varname></term>
19875 <listitem>
19876 <para>
19877 <indexterm role="concept">
19878 <primary>router</primary>
19879 <secondary>name</secondary>
19880 </indexterm>
19881 <indexterm role="concept">
19882 <primary>name</primary>
19883 <secondary>of router</secondary>
19884 </indexterm>
19885 <indexterm role="variable">
19886 <primary><varname>$router_name</varname></primary>
19887 </indexterm>
19888 During the running of a router this variable contains its name.
19889 </para>
19890 </listitem></varlistentry>
19891 <varlistentry>
19892 <term><varname>$runrc</varname></term>
19893 <listitem>
19894 <para>
19895 <indexterm role="concept">
19896 <primary>return code</primary>
19897 <secondary>from <option>run</option> expansion</secondary>
19898 </indexterm>
19899 <indexterm role="variable">
19900 <primary><varname>$runrc</varname></primary>
19901 </indexterm>
19902 This variable contains the return code from a command that is run by the
19903 <option>${run...}</option> expansion item. <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot
19904 assume the order in which option values are expanded, except for those
19905 preconditions whose order of testing is documented. Therefore, you cannot
19906 reliably expect to set <varname>$runrc</varname> by the expansion of one option, and use it in
19907 another.
19908 </para>
19909 </listitem></varlistentry>
19910 <varlistentry>
19911 <term><varname>$self_hostname</varname></term>
19912 <listitem>
19913 <para>
19914 <indexterm role="option">
19915 <primary><option>self</option></primary>
19916 <secondary>value of host name</secondary>
19917 </indexterm>
19918 <indexterm role="variable">
19919 <primary><varname>$self_hostname</varname></primary>
19920 </indexterm>
19921 When an address is routed to a supposedly remote host that turns out to be the
19922 local host, what happens is controlled by the <option>self</option> generic router option.
19923 One of its values causes the address to be passed to another router. When this
19924 happens, <varname>$self_hostname</varname> is set to the name of the local host that the
19925 original router encountered. In other circumstances its contents are null.
19926 </para>
19927 </listitem></varlistentry>
19928 <varlistentry>
19929 <term><varname>$sender_address</varname></term>
19930 <listitem>
19931 <para>
19932 <indexterm role="variable">
19933 <primary><varname>$sender_address</varname></primary>
19934 </indexterm>
19935 When a message is being processed, this variable contains the sender&#x2019;s address
19936 that was received in the message&#x2019;s envelope. The case of letters in the address
19937 is retained, in both the local part and the domain. For bounce messages, the
19938 value of this variable is the empty string. See also <varname>$return_path</varname>.
19939 </para>
19940 </listitem></varlistentry>
19941 <varlistentry>
19942 <term><varname>$sender_address_data</varname></term>
19943 <listitem>
19944 <para>
19945 <indexterm role="variable">
19946 <primary><varname>$address_data</varname></primary>
19947 </indexterm>
19948 <indexterm role="variable">
19949 <primary><varname>$sender_address_data</varname></primary>
19950 </indexterm>
19951 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
19952 sender address, the final value is preserved in <varname>$sender_address_data</varname>, to
19953 distinguish it from data from a recipient address. The value does not persist
19954 after the end of the current ACL statement. If you want to preserve it for
19955 longer, you can save it in an ACL variable.
19956 </para>
19957 </listitem></varlistentry>
19958 <varlistentry>
19959 <term><varname>$sender_address_domain</varname></term>
19960 <listitem>
19961 <para>
19962 <indexterm role="variable">
19963 <primary><varname>$sender_address_domain</varname></primary>
19964 </indexterm>
19965 The domain portion of <varname>$sender_address</varname>.
19966 </para>
19967 </listitem></varlistentry>
19968 <varlistentry>
19969 <term><varname>$sender_address_local_part</varname></term>
19970 <listitem>
19971 <para>
19972 <indexterm role="variable">
19973 <primary><varname>$sender_address_local_part</varname></primary>
19974 </indexterm>
19975 The local part portion of <varname>$sender_address</varname>.
19976 </para>
19977 </listitem></varlistentry>
19978 <varlistentry>
19979 <term><varname>$sender_data</varname></term>
19980 <listitem>
19981 <para>
19982 <indexterm role="variable">
19983 <primary><varname>$sender_data</varname></primary>
19984 </indexterm>
19985 This variable is set after a lookup success in an ACL <option>senders</option> condition or
19986 in a router <option>senders</option> option. It contains the data from the lookup, and the
19987 value remains set until the next <option>senders</option> test. Thus, you can do things like
19988 this:
19989 </para>
19990 <literallayout>
19991 <literal>require senders      = cdb*@;/some/file</literal>
19992 <literal>deny    </literal><emphasis>some further test involving</emphasis> <literal>$sender_data</literal>
19993 </literallayout>
19994 <para>
19995 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
19996 method in the address list, using the semicolon syntax as in the example above.
19997 The variable is not set for a lookup that is used as part of the string
19998 expansion that all such lists undergo before being interpreted.
19999 </para>
20000 </listitem></varlistentry>
20001 <varlistentry>
20002 <term><varname>$sender_fullhost</varname></term>
20003 <listitem>
20004 <para>
20005 <indexterm role="variable">
20006 <primary><varname>$sender_fullhost</varname></primary>
20007 </indexterm>
20008 When a message is received from a remote host, this variable contains the host
20009 name and IP address in a single string. It ends with the IP address in square
20010 brackets, followed by a colon and a port number if the logging of ports is
20011 enabled. The format of the rest of the string depends on whether the host
20012 issued a HELO or EHLO SMTP command, and whether the host name was verified by
20013 looking up its IP address. (Looking up the IP address can be forced by the
20014 <option>host_lookup</option> option, independent of verification.) A plain host name at the
20015 start of the string is a verified host name; if this is not present,
20016 verification either failed or was not requested. A host name in parentheses is
20017 the argument of a HELO or EHLO command. This is omitted if it is identical to
20018 the verified host name or to the host&#x2019;s IP address in square brackets.
20019 </para>
20020 </listitem></varlistentry>
20021 <varlistentry>
20022 <term><varname>$sender_helo_dnssec</varname></term>
20023 <listitem>
20024 <para>
20025 <indexterm role="variable">
20026 <primary><varname>$sender_helo_dnssec</varname></primary>
20027 </indexterm>
20028 This boolean variable is true if a successful HELO verification was
20029 <indexterm role="concept">
20030 <primary>DNS</primary>
20031 <secondary>DNSSEC</secondary>
20032 </indexterm>
20033 done using DNS information the resolver library stated was authenticated data.
20034 </para>
20035 </listitem></varlistentry>
20036 <varlistentry>
20037 <term><varname>$sender_helo_name</varname></term>
20038 <listitem>
20039 <para>
20040 <indexterm role="variable">
20041 <primary><varname>$sender_helo_name</varname></primary>
20042 </indexterm>
20043 When a message is received from a remote host that has issued a HELO or EHLO
20044 command, the argument of that command is placed in this variable. It is also
20045 set if HELO or EHLO is used when a message is received using SMTP locally via
20046 the <option>-bs</option> or <option>-bS</option> options.
20047 </para>
20048 </listitem></varlistentry>
20049 <varlistentry>
20050 <term><varname>$sender_host_address</varname></term>
20051 <listitem>
20052 <para>
20053 <indexterm role="variable">
20054 <primary><varname>$sender_host_address</varname></primary>
20055 </indexterm>
20056 When a message is received from a remote host using SMTP,
20057 this variable contains that
20058 host&#x2019;s IP address. For locally non-SMTP submitted messages, it is empty.
20059 </para>
20060 </listitem></varlistentry>
20061 <varlistentry>
20062 <term><varname>$sender_host_authenticated</varname></term>
20063 <listitem>
20064 <para>
20065 <indexterm role="variable">
20066 <primary><varname>$sender_host_authenticated</varname></primary>
20067 </indexterm>
20068 This variable contains the name (not the public name) of the authenticator
20069 driver that successfully authenticated the client from which the message was
20070 received. It is empty if there was no successful authentication. See also
20071 <varname>$authenticated_id</varname>.
20072 </para>
20073 </listitem></varlistentry>
20074 <varlistentry>
20075 <term><varname>$sender_host_dnssec</varname></term>
20076 <listitem>
20077 <para>
20078 <indexterm role="variable">
20079 <primary><varname>$sender_host_dnssec</varname></primary>
20080 </indexterm>
20081 If an attempt to populate <varname>$sender_host_name</varname> has been made
20082 (by reference, <option>hosts_lookup</option> or
20083 otherwise) then this boolean will have been set true if, and only if, the
20084 resolver library states that both
20085 the reverse and forward DNS were authenticated data.  At all
20086 other times, this variable is false.
20087 </para>
20088 <para>
20089 <indexterm role="concept">
20090 <primary>DNS</primary>
20091 <secondary>DNSSEC</secondary>
20092 </indexterm>
20093 It is likely that you will need to coerce DNSSEC support on in the resolver
20094 library, by setting:
20095 </para>
20096 <literallayout class="monospaced">
20097 dns_dnssec_ok = 1
20098 </literallayout>
20099 <para>
20100 Exim does not perform DNSSEC validation itself, instead leaving that to a
20101 validating resolver (e.g. unbound, or bind with suitable configuration).
20102 </para>
20103 <para>
20104 If you have changed <option>host_lookup_order</option> so that <literal>bydns</literal> is not the first
20105 mechanism in the list, then this variable will be false.
20106 </para>
20107 <para>
20108 This requires that your system resolver library support EDNS0 (and that
20109 DNSSEC flags exist in the system headers).  If the resolver silently drops
20110 all EDNS0 options, then this will have no effect.  OpenBSD&#x2019;s asr resolver
20111 is known to currently ignore EDNS0, documented in CAVEATS of asr_run(3).
20112 </para>
20113 </listitem></varlistentry>
20114 <varlistentry>
20115 <term><varname>$sender_host_name</varname></term>
20116 <listitem>
20117 <para>
20118 <indexterm role="variable">
20119 <primary><varname>$sender_host_name</varname></primary>
20120 </indexterm>
20121 When a message is received from a remote host, this variable contains the
20122 host&#x2019;s name as obtained by looking up its IP address. For messages received by
20123 other means, this variable is empty.
20124 </para>
20125 <para>
20126 <indexterm role="variable">
20127 <primary><varname>$host_lookup_failed</varname></primary>
20128 </indexterm>
20129 If the host name has not previously been looked up, a reference to
20130 <varname>$sender_host_name</varname> triggers a lookup (for messages from remote hosts).
20131 A looked up name is accepted only if it leads back to the original IP address
20132 via a forward lookup. If either the reverse or the forward lookup fails to find
20133 any data, or if the forward lookup does not yield the original IP address,
20134 <varname>$sender_host_name</varname> remains empty, and <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
20135 </para>
20136 <para>
20137 <indexterm role="variable">
20138 <primary><varname>$host_lookup_deferred</varname></primary>
20139 </indexterm>
20140 However, if either of the lookups cannot be completed (for example, there is a
20141 DNS timeout), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>, and
20142 <varname>$host_lookup_failed</varname> remains set to <quote>0</quote>.
20143 </para>
20144 <para>
20145 Once <varname>$host_lookup_failed</varname> is set to <quote>1</quote>, Exim does not try to look up the
20146 host name again if there is a subsequent reference to <varname>$sender_host_name</varname>
20147 in the same Exim process, but it does try again if <varname>$host_lookup_deferred</varname>
20148 is set to <quote>1</quote>.
20149 </para>
20150 <para>
20151 Exim does not automatically look up every calling host&#x2019;s name. If you want
20152 maximum efficiency, you should arrange your configuration so that it avoids
20153 these lookups altogether. The lookup happens only if one or more of the
20154 following are true:
20155 </para>
20156 <itemizedlist>
20157 <listitem>
20158 <para>
20159 A string containing <varname>$sender_host_name</varname> is expanded.
20160 </para>
20161 </listitem>
20162 <listitem>
20163 <para>
20164 The calling host matches the list in <option>host_lookup</option>. In the default
20165 configuration, this option is set to *, so it must be changed if lookups are
20166 to be avoided. (In the code, the default for <option>host_lookup</option> is unset.)
20167 </para>
20168 </listitem>
20169 <listitem>
20170 <para>
20171 Exim needs the host name in order to test an item in a host list. The items
20172 that require this are described in sections <xref linkend="SECThoslispatnam"/> and
20173 <xref linkend="SECThoslispatnamsk"/>.
20174 </para>
20175 </listitem>
20176 <listitem>
20177 <para>
20178 The calling host matches <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>.
20179 In this case, the host name is required to compare with the name quoted in any
20180 EHLO or HELO commands that the client issues.
20181 </para>
20182 </listitem>
20183 <listitem>
20184 <para>
20185 The remote host issues a EHLO or HELO command that quotes one of the
20186 domains in <option>helo_lookup_domains</option>. The default value of this option is
20187 </para>
20188 <literallayout class="monospaced">
20189   helo_lookup_domains = @ : @[]
20190 </literallayout>
20191 <para>
20192 which causes a lookup if a remote host (incorrectly) gives the server&#x2019;s name or
20193 IP address in an EHLO or HELO command.
20194 </para>
20195 </listitem>
20196 </itemizedlist>
20197 </listitem></varlistentry>
20198 <varlistentry>
20199 <term><varname>$sender_host_port</varname></term>
20200 <listitem>
20201 <para>
20202 <indexterm role="variable">
20203 <primary><varname>$sender_host_port</varname></primary>
20204 </indexterm>
20205 When a message is received from a remote host, this variable contains the port
20206 number that was used on the remote host.
20207 </para>
20208 </listitem></varlistentry>
20209 <varlistentry>
20210 <term><varname>$sender_ident</varname></term>
20211 <listitem>
20212 <para>
20213 <indexterm role="variable">
20214 <primary><varname>$sender_ident</varname></primary>
20215 </indexterm>
20216 When a message is received from a remote host, this variable contains the
20217 identification received in response to an RFC 1413 request. When a message has
20218 been received locally, this variable contains the login name of the user that
20219 called Exim.
20220 </para>
20221 </listitem></varlistentry>
20222 <varlistentry>
20223 <term><varname>$sender_rate_</varname><emphasis>xxx</emphasis></term>
20224 <listitem>
20225 <para>
20226 A number of variables whose names begin <varname>$sender_rate_</varname> are set as part of the
20227 <option>ratelimit</option> ACL condition. Details are given in section
20228 <xref linkend="SECTratelimiting"/>.
20229 </para>
20230 </listitem></varlistentry>
20231 <varlistentry>
20232 <term><varname>$sender_rcvhost</varname></term>
20233 <listitem>
20234 <para>
20235 <indexterm role="concept">
20236 <primary>DNS</primary>
20237 <secondary>reverse lookup</secondary>
20238 </indexterm>
20239 <indexterm role="concept">
20240 <primary>reverse DNS lookup</primary>
20241 </indexterm>
20242 <indexterm role="variable">
20243 <primary><varname>$sender_rcvhost</varname></primary>
20244 </indexterm>
20245 This is provided specifically for use in <emphasis>Received:</emphasis> headers. It starts with
20246 either the verified host name (as obtained from a reverse DNS lookup) or, if
20247 there is no verified host name, the IP address in square brackets. After that
20248 there may be text in parentheses. When the first item is a verified host name,
20249 the first thing in the parentheses is the IP address in square brackets,
20250 followed by a colon and a port number if port logging is enabled. When the
20251 first item is an IP address, the port is recorded as <quote>port=<emphasis>xxxx</emphasis></quote> inside
20252 the parentheses.
20253 </para>
20254 <para>
20255 There may also be items of the form <quote>helo=<emphasis>xxxx</emphasis></quote> if HELO or EHLO
20256 was used and its argument was not identical to the real host name or IP
20257 address, and <quote>ident=<emphasis>xxxx</emphasis></quote> if an RFC 1413 ident string is available. If
20258 all three items are present in the parentheses, a newline and tab are inserted
20259 into the string, to improve the formatting of the <emphasis>Received:</emphasis> header.
20260 </para>
20261 </listitem></varlistentry>
20262 <varlistentry>
20263 <term><varname>$sender_verify_failure</varname></term>
20264 <listitem>
20265 <para>
20266 <indexterm role="variable">
20267 <primary><varname>$sender_verify_failure</varname></primary>
20268 </indexterm>
20269 In an ACL, when a sender verification fails, this variable contains information
20270 about the failure. The details are the same as for
20271 <varname>$recipient_verify_failure</varname>.
20272 </para>
20273 </listitem></varlistentry>
20274 <varlistentry>
20275 <term><varname>$sending_ip_address</varname></term>
20276 <listitem>
20277 <para>
20278 <indexterm role="variable">
20279 <primary><varname>$sending_ip_address</varname></primary>
20280 </indexterm>
20281 This variable is set whenever an outgoing SMTP connection to another host has
20282 been set up. It contains the IP address of the local interface that is being
20283 used. This is useful if a host that has more than one IP address wants to take
20284 on different personalities depending on which one is being used. For incoming
20285 connections, see <varname>$received_ip_address</varname>.
20286 </para>
20287 </listitem></varlistentry>
20288 <varlistentry>
20289 <term><varname>$sending_port</varname></term>
20290 <listitem>
20291 <para>
20292 <indexterm role="variable">
20293 <primary><varname>$sending_port</varname></primary>
20294 </indexterm>
20295 This variable is set whenever an outgoing SMTP connection to another host has
20296 been set up. It contains the local port that is being used. For incoming
20297 connections, see <varname>$received_port</varname>.
20298 </para>
20299 </listitem></varlistentry>
20300 <varlistentry>
20301 <term><varname>$smtp_active_hostname</varname></term>
20302 <listitem>
20303 <para>
20304 <indexterm role="variable">
20305 <primary><varname>$smtp_active_hostname</varname></primary>
20306 </indexterm>
20307 During an incoming SMTP session, this variable contains the value of the active
20308 host name, as specified by the <option>smtp_active_hostname</option> option. The value of
20309 <varname>$smtp_active_hostname</varname> is saved with any message that is received, so its
20310 value can be consulted during routing and delivery.
20311 </para>
20312 </listitem></varlistentry>
20313 <varlistentry>
20314 <term><varname>$smtp_command</varname></term>
20315 <listitem>
20316 <para>
20317 <indexterm role="variable">
20318 <primary><varname>$smtp_command</varname></primary>
20319 </indexterm>
20320 During the processing of an incoming SMTP command, this variable contains the
20321 entire command. This makes it possible to distinguish between HELO and EHLO in
20322 the HELO ACL, and also to distinguish between commands such as these:
20323 </para>
20324 <literallayout class="monospaced">
20325 MAIL FROM:&lt;&gt;
20326 MAIL FROM: &lt;&gt;
20327 </literallayout>
20328 <para>
20329 For a MAIL command, extra parameters such as SIZE can be inspected. For a RCPT
20330 command, the address in <varname>$smtp_command</varname> is the original address before any
20331 rewriting, whereas the values in <varname>$local_part</varname> and <varname>$domain</varname> are taken from
20332 the address after SMTP-time rewriting.
20333 </para>
20334 </listitem></varlistentry>
20335 <varlistentry>
20336 <term><varname>$smtp_command_argument</varname></term>
20337 <listitem>
20338 <para>
20339 <indexterm role="concept">
20340 <primary>SMTP</primary>
20341 <secondary>command, argument for</secondary>
20342 </indexterm>
20343 <indexterm role="variable">
20344 <primary><varname>$smtp_command_argument</varname></primary>
20345 </indexterm>
20346 While an ACL is running to check an SMTP command, this variable contains the
20347 argument, that is, the text that follows the command name, with leading white
20348 space removed. Following the introduction of <varname>$smtp_command</varname>, this variable is
20349 somewhat redundant, but is retained for backwards compatibility.
20350 </para>
20351 </listitem></varlistentry>
20352 <varlistentry>
20353 <term><varname>$smtp_command_history</varname></term>
20354 <listitem>
20355 <para>
20356 <indexterm role="concept">
20357 <primary>SMTP</primary>
20358 <secondary>command history</secondary>
20359 </indexterm>
20360 <indexterm role="variable">
20361 <primary><varname>$smtp_command_history</varname></primary>
20362 </indexterm>
20363 A comma-separated list (with no whitespace) of the most-recent SMTP commands
20364 received, in time-order left to right.  Only a limited number of commands
20365 are remembered.
20366 </para>
20367 </listitem></varlistentry>
20368 <varlistentry>
20369 <term><varname>$smtp_count_at_connection_start</varname></term>
20370 <listitem>
20371 <para>
20372 <indexterm role="variable">
20373 <primary><varname>$smtp_count_at_connection_start</varname></primary>
20374 </indexterm>
20375 This variable is set greater than zero only in processes spawned by the Exim
20376 daemon for handling incoming SMTP connections. The name is deliberately long,
20377 in order to emphasize what the contents are. When the daemon accepts a new
20378 connection, it increments this variable. A copy of the variable is passed to
20379 the child process that handles the connection, but its value is fixed, and
20380 never changes. It is only an approximation of how many incoming connections
20381 there actually are, because many other connections may come and go while a
20382 single connection is being processed. When a child process terminates, the
20383 daemon decrements its copy of the variable.
20384 </para>
20385 </listitem></varlistentry>
20386 <varlistentry>
20387 <term><varname>$sn0</varname> &ndash; <varname>$sn9</varname></term>
20388 <listitem>
20389 <para>
20390 These variables are copies of the values of the <varname>$n0</varname> &ndash; <varname>$n9</varname> accumulators
20391 that were current at the end of the system filter file. This allows a system
20392 filter file to set values that can be tested in users&#x2019; filter files. For
20393 example, a system filter could set a value indicating how likely it is that a
20394 message is junk mail.
20395 </para>
20396 </listitem></varlistentry>
20397 <varlistentry>
20398 <term><varname>$spam_</varname><emphasis>xxx</emphasis></term>
20399 <listitem>
20400 <para>
20401 A number of variables whose names start with <varname>$spam</varname> are available when Exim
20402 is compiled with the content-scanning extension. For details, see section
20403 <xref linkend="SECTscanspamass"/>.
20404 </para>
20405 </listitem></varlistentry>
20406 <varlistentry>
20407 <term><varname>$spf_header_comment</varname></term>
20408 <term><varname>$spf_received</varname></term>
20409 <term><varname>$spf_result</varname></term>
20410 <term><varname>$spf_result_guessed</varname></term>
20411 <term><varname>$spf_smtp_comment</varname></term>
20412 <listitem>
20413 <para>
20414 These variables are only available if Exim is built with SPF support.
20415 For details see section <xref linkend="SECSPF"/>.
20416 </para>
20417 </listitem></varlistentry>
20418 <varlistentry>
20419 <term><varname>$spool_directory</varname></term>
20420 <listitem>
20421 <para>
20422 <indexterm role="variable">
20423 <primary><varname>$spool_directory</varname></primary>
20424 </indexterm>
20425 The name of Exim&#x2019;s spool directory.
20426 </para>
20427 </listitem></varlistentry>
20428 <varlistentry>
20429 <term><varname>$spool_inodes</varname></term>
20430 <listitem>
20431 <para>
20432 <indexterm role="variable">
20433 <primary><varname>$spool_inodes</varname></primary>
20434 </indexterm>
20435 The number of free inodes in the disk partition where Exim&#x2019;s spool files are
20436 being written. The value is recalculated whenever the variable is referenced.
20437 If the relevant file system does not have the concept of inodes, the value of
20438 is -1. See also the <option>check_spool_inodes</option> option.
20439 </para>
20440 </listitem></varlistentry>
20441 <varlistentry>
20442 <term><varname>$spool_space</varname></term>
20443 <listitem>
20444 <para>
20445 <indexterm role="variable">
20446 <primary><varname>$spool_space</varname></primary>
20447 </indexterm>
20448 The amount of free space (as a number of kilobytes) in the disk partition where
20449 Exim&#x2019;s spool files are being written. The value is recalculated whenever the
20450 variable is referenced. If the operating system does not have the ability to
20451 find the amount of free space (only true for experimental systems), the space
20452 value is -1. For example, to check in an ACL that there is at least 50
20453 megabytes free on the spool, you could write:
20454 </para>
20455 <literallayout class="monospaced">
20456 condition = ${if &gt; {$spool_space}{50000}}
20457 </literallayout>
20458 <para>
20459 See also the <option>check_spool_space</option> option.
20460 </para>
20461 </listitem></varlistentry>
20462 <varlistentry>
20463 <term><varname>$thisaddress</varname></term>
20464 <listitem>
20465 <para>
20466 <indexterm role="variable">
20467 <primary><varname>$thisaddress</varname></primary>
20468 </indexterm>
20469 This variable is set only during the processing of the <option>foranyaddress</option>
20470 command in a filter file. Its use is explained in the description of that
20471 command, which can be found in the separate document entitled <emphasis>Exim&#x2019;s
20472 interfaces to mail filtering</emphasis>.
20473 </para>
20474 </listitem></varlistentry>
20475 <varlistentry>
20476 <term><varname>$tls_in_bits</varname></term>
20477 <listitem>
20478 <para>
20479 <indexterm role="variable">
20480 <primary><varname>$tls_in_bits</varname></primary>
20481 </indexterm>
20482 Contains an approximation of the TLS cipher&#x2019;s bit-strength
20483 on the inbound connection; the meaning of
20484 this depends upon the TLS implementation used.
20485 If TLS has not been negotiated, the value will be 0.
20486 The value of this is automatically fed into the Cyrus SASL authenticator
20487 when acting as a server, to specify the "external SSF" (a SASL term).
20488 </para>
20489 <para>
20490 The deprecated <varname>$tls_bits</varname> variable refers to the inbound side
20491 except when used in the context of an outbound SMTP delivery, when it refers to
20492 the outbound.
20493 </para>
20494 </listitem></varlistentry>
20495 <varlistentry>
20496 <term><varname>$tls_out_bits</varname></term>
20497 <listitem>
20498 <para>
20499 <indexterm role="variable">
20500 <primary><varname>$tls_out_bits</varname></primary>
20501 </indexterm>
20502 Contains an approximation of the TLS cipher&#x2019;s bit-strength
20503 on an outbound SMTP connection; the meaning of
20504 this depends upon the TLS implementation used.
20505 If TLS has not been negotiated, the value will be 0.
20506 </para>
20507 </listitem></varlistentry>
20508 <varlistentry>
20509 <term><varname>$tls_in_ourcert</varname></term>
20510 <listitem>
20511 <para>
20512 <indexterm role="variable">
20513 <primary><varname>$tls_in_ourcert</varname></primary>
20514 </indexterm>
20515 <indexterm role="concept">
20516 <primary>certificate</primary>
20517 <secondary>variables</secondary>
20518 </indexterm>
20519 This variable refers to the certificate presented to the peer of an
20520 inbound connection when the message was received.
20521 It is only useful as the argument of a
20522 <option>certextract</option> expansion item, <option>md5</option>, <option>sha1</option> or <option>sha256</option> operator,
20523 or a <option>def</option> condition.
20524 </para>
20525 <para>
20526 <emphasis role="bold">Note</emphasis>: Under versions of OpenSSL preceding 1.1.1,
20527 when a list of more than one
20528 file is used for <option>tls_certificate</option>, this variable is not reliable.
20529 </para>
20530 </listitem></varlistentry>
20531 <varlistentry>
20532 <term><varname>$tls_in_peercert</varname></term>
20533 <listitem>
20534 <para>
20535 <indexterm role="variable">
20536 <primary><varname>$tls_in_peercert</varname></primary>
20537 </indexterm>
20538 This variable refers to the certificate presented by the peer of an
20539 inbound connection when the message was received.
20540 It is only useful as the argument of a
20541 <option>certextract</option> expansion item, <option>md5</option>, <option>sha1</option> or <option>sha256</option> operator,
20542 or a <option>def</option> condition.
20543 If certificate verification fails it may refer to a failing chain element
20544 which is not the leaf.
20545 </para>
20546 </listitem></varlistentry>
20547 <varlistentry>
20548 <term><varname>$tls_out_ourcert</varname></term>
20549 <listitem>
20550 <para>
20551 <indexterm role="variable">
20552 <primary><varname>$tls_out_ourcert</varname></primary>
20553 </indexterm>
20554 This variable refers to the certificate presented to the peer of an
20555 outbound connection.  It is only useful as the argument of a
20556 <option>certextract</option> expansion item, <option>md5</option>, <option>sha1</option> or <option>sha256</option> operator,
20557 or a <option>def</option> condition.
20558 </para>
20559 </listitem></varlistentry>
20560 <varlistentry>
20561 <term><varname>$tls_out_peercert</varname></term>
20562 <listitem>
20563 <para>
20564 <indexterm role="variable">
20565 <primary><varname>$tls_out_peercert</varname></primary>
20566 </indexterm>
20567 This variable refers to the certificate presented by the peer of an
20568 outbound connection.  It is only useful as the argument of a
20569 <option>certextract</option> expansion item, <option>md5</option>, <option>sha1</option> or <option>sha256</option> operator,
20570 or a <option>def</option> condition.
20571 If certificate verification fails it may refer to a failing chain element
20572 which is not the leaf.
20573 </para>
20574 </listitem></varlistentry>
20575 <varlistentry>
20576 <term><varname>$tls_in_certificate_verified</varname></term>
20577 <listitem>
20578 <para>
20579 <indexterm role="variable">
20580 <primary><varname>$tls_in_certificate_verified</varname></primary>
20581 </indexterm>
20582 This variable is set to <quote>1</quote> if a TLS certificate was verified when the
20583 message was received, and <quote>0</quote> otherwise.
20584 </para>
20585 <para>
20586 The deprecated <varname>$tls_certificate_verified</varname> variable refers to the inbound side
20587 except when used in the context of an outbound SMTP delivery, when it refers to
20588 the outbound.
20589 </para>
20590 </listitem></varlistentry>
20591 <varlistentry>
20592 <term><varname>$tls_out_certificate_verified</varname></term>
20593 <listitem>
20594 <para>
20595 <indexterm role="variable">
20596 <primary><varname>$tls_out_certificate_verified</varname></primary>
20597 </indexterm>
20598 This variable is set to <quote>1</quote> if a TLS certificate was verified when an
20599 outbound SMTP connection was made,
20600 and <quote>0</quote> otherwise.
20601 </para>
20602 </listitem></varlistentry>
20603 <varlistentry>
20604 <term><varname>$tls_in_cipher</varname></term>
20605 <listitem>
20606 <para>
20607 <indexterm role="variable">
20608 <primary><varname>$tls_in_cipher</varname></primary>
20609 </indexterm>
20610 <indexterm role="variable">
20611 <primary><varname>$tls_cipher</varname></primary>
20612 </indexterm>
20613 When a message is received from a remote host over an encrypted SMTP
20614 connection, this variable is set to the cipher suite that was negotiated, for
20615 example DES-CBC3-SHA. In other circumstances, in particular, for message
20616 received over unencrypted connections, the variable is empty. Testing
20617 <varname>$tls_in_cipher</varname> for emptiness is one way of distinguishing between encrypted and
20618 non-encrypted connections during ACL processing.
20619 </para>
20620 <para>
20621 The deprecated <varname>$tls_cipher</varname> variable is the same as <varname>$tls_in_cipher</varname> during message reception,
20622 but in the context of an outward SMTP delivery taking place via the <command>smtp</command> transport
20623 becomes the same as <varname>$tls_out_cipher</varname>.
20624 </para>
20625 </listitem></varlistentry>
20626 <varlistentry>
20627 <term><varname>$tls_out_cipher</varname></term>
20628 <listitem>
20629 <para>
20630 <indexterm role="variable">
20631 <primary><varname>$tls_out_cipher</varname></primary>
20632 </indexterm>
20633 This variable is
20634 cleared before any outgoing SMTP connection is made,
20635 and then set to the outgoing cipher suite if one is negotiated. See chapter
20636 <xref linkend="CHAPTLS"/> for details of TLS support and chapter <xref linkend="CHAPsmtptrans"/> for
20637 details of the <command>smtp</command> transport.
20638 </para>
20639 </listitem></varlistentry>
20640 <varlistentry>
20641 <term><varname>$tls_out_dane</varname></term>
20642 <listitem>
20643 <para>
20644 <indexterm role="variable">
20645 <primary><varname>$tls_out_dane</varname></primary>
20646 </indexterm>
20647 DANE active status.  See section <xref linkend="SECDANE"/>.
20648 </para>
20649 </listitem></varlistentry>
20650 <varlistentry>
20651 <term><varname>$tls_in_ocsp</varname></term>
20652 <listitem>
20653 <para>
20654 <indexterm role="variable">
20655 <primary><varname>$tls_in_ocsp</varname></primary>
20656 </indexterm>
20657 When a message is received from a remote client connection
20658 the result of any OCSP request from the client is encoded in this variable:
20659 </para>
20660 <literallayout class="monospaced">
20661 0 OCSP proof was not requested (default value)
20662 1 No response to request
20663 2 Response not verified
20664 3 Verification failed
20665 4 Verification succeeded
20666 </literallayout>
20667 </listitem></varlistentry>
20668 <varlistentry>
20669 <term><varname>$tls_out_ocsp</varname></term>
20670 <listitem>
20671 <para>
20672 <indexterm role="variable">
20673 <primary><varname>$tls_out_ocsp</varname></primary>
20674 </indexterm>
20675 When a message is sent to a remote host connection
20676 the result of any OCSP request made is encoded in this variable.
20677 See <varname>$tls_in_ocsp</varname> for values.
20678 </para>
20679 </listitem></varlistentry>
20680 <varlistentry>
20681 <term><varname>$tls_in_peerdn</varname></term>
20682 <listitem>
20683 <para>
20684 <indexterm role="variable">
20685 <primary><varname>$tls_in_peerdn</varname></primary>
20686 </indexterm>
20687 <indexterm role="variable">
20688 <primary><varname>$tls_peerdn</varname></primary>
20689 </indexterm>
20690 <indexterm role="concept">
20691 <primary>certificate</primary>
20692 <secondary>extracting fields</secondary>
20693 </indexterm>
20694 When a message is received from a remote host over an encrypted SMTP
20695 connection, and Exim is configured to request a certificate from the client,
20696 the value of the Distinguished Name of the certificate is made available in the
20697 <varname>$tls_in_peerdn</varname> during subsequent processing.
20698 If certificate verification fails it may refer to a failing chain element
20699 which is not the leaf.
20700 </para>
20701 <para>
20702 The deprecated <varname>$tls_peerdn</varname> variable refers to the inbound side
20703 except when used in the context of an outbound SMTP delivery, when it refers to
20704 the outbound.
20705 </para>
20706 </listitem></varlistentry>
20707 <varlistentry>
20708 <term><varname>$tls_out_peerdn</varname></term>
20709 <listitem>
20710 <para>
20711 <indexterm role="variable">
20712 <primary><varname>$tls_out_peerdn</varname></primary>
20713 </indexterm>
20714 When a message is being delivered to a remote host over an encrypted SMTP
20715 connection, and Exim is configured to request a certificate from the server,
20716 the value of the Distinguished Name of the certificate is made available in the
20717 <varname>$tls_out_peerdn</varname> during subsequent processing.
20718 If certificate verification fails it may refer to a failing chain element
20719 which is not the leaf.
20720 </para>
20721 </listitem></varlistentry>
20722 <varlistentry>
20723 <term><varname>$tls_in_sni</varname></term>
20724 <listitem>
20725 <para>
20726 <indexterm role="variable">
20727 <primary><varname>$tls_in_sni</varname></primary>
20728 </indexterm>
20729 <indexterm role="variable">
20730 <primary><varname>$tls_sni</varname></primary>
20731 </indexterm>
20732 <indexterm role="concept">
20733 <primary>TLS</primary>
20734 <secondary>Server Name Indication</secondary>
20735 </indexterm>
20736 When a TLS session is being established, if the client sends the Server
20737 Name Indication extension, the value will be placed in this variable.
20738 If the variable appears in <option>tls_certificate</option> then this option and
20739 some others, described in <xref linkend="SECTtlssni"/>,
20740 will be re-expanded early in the TLS session, to permit
20741 a different certificate to be presented (and optionally a different key to be
20742 used) to the client, based upon the value of the SNI extension.
20743 </para>
20744 <para>
20745 The deprecated <varname>$tls_sni</varname> variable refers to the inbound side
20746 except when used in the context of an outbound SMTP delivery, when it refers to
20747 the outbound.
20748 </para>
20749 </listitem></varlistentry>
20750 <varlistentry>
20751 <term><varname>$tls_out_sni</varname></term>
20752 <listitem>
20753 <para>
20754 <indexterm role="variable">
20755 <primary><varname>$tls_out_sni</varname></primary>
20756 </indexterm>
20757 <indexterm role="concept">
20758 <primary>TLS</primary>
20759 <secondary>Server Name Indication</secondary>
20760 </indexterm>
20761 During outbound
20762 SMTP deliveries, this variable reflects the value of the <option>tls_sni</option> option on
20763 the transport.
20764 </para>
20765 </listitem></varlistentry>
20766 <varlistentry>
20767 <term><varname>$tls_out_tlsa_usage</varname></term>
20768 <listitem>
20769 <para>
20770 <indexterm role="variable">
20771 <primary><varname>$tls_out_tlsa_usage</varname></primary>
20772 </indexterm>
20773 Bitfield of TLSA record types found.  See section <xref linkend="SECDANE"/>.
20774 </para>
20775 </listitem></varlistentry>
20776 <varlistentry>
20777 <term><varname>$tod_bsdinbox</varname></term>
20778 <listitem>
20779 <para>
20780 <indexterm role="variable">
20781 <primary><varname>$tod_bsdinbox</varname></primary>
20782 </indexterm>
20783 The time of day and the date, in the format required for BSD-style mailbox
20784 files, for example: Thu Oct 17 17:14:09 1995.
20785 </para>
20786 </listitem></varlistentry>
20787 <varlistentry>
20788 <term><varname>$tod_epoch</varname></term>
20789 <listitem>
20790 <para>
20791 <indexterm role="variable">
20792 <primary><varname>$tod_epoch</varname></primary>
20793 </indexterm>
20794 The time and date as a number of seconds since the start of the Unix epoch.
20795 </para>
20796 </listitem></varlistentry>
20797 <varlistentry>
20798 <term><varname>$tod_epoch_l</varname></term>
20799 <listitem>
20800 <para>
20801 <indexterm role="variable">
20802 <primary><varname>$tod_epoch_l</varname></primary>
20803 </indexterm>
20804 The time and date as a number of microseconds since the start of the Unix epoch.
20805 </para>
20806 </listitem></varlistentry>
20807 <varlistentry>
20808 <term><varname>$tod_full</varname></term>
20809 <listitem>
20810 <para>
20811 <indexterm role="variable">
20812 <primary><varname>$tod_full</varname></primary>
20813 </indexterm>
20814 A full version of the time and date, for example: Wed, 16 Oct 1995 09:51:40
20815 +0100. The timezone is always given as a numerical offset from UTC, with
20816 positive values used for timezones that are ahead (east) of UTC, and negative
20817 values for those that are behind (west).
20818 </para>
20819 </listitem></varlistentry>
20820 <varlistentry>
20821 <term><varname>$tod_log</varname></term>
20822 <listitem>
20823 <para>
20824 <indexterm role="variable">
20825 <primary><varname>$tod_log</varname></primary>
20826 </indexterm>
20827 The time and date in the format used for writing Exim&#x2019;s log files, for example:
20828 1995-10-12 15:32:29, but without a timezone.
20829 </para>
20830 </listitem></varlistentry>
20831 <varlistentry>
20832 <term><varname>$tod_logfile</varname></term>
20833 <listitem>
20834 <para>
20835 <indexterm role="variable">
20836 <primary><varname>$tod_logfile</varname></primary>
20837 </indexterm>
20838 This variable contains the date in the format yyyymmdd. This is the format that
20839 is used for datestamping log files when <option>log_file_path</option> contains the <literal>%D</literal>
20840 flag.
20841 </para>
20842 </listitem></varlistentry>
20843 <varlistentry>
20844 <term><varname>$tod_zone</varname></term>
20845 <listitem>
20846 <para>
20847 <indexterm role="variable">
20848 <primary><varname>$tod_zone</varname></primary>
20849 </indexterm>
20850 This variable contains the numerical value of the local timezone, for example:
20851 -0500.
20852 </para>
20853 </listitem></varlistentry>
20854 <varlistentry>
20855 <term><varname>$tod_zulu</varname></term>
20856 <listitem>
20857 <para>
20858 <indexterm role="variable">
20859 <primary><varname>$tod_zulu</varname></primary>
20860 </indexterm>
20861 This variable contains the UTC date and time in <quote>Zulu</quote> format, as specified
20862 by ISO 8601, for example: 20030221154023Z.
20863 </para>
20864 </listitem></varlistentry>
20865 <varlistentry>
20866 <term><varname>$transport_name</varname></term>
20867 <listitem>
20868 <para>
20869 <indexterm role="concept">
20870 <primary>transport</primary>
20871 <secondary>name</secondary>
20872 </indexterm>
20873 <indexterm role="concept">
20874 <primary>name</primary>
20875 <secondary>of transport</secondary>
20876 </indexterm>
20877 <indexterm role="variable">
20878 <primary><varname>$transport_name</varname></primary>
20879 </indexterm>
20880 During the running of a transport, this variable contains its name.
20881 </para>
20882 </listitem></varlistentry>
20883 <varlistentry>
20884 <term><varname>$value</varname></term>
20885 <listitem>
20886 <para>
20887 <indexterm role="variable">
20888 <primary><varname>$value</varname></primary>
20889 </indexterm>
20890 This variable contains the result of an expansion lookup, extraction operation,
20891 or external command, as described above. It is also used during a
20892 <emphasis role="bold">reduce</emphasis> expansion.
20893 </para>
20894 </listitem></varlistentry>
20895 <varlistentry>
20896 <term><varname>$verify_mode</varname></term>
20897 <listitem>
20898 <para>
20899 <indexterm role="variable">
20900 <primary><varname>$verify_mode</varname></primary>
20901 </indexterm>
20902 While a router or transport is being run in verify mode or for cutthrough delivery,
20903 contains "S" for sender-verification or "R" for recipient-verification.
20904 Otherwise, empty.
20905 </para>
20906 </listitem></varlistentry>
20907 <varlistentry>
20908 <term><varname>$version_number</varname></term>
20909 <listitem>
20910 <para>
20911 <indexterm role="variable">
20912 <primary><varname>$version_number</varname></primary>
20913 </indexterm>
20914 The version number of Exim.
20915 </para>
20916 </listitem></varlistentry>
20917 <varlistentry>
20918 <term><varname>$warn_message_delay</varname></term>
20919 <listitem>
20920 <para>
20921 <indexterm role="variable">
20922 <primary><varname>$warn_message_delay</varname></primary>
20923 </indexterm>
20924 This variable is set only during the creation of a message warning about a
20925 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
20926 </para>
20927 </listitem></varlistentry>
20928 <varlistentry>
20929 <term><varname>$warn_message_recipients</varname></term>
20930 <listitem>
20931 <para>
20932 <indexterm role="variable">
20933 <primary><varname>$warn_message_recipients</varname></primary>
20934 </indexterm>
20935 This variable is set only during the creation of a message warning about a
20936 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
20937 </para>
20938 </listitem></varlistentry>
20939 </variablelist>
20940 <para>
20941 <indexterm role="concept" startref="IIDstrexp" class="endofrange"/>
20942 </para>
20943 </section>
20944 </chapter>
20945
20946 <chapter id="CHAPperl">
20947 <title>Embedded Perl</title>
20948 <para>
20949 <indexterm role="concept" id="IIDperl" class="startofrange">
20950 <primary>Perl</primary>
20951 <secondary>calling from Exim</secondary>
20952 </indexterm>
20953 Exim can be built to include an embedded Perl interpreter. When this is done,
20954 Perl subroutines can be called as part of the string expansion process. To make
20955 use of the Perl support, you need version 5.004 or later of Perl installed on
20956 your system. To include the embedded interpreter in the Exim binary, include
20957 the line
20958 </para>
20959 <literallayout class="monospaced">
20960 EXIM_PERL = perl.o
20961 </literallayout>
20962 <para>
20963 in your <filename>Local/Makefile</filename> and then build Exim in the normal way.
20964 </para>
20965 <section id="SECID85">
20966 <title>Setting up so Perl can be used</title>
20967 <para>
20968 <indexterm role="option">
20969 <primary><option>perl_startup</option></primary>
20970 </indexterm>
20971 Access to Perl subroutines is via a global configuration option called
20972 <option>perl_startup</option> and an expansion string operator <option>${perl ...}</option>. If there is
20973 no <option>perl_startup</option> option in the Exim configuration file then no Perl
20974 interpreter is started and there is almost no overhead for Exim (since none of
20975 the Perl library will be paged in unless used). If there is a <option>perl_startup</option>
20976 option then the associated value is taken to be Perl code which is executed in
20977 a newly created Perl interpreter.
20978 </para>
20979 <para>
20980 The value of <option>perl_startup</option> is not expanded in the Exim sense, so you do not
20981 need backslashes before any characters to escape special meanings. The option
20982 should usually be something like
20983 </para>
20984 <literallayout class="monospaced">
20985 perl_startup = do '/etc/exim.pl'
20986 </literallayout>
20987 <para>
20988 where <filename>/etc/exim.pl</filename> is Perl code which defines any subroutines you want to
20989 use from Exim. Exim can be configured either to start up a Perl interpreter as
20990 soon as it is entered, or to wait until the first time it is needed. Starting
20991 the interpreter at the beginning ensures that it is done while Exim still has
20992 its setuid privilege, but can impose an unnecessary overhead if Perl is not in
20993 fact used in a particular run. Also, note that this does not mean that Exim is
20994 necessarily running as root when Perl is called at a later time. By default,
20995 the interpreter is started only when it is needed, but this can be changed in
20996 two ways:
20997 </para>
20998 <itemizedlist>
20999 <listitem>
21000 <para>
21001 <indexterm role="option">
21002 <primary><option>perl_at_start</option></primary>
21003 </indexterm>
21004 Setting <option>perl_at_start</option> (a boolean option) in the configuration requests
21005 a startup when Exim is entered.
21006 </para>
21007 </listitem>
21008 <listitem>
21009 <para>
21010 The command line option <option>-ps</option> also requests a startup when Exim is entered,
21011 overriding the setting of <option>perl_at_start</option>.
21012 </para>
21013 </listitem>
21014 </itemizedlist>
21015 <para>
21016 There is also a command line option <option>-pd</option> (for delay) which suppresses the
21017 initial startup, even if <option>perl_at_start</option> is set.
21018 </para>
21019 <itemizedlist>
21020 <listitem>
21021 <para>
21022 <indexterm role="option">
21023 <primary><option>perl_taintmode</option></primary>
21024 </indexterm>
21025 <indexterm role="concept">
21026 <primary>Perl</primary>
21027 <secondary>taintmode</secondary>
21028 </indexterm>
21029 To provide more security executing Perl code via the embedded Perl
21030 interpreter, the <option>perl_taintmode</option> option can be set. This enables the
21031 taint mode of the Perl interpreter. You are encouraged to set this
21032 option to a true value. To avoid breaking existing installations, it
21033 defaults to false.
21034 </para>
21035 </listitem>
21036 </itemizedlist>
21037 </section>
21038 <section id="SECID86">
21039 <title>Calling Perl subroutines</title>
21040 <para>
21041 When the configuration file includes a <option>perl_startup</option> option you can make use
21042 of the string expansion item to call the Perl subroutines that are defined
21043 by the <option>perl_startup</option> code. The operator is used in any of the following
21044 forms:
21045 </para>
21046 <literallayout class="monospaced">
21047 ${perl{foo}}
21048 ${perl{foo}{argument}}
21049 ${perl{foo}{argument1}{argument2} ... }
21050 </literallayout>
21051 <para>
21052 which calls the subroutine <option>foo</option> with the given arguments. A maximum of eight
21053 arguments may be passed. Passing more than this results in an expansion failure
21054 with an error message of the form
21055 </para>
21056 <literallayout class="monospaced">
21057 Too many arguments passed to Perl subroutine "foo" (max is 8)
21058 </literallayout>
21059 <para>
21060 The return value of the Perl subroutine is evaluated in a scalar context before
21061 it is passed back to Exim to be inserted into the expanded string. If the
21062 return value is <emphasis>undef</emphasis>, the expansion is forced to fail in the same way as
21063 an explicit <quote>fail</quote> on an <option>if</option> or <option>lookup</option> item. If the subroutine aborts
21064 by obeying Perl&#x2019;s <option>die</option> function, the expansion fails with the error message
21065 that was passed to <option>die</option>.
21066 </para>
21067 </section>
21068 <section id="SECID87">
21069 <title>Calling Exim functions from Perl</title>
21070 <para>
21071 Within any Perl code called from Exim, the function <emphasis>Exim::expand_string()</emphasis>
21072 is available to call back into Exim&#x2019;s string expansion function. For example,
21073 the Perl code
21074 </para>
21075 <literallayout class="monospaced">
21076 my $lp = Exim::expand_string('$local_part');
21077 </literallayout>
21078 <para>
21079 makes the current Exim <varname>$local_part</varname> available in the Perl variable <varname>$lp</varname>.
21080 Note those are single quotes and not double quotes to protect against
21081 <varname>$local_part</varname> being interpolated as a Perl variable.
21082 </para>
21083 <para>
21084 If the string expansion is forced to fail by a <quote>fail</quote> item, the result of
21085 <emphasis>Exim::expand_string()</emphasis> is <option>undef</option>. If there is a syntax error in the
21086 expansion string, the Perl call from the original expansion string fails with
21087 an appropriate error message, in the same way as if <option>die</option> were used.
21088 </para>
21089 <para>
21090 <indexterm role="concept">
21091 <primary>debugging</primary>
21092 <secondary>from embedded Perl</secondary>
21093 </indexterm>
21094 <indexterm role="concept">
21095 <primary>log</primary>
21096 <secondary>writing from embedded Perl</secondary>
21097 </indexterm>
21098 Two other Exim functions are available for use from within Perl code.
21099 <emphasis>Exim::debug_write()</emphasis> writes a string to the standard error stream if Exim&#x2019;s
21100 debugging is enabled. If you want a newline at the end, you must supply it.
21101 <emphasis>Exim::log_write()</emphasis> writes a string to Exim&#x2019;s main log, adding a leading
21102 timestamp. In this case, you should not supply a terminating newline.
21103 </para>
21104 </section>
21105 <section id="SECID88">
21106 <title>Use of standard output and error by Perl</title>
21107 <para>
21108 <indexterm role="concept">
21109 <primary>Perl</primary>
21110 <secondary>standard output and error</secondary>
21111 </indexterm>
21112 You should not write to the standard error or output streams from within your
21113 Perl code, as it is not defined how these are set up. In versions of Exim
21114 before 4.50, it is possible for the standard output or error to refer to the
21115 SMTP connection during message reception via the daemon. Writing to this stream
21116 is certain to cause chaos. From Exim 4.50 onwards, the standard output and
21117 error streams are connected to <filename>/dev/null</filename> in the daemon. The chaos is
21118 avoided, but the output is lost.
21119 </para>
21120 <para>
21121 <indexterm role="concept">
21122 <primary>Perl</primary>
21123 <secondary>use of <option>warn</option></secondary>
21124 </indexterm>
21125 The Perl <option>warn</option> statement writes to the standard error stream by default.
21126 Calls to <option>warn</option> may be embedded in Perl modules that you use, but over which
21127 you have no control. When Exim starts up the Perl interpreter, it arranges for
21128 output from the <option>warn</option> statement to be written to the Exim main log. You can
21129 change this by including appropriate Perl magic somewhere in your Perl code.
21130 For example, to discard <option>warn</option> output completely, you need this:
21131 </para>
21132 <literallayout class="monospaced">
21133 $SIG{__WARN__} = sub { };
21134 </literallayout>
21135 <para>
21136 Whenever a <option>warn</option> is obeyed, the anonymous subroutine is called. In this
21137 example, the code for the subroutine is empty, so it does nothing, but you can
21138 include any Perl code that you like. The text of the <option>warn</option> message is passed
21139 as the first subroutine argument.
21140 <indexterm role="concept" startref="IIDperl" class="endofrange"/>
21141 </para>
21142 </section>
21143 </chapter>
21144
21145 <chapter id="CHAPinterfaces">
21146 <title>Starting the daemon and the use of network interfaces</title>
21147 <titleabbrev>Starting the daemon</titleabbrev>
21148 <para>
21149 <indexterm role="concept">
21150 <primary>daemon</primary>
21151 <secondary>starting</secondary>
21152 </indexterm>
21153 <indexterm role="concept">
21154 <primary>interface</primary>
21155 <secondary>listening</secondary>
21156 </indexterm>
21157 <indexterm role="concept">
21158 <primary>network interface</primary>
21159 </indexterm>
21160 <indexterm role="concept">
21161 <primary>interface</primary>
21162 <secondary>network</secondary>
21163 </indexterm>
21164 <indexterm role="concept">
21165 <primary>IP address</primary>
21166 <secondary>for listening</secondary>
21167 </indexterm>
21168 <indexterm role="concept">
21169 <primary>daemon</primary>
21170 <secondary>listening IP addresses</secondary>
21171 </indexterm>
21172 <indexterm role="concept">
21173 <primary>TCP/IP</primary>
21174 <secondary>setting listening interfaces</secondary>
21175 </indexterm>
21176 <indexterm role="concept">
21177 <primary>TCP/IP</primary>
21178 <secondary>setting listening ports</secondary>
21179 </indexterm>
21180 A host that is connected to a TCP/IP network may have one or more physical
21181 hardware network interfaces. Each of these interfaces may be configured as one
21182 or more <quote>logical</quote> interfaces, which are the entities that a program actually
21183 works with. Each of these logical interfaces is associated with an IP address.
21184 In addition, TCP/IP software supports <quote>loopback</quote> interfaces (127.0.0.1 in
21185 IPv4 and ::1 in IPv6), which do not use any physical hardware. Exim requires
21186 knowledge about the host&#x2019;s interfaces for use in three different circumstances:
21187 </para>
21188 <orderedlist numeration="arabic">
21189 <listitem>
21190 <para>
21191 When a listening daemon is started, Exim needs to know which interfaces
21192 and ports to listen on.
21193 </para>
21194 </listitem>
21195 <listitem>
21196 <para>
21197 When Exim is routing an address, it needs to know which IP addresses
21198 are associated with local interfaces. This is required for the correct
21199 processing of MX lists by removing the local host and others with the
21200 same or higher priority values. Also, Exim needs to detect cases
21201 when an address is routed to an IP address that in fact belongs to the
21202 local host. Unless the <option>self</option> router option or the <option>allow_localhost</option>
21203 option of the smtp transport is set (as appropriate), this is treated
21204 as an error situation.
21205 </para>
21206 </listitem>
21207 <listitem>
21208 <para>
21209 When Exim connects to a remote host, it may need to know which interface to use
21210 for the outgoing connection.
21211 </para>
21212 </listitem>
21213 </orderedlist>
21214 <para>
21215 Exim&#x2019;s default behaviour is likely to be appropriate in the vast majority
21216 of cases. If your host has only one interface, and you want all its IP
21217 addresses to be treated in the same way, and you are using only the
21218 standard SMTP port, you should not need to take any special action. The
21219 rest of this chapter does not apply to you.
21220 </para>
21221 <para>
21222 In a more complicated situation you may want to listen only on certain
21223 interfaces, or on different ports, and for this reason there are a number of
21224 options that can be used to influence Exim&#x2019;s behaviour. The rest of this
21225 chapter describes how they operate.
21226 </para>
21227 <para>
21228 When a message is received over TCP/IP, the interface and port that were
21229 actually used are set in <varname>$received_ip_address</varname> and <varname>$received_port</varname>.
21230 </para>
21231 <section id="SECID89">
21232 <title>Starting a listening daemon</title>
21233 <para>
21234 When a listening daemon is started (by means of the <option>-bd</option> command line
21235 option), the interfaces and ports on which it listens are controlled by the
21236 following options:
21237 </para>
21238 <itemizedlist>
21239 <listitem>
21240 <para>
21241 <option>daemon_smtp_ports</option> contains a list of default ports
21242 or service names.
21243 (For backward compatibility, this option can also be specified in the singular.)
21244 </para>
21245 </listitem>
21246 <listitem>
21247 <para>
21248 <option>local_interfaces</option> contains list of interface IP addresses on which to
21249 listen. Each item may optionally also specify a port.
21250 </para>
21251 </listitem>
21252 </itemizedlist>
21253 <para>
21254 The default list separator in both cases is a colon, but this can be changed as
21255 described in section <xref linkend="SECTlistsepchange"/>. When IPv6 addresses are involved,
21256 it is usually best to change the separator to avoid having to double all the
21257 colons. For example:
21258 </para>
21259 <literallayout class="monospaced">
21260 local_interfaces = &lt;; 127.0.0.1 ; \
21261                       192.168.23.65 ; \
21262                       ::1 ; \
21263                       3ffe:ffff:836f::fe86:a061
21264 </literallayout>
21265 <para>
21266 There are two different formats for specifying a port along with an IP address
21267 in <option>local_interfaces</option>:
21268 </para>
21269 <orderedlist numeration="arabic">
21270 <listitem>
21271 <para>
21272 The port is added onto the address with a dot separator. For example, to listen
21273 on port 1234 on two different IP addresses:
21274 </para>
21275 <literallayout class="monospaced">
21276 local_interfaces = &lt;; 192.168.23.65.1234 ; \
21277                       3ffe:ffff:836f::fe86:a061.1234
21278 </literallayout>
21279 </listitem>
21280 <listitem>
21281 <para>
21282 The IP address is enclosed in square brackets, and the port is added
21283 with a colon separator, for example:
21284 </para>
21285 <literallayout class="monospaced">
21286 local_interfaces = &lt;; [192.168.23.65]:1234 ; \
21287                       [3ffe:ffff:836f::fe86:a061]:1234
21288 </literallayout>
21289 </listitem>
21290 </orderedlist>
21291 <para>
21292 When a port is not specified, the value of <option>daemon_smtp_ports</option> is used. The
21293 default setting contains just one port:
21294 </para>
21295 <literallayout class="monospaced">
21296 daemon_smtp_ports = smtp
21297 </literallayout>
21298 <para>
21299 If more than one port is listed, each interface that does not have its own port
21300 specified listens on all of them. Ports that are listed in
21301 <option>daemon_smtp_ports</option> can be identified either by name (defined in
21302 <filename>/etc/services</filename>) or by number. However, when ports are given with individual
21303 IP addresses in <option>local_interfaces</option>, only numbers (not names) can be used.
21304 </para>
21305 </section>
21306 <section id="SECID90">
21307 <title>Special IP listening addresses</title>
21308 <para>
21309 The addresses 0.0.0.0 and ::0 are treated specially. They are interpreted
21310 as <quote>all IPv4 interfaces</quote> and <quote>all IPv6 interfaces</quote>, respectively. In each
21311 case, Exim tells the TCP/IP stack to <quote>listen on all IPv<emphasis>x</emphasis> interfaces</quote>
21312 instead of setting up separate listening sockets for each interface. The
21313 default value of <option>local_interfaces</option> is
21314 </para>
21315 <literallayout class="monospaced">
21316 local_interfaces = 0.0.0.0
21317 </literallayout>
21318 <para>
21319 when Exim is built without IPv6 support; otherwise it is:
21320 </para>
21321 <literallayout class="monospaced">
21322 local_interfaces = &lt;; ::0 ; 0.0.0.0
21323 </literallayout>
21324 <para>
21325 Thus, by default, Exim listens on all available interfaces, on the SMTP port.
21326 </para>
21327 </section>
21328 <section id="SECID91">
21329 <title>Overriding local_interfaces and daemon_smtp_ports</title>
21330 <para>
21331 The <option>-oX</option> command line option can be used to override the values of
21332 <option>daemon_smtp_ports</option> and/or <option>local_interfaces</option> for a particular daemon
21333 instance. Another way of doing this would be to use macros and the <option>-D</option>
21334 option. However, <option>-oX</option> can be used by any admin user, whereas modification of
21335 the runtime configuration by <option>-D</option> is allowed only when the caller is root or
21336 exim.
21337 </para>
21338 <para>
21339 The value of <option>-oX</option> is a list of items. The default colon separator can be
21340 changed in the usual way (<xref linkend="SECTlistsepchange"/>) if required.
21341 If there are any items that do not
21342 contain dots or colons (that is, are not IP addresses), the value of
21343 <option>daemon_smtp_ports</option> is replaced by the list of those items. If there are any
21344 items that do contain dots or colons, the value of <option>local_interfaces</option> is
21345 replaced by those items. Thus, for example,
21346 </para>
21347 <literallayout class="monospaced">
21348 -oX 1225
21349 </literallayout>
21350 <para>
21351 overrides <option>daemon_smtp_ports</option>, but leaves <option>local_interfaces</option> unchanged,
21352 whereas
21353 </para>
21354 <literallayout class="monospaced">
21355 -oX 192.168.34.5.1125
21356 </literallayout>
21357 <para>
21358 overrides <option>local_interfaces</option>, leaving <option>daemon_smtp_ports</option> unchanged.
21359 (However, since <option>local_interfaces</option> now contains no items without ports, the
21360 value of <option>daemon_smtp_ports</option> is no longer relevant in this example.)
21361 </para>
21362 </section>
21363 <section id="SECTsupobssmt">
21364 <title>Support for the submissions (aka SSMTP or SMTPS) protocol</title>
21365 <para>
21366 <indexterm role="concept">
21367 <primary>submissions protocol</primary>
21368 </indexterm>
21369 <indexterm role="concept">
21370 <primary>ssmtp protocol</primary>
21371 </indexterm>
21372 <indexterm role="concept">
21373 <primary>smtps protocol</primary>
21374 </indexterm>
21375 <indexterm role="concept">
21376 <primary>SMTP</primary>
21377 <secondary>ssmtp protocol</secondary>
21378 </indexterm>
21379 <indexterm role="concept">
21380 <primary>SMTP</primary>
21381 <secondary>smtps protocol</secondary>
21382 </indexterm>
21383 Exim supports the use of TLS-on-connect, used by mail clients in the
21384 <quote>submissions</quote> protocol, historically also known as SMTPS or SSMTP.
21385 For some years, IETF Standards Track documents only blessed the
21386 STARTTLS-based Submission service (port 587) while common practice was to support
21387 the same feature set on port 465, but using TLS-on-connect.
21388 If your installation needs to provide service to mail clients
21389 (Mail User Agents, MUAs) then you should provide service on both the 587 and
21390 the 465 TCP ports.
21391 </para>
21392 <para>
21393 If the <option>tls_on_connect_ports</option> option is set to a list of port numbers or
21394 service names, connections to those ports must first establish TLS, before
21395 proceeding to the application layer use of the SMTP protocol.
21396 </para>
21397 <para>
21398 The common use of this option is expected to be
21399 </para>
21400 <literallayout class="monospaced">
21401 tls_on_connect_ports = 465
21402 </literallayout>
21403 <para>
21404 per RFC 8314.
21405 There is also a command line option <option>-tls-on-connect</option>, which forces all ports
21406 to behave in this way when a daemon is started.
21407 </para>
21408 <para>
21409 <emphasis role="bold">Warning</emphasis>: Setting <option>tls_on_connect_ports</option> does not of itself cause the
21410 daemon to listen on those ports. You must still specify them in
21411 <option>daemon_smtp_ports</option>, <option>local_interfaces</option>, or the <option>-oX</option> option. (This is
21412 because <option>tls_on_connect_ports</option> applies to <option>inetd</option> connections as well as to
21413 connections via the daemon.)
21414 </para>
21415 </section>
21416 <section id="SECID92">
21417 <title>IPv6 address scopes</title>
21418 <para>
21419 <indexterm role="concept">
21420 <primary>IPv6</primary>
21421 <secondary>address scopes</secondary>
21422 </indexterm>
21423 IPv6 addresses have <quote>scopes</quote>, and a host with multiple hardware interfaces
21424 can, in principle, have the same link-local IPv6 address on different
21425 interfaces. Thus, additional information is needed, over and above the IP
21426 address, to distinguish individual interfaces. A convention of using a
21427 percent sign followed by something (often the interface name) has been
21428 adopted in some cases, leading to addresses like this:
21429 </para>
21430 <literallayout class="monospaced">
21431 fe80::202:b3ff:fe03:45c1%eth0
21432 </literallayout>
21433 <para>
21434 To accommodate this usage, a percent sign followed by an arbitrary string is
21435 allowed at the end of an IPv6 address. By default, Exim calls <function>getaddrinfo()</function>
21436 to convert a textual IPv6 address for actual use. This function recognizes the
21437 percent convention in operating systems that support it, and it processes the
21438 address appropriately. Unfortunately, some older libraries have problems with
21439 <function>getaddrinfo()</function>. If
21440 </para>
21441 <literallayout class="monospaced">
21442 IPV6_USE_INET_PTON=yes
21443 </literallayout>
21444 <para>
21445 is set in <filename>Local/Makefile</filename> (or an OS-dependent Makefile) when Exim is built,
21446 Exim uses <emphasis>inet_pton()</emphasis> to convert a textual IPv6 address for actual use,
21447 instead of <function>getaddrinfo()</function>. (Before version 4.14, it always used this
21448 function.) Of course, this means that the additional functionality of
21449 <function>getaddrinfo()</function> &ndash; recognizing scoped addresses &ndash; is lost.
21450 </para>
21451 </section>
21452 <section id="SECID93">
21453 <title>Disabling IPv6</title>
21454 <para>
21455 <indexterm role="concept">
21456 <primary>IPv6</primary>
21457 <secondary>disabling</secondary>
21458 </indexterm>
21459 Sometimes it happens that an Exim binary that was compiled with IPv6 support is
21460 run on a host whose kernel does not support IPv6. The binary will fall back to
21461 using IPv4, but it may waste resources looking up AAAA records, and trying to
21462 connect to IPv6 addresses, causing delays to mail delivery. If you set the
21463 <indexterm role="option">
21464 <primary><option>disable_ipv6</option></primary>
21465 </indexterm>
21466 <option>disable_ipv6</option> option true, even if the Exim binary has IPv6 support, no IPv6
21467 activities take place. AAAA records are never looked up, and any IPv6 addresses
21468 that are listed in <option>local_interfaces</option>, data for the <command>manualroute</command> router,
21469 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
21470 to handle IPv6 literal addresses.
21471 </para>
21472 <para>
21473 On the other hand, when IPv6 is in use, there may be times when you want to
21474 disable it for certain hosts or domains. You can use the <option>dns_ipv4_lookup</option>
21475 option to globally suppress the lookup of AAAA records for specified domains,
21476 and you can use the <option>ignore_target_hosts</option> generic router option to ignore
21477 IPv6 addresses in an individual router.
21478 </para>
21479 </section>
21480 <section id="SECID94">
21481 <title>Examples of starting a listening daemon</title>
21482 <para>
21483 The default case in an IPv6 environment is
21484 </para>
21485 <literallayout class="monospaced">
21486 daemon_smtp_ports = smtp
21487 local_interfaces = &lt;; ::0 ; 0.0.0.0
21488 </literallayout>
21489 <para>
21490 This specifies listening on the smtp port on all IPv6 and IPv4 interfaces.
21491 Either one or two sockets may be used, depending on the characteristics of
21492 the TCP/IP stack. (This is complicated and messy; for more information,
21493 read the comments in the <filename>daemon.c</filename> source file.)
21494 </para>
21495 <para>
21496 To specify listening on ports 25 and 26 on all interfaces:
21497 </para>
21498 <literallayout class="monospaced">
21499 daemon_smtp_ports = 25 : 26
21500 </literallayout>
21501 <para>
21502 (leaving <option>local_interfaces</option> at the default setting) or, more explicitly:
21503 </para>
21504 <literallayout class="monospaced">
21505 local_interfaces = &lt;; ::0.25     ; ::0.26 \
21506                       0.0.0.0.25 ; 0.0.0.0.26
21507 </literallayout>
21508 <para>
21509 To listen on the default port on all IPv4 interfaces, and on port 26 on the
21510 IPv4 loopback address only:
21511 </para>
21512 <literallayout class="monospaced">
21513 local_interfaces = 0.0.0.0 : 127.0.0.1.26
21514 </literallayout>
21515 <para>
21516 To specify listening on the default port on specific interfaces only:
21517 </para>
21518 <literallayout class="monospaced">
21519 local_interfaces = 10.0.0.67 : 192.168.34.67
21520 </literallayout>
21521 <para>
21522 <emphasis role="bold">Warning</emphasis>: Such a setting excludes listening on the loopback interfaces.
21523 </para>
21524 </section>
21525 <section id="SECTreclocipadd">
21526 <title>Recognizing the local host</title>
21527 <para>
21528 The <option>local_interfaces</option> option is also used when Exim needs to determine
21529 whether or not an IP address refers to the local host. That is, the IP
21530 addresses of all the interfaces on which a daemon is listening are always
21531 treated as local.
21532 </para>
21533 <para>
21534 For this usage, port numbers in <option>local_interfaces</option> are ignored. If either of
21535 the items 0.0.0.0 or ::0 are encountered, Exim gets a complete list of
21536 available interfaces from the operating system, and extracts the relevant
21537 (that is, IPv4 or IPv6) addresses to use for checking.
21538 </para>
21539 <para>
21540 Some systems set up large numbers of virtual interfaces in order to provide
21541 many virtual web servers. In this situation, you may want to listen for
21542 email on only a few of the available interfaces, but nevertheless treat all
21543 interfaces as local when routing. You can do this by setting
21544 <option>extra_local_interfaces</option> to a list of IP addresses, possibly including the
21545 <quote>all</quote> wildcard values. These addresses are recognized as local, but are not
21546 used for listening. Consider this example:
21547 </para>
21548 <literallayout class="monospaced">
21549 local_interfaces = &lt;; 127.0.0.1 ; ::1 ; \
21550                       192.168.53.235 ; \
21551                       3ffe:2101:12:1:a00:20ff:fe86:a061
21552
21553 extra_local_interfaces = &lt;; ::0 ; 0.0.0.0
21554 </literallayout>
21555 <para>
21556 The daemon listens on the loopback interfaces and just one IPv4 and one IPv6
21557 address, but all available interface addresses are treated as local when
21558 Exim is routing.
21559 </para>
21560 <para>
21561 In some environments the local host name may be in an MX list, but with an IP
21562 address that is not assigned to any local interface. In other cases it may be
21563 desirable to treat other host names as if they referred to the local host. Both
21564 these cases can be handled by setting the <option>hosts_treat_as_local</option> option.
21565 This contains host names rather than IP addresses. When a host is referenced
21566 during routing, either via an MX record or directly, it is treated as the local
21567 host if its name matches <option>hosts_treat_as_local</option>, or if any of its IP
21568 addresses match <option>local_interfaces</option> or <option>extra_local_interfaces</option>.
21569 </para>
21570 </section>
21571 <section id="SECID95">
21572 <title>Delivering to a remote host</title>
21573 <para>
21574 Delivery to a remote host is handled by the smtp transport. By default, it
21575 allows the system&#x2019;s TCP/IP functions to choose which interface to use (if
21576 there is more than one) when connecting to a remote host. However, the
21577 <option>interface</option> option can be set to specify which interface is used. See the
21578 description of the smtp transport in chapter <xref linkend="CHAPsmtptrans"/> for more
21579 details.
21580 </para>
21581 </section>
21582 </chapter>
21583
21584 <chapter id="CHAPmainconfig">
21585 <title>Main configuration</title>
21586 <para>
21587 <indexterm role="concept" id="IIDconfima" class="startofrange">
21588 <primary>configuration file</primary>
21589 <secondary>main section</secondary>
21590 </indexterm>
21591 <indexterm role="concept" id="IIDmaiconf" class="startofrange">
21592 <primary>main configuration</primary>
21593 </indexterm>
21594 The first part of the runtime configuration file contains three types of item:
21595 </para>
21596 <itemizedlist>
21597 <listitem>
21598 <para>
21599 Macro definitions: These lines start with an upper case letter. See section
21600 <xref linkend="SECTmacrodefs"/> for details of macro processing.
21601 </para>
21602 </listitem>
21603 <listitem>
21604 <para>
21605 Named list definitions: These lines start with one of the words <quote>domainlist</quote>,
21606 <quote>hostlist</quote>, <quote>addresslist</quote>, or <quote>localpartlist</quote>. Their use is described in
21607 section <xref linkend="SECTnamedlists"/>.
21608 </para>
21609 </listitem>
21610 <listitem>
21611 <para>
21612 Main configuration settings: Each setting occupies one line of the file
21613 (with possible continuations). If any setting is preceded by the word
21614 <quote>hide</quote>, the <option>-bP</option> command line option displays its value to admin users
21615 only. See section <xref linkend="SECTcos"/> for a description of the syntax of these option
21616 settings.
21617 </para>
21618 </listitem>
21619 </itemizedlist>
21620 <para>
21621 This chapter specifies all the main configuration options, along with their
21622 types and default values. For ease of finding a particular option, they appear
21623 in alphabetical order in section <xref linkend="SECTalomo"/> below. However, because there
21624 are now so many options, they are first listed briefly in functional groups, as
21625 an aid to finding the name of the option you are looking for. Some options are
21626 listed in more than one group.
21627 </para>
21628 <section id="SECID96">
21629 <title>Miscellaneous</title>
21630 <informaltable frame="none">
21631 <tgroup cols="2" colsep="0" rowsep="0">
21632 <colspec colwidth="196pt" align="left"/>
21633 <colspec colwidth="254pt" align="left"/>
21634 <tbody>
21635 <row>
21636 <entry><option>bi_command</option></entry>
21637 <entry>to run for <option>-bi</option> command line option</entry>
21638 </row>
21639 <row>
21640 <entry><option>debug_store</option></entry>
21641 <entry>do extra internal checks</entry>
21642 </row>
21643 <row>
21644 <entry><option>disable_ipv6</option></entry>
21645 <entry>do no IPv6 processing</entry>
21646 </row>
21647 <row>
21648 <entry><option>keep_malformed</option></entry>
21649 <entry>for broken files &ndash; should not happen</entry>
21650 </row>
21651 <row>
21652 <entry><option>localhost_number</option></entry>
21653 <entry>for unique message ids in clusters</entry>
21654 </row>
21655 <row>
21656 <entry><option>message_body_newlines</option></entry>
21657 <entry>retain newlines in <varname>$message_body</varname></entry>
21658 </row>
21659 <row>
21660 <entry><option>message_body_visible</option></entry>
21661 <entry>how much to show in <varname>$message_body</varname></entry>
21662 </row>
21663 <row>
21664 <entry><option>mua_wrapper</option></entry>
21665 <entry>run in <quote>MUA wrapper</quote> mode</entry>
21666 </row>
21667 <row>
21668 <entry><option>print_topbitchars</option></entry>
21669 <entry>top-bit characters are printing</entry>
21670 </row>
21671 <row>
21672 <entry><option>spool_wireformat</option></entry>
21673 <entry>use wire-format spool data files when possible</entry>
21674 </row>
21675 <row>
21676 <entry><option>timezone</option></entry>
21677 <entry>force time zone</entry>
21678 </row>
21679 </tbody>
21680 </tgroup>
21681 </informaltable>
21682 </section>
21683 <section id="SECID97">
21684 <title>Exim parameters</title>
21685 <informaltable frame="none">
21686 <tgroup cols="2" colsep="0" rowsep="0">
21687 <colspec colwidth="196pt" align="left"/>
21688 <colspec colwidth="254pt" align="left"/>
21689 <tbody>
21690 <row>
21691 <entry><option>exim_group</option></entry>
21692 <entry>override compiled-in value</entry>
21693 </row>
21694 <row>
21695 <entry><option>exim_path</option></entry>
21696 <entry>override compiled-in value</entry>
21697 </row>
21698 <row>
21699 <entry><option>exim_user</option></entry>
21700 <entry>override compiled-in value</entry>
21701 </row>
21702 <row>
21703 <entry><option>primary_hostname</option></entry>
21704 <entry>default from <function>uname()</function></entry>
21705 </row>
21706 <row>
21707 <entry><option>split_spool_directory</option></entry>
21708 <entry>use multiple directories</entry>
21709 </row>
21710 <row>
21711 <entry><option>spool_directory</option></entry>
21712 <entry>override compiled-in value</entry>
21713 </row>
21714 </tbody>
21715 </tgroup>
21716 </informaltable>
21717 </section>
21718 <section id="SECID98">
21719 <title>Privilege controls</title>
21720 <informaltable frame="none">
21721 <tgroup cols="2" colsep="0" rowsep="0">
21722 <colspec colwidth="196pt" align="left"/>
21723 <colspec colwidth="254pt" align="left"/>
21724 <tbody>
21725 <row>
21726 <entry><option>admin_groups</option></entry>
21727 <entry>groups that are Exim admin users</entry>
21728 </row>
21729 <row>
21730 <entry><option>commandline_checks_require_admin</option></entry>
21731 <entry>require admin for various checks</entry>
21732 </row>
21733 <row>
21734 <entry><option>deliver_drop_privilege</option></entry>
21735 <entry>drop root for delivery processes</entry>
21736 </row>
21737 <row>
21738 <entry><option>local_from_check</option></entry>
21739 <entry>insert <emphasis>Sender:</emphasis> if necessary</entry>
21740 </row>
21741 <row>
21742 <entry><option>local_from_prefix</option></entry>
21743 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
21744 </row>
21745 <row>
21746 <entry><option>local_from_suffix</option></entry>
21747 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
21748 </row>
21749 <row>
21750 <entry><option>local_sender_retain</option></entry>
21751 <entry>keep <emphasis>Sender:</emphasis> from untrusted user</entry>
21752 </row>
21753 <row>
21754 <entry><option>never_users</option></entry>
21755 <entry>do not run deliveries as these</entry>
21756 </row>
21757 <row>
21758 <entry><option>prod_requires_admin</option></entry>
21759 <entry>forced delivery requires admin user</entry>
21760 </row>
21761 <row>
21762 <entry><option>queue_list_requires_admin</option></entry>
21763 <entry>queue listing requires admin user</entry>
21764 </row>
21765 <row>
21766 <entry><option>trusted_groups</option></entry>
21767 <entry>groups that are trusted</entry>
21768 </row>
21769 <row>
21770 <entry><option>trusted_users</option></entry>
21771 <entry>users that are trusted</entry>
21772 </row>
21773 </tbody>
21774 </tgroup>
21775 </informaltable>
21776 </section>
21777 <section id="SECID99">
21778 <title>Logging</title>
21779 <informaltable frame="none">
21780 <tgroup cols="2" colsep="0" rowsep="0">
21781 <colspec colwidth="196pt" align="left"/>
21782 <colspec colwidth="254pt" align="left"/>
21783 <tbody>
21784 <row>
21785 <entry><option>event_action</option></entry>
21786 <entry>custom logging</entry>
21787 </row>
21788 <row>
21789 <entry><option>hosts_connection_nolog</option></entry>
21790 <entry>exemption from connect logging</entry>
21791 </row>
21792 <row>
21793 <entry><option>log_file_path</option></entry>
21794 <entry>override compiled-in value</entry>
21795 </row>
21796 <row>
21797 <entry><option>log_selector</option></entry>
21798 <entry>set/unset optional logging</entry>
21799 </row>
21800 <row>
21801 <entry><option>log_timezone</option></entry>
21802 <entry>add timezone to log lines</entry>
21803 </row>
21804 <row>
21805 <entry><option>message_logs</option></entry>
21806 <entry>create per-message logs</entry>
21807 </row>
21808 <row>
21809 <entry><option>preserve_message_logs</option></entry>
21810 <entry>after message completion</entry>
21811 </row>
21812 <row>
21813 <entry><option>process_log_path</option></entry>
21814 <entry>for SIGUSR1 and <emphasis>exiwhat</emphasis></entry>
21815 </row>
21816 <row>
21817 <entry><option>slow_lookup_log</option></entry>
21818 <entry>control logging of slow DNS lookups</entry>
21819 </row>
21820 <row>
21821 <entry><option>syslog_duplication</option></entry>
21822 <entry>controls duplicate log lines on syslog</entry>
21823 </row>
21824 <row>
21825 <entry><option>syslog_facility</option></entry>
21826 <entry>set syslog <quote>facility</quote> field</entry>
21827 </row>
21828 <row>
21829 <entry><option>syslog_pid</option></entry>
21830 <entry>pid in syslog lines</entry>
21831 </row>
21832 <row>
21833 <entry><option>syslog_processname</option></entry>
21834 <entry>set syslog <quote>ident</quote> field</entry>
21835 </row>
21836 <row>
21837 <entry><option>syslog_timestamp</option></entry>
21838 <entry>timestamp syslog lines</entry>
21839 </row>
21840 <row>
21841 <entry><option>write_rejectlog</option></entry>
21842 <entry>control use of message log</entry>
21843 </row>
21844 </tbody>
21845 </tgroup>
21846 </informaltable>
21847 </section>
21848 <section id="SECID100">
21849 <title>Frozen messages</title>
21850 <informaltable frame="none">
21851 <tgroup cols="2" colsep="0" rowsep="0">
21852 <colspec colwidth="196pt" align="left"/>
21853 <colspec colwidth="254pt" align="left"/>
21854 <tbody>
21855 <row>
21856 <entry><option>auto_thaw</option></entry>
21857 <entry>sets time for retrying frozen messages</entry>
21858 </row>
21859 <row>
21860 <entry><option>freeze_tell</option></entry>
21861 <entry>send message when freezing</entry>
21862 </row>
21863 <row>
21864 <entry><option>move_frozen_messages</option></entry>
21865 <entry>to another directory</entry>
21866 </row>
21867 <row>
21868 <entry><option>timeout_frozen_after</option></entry>
21869 <entry>keep frozen messages only so long</entry>
21870 </row>
21871 </tbody>
21872 </tgroup>
21873 </informaltable>
21874 </section>
21875 <section id="SECID101">
21876 <title>Data lookups</title>
21877 <informaltable frame="none">
21878 <tgroup cols="2" colsep="0" rowsep="0">
21879 <colspec colwidth="196pt" align="left"/>
21880 <colspec colwidth="254pt" align="left"/>
21881 <tbody>
21882 <row>
21883 <entry><option>ibase_servers</option></entry>
21884 <entry>InterBase servers</entry>
21885 </row>
21886 <row>
21887 <entry><option>ldap_ca_cert_dir</option></entry>
21888 <entry>dir of CA certs to verify LDAP server&#x2019;s</entry>
21889 </row>
21890 <row>
21891 <entry><option>ldap_ca_cert_file</option></entry>
21892 <entry>file of CA certs to verify LDAP server&#x2019;s</entry>
21893 </row>
21894 <row>
21895 <entry><option>ldap_cert_file</option></entry>
21896 <entry>client cert file for LDAP</entry>
21897 </row>
21898 <row>
21899 <entry><option>ldap_cert_key</option></entry>
21900 <entry>client key file for LDAP</entry>
21901 </row>
21902 <row>
21903 <entry><option>ldap_cipher_suite</option></entry>
21904 <entry>TLS negotiation preference control</entry>
21905 </row>
21906 <row>
21907 <entry><option>ldap_default_servers</option></entry>
21908 <entry>used if no server in query</entry>
21909 </row>
21910 <row>
21911 <entry><option>ldap_require_cert</option></entry>
21912 <entry>action to take without LDAP server cert</entry>
21913 </row>
21914 <row>
21915 <entry><option>ldap_start_tls</option></entry>
21916 <entry>require TLS within LDAP</entry>
21917 </row>
21918 <row>
21919 <entry><option>ldap_version</option></entry>
21920 <entry>set protocol version</entry>
21921 </row>
21922 <row>
21923 <entry><option>lookup_open_max</option></entry>
21924 <entry>lookup files held open</entry>
21925 </row>
21926 <row>
21927 <entry><option>mysql_servers</option></entry>
21928 <entry>default MySQL servers</entry>
21929 </row>
21930 <row>
21931 <entry><option>oracle_servers</option></entry>
21932 <entry>Oracle servers</entry>
21933 </row>
21934 <row>
21935 <entry><option>pgsql_servers</option></entry>
21936 <entry>default PostgreSQL servers</entry>
21937 </row>
21938 <row>
21939 <entry><option>sqlite_lock_timeout</option></entry>
21940 <entry>as it says</entry>
21941 </row>
21942 </tbody>
21943 </tgroup>
21944 </informaltable>
21945 </section>
21946 <section id="SECID102">
21947 <title>Message ids</title>
21948 <informaltable frame="none">
21949 <tgroup cols="2" colsep="0" rowsep="0">
21950 <colspec colwidth="196pt" align="left"/>
21951 <colspec colwidth="254pt" align="left"/>
21952 <tbody>
21953 <row>
21954 <entry><option>message_id_header_domain</option></entry>
21955 <entry>used to build <emphasis>Message-ID:</emphasis> header</entry>
21956 </row>
21957 <row>
21958 <entry><option>message_id_header_text</option></entry>
21959 <entry>ditto</entry>
21960 </row>
21961 </tbody>
21962 </tgroup>
21963 </informaltable>
21964 </section>
21965 <section id="SECID103">
21966 <title>Embedded Perl Startup</title>
21967 <informaltable frame="none">
21968 <tgroup cols="2" colsep="0" rowsep="0">
21969 <colspec colwidth="196pt" align="left"/>
21970 <colspec colwidth="254pt" align="left"/>
21971 <tbody>
21972 <row>
21973 <entry><option>perl_at_start</option></entry>
21974 <entry>always start the interpreter</entry>
21975 </row>
21976 <row>
21977 <entry><option>perl_startup</option></entry>
21978 <entry>code to obey when starting Perl</entry>
21979 </row>
21980 <row>
21981 <entry><option>perl_taintmode</option></entry>
21982 <entry>enable taint mode in Perl</entry>
21983 </row>
21984 </tbody>
21985 </tgroup>
21986 </informaltable>
21987 </section>
21988 <section id="SECID104">
21989 <title>Daemon</title>
21990 <informaltable frame="none">
21991 <tgroup cols="2" colsep="0" rowsep="0">
21992 <colspec colwidth="196pt" align="left"/>
21993 <colspec colwidth="254pt" align="left"/>
21994 <tbody>
21995 <row>
21996 <entry><option>daemon_smtp_ports</option></entry>
21997 <entry>default ports</entry>
21998 </row>
21999 <row>
22000 <entry><option>daemon_startup_retries</option></entry>
22001 <entry>number of times to retry</entry>
22002 </row>
22003 <row>
22004 <entry><option>daemon_startup_sleep</option></entry>
22005 <entry>time to sleep between tries</entry>
22006 </row>
22007 <row>
22008 <entry><option>extra_local_interfaces</option></entry>
22009 <entry>not necessarily listened on</entry>
22010 </row>
22011 <row>
22012 <entry><option>local_interfaces</option></entry>
22013 <entry>on which to listen, with optional ports</entry>
22014 </row>
22015 <row>
22016 <entry><option>pid_file_path</option></entry>
22017 <entry>override compiled-in value</entry>
22018 </row>
22019 <row>
22020 <entry><option>queue_run_max</option></entry>
22021 <entry>maximum simultaneous queue runners</entry>
22022 </row>
22023 </tbody>
22024 </tgroup>
22025 </informaltable>
22026 </section>
22027 <section id="SECID105">
22028 <title>Resource control</title>
22029 <informaltable frame="none">
22030 <tgroup cols="2" colsep="0" rowsep="0">
22031 <colspec colwidth="196pt" align="left"/>
22032 <colspec colwidth="254pt" align="left"/>
22033 <tbody>
22034 <row>
22035 <entry><option>check_log_inodes</option></entry>
22036 <entry>before accepting a message</entry>
22037 </row>
22038 <row>
22039 <entry><option>check_log_space</option></entry>
22040 <entry>before accepting a message</entry>
22041 </row>
22042 <row>
22043 <entry><option>check_spool_inodes</option></entry>
22044 <entry>before accepting a message</entry>
22045 </row>
22046 <row>
22047 <entry><option>check_spool_space</option></entry>
22048 <entry>before accepting a message</entry>
22049 </row>
22050 <row>
22051 <entry><option>deliver_queue_load_max</option></entry>
22052 <entry>no queue deliveries if load high</entry>
22053 </row>
22054 <row>
22055 <entry><option>queue_only_load</option></entry>
22056 <entry>queue incoming if load high</entry>
22057 </row>
22058 <row>
22059 <entry><option>queue_only_load_latch</option></entry>
22060 <entry>don&#x2019;t re-evaluate load for each message</entry>
22061 </row>
22062 <row>
22063 <entry><option>queue_run_max</option></entry>
22064 <entry>maximum simultaneous queue runners</entry>
22065 </row>
22066 <row>
22067 <entry><option>remote_max_parallel</option></entry>
22068 <entry>parallel SMTP delivery per message</entry>
22069 </row>
22070 <row>
22071 <entry><option>smtp_accept_max</option></entry>
22072 <entry>simultaneous incoming connections</entry>
22073 </row>
22074 <row>
22075 <entry><option>smtp_accept_max_nonmail</option></entry>
22076 <entry>non-mail commands</entry>
22077 </row>
22078 <row>
22079 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
22080 <entry>hosts to which the limit applies</entry>
22081 </row>
22082 <row>
22083 <entry><option>smtp_accept_max_per_connection</option></entry>
22084 <entry>messages per connection</entry>
22085 </row>
22086 <row>
22087 <entry><option>smtp_accept_max_per_host</option></entry>
22088 <entry>connections from one host</entry>
22089 </row>
22090 <row>
22091 <entry><option>smtp_accept_queue</option></entry>
22092 <entry>queue mail if more connections</entry>
22093 </row>
22094 <row>
22095 <entry><option>smtp_accept_queue_per_connection</option></entry>
22096 <entry>queue if more messages per connection</entry>
22097 </row>
22098 <row>
22099 <entry><option>smtp_accept_reserve</option></entry>
22100 <entry>only reserve hosts if more connections</entry>
22101 </row>
22102 <row>
22103 <entry><option>smtp_check_spool_space</option></entry>
22104 <entry>from SIZE on MAIL command</entry>
22105 </row>
22106 <row>
22107 <entry><option>smtp_connect_backlog</option></entry>
22108 <entry>passed to TCP/IP stack</entry>
22109 </row>
22110 <row>
22111 <entry><option>smtp_load_reserve</option></entry>
22112 <entry>SMTP from reserved hosts if load high</entry>
22113 </row>
22114 <row>
22115 <entry><option>smtp_reserve_hosts</option></entry>
22116 <entry>these are the reserve hosts</entry>
22117 </row>
22118 </tbody>
22119 </tgroup>
22120 </informaltable>
22121 </section>
22122 <section id="SECID106">
22123 <title>Policy controls</title>
22124 <informaltable frame="none">
22125 <tgroup cols="2" colsep="0" rowsep="0">
22126 <colspec colwidth="196pt" align="left"/>
22127 <colspec colwidth="254pt" align="left"/>
22128 <tbody>
22129 <row>
22130 <entry><option>acl_not_smtp</option></entry>
22131 <entry>ACL for non-SMTP messages</entry>
22132 </row>
22133 <row>
22134 <entry><option>acl_not_smtp_mime</option></entry>
22135 <entry>ACL for non-SMTP MIME parts</entry>
22136 </row>
22137 <row>
22138 <entry><option>acl_not_smtp_start</option></entry>
22139 <entry>ACL for start of non-SMTP message</entry>
22140 </row>
22141 <row>
22142 <entry><option>acl_smtp_auth</option></entry>
22143 <entry>ACL for AUTH</entry>
22144 </row>
22145 <row>
22146 <entry><option>acl_smtp_connect</option></entry>
22147 <entry>ACL for connection</entry>
22148 </row>
22149 <row>
22150 <entry><option>acl_smtp_data</option></entry>
22151 <entry>ACL for DATA</entry>
22152 </row>
22153 <row>
22154 <entry><option>acl_smtp_data_prdr</option></entry>
22155 <entry>ACL for DATA, per-recipient</entry>
22156 </row>
22157 <row>
22158 <entry><option>acl_smtp_dkim</option></entry>
22159 <entry>ACL for DKIM verification</entry>
22160 </row>
22161 <row>
22162 <entry><option>acl_smtp_etrn</option></entry>
22163 <entry>ACL for ETRN</entry>
22164 </row>
22165 <row>
22166 <entry><option>acl_smtp_expn</option></entry>
22167 <entry>ACL for EXPN</entry>
22168 </row>
22169 <row>
22170 <entry><option>acl_smtp_helo</option></entry>
22171 <entry>ACL for EHLO or HELO</entry>
22172 </row>
22173 <row>
22174 <entry><option>acl_smtp_mail</option></entry>
22175 <entry>ACL for MAIL</entry>
22176 </row>
22177 <row>
22178 <entry><option>acl_smtp_mailauth</option></entry>
22179 <entry>ACL for AUTH on MAIL command</entry>
22180 </row>
22181 <row>
22182 <entry><option>acl_smtp_mime</option></entry>
22183 <entry>ACL for MIME parts</entry>
22184 </row>
22185 <row>
22186 <entry><option>acl_smtp_notquit</option></entry>
22187 <entry>ACL for non-QUIT terminations</entry>
22188 </row>
22189 <row>
22190 <entry><option>acl_smtp_predata</option></entry>
22191 <entry>ACL for start of data</entry>
22192 </row>
22193 <row>
22194 <entry><option>acl_smtp_quit</option></entry>
22195 <entry>ACL for QUIT</entry>
22196 </row>
22197 <row>
22198 <entry><option>acl_smtp_rcpt</option></entry>
22199 <entry>ACL for RCPT</entry>
22200 </row>
22201 <row>
22202 <entry><option>acl_smtp_starttls</option></entry>
22203 <entry>ACL for STARTTLS</entry>
22204 </row>
22205 <row>
22206 <entry><option>acl_smtp_vrfy</option></entry>
22207 <entry>ACL for VRFY</entry>
22208 </row>
22209 <row>
22210 <entry><option>av_scanner</option></entry>
22211 <entry>specify virus scanner</entry>
22212 </row>
22213 <row>
22214 <entry><option>check_rfc2047_length</option></entry>
22215 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
22216 </row>
22217 <row>
22218 <entry><option>dns_cname_loops</option></entry>
22219 <entry>follow CNAMEs returned by resolver</entry>
22220 </row>
22221 <row>
22222 <entry><option>dns_csa_search_limit</option></entry>
22223 <entry>control CSA parent search depth</entry>
22224 </row>
22225 <row>
22226 <entry><option>dns_csa_use_reverse</option></entry>
22227 <entry>en/disable CSA IP reverse search</entry>
22228 </row>
22229 <row>
22230 <entry><option>header_maxsize</option></entry>
22231 <entry>total size of message header</entry>
22232 </row>
22233 <row>
22234 <entry><option>header_line_maxsize</option></entry>
22235 <entry>individual header line limit</entry>
22236 </row>
22237 <row>
22238 <entry><option>helo_accept_junk_hosts</option></entry>
22239 <entry>allow syntactic junk from these hosts</entry>
22240 </row>
22241 <row>
22242 <entry><option>helo_allow_chars</option></entry>
22243 <entry>allow illegal chars in HELO names</entry>
22244 </row>
22245 <row>
22246 <entry><option>helo_lookup_domains</option></entry>
22247 <entry>lookup hostname for these HELO names</entry>
22248 </row>
22249 <row>
22250 <entry><option>helo_try_verify_hosts</option></entry>
22251 <entry>HELO soft-checked for these hosts</entry>
22252 </row>
22253 <row>
22254 <entry><option>helo_verify_hosts</option></entry>
22255 <entry>HELO hard-checked for these hosts</entry>
22256 </row>
22257 <row>
22258 <entry><option>host_lookup</option></entry>
22259 <entry>host name looked up for these hosts</entry>
22260 </row>
22261 <row>
22262 <entry><option>host_lookup_order</option></entry>
22263 <entry>order of DNS and local name lookups</entry>
22264 </row>
22265 <row>
22266 <entry><option>hosts_proxy</option></entry>
22267 <entry>use proxy protocol for these hosts</entry>
22268 </row>
22269 <row>
22270 <entry><option>host_reject_connection</option></entry>
22271 <entry>reject connection from these hosts</entry>
22272 </row>
22273 <row>
22274 <entry><option>hosts_treat_as_local</option></entry>
22275 <entry>useful in some cluster configurations</entry>
22276 </row>
22277 <row>
22278 <entry><option>local_scan_timeout</option></entry>
22279 <entry>timeout for <function>local_scan()</function></entry>
22280 </row>
22281 <row>
22282 <entry><option>message_size_limit</option></entry>
22283 <entry>for all messages</entry>
22284 </row>
22285 <row>
22286 <entry><option>percent_hack_domains</option></entry>
22287 <entry>recognize %-hack for these domains</entry>
22288 </row>
22289 <row>
22290 <entry><option>spamd_address</option></entry>
22291 <entry>set interface to SpamAssassin</entry>
22292 </row>
22293 <row>
22294 <entry><option>strict_acl_vars</option></entry>
22295 <entry>object to unset ACL variables</entry>
22296 </row>
22297 </tbody>
22298 </tgroup>
22299 </informaltable>
22300 </section>
22301 <section id="SECID107">
22302 <title>Callout cache</title>
22303 <informaltable frame="none">
22304 <tgroup cols="2" colsep="0" rowsep="0">
22305 <colspec colwidth="196pt" align="left"/>
22306 <colspec colwidth="254pt" align="left"/>
22307 <tbody>
22308 <row>
22309 <entry><option>callout_domain_negative_expire</option></entry>
22310 <entry>timeout for negative domain cache item</entry>
22311 </row>
22312 <row>
22313 <entry><option>callout_domain_positive_expire</option></entry>
22314 <entry>timeout for positive domain cache item</entry>
22315 </row>
22316 <row>
22317 <entry><option>callout_negative_expire</option></entry>
22318 <entry>timeout for negative address cache item</entry>
22319 </row>
22320 <row>
22321 <entry><option>callout_positive_expire</option></entry>
22322 <entry>timeout for positive address cache item</entry>
22323 </row>
22324 <row>
22325 <entry><option>callout_random_local_part</option></entry>
22326 <entry>string to use for <quote>random</quote> testing</entry>
22327 </row>
22328 </tbody>
22329 </tgroup>
22330 </informaltable>
22331 </section>
22332 <section id="SECID108">
22333 <title>TLS</title>
22334 <informaltable frame="none">
22335 <tgroup cols="2" colsep="0" rowsep="0">
22336 <colspec colwidth="196pt" align="left"/>
22337 <colspec colwidth="254pt" align="left"/>
22338 <tbody>
22339 <row>
22340 <entry><option>gnutls_compat_mode</option></entry>
22341 <entry>use GnuTLS compatibility mode</entry>
22342 </row>
22343 <row>
22344 <entry><option>gnutls_allow_auto_pkcs11</option></entry>
22345 <entry>allow GnuTLS to autoload PKCS11 modules</entry>
22346 </row>
22347 <row>
22348 <entry><option>openssl_options</option></entry>
22349 <entry>adjust OpenSSL compatibility options</entry>
22350 </row>
22351 <row>
22352 <entry><option>tls_advertise_hosts</option></entry>
22353 <entry>advertise TLS to these hosts</entry>
22354 </row>
22355 <row>
22356 <entry><option>tls_certificate</option></entry>
22357 <entry>location of server certificate</entry>
22358 </row>
22359 <row>
22360 <entry><option>tls_crl</option></entry>
22361 <entry>certificate revocation list</entry>
22362 </row>
22363 <row>
22364 <entry><option>tls_dh_max_bits</option></entry>
22365 <entry>clamp D-H bit count suggestion</entry>
22366 </row>
22367 <row>
22368 <entry><option>tls_dhparam</option></entry>
22369 <entry>DH parameters for server</entry>
22370 </row>
22371 <row>
22372 <entry><option>tls_eccurve</option></entry>
22373 <entry>EC curve selection for server</entry>
22374 </row>
22375 <row>
22376 <entry><option>tls_ocsp_file</option></entry>
22377 <entry>location of server certificate status proof</entry>
22378 </row>
22379 <row>
22380 <entry><option>tls_on_connect_ports</option></entry>
22381 <entry>specify SSMTP (SMTPS) ports</entry>
22382 </row>
22383 <row>
22384 <entry><option>tls_privatekey</option></entry>
22385 <entry>location of server private key</entry>
22386 </row>
22387 <row>
22388 <entry><option>tls_remember_esmtp</option></entry>
22389 <entry>don&#x2019;t reset after starting TLS</entry>
22390 </row>
22391 <row>
22392 <entry><option>tls_require_ciphers</option></entry>
22393 <entry>specify acceptable ciphers</entry>
22394 </row>
22395 <row>
22396 <entry><option>tls_try_verify_hosts</option></entry>
22397 <entry>try to verify client certificate</entry>
22398 </row>
22399 <row>
22400 <entry><option>tls_verify_certificates</option></entry>
22401 <entry>expected client certificates</entry>
22402 </row>
22403 <row>
22404 <entry><option>tls_verify_hosts</option></entry>
22405 <entry>insist on client certificate verify</entry>
22406 </row>
22407 </tbody>
22408 </tgroup>
22409 </informaltable>
22410 </section>
22411 <section id="SECID109">
22412 <title>Local user handling</title>
22413 <informaltable frame="none">
22414 <tgroup cols="2" colsep="0" rowsep="0">
22415 <colspec colwidth="196pt" align="left"/>
22416 <colspec colwidth="254pt" align="left"/>
22417 <tbody>
22418 <row>
22419 <entry><option>finduser_retries</option></entry>
22420 <entry>useful in NIS environments</entry>
22421 </row>
22422 <row>
22423 <entry><option>gecos_name</option></entry>
22424 <entry>used when creating <emphasis>Sender:</emphasis></entry>
22425 </row>
22426 <row>
22427 <entry><option>gecos_pattern</option></entry>
22428 <entry>ditto</entry>
22429 </row>
22430 <row>
22431 <entry><option>max_username_length</option></entry>
22432 <entry>for systems that truncate</entry>
22433 </row>
22434 <row>
22435 <entry><option>unknown_login</option></entry>
22436 <entry>used when no login name found</entry>
22437 </row>
22438 <row>
22439 <entry><option>unknown_username</option></entry>
22440 <entry>ditto</entry>
22441 </row>
22442 <row>
22443 <entry><option>uucp_from_pattern</option></entry>
22444 <entry>for recognizing <quote>From </quote> lines</entry>
22445 </row>
22446 <row>
22447 <entry><option>uucp_from_sender</option></entry>
22448 <entry>ditto</entry>
22449 </row>
22450 </tbody>
22451 </tgroup>
22452 </informaltable>
22453 </section>
22454 <section id="SECID110">
22455 <title>All incoming messages (SMTP and non-SMTP)</title>
22456 <informaltable frame="none">
22457 <tgroup cols="2" colsep="0" rowsep="0">
22458 <colspec colwidth="196pt" align="left"/>
22459 <colspec colwidth="254pt" align="left"/>
22460 <tbody>
22461 <row>
22462 <entry><option>header_maxsize</option></entry>
22463 <entry>total size of message header</entry>
22464 </row>
22465 <row>
22466 <entry><option>header_line_maxsize</option></entry>
22467 <entry>individual header line limit</entry>
22468 </row>
22469 <row>
22470 <entry><option>message_size_limit</option></entry>
22471 <entry>applies to all messages</entry>
22472 </row>
22473 <row>
22474 <entry><option>percent_hack_domains</option></entry>
22475 <entry>recognize %-hack for these domains</entry>
22476 </row>
22477 <row>
22478 <entry><option>received_header_text</option></entry>
22479 <entry>expanded to make <emphasis>Received:</emphasis></entry>
22480 </row>
22481 <row>
22482 <entry><option>received_headers_max</option></entry>
22483 <entry>for mail loop detection</entry>
22484 </row>
22485 <row>
22486 <entry><option>recipients_max</option></entry>
22487 <entry>limit per message</entry>
22488 </row>
22489 <row>
22490 <entry><option>recipients_max_reject</option></entry>
22491 <entry>permanently reject excess recipients</entry>
22492 </row>
22493 </tbody>
22494 </tgroup>
22495 </informaltable>
22496 </section>
22497 <section id="SECID111">
22498 <title>Non-SMTP incoming messages</title>
22499 <informaltable frame="none">
22500 <tgroup cols="2" colsep="0" rowsep="0">
22501 <colspec colwidth="196pt" align="left"/>
22502 <colspec colwidth="254pt" align="left"/>
22503 <tbody>
22504 <row>
22505 <entry><option>receive_timeout</option></entry>
22506 <entry>for non-SMTP messages</entry>
22507 </row>
22508 </tbody>
22509 </tgroup>
22510 </informaltable>
22511 </section>
22512 <section id="SECID112">
22513 <title>Incoming SMTP messages</title>
22514 <para>
22515 See also the <emphasis>Policy controls</emphasis> section above.
22516 </para>
22517 <informaltable frame="none">
22518 <tgroup cols="2" colsep="0" rowsep="0">
22519 <colspec colwidth="196pt" align="left"/>
22520 <colspec colwidth="254pt" align="left"/>
22521 <tbody>
22522 <row>
22523 <entry><option>dkim_verify_signers</option></entry>
22524 <entry>DKIM domain for which DKIM ACL is run</entry>
22525 </row>
22526 <row>
22527 <entry><option>host_lookup</option></entry>
22528 <entry>host name looked up for these hosts</entry>
22529 </row>
22530 <row>
22531 <entry><option>host_lookup_order</option></entry>
22532 <entry>order of DNS and local name lookups</entry>
22533 </row>
22534 <row>
22535 <entry><option>recipient_unqualified_hosts</option></entry>
22536 <entry>may send unqualified recipients</entry>
22537 </row>
22538 <row>
22539 <entry><option>rfc1413_hosts</option></entry>
22540 <entry>make ident calls to these hosts</entry>
22541 </row>
22542 <row>
22543 <entry><option>rfc1413_query_timeout</option></entry>
22544 <entry>zero disables ident calls</entry>
22545 </row>
22546 <row>
22547 <entry><option>sender_unqualified_hosts</option></entry>
22548 <entry>may send unqualified senders</entry>
22549 </row>
22550 <row>
22551 <entry><option>smtp_accept_keepalive</option></entry>
22552 <entry>some TCP/IP magic</entry>
22553 </row>
22554 <row>
22555 <entry><option>smtp_accept_max</option></entry>
22556 <entry>simultaneous incoming connections</entry>
22557 </row>
22558 <row>
22559 <entry><option>smtp_accept_max_nonmail</option></entry>
22560 <entry>non-mail commands</entry>
22561 </row>
22562 <row>
22563 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
22564 <entry>hosts to which the limit applies</entry>
22565 </row>
22566 <row>
22567 <entry><option>smtp_accept_max_per_connection</option></entry>
22568 <entry>messages per connection</entry>
22569 </row>
22570 <row>
22571 <entry><option>smtp_accept_max_per_host</option></entry>
22572 <entry>connections from one host</entry>
22573 </row>
22574 <row>
22575 <entry><option>smtp_accept_queue</option></entry>
22576 <entry>queue mail if more connections</entry>
22577 </row>
22578 <row>
22579 <entry><option>smtp_accept_queue_per_connection</option></entry>
22580 <entry>queue if more messages per connection</entry>
22581 </row>
22582 <row>
22583 <entry><option>smtp_accept_reserve</option></entry>
22584 <entry>only reserve hosts if more connections</entry>
22585 </row>
22586 <row>
22587 <entry><option>smtp_active_hostname</option></entry>
22588 <entry>host name to use in messages</entry>
22589 </row>
22590 <row>
22591 <entry><option>smtp_banner</option></entry>
22592 <entry>text for welcome banner</entry>
22593 </row>
22594 <row>
22595 <entry><option>smtp_check_spool_space</option></entry>
22596 <entry>from SIZE on MAIL command</entry>
22597 </row>
22598 <row>
22599 <entry><option>smtp_connect_backlog</option></entry>
22600 <entry>passed to TCP/IP stack</entry>
22601 </row>
22602 <row>
22603 <entry><option>smtp_enforce_sync</option></entry>
22604 <entry>of SMTP command/responses</entry>
22605 </row>
22606 <row>
22607 <entry><option>smtp_etrn_command</option></entry>
22608 <entry>what to run for ETRN</entry>
22609 </row>
22610 <row>
22611 <entry><option>smtp_etrn_serialize</option></entry>
22612 <entry>only one at once</entry>
22613 </row>
22614 <row>
22615 <entry><option>smtp_load_reserve</option></entry>
22616 <entry>only reserve hosts if this load</entry>
22617 </row>
22618 <row>
22619 <entry><option>smtp_max_unknown_commands</option></entry>
22620 <entry>before dropping connection</entry>
22621 </row>
22622 <row>
22623 <entry><option>smtp_ratelimit_hosts</option></entry>
22624 <entry>apply ratelimiting to these hosts</entry>
22625 </row>
22626 <row>
22627 <entry><option>smtp_ratelimit_mail</option></entry>
22628 <entry>ratelimit for MAIL commands</entry>
22629 </row>
22630 <row>
22631 <entry><option>smtp_ratelimit_rcpt</option></entry>
22632 <entry>ratelimit for RCPT commands</entry>
22633 </row>
22634 <row>
22635 <entry><option>smtp_receive_timeout</option></entry>
22636 <entry>per command or data line</entry>
22637 </row>
22638 <row>
22639 <entry><option>smtp_reserve_hosts</option></entry>
22640 <entry>these are the reserve hosts</entry>
22641 </row>
22642 <row>
22643 <entry><option>smtp_return_error_details</option></entry>
22644 <entry>give detail on rejections</entry>
22645 </row>
22646 </tbody>
22647 </tgroup>
22648 </informaltable>
22649 </section>
22650 <section id="SECID113">
22651 <title>SMTP extensions</title>
22652 <informaltable frame="none">
22653 <tgroup cols="2" colsep="0" rowsep="0">
22654 <colspec colwidth="196pt" align="left"/>
22655 <colspec colwidth="254pt" align="left"/>
22656 <tbody>
22657 <row>
22658 <entry><option>accept_8bitmime</option></entry>
22659 <entry>advertise 8BITMIME</entry>
22660 </row>
22661 <row>
22662 <entry><option>auth_advertise_hosts</option></entry>
22663 <entry>advertise AUTH to these hosts</entry>
22664 </row>
22665 <row>
22666 <entry><option>chunking_advertise_hosts</option></entry>
22667 <entry>advertise CHUNKING to these hosts</entry>
22668 </row>
22669 <row>
22670 <entry><option>dsn_advertise_hosts</option></entry>
22671 <entry>advertise DSN extensions to these hosts</entry>
22672 </row>
22673 <row>
22674 <entry><option>ignore_fromline_hosts</option></entry>
22675 <entry>allow <quote>From </quote> from these hosts</entry>
22676 </row>
22677 <row>
22678 <entry><option>ignore_fromline_local</option></entry>
22679 <entry>allow <quote>From </quote> from local SMTP</entry>
22680 </row>
22681 <row>
22682 <entry><option>pipelining_advertise_hosts</option></entry>
22683 <entry>advertise pipelining to these hosts</entry>
22684 </row>
22685 <row>
22686 <entry><option>prdr_enable</option></entry>
22687 <entry>advertise PRDR to all hosts</entry>
22688 </row>
22689 <row>
22690 <entry><option>smtputf8_advertise_hosts</option></entry>
22691 <entry>advertise SMTPUTF8 to these hosts</entry>
22692 </row>
22693 <row>
22694 <entry><option>tls_advertise_hosts</option></entry>
22695 <entry>advertise TLS to these hosts</entry>
22696 </row>
22697 </tbody>
22698 </tgroup>
22699 </informaltable>
22700 </section>
22701 <section id="SECID114">
22702 <title>Processing messages</title>
22703 <informaltable frame="none">
22704 <tgroup cols="2" colsep="0" rowsep="0">
22705 <colspec colwidth="196pt" align="left"/>
22706 <colspec colwidth="254pt" align="left"/>
22707 <tbody>
22708 <row>
22709 <entry><option>allow_domain_literals</option></entry>
22710 <entry>recognize domain literal syntax</entry>
22711 </row>
22712 <row>
22713 <entry><option>allow_mx_to_ip</option></entry>
22714 <entry>allow MX to point to IP address</entry>
22715 </row>
22716 <row>
22717 <entry><option>allow_utf8_domains</option></entry>
22718 <entry>in addresses</entry>
22719 </row>
22720 <row>
22721 <entry><option>check_rfc2047_length</option></entry>
22722 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
22723 </row>
22724 <row>
22725 <entry><option>delivery_date_remove</option></entry>
22726 <entry>from incoming messages</entry>
22727 </row>
22728 <row>
22729 <entry><option>envelope_to_remove</option></entry>
22730 <entry>from incoming messages</entry>
22731 </row>
22732 <row>
22733 <entry><option>extract_addresses_remove_arguments</option></entry>
22734 <entry>affects <option>-t</option> processing</entry>
22735 </row>
22736 <row>
22737 <entry><option>headers_charset</option></entry>
22738 <entry>default for translations</entry>
22739 </row>
22740 <row>
22741 <entry><option>qualify_domain</option></entry>
22742 <entry>default for senders</entry>
22743 </row>
22744 <row>
22745 <entry><option>qualify_recipient</option></entry>
22746 <entry>default for recipients</entry>
22747 </row>
22748 <row>
22749 <entry><option>return_path_remove</option></entry>
22750 <entry>from incoming messages</entry>
22751 </row>
22752 <row>
22753 <entry><option>strip_excess_angle_brackets</option></entry>
22754 <entry>in addresses</entry>
22755 </row>
22756 <row>
22757 <entry><option>strip_trailing_dot</option></entry>
22758 <entry>at end of addresses</entry>
22759 </row>
22760 <row>
22761 <entry><option>untrusted_set_sender</option></entry>
22762 <entry>untrusted can set envelope sender</entry>
22763 </row>
22764 </tbody>
22765 </tgroup>
22766 </informaltable>
22767 </section>
22768 <section id="SECID115">
22769 <title>System filter</title>
22770 <informaltable frame="none">
22771 <tgroup cols="2" colsep="0" rowsep="0">
22772 <colspec colwidth="196pt" align="left"/>
22773 <colspec colwidth="254pt" align="left"/>
22774 <tbody>
22775 <row>
22776 <entry><option>system_filter</option></entry>
22777 <entry>locate system filter</entry>
22778 </row>
22779 <row>
22780 <entry><option>system_filter_directory_transport</option></entry>
22781 <entry>transport for delivery to a directory</entry>
22782 </row>
22783 <row>
22784 <entry><option>system_filter_file_transport</option></entry>
22785 <entry>transport for delivery to a file</entry>
22786 </row>
22787 <row>
22788 <entry><option>system_filter_group</option></entry>
22789 <entry>group for filter running</entry>
22790 </row>
22791 <row>
22792 <entry><option>system_filter_pipe_transport</option></entry>
22793 <entry>transport for delivery to a pipe</entry>
22794 </row>
22795 <row>
22796 <entry><option>system_filter_reply_transport</option></entry>
22797 <entry>transport for autoreply delivery</entry>
22798 </row>
22799 <row>
22800 <entry><option>system_filter_user</option></entry>
22801 <entry>user for filter running</entry>
22802 </row>
22803 </tbody>
22804 </tgroup>
22805 </informaltable>
22806 </section>
22807 <section id="SECID116">
22808 <title>Routing and delivery</title>
22809 <informaltable frame="none">
22810 <tgroup cols="2" colsep="0" rowsep="0">
22811 <colspec colwidth="196pt" align="left"/>
22812 <colspec colwidth="254pt" align="left"/>
22813 <tbody>
22814 <row>
22815 <entry><option>disable_ipv6</option></entry>
22816 <entry>do no IPv6 processing</entry>
22817 </row>
22818 <row>
22819 <entry><option>dns_again_means_nonexist</option></entry>
22820 <entry>for broken domains</entry>
22821 </row>
22822 <row>
22823 <entry><option>dns_check_names_pattern</option></entry>
22824 <entry>pre-DNS syntax check</entry>
22825 </row>
22826 <row>
22827 <entry><option>dns_dnssec_ok</option></entry>
22828 <entry>parameter for resolver</entry>
22829 </row>
22830 <row>
22831 <entry><option>dns_ipv4_lookup</option></entry>
22832 <entry>only v4 lookup for these domains</entry>
22833 </row>
22834 <row>
22835 <entry><option>dns_retrans</option></entry>
22836 <entry>parameter for resolver</entry>
22837 </row>
22838 <row>
22839 <entry><option>dns_retry</option></entry>
22840 <entry>parameter for resolver</entry>
22841 </row>
22842 <row>
22843 <entry><option>dns_trust_aa</option></entry>
22844 <entry>DNS zones trusted as authentic</entry>
22845 </row>
22846 <row>
22847 <entry><option>dns_use_edns0</option></entry>
22848 <entry>parameter for resolver</entry>
22849 </row>
22850 <row>
22851 <entry><option>hold_domains</option></entry>
22852 <entry>hold delivery for these domains</entry>
22853 </row>
22854 <row>
22855 <entry><option>local_interfaces</option></entry>
22856 <entry>for routing checks</entry>
22857 </row>
22858 <row>
22859 <entry><option>queue_domains</option></entry>
22860 <entry>no immediate delivery for these</entry>
22861 </row>
22862 <row>
22863 <entry><option>queue_only</option></entry>
22864 <entry>no immediate delivery at all</entry>
22865 </row>
22866 <row>
22867 <entry><option>queue_only_file</option></entry>
22868 <entry>no immediate delivery if file exists</entry>
22869 </row>
22870 <row>
22871 <entry><option>queue_only_load</option></entry>
22872 <entry>no immediate delivery if load is high</entry>
22873 </row>
22874 <row>
22875 <entry><option>queue_only_load_latch</option></entry>
22876 <entry>don&#x2019;t re-evaluate load for each message</entry>
22877 </row>
22878 <row>
22879 <entry><option>queue_only_override</option></entry>
22880 <entry>allow command line to override</entry>
22881 </row>
22882 <row>
22883 <entry><option>queue_run_in_order</option></entry>
22884 <entry>order of arrival</entry>
22885 </row>
22886 <row>
22887 <entry><option>queue_run_max</option></entry>
22888 <entry>of simultaneous queue runners</entry>
22889 </row>
22890 <row>
22891 <entry><option>queue_smtp_domains</option></entry>
22892 <entry>no immediate SMTP delivery for these</entry>
22893 </row>
22894 <row>
22895 <entry><option>remote_max_parallel</option></entry>
22896 <entry>parallel SMTP delivery per message</entry>
22897 </row>
22898 <row>
22899 <entry><option>remote_sort_domains</option></entry>
22900 <entry>order of remote deliveries</entry>
22901 </row>
22902 <row>
22903 <entry><option>retry_data_expire</option></entry>
22904 <entry>timeout for retry data</entry>
22905 </row>
22906 <row>
22907 <entry><option>retry_interval_max</option></entry>
22908 <entry>safety net for retry rules</entry>
22909 </row>
22910 </tbody>
22911 </tgroup>
22912 </informaltable>
22913 </section>
22914 <section id="SECID117">
22915 <title>Bounce and warning messages</title>
22916 <informaltable frame="none">
22917 <tgroup cols="2" colsep="0" rowsep="0">
22918 <colspec colwidth="196pt" align="left"/>
22919 <colspec colwidth="254pt" align="left"/>
22920 <tbody>
22921 <row>
22922 <entry><option>bounce_message_file</option></entry>
22923 <entry>content of bounce</entry>
22924 </row>
22925 <row>
22926 <entry><option>bounce_message_text</option></entry>
22927 <entry>content of bounce</entry>
22928 </row>
22929 <row>
22930 <entry><option>bounce_return_body</option></entry>
22931 <entry>include body if returning message</entry>
22932 </row>
22933 <row>
22934 <entry><option>bounce_return_linesize_limit</option></entry>
22935 <entry>limit on returned message line length</entry>
22936 </row>
22937 <row>
22938 <entry><option>bounce_return_message</option></entry>
22939 <entry>include original message in bounce</entry>
22940 </row>
22941 <row>
22942 <entry><option>bounce_return_size_limit</option></entry>
22943 <entry>limit on returned message</entry>
22944 </row>
22945 <row>
22946 <entry><option>bounce_sender_authentication</option></entry>
22947 <entry>send authenticated sender with bounce</entry>
22948 </row>
22949 <row>
22950 <entry><option>dsn_from</option></entry>
22951 <entry>set <emphasis>From:</emphasis> contents in bounces</entry>
22952 </row>
22953 <row>
22954 <entry><option>errors_copy</option></entry>
22955 <entry>copy bounce messages</entry>
22956 </row>
22957 <row>
22958 <entry><option>errors_reply_to</option></entry>
22959 <entry><emphasis>Reply-to:</emphasis> in bounces</entry>
22960 </row>
22961 <row>
22962 <entry><option>delay_warning</option></entry>
22963 <entry>time schedule</entry>
22964 </row>
22965 <row>
22966 <entry><option>delay_warning_condition</option></entry>
22967 <entry>condition for warning messages</entry>
22968 </row>
22969 <row>
22970 <entry><option>ignore_bounce_errors_after</option></entry>
22971 <entry>discard undeliverable bounces</entry>
22972 </row>
22973 <row>
22974 <entry><option>smtp_return_error_details</option></entry>
22975 <entry>give detail on rejections</entry>
22976 </row>
22977 <row>
22978 <entry><option>warn_message_file</option></entry>
22979 <entry>content of warning message</entry>
22980 </row>
22981 </tbody>
22982 </tgroup>
22983 </informaltable>
22984 </section>
22985 <section id="SECTalomo">
22986 <title>Alphabetical list of main options</title>
22987 <para>
22988 Those options that undergo string expansion before use are marked with
22989 &dagger;.
22990 </para>
22991 <para>
22992 <indexterm role="option">
22993 <primary><option>accept_8bitmime</option></primary>
22994 </indexterm>
22995 </para>
22996 <informaltable frame="all">
22997 <tgroup cols="4" colsep="0" rowsep="0">
22998 <colspec colwidth="8*" align="left"/>
22999 <colspec colwidth="6*" align="center"/>
23000 <colspec colwidth="6*" align="center"/>
23001 <colspec colwidth="6*" align="right"/>
23002 <tbody>
23003 <row>
23004 <entry><option>accept_8bitmime</option></entry>
23005 <entry>Use: <emphasis>main</emphasis></entry>
23006 <entry>Type: <emphasis>boolean</emphasis></entry>
23007 <entry>Default: <emphasis>true</emphasis></entry>
23008 </row>
23009 </tbody>
23010 </tgroup>
23011 </informaltable>
23012 <para>
23013 <indexterm role="concept">
23014 <primary>8BITMIME</primary>
23015 </indexterm>
23016 <indexterm role="concept">
23017 <primary>8-bit characters</primary>
23018 </indexterm>
23019 <indexterm role="concept">
23020 <primary>log</primary>
23021 <secondary>selectors</secondary>
23022 </indexterm>
23023 <indexterm role="concept">
23024 <primary>log</primary>
23025 <secondary>8BITMIME</secondary>
23026 </indexterm>
23027 This option causes Exim to send 8BITMIME in its response to an SMTP
23028 EHLO command, and to accept the BODY= parameter on MAIL commands.
23029 However, though Exim is 8-bit clean, it is not a protocol converter, and it
23030 takes no steps to do anything special with messages received by this route.
23031 </para>
23032 <para>
23033 Historically Exim kept this option off by default, but the maintainers
23034 feel that in today&#x2019;s Internet, this causes more problems than it solves.
23035 It now defaults to true.
23036 A more detailed analysis of the issues is provided by Dan Bernstein:
23037 </para>
23038 <literallayout>
23039 <emphasis role="bold"><ulink url="https://cr.yp.to/smtp/8bitmime.html">https://cr.yp.to/smtp/8bitmime.html</ulink></emphasis>
23040 </literallayout>
23041 <para>
23042 To log received 8BITMIME status use
23043 </para>
23044 <literallayout class="monospaced">
23045 log_selector = +8bitmime
23046 </literallayout>
23047 <para>
23048 <indexterm role="option">
23049 <primary><option>acl_not_smtp</option></primary>
23050 </indexterm>
23051 </para>
23052 <informaltable frame="all">
23053 <tgroup cols="4" colsep="0" rowsep="0">
23054 <colspec colwidth="8*" align="left"/>
23055 <colspec colwidth="6*" align="center"/>
23056 <colspec colwidth="6*" align="center"/>
23057 <colspec colwidth="6*" align="right"/>
23058 <tbody>
23059 <row>
23060 <entry><option>acl_not_smtp</option></entry>
23061 <entry>Use: <emphasis>main</emphasis></entry>
23062 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23063 <entry>Default: <emphasis>unset</emphasis></entry>
23064 </row>
23065 </tbody>
23066 </tgroup>
23067 </informaltable>
23068 <para>
23069 <indexterm role="concept">
23070 <primary>access control lists (ACLs)</primary>
23071 <secondary>for non-SMTP messages</secondary>
23072 </indexterm>
23073 <indexterm role="concept">
23074 <primary>non-SMTP messages</primary>
23075 <secondary>ACLs for</secondary>
23076 </indexterm>
23077 This option defines the ACL that is run when a non-SMTP message has been
23078 read and is on the point of being accepted. See chapter <xref linkend="CHAPACL"/> for
23079 further details.
23080 </para>
23081 <para>
23082 <indexterm role="option">
23083 <primary><option>acl_not_smtp_mime</option></primary>
23084 </indexterm>
23085 </para>
23086 <informaltable frame="all">
23087 <tgroup cols="4" colsep="0" rowsep="0">
23088 <colspec colwidth="8*" align="left"/>
23089 <colspec colwidth="6*" align="center"/>
23090 <colspec colwidth="6*" align="center"/>
23091 <colspec colwidth="6*" align="right"/>
23092 <tbody>
23093 <row>
23094 <entry><option>acl_not_smtp_mime</option></entry>
23095 <entry>Use: <emphasis>main</emphasis></entry>
23096 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23097 <entry>Default: <emphasis>unset</emphasis></entry>
23098 </row>
23099 </tbody>
23100 </tgroup>
23101 </informaltable>
23102 <para>
23103 This option defines the ACL that is run for individual MIME parts of non-SMTP
23104 messages. It operates in exactly the same way as <option>acl_smtp_mime</option> operates for
23105 SMTP messages.
23106 </para>
23107 <para>
23108 <indexterm role="option">
23109 <primary><option>acl_not_smtp_start</option></primary>
23110 </indexterm>
23111 </para>
23112 <informaltable frame="all">
23113 <tgroup cols="4" colsep="0" rowsep="0">
23114 <colspec colwidth="8*" align="left"/>
23115 <colspec colwidth="6*" align="center"/>
23116 <colspec colwidth="6*" align="center"/>
23117 <colspec colwidth="6*" align="right"/>
23118 <tbody>
23119 <row>
23120 <entry><option>acl_not_smtp_start</option></entry>
23121 <entry>Use: <emphasis>main</emphasis></entry>
23122 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23123 <entry>Default: <emphasis>unset</emphasis></entry>
23124 </row>
23125 </tbody>
23126 </tgroup>
23127 </informaltable>
23128 <para>
23129 <indexterm role="concept">
23130 <primary>access control lists (ACLs)</primary>
23131 <secondary>at start of non-SMTP message</secondary>
23132 </indexterm>
23133 <indexterm role="concept">
23134 <primary>non-SMTP messages</primary>
23135 <secondary>ACLs for</secondary>
23136 </indexterm>
23137 This option defines the ACL that is run before Exim starts reading a
23138 non-SMTP message. See chapter <xref linkend="CHAPACL"/> for further details.
23139 </para>
23140 <para>
23141 <indexterm role="option">
23142 <primary><option>acl_smtp_auth</option></primary>
23143 </indexterm>
23144 </para>
23145 <informaltable frame="all">
23146 <tgroup cols="4" colsep="0" rowsep="0">
23147 <colspec colwidth="8*" align="left"/>
23148 <colspec colwidth="6*" align="center"/>
23149 <colspec colwidth="6*" align="center"/>
23150 <colspec colwidth="6*" align="right"/>
23151 <tbody>
23152 <row>
23153 <entry><option>acl_smtp_auth</option></entry>
23154 <entry>Use: <emphasis>main</emphasis></entry>
23155 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23156 <entry>Default: <emphasis>unset</emphasis></entry>
23157 </row>
23158 </tbody>
23159 </tgroup>
23160 </informaltable>
23161 <para>
23162 <indexterm role="concept">
23163 <primary>access control lists (ACLs)</primary>
23164 <secondary>setting up for SMTP commands</secondary>
23165 </indexterm>
23166 <indexterm role="concept">
23167 <primary>AUTH</primary>
23168 <secondary>ACL for</secondary>
23169 </indexterm>
23170 This option defines the ACL that is run when an SMTP AUTH command is
23171 received. See chapter <xref linkend="CHAPACL"/> for further details.
23172 </para>
23173 <para>
23174 <indexterm role="option">
23175 <primary><option>acl_smtp_connect</option></primary>
23176 </indexterm>
23177 </para>
23178 <informaltable frame="all">
23179 <tgroup cols="4" colsep="0" rowsep="0">
23180 <colspec colwidth="8*" align="left"/>
23181 <colspec colwidth="6*" align="center"/>
23182 <colspec colwidth="6*" align="center"/>
23183 <colspec colwidth="6*" align="right"/>
23184 <tbody>
23185 <row>
23186 <entry><option>acl_smtp_connect</option></entry>
23187 <entry>Use: <emphasis>main</emphasis></entry>
23188 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23189 <entry>Default: <emphasis>unset</emphasis></entry>
23190 </row>
23191 </tbody>
23192 </tgroup>
23193 </informaltable>
23194 <para>
23195 <indexterm role="concept">
23196 <primary>access control lists (ACLs)</primary>
23197 <secondary>on SMTP connection</secondary>
23198 </indexterm>
23199 This option defines the ACL that is run when an SMTP connection is received.
23200 See chapter <xref linkend="CHAPACL"/> for further details.
23201 </para>
23202 <para>
23203 <indexterm role="option">
23204 <primary><option>acl_smtp_data</option></primary>
23205 </indexterm>
23206 </para>
23207 <informaltable frame="all">
23208 <tgroup cols="4" colsep="0" rowsep="0">
23209 <colspec colwidth="8*" align="left"/>
23210 <colspec colwidth="6*" align="center"/>
23211 <colspec colwidth="6*" align="center"/>
23212 <colspec colwidth="6*" align="right"/>
23213 <tbody>
23214 <row>
23215 <entry><option>acl_smtp_data</option></entry>
23216 <entry>Use: <emphasis>main</emphasis></entry>
23217 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23218 <entry>Default: <emphasis>unset</emphasis></entry>
23219 </row>
23220 </tbody>
23221 </tgroup>
23222 </informaltable>
23223 <para>
23224 <indexterm role="concept">
23225 <primary>DATA</primary>
23226 <secondary>ACL for</secondary>
23227 </indexterm>
23228 This option defines the ACL that is run after an SMTP DATA command has been
23229 processed and the message itself has been received, but before the final
23230 acknowledgment is sent. See chapter <xref linkend="CHAPACL"/> for further details.
23231 </para>
23232 <para>
23233 <indexterm role="option">
23234 <primary><option>acl_smtp_data_prdr</option></primary>
23235 </indexterm>
23236 </para>
23237 <informaltable frame="all">
23238 <tgroup cols="4" colsep="0" rowsep="0">
23239 <colspec colwidth="8*" align="left"/>
23240 <colspec colwidth="6*" align="center"/>
23241 <colspec colwidth="6*" align="center"/>
23242 <colspec colwidth="6*" align="right"/>
23243 <tbody>
23244 <row>
23245 <entry><option>acl_smtp_data_prdr</option></entry>
23246 <entry>Use: <emphasis>main</emphasis></entry>
23247 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23248 <entry>Default: <emphasis>accept</emphasis></entry>
23249 </row>
23250 </tbody>
23251 </tgroup>
23252 </informaltable>
23253 <para>
23254 <indexterm role="concept">
23255 <primary>PRDR</primary>
23256 <secondary>ACL for</secondary>
23257 </indexterm>
23258 <indexterm role="concept">
23259 <primary>DATA</primary>
23260 <secondary>PRDR ACL for</secondary>
23261 </indexterm>
23262 <indexterm role="concept">
23263 <primary>access control lists (ACLs)</primary>
23264 <secondary>PRDR-related</secondary>
23265 </indexterm>
23266 <indexterm role="concept">
23267 <primary>access control lists (ACLs)</primary>
23268 <secondary>per-user data processing</secondary>
23269 </indexterm>
23270 This option defines the ACL that,
23271 if the PRDR feature has been negotiated,
23272 is run for each recipient after an SMTP DATA command has been
23273 processed and the message itself has been received, but before the
23274 acknowledgment is sent. See chapter <xref linkend="CHAPACL"/> for further details.
23275 </para>
23276 <para>
23277 <indexterm role="option">
23278 <primary><option>acl_smtp_dkim</option></primary>
23279 </indexterm>
23280 </para>
23281 <informaltable frame="all">
23282 <tgroup cols="4" colsep="0" rowsep="0">
23283 <colspec colwidth="8*" align="left"/>
23284 <colspec colwidth="6*" align="center"/>
23285 <colspec colwidth="6*" align="center"/>
23286 <colspec colwidth="6*" align="right"/>
23287 <tbody>
23288 <row>
23289 <entry><option>acl_smtp_dkim</option></entry>
23290 <entry>Use: <emphasis>main</emphasis></entry>
23291 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23292 <entry>Default: <emphasis>unset</emphasis></entry>
23293 </row>
23294 </tbody>
23295 </tgroup>
23296 </informaltable>
23297 <para>
23298 <indexterm role="concept">
23299 <primary>DKIM</primary>
23300 <secondary>ACL for</secondary>
23301 </indexterm>
23302 This option defines the ACL that is run for each DKIM signature
23303 (by default, or as specified in the dkim_verify_signers option)
23304 of a received message.
23305 See section <xref linkend="SECDKIMVFY"/> for further details.
23306 </para>
23307 <para>
23308 <indexterm role="option">
23309 <primary><option>acl_smtp_etrn</option></primary>
23310 </indexterm>
23311 </para>
23312 <informaltable frame="all">
23313 <tgroup cols="4" colsep="0" rowsep="0">
23314 <colspec colwidth="8*" align="left"/>
23315 <colspec colwidth="6*" align="center"/>
23316 <colspec colwidth="6*" align="center"/>
23317 <colspec colwidth="6*" align="right"/>
23318 <tbody>
23319 <row>
23320 <entry><option>acl_smtp_etrn</option></entry>
23321 <entry>Use: <emphasis>main</emphasis></entry>
23322 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23323 <entry>Default: <emphasis>unset</emphasis></entry>
23324 </row>
23325 </tbody>
23326 </tgroup>
23327 </informaltable>
23328 <para>
23329 <indexterm role="concept">
23330 <primary>ETRN</primary>
23331 <secondary>ACL for</secondary>
23332 </indexterm>
23333 This option defines the ACL that is run when an SMTP ETRN command is
23334 received. See chapter <xref linkend="CHAPACL"/> for further details.
23335 </para>
23336 <para>
23337 <indexterm role="option">
23338 <primary><option>acl_smtp_expn</option></primary>
23339 </indexterm>
23340 </para>
23341 <informaltable frame="all">
23342 <tgroup cols="4" colsep="0" rowsep="0">
23343 <colspec colwidth="8*" align="left"/>
23344 <colspec colwidth="6*" align="center"/>
23345 <colspec colwidth="6*" align="center"/>
23346 <colspec colwidth="6*" align="right"/>
23347 <tbody>
23348 <row>
23349 <entry><option>acl_smtp_expn</option></entry>
23350 <entry>Use: <emphasis>main</emphasis></entry>
23351 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23352 <entry>Default: <emphasis>unset</emphasis></entry>
23353 </row>
23354 </tbody>
23355 </tgroup>
23356 </informaltable>
23357 <para>
23358 <indexterm role="concept">
23359 <primary>EXPN</primary>
23360 <secondary>ACL for</secondary>
23361 </indexterm>
23362 This option defines the ACL that is run when an SMTP EXPN command is
23363 received. See chapter <xref linkend="CHAPACL"/> for further details.
23364 </para>
23365 <para>
23366 <indexterm role="option">
23367 <primary><option>acl_smtp_helo</option></primary>
23368 </indexterm>
23369 </para>
23370 <informaltable frame="all">
23371 <tgroup cols="4" colsep="0" rowsep="0">
23372 <colspec colwidth="8*" align="left"/>
23373 <colspec colwidth="6*" align="center"/>
23374 <colspec colwidth="6*" align="center"/>
23375 <colspec colwidth="6*" align="right"/>
23376 <tbody>
23377 <row>
23378 <entry><option>acl_smtp_helo</option></entry>
23379 <entry>Use: <emphasis>main</emphasis></entry>
23380 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23381 <entry>Default: <emphasis>unset</emphasis></entry>
23382 </row>
23383 </tbody>
23384 </tgroup>
23385 </informaltable>
23386 <para>
23387 <indexterm role="concept">
23388 <primary>EHLO</primary>
23389 <secondary>ACL for</secondary>
23390 </indexterm>
23391 <indexterm role="concept">
23392 <primary>HELO</primary>
23393 <secondary>ACL for</secondary>
23394 </indexterm>
23395 This option defines the ACL that is run when an SMTP EHLO or HELO
23396 command is received. See chapter <xref linkend="CHAPACL"/> for further details.
23397 </para>
23398 <para>
23399 <indexterm role="option">
23400 <primary><option>acl_smtp_mail</option></primary>
23401 </indexterm>
23402 </para>
23403 <informaltable frame="all">
23404 <tgroup cols="4" colsep="0" rowsep="0">
23405 <colspec colwidth="8*" align="left"/>
23406 <colspec colwidth="6*" align="center"/>
23407 <colspec colwidth="6*" align="center"/>
23408 <colspec colwidth="6*" align="right"/>
23409 <tbody>
23410 <row>
23411 <entry><option>acl_smtp_mail</option></entry>
23412 <entry>Use: <emphasis>main</emphasis></entry>
23413 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23414 <entry>Default: <emphasis>unset</emphasis></entry>
23415 </row>
23416 </tbody>
23417 </tgroup>
23418 </informaltable>
23419 <para>
23420 <indexterm role="concept">
23421 <primary>MAIL</primary>
23422 <secondary>ACL for</secondary>
23423 </indexterm>
23424 This option defines the ACL that is run when an SMTP MAIL command is
23425 received. See chapter <xref linkend="CHAPACL"/> for further details.
23426 </para>
23427 <para>
23428 <indexterm role="option">
23429 <primary><option>acl_smtp_mailauth</option></primary>
23430 </indexterm>
23431 </para>
23432 <informaltable frame="all">
23433 <tgroup cols="4" colsep="0" rowsep="0">
23434 <colspec colwidth="8*" align="left"/>
23435 <colspec colwidth="6*" align="center"/>
23436 <colspec colwidth="6*" align="center"/>
23437 <colspec colwidth="6*" align="right"/>
23438 <tbody>
23439 <row>
23440 <entry><option>acl_smtp_mailauth</option></entry>
23441 <entry>Use: <emphasis>main</emphasis></entry>
23442 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23443 <entry>Default: <emphasis>unset</emphasis></entry>
23444 </row>
23445 </tbody>
23446 </tgroup>
23447 </informaltable>
23448 <para>
23449 <indexterm role="concept">
23450 <primary>AUTH</primary>
23451 <secondary>on MAIL command</secondary>
23452 </indexterm>
23453 This option defines the ACL that is run when there is an AUTH parameter on
23454 a MAIL command. See chapter <xref linkend="CHAPACL"/> for details of ACLs, and chapter
23455 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
23456 </para>
23457 <para>
23458 <indexterm role="option">
23459 <primary><option>acl_smtp_mime</option></primary>
23460 </indexterm>
23461 </para>
23462 <informaltable frame="all">
23463 <tgroup cols="4" colsep="0" rowsep="0">
23464 <colspec colwidth="8*" align="left"/>
23465 <colspec colwidth="6*" align="center"/>
23466 <colspec colwidth="6*" align="center"/>
23467 <colspec colwidth="6*" align="right"/>
23468 <tbody>
23469 <row>
23470 <entry><option>acl_smtp_mime</option></entry>
23471 <entry>Use: <emphasis>main</emphasis></entry>
23472 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23473 <entry>Default: <emphasis>unset</emphasis></entry>
23474 </row>
23475 </tbody>
23476 </tgroup>
23477 </informaltable>
23478 <para>
23479 <indexterm role="concept">
23480 <primary>MIME content scanning</primary>
23481 <secondary>ACL for</secondary>
23482 </indexterm>
23483 This option is available when Exim is built with the content-scanning
23484 extension. It defines the ACL that is run for each MIME part in a message. See
23485 section <xref linkend="SECTscanmimepart"/> for details.
23486 </para>
23487 <para>
23488 <indexterm role="option">
23489 <primary><option>acl_smtp_notquit</option></primary>
23490 </indexterm>
23491 </para>
23492 <informaltable frame="all">
23493 <tgroup cols="4" colsep="0" rowsep="0">
23494 <colspec colwidth="8*" align="left"/>
23495 <colspec colwidth="6*" align="center"/>
23496 <colspec colwidth="6*" align="center"/>
23497 <colspec colwidth="6*" align="right"/>
23498 <tbody>
23499 <row>
23500 <entry><option>acl_smtp_notquit</option></entry>
23501 <entry>Use: <emphasis>main</emphasis></entry>
23502 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23503 <entry>Default: <emphasis>unset</emphasis></entry>
23504 </row>
23505 </tbody>
23506 </tgroup>
23507 </informaltable>
23508 <para>
23509 <indexterm role="concept">
23510 <primary>not-QUIT, ACL for</primary>
23511 </indexterm>
23512 This option defines the ACL that is run when an SMTP session
23513 ends without a QUIT command being received.
23514 See chapter <xref linkend="CHAPACL"/> for further details.
23515 </para>
23516 <para>
23517 <indexterm role="option">
23518 <primary><option>acl_smtp_predata</option></primary>
23519 </indexterm>
23520 </para>
23521 <informaltable frame="all">
23522 <tgroup cols="4" colsep="0" rowsep="0">
23523 <colspec colwidth="8*" align="left"/>
23524 <colspec colwidth="6*" align="center"/>
23525 <colspec colwidth="6*" align="center"/>
23526 <colspec colwidth="6*" align="right"/>
23527 <tbody>
23528 <row>
23529 <entry><option>acl_smtp_predata</option></entry>
23530 <entry>Use: <emphasis>main</emphasis></entry>
23531 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23532 <entry>Default: <emphasis>unset</emphasis></entry>
23533 </row>
23534 </tbody>
23535 </tgroup>
23536 </informaltable>
23537 <para>
23538 This option defines the ACL that is run when an SMTP DATA command is
23539 received, before the message itself is received. See chapter <xref linkend="CHAPACL"/> for
23540 further details.
23541 </para>
23542 <para>
23543 <indexterm role="option">
23544 <primary><option>acl_smtp_quit</option></primary>
23545 </indexterm>
23546 </para>
23547 <informaltable frame="all">
23548 <tgroup cols="4" colsep="0" rowsep="0">
23549 <colspec colwidth="8*" align="left"/>
23550 <colspec colwidth="6*" align="center"/>
23551 <colspec colwidth="6*" align="center"/>
23552 <colspec colwidth="6*" align="right"/>
23553 <tbody>
23554 <row>
23555 <entry><option>acl_smtp_quit</option></entry>
23556 <entry>Use: <emphasis>main</emphasis></entry>
23557 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23558 <entry>Default: <emphasis>unset</emphasis></entry>
23559 </row>
23560 </tbody>
23561 </tgroup>
23562 </informaltable>
23563 <para>
23564 <indexterm role="concept">
23565 <primary>QUIT, ACL for</primary>
23566 </indexterm>
23567 This option defines the ACL that is run when an SMTP QUIT command is
23568 received. See chapter <xref linkend="CHAPACL"/> for further details.
23569 </para>
23570 <para>
23571 <indexterm role="option">
23572 <primary><option>acl_smtp_rcpt</option></primary>
23573 </indexterm>
23574 </para>
23575 <informaltable frame="all">
23576 <tgroup cols="4" colsep="0" rowsep="0">
23577 <colspec colwidth="8*" align="left"/>
23578 <colspec colwidth="6*" align="center"/>
23579 <colspec colwidth="6*" align="center"/>
23580 <colspec colwidth="6*" align="right"/>
23581 <tbody>
23582 <row>
23583 <entry><option>acl_smtp_rcpt</option></entry>
23584 <entry>Use: <emphasis>main</emphasis></entry>
23585 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23586 <entry>Default: <emphasis>unset</emphasis></entry>
23587 </row>
23588 </tbody>
23589 </tgroup>
23590 </informaltable>
23591 <para>
23592 <indexterm role="concept">
23593 <primary>RCPT</primary>
23594 <secondary>ACL for</secondary>
23595 </indexterm>
23596 This option defines the ACL that is run when an SMTP RCPT command is
23597 received. See chapter <xref linkend="CHAPACL"/> for further details.
23598 </para>
23599 <para>
23600 <indexterm role="option">
23601 <primary><option>acl_smtp_starttls</option></primary>
23602 </indexterm>
23603 </para>
23604 <informaltable frame="all">
23605 <tgroup cols="4" colsep="0" rowsep="0">
23606 <colspec colwidth="8*" align="left"/>
23607 <colspec colwidth="6*" align="center"/>
23608 <colspec colwidth="6*" align="center"/>
23609 <colspec colwidth="6*" align="right"/>
23610 <tbody>
23611 <row>
23612 <entry><option>acl_smtp_starttls</option></entry>
23613 <entry>Use: <emphasis>main</emphasis></entry>
23614 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23615 <entry>Default: <emphasis>unset</emphasis></entry>
23616 </row>
23617 </tbody>
23618 </tgroup>
23619 </informaltable>
23620 <para>
23621 <indexterm role="concept">
23622 <primary>STARTTLS, ACL for</primary>
23623 </indexterm>
23624 This option defines the ACL that is run when an SMTP STARTTLS command is
23625 received. See chapter <xref linkend="CHAPACL"/> for further details.
23626 </para>
23627 <para>
23628 <indexterm role="option">
23629 <primary><option>acl_smtp_vrfy</option></primary>
23630 </indexterm>
23631 </para>
23632 <informaltable frame="all">
23633 <tgroup cols="4" colsep="0" rowsep="0">
23634 <colspec colwidth="8*" align="left"/>
23635 <colspec colwidth="6*" align="center"/>
23636 <colspec colwidth="6*" align="center"/>
23637 <colspec colwidth="6*" align="right"/>
23638 <tbody>
23639 <row>
23640 <entry><option>acl_smtp_vrfy</option></entry>
23641 <entry>Use: <emphasis>main</emphasis></entry>
23642 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23643 <entry>Default: <emphasis>unset</emphasis></entry>
23644 </row>
23645 </tbody>
23646 </tgroup>
23647 </informaltable>
23648 <para>
23649 <indexterm role="concept">
23650 <primary>VRFY</primary>
23651 <secondary>ACL for</secondary>
23652 </indexterm>
23653 This option defines the ACL that is run when an SMTP VRFY command is
23654 received. See chapter <xref linkend="CHAPACL"/> for further details.
23655 </para>
23656 <para>
23657 <indexterm role="option">
23658 <primary><option>add_environment</option></primary>
23659 </indexterm>
23660 </para>
23661 <informaltable frame="all">
23662 <tgroup cols="4" colsep="0" rowsep="0">
23663 <colspec colwidth="8*" align="left"/>
23664 <colspec colwidth="6*" align="center"/>
23665 <colspec colwidth="6*" align="center"/>
23666 <colspec colwidth="6*" align="right"/>
23667 <tbody>
23668 <row>
23669 <entry><option>add_environment</option></entry>
23670 <entry>Use: <emphasis>main</emphasis></entry>
23671 <entry>Type: <emphasis>string list</emphasis></entry>
23672 <entry>Default: <emphasis>empty</emphasis></entry>
23673 </row>
23674 </tbody>
23675 </tgroup>
23676 </informaltable>
23677 <para>
23678 <indexterm role="concept">
23679 <primary>environment</primary>
23680 <secondary>set values</secondary>
23681 </indexterm>
23682 This option allows to set individual environment variables that the
23683 currently linked libraries and programs in child processes use.
23684 See <xref linkend="SECTpipeenv"/> for the environment of <command>pipe</command> transports.
23685 </para>
23686 <para>
23687 <indexterm role="option">
23688 <primary><option>admin_groups</option></primary>
23689 </indexterm>
23690 </para>
23691 <informaltable frame="all">
23692 <tgroup cols="4" colsep="0" rowsep="0">
23693 <colspec colwidth="8*" align="left"/>
23694 <colspec colwidth="6*" align="center"/>
23695 <colspec colwidth="6*" align="center"/>
23696 <colspec colwidth="6*" align="right"/>
23697 <tbody>
23698 <row>
23699 <entry><option>admin_groups</option></entry>
23700 <entry>Use: <emphasis>main</emphasis></entry>
23701 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
23702 <entry>Default: <emphasis>unset</emphasis></entry>
23703 </row>
23704 </tbody>
23705 </tgroup>
23706 </informaltable>
23707 <para>
23708 <indexterm role="concept">
23709 <primary>admin user</primary>
23710 </indexterm>
23711 This option is expanded just once, at the start of Exim&#x2019;s processing. If the
23712 current group or any of the supplementary groups of an Exim caller is in this
23713 colon-separated list, the caller has admin privileges. If all your system
23714 programmers are in a specific group, for example, you can give them all Exim
23715 admin privileges by putting that group in <option>admin_groups</option>. However, this does
23716 not permit them to read Exim&#x2019;s spool files (whose group owner is the Exim gid).
23717 To permit this, you have to add individuals to the Exim group.
23718 </para>
23719 <para>
23720 <indexterm role="option">
23721 <primary><option>allow_domain_literals</option></primary>
23722 </indexterm>
23723 </para>
23724 <informaltable frame="all">
23725 <tgroup cols="4" colsep="0" rowsep="0">
23726 <colspec colwidth="8*" align="left"/>
23727 <colspec colwidth="6*" align="center"/>
23728 <colspec colwidth="6*" align="center"/>
23729 <colspec colwidth="6*" align="right"/>
23730 <tbody>
23731 <row>
23732 <entry><option>allow_domain_literals</option></entry>
23733 <entry>Use: <emphasis>main</emphasis></entry>
23734 <entry>Type: <emphasis>boolean</emphasis></entry>
23735 <entry>Default: <emphasis>false</emphasis></entry>
23736 </row>
23737 </tbody>
23738 </tgroup>
23739 </informaltable>
23740 <para>
23741 <indexterm role="concept">
23742 <primary>domain literal</primary>
23743 </indexterm>
23744 If this option is set, the RFC 2822 domain literal format is permitted in
23745 email addresses. The option is not set by default, because the domain literal
23746 format is not normally required these days, and few people know about it. It
23747 has, however, been exploited by mail abusers.
23748 </para>
23749 <para>
23750 Unfortunately, it seems that some DNS black list maintainers are using this
23751 format to report black listing to postmasters. If you want to accept messages
23752 addressed to your hosts by IP address, you need to set
23753 <option>allow_domain_literals</option> true, and also to add <literal>@[]</literal> to the list of local
23754 domains (defined in the named domain list <option>local_domains</option> in the default
23755 configuration). This <quote>magic string</quote> matches the domain literal form of all
23756 the local host&#x2019;s IP addresses.
23757 </para>
23758 <para>
23759 <indexterm role="option">
23760 <primary><option>allow_mx_to_ip</option></primary>
23761 </indexterm>
23762 </para>
23763 <informaltable frame="all">
23764 <tgroup cols="4" colsep="0" rowsep="0">
23765 <colspec colwidth="8*" align="left"/>
23766 <colspec colwidth="6*" align="center"/>
23767 <colspec colwidth="6*" align="center"/>
23768 <colspec colwidth="6*" align="right"/>
23769 <tbody>
23770 <row>
23771 <entry><option>allow_mx_to_ip</option></entry>
23772 <entry>Use: <emphasis>main</emphasis></entry>
23773 <entry>Type: <emphasis>boolean</emphasis></entry>
23774 <entry>Default: <emphasis>false</emphasis></entry>
23775 </row>
23776 </tbody>
23777 </tgroup>
23778 </informaltable>
23779 <para>
23780 <indexterm role="concept">
23781 <primary>MX record</primary>
23782 <secondary>pointing to IP address</secondary>
23783 </indexterm>
23784 It appears that more and more DNS zone administrators are breaking the rules
23785 and putting domain names that look like IP addresses on the right hand side of
23786 MX records. Exim follows the rules and rejects this, giving an error message
23787 that explains the misconfiguration. However, some other MTAs support this
23788 practice, so to avoid <quote>Why can&#x2019;t Exim do this?</quote> complaints,
23789 <option>allow_mx_to_ip</option> exists, in order to enable this heinous activity. It is not
23790 recommended, except when you have no other choice.
23791 </para>
23792 <para>
23793 <indexterm role="option">
23794 <primary><option>allow_utf8_domains</option></primary>
23795 </indexterm>
23796 </para>
23797 <informaltable frame="all">
23798 <tgroup cols="4" colsep="0" rowsep="0">
23799 <colspec colwidth="8*" align="left"/>
23800 <colspec colwidth="6*" align="center"/>
23801 <colspec colwidth="6*" align="center"/>
23802 <colspec colwidth="6*" align="right"/>
23803 <tbody>
23804 <row>
23805 <entry><option>allow_utf8_domains</option></entry>
23806 <entry>Use: <emphasis>main</emphasis></entry>
23807 <entry>Type: <emphasis>boolean</emphasis></entry>
23808 <entry>Default: <emphasis>false</emphasis></entry>
23809 </row>
23810 </tbody>
23811 </tgroup>
23812 </informaltable>
23813 <para>
23814 <indexterm role="concept">
23815 <primary>domain</primary>
23816 <secondary>UTF-8 characters in</secondary>
23817 </indexterm>
23818 <indexterm role="concept">
23819 <primary>UTF-8</primary>
23820 <secondary>in domain name</secondary>
23821 </indexterm>
23822 Lots of discussion is going on about internationalized domain names. One
23823 camp is strongly in favour of just using UTF-8 characters, and it seems
23824 that at least two other MTAs permit this. This option allows Exim users to
23825 experiment if they wish.
23826 </para>
23827 <para>
23828 If it is set true, Exim&#x2019;s domain parsing function allows valid
23829 UTF-8 multicharacters to appear in domain name components, in addition to
23830 letters, digits, and hyphens. However, just setting this option is not
23831 enough; if you want to look up these domain names in the DNS, you must also
23832 adjust the value of <option>dns_check_names_pattern</option> to match the extended form. A
23833 suitable setting is:
23834 </para>
23835 <literallayout class="monospaced">
23836 dns_check_names_pattern = (?i)^(?&gt;(?(1)\.|())[a-z0-9\xc0-\xff]\
23837   (?&gt;[-a-z0-9\x80-\xff]*[a-z0-9\x80-\xbf])?)+$
23838 </literallayout>
23839 <para>
23840 Alternatively, you can just disable this feature by setting
23841 </para>
23842 <literallayout class="monospaced">
23843 dns_check_names_pattern =
23844 </literallayout>
23845 <para>
23846 That is, set the option to an empty string so that no check is done.
23847 </para>
23848 <para>
23849 <indexterm role="option">
23850 <primary><option>auth_advertise_hosts</option></primary>
23851 </indexterm>
23852 </para>
23853 <informaltable frame="all">
23854 <tgroup cols="4" colsep="0" rowsep="0">
23855 <colspec colwidth="8*" align="left"/>
23856 <colspec colwidth="6*" align="center"/>
23857 <colspec colwidth="6*" align="center"/>
23858 <colspec colwidth="6*" align="right"/>
23859 <tbody>
23860 <row>
23861 <entry><option>auth_advertise_hosts</option></entry>
23862 <entry>Use: <emphasis>main</emphasis></entry>
23863 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
23864 <entry>Default: <emphasis>*</emphasis></entry>
23865 </row>
23866 </tbody>
23867 </tgroup>
23868 </informaltable>
23869 <para>
23870 <indexterm role="concept">
23871 <primary>authentication</primary>
23872 <secondary>advertising</secondary>
23873 </indexterm>
23874 <indexterm role="concept">
23875 <primary>AUTH</primary>
23876 <secondary>advertising</secondary>
23877 </indexterm>
23878 If any server authentication mechanisms are configured, Exim advertises them in
23879 response to an EHLO command only if the calling host matches this list.
23880 Otherwise, Exim does not advertise AUTH.
23881 Exim does not accept AUTH commands from clients to which it has not
23882 advertised the availability of AUTH. The advertising of individual
23883 authentication mechanisms can be controlled by the use of the
23884 <option>server_advertise_condition</option> generic authenticator option on the individual
23885 authenticators. See chapter <xref linkend="CHAPSMTPAUTH"/> for further details.
23886 </para>
23887 <para>
23888 Certain mail clients (for example, Netscape) require the user to provide a name
23889 and password for authentication if AUTH is advertised, even though it may
23890 not be needed (the host may accept messages from hosts on its local LAN without
23891 authentication, for example). The <option>auth_advertise_hosts</option> option can be used
23892 to make these clients more friendly by excluding them from the set of hosts to
23893 which Exim advertises AUTH.
23894 </para>
23895 <para>
23896 <indexterm role="concept">
23897 <primary>AUTH</primary>
23898 <secondary>advertising when encrypted</secondary>
23899 </indexterm>
23900 If you want to advertise the availability of AUTH only when the connection
23901 is encrypted using TLS, you can make use of the fact that the value of this
23902 option is expanded, with a setting like this:
23903 </para>
23904 <literallayout class="monospaced">
23905 auth_advertise_hosts = ${if eq{$tls_in_cipher}{}{}{*}}
23906 </literallayout>
23907 <para>
23908 <indexterm role="variable">
23909 <primary><varname>$tls_in_cipher</varname></primary>
23910 </indexterm>
23911 If <varname>$tls_in_cipher</varname> is empty, the session is not encrypted, and the result of
23912 the expansion is empty, thus matching no hosts. Otherwise, the result of the
23913 expansion is *, which matches all hosts.
23914 </para>
23915 <para>
23916 <indexterm role="option">
23917 <primary><option>auto_thaw</option></primary>
23918 </indexterm>
23919 </para>
23920 <informaltable frame="all">
23921 <tgroup cols="4" colsep="0" rowsep="0">
23922 <colspec colwidth="8*" align="left"/>
23923 <colspec colwidth="6*" align="center"/>
23924 <colspec colwidth="6*" align="center"/>
23925 <colspec colwidth="6*" align="right"/>
23926 <tbody>
23927 <row>
23928 <entry><option>auto_thaw</option></entry>
23929 <entry>Use: <emphasis>main</emphasis></entry>
23930 <entry>Type: <emphasis>time</emphasis></entry>
23931 <entry>Default: <emphasis>0s</emphasis></entry>
23932 </row>
23933 </tbody>
23934 </tgroup>
23935 </informaltable>
23936 <para>
23937 <indexterm role="concept">
23938 <primary>thawing messages</primary>
23939 </indexterm>
23940 <indexterm role="concept">
23941 <primary>unfreezing messages</primary>
23942 </indexterm>
23943 If this option is set to a time greater than zero, a queue runner will try a
23944 new delivery attempt on any frozen message, other than a bounce message, if
23945 this much time has passed since it was frozen. This may result in the message
23946 being re-frozen if nothing has changed since the last attempt. It is a way of
23947 saying <quote>keep on trying, even though there are big problems</quote>.
23948 </para>
23949 <para>
23950 <emphasis role="bold">Note</emphasis>: This is an old option, which predates <option>timeout_frozen_after</option> and
23951 <option>ignore_bounce_errors_after</option>. It is retained for compatibility, but it is not
23952 thought to be very useful any more, and its use should probably be avoided.
23953 </para>
23954 <para>
23955 <indexterm role="option">
23956 <primary><option>av_scanner</option></primary>
23957 </indexterm>
23958 </para>
23959 <informaltable frame="all">
23960 <tgroup cols="4" colsep="0" rowsep="0">
23961 <colspec colwidth="8*" align="left"/>
23962 <colspec colwidth="6*" align="center"/>
23963 <colspec colwidth="6*" align="center"/>
23964 <colspec colwidth="6*" align="right"/>
23965 <tbody>
23966 <row>
23967 <entry><option>av_scanner</option></entry>
23968 <entry>Use: <emphasis>main</emphasis></entry>
23969 <entry>Type: <emphasis>string</emphasis></entry>
23970 <entry>Default: <emphasis>see below</emphasis></entry>
23971 </row>
23972 </tbody>
23973 </tgroup>
23974 </informaltable>
23975 <para>
23976 This option is available if Exim is built with the content-scanning extension.
23977 It specifies which anti-virus scanner to use. The default value is:
23978 </para>
23979 <literallayout class="monospaced">
23980 sophie:/var/run/sophie
23981 </literallayout>
23982 <para>
23983 If the value of <option>av_scanner</option> starts with a dollar character, it is expanded
23984 before use. See section <xref linkend="SECTscanvirus"/> for further details.
23985 </para>
23986 <para>
23987 <indexterm role="option">
23988 <primary><option>bi_command</option></primary>
23989 </indexterm>
23990 </para>
23991 <informaltable frame="all">
23992 <tgroup cols="4" colsep="0" rowsep="0">
23993 <colspec colwidth="8*" align="left"/>
23994 <colspec colwidth="6*" align="center"/>
23995 <colspec colwidth="6*" align="center"/>
23996 <colspec colwidth="6*" align="right"/>
23997 <tbody>
23998 <row>
23999 <entry><option>bi_command</option></entry>
24000 <entry>Use: <emphasis>main</emphasis></entry>
24001 <entry>Type: <emphasis>string</emphasis></entry>
24002 <entry>Default: <emphasis>unset</emphasis></entry>
24003 </row>
24004 </tbody>
24005 </tgroup>
24006 </informaltable>
24007 <para>
24008 <indexterm role="option">
24009 <primary><option>-bi</option></primary>
24010 </indexterm>
24011 This option supplies the name of a command that is run when Exim is called with
24012 the <option>-bi</option> option (see chapter <xref linkend="CHAPcommandline"/>). The string value is
24013 just the command name, it is not a complete command line. If an argument is
24014 required, it must come from the <option>-oA</option> command line option.
24015 </para>
24016 <para>
24017 <indexterm role="option">
24018 <primary><option>bounce_message_file</option></primary>
24019 </indexterm>
24020 </para>
24021 <informaltable frame="all">
24022 <tgroup cols="4" colsep="0" rowsep="0">
24023 <colspec colwidth="8*" align="left"/>
24024 <colspec colwidth="6*" align="center"/>
24025 <colspec colwidth="6*" align="center"/>
24026 <colspec colwidth="6*" align="right"/>
24027 <tbody>
24028 <row>
24029 <entry><option>bounce_message_file</option></entry>
24030 <entry>Use: <emphasis>main</emphasis></entry>
24031 <entry>Type: <emphasis>string</emphasis></entry>
24032 <entry>Default: <emphasis>unset</emphasis></entry>
24033 </row>
24034 </tbody>
24035 </tgroup>
24036 </informaltable>
24037 <para>
24038 <indexterm role="concept">
24039 <primary>bounce message</primary>
24040 <secondary>customizing</secondary>
24041 </indexterm>
24042 <indexterm role="concept">
24043 <primary>customizing</primary>
24044 <secondary>bounce message</secondary>
24045 </indexterm>
24046 This option defines a template file containing paragraphs of text to be used
24047 for constructing bounce messages.  Details of the file&#x2019;s contents are given in
24048 chapter <xref linkend="CHAPemsgcust"/>. See also <option>warn_message_file</option>.
24049 </para>
24050 <para>
24051 <indexterm role="option">
24052 <primary><option>bounce_message_text</option></primary>
24053 </indexterm>
24054 </para>
24055 <informaltable frame="all">
24056 <tgroup cols="4" colsep="0" rowsep="0">
24057 <colspec colwidth="8*" align="left"/>
24058 <colspec colwidth="6*" align="center"/>
24059 <colspec colwidth="6*" align="center"/>
24060 <colspec colwidth="6*" align="right"/>
24061 <tbody>
24062 <row>
24063 <entry><option>bounce_message_text</option></entry>
24064 <entry>Use: <emphasis>main</emphasis></entry>
24065 <entry>Type: <emphasis>string</emphasis></entry>
24066 <entry>Default: <emphasis>unset</emphasis></entry>
24067 </row>
24068 </tbody>
24069 </tgroup>
24070 </informaltable>
24071 <para>
24072 When this option is set, its contents are included in the default bounce
24073 message immediately after <quote>This message was created automatically by mail
24074 delivery software.</quote> It is not used if <option>bounce_message_file</option> is set.
24075 </para>
24076 <para>
24077 <indexterm role="option">
24078 <primary><option>bounce_return_body</option></primary>
24079 </indexterm>
24080 </para>
24081 <informaltable frame="all">
24082 <tgroup cols="4" colsep="0" rowsep="0">
24083 <colspec colwidth="8*" align="left"/>
24084 <colspec colwidth="6*" align="center"/>
24085 <colspec colwidth="6*" align="center"/>
24086 <colspec colwidth="6*" align="right"/>
24087 <tbody>
24088 <row>
24089 <entry><option>bounce_return_body</option></entry>
24090 <entry>Use: <emphasis>main</emphasis></entry>
24091 <entry>Type: <emphasis>boolean</emphasis></entry>
24092 <entry>Default: <emphasis>true</emphasis></entry>
24093 </row>
24094 </tbody>
24095 </tgroup>
24096 </informaltable>
24097 <para>
24098 <indexterm role="concept">
24099 <primary>bounce message</primary>
24100 <secondary>including body</secondary>
24101 </indexterm>
24102 This option controls whether the body of an incoming message is included in a
24103 bounce message when <option>bounce_return_message</option> is true. The default setting
24104 causes the entire message, both header and body, to be returned (subject to the
24105 value of <option>bounce_return_size_limit</option>). If this option is false, only the
24106 message header is included. In the case of a non-SMTP message containing an
24107 error that is detected during reception, only those header lines preceding the
24108 point at which the error was detected are returned.
24109 <indexterm role="concept">
24110 <primary>bounce message</primary>
24111 <secondary>including original</secondary>
24112 </indexterm>
24113 </para>
24114 <para>
24115 <indexterm role="option">
24116 <primary><option>bounce_return_linesize_limit</option></primary>
24117 </indexterm>
24118 </para>
24119 <informaltable frame="all">
24120 <tgroup cols="4" colsep="0" rowsep="0">
24121 <colspec colwidth="8*" align="left"/>
24122 <colspec colwidth="6*" align="center"/>
24123 <colspec colwidth="6*" align="center"/>
24124 <colspec colwidth="6*" align="right"/>
24125 <tbody>
24126 <row>
24127 <entry><option>bounce_return_linesize_limit</option></entry>
24128 <entry>Use: <emphasis>main</emphasis></entry>
24129 <entry>Type: <emphasis>integer</emphasis></entry>
24130 <entry>Default: <emphasis>998</emphasis></entry>
24131 </row>
24132 </tbody>
24133 </tgroup>
24134 </informaltable>
24135 <para>
24136 <indexterm role="concept">
24137 <primary>size</primary>
24138 <secondary>of bounce lines, limit</secondary>
24139 </indexterm>
24140 <indexterm role="concept">
24141 <primary>bounce message</primary>
24142 <secondary>line length limit</secondary>
24143 </indexterm>
24144 <indexterm role="concept">
24145 <primary>limit</primary>
24146 <secondary>bounce message line length</secondary>
24147 </indexterm>
24148 This option sets a limit in bytes on the line length of messages
24149 that are returned to senders due to delivery problems,
24150 when <option>bounce_return_message</option> is true.
24151 The default value corresponds to RFC limits.
24152 If the message being returned has lines longer than this value it is
24153 treated as if the <option>bounce_return_size_limit</option> (below) restriction was exceeded.
24154 </para>
24155 <para>
24156 The option also applies to bounces returned when an error is detected
24157 during reception of a message.
24158 In this case lines from the original are truncated.
24159 </para>
24160 <para>
24161 The option does not apply to messages generated by an <command>autoreply</command> transport.
24162 </para>
24163 <para>
24164 <indexterm role="option">
24165 <primary><option>bounce_return_message</option></primary>
24166 </indexterm>
24167 </para>
24168 <informaltable frame="all">
24169 <tgroup cols="4" colsep="0" rowsep="0">
24170 <colspec colwidth="8*" align="left"/>
24171 <colspec colwidth="6*" align="center"/>
24172 <colspec colwidth="6*" align="center"/>
24173 <colspec colwidth="6*" align="right"/>
24174 <tbody>
24175 <row>
24176 <entry><option>bounce_return_message</option></entry>
24177 <entry>Use: <emphasis>main</emphasis></entry>
24178 <entry>Type: <emphasis>boolean</emphasis></entry>
24179 <entry>Default: <emphasis>true</emphasis></entry>
24180 </row>
24181 </tbody>
24182 </tgroup>
24183 </informaltable>
24184 <para>
24185 If this option is set false, none of the original message is included in
24186 bounce messages generated by Exim. See also <option>bounce_return_size_limit</option> and
24187 <option>bounce_return_body</option>.
24188 </para>
24189 <para>
24190 <indexterm role="option">
24191 <primary><option>bounce_return_size_limit</option></primary>
24192 </indexterm>
24193 </para>
24194 <informaltable frame="all">
24195 <tgroup cols="4" colsep="0" rowsep="0">
24196 <colspec colwidth="8*" align="left"/>
24197 <colspec colwidth="6*" align="center"/>
24198 <colspec colwidth="6*" align="center"/>
24199 <colspec colwidth="6*" align="right"/>
24200 <tbody>
24201 <row>
24202 <entry><option>bounce_return_size_limit</option></entry>
24203 <entry>Use: <emphasis>main</emphasis></entry>
24204 <entry>Type: <emphasis>integer</emphasis></entry>
24205 <entry>Default: <emphasis>100K</emphasis></entry>
24206 </row>
24207 </tbody>
24208 </tgroup>
24209 </informaltable>
24210 <para>
24211 <indexterm role="concept">
24212 <primary>size</primary>
24213 <secondary>of bounce, limit</secondary>
24214 </indexterm>
24215 <indexterm role="concept">
24216 <primary>bounce message</primary>
24217 <secondary>size limit</secondary>
24218 </indexterm>
24219 <indexterm role="concept">
24220 <primary>limit</primary>
24221 <secondary>bounce message size</secondary>
24222 </indexterm>
24223 This option sets a limit in bytes on the size of messages that are returned to
24224 senders as part of bounce messages when <option>bounce_return_message</option> is true. The
24225 limit should be less than the value of the global <option>message_size_limit</option> and of
24226 any <option>message_size_limit</option> settings on transports, to allow for the bounce text
24227 that Exim generates. If this option is set to zero there is no limit.
24228 </para>
24229 <para>
24230 When the body of any message that is to be included in a bounce message is
24231 greater than the limit, it is truncated, and a comment pointing this out is
24232 added at the top. The actual cutoff may be greater than the value given, owing
24233 to the use of buffering for transferring the message in chunks (typically 8K in
24234 size). The idea is to save bandwidth on those undeliverable 15-megabyte
24235 messages.
24236 </para>
24237 <para>
24238 <indexterm role="option">
24239 <primary><option>bounce_sender_authentication</option></primary>
24240 </indexterm>
24241 </para>
24242 <informaltable frame="all">
24243 <tgroup cols="4" colsep="0" rowsep="0">
24244 <colspec colwidth="8*" align="left"/>
24245 <colspec colwidth="6*" align="center"/>
24246 <colspec colwidth="6*" align="center"/>
24247 <colspec colwidth="6*" align="right"/>
24248 <tbody>
24249 <row>
24250 <entry><option>bounce_sender_authentication</option></entry>
24251 <entry>Use: <emphasis>main</emphasis></entry>
24252 <entry>Type: <emphasis>string</emphasis></entry>
24253 <entry>Default: <emphasis>unset</emphasis></entry>
24254 </row>
24255 </tbody>
24256 </tgroup>
24257 </informaltable>
24258 <para>
24259 <indexterm role="concept">
24260 <primary>bounce message</primary>
24261 <secondary>sender authentication</secondary>
24262 </indexterm>
24263 <indexterm role="concept">
24264 <primary>authentication</primary>
24265 <secondary>bounce message</secondary>
24266 </indexterm>
24267 <indexterm role="concept">
24268 <primary>AUTH</primary>
24269 <secondary>on bounce message</secondary>
24270 </indexterm>
24271 This option provides an authenticated sender address that is sent with any
24272 bounce messages generated by Exim that are sent over an authenticated SMTP
24273 connection. A typical setting might be:
24274 </para>
24275 <literallayout class="monospaced">
24276 bounce_sender_authentication = mailer-daemon@my.domain.example
24277 </literallayout>
24278 <para>
24279 which would cause bounce messages to be sent using the SMTP command:
24280 </para>
24281 <literallayout class="monospaced">
24282 MAIL FROM:&lt;&gt; AUTH=mailer-daemon@my.domain.example
24283 </literallayout>
24284 <para>
24285 The value of <option>bounce_sender_authentication</option> must always be a complete email
24286 address.
24287 </para>
24288 <para>
24289 <indexterm role="option">
24290 <primary><option>callout_domain_negative_expire</option></primary>
24291 </indexterm>
24292 </para>
24293 <informaltable frame="all">
24294 <tgroup cols="4" colsep="0" rowsep="0">
24295 <colspec colwidth="8*" align="left"/>
24296 <colspec colwidth="6*" align="center"/>
24297 <colspec colwidth="6*" align="center"/>
24298 <colspec colwidth="6*" align="right"/>
24299 <tbody>
24300 <row>
24301 <entry><option>callout_domain_negative_expire</option></entry>
24302 <entry>Use: <emphasis>main</emphasis></entry>
24303 <entry>Type: <emphasis>time</emphasis></entry>
24304 <entry>Default: <emphasis>3h</emphasis></entry>
24305 </row>
24306 </tbody>
24307 </tgroup>
24308 </informaltable>
24309 <para>
24310 <indexterm role="concept">
24311 <primary>caching</primary>
24312 <secondary>callout timeouts</secondary>
24313 </indexterm>
24314 <indexterm role="concept">
24315 <primary>callout</primary>
24316 <secondary>caching timeouts</secondary>
24317 </indexterm>
24318 This option specifies the expiry time for negative callout cache data for a
24319 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
24320 section <xref linkend="SECTcallvercache"/> for details of the caching.
24321 </para>
24322 <para>
24323 <indexterm role="option">
24324 <primary><option>callout_domain_positive_expire</option></primary>
24325 </indexterm>
24326 </para>
24327 <informaltable frame="all">
24328 <tgroup cols="4" colsep="0" rowsep="0">
24329 <colspec colwidth="8*" align="left"/>
24330 <colspec colwidth="6*" align="center"/>
24331 <colspec colwidth="6*" align="center"/>
24332 <colspec colwidth="6*" align="right"/>
24333 <tbody>
24334 <row>
24335 <entry><option>callout_domain_positive_expire</option></entry>
24336 <entry>Use: <emphasis>main</emphasis></entry>
24337 <entry>Type: <emphasis>time</emphasis></entry>
24338 <entry>Default: <emphasis>7d</emphasis></entry>
24339 </row>
24340 </tbody>
24341 </tgroup>
24342 </informaltable>
24343 <para>
24344 This option specifies the expiry time for positive callout cache data for a
24345 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
24346 section <xref linkend="SECTcallvercache"/> for details of the caching.
24347 </para>
24348 <para>
24349 <indexterm role="option">
24350 <primary><option>callout_negative_expire</option></primary>
24351 </indexterm>
24352 </para>
24353 <informaltable frame="all">
24354 <tgroup cols="4" colsep="0" rowsep="0">
24355 <colspec colwidth="8*" align="left"/>
24356 <colspec colwidth="6*" align="center"/>
24357 <colspec colwidth="6*" align="center"/>
24358 <colspec colwidth="6*" align="right"/>
24359 <tbody>
24360 <row>
24361 <entry><option>callout_negative_expire</option></entry>
24362 <entry>Use: <emphasis>main</emphasis></entry>
24363 <entry>Type: <emphasis>time</emphasis></entry>
24364 <entry>Default: <emphasis>2h</emphasis></entry>
24365 </row>
24366 </tbody>
24367 </tgroup>
24368 </informaltable>
24369 <para>
24370 This option specifies the expiry time for negative callout cache data for an
24371 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
24372 section <xref linkend="SECTcallvercache"/> for details of the caching.
24373 </para>
24374 <para>
24375 <indexterm role="option">
24376 <primary><option>callout_positive_expire</option></primary>
24377 </indexterm>
24378 </para>
24379 <informaltable frame="all">
24380 <tgroup cols="4" colsep="0" rowsep="0">
24381 <colspec colwidth="8*" align="left"/>
24382 <colspec colwidth="6*" align="center"/>
24383 <colspec colwidth="6*" align="center"/>
24384 <colspec colwidth="6*" align="right"/>
24385 <tbody>
24386 <row>
24387 <entry><option>callout_positive_expire</option></entry>
24388 <entry>Use: <emphasis>main</emphasis></entry>
24389 <entry>Type: <emphasis>time</emphasis></entry>
24390 <entry>Default: <emphasis>24h</emphasis></entry>
24391 </row>
24392 </tbody>
24393 </tgroup>
24394 </informaltable>
24395 <para>
24396 This option specifies the expiry time for positive callout cache data for an
24397 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
24398 section <xref linkend="SECTcallvercache"/> for details of the caching.
24399 </para>
24400 <para>
24401 <indexterm role="option">
24402 <primary><option>callout_random_local_part</option></primary>
24403 </indexterm>
24404 </para>
24405 <informaltable frame="all">
24406 <tgroup cols="4" colsep="0" rowsep="0">
24407 <colspec colwidth="8*" align="left"/>
24408 <colspec colwidth="6*" align="center"/>
24409 <colspec colwidth="6*" align="center"/>
24410 <colspec colwidth="6*" align="right"/>
24411 <tbody>
24412 <row>
24413 <entry><option>callout_random_local_part</option></entry>
24414 <entry>Use: <emphasis>main</emphasis></entry>
24415 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24416 <entry>Default: <emphasis>see below</emphasis></entry>
24417 </row>
24418 </tbody>
24419 </tgroup>
24420 </informaltable>
24421 <para>
24422 This option defines the <quote>random</quote> local part that can be used as part of
24423 callout verification. The default value is
24424 </para>
24425 <literallayout class="monospaced">
24426 $primary_hostname-$tod_epoch-testing
24427 </literallayout>
24428 <para>
24429 See section <xref linkend="CALLaddparcall"/> for details of how this value is used.
24430 </para>
24431 <para>
24432 <indexterm role="option">
24433 <primary><option>check_log_inodes</option></primary>
24434 </indexterm>
24435 </para>
24436 <informaltable frame="all">
24437 <tgroup cols="4" colsep="0" rowsep="0">
24438 <colspec colwidth="8*" align="left"/>
24439 <colspec colwidth="6*" align="center"/>
24440 <colspec colwidth="6*" align="center"/>
24441 <colspec colwidth="6*" align="right"/>
24442 <tbody>
24443 <row>
24444 <entry><option>check_log_inodes</option></entry>
24445 <entry>Use: <emphasis>main</emphasis></entry>
24446 <entry>Type: <emphasis>integer</emphasis></entry>
24447 <entry>Default: <emphasis>100</emphasis></entry>
24448 </row>
24449 </tbody>
24450 </tgroup>
24451 </informaltable>
24452 <para>
24453 See <option>check_spool_space</option> below.
24454 </para>
24455 <para>
24456 <indexterm role="option">
24457 <primary><option>check_log_space</option></primary>
24458 </indexterm>
24459 </para>
24460 <informaltable frame="all">
24461 <tgroup cols="4" colsep="0" rowsep="0">
24462 <colspec colwidth="8*" align="left"/>
24463 <colspec colwidth="6*" align="center"/>
24464 <colspec colwidth="6*" align="center"/>
24465 <colspec colwidth="6*" align="right"/>
24466 <tbody>
24467 <row>
24468 <entry><option>check_log_space</option></entry>
24469 <entry>Use: <emphasis>main</emphasis></entry>
24470 <entry>Type: <emphasis>integer</emphasis></entry>
24471 <entry>Default: <emphasis>10M</emphasis></entry>
24472 </row>
24473 </tbody>
24474 </tgroup>
24475 </informaltable>
24476 <para>
24477 See <option>check_spool_space</option> below.
24478 </para>
24479 <para>
24480 <indexterm role="option">
24481 <primary><option>check_rfc2047_length</option></primary>
24482 </indexterm>
24483 <indexterm role="concept">
24484 <primary>RFC 2047</primary>
24485 <secondary>disabling length check</secondary>
24486 </indexterm>
24487 <indexterm role="option">
24488 <primary><option>check_rfc2047_length</option></primary>
24489 </indexterm>
24490 </para>
24491 <informaltable frame="all">
24492 <tgroup cols="4" colsep="0" rowsep="0">
24493 <colspec colwidth="8*" align="left"/>
24494 <colspec colwidth="6*" align="center"/>
24495 <colspec colwidth="6*" align="center"/>
24496 <colspec colwidth="6*" align="right"/>
24497 <tbody>
24498 <row>
24499 <entry><option>check_rfc2047_length</option></entry>
24500 <entry>Use: <emphasis>main</emphasis></entry>
24501 <entry>Type: <emphasis>boolean</emphasis></entry>
24502 <entry>Default: <emphasis>true</emphasis></entry>
24503 </row>
24504 </tbody>
24505 </tgroup>
24506 </informaltable>
24507 <para>
24508 RFC 2047 defines a way of encoding non-ASCII characters in headers using a
24509 system of <quote>encoded words</quote>. The RFC specifies a maximum length for an encoded
24510 word; strings to be encoded that exceed this length are supposed to use
24511 multiple encoded words. By default, Exim does not recognize encoded words that
24512 exceed the maximum length. However, it seems that some software, in violation
24513 of the RFC, generates overlong encoded words. If <option>check_rfc2047_length</option> is
24514 set false, Exim recognizes encoded words of any length.
24515 </para>
24516 <para>
24517 <indexterm role="option">
24518 <primary><option>check_spool_inodes</option></primary>
24519 </indexterm>
24520 </para>
24521 <informaltable frame="all">
24522 <tgroup cols="4" colsep="0" rowsep="0">
24523 <colspec colwidth="8*" align="left"/>
24524 <colspec colwidth="6*" align="center"/>
24525 <colspec colwidth="6*" align="center"/>
24526 <colspec colwidth="6*" align="right"/>
24527 <tbody>
24528 <row>
24529 <entry><option>check_spool_inodes</option></entry>
24530 <entry>Use: <emphasis>main</emphasis></entry>
24531 <entry>Type: <emphasis>integer</emphasis></entry>
24532 <entry>Default: <emphasis>100</emphasis></entry>
24533 </row>
24534 </tbody>
24535 </tgroup>
24536 </informaltable>
24537 <para>
24538 See <option>check_spool_space</option> below.
24539 </para>
24540 <para>
24541 <indexterm role="option">
24542 <primary><option>check_spool_space</option></primary>
24543 </indexterm>
24544 </para>
24545 <informaltable frame="all">
24546 <tgroup cols="4" colsep="0" rowsep="0">
24547 <colspec colwidth="8*" align="left"/>
24548 <colspec colwidth="6*" align="center"/>
24549 <colspec colwidth="6*" align="center"/>
24550 <colspec colwidth="6*" align="right"/>
24551 <tbody>
24552 <row>
24553 <entry><option>check_spool_space</option></entry>
24554 <entry>Use: <emphasis>main</emphasis></entry>
24555 <entry>Type: <emphasis>integer</emphasis></entry>
24556 <entry>Default: <emphasis>10M</emphasis></entry>
24557 </row>
24558 </tbody>
24559 </tgroup>
24560 </informaltable>
24561 <para>
24562 <indexterm role="concept">
24563 <primary>checking disk space</primary>
24564 </indexterm>
24565 <indexterm role="concept">
24566 <primary>disk space, checking</primary>
24567 </indexterm>
24568 <indexterm role="concept">
24569 <primary>spool directory</primary>
24570 <secondary>checking space</secondary>
24571 </indexterm>
24572 The four <option>check_...</option> options allow for checking of disk resources before a
24573 message is accepted.
24574 </para>
24575 <para>
24576 <indexterm role="variable">
24577 <primary><varname>$log_inodes</varname></primary>
24578 </indexterm>
24579 <indexterm role="variable">
24580 <primary><varname>$log_space</varname></primary>
24581 </indexterm>
24582 <indexterm role="variable">
24583 <primary><varname>$spool_inodes</varname></primary>
24584 </indexterm>
24585 <indexterm role="variable">
24586 <primary><varname>$spool_space</varname></primary>
24587 </indexterm>
24588 When any of these options are nonzero, they apply to all incoming messages. If you
24589 want to apply different checks to different kinds of message, you can do so by
24590 testing the variables <varname>$log_inodes</varname>, <varname>$log_space</varname>, <varname>$spool_inodes</varname>, and
24591 <varname>$spool_space</varname> in an ACL with appropriate additional conditions.
24592 </para>
24593 <para>
24594 <option>check_spool_space</option> and <option>check_spool_inodes</option> check the spool partition if
24595 either value is greater than zero, for example:
24596 </para>
24597 <literallayout class="monospaced">
24598 check_spool_space = 100M
24599 check_spool_inodes = 100
24600 </literallayout>
24601 <para>
24602 The spool partition is the one that contains the directory defined by
24603 SPOOL_DIRECTORY in <filename>Local/Makefile</filename>. It is used for holding messages in
24604 transit.
24605 </para>
24606 <para>
24607 <option>check_log_space</option> and <option>check_log_inodes</option>  check the partition in which log
24608 files are written if either is greater than zero. These should be set only if
24609 <option>log_file_path</option> and <option>spool_directory</option> refer to different partitions.
24610 </para>
24611 <para>
24612 If there is less space or fewer inodes than requested, Exim refuses to accept
24613 incoming mail. In the case of SMTP input this is done by giving a 452 temporary
24614 error response to the MAIL command. If ESMTP is in use and there was a
24615 SIZE parameter on the MAIL command, its value is added to the
24616 <option>check_spool_space</option> value, and the check is performed even if
24617 <option>check_spool_space</option> is zero, unless <option>no_smtp_check_spool_space</option> is set.
24618 </para>
24619 <para>
24620 The values for <option>check_spool_space</option> and <option>check_log_space</option> are held as a
24621 number of kilobytes (though specified in bytes).
24622 If a non-multiple of 1024 is specified, it is rounded up.
24623 </para>
24624 <para>
24625 For non-SMTP input and for batched SMTP input, the test is done at start-up; on
24626 failure a message is written to stderr and Exim exits with a non-zero code, as
24627 it obviously cannot send an error message of any kind.
24628 </para>
24629 <para>
24630 There is a slight performance penalty for these checks.
24631 Versions of Exim preceding 4.88 had these disabled by default;
24632 high-rate installations confident they will never run out of resources
24633 may wish to deliberately disable them.
24634 </para>
24635 <para>
24636 <indexterm role="option">
24637 <primary><option>chunking_advertise_hosts</option></primary>
24638 </indexterm>
24639 </para>
24640 <informaltable frame="all">
24641 <tgroup cols="4" colsep="0" rowsep="0">
24642 <colspec colwidth="8*" align="left"/>
24643 <colspec colwidth="6*" align="center"/>
24644 <colspec colwidth="6*" align="center"/>
24645 <colspec colwidth="6*" align="right"/>
24646 <tbody>
24647 <row>
24648 <entry><option>chunking_advertise_hosts</option></entry>
24649 <entry>Use: <emphasis>main</emphasis></entry>
24650 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
24651 <entry>Default: <emphasis>*</emphasis></entry>
24652 </row>
24653 </tbody>
24654 </tgroup>
24655 </informaltable>
24656 <para>
24657 <indexterm role="concept">
24658 <primary>CHUNKING</primary>
24659 <secondary>advertisement</secondary>
24660 </indexterm>
24661 <indexterm role="concept">
24662 <primary>RFC 3030</primary>
24663 <secondary>CHUNKING</secondary>
24664 </indexterm>
24665 The CHUNKING extension (RFC3030) will be advertised in the EHLO message to
24666 these hosts.
24667 Hosts may use the BDAT command as an alternate to DATA.
24668 </para>
24669 <para>
24670 <indexterm role="option">
24671 <primary><option>commandline_checks_require_admin</option></primary>
24672 </indexterm>
24673 </para>
24674 <informaltable frame="all">
24675 <tgroup cols="4" colsep="0" rowsep="0">
24676 <colspec colwidth="8*" align="left"/>
24677 <colspec colwidth="6*" align="center"/>
24678 <colspec colwidth="6*" align="center"/>
24679 <colspec colwidth="6*" align="right"/>
24680 <tbody>
24681 <row>
24682 <entry><option>commandline_checks_require_admin</option></entry>
24683 <entry>Use: <emphasis>main</emphasis></entry>
24684 <entry>Type: <emphasis>boolean</emphasis></entry>
24685 <entry>Default: <emphasis><literal>false</literal></emphasis></entry>
24686 </row>
24687 </tbody>
24688 </tgroup>
24689 </informaltable>
24690 <para>
24691 <indexterm role="concept">
24692 <primary>restricting access to features</primary>
24693 </indexterm>
24694 This option restricts various basic checking features to require an
24695 administrative user.
24696 This affects most of the <option>-b*</option> options, such as <option>-be</option>.
24697 </para>
24698 <para>
24699 <indexterm role="option">
24700 <primary><option>debug_store</option></primary>
24701 </indexterm>
24702 </para>
24703 <informaltable frame="all">
24704 <tgroup cols="4" colsep="0" rowsep="0">
24705 <colspec colwidth="8*" align="left"/>
24706 <colspec colwidth="6*" align="center"/>
24707 <colspec colwidth="6*" align="center"/>
24708 <colspec colwidth="6*" align="right"/>
24709 <tbody>
24710 <row>
24711 <entry><option>debug_store</option></entry>
24712 <entry>Use: <emphasis>main</emphasis></entry>
24713 <entry>Type: <emphasis>boolean</emphasis></entry>
24714 <entry>Default: <emphasis><literal>false</literal></emphasis></entry>
24715 </row>
24716 </tbody>
24717 </tgroup>
24718 </informaltable>
24719 <para>
24720 <indexterm role="concept">
24721 <primary>debugging</primary>
24722 <secondary>memory corruption</secondary>
24723 </indexterm>
24724 <indexterm role="concept">
24725 <primary>memory</primary>
24726 <secondary>debugging</secondary>
24727 </indexterm>
24728 This option, when true, enables extra checking in Exim&#x2019;s internal memory
24729 management.  For use when a memory corruption issue is being investigated,
24730 it should normally be left as default.
24731 </para>
24732 <para>
24733 <indexterm role="option">
24734 <primary><option>daemon_smtp_ports</option></primary>
24735 </indexterm>
24736 </para>
24737 <informaltable frame="all">
24738 <tgroup cols="4" colsep="0" rowsep="0">
24739 <colspec colwidth="8*" align="left"/>
24740 <colspec colwidth="6*" align="center"/>
24741 <colspec colwidth="6*" align="center"/>
24742 <colspec colwidth="6*" align="right"/>
24743 <tbody>
24744 <row>
24745 <entry><option>daemon_smtp_ports</option></entry>
24746 <entry>Use: <emphasis>main</emphasis></entry>
24747 <entry>Type: <emphasis>string</emphasis></entry>
24748 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
24749 </row>
24750 </tbody>
24751 </tgroup>
24752 </informaltable>
24753 <para>
24754 <indexterm role="concept">
24755 <primary>port</primary>
24756 <secondary>for daemon</secondary>
24757 </indexterm>
24758 <indexterm role="concept">
24759 <primary>TCP/IP</primary>
24760 <secondary>setting listening ports</secondary>
24761 </indexterm>
24762 This option specifies one or more default SMTP ports on which the Exim daemon
24763 listens. See chapter <xref linkend="CHAPinterfaces"/> for details of how it is used. For
24764 backward compatibility, <option>daemon_smtp_port</option> (singular) is a synonym.
24765 </para>
24766 <para>
24767 <indexterm role="option">
24768 <primary><option>daemon_startup_retries</option></primary>
24769 </indexterm>
24770 </para>
24771 <informaltable frame="all">
24772 <tgroup cols="4" colsep="0" rowsep="0">
24773 <colspec colwidth="8*" align="left"/>
24774 <colspec colwidth="6*" align="center"/>
24775 <colspec colwidth="6*" align="center"/>
24776 <colspec colwidth="6*" align="right"/>
24777 <tbody>
24778 <row>
24779 <entry><option>daemon_startup_retries</option></entry>
24780 <entry>Use: <emphasis>main</emphasis></entry>
24781 <entry>Type: <emphasis>integer</emphasis></entry>
24782 <entry>Default: <emphasis>9</emphasis></entry>
24783 </row>
24784 </tbody>
24785 </tgroup>
24786 </informaltable>
24787 <para>
24788 <indexterm role="concept">
24789 <primary>daemon startup, retrying</primary>
24790 </indexterm>
24791 This option, along with <option>daemon_startup_sleep</option>, controls the retrying done by
24792 the daemon at startup when it cannot immediately bind a listening socket
24793 (typically because the socket is already in use): <option>daemon_startup_retries</option>
24794 defines the number of retries after the first failure, and
24795 <option>daemon_startup_sleep</option> defines the length of time to wait between retries.
24796 </para>
24797 <para>
24798 <indexterm role="option">
24799 <primary><option>daemon_startup_sleep</option></primary>
24800 </indexterm>
24801 </para>
24802 <informaltable frame="all">
24803 <tgroup cols="4" colsep="0" rowsep="0">
24804 <colspec colwidth="8*" align="left"/>
24805 <colspec colwidth="6*" align="center"/>
24806 <colspec colwidth="6*" align="center"/>
24807 <colspec colwidth="6*" align="right"/>
24808 <tbody>
24809 <row>
24810 <entry><option>daemon_startup_sleep</option></entry>
24811 <entry>Use: <emphasis>main</emphasis></entry>
24812 <entry>Type: <emphasis>time</emphasis></entry>
24813 <entry>Default: <emphasis>30s</emphasis></entry>
24814 </row>
24815 </tbody>
24816 </tgroup>
24817 </informaltable>
24818 <para>
24819 See <option>daemon_startup_retries</option>.
24820 </para>
24821 <para>
24822 <indexterm role="option">
24823 <primary><option>delay_warning</option></primary>
24824 </indexterm>
24825 </para>
24826 <informaltable frame="all">
24827 <tgroup cols="4" colsep="0" rowsep="0">
24828 <colspec colwidth="8*" align="left"/>
24829 <colspec colwidth="6*" align="center"/>
24830 <colspec colwidth="6*" align="center"/>
24831 <colspec colwidth="6*" align="right"/>
24832 <tbody>
24833 <row>
24834 <entry><option>delay_warning</option></entry>
24835 <entry>Use: <emphasis>main</emphasis></entry>
24836 <entry>Type: <emphasis>time list</emphasis></entry>
24837 <entry>Default: <emphasis>24h</emphasis></entry>
24838 </row>
24839 </tbody>
24840 </tgroup>
24841 </informaltable>
24842 <para>
24843 <indexterm role="concept">
24844 <primary>warning of delay</primary>
24845 </indexterm>
24846 <indexterm role="concept">
24847 <primary>delay warning, specifying</primary>
24848 </indexterm>
24849 <indexterm role="concept">
24850 <primary>queue</primary>
24851 <secondary>delay warning</secondary>
24852 </indexterm>
24853 When a message is delayed, Exim sends a warning message to the sender at
24854 intervals specified by this option. The data is a colon-separated list of times
24855 after which to send warning messages. If the value of the option is an empty
24856 string or a zero time, no warnings are sent. Up to 10 times may be given. If a
24857 message has been in the queue for longer than the last time, the last interval
24858 between the times is used to compute subsequent warning times. For example,
24859 with
24860 </para>
24861 <literallayout class="monospaced">
24862 delay_warning = 4h:8h:24h
24863 </literallayout>
24864 <para>
24865 the first message is sent after 4 hours, the second after 8 hours, and
24866 the third one after 24 hours. After that, messages are sent every 16 hours,
24867 because that is the interval between the last two times on the list. If you set
24868 just one time, it specifies the repeat interval. For example, with:
24869 </para>
24870 <literallayout class="monospaced">
24871 delay_warning = 6h
24872 </literallayout>
24873 <para>
24874 messages are repeated every six hours. To stop warnings after a given time, set
24875 a very large time at the end of the list. For example:
24876 </para>
24877 <literallayout class="monospaced">
24878 delay_warning = 2h:12h:99d
24879 </literallayout>
24880 <para>
24881 Note that the option is only evaluated at the time a delivery attempt fails,
24882 which depends on retry and queue-runner configuration.
24883 Typically retries will be configured more frequently than warning messages.
24884 </para>
24885 <para>
24886 <indexterm role="option">
24887 <primary><option>delay_warning_condition</option></primary>
24888 </indexterm>
24889 </para>
24890 <informaltable frame="all">
24891 <tgroup cols="4" colsep="0" rowsep="0">
24892 <colspec colwidth="8*" align="left"/>
24893 <colspec colwidth="6*" align="center"/>
24894 <colspec colwidth="6*" align="center"/>
24895 <colspec colwidth="6*" align="right"/>
24896 <tbody>
24897 <row>
24898 <entry><option>delay_warning_condition</option></entry>
24899 <entry>Use: <emphasis>main</emphasis></entry>
24900 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24901 <entry>Default: <emphasis>see below</emphasis></entry>
24902 </row>
24903 </tbody>
24904 </tgroup>
24905 </informaltable>
24906 <para>
24907 <indexterm role="variable">
24908 <primary><varname>$domain</varname></primary>
24909 </indexterm>
24910 The string is expanded at the time a warning message might be sent. If all the
24911 deferred addresses have the same domain, it is set in <varname>$domain</varname> during the
24912 expansion. Otherwise <varname>$domain</varname> is empty. If the result of the expansion is a
24913 forced failure, an empty string, or a string matching any of <quote>0</quote>, <quote>no</quote> or
24914 <quote>false</quote> (the comparison being done caselessly) then the warning message is
24915 not sent. The default is:
24916 </para>
24917 <literallayout class="monospaced">
24918 delay_warning_condition = ${if or {\
24919   { !eq{$h_list-id:$h_list-post:$h_list-subscribe:}{} }\
24920   { match{$h_precedence:}{(?i)bulk|list|junk} }\
24921   { match{$h_auto-submitted:}{(?i)auto-generated|auto-replied} }\
24922   } {no}{yes}}
24923 </literallayout>
24924 <para>
24925 This suppresses the sending of warnings for messages that contain <emphasis>List-ID:</emphasis>,
24926 <emphasis>List-Post:</emphasis>, or <emphasis>List-Subscribe:</emphasis> headers, or have <quote>bulk</quote>, <quote>list</quote> or
24927 <quote>junk</quote> in a <emphasis>Precedence:</emphasis> header, or have <quote>auto-generated</quote> or
24928 <quote>auto-replied</quote> in an <emphasis>Auto-Submitted:</emphasis> header.
24929 </para>
24930 <para>
24931 <indexterm role="option">
24932 <primary><option>deliver_drop_privilege</option></primary>
24933 </indexterm>
24934 </para>
24935 <informaltable frame="all">
24936 <tgroup cols="4" colsep="0" rowsep="0">
24937 <colspec colwidth="8*" align="left"/>
24938 <colspec colwidth="6*" align="center"/>
24939 <colspec colwidth="6*" align="center"/>
24940 <colspec colwidth="6*" align="right"/>
24941 <tbody>
24942 <row>
24943 <entry><option>deliver_drop_privilege</option></entry>
24944 <entry>Use: <emphasis>main</emphasis></entry>
24945 <entry>Type: <emphasis>boolean</emphasis></entry>
24946 <entry>Default: <emphasis>false</emphasis></entry>
24947 </row>
24948 </tbody>
24949 </tgroup>
24950 </informaltable>
24951 <para>
24952 <indexterm role="concept">
24953 <primary>unprivileged delivery</primary>
24954 </indexterm>
24955 <indexterm role="concept">
24956 <primary>delivery</primary>
24957 <secondary>unprivileged</secondary>
24958 </indexterm>
24959 If this option is set true, Exim drops its root privilege at the start of a
24960 delivery process, and runs as the Exim user throughout. This severely restricts
24961 the kinds of local delivery that are possible, but is viable in certain types
24962 of configuration. There is a discussion about the use of root privilege in
24963 chapter <xref linkend="CHAPsecurity"/>.
24964 </para>
24965 <para>
24966 <indexterm role="option">
24967 <primary><option>deliver_queue_load_max</option></primary>
24968 </indexterm>
24969 </para>
24970 <informaltable frame="all">
24971 <tgroup cols="4" colsep="0" rowsep="0">
24972 <colspec colwidth="8*" align="left"/>
24973 <colspec colwidth="6*" align="center"/>
24974 <colspec colwidth="6*" align="center"/>
24975 <colspec colwidth="6*" align="right"/>
24976 <tbody>
24977 <row>
24978 <entry><option>deliver_queue_load_max</option></entry>
24979 <entry>Use: <emphasis>main</emphasis></entry>
24980 <entry>Type: <emphasis>fixed-point</emphasis></entry>
24981 <entry>Default: <emphasis>unset</emphasis></entry>
24982 </row>
24983 </tbody>
24984 </tgroup>
24985 </informaltable>
24986 <para>
24987 <indexterm role="concept">
24988 <primary>load average</primary>
24989 </indexterm>
24990 <indexterm role="concept">
24991 <primary>queue runner</primary>
24992 <secondary>abandoning</secondary>
24993 </indexterm>
24994 When this option is set, a queue run is abandoned if the system load average
24995 becomes greater than the value of the option. The option has no effect on
24996 ancient operating systems on which Exim cannot determine the load average.
24997 See also <option>queue_only_load</option> and <option>smtp_load_reserve</option>.
24998 </para>
24999 <para>
25000 <indexterm role="option">
25001 <primary><option>delivery_date_remove</option></primary>
25002 </indexterm>
25003 </para>
25004 <informaltable frame="all">
25005 <tgroup cols="4" colsep="0" rowsep="0">
25006 <colspec colwidth="8*" align="left"/>
25007 <colspec colwidth="6*" align="center"/>
25008 <colspec colwidth="6*" align="center"/>
25009 <colspec colwidth="6*" align="right"/>
25010 <tbody>
25011 <row>
25012 <entry><option>delivery_date_remove</option></entry>
25013 <entry>Use: <emphasis>main</emphasis></entry>
25014 <entry>Type: <emphasis>boolean</emphasis></entry>
25015 <entry>Default: <emphasis>true</emphasis></entry>
25016 </row>
25017 </tbody>
25018 </tgroup>
25019 </informaltable>
25020 <para>
25021 <indexterm role="concept">
25022 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
25023 </indexterm>
25024 Exim&#x2019;s transports have an option for adding a <emphasis>Delivery-date:</emphasis> header to a
25025 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
25026 handled. <emphasis>Delivery-date:</emphasis> records the actual time of delivery. Such headers
25027 should not be present in incoming messages, and this option causes them to be
25028 removed at the time the message is received, to avoid any problems that might
25029 occur when a delivered message is subsequently sent on to some other recipient.
25030 </para>
25031 <para>
25032 <indexterm role="option">
25033 <primary><option>disable_fsync</option></primary>
25034 </indexterm>
25035 </para>
25036 <informaltable frame="all">
25037 <tgroup cols="4" colsep="0" rowsep="0">
25038 <colspec colwidth="8*" align="left"/>
25039 <colspec colwidth="6*" align="center"/>
25040 <colspec colwidth="6*" align="center"/>
25041 <colspec colwidth="6*" align="right"/>
25042 <tbody>
25043 <row>
25044 <entry><option>disable_fsync</option></entry>
25045 <entry>Use: <emphasis>main</emphasis></entry>
25046 <entry>Type: <emphasis>boolean</emphasis></entry>
25047 <entry>Default: <emphasis>false</emphasis></entry>
25048 </row>
25049 </tbody>
25050 </tgroup>
25051 </informaltable>
25052 <para>
25053 <indexterm role="concept">
25054 <primary><function>fsync()</function>, disabling</primary>
25055 </indexterm>
25056 This option is available only if Exim was built with the compile-time option
25057 ENABLE_DISABLE_FSYNC. When this is not set, a reference to <option>disable_fsync</option> in
25058 a runtime configuration generates an <quote>unknown option</quote> error. You should not
25059 build Exim with ENABLE_DISABLE_FSYNC or set <option>disable_fsync</option> unless you
25060 really, really, really understand what you are doing. <emphasis>No pre-compiled
25061 distributions of Exim should ever make this option available.</emphasis>
25062 </para>
25063 <para>
25064 When <option>disable_fsync</option> is set true, Exim no longer calls <function>fsync()</function> to force
25065 updated files&#x2019; data to be written to disc before continuing. Unexpected events
25066 such as crashes and power outages may cause data to be lost or scrambled.
25067 Here be Dragons. <emphasis role="bold">Beware.</emphasis>
25068 </para>
25069 <para>
25070 <indexterm role="option">
25071 <primary><option>disable_ipv6</option></primary>
25072 </indexterm>
25073 </para>
25074 <informaltable frame="all">
25075 <tgroup cols="4" colsep="0" rowsep="0">
25076 <colspec colwidth="8*" align="left"/>
25077 <colspec colwidth="6*" align="center"/>
25078 <colspec colwidth="6*" align="center"/>
25079 <colspec colwidth="6*" align="right"/>
25080 <tbody>
25081 <row>
25082 <entry><option>disable_ipv6</option></entry>
25083 <entry>Use: <emphasis>main</emphasis></entry>
25084 <entry>Type: <emphasis>boolean</emphasis></entry>
25085 <entry>Default: <emphasis>false</emphasis></entry>
25086 </row>
25087 </tbody>
25088 </tgroup>
25089 </informaltable>
25090 <para>
25091 <indexterm role="concept">
25092 <primary>IPv6</primary>
25093 <secondary>disabling</secondary>
25094 </indexterm>
25095 If this option is set true, even if the Exim binary has IPv6 support, no IPv6
25096 activities take place. AAAA records are never looked up, and any IPv6 addresses
25097 that are listed in <option>local_interfaces</option>, data for the <option>manualroute</option> router,
25098 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
25099 to handle IPv6 literal addresses.
25100 </para>
25101 <para>
25102 <indexterm role="option">
25103 <primary><option>dkim_verify_signers</option></primary>
25104 </indexterm>
25105 </para>
25106 <informaltable frame="all">
25107 <tgroup cols="4" colsep="0" rowsep="0">
25108 <colspec colwidth="8*" align="left"/>
25109 <colspec colwidth="6*" align="center"/>
25110 <colspec colwidth="6*" align="center"/>
25111 <colspec colwidth="6*" align="right"/>
25112 <tbody>
25113 <row>
25114 <entry><option>dkim_verify_signers</option></entry>
25115 <entry>Use: <emphasis>main</emphasis></entry>
25116 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
25117 <entry>Default: <emphasis>$dkim_signers</emphasis></entry>
25118 </row>
25119 </tbody>
25120 </tgroup>
25121 </informaltable>
25122 <para>
25123 <indexterm role="concept">
25124 <primary>DKIM</primary>
25125 <secondary>controlling calls to the ACL</secondary>
25126 </indexterm>
25127 This option gives a list of DKIM domains for which the DKIM ACL is run.
25128 It is expanded after the message is received; by default it runs
25129 the ACL once for each signature in the message.
25130 See section <xref linkend="SECDKIMVFY"/>.
25131 </para>
25132 <para>
25133 <indexterm role="option">
25134 <primary><option>dns_again_means_nonexist</option></primary>
25135 </indexterm>
25136 </para>
25137 <informaltable frame="all">
25138 <tgroup cols="4" colsep="0" rowsep="0">
25139 <colspec colwidth="8*" align="left"/>
25140 <colspec colwidth="6*" align="center"/>
25141 <colspec colwidth="6*" align="center"/>
25142 <colspec colwidth="6*" align="right"/>
25143 <tbody>
25144 <row>
25145 <entry><option>dns_again_means_nonexist</option></entry>
25146 <entry>Use: <emphasis>main</emphasis></entry>
25147 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
25148 <entry>Default: <emphasis>unset</emphasis></entry>
25149 </row>
25150 </tbody>
25151 </tgroup>
25152 </informaltable>
25153 <para>
25154 <indexterm role="concept">
25155 <primary>DNS</primary>
25156 <secondary><quote>try again</quote> response; overriding</secondary>
25157 </indexterm>
25158 DNS lookups give a <quote>try again</quote> response for the DNS errors
25159 <quote>non-authoritative host not found</quote> and <quote>SERVERFAIL</quote>. This can cause Exim to
25160 keep trying to deliver a message, or to give repeated temporary errors to
25161 incoming mail. Sometimes the effect is caused by a badly set up name server and
25162 may persist for a long time. If a domain which exhibits this problem matches
25163 anything in <option>dns_again_means_nonexist</option>, it is treated as if it did not exist.
25164 This option should be used with care. You can make it apply to reverse lookups
25165 by a setting such as this:
25166 </para>
25167 <literallayout class="monospaced">
25168 dns_again_means_nonexist = *.in-addr.arpa
25169 </literallayout>
25170 <para>
25171 This option applies to all DNS lookups that Exim does. It also applies when the
25172 <function>gethostbyname()</function> or <function>getipnodebyname()</function> functions give temporary errors,
25173 since these are most likely to be caused by DNS lookup problems. The
25174 <command>dnslookup</command> router has some options of its own for controlling what happens
25175 when lookups for MX or SRV records give temporary errors. These more specific
25176 options are applied after this global option.
25177 </para>
25178 <para>
25179 <indexterm role="option">
25180 <primary><option>dns_check_names_pattern</option></primary>
25181 </indexterm>
25182 </para>
25183 <informaltable frame="all">
25184 <tgroup cols="4" colsep="0" rowsep="0">
25185 <colspec colwidth="8*" align="left"/>
25186 <colspec colwidth="6*" align="center"/>
25187 <colspec colwidth="6*" align="center"/>
25188 <colspec colwidth="6*" align="right"/>
25189 <tbody>
25190 <row>
25191 <entry><option>dns_check_names_pattern</option></entry>
25192 <entry>Use: <emphasis>main</emphasis></entry>
25193 <entry>Type: <emphasis>string</emphasis></entry>
25194 <entry>Default: <emphasis>see below</emphasis></entry>
25195 </row>
25196 </tbody>
25197 </tgroup>
25198 </informaltable>
25199 <para>
25200 <indexterm role="concept">
25201 <primary>DNS</primary>
25202 <secondary>pre-check of name syntax</secondary>
25203 </indexterm>
25204 When this option is set to a non-empty string, it causes Exim to check domain
25205 names for characters that are not allowed in host names before handing them to
25206 the DNS resolver, because some resolvers give temporary errors for names that
25207 contain unusual characters. If a domain name contains any unwanted characters,
25208 a <quote>not found</quote> result is forced, and the resolver is not called. The check is
25209 done by matching the domain name against a regular expression, which is the
25210 value of this option. The default pattern is
25211 </para>
25212 <literallayout class="monospaced">
25213 dns_check_names_pattern = \
25214   (?i)^(?&gt;(?(1)\.|())[^\W_](?&gt;[a-z0-9/-]*[^\W_])?)+$
25215 </literallayout>
25216 <para>
25217 which permits only letters, digits, slashes, and hyphens in components, but
25218 they must start and end with a letter or digit. Slashes are not, in fact,
25219 permitted in host names, but they are found in certain NS records (which can be
25220 accessed in Exim by using a <option>dnsdb</option> lookup). If you set
25221 <option>allow_utf8_domains</option>, you must modify this pattern, or set the option to an
25222 empty string.
25223 </para>
25224 <para>
25225 <indexterm role="option">
25226 <primary><option>dns_csa_search_limit</option></primary>
25227 </indexterm>
25228 </para>
25229 <informaltable frame="all">
25230 <tgroup cols="4" colsep="0" rowsep="0">
25231 <colspec colwidth="8*" align="left"/>
25232 <colspec colwidth="6*" align="center"/>
25233 <colspec colwidth="6*" align="center"/>
25234 <colspec colwidth="6*" align="right"/>
25235 <tbody>
25236 <row>
25237 <entry><option>dns_csa_search_limit</option></entry>
25238 <entry>Use: <emphasis>main</emphasis></entry>
25239 <entry>Type: <emphasis>integer</emphasis></entry>
25240 <entry>Default: <emphasis>5</emphasis></entry>
25241 </row>
25242 </tbody>
25243 </tgroup>
25244 </informaltable>
25245 <para>
25246 This option controls the depth of parental searching for CSA SRV records in the
25247 DNS, as described in more detail in section <xref linkend="SECTverifyCSA"/>.
25248 </para>
25249 <para>
25250 <indexterm role="option">
25251 <primary><option>dns_csa_use_reverse</option></primary>
25252 </indexterm>
25253 </para>
25254 <informaltable frame="all">
25255 <tgroup cols="4" colsep="0" rowsep="0">
25256 <colspec colwidth="8*" align="left"/>
25257 <colspec colwidth="6*" align="center"/>
25258 <colspec colwidth="6*" align="center"/>
25259 <colspec colwidth="6*" align="right"/>
25260 <tbody>
25261 <row>
25262 <entry><option>dns_csa_use_reverse</option></entry>
25263 <entry>Use: <emphasis>main</emphasis></entry>
25264 <entry>Type: <emphasis>boolean</emphasis></entry>
25265 <entry>Default: <emphasis>true</emphasis></entry>
25266 </row>
25267 </tbody>
25268 </tgroup>
25269 </informaltable>
25270 <para>
25271 This option controls whether or not an IP address, given as a CSA domain, is
25272 reversed and looked up in the reverse DNS, as described in more detail in
25273 section <xref linkend="SECTverifyCSA"/>.
25274 </para>
25275 <para revisionflag="changed">
25276 <indexterm role="option">
25277 <primary><option>dns_cname_loops</option></primary>
25278 </indexterm>
25279 </para>
25280 <informaltable frame="all" revisionflag="changed">
25281 <tgroup cols="4" colsep="0" rowsep="0">
25282 <colspec colwidth="8*" align="left"/>
25283 <colspec colwidth="6*" align="center"/>
25284 <colspec colwidth="6*" align="center"/>
25285 <colspec colwidth="6*" align="right"/>
25286 <tbody>
25287 <row>
25288 <entry><option>dns_cname_loops</option></entry>
25289 <entry>Use: <emphasis>main</emphasis></entry>
25290 <entry>Type: <emphasis>integer</emphasis></entry>
25291 <entry>Default: <emphasis>1</emphasis></entry>
25292 </row>
25293 </tbody>
25294 </tgroup>
25295 </informaltable>
25296 <para revisionflag="changed">
25297 <indexterm role="concept">
25298 <primary>DNS</primary>
25299 <secondary>CNAME following</secondary>
25300 </indexterm>
25301 This option controls the following of CNAME chains, needed if the resolver does
25302 not do it internally.
25303 As of 2018 most should, and the default can be left.
25304 If you have an ancient one, a value of 10 is likely needed.
25305 </para>
25306 <para revisionflag="changed">
25307 The default value of one CNAME-follow is needed
25308 thanks to the observed return for an MX request,
25309 given no MX presence but a CNAME to an A, of the CNAME.
25310 </para>
25311 <para>
25312 <indexterm role="option">
25313 <primary><option>dns_dnssec_ok</option></primary>
25314 </indexterm>
25315 </para>
25316 <informaltable frame="all">
25317 <tgroup cols="4" colsep="0" rowsep="0">
25318 <colspec colwidth="8*" align="left"/>
25319 <colspec colwidth="6*" align="center"/>
25320 <colspec colwidth="6*" align="center"/>
25321 <colspec colwidth="6*" align="right"/>
25322 <tbody>
25323 <row>
25324 <entry><option>dns_dnssec_ok</option></entry>
25325 <entry>Use: <emphasis>main</emphasis></entry>
25326 <entry>Type: <emphasis>integer</emphasis></entry>
25327 <entry>Default: <emphasis>-1</emphasis></entry>
25328 </row>
25329 </tbody>
25330 </tgroup>
25331 </informaltable>
25332 <para>
25333 <indexterm role="concept">
25334 <primary>DNS</primary>
25335 <secondary>resolver options</secondary>
25336 </indexterm>
25337 <indexterm role="concept">
25338 <primary>DNS</primary>
25339 <secondary>DNSSEC</secondary>
25340 </indexterm>
25341 If this option is set to a non-negative number then Exim will initialise the
25342 DNS resolver library to either use or not use DNSSEC, overriding the system
25343 default. A value of 0 coerces DNSSEC off, a value of 1 coerces DNSSEC on.
25344 </para>
25345 <para>
25346 If the resolver library does not support DNSSEC then this option has no effect.
25347 </para>
25348 <para>
25349 <indexterm role="option">
25350 <primary><option>dns_ipv4_lookup</option></primary>
25351 </indexterm>
25352 </para>
25353 <informaltable frame="all">
25354 <tgroup cols="4" colsep="0" rowsep="0">
25355 <colspec colwidth="8*" align="left"/>
25356 <colspec colwidth="6*" align="center"/>
25357 <colspec colwidth="6*" align="center"/>
25358 <colspec colwidth="6*" align="right"/>
25359 <tbody>
25360 <row>
25361 <entry><option>dns_ipv4_lookup</option></entry>
25362 <entry>Use: <emphasis>main</emphasis></entry>
25363 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
25364 <entry>Default: <emphasis>unset</emphasis></entry>
25365 </row>
25366 </tbody>
25367 </tgroup>
25368 </informaltable>
25369 <para>
25370 <indexterm role="concept">
25371 <primary>IPv6</primary>
25372 <secondary>DNS lookup for AAAA records</secondary>
25373 </indexterm>
25374 <indexterm role="concept">
25375 <primary>DNS</primary>
25376 <secondary>IPv6 lookup for AAAA records</secondary>
25377 </indexterm>
25378 <indexterm role="concept">
25379 <primary>DNS</primary>
25380 <secondary>IPv6 disabling</secondary>
25381 </indexterm>
25382 When Exim is compiled with IPv6 support and <option>disable_ipv6</option> is not set, it
25383 looks for IPv6 address records (AAAA records) as well as IPv4 address records
25384 (A records) when trying to find IP addresses for hosts, unless the host&#x2019;s
25385 domain matches this list.
25386 </para>
25387 <para>
25388 This is a fudge to help with name servers that give big delays or otherwise do
25389 not work for the AAAA record type. In due course, when the world&#x2019;s name
25390 servers have all been upgraded, there should be no need for this option.
25391 </para>
25392 <para>
25393 <indexterm role="option">
25394 <primary><option>dns_retrans</option></primary>
25395 </indexterm>
25396 </para>
25397 <informaltable frame="all">
25398 <tgroup cols="4" colsep="0" rowsep="0">
25399 <colspec colwidth="8*" align="left"/>
25400 <colspec colwidth="6*" align="center"/>
25401 <colspec colwidth="6*" align="center"/>
25402 <colspec colwidth="6*" align="right"/>
25403 <tbody>
25404 <row>
25405 <entry><option>dns_retrans</option></entry>
25406 <entry>Use: <emphasis>main</emphasis></entry>
25407 <entry>Type: <emphasis>time</emphasis></entry>
25408 <entry>Default: <emphasis>0s</emphasis></entry>
25409 </row>
25410 </tbody>
25411 </tgroup>
25412 </informaltable>
25413 <para>
25414 <indexterm role="concept">
25415 <primary>DNS</primary>
25416 <secondary>resolver options</secondary>
25417 </indexterm>
25418 <indexterm role="concept">
25419 <primary>timeout</primary>
25420 <secondary>dns lookup</secondary>
25421 </indexterm>
25422 <indexterm role="concept">
25423 <primary>DNS</primary>
25424 <secondary>timeout</secondary>
25425 </indexterm>
25426 The options <option>dns_retrans</option> and <option>dns_retry</option> can be used to set the
25427 retransmission and retry parameters for DNS lookups. Values of zero (the
25428 defaults) leave the system default settings unchanged. The first value is the
25429 time between retries, and the second is the number of retries. It isn&#x2019;t
25430 totally clear exactly how these settings affect the total time a DNS lookup may
25431 take. I haven&#x2019;t found any documentation about timeouts on DNS lookups; these
25432 parameter values are available in the external resolver interface structure,
25433 but nowhere does it seem to describe how they are used or what you might want
25434 to set in them.
25435 See also the <option>slow_lookup_log</option> option.
25436 </para>
25437 <para>
25438 <indexterm role="option">
25439 <primary><option>dns_retry</option></primary>
25440 </indexterm>
25441 </para>
25442 <informaltable frame="all">
25443 <tgroup cols="4" colsep="0" rowsep="0">
25444 <colspec colwidth="8*" align="left"/>
25445 <colspec colwidth="6*" align="center"/>
25446 <colspec colwidth="6*" align="center"/>
25447 <colspec colwidth="6*" align="right"/>
25448 <tbody>
25449 <row>
25450 <entry><option>dns_retry</option></entry>
25451 <entry>Use: <emphasis>main</emphasis></entry>
25452 <entry>Type: <emphasis>integer</emphasis></entry>
25453 <entry>Default: <emphasis>0</emphasis></entry>
25454 </row>
25455 </tbody>
25456 </tgroup>
25457 </informaltable>
25458 <para>
25459 See <option>dns_retrans</option> above.
25460 </para>
25461 <para>
25462 <indexterm role="option">
25463 <primary><option>dns_trust_aa</option></primary>
25464 </indexterm>
25465 </para>
25466 <informaltable frame="all">
25467 <tgroup cols="4" colsep="0" rowsep="0">
25468 <colspec colwidth="8*" align="left"/>
25469 <colspec colwidth="6*" align="center"/>
25470 <colspec colwidth="6*" align="center"/>
25471 <colspec colwidth="6*" align="right"/>
25472 <tbody>
25473 <row>
25474 <entry><option>dns_trust_aa</option></entry>
25475 <entry>Use: <emphasis>main</emphasis></entry>
25476 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
25477 <entry>Default: <emphasis>unset</emphasis></entry>
25478 </row>
25479 </tbody>
25480 </tgroup>
25481 </informaltable>
25482 <para>
25483 <indexterm role="concept">
25484 <primary>DNS</primary>
25485 <secondary>resolver options</secondary>
25486 </indexterm>
25487 <indexterm role="concept">
25488 <primary>DNS</primary>
25489 <secondary>DNSSEC</secondary>
25490 </indexterm>
25491 If this option is set then lookup results marked with the AA bit
25492 (Authoritative Answer) are trusted the same way as if they were
25493 DNSSEC-verified. The authority section&#x2019;s name of the answer must
25494 match with this expanded domain list.
25495 </para>
25496 <para>
25497 Use this option only if you talk directly to a resolver that is
25498 authoritative for some zones and does not set the AD (Authentic Data)
25499 bit in the answer. Some DNS servers may have an configuration option to
25500 mark the answers from their own zones as verified (they set the AD bit).
25501 Others do not have this option. It is considered as poor practice using
25502 a resolver that is an authoritative server for some zones.
25503 </para>
25504 <para>
25505 Use this option only if you really have to (e.g. if you want
25506 to use DANE for remote delivery to a server that is listed in the DNS
25507 zones that your resolver is authoritative for).
25508 </para>
25509 <para>
25510 If the DNS answer packet has the AA bit set and contains resource record
25511 in the answer section, the name of the first NS record appearing in the
25512 authority section is compared against the list. If the answer packet is
25513 authoritative but the answer section is empty, the name of the first SOA
25514 record in the authoritative section is used instead.
25515 </para>
25516 <para>
25517 <indexterm role="concept">
25518 <primary>DNS</primary>
25519 <secondary>resolver options</secondary>
25520 </indexterm>
25521 <indexterm role="option">
25522 <primary><option>dns_use_edns0</option></primary>
25523 </indexterm>
25524 </para>
25525 <informaltable frame="all">
25526 <tgroup cols="4" colsep="0" rowsep="0">
25527 <colspec colwidth="8*" align="left"/>
25528 <colspec colwidth="6*" align="center"/>
25529 <colspec colwidth="6*" align="center"/>
25530 <colspec colwidth="6*" align="right"/>
25531 <tbody>
25532 <row>
25533 <entry><option>dns_use_edns0</option></entry>
25534 <entry>Use: <emphasis>main</emphasis></entry>
25535 <entry>Type: <emphasis>integer</emphasis></entry>
25536 <entry>Default: <emphasis>-1</emphasis></entry>
25537 </row>
25538 </tbody>
25539 </tgroup>
25540 </informaltable>
25541 <para>
25542 <indexterm role="concept">
25543 <primary>DNS</primary>
25544 <secondary>resolver options</secondary>
25545 </indexterm>
25546 <indexterm role="concept">
25547 <primary>DNS</primary>
25548 <secondary>EDNS0</secondary>
25549 </indexterm>
25550 <indexterm role="concept">
25551 <primary>DNS</primary>
25552 <secondary>OpenBSD</secondary>
25553 </indexterm>
25554 If this option is set to a non-negative number then Exim will initialise the
25555 DNS resolver library to either use or not use EDNS0 extensions, overriding
25556 the system default. A value of 0 coerces EDNS0 off, a value of 1 coerces EDNS0
25557 on.
25558 </para>
25559 <para>
25560 If the resolver library does not support EDNS0 then this option has no effect.
25561 </para>
25562 <para>
25563 OpenBSD&#x2019;s asr resolver routines are known to ignore the EDNS0 option; this
25564 means that DNSSEC will not work with Exim on that platform either, unless Exim
25565 is linked against an alternative DNS client library.
25566 </para>
25567 <para>
25568 <indexterm role="option">
25569 <primary><option>drop_cr</option></primary>
25570 </indexterm>
25571 </para>
25572 <informaltable frame="all">
25573 <tgroup cols="4" colsep="0" rowsep="0">
25574 <colspec colwidth="8*" align="left"/>
25575 <colspec colwidth="6*" align="center"/>
25576 <colspec colwidth="6*" align="center"/>
25577 <colspec colwidth="6*" align="right"/>
25578 <tbody>
25579 <row>
25580 <entry><option>drop_cr</option></entry>
25581 <entry>Use: <emphasis>main</emphasis></entry>
25582 <entry>Type: <emphasis>boolean</emphasis></entry>
25583 <entry>Default: <emphasis>false</emphasis></entry>
25584 </row>
25585 </tbody>
25586 </tgroup>
25587 </informaltable>
25588 <para>
25589 This is an obsolete option that is now a no-op. It used to affect the way Exim
25590 handled CR and LF characters in incoming messages. What happens now is
25591 described in section <xref linkend="SECTlineendings"/>.
25592 </para>
25593 <para>
25594 <indexterm role="option">
25595 <primary><option>dsn_advertise_hosts</option></primary>
25596 </indexterm>
25597 </para>
25598 <informaltable frame="all">
25599 <tgroup cols="4" colsep="0" rowsep="0">
25600 <colspec colwidth="8*" align="left"/>
25601 <colspec colwidth="6*" align="center"/>
25602 <colspec colwidth="6*" align="center"/>
25603 <colspec colwidth="6*" align="right"/>
25604 <tbody>
25605 <row>
25606 <entry><option>dsn_advertise_hosts</option></entry>
25607 <entry>Use: <emphasis>main</emphasis></entry>
25608 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25609 <entry>Default: <emphasis>unset</emphasis></entry>
25610 </row>
25611 </tbody>
25612 </tgroup>
25613 </informaltable>
25614 <para>
25615 <indexterm role="concept">
25616 <primary>bounce messages</primary>
25617 <secondary>success</secondary>
25618 </indexterm>
25619 <indexterm role="concept">
25620 <primary>DSN</primary>
25621 <secondary>success</secondary>
25622 </indexterm>
25623 <indexterm role="concept">
25624 <primary>Delivery Status Notification</primary>
25625 <secondary>success</secondary>
25626 </indexterm>
25627 DSN extensions (RFC3461) will be advertised in the EHLO message to,
25628 and accepted from, these hosts.
25629 Hosts may use the NOTIFY and ENVID options on RCPT TO commands,
25630 and RET and ORCPT options on MAIL FROM commands.
25631 A NOTIFY=SUCCESS option requests success-DSN messages.
25632 A NOTIFY= option with no argument requests that no delay or failure DSNs
25633 are sent.
25634 </para>
25635 <para>
25636 <indexterm role="option">
25637 <primary><option>dsn_from</option></primary>
25638 </indexterm>
25639 </para>
25640 <informaltable frame="all">
25641 <tgroup cols="4" colsep="0" rowsep="0">
25642 <colspec colwidth="8*" align="left"/>
25643 <colspec colwidth="6*" align="center"/>
25644 <colspec colwidth="6*" align="center"/>
25645 <colspec colwidth="6*" align="right"/>
25646 <tbody>
25647 <row>
25648 <entry><option>dsn_from</option></entry>
25649 <entry>Use: <emphasis>main</emphasis></entry>
25650 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25651 <entry>Default: <emphasis>see below</emphasis></entry>
25652 </row>
25653 </tbody>
25654 </tgroup>
25655 </informaltable>
25656 <para>
25657 <indexterm role="concept">
25658 <primary><emphasis>From:</emphasis> header line</primary>
25659 <secondary>in bounces</secondary>
25660 </indexterm>
25661 <indexterm role="concept">
25662 <primary>bounce messages</primary>
25663 <secondary><emphasis>From:</emphasis> line, specifying</secondary>
25664 </indexterm>
25665 This option can be used to vary the contents of <emphasis>From:</emphasis> header lines in
25666 bounces and other automatically generated messages (<quote>Delivery Status
25667 Notifications</quote> &ndash; hence the name of the option). The default setting is:
25668 </para>
25669 <literallayout class="monospaced">
25670 dsn_from = Mail Delivery System &lt;Mailer-Daemon@$qualify_domain&gt;
25671 </literallayout>
25672 <para>
25673 The value is expanded every time it is needed. If the expansion fails, a
25674 panic is logged, and the default value is used.
25675 </para>
25676 <para>
25677 <indexterm role="option">
25678 <primary><option>envelope_to_remove</option></primary>
25679 </indexterm>
25680 </para>
25681 <informaltable frame="all">
25682 <tgroup cols="4" colsep="0" rowsep="0">
25683 <colspec colwidth="8*" align="left"/>
25684 <colspec colwidth="6*" align="center"/>
25685 <colspec colwidth="6*" align="center"/>
25686 <colspec colwidth="6*" align="right"/>
25687 <tbody>
25688 <row>
25689 <entry><option>envelope_to_remove</option></entry>
25690 <entry>Use: <emphasis>main</emphasis></entry>
25691 <entry>Type: <emphasis>boolean</emphasis></entry>
25692 <entry>Default: <emphasis>true</emphasis></entry>
25693 </row>
25694 </tbody>
25695 </tgroup>
25696 </informaltable>
25697 <para>
25698 <indexterm role="concept">
25699 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
25700 </indexterm>
25701 Exim&#x2019;s transports have an option for adding an <emphasis>Envelope-to:</emphasis> header to a
25702 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
25703 handled. <emphasis>Envelope-to:</emphasis> records the original recipient address from the
25704 message&#x2019;s envelope that caused the delivery to happen. Such headers should not
25705 be present in incoming messages, and this option causes them to be removed at
25706 the time the message is received, to avoid any problems that might occur when a
25707 delivered message is subsequently sent on to some other recipient.
25708 </para>
25709 <para>
25710 <indexterm role="option">
25711 <primary><option>errors_copy</option></primary>
25712 </indexterm>
25713 </para>
25714 <informaltable frame="all">
25715 <tgroup cols="4" colsep="0" rowsep="0">
25716 <colspec colwidth="8*" align="left"/>
25717 <colspec colwidth="6*" align="center"/>
25718 <colspec colwidth="6*" align="center"/>
25719 <colspec colwidth="6*" align="right"/>
25720 <tbody>
25721 <row>
25722 <entry><option>errors_copy</option></entry>
25723 <entry>Use: <emphasis>main</emphasis></entry>
25724 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
25725 <entry>Default: <emphasis>unset</emphasis></entry>
25726 </row>
25727 </tbody>
25728 </tgroup>
25729 </informaltable>
25730 <para>
25731 <indexterm role="concept">
25732 <primary>bounce message</primary>
25733 <secondary>copy to other address</secondary>
25734 </indexterm>
25735 <indexterm role="concept">
25736 <primary>copy of bounce message</primary>
25737 </indexterm>
25738 Setting this option causes Exim to send bcc copies of bounce messages that it
25739 generates to other addresses. <emphasis role="bold">Note</emphasis>: This does not apply to bounce messages
25740 coming from elsewhere. The value of the option is a colon-separated list of
25741 items. Each item consists of a pattern, terminated by white space, followed by
25742 a comma-separated list of email addresses. If a pattern contains spaces, it
25743 must be enclosed in double quotes.
25744 </para>
25745 <para>
25746 Each pattern is processed in the same way as a single item in an address list
25747 (see section <xref linkend="SECTaddresslist"/>). When a pattern matches the recipient of
25748 the bounce message, the message is copied to the addresses on the list. The
25749 items are scanned in order, and once a matching one is found, no further items
25750 are examined. For example:
25751 </para>
25752 <literallayout class="monospaced">
25753 errors_copy = spqr@mydomain   postmaster@mydomain.example :\
25754               rqps@mydomain   hostmaster@mydomain.example,\
25755                               postmaster@mydomain.example
25756 </literallayout>
25757 <para>
25758 <indexterm role="variable">
25759 <primary><varname>$domain</varname></primary>
25760 </indexterm>
25761 <indexterm role="variable">
25762 <primary><varname>$local_part</varname></primary>
25763 </indexterm>
25764 The address list is expanded before use. The expansion variables <varname>$local_part</varname>
25765 and <varname>$domain</varname> are set from the original recipient of the error message, and if
25766 there was any wildcard matching in the pattern, the expansion
25767 <indexterm role="concept">
25768 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
25769 <secondary>in <option>errors_copy</option></secondary>
25770 </indexterm>
25771 variables <varname>$0</varname>, <varname>$1</varname>, etc. are set in the normal way.
25772 </para>
25773 <para>
25774 <indexterm role="option">
25775 <primary><option>errors_reply_to</option></primary>
25776 </indexterm>
25777 </para>
25778 <informaltable frame="all">
25779 <tgroup cols="4" colsep="0" rowsep="0">
25780 <colspec colwidth="8*" align="left"/>
25781 <colspec colwidth="6*" align="center"/>
25782 <colspec colwidth="6*" align="center"/>
25783 <colspec colwidth="6*" align="right"/>
25784 <tbody>
25785 <row>
25786 <entry><option>errors_reply_to</option></entry>
25787 <entry>Use: <emphasis>main</emphasis></entry>
25788 <entry>Type: <emphasis>string</emphasis></entry>
25789 <entry>Default: <emphasis>unset</emphasis></entry>
25790 </row>
25791 </tbody>
25792 </tgroup>
25793 </informaltable>
25794 <para>
25795 <indexterm role="concept">
25796 <primary>bounce message</primary>
25797 <secondary><emphasis>Reply-to:</emphasis> in</secondary>
25798 </indexterm>
25799 By default, Exim&#x2019;s bounce and delivery warning messages contain the header line
25800 </para>
25801 <literallayout>
25802 <literal>From: Mail Delivery System &lt;Mailer-Daemon@</literal><emphasis>qualify-domain</emphasis><literal>&gt;</literal>
25803 </literallayout>
25804 <para>
25805 <indexterm role="option">
25806 <primary><option>quota_warn_message</option></primary>
25807 </indexterm>
25808 where <emphasis>qualify-domain</emphasis> is the value of the <option>qualify_domain</option> option.
25809 A warning message that is generated by the <option>quota_warn_message</option> option in an
25810 <command>appendfile</command> transport may contain its own <emphasis>From:</emphasis> header line that
25811 overrides the default.
25812 </para>
25813 <para>
25814 Experience shows that people reply to bounce messages. If the
25815 <option>errors_reply_to</option> option is set, a <emphasis>Reply-To:</emphasis> header is added to bounce
25816 and warning messages. For example:
25817 </para>
25818 <literallayout class="monospaced">
25819 errors_reply_to = postmaster@my.domain.example
25820 </literallayout>
25821 <para>
25822 The value of the option is not expanded. It must specify a valid RFC 2822
25823 address. However, if a warning message that is generated by the
25824 <option>quota_warn_message</option> option in an <command>appendfile</command> transport contain its
25825 own <emphasis>Reply-To:</emphasis> header line, the value of the <option>errors_reply_to</option> option is
25826 not used.
25827 </para>
25828 <para>
25829 <indexterm role="option">
25830 <primary><option>event_action</option></primary>
25831 </indexterm>
25832 </para>
25833 <informaltable frame="all">
25834 <tgroup cols="4" colsep="0" rowsep="0">
25835 <colspec colwidth="8*" align="left"/>
25836 <colspec colwidth="6*" align="center"/>
25837 <colspec colwidth="6*" align="center"/>
25838 <colspec colwidth="6*" align="right"/>
25839 <tbody>
25840 <row>
25841 <entry><option>event_action</option></entry>
25842 <entry>Use: <emphasis>main</emphasis></entry>
25843 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25844 <entry>Default: <emphasis>unset</emphasis></entry>
25845 </row>
25846 </tbody>
25847 </tgroup>
25848 </informaltable>
25849 <para>
25850 <indexterm role="concept">
25851 <primary>events</primary>
25852 </indexterm>
25853 This option declares a string to be expanded for Exim&#x2019;s events mechanism.
25854 For details see chapter <xref linkend="CHAPevents"/>.
25855 </para>
25856 <para>
25857 <indexterm role="option">
25858 <primary><option>exim_group</option></primary>
25859 </indexterm>
25860 </para>
25861 <informaltable frame="all">
25862 <tgroup cols="4" colsep="0" rowsep="0">
25863 <colspec colwidth="8*" align="left"/>
25864 <colspec colwidth="6*" align="center"/>
25865 <colspec colwidth="6*" align="center"/>
25866 <colspec colwidth="6*" align="right"/>
25867 <tbody>
25868 <row>
25869 <entry><option>exim_group</option></entry>
25870 <entry>Use: <emphasis>main</emphasis></entry>
25871 <entry>Type: <emphasis>string</emphasis></entry>
25872 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
25873 </row>
25874 </tbody>
25875 </tgroup>
25876 </informaltable>
25877 <para>
25878 <indexterm role="concept">
25879 <primary>gid (group id)</primary>
25880 <secondary>Exim&#x2019;s own</secondary>
25881 </indexterm>
25882 <indexterm role="concept">
25883 <primary>Exim group</primary>
25884 </indexterm>
25885 This option changes the gid under which Exim runs when it gives up root
25886 privilege. The default value is compiled into the binary. The value of this
25887 option is used only when <option>exim_user</option> is also set. Unless it consists entirely
25888 of digits, the string is looked up using <function>getgrnam()</function>, and failure causes a
25889 configuration error. See chapter <xref linkend="CHAPsecurity"/> for a discussion of
25890 security issues.
25891 </para>
25892 <para>
25893 <indexterm role="option">
25894 <primary><option>exim_path</option></primary>
25895 </indexterm>
25896 </para>
25897 <informaltable frame="all">
25898 <tgroup cols="4" colsep="0" rowsep="0">
25899 <colspec colwidth="8*" align="left"/>
25900 <colspec colwidth="6*" align="center"/>
25901 <colspec colwidth="6*" align="center"/>
25902 <colspec colwidth="6*" align="right"/>
25903 <tbody>
25904 <row>
25905 <entry><option>exim_path</option></entry>
25906 <entry>Use: <emphasis>main</emphasis></entry>
25907 <entry>Type: <emphasis>string</emphasis></entry>
25908 <entry>Default: <emphasis>see below</emphasis></entry>
25909 </row>
25910 </tbody>
25911 </tgroup>
25912 </informaltable>
25913 <para>
25914 <indexterm role="concept">
25915 <primary>Exim binary, path name</primary>
25916 </indexterm>
25917 This option specifies the path name of the Exim binary, which is used when Exim
25918 needs to re-exec itself. The default is set up to point to the file <emphasis>exim</emphasis> in
25919 the directory configured at compile time by the BIN_DIRECTORY setting. It
25920 is necessary to change <option>exim_path</option> if, exceptionally, Exim is run from some
25921 other place.
25922 <emphasis role="bold">Warning</emphasis>: Do not use a macro to define the value of this option, because
25923 you will break those Exim utilities that scan the configuration file to find
25924 where the binary is. (They then use the <option>-bP</option> option to extract option
25925 settings such as the value of <option>spool_directory</option>.)
25926 </para>
25927 <para>
25928 <indexterm role="option">
25929 <primary><option>exim_user</option></primary>
25930 </indexterm>
25931 </para>
25932 <informaltable frame="all">
25933 <tgroup cols="4" colsep="0" rowsep="0">
25934 <colspec colwidth="8*" align="left"/>
25935 <colspec colwidth="6*" align="center"/>
25936 <colspec colwidth="6*" align="center"/>
25937 <colspec colwidth="6*" align="right"/>
25938 <tbody>
25939 <row>
25940 <entry><option>exim_user</option></entry>
25941 <entry>Use: <emphasis>main</emphasis></entry>
25942 <entry>Type: <emphasis>string</emphasis></entry>
25943 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
25944 </row>
25945 </tbody>
25946 </tgroup>
25947 </informaltable>
25948 <para>
25949 <indexterm role="concept">
25950 <primary>uid (user id)</primary>
25951 <secondary>Exim&#x2019;s own</secondary>
25952 </indexterm>
25953 <indexterm role="concept">
25954 <primary>Exim user</primary>
25955 </indexterm>
25956 This option changes the uid under which Exim runs when it gives up root
25957 privilege. The default value is compiled into the binary. Ownership of the run
25958 time configuration file and the use of the <option>-C</option> and <option>-D</option> command line
25959 options is checked against the values in the binary, not what is set here.
25960 </para>
25961 <para>
25962 Unless it consists entirely of digits, the string is looked up using
25963 <function>getpwnam()</function>, and failure causes a configuration error. If <option>exim_group</option> is
25964 not also supplied, the gid is taken from the result of <function>getpwnam()</function> if it is
25965 used. See chapter <xref linkend="CHAPsecurity"/> for a discussion of security issues.
25966 </para>
25967 <para>
25968 <indexterm role="option">
25969 <primary><option>extra_local_interfaces</option></primary>
25970 </indexterm>
25971 </para>
25972 <informaltable frame="all">
25973 <tgroup cols="4" colsep="0" rowsep="0">
25974 <colspec colwidth="8*" align="left"/>
25975 <colspec colwidth="6*" align="center"/>
25976 <colspec colwidth="6*" align="center"/>
25977 <colspec colwidth="6*" align="right"/>
25978 <tbody>
25979 <row>
25980 <entry><option>extra_local_interfaces</option></entry>
25981 <entry>Use: <emphasis>main</emphasis></entry>
25982 <entry>Type: <emphasis>string list</emphasis></entry>
25983 <entry>Default: <emphasis>unset</emphasis></entry>
25984 </row>
25985 </tbody>
25986 </tgroup>
25987 </informaltable>
25988 <para>
25989 This option defines network interfaces that are to be considered local when
25990 routing, but which are not used for listening by the daemon. See section
25991 <xref linkend="SECTreclocipadd"/> for details.
25992 </para>
25993 <para>
25994 <indexterm role="option">
25995 <primary><option>extract_addresses_remove_arguments</option></primary>
25996 </indexterm>
25997 </para>
25998 <informaltable frame="all">
25999 <tgroup cols="4" colsep="0" rowsep="0">
26000 <colspec colwidth="8*" align="left"/>
26001 <colspec colwidth="6*" align="center"/>
26002 <colspec colwidth="6*" align="center"/>
26003 <colspec colwidth="6*" align="right"/>
26004 <tbody>
26005 <row>
26006 <entry><option>extract_addresses_remove_arguments</option></entry>
26007 <entry>Use: <emphasis>main</emphasis></entry>
26008 <entry>Type: <emphasis>boolean</emphasis></entry>
26009 <entry>Default: <emphasis>true</emphasis></entry>
26010 </row>
26011 </tbody>
26012 </tgroup>
26013 </informaltable>
26014 <para>
26015 <indexterm role="option">
26016 <primary><option>-t</option></primary>
26017 </indexterm>
26018 <indexterm role="concept">
26019 <primary>command line</primary>
26020 <secondary>addresses with <option>-t</option></secondary>
26021 </indexterm>
26022 <indexterm role="concept">
26023 <primary>Sendmail compatibility</primary>
26024 <secondary><option>-t</option> option</secondary>
26025 </indexterm>
26026 According to some Sendmail documentation (Sun, IRIX, HP-UX), if any addresses
26027 are present on the command line when the <option>-t</option> option is used to build an
26028 envelope from a message&#x2019;s <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis> and <emphasis>Bcc:</emphasis> headers, the command
26029 line addresses are removed from the recipients list. This is also how Smail
26030 behaves. However, other Sendmail documentation (the O&#x2019;Reilly book) states that
26031 command line addresses are added to those obtained from the header lines. When
26032 <option>extract_addresses_remove_arguments</option> is true (the default), Exim subtracts
26033 argument headers. If it is set false, Exim adds rather than removes argument
26034 addresses.
26035 </para>
26036 <para>
26037 <indexterm role="option">
26038 <primary><option>finduser_retries</option></primary>
26039 </indexterm>
26040 </para>
26041 <informaltable frame="all">
26042 <tgroup cols="4" colsep="0" rowsep="0">
26043 <colspec colwidth="8*" align="left"/>
26044 <colspec colwidth="6*" align="center"/>
26045 <colspec colwidth="6*" align="center"/>
26046 <colspec colwidth="6*" align="right"/>
26047 <tbody>
26048 <row>
26049 <entry><option>finduser_retries</option></entry>
26050 <entry>Use: <emphasis>main</emphasis></entry>
26051 <entry>Type: <emphasis>integer</emphasis></entry>
26052 <entry>Default: <emphasis>0</emphasis></entry>
26053 </row>
26054 </tbody>
26055 </tgroup>
26056 </informaltable>
26057 <para>
26058 <indexterm role="concept">
26059 <primary>NIS, retrying user lookups</primary>
26060 </indexterm>
26061 On systems running NIS or other schemes in which user and group information is
26062 distributed from a remote system, there can be times when <function>getpwnam()</function> and
26063 related functions fail, even when given valid data, because things time out.
26064 Unfortunately these failures cannot be distinguished from genuine <quote>not found</quote>
26065 errors. If <option>finduser_retries</option> is set greater than zero, Exim will try that
26066 many extra times to find a user or a group, waiting for one second between
26067 retries.
26068 </para>
26069 <para>
26070 <indexterm role="concept">
26071 <primary><filename>/etc/passwd</filename></primary>
26072 <secondary>multiple reading of</secondary>
26073 </indexterm>
26074 You should not set this option greater than zero if your user information is in
26075 a traditional <filename>/etc/passwd</filename> file, because it will cause Exim needlessly to
26076 search the file multiple times for non-existent users, and also cause delay.
26077 </para>
26078 <para>
26079 <indexterm role="option">
26080 <primary><option>freeze_tell</option></primary>
26081 </indexterm>
26082 </para>
26083 <informaltable frame="all">
26084 <tgroup cols="4" colsep="0" rowsep="0">
26085 <colspec colwidth="8*" align="left"/>
26086 <colspec colwidth="6*" align="center"/>
26087 <colspec colwidth="6*" align="center"/>
26088 <colspec colwidth="6*" align="right"/>
26089 <tbody>
26090 <row>
26091 <entry><option>freeze_tell</option></entry>
26092 <entry>Use: <emphasis>main</emphasis></entry>
26093 <entry>Type: <emphasis>string list, comma separated</emphasis></entry>
26094 <entry>Default: <emphasis>unset</emphasis></entry>
26095 </row>
26096 </tbody>
26097 </tgroup>
26098 </informaltable>
26099 <para>
26100 <indexterm role="concept">
26101 <primary>freezing messages</primary>
26102 <secondary>sending a message when freezing</secondary>
26103 </indexterm>
26104 On encountering certain errors, or when configured to do so in a system filter,
26105 ACL, or special router, Exim freezes a message. This means that no further
26106 delivery attempts take place until an administrator thaws the message, or the
26107 <option>auto_thaw</option>, <option>ignore_bounce_errors_after</option>, or <option>timeout_frozen_after</option>
26108 feature cause it to be processed. If <option>freeze_tell</option> is set, Exim generates a
26109 warning message whenever it freezes something, unless the message it is
26110 freezing is a locally-generated bounce message. (Without this exception there
26111 is the possibility of looping.) The warning message is sent to the addresses
26112 supplied as the comma-separated value of this option. If several of the
26113 message&#x2019;s addresses cause freezing, only a single message is sent. If the
26114 freezing was automatic, the reason(s) for freezing can be found in the message
26115 log. If you configure freezing in a filter or ACL, you must arrange for any
26116 logging that you require.
26117 </para>
26118 <para>
26119 <indexterm role="option">
26120 <primary><option>gecos_name</option></primary>
26121 </indexterm>
26122 </para>
26123 <informaltable frame="all">
26124 <tgroup cols="4" colsep="0" rowsep="0">
26125 <colspec colwidth="8*" align="left"/>
26126 <colspec colwidth="6*" align="center"/>
26127 <colspec colwidth="6*" align="center"/>
26128 <colspec colwidth="6*" align="right"/>
26129 <tbody>
26130 <row>
26131 <entry><option>gecos_name</option></entry>
26132 <entry>Use: <emphasis>main</emphasis></entry>
26133 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26134 <entry>Default: <emphasis>unset</emphasis></entry>
26135 </row>
26136 </tbody>
26137 </tgroup>
26138 </informaltable>
26139 <para>
26140 <indexterm role="concept">
26141 <primary>HP-UX</primary>
26142 </indexterm>
26143 <indexterm role="concept">
26144 <primary><quote>gecos</quote> field, parsing</primary>
26145 </indexterm>
26146 Some operating systems, notably HP-UX, use the <quote>gecos</quote> field in the system
26147 password file to hold other information in addition to users&#x2019; real names. Exim
26148 looks up this field for use when it is creating <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis>
26149 headers. If either <option>gecos_pattern</option> or <option>gecos_name</option> are unset, the contents
26150 of the field are used unchanged, except that, if an ampersand is encountered,
26151 it is replaced by the user&#x2019;s login name with the first character forced to
26152 upper case, since this is a convention that is observed on many systems.
26153 </para>
26154 <para>
26155 When these options are set, <option>gecos_pattern</option> is treated as a regular
26156 expression that is to be applied to the field (again with &amp; replaced by the
26157 login name), and if it matches, <option>gecos_name</option> is expanded and used as the
26158 user&#x2019;s name.
26159 </para>
26160 <para>
26161 <indexterm role="concept">
26162 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
26163 <secondary>in <option>gecos_name</option></secondary>
26164 </indexterm>
26165 Numeric variables such as <varname>$1</varname>, <varname>$2</varname>, etc. can be used in the expansion to
26166 pick up sub-fields that were matched by the pattern. In HP-UX, where the user&#x2019;s
26167 name terminates at the first comma, the following can be used:
26168 </para>
26169 <literallayout class="monospaced">
26170 gecos_pattern = ([^,]*)
26171 gecos_name = $1
26172 </literallayout>
26173 <para>
26174 <indexterm role="option">
26175 <primary><option>gecos_pattern</option></primary>
26176 </indexterm>
26177 </para>
26178 <informaltable frame="all">
26179 <tgroup cols="4" colsep="0" rowsep="0">
26180 <colspec colwidth="8*" align="left"/>
26181 <colspec colwidth="6*" align="center"/>
26182 <colspec colwidth="6*" align="center"/>
26183 <colspec colwidth="6*" align="right"/>
26184 <tbody>
26185 <row>
26186 <entry><option>gecos_pattern</option></entry>
26187 <entry>Use: <emphasis>main</emphasis></entry>
26188 <entry>Type: <emphasis>string</emphasis></entry>
26189 <entry>Default: <emphasis>unset</emphasis></entry>
26190 </row>
26191 </tbody>
26192 </tgroup>
26193 </informaltable>
26194 <para>
26195 See <option>gecos_name</option> above.
26196 </para>
26197 <para>
26198 <indexterm role="option">
26199 <primary><option>gnutls_compat_mode</option></primary>
26200 </indexterm>
26201 </para>
26202 <informaltable frame="all">
26203 <tgroup cols="4" colsep="0" rowsep="0">
26204 <colspec colwidth="8*" align="left"/>
26205 <colspec colwidth="6*" align="center"/>
26206 <colspec colwidth="6*" align="center"/>
26207 <colspec colwidth="6*" align="right"/>
26208 <tbody>
26209 <row>
26210 <entry><option>gnutls_compat_mode</option></entry>
26211 <entry>Use: <emphasis>main</emphasis></entry>
26212 <entry>Type: <emphasis>boolean</emphasis></entry>
26213 <entry>Default: <emphasis>unset</emphasis></entry>
26214 </row>
26215 </tbody>
26216 </tgroup>
26217 </informaltable>
26218 <para>
26219 This option controls whether GnuTLS is used in compatibility mode in an Exim
26220 server. This reduces security slightly, but improves interworking with older
26221 implementations of TLS.
26222 </para>
26223 <para>
26224 <indexterm role="option">
26225 <primary><option>gnutls_allow_auto_pkcs11</option></primary>
26226 </indexterm>
26227 </para>
26228 <informaltable frame="all">
26229 <tgroup cols="4" colsep="0" rowsep="0">
26230 <colspec colwidth="8*" align="left"/>
26231 <colspec colwidth="6*" align="center"/>
26232 <colspec colwidth="6*" align="center"/>
26233 <colspec colwidth="6*" align="right"/>
26234 <tbody>
26235 <row>
26236 <entry><option>gnutls_allow_auto_pkcs11</option></entry>
26237 <entry>Use: <emphasis>main</emphasis></entry>
26238 <entry>Type: <emphasis>boolean</emphasis></entry>
26239 <entry>Default: <emphasis>unset</emphasis></entry>
26240 </row>
26241 </tbody>
26242 </tgroup>
26243 </informaltable>
26244 <para>
26245 This option will let GnuTLS (2.12.0 or later) autoload PKCS11 modules with
26246 the p11-kit configuration files in <filename>/etc/pkcs11/modules/</filename>.
26247 </para>
26248 <para>
26249 See
26250 <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>
26251 for documentation.
26252 </para>
26253 <para>
26254 <indexterm role="option">
26255 <primary><option>headers_charset</option></primary>
26256 </indexterm>
26257 </para>
26258 <informaltable frame="all">
26259 <tgroup cols="4" colsep="0" rowsep="0">
26260 <colspec colwidth="8*" align="left"/>
26261 <colspec colwidth="6*" align="center"/>
26262 <colspec colwidth="6*" align="center"/>
26263 <colspec colwidth="6*" align="right"/>
26264 <tbody>
26265 <row>
26266 <entry><option>headers_charset</option></entry>
26267 <entry>Use: <emphasis>main</emphasis></entry>
26268 <entry>Type: <emphasis>string</emphasis></entry>
26269 <entry>Default: <emphasis>see below</emphasis></entry>
26270 </row>
26271 </tbody>
26272 </tgroup>
26273 </informaltable>
26274 <para>
26275 This option sets a default character set for translating from encoded MIME
26276 <quote>words</quote> in header lines, when referenced by an <varname>$h_xxx</varname> expansion item. The
26277 default is the value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The
26278 ultimate default is ISO-8859-1. For more details see the description of header
26279 insertions in section <xref linkend="SECTexpansionitems"/>.
26280 </para>
26281 <para>
26282 <indexterm role="option">
26283 <primary><option>header_maxsize</option></primary>
26284 </indexterm>
26285 </para>
26286 <informaltable frame="all">
26287 <tgroup cols="4" colsep="0" rowsep="0">
26288 <colspec colwidth="8*" align="left"/>
26289 <colspec colwidth="6*" align="center"/>
26290 <colspec colwidth="6*" align="center"/>
26291 <colspec colwidth="6*" align="right"/>
26292 <tbody>
26293 <row>
26294 <entry><option>header_maxsize</option></entry>
26295 <entry>Use: <emphasis>main</emphasis></entry>
26296 <entry>Type: <emphasis>integer</emphasis></entry>
26297 <entry>Default: <emphasis>see below</emphasis></entry>
26298 </row>
26299 </tbody>
26300 </tgroup>
26301 </informaltable>
26302 <para>
26303 <indexterm role="concept">
26304 <primary>header section</primary>
26305 <secondary>maximum size of</secondary>
26306 </indexterm>
26307 <indexterm role="concept">
26308 <primary>limit</primary>
26309 <secondary>size of message header section</secondary>
26310 </indexterm>
26311 This option controls the overall maximum size of a message&#x2019;s header
26312 section. The default is the value of HEADER_MAXSIZE in
26313 <filename>Local/Makefile</filename>; the default for that is 1M. Messages with larger header
26314 sections are rejected.
26315 </para>
26316 <para>
26317 <indexterm role="option">
26318 <primary><option>header_line_maxsize</option></primary>
26319 </indexterm>
26320 </para>
26321 <informaltable frame="all">
26322 <tgroup cols="4" colsep="0" rowsep="0">
26323 <colspec colwidth="8*" align="left"/>
26324 <colspec colwidth="6*" align="center"/>
26325 <colspec colwidth="6*" align="center"/>
26326 <colspec colwidth="6*" align="right"/>
26327 <tbody>
26328 <row>
26329 <entry><option>header_line_maxsize</option></entry>
26330 <entry>Use: <emphasis>main</emphasis></entry>
26331 <entry>Type: <emphasis>integer</emphasis></entry>
26332 <entry>Default: <emphasis>0</emphasis></entry>
26333 </row>
26334 </tbody>
26335 </tgroup>
26336 </informaltable>
26337 <para>
26338 <indexterm role="concept">
26339 <primary>header lines</primary>
26340 <secondary>maximum size of</secondary>
26341 </indexterm>
26342 <indexterm role="concept">
26343 <primary>limit</primary>
26344 <secondary>size of one header line</secondary>
26345 </indexterm>
26346 This option limits the length of any individual header line in a message, after
26347 all the continuations have been joined together. Messages with individual
26348 header lines that are longer than the limit are rejected. The default value of
26349 zero means <quote>no limit</quote>.
26350 </para>
26351 <para>
26352 <indexterm role="option">
26353 <primary><option>helo_accept_junk_hosts</option></primary>
26354 </indexterm>
26355 </para>
26356 <informaltable frame="all">
26357 <tgroup cols="4" colsep="0" rowsep="0">
26358 <colspec colwidth="8*" align="left"/>
26359 <colspec colwidth="6*" align="center"/>
26360 <colspec colwidth="6*" align="center"/>
26361 <colspec colwidth="6*" align="right"/>
26362 <tbody>
26363 <row>
26364 <entry><option>helo_accept_junk_hosts</option></entry>
26365 <entry>Use: <emphasis>main</emphasis></entry>
26366 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26367 <entry>Default: <emphasis>unset</emphasis></entry>
26368 </row>
26369 </tbody>
26370 </tgroup>
26371 </informaltable>
26372 <para>
26373 <indexterm role="concept">
26374 <primary>HELO</primary>
26375 <secondary>accepting junk data</secondary>
26376 </indexterm>
26377 <indexterm role="concept">
26378 <primary>EHLO</primary>
26379 <secondary>accepting junk data</secondary>
26380 </indexterm>
26381 Exim checks the syntax of HELO and EHLO commands for incoming SMTP
26382 mail, and gives an error response for invalid data. Unfortunately, there are
26383 some SMTP clients that send syntactic junk. They can be accommodated by setting
26384 this option. Note that this is a syntax check only. See <option>helo_verify_hosts</option>
26385 if you want to do semantic checking.
26386 See also <option>helo_allow_chars</option> for a way of extending the permitted character
26387 set.
26388 </para>
26389 <para>
26390 <indexterm role="option">
26391 <primary><option>helo_allow_chars</option></primary>
26392 </indexterm>
26393 </para>
26394 <informaltable frame="all">
26395 <tgroup cols="4" colsep="0" rowsep="0">
26396 <colspec colwidth="8*" align="left"/>
26397 <colspec colwidth="6*" align="center"/>
26398 <colspec colwidth="6*" align="center"/>
26399 <colspec colwidth="6*" align="right"/>
26400 <tbody>
26401 <row>
26402 <entry><option>helo_allow_chars</option></entry>
26403 <entry>Use: <emphasis>main</emphasis></entry>
26404 <entry>Type: <emphasis>string</emphasis></entry>
26405 <entry>Default: <emphasis>unset</emphasis></entry>
26406 </row>
26407 </tbody>
26408 </tgroup>
26409 </informaltable>
26410 <para>
26411 <indexterm role="concept">
26412 <primary>HELO</primary>
26413 <secondary>underscores in</secondary>
26414 </indexterm>
26415 <indexterm role="concept">
26416 <primary>EHLO</primary>
26417 <secondary>underscores in</secondary>
26418 </indexterm>
26419 <indexterm role="concept">
26420 <primary>underscore in EHLO/HELO</primary>
26421 </indexterm>
26422 This option can be set to a string of rogue characters that are permitted in
26423 all EHLO and HELO names in addition to the standard letters, digits,
26424 hyphens, and dots. If you really must allow underscores, you can set
26425 </para>
26426 <literallayout class="monospaced">
26427 helo_allow_chars = _
26428 </literallayout>
26429 <para>
26430 Note that the value is one string, not a list.
26431 </para>
26432 <para>
26433 <indexterm role="option">
26434 <primary><option>helo_lookup_domains</option></primary>
26435 </indexterm>
26436 </para>
26437 <informaltable frame="all">
26438 <tgroup cols="4" colsep="0" rowsep="0">
26439 <colspec colwidth="8*" align="left"/>
26440 <colspec colwidth="6*" align="center"/>
26441 <colspec colwidth="6*" align="center"/>
26442 <colspec colwidth="6*" align="right"/>
26443 <tbody>
26444 <row>
26445 <entry><option>helo_lookup_domains</option></entry>
26446 <entry>Use: <emphasis>main</emphasis></entry>
26447 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
26448 <entry>Default: <emphasis><literal>@:@[]</literal></emphasis></entry>
26449 </row>
26450 </tbody>
26451 </tgroup>
26452 </informaltable>
26453 <para>
26454 <indexterm role="concept">
26455 <primary>HELO</primary>
26456 <secondary>forcing reverse lookup</secondary>
26457 </indexterm>
26458 <indexterm role="concept">
26459 <primary>EHLO</primary>
26460 <secondary>forcing reverse lookup</secondary>
26461 </indexterm>
26462 If the domain given by a client in a HELO or EHLO command matches this
26463 list, a reverse lookup is done in order to establish the host&#x2019;s true name. The
26464 default forces a lookup if the client host gives the server&#x2019;s name or any of
26465 its IP addresses (in brackets), something that broken clients have been seen to
26466 do.
26467 </para>
26468 <para>
26469 <indexterm role="option">
26470 <primary><option>helo_try_verify_hosts</option></primary>
26471 </indexterm>
26472 </para>
26473 <informaltable frame="all">
26474 <tgroup cols="4" colsep="0" rowsep="0">
26475 <colspec colwidth="8*" align="left"/>
26476 <colspec colwidth="6*" align="center"/>
26477 <colspec colwidth="6*" align="center"/>
26478 <colspec colwidth="6*" align="right"/>
26479 <tbody>
26480 <row>
26481 <entry><option>helo_try_verify_hosts</option></entry>
26482 <entry>Use: <emphasis>main</emphasis></entry>
26483 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26484 <entry>Default: <emphasis>unset</emphasis></entry>
26485 </row>
26486 </tbody>
26487 </tgroup>
26488 </informaltable>
26489 <para>
26490 <indexterm role="concept">
26491 <primary>HELO verifying</primary>
26492 <secondary>optional</secondary>
26493 </indexterm>
26494 <indexterm role="concept">
26495 <primary>EHLO</primary>
26496 <secondary>verifying, optional</secondary>
26497 </indexterm>
26498 By default, Exim just checks the syntax of HELO and EHLO commands (see
26499 <option>helo_accept_junk_hosts</option> and <option>helo_allow_chars</option>). However, some sites like
26500 to do more extensive checking of the data supplied by these commands. The ACL
26501 condition <literal>verify = helo</literal> is provided to make this possible.
26502 Formerly, it was necessary also to set this option (<option>helo_try_verify_hosts</option>)
26503 to force the check to occur. From release 4.53 onwards, this is no longer
26504 necessary. If the check has not been done before <literal>verify = helo</literal> is
26505 encountered, it is done at that time. Consequently, this option is obsolete.
26506 Its specification is retained here for backwards compatibility.
26507 </para>
26508 <para>
26509 When an EHLO or HELO command is received, if the calling host matches
26510 <option>helo_try_verify_hosts</option>, Exim checks that the host name given in the HELO or
26511 EHLO command either:
26512 </para>
26513 <itemizedlist>
26514 <listitem>
26515 <para>
26516 is an IP literal matching the calling address of the host, or
26517 </para>
26518 </listitem>
26519 <listitem>
26520 <para>
26521 <indexterm role="concept">
26522 <primary>DNS</primary>
26523 <secondary>reverse lookup</secondary>
26524 </indexterm>
26525 <indexterm role="concept">
26526 <primary>reverse DNS lookup</primary>
26527 </indexterm>
26528 matches the host name that Exim obtains by doing a reverse lookup of the
26529 calling host address, or
26530 </para>
26531 </listitem>
26532 <listitem>
26533 <para>
26534 when looked up in DNS yields the calling host address.
26535 </para>
26536 </listitem>
26537 </itemizedlist>
26538 <para>
26539 However, the EHLO or HELO command is not rejected if any of the checks
26540 fail. Processing continues, but the result of the check is remembered, and can
26541 be detected later in an ACL by the <literal>verify = helo</literal> condition.
26542 </para>
26543 <para>
26544 If DNS was used for successful verification, the variable
26545 <indexterm role="concept">
26546 <primary>DNS</primary>
26547 <secondary>DNSSEC</secondary>
26548 </indexterm>
26549 <varname>$helo_verify_dnssec</varname> records the DNSSEC status of the lookups.
26550 </para>
26551 <para>
26552 <indexterm role="option">
26553 <primary><option>helo_verify_hosts</option></primary>
26554 </indexterm>
26555 </para>
26556 <informaltable frame="all">
26557 <tgroup cols="4" colsep="0" rowsep="0">
26558 <colspec colwidth="8*" align="left"/>
26559 <colspec colwidth="6*" align="center"/>
26560 <colspec colwidth="6*" align="center"/>
26561 <colspec colwidth="6*" align="right"/>
26562 <tbody>
26563 <row>
26564 <entry><option>helo_verify_hosts</option></entry>
26565 <entry>Use: <emphasis>main</emphasis></entry>
26566 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26567 <entry>Default: <emphasis>unset</emphasis></entry>
26568 </row>
26569 </tbody>
26570 </tgroup>
26571 </informaltable>
26572 <para>
26573 <indexterm role="concept">
26574 <primary>HELO verifying</primary>
26575 <secondary>mandatory</secondary>
26576 </indexterm>
26577 <indexterm role="concept">
26578 <primary>EHLO</primary>
26579 <secondary>verifying, mandatory</secondary>
26580 </indexterm>
26581 Like <option>helo_try_verify_hosts</option>, this option is obsolete, and retained only for
26582 backwards compatibility. For hosts that match this option, Exim checks the host
26583 name given in the HELO or EHLO in the same way as for
26584 <option>helo_try_verify_hosts</option>. If the check fails, the HELO or EHLO command is
26585 rejected with a 550 error, and entries are written to the main and reject logs.
26586 If a MAIL command is received before EHLO or HELO, it is rejected with a 503
26587 error.
26588 </para>
26589 <para>
26590 <indexterm role="option">
26591 <primary><option>hold_domains</option></primary>
26592 </indexterm>
26593 </para>
26594 <informaltable frame="all">
26595 <tgroup cols="4" colsep="0" rowsep="0">
26596 <colspec colwidth="8*" align="left"/>
26597 <colspec colwidth="6*" align="center"/>
26598 <colspec colwidth="6*" align="center"/>
26599 <colspec colwidth="6*" align="right"/>
26600 <tbody>
26601 <row>
26602 <entry><option>hold_domains</option></entry>
26603 <entry>Use: <emphasis>main</emphasis></entry>
26604 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
26605 <entry>Default: <emphasis>unset</emphasis></entry>
26606 </row>
26607 </tbody>
26608 </tgroup>
26609 </informaltable>
26610 <para>
26611 <indexterm role="concept">
26612 <primary>domain</primary>
26613 <secondary>delaying delivery</secondary>
26614 </indexterm>
26615 <indexterm role="concept">
26616 <primary>delivery</primary>
26617 <secondary>delaying certain domains</secondary>
26618 </indexterm>
26619 This option allows mail for particular domains to be held in the queue
26620 manually. The option is overridden if a message delivery is forced with the
26621 <option>-M</option>, <option>-qf</option>, <option>-Rf</option> or <option>-Sf</option> options, and also while testing or
26622 verifying addresses using <option>-bt</option> or <option>-bv</option>. Otherwise, if a domain matches an
26623 item in <option>hold_domains</option>, no routing or delivery for that address is done, and
26624 it is deferred every time the message is looked at.
26625 </para>
26626 <para>
26627 This option is intended as a temporary operational measure for delaying the
26628 delivery of mail while some problem is being sorted out, or some new
26629 configuration tested. If you just want to delay the processing of some
26630 domains until a queue run occurs, you should use <option>queue_domains</option> or
26631 <option>queue_smtp_domains</option>, not <option>hold_domains</option>.
26632 </para>
26633 <para>
26634 A setting of <option>hold_domains</option> does not override Exim&#x2019;s code for removing
26635 messages from the queue if they have been there longer than the longest retry
26636 time in any retry rule. If you want to hold messages for longer than the normal
26637 retry times, insert a dummy retry rule with a long retry time.
26638 </para>
26639 <para>
26640 <indexterm role="option">
26641 <primary><option>host_lookup</option></primary>
26642 </indexterm>
26643 </para>
26644 <informaltable frame="all">
26645 <tgroup cols="4" colsep="0" rowsep="0">
26646 <colspec colwidth="8*" align="left"/>
26647 <colspec colwidth="6*" align="center"/>
26648 <colspec colwidth="6*" align="center"/>
26649 <colspec colwidth="6*" align="right"/>
26650 <tbody>
26651 <row>
26652 <entry><option>host_lookup</option></entry>
26653 <entry>Use: <emphasis>main</emphasis></entry>
26654 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26655 <entry>Default: <emphasis>unset</emphasis></entry>
26656 </row>
26657 </tbody>
26658 </tgroup>
26659 </informaltable>
26660 <para>
26661 <indexterm role="concept">
26662 <primary>host name</primary>
26663 <secondary>lookup, forcing</secondary>
26664 </indexterm>
26665 Exim does not look up the name of a calling host from its IP address unless it
26666 is required to compare against some host list, or the host matches
26667 <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>, or the host matches this
26668 option (which normally contains IP addresses rather than host names). The
26669 default configuration file contains
26670 </para>
26671 <literallayout class="monospaced">
26672 host_lookup = *
26673 </literallayout>
26674 <para>
26675 which causes a lookup to happen for all hosts. If the expense of these lookups
26676 is felt to be too great, the setting can be changed or removed.
26677 </para>
26678 <para>
26679 After a successful reverse lookup, Exim does a forward lookup on the name it
26680 has obtained, to verify that it yields the IP address that it started with. If
26681 this check fails, Exim behaves as if the name lookup failed.
26682 </para>
26683 <para>
26684 <indexterm role="variable">
26685 <primary><varname>$host_lookup_failed</varname></primary>
26686 </indexterm>
26687 <indexterm role="variable">
26688 <primary><varname>$sender_host_name</varname></primary>
26689 </indexterm>
26690 After any kind of failure, the host name (in <varname>$sender_host_name</varname>) remains
26691 unset, and <varname>$host_lookup_failed</varname> is set to the string <quote>1</quote>. See also
26692 <option>dns_again_means_nonexist</option>, <option>helo_lookup_domains</option>, and
26693 <literal>verify = reverse_host_lookup</literal> in ACLs.
26694 </para>
26695 <para>
26696 <indexterm role="option">
26697 <primary><option>host_lookup_order</option></primary>
26698 </indexterm>
26699 </para>
26700 <informaltable frame="all">
26701 <tgroup cols="4" colsep="0" rowsep="0">
26702 <colspec colwidth="8*" align="left"/>
26703 <colspec colwidth="6*" align="center"/>
26704 <colspec colwidth="6*" align="center"/>
26705 <colspec colwidth="6*" align="right"/>
26706 <tbody>
26707 <row>
26708 <entry><option>host_lookup_order</option></entry>
26709 <entry>Use: <emphasis>main</emphasis></entry>
26710 <entry>Type: <emphasis>string list</emphasis></entry>
26711 <entry>Default: <emphasis><literal>bydns:byaddr</literal></emphasis></entry>
26712 </row>
26713 </tbody>
26714 </tgroup>
26715 </informaltable>
26716 <para>
26717 This option specifies the order of different lookup methods when Exim is trying
26718 to find a host name from an IP address. The default is to do a DNS lookup
26719 first, and then to try a local lookup (using <function>gethostbyaddr()</function> or equivalent)
26720 if that fails. You can change the order of these lookups, or omit one entirely,
26721 if you want.
26722 </para>
26723 <para>
26724 <emphasis role="bold">Warning</emphasis>: The <quote>byaddr</quote> method does not always yield aliases when there are
26725 multiple PTR records in the DNS and the IP address is not listed in
26726 <filename>/etc/hosts</filename>. Different operating systems give different results in this
26727 case. That is why the default tries a DNS lookup first.
26728 </para>
26729 <para>
26730 <indexterm role="option">
26731 <primary><option>host_reject_connection</option></primary>
26732 </indexterm>
26733 </para>
26734 <informaltable frame="all">
26735 <tgroup cols="4" colsep="0" rowsep="0">
26736 <colspec colwidth="8*" align="left"/>
26737 <colspec colwidth="6*" align="center"/>
26738 <colspec colwidth="6*" align="center"/>
26739 <colspec colwidth="6*" align="right"/>
26740 <tbody>
26741 <row>
26742 <entry><option>host_reject_connection</option></entry>
26743 <entry>Use: <emphasis>main</emphasis></entry>
26744 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26745 <entry>Default: <emphasis>unset</emphasis></entry>
26746 </row>
26747 </tbody>
26748 </tgroup>
26749 </informaltable>
26750 <para>
26751 <indexterm role="concept">
26752 <primary>host</primary>
26753 <secondary>rejecting connections from</secondary>
26754 </indexterm>
26755 If this option is set, incoming SMTP calls from the hosts listed are rejected
26756 as soon as the connection is made.
26757 This option is obsolete, and retained only for backward compatibility, because
26758 nowadays the ACL specified by <option>acl_smtp_connect</option> can also reject incoming
26759 connections immediately.
26760 </para>
26761 <para>
26762 The ability to give an immediate rejection (either by this option or using an
26763 ACL) is provided for use in unusual cases. Many hosts will just try again,
26764 sometimes without much delay. Normally, it is better to use an ACL to reject
26765 incoming messages at a later stage, such as after RCPT commands. See
26766 chapter <xref linkend="CHAPACL"/>.
26767 </para>
26768 <para>
26769 <indexterm role="option">
26770 <primary><option>hosts_connection_nolog</option></primary>
26771 </indexterm>
26772 </para>
26773 <informaltable frame="all">
26774 <tgroup cols="4" colsep="0" rowsep="0">
26775 <colspec colwidth="8*" align="left"/>
26776 <colspec colwidth="6*" align="center"/>
26777 <colspec colwidth="6*" align="center"/>
26778 <colspec colwidth="6*" align="right"/>
26779 <tbody>
26780 <row>
26781 <entry><option>hosts_connection_nolog</option></entry>
26782 <entry>Use: <emphasis>main</emphasis></entry>
26783 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26784 <entry>Default: <emphasis>unset</emphasis></entry>
26785 </row>
26786 </tbody>
26787 </tgroup>
26788 </informaltable>
26789 <para>
26790 <indexterm role="concept">
26791 <primary>host</primary>
26792 <secondary>not logging connections from</secondary>
26793 </indexterm>
26794 This option defines a list of hosts for which connection logging does not
26795 happen, even though the <option>smtp_connection</option> log selector is set. For example,
26796 you might want not to log SMTP connections from local processes, or from
26797 127.0.0.1, or from your local LAN. This option is consulted in the main loop of
26798 the daemon; you should therefore strive to restrict its value to a short inline
26799 list of IP addresses and networks. To disable logging SMTP connections from
26800 local processes, you must create a host list with an empty item. For example:
26801 </para>
26802 <literallayout class="monospaced">
26803 hosts_connection_nolog = :
26804 </literallayout>
26805 <para>
26806 If the <option>smtp_connection</option> log selector is not set, this option has no effect.
26807 </para>
26808 <para>
26809 <indexterm role="option">
26810 <primary><option>hosts_proxy</option></primary>
26811 </indexterm>
26812 </para>
26813 <informaltable frame="all">
26814 <tgroup cols="4" colsep="0" rowsep="0">
26815 <colspec colwidth="8*" align="left"/>
26816 <colspec colwidth="6*" align="center"/>
26817 <colspec colwidth="6*" align="center"/>
26818 <colspec colwidth="6*" align="right"/>
26819 <tbody>
26820 <row>
26821 <entry><option>hosts_proxy</option></entry>
26822 <entry>Use: <emphasis>main</emphasis></entry>
26823 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26824 <entry>Default: <emphasis>unset</emphasis></entry>
26825 </row>
26826 </tbody>
26827 </tgroup>
26828 </informaltable>
26829 <para>
26830 <indexterm role="concept">
26831 <primary>proxy</primary>
26832 <secondary>proxy protocol</secondary>
26833 </indexterm>
26834 This option enables use of Proxy Protocol proxies for incoming
26835 connections.  For details see section <xref linkend="SECTproxyInbound"/>.
26836 </para>
26837 <para>
26838 <indexterm role="option">
26839 <primary><option>hosts_treat_as_local</option></primary>
26840 </indexterm>
26841 </para>
26842 <informaltable frame="all">
26843 <tgroup cols="4" colsep="0" rowsep="0">
26844 <colspec colwidth="8*" align="left"/>
26845 <colspec colwidth="6*" align="center"/>
26846 <colspec colwidth="6*" align="center"/>
26847 <colspec colwidth="6*" align="right"/>
26848 <tbody>
26849 <row>
26850 <entry><option>hosts_treat_as_local</option></entry>
26851 <entry>Use: <emphasis>main</emphasis></entry>
26852 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
26853 <entry>Default: <emphasis>unset</emphasis></entry>
26854 </row>
26855 </tbody>
26856 </tgroup>
26857 </informaltable>
26858 <para>
26859 <indexterm role="concept">
26860 <primary>local host</primary>
26861 <secondary>domains treated as</secondary>
26862 </indexterm>
26863 <indexterm role="concept">
26864 <primary>host</primary>
26865 <secondary>treated as local</secondary>
26866 </indexterm>
26867 If this option is set, any host names that match the domain list are treated as
26868 if they were the local host when Exim is scanning host lists obtained from MX
26869 records
26870 or other sources. Note that the value of this option is a domain list, not a
26871 host list, because it is always used to check host names, not IP addresses.
26872 </para>
26873 <para>
26874 This option also applies when Exim is matching the special items
26875 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal> in a domain list (see
26876 section <xref linkend="SECTdomainlist"/>), and when checking the <option>hosts</option> option in the
26877 <command>smtp</command> transport for the local host (see the <option>allow_localhost</option> option in
26878 that transport). See also <option>local_interfaces</option>, <option>extra_local_interfaces</option>, and
26879 chapter <xref linkend="CHAPinterfaces"/>, which contains a discussion about local network
26880 interfaces and recognizing the local host.
26881 </para>
26882 <para>
26883 <indexterm role="option">
26884 <primary><option>ibase_servers</option></primary>
26885 </indexterm>
26886 </para>
26887 <informaltable frame="all">
26888 <tgroup cols="4" colsep="0" rowsep="0">
26889 <colspec colwidth="8*" align="left"/>
26890 <colspec colwidth="6*" align="center"/>
26891 <colspec colwidth="6*" align="center"/>
26892 <colspec colwidth="6*" align="right"/>
26893 <tbody>
26894 <row>
26895 <entry><option>ibase_servers</option></entry>
26896 <entry>Use: <emphasis>main</emphasis></entry>
26897 <entry>Type: <emphasis>string list</emphasis></entry>
26898 <entry>Default: <emphasis>unset</emphasis></entry>
26899 </row>
26900 </tbody>
26901 </tgroup>
26902 </informaltable>
26903 <para>
26904 <indexterm role="concept">
26905 <primary>InterBase</primary>
26906 <secondary>server list</secondary>
26907 </indexterm>
26908 This option provides a list of InterBase servers and associated connection data,
26909 to be used in conjunction with <command>ibase</command> lookups (see section <xref linkend="SECID72"/>).
26910 The option is available only if Exim has been built with InterBase support.
26911 </para>
26912 <para>
26913 <indexterm role="option">
26914 <primary><option>ignore_bounce_errors_after</option></primary>
26915 </indexterm>
26916 </para>
26917 <informaltable frame="all">
26918 <tgroup cols="4" colsep="0" rowsep="0">
26919 <colspec colwidth="8*" align="left"/>
26920 <colspec colwidth="6*" align="center"/>
26921 <colspec colwidth="6*" align="center"/>
26922 <colspec colwidth="6*" align="right"/>
26923 <tbody>
26924 <row>
26925 <entry><option>ignore_bounce_errors_after</option></entry>
26926 <entry>Use: <emphasis>main</emphasis></entry>
26927 <entry>Type: <emphasis>time</emphasis></entry>
26928 <entry>Default: <emphasis>10w</emphasis></entry>
26929 </row>
26930 </tbody>
26931 </tgroup>
26932 </informaltable>
26933 <para>
26934 <indexterm role="concept">
26935 <primary>bounce message</primary>
26936 <secondary>discarding</secondary>
26937 </indexterm>
26938 <indexterm role="concept">
26939 <primary>discarding bounce message</primary>
26940 </indexterm>
26941 This option affects the processing of bounce messages that cannot be delivered,
26942 that is, those that suffer a permanent delivery failure. (Bounce messages that
26943 suffer temporary delivery failures are of course retried in the usual way.)
26944 </para>
26945 <para>
26946 After a permanent delivery failure, bounce messages are frozen,
26947 because there is no sender to whom they can be returned. When a frozen bounce
26948 message has been in the queue for more than the given time, it is unfrozen at
26949 the next queue run, and a further delivery is attempted. If delivery fails
26950 again, the bounce message is discarded. This makes it possible to keep failed
26951 bounce messages around for a shorter time than the normal maximum retry time
26952 for frozen messages. For example,
26953 </para>
26954 <literallayout class="monospaced">
26955 ignore_bounce_errors_after = 12h
26956 </literallayout>
26957 <para>
26958 retries failed bounce message deliveries after 12 hours, discarding any further
26959 failures. If the value of this option is set to a zero time period, bounce
26960 failures are discarded immediately. Setting a very long time (as in the default
26961 value) has the effect of disabling this option. For ways of automatically
26962 dealing with other kinds of frozen message, see <option>auto_thaw</option> and
26963 <option>timeout_frozen_after</option>.
26964 </para>
26965 <para>
26966 <indexterm role="option">
26967 <primary><option>ignore_fromline_hosts</option></primary>
26968 </indexterm>
26969 </para>
26970 <informaltable frame="all">
26971 <tgroup cols="4" colsep="0" rowsep="0">
26972 <colspec colwidth="8*" align="left"/>
26973 <colspec colwidth="6*" align="center"/>
26974 <colspec colwidth="6*" align="center"/>
26975 <colspec colwidth="6*" align="right"/>
26976 <tbody>
26977 <row>
26978 <entry><option>ignore_fromline_hosts</option></entry>
26979 <entry>Use: <emphasis>main</emphasis></entry>
26980 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26981 <entry>Default: <emphasis>unset</emphasis></entry>
26982 </row>
26983 </tbody>
26984 </tgroup>
26985 </informaltable>
26986 <para>
26987 <indexterm role="concept">
26988 <primary><quote>From</quote> line</primary>
26989 </indexterm>
26990 <indexterm role="concept">
26991 <primary>UUCP</primary>
26992 <secondary><quote>From</quote> line</secondary>
26993 </indexterm>
26994 Some broken SMTP clients insist on sending a UUCP-like <quote>From&nbsp;</quote> line before
26995 the headers of a message. By default this is treated as the start of the
26996 message&#x2019;s body, which means that any following headers are not recognized as
26997 such. Exim can be made to ignore it by setting <option>ignore_fromline_hosts</option> to
26998 match those hosts that insist on sending it. If the sender is actually a local
26999 process rather than a remote host, and is using <option>-bs</option> to inject the messages,
27000 <option>ignore_fromline_local</option> must be set to achieve this effect.
27001 </para>
27002 <para>
27003 <indexterm role="option">
27004 <primary><option>ignore_fromline_local</option></primary>
27005 </indexterm>
27006 </para>
27007 <informaltable frame="all">
27008 <tgroup cols="4" colsep="0" rowsep="0">
27009 <colspec colwidth="8*" align="left"/>
27010 <colspec colwidth="6*" align="center"/>
27011 <colspec colwidth="6*" align="center"/>
27012 <colspec colwidth="6*" align="right"/>
27013 <tbody>
27014 <row>
27015 <entry><option>ignore_fromline_local</option></entry>
27016 <entry>Use: <emphasis>main</emphasis></entry>
27017 <entry>Type: <emphasis>boolean</emphasis></entry>
27018 <entry>Default: <emphasis>false</emphasis></entry>
27019 </row>
27020 </tbody>
27021 </tgroup>
27022 </informaltable>
27023 <para>
27024 See <option>ignore_fromline_hosts</option> above.
27025 </para>
27026 <para>
27027 <indexterm role="option">
27028 <primary><option>keep_environment</option></primary>
27029 </indexterm>
27030 </para>
27031 <informaltable frame="all">
27032 <tgroup cols="4" colsep="0" rowsep="0">
27033 <colspec colwidth="8*" align="left"/>
27034 <colspec colwidth="6*" align="center"/>
27035 <colspec colwidth="6*" align="center"/>
27036 <colspec colwidth="6*" align="right"/>
27037 <tbody>
27038 <row>
27039 <entry><option>keep_environment</option></entry>
27040 <entry>Use: <emphasis>main</emphasis></entry>
27041 <entry>Type: <emphasis>string list</emphasis></entry>
27042 <entry>Default: <emphasis>unset</emphasis></entry>
27043 </row>
27044 </tbody>
27045 </tgroup>
27046 </informaltable>
27047 <para>
27048 <indexterm role="concept">
27049 <primary>environment</primary>
27050 <secondary>values from</secondary>
27051 </indexterm>
27052 This option contains a string list of environment variables to keep.
27053 You have to trust these variables or you have to be sure that
27054 these variables do not impose any security risk. Keep in mind that
27055 during the startup phase Exim is running with an effective UID 0 in most
27056 installations. As the default value is an empty list, the default
27057 environment for using libraries, running embedded Perl code, or running
27058 external binaries is empty, and does not not even contain PATH or HOME.
27059 </para>
27060 <para>
27061 Actually the list is interpreted as a list of patterns
27062 (<xref linkend="SECTlistexpand"/>), except that it is not expanded first.
27063 </para>
27064 <para>
27065 WARNING: Macro substitution is still done first, so having a macro
27066 FOO and having FOO_HOME in your <option>keep_environment</option> option may have
27067 unexpected results. You may work around this using a regular expression
27068 that does not match the macro name: ^[F]OO_HOME$.
27069 </para>
27070 <para>
27071 Current versions of Exim issue a warning during startup if you do not mention
27072 <option>keep_environment</option> in your runtime configuration file and if your
27073 current environment is not empty. Future versions may not issue that warning
27074 anymore.
27075 </para>
27076 <para>
27077 See the <option>add_environment</option> main config option for a way to set
27078 environment variables to a fixed value.  The environment for <command>pipe</command>
27079 transports is handled separately, see section <xref linkend="SECTpipeenv"/> for
27080 details.
27081 </para>
27082 <para>
27083 <indexterm role="option">
27084 <primary><option>keep_malformed</option></primary>
27085 </indexterm>
27086 </para>
27087 <informaltable frame="all">
27088 <tgroup cols="4" colsep="0" rowsep="0">
27089 <colspec colwidth="8*" align="left"/>
27090 <colspec colwidth="6*" align="center"/>
27091 <colspec colwidth="6*" align="center"/>
27092 <colspec colwidth="6*" align="right"/>
27093 <tbody>
27094 <row>
27095 <entry><option>keep_malformed</option></entry>
27096 <entry>Use: <emphasis>main</emphasis></entry>
27097 <entry>Type: <emphasis>time</emphasis></entry>
27098 <entry>Default: <emphasis>4d</emphasis></entry>
27099 </row>
27100 </tbody>
27101 </tgroup>
27102 </informaltable>
27103 <para>
27104 This option specifies the length of time to keep messages whose spool files
27105 have been corrupted in some way. This should, of course, never happen. At the
27106 next attempt to deliver such a message, it gets removed. The incident is
27107 logged.
27108 </para>
27109 <para>
27110 <indexterm role="option">
27111 <primary><option>ldap_ca_cert_dir</option></primary>
27112 </indexterm>
27113 </para>
27114 <informaltable frame="all">
27115 <tgroup cols="4" colsep="0" rowsep="0">
27116 <colspec colwidth="8*" align="left"/>
27117 <colspec colwidth="6*" align="center"/>
27118 <colspec colwidth="6*" align="center"/>
27119 <colspec colwidth="6*" align="right"/>
27120 <tbody>
27121 <row>
27122 <entry><option>ldap_ca_cert_dir</option></entry>
27123 <entry>Use: <emphasis>main</emphasis></entry>
27124 <entry>Type: <emphasis>string</emphasis></entry>
27125 <entry>Default: <emphasis>unset</emphasis></entry>
27126 </row>
27127 </tbody>
27128 </tgroup>
27129 </informaltable>
27130 <para>
27131 <indexterm role="concept">
27132 <primary>LDAP</primary>
27133 <secondary>,</secondary>
27134 </indexterm>
27135 <indexterm role="concept">
27136 <primary>certificate</primary>
27137 <secondary>directory for LDAP</secondary>
27138 </indexterm>
27139 This option indicates which directory contains CA certificates for verifying
27140 a TLS certificate presented by an LDAP server.
27141 While Exim does not provide a default value, your SSL library may.
27142 Analogous to <option>tls_verify_certificates</option> but as a client-side option for LDAP
27143 and constrained to be a directory.
27144 </para>
27145 <para>
27146 <indexterm role="option">
27147 <primary><option>ldap_ca_cert_file</option></primary>
27148 </indexterm>
27149 </para>
27150 <informaltable frame="all">
27151 <tgroup cols="4" colsep="0" rowsep="0">
27152 <colspec colwidth="8*" align="left"/>
27153 <colspec colwidth="6*" align="center"/>
27154 <colspec colwidth="6*" align="center"/>
27155 <colspec colwidth="6*" align="right"/>
27156 <tbody>
27157 <row>
27158 <entry><option>ldap_ca_cert_file</option></entry>
27159 <entry>Use: <emphasis>main</emphasis></entry>
27160 <entry>Type: <emphasis>string</emphasis></entry>
27161 <entry>Default: <emphasis>unset</emphasis></entry>
27162 </row>
27163 </tbody>
27164 </tgroup>
27165 </informaltable>
27166 <para>
27167 <indexterm role="concept">
27168 <primary>LDAP</primary>
27169 <secondary>,</secondary>
27170 </indexterm>
27171 <indexterm role="concept">
27172 <primary>certificate</primary>
27173 <secondary>file for LDAP</secondary>
27174 </indexterm>
27175 This option indicates which file contains CA certificates for verifying
27176 a TLS certificate presented by an LDAP server.
27177 While Exim does not provide a default value, your SSL library may.
27178 Analogous to <option>tls_verify_certificates</option> but as a client-side option for LDAP
27179 and constrained to be a file.
27180 </para>
27181 <para>
27182 <indexterm role="option">
27183 <primary><option>ldap_cert_file</option></primary>
27184 </indexterm>
27185 </para>
27186 <informaltable frame="all">
27187 <tgroup cols="4" colsep="0" rowsep="0">
27188 <colspec colwidth="8*" align="left"/>
27189 <colspec colwidth="6*" align="center"/>
27190 <colspec colwidth="6*" align="center"/>
27191 <colspec colwidth="6*" align="right"/>
27192 <tbody>
27193 <row>
27194 <entry><option>ldap_cert_file</option></entry>
27195 <entry>Use: <emphasis>main</emphasis></entry>
27196 <entry>Type: <emphasis>string</emphasis></entry>
27197 <entry>Default: <emphasis>unset</emphasis></entry>
27198 </row>
27199 </tbody>
27200 </tgroup>
27201 </informaltable>
27202 <para>
27203 <indexterm role="concept">
27204 <primary>LDAP</primary>
27205 <secondary>TLS client certificate file</secondary>
27206 </indexterm>
27207 <indexterm role="concept">
27208 <primary>certificate</primary>
27209 <secondary>file for LDAP</secondary>
27210 </indexterm>
27211 This option indicates which file contains an TLS client certificate which
27212 Exim should present to the LDAP server during TLS negotiation.
27213 Should be used together with <option>ldap_cert_key</option>.
27214 </para>
27215 <para>
27216 <indexterm role="option">
27217 <primary><option>ldap_cert_key</option></primary>
27218 </indexterm>
27219 </para>
27220 <informaltable frame="all">
27221 <tgroup cols="4" colsep="0" rowsep="0">
27222 <colspec colwidth="8*" align="left"/>
27223 <colspec colwidth="6*" align="center"/>
27224 <colspec colwidth="6*" align="center"/>
27225 <colspec colwidth="6*" align="right"/>
27226 <tbody>
27227 <row>
27228 <entry><option>ldap_cert_key</option></entry>
27229 <entry>Use: <emphasis>main</emphasis></entry>
27230 <entry>Type: <emphasis>string</emphasis></entry>
27231 <entry>Default: <emphasis>unset</emphasis></entry>
27232 </row>
27233 </tbody>
27234 </tgroup>
27235 </informaltable>
27236 <para>
27237 <indexterm role="concept">
27238 <primary>LDAP</primary>
27239 <secondary>TLS client key file</secondary>
27240 </indexterm>
27241 <indexterm role="concept">
27242 <primary>certificate</primary>
27243 <secondary>key for LDAP</secondary>
27244 </indexterm>
27245 This option indicates which file contains the secret/private key to use
27246 to prove identity to the LDAP server during TLS negotiation.
27247 Should be used together with <option>ldap_cert_file</option>, which contains the
27248 identity to be proven.
27249 </para>
27250 <para>
27251 <indexterm role="option">
27252 <primary><option>ldap_cipher_suite</option></primary>
27253 </indexterm>
27254 </para>
27255 <informaltable frame="all">
27256 <tgroup cols="4" colsep="0" rowsep="0">
27257 <colspec colwidth="8*" align="left"/>
27258 <colspec colwidth="6*" align="center"/>
27259 <colspec colwidth="6*" align="center"/>
27260 <colspec colwidth="6*" align="right"/>
27261 <tbody>
27262 <row>
27263 <entry><option>ldap_cipher_suite</option></entry>
27264 <entry>Use: <emphasis>main</emphasis></entry>
27265 <entry>Type: <emphasis>string</emphasis></entry>
27266 <entry>Default: <emphasis>unset</emphasis></entry>
27267 </row>
27268 </tbody>
27269 </tgroup>
27270 </informaltable>
27271 <para>
27272 <indexterm role="concept">
27273 <primary>LDAP</primary>
27274 <secondary>TLS cipher suite</secondary>
27275 </indexterm>
27276 This controls the TLS cipher-suite negotiation during TLS negotiation with
27277 the LDAP server.  See <xref linkend="SECTreqciphssl"/> for more details of the format of
27278 cipher-suite options with OpenSSL (as used by LDAP client libraries).
27279 </para>
27280 <para>
27281 <indexterm role="option">
27282 <primary><option>ldap_default_servers</option></primary>
27283 </indexterm>
27284 </para>
27285 <informaltable frame="all">
27286 <tgroup cols="4" colsep="0" rowsep="0">
27287 <colspec colwidth="8*" align="left"/>
27288 <colspec colwidth="6*" align="center"/>
27289 <colspec colwidth="6*" align="center"/>
27290 <colspec colwidth="6*" align="right"/>
27291 <tbody>
27292 <row>
27293 <entry><option>ldap_default_servers</option></entry>
27294 <entry>Use: <emphasis>main</emphasis></entry>
27295 <entry>Type: <emphasis>string list</emphasis></entry>
27296 <entry>Default: <emphasis>unset</emphasis></entry>
27297 </row>
27298 </tbody>
27299 </tgroup>
27300 </informaltable>
27301 <para>
27302 <indexterm role="concept">
27303 <primary>LDAP</primary>
27304 <secondary>default servers</secondary>
27305 </indexterm>
27306 This option provides a list of LDAP servers which are tried in turn when an
27307 LDAP query does not contain a server. See section <xref linkend="SECTforldaque"/> for
27308 details of LDAP queries. This option is available only when Exim has been built
27309 with LDAP support.
27310 </para>
27311 <para>
27312 <indexterm role="option">
27313 <primary><option>ldap_require_cert</option></primary>
27314 </indexterm>
27315 </para>
27316 <informaltable frame="all">
27317 <tgroup cols="4" colsep="0" rowsep="0">
27318 <colspec colwidth="8*" align="left"/>
27319 <colspec colwidth="6*" align="center"/>
27320 <colspec colwidth="6*" align="center"/>
27321 <colspec colwidth="6*" align="right"/>
27322 <tbody>
27323 <row>
27324 <entry><option>ldap_require_cert</option></entry>
27325 <entry>Use: <emphasis>main</emphasis></entry>
27326 <entry>Type: <emphasis>string</emphasis></entry>
27327 <entry>Default: <emphasis>unset.</emphasis></entry>
27328 </row>
27329 </tbody>
27330 </tgroup>
27331 </informaltable>
27332 <para>
27333 <indexterm role="concept">
27334 <primary>LDAP</primary>
27335 <secondary>policy for LDAP server TLS cert presentation</secondary>
27336 </indexterm>
27337 This should be one of the values "hard", "demand", "allow", "try" or "never".
27338 A value other than one of these is interpreted as "never".
27339 See the entry "TLS_REQCERT" in your system man page for ldap.conf(5).
27340 Although Exim does not set a default, the LDAP library probably defaults
27341 to hard/demand.
27342 </para>
27343 <para>
27344 <indexterm role="option">
27345 <primary><option>ldap_start_tls</option></primary>
27346 </indexterm>
27347 </para>
27348 <informaltable frame="all">
27349 <tgroup cols="4" colsep="0" rowsep="0">
27350 <colspec colwidth="8*" align="left"/>
27351 <colspec colwidth="6*" align="center"/>
27352 <colspec colwidth="6*" align="center"/>
27353 <colspec colwidth="6*" align="right"/>
27354 <tbody>
27355 <row>
27356 <entry><option>ldap_start_tls</option></entry>
27357 <entry>Use: <emphasis>main</emphasis></entry>
27358 <entry>Type: <emphasis>boolean</emphasis></entry>
27359 <entry>Default: <emphasis>false</emphasis></entry>
27360 </row>
27361 </tbody>
27362 </tgroup>
27363 </informaltable>
27364 <para>
27365 <indexterm role="concept">
27366 <primary>LDAP</primary>
27367 <secondary>whether or not to negotiate TLS</secondary>
27368 </indexterm>
27369 If set, Exim will attempt to negotiate TLS with the LDAP server when
27370 connecting on a regular LDAP port.  This is the LDAP equivalent of SMTP&#x2019;s
27371 "STARTTLS".  This is distinct from using "ldaps", which is the LDAP form
27372 of SSL-on-connect.
27373 In the event of failure to negotiate TLS, the action taken is controlled
27374 by <option>ldap_require_cert</option>.
27375 This option is ignored for <literal>ldapi</literal> connections.
27376 </para>
27377 <para>
27378 <indexterm role="option">
27379 <primary><option>ldap_version</option></primary>
27380 </indexterm>
27381 </para>
27382 <informaltable frame="all">
27383 <tgroup cols="4" colsep="0" rowsep="0">
27384 <colspec colwidth="8*" align="left"/>
27385 <colspec colwidth="6*" align="center"/>
27386 <colspec colwidth="6*" align="center"/>
27387 <colspec colwidth="6*" align="right"/>
27388 <tbody>
27389 <row>
27390 <entry><option>ldap_version</option></entry>
27391 <entry>Use: <emphasis>main</emphasis></entry>
27392 <entry>Type: <emphasis>integer</emphasis></entry>
27393 <entry>Default: <emphasis>unset</emphasis></entry>
27394 </row>
27395 </tbody>
27396 </tgroup>
27397 </informaltable>
27398 <para>
27399 <indexterm role="concept">
27400 <primary>LDAP</primary>
27401 <secondary>protocol version, forcing</secondary>
27402 </indexterm>
27403 This option can be used to force Exim to set a specific protocol version for
27404 LDAP. If it option is unset, it is shown by the <option>-bP</option> command line option as
27405 -1. When this is the case, the default is 3 if LDAP_VERSION3 is defined in
27406 the LDAP headers; otherwise it is 2. This option is available only when Exim
27407 has been built with LDAP support.
27408 </para>
27409 <para>
27410 <indexterm role="option">
27411 <primary><option>local_from_check</option></primary>
27412 </indexterm>
27413 </para>
27414 <informaltable frame="all">
27415 <tgroup cols="4" colsep="0" rowsep="0">
27416 <colspec colwidth="8*" align="left"/>
27417 <colspec colwidth="6*" align="center"/>
27418 <colspec colwidth="6*" align="center"/>
27419 <colspec colwidth="6*" align="right"/>
27420 <tbody>
27421 <row>
27422 <entry><option>local_from_check</option></entry>
27423 <entry>Use: <emphasis>main</emphasis></entry>
27424 <entry>Type: <emphasis>boolean</emphasis></entry>
27425 <entry>Default: <emphasis>true</emphasis></entry>
27426 </row>
27427 </tbody>
27428 </tgroup>
27429 </informaltable>
27430 <para>
27431 <indexterm role="concept">
27432 <primary><emphasis>Sender:</emphasis> header line</primary>
27433 <secondary>disabling addition of</secondary>
27434 </indexterm>
27435 <indexterm role="concept">
27436 <primary><emphasis>From:</emphasis> header line</primary>
27437 <secondary>disabling checking of</secondary>
27438 </indexterm>
27439 When a message is submitted locally (that is, not over a TCP/IP connection) by
27440 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line, and
27441 checks that the <emphasis>From:</emphasis> header line matches the login of the calling user and
27442 the domain specified by <option>qualify_domain</option>.
27443 </para>
27444 <para>
27445 <emphasis role="bold">Note</emphasis>: An unqualified address (no domain) in the <emphasis>From:</emphasis> header in a
27446 locally submitted message is automatically qualified by Exim, unless the
27447 <option>-bnq</option> command line option is used.
27448 </para>
27449 <para>
27450 You can use <option>local_from_prefix</option> and <option>local_from_suffix</option> to permit affixes
27451 on the local part. If the <emphasis>From:</emphasis> header line does not match, Exim adds a
27452 <emphasis>Sender:</emphasis> header with an address constructed from the calling user&#x2019;s login
27453 and the default qualify domain.
27454 </para>
27455 <para>
27456 If <option>local_from_check</option> is set false, the <emphasis>From:</emphasis> header check is disabled,
27457 and no <emphasis>Sender:</emphasis> header is ever added. If, in addition, you want to retain
27458 <emphasis>Sender:</emphasis> header lines supplied by untrusted users, you must also set
27459 <option>local_sender_retain</option> to be true.
27460 </para>
27461 <para>
27462 <indexterm role="concept">
27463 <primary>envelope sender</primary>
27464 </indexterm>
27465 These options affect only the header lines in the message. The envelope sender
27466 is still forced to be the login id at the qualify domain unless
27467 <option>untrusted_set_sender</option> permits the user to supply an envelope sender.
27468 </para>
27469 <para>
27470 For messages received over TCP/IP, an ACL can specify <quote>submission mode</quote> to
27471 request similar header line checking. See section <xref linkend="SECTthesenhea"/>, which
27472 has more details about <emphasis>Sender:</emphasis> processing.
27473 </para>
27474 <para>
27475 <indexterm role="option">
27476 <primary><option>local_from_prefix</option></primary>
27477 </indexterm>
27478 </para>
27479 <informaltable frame="all">
27480 <tgroup cols="4" colsep="0" rowsep="0">
27481 <colspec colwidth="8*" align="left"/>
27482 <colspec colwidth="6*" align="center"/>
27483 <colspec colwidth="6*" align="center"/>
27484 <colspec colwidth="6*" align="right"/>
27485 <tbody>
27486 <row>
27487 <entry><option>local_from_prefix</option></entry>
27488 <entry>Use: <emphasis>main</emphasis></entry>
27489 <entry>Type: <emphasis>string</emphasis></entry>
27490 <entry>Default: <emphasis>unset</emphasis></entry>
27491 </row>
27492 </tbody>
27493 </tgroup>
27494 </informaltable>
27495 <para>
27496 When Exim checks the <emphasis>From:</emphasis> header line of locally submitted messages for
27497 matching the login id (see <option>local_from_check</option> above), it can be configured to
27498 ignore certain prefixes and suffixes in the local part of the address. This is
27499 done by setting <option>local_from_prefix</option> and/or <option>local_from_suffix</option> to
27500 appropriate lists, in the same form as the <option>local_part_prefix</option> and
27501 <option>local_part_suffix</option> router options (see chapter <xref linkend="CHAProutergeneric"/>). For
27502 example, if
27503 </para>
27504 <literallayout class="monospaced">
27505 local_from_prefix = *-
27506 </literallayout>
27507 <para>
27508 is set, a <emphasis>From:</emphasis> line containing
27509 </para>
27510 <literallayout class="monospaced">
27511 From: anything-user@your.domain.example
27512 </literallayout>
27513 <para>
27514 will not cause a <emphasis>Sender:</emphasis> header to be added if <emphasis>user@your.domain.example</emphasis>
27515 matches the actual sender address that is constructed from the login name and
27516 qualify domain.
27517 </para>
27518 <para>
27519 <indexterm role="option">
27520 <primary><option>local_from_suffix</option></primary>
27521 </indexterm>
27522 </para>
27523 <informaltable frame="all">
27524 <tgroup cols="4" colsep="0" rowsep="0">
27525 <colspec colwidth="8*" align="left"/>
27526 <colspec colwidth="6*" align="center"/>
27527 <colspec colwidth="6*" align="center"/>
27528 <colspec colwidth="6*" align="right"/>
27529 <tbody>
27530 <row>
27531 <entry><option>local_from_suffix</option></entry>
27532 <entry>Use: <emphasis>main</emphasis></entry>
27533 <entry>Type: <emphasis>string</emphasis></entry>
27534 <entry>Default: <emphasis>unset</emphasis></entry>
27535 </row>
27536 </tbody>
27537 </tgroup>
27538 </informaltable>
27539 <para>
27540 See <option>local_from_prefix</option> above.
27541 </para>
27542 <para>
27543 <indexterm role="option">
27544 <primary><option>local_interfaces</option></primary>
27545 </indexterm>
27546 </para>
27547 <informaltable frame="all">
27548 <tgroup cols="4" colsep="0" rowsep="0">
27549 <colspec colwidth="8*" align="left"/>
27550 <colspec colwidth="6*" align="center"/>
27551 <colspec colwidth="6*" align="center"/>
27552 <colspec colwidth="6*" align="right"/>
27553 <tbody>
27554 <row>
27555 <entry><option>local_interfaces</option></entry>
27556 <entry>Use: <emphasis>main</emphasis></entry>
27557 <entry>Type: <emphasis>string list</emphasis></entry>
27558 <entry>Default: <emphasis>see below</emphasis></entry>
27559 </row>
27560 </tbody>
27561 </tgroup>
27562 </informaltable>
27563 <para>
27564 This option controls which network interfaces are used by the daemon for
27565 listening; they are also used to identify the local host when routing. Chapter
27566 <xref linkend="CHAPinterfaces"/> contains a full description of this option and the related
27567 options <option>daemon_smtp_ports</option>, <option>extra_local_interfaces</option>,
27568 <option>hosts_treat_as_local</option>, and <option>tls_on_connect_ports</option>. The default value for
27569 <option>local_interfaces</option> is
27570 </para>
27571 <literallayout class="monospaced">
27572 local_interfaces = 0.0.0.0
27573 </literallayout>
27574 <para>
27575 when Exim is built without IPv6 support; otherwise it is
27576 </para>
27577 <literallayout class="monospaced">
27578 local_interfaces = &lt;; ::0 ; 0.0.0.0
27579 </literallayout>
27580 <para>
27581 <indexterm role="option">
27582 <primary><option>local_scan_timeout</option></primary>
27583 </indexterm>
27584 </para>
27585 <informaltable frame="all">
27586 <tgroup cols="4" colsep="0" rowsep="0">
27587 <colspec colwidth="8*" align="left"/>
27588 <colspec colwidth="6*" align="center"/>
27589 <colspec colwidth="6*" align="center"/>
27590 <colspec colwidth="6*" align="right"/>
27591 <tbody>
27592 <row>
27593 <entry><option>local_scan_timeout</option></entry>
27594 <entry>Use: <emphasis>main</emphasis></entry>
27595 <entry>Type: <emphasis>time</emphasis></entry>
27596 <entry>Default: <emphasis>5m</emphasis></entry>
27597 </row>
27598 </tbody>
27599 </tgroup>
27600 </informaltable>
27601 <para>
27602 <indexterm role="concept">
27603 <primary>timeout</primary>
27604 <secondary>for <function>local_scan()</function> function</secondary>
27605 </indexterm>
27606 <indexterm role="concept">
27607 <primary><function>local_scan()</function> function</primary>
27608 <secondary>timeout</secondary>
27609 </indexterm>
27610 This timeout applies to the <function>local_scan()</function> function (see chapter
27611 <xref linkend="CHAPlocalscan"/>). Zero means <quote>no timeout</quote>. If the timeout is exceeded,
27612 the incoming message is rejected with a temporary error if it is an SMTP
27613 message. For a non-SMTP message, the message is dropped and Exim ends with a
27614 non-zero code. The incident is logged on the main and reject logs.
27615 </para>
27616 <para>
27617 <indexterm role="option">
27618 <primary><option>local_sender_retain</option></primary>
27619 </indexterm>
27620 </para>
27621 <informaltable frame="all">
27622 <tgroup cols="4" colsep="0" rowsep="0">
27623 <colspec colwidth="8*" align="left"/>
27624 <colspec colwidth="6*" align="center"/>
27625 <colspec colwidth="6*" align="center"/>
27626 <colspec colwidth="6*" align="right"/>
27627 <tbody>
27628 <row>
27629 <entry><option>local_sender_retain</option></entry>
27630 <entry>Use: <emphasis>main</emphasis></entry>
27631 <entry>Type: <emphasis>boolean</emphasis></entry>
27632 <entry>Default: <emphasis>false</emphasis></entry>
27633 </row>
27634 </tbody>
27635 </tgroup>
27636 </informaltable>
27637 <para>
27638 <indexterm role="concept">
27639 <primary><emphasis>Sender:</emphasis> header line</primary>
27640 <secondary>retaining from local submission</secondary>
27641 </indexterm>
27642 When a message is submitted locally (that is, not over a TCP/IP connection) by
27643 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line. If you
27644 do not want this to happen, you must set <option>local_sender_retain</option>, and you must
27645 also set <option>local_from_check</option> to be false (Exim will complain if you do not).
27646 See also the ACL modifier <literal>control = suppress_local_fixups</literal>. Section
27647 <xref linkend="SECTthesenhea"/> has more details about <emphasis>Sender:</emphasis> processing.
27648 </para>
27649 <para>
27650 <indexterm role="option">
27651 <primary><option>localhost_number</option></primary>
27652 </indexterm>
27653 </para>
27654 <informaltable frame="all">
27655 <tgroup cols="4" colsep="0" rowsep="0">
27656 <colspec colwidth="8*" align="left"/>
27657 <colspec colwidth="6*" align="center"/>
27658 <colspec colwidth="6*" align="center"/>
27659 <colspec colwidth="6*" align="right"/>
27660 <tbody>
27661 <row>
27662 <entry><option>localhost_number</option></entry>
27663 <entry>Use: <emphasis>main</emphasis></entry>
27664 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27665 <entry>Default: <emphasis>unset</emphasis></entry>
27666 </row>
27667 </tbody>
27668 </tgroup>
27669 </informaltable>
27670 <para>
27671 <indexterm role="concept">
27672 <primary>host</primary>
27673 <secondary>locally unique number for</secondary>
27674 </indexterm>
27675 <indexterm role="concept">
27676 <primary>message ids</primary>
27677 <secondary>with multiple hosts</secondary>
27678 </indexterm>
27679 <indexterm role="variable">
27680 <primary><varname>$localhost_number</varname></primary>
27681 </indexterm>
27682 Exim&#x2019;s message ids are normally unique only within the local host. If
27683 uniqueness among a set of hosts is required, each host must set a different
27684 value for the <option>localhost_number</option> option. The string is expanded immediately
27685 after reading the configuration file (so that a number can be computed from the
27686 host name, for example) and the result of the expansion must be a number in the
27687 range 0&ndash;16 (or 0&ndash;10 on operating systems with case-insensitive file
27688 systems). This is available in subsequent string expansions via the variable
27689 <varname>$localhost_number</varname>. When <option>localhost_number is set</option>, the final two
27690 characters of the message id, instead of just being a fractional part of the
27691 time, are computed from the time and the local host number as described in
27692 section <xref linkend="SECTmessiden"/>.
27693 </para>
27694 <para>
27695 <indexterm role="option">
27696 <primary><option>log_file_path</option></primary>
27697 </indexterm>
27698 </para>
27699 <informaltable frame="all">
27700 <tgroup cols="4" colsep="0" rowsep="0">
27701 <colspec colwidth="8*" align="left"/>
27702 <colspec colwidth="6*" align="center"/>
27703 <colspec colwidth="6*" align="center"/>
27704 <colspec colwidth="6*" align="right"/>
27705 <tbody>
27706 <row>
27707 <entry><option>log_file_path</option></entry>
27708 <entry>Use: <emphasis>main</emphasis></entry>
27709 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
27710 <entry>Default: <emphasis>set at compile time</emphasis></entry>
27711 </row>
27712 </tbody>
27713 </tgroup>
27714 </informaltable>
27715 <para>
27716 <indexterm role="concept">
27717 <primary>log</primary>
27718 <secondary>file path for</secondary>
27719 </indexterm>
27720 This option sets the path which is used to determine the names of Exim&#x2019;s log
27721 files, or indicates that logging is to be to syslog, or both. It is expanded
27722 when Exim is entered, so it can, for example, contain a reference to the host
27723 name. If no specific path is set for the log files at compile or runtime,
27724 or if the option is unset at runtime (i.e.  <literal>log_file_path = </literal>)
27725 they are written in a sub-directory called <filename>log</filename> in Exim&#x2019;s spool directory.
27726 Chapter <xref linkend="CHAPlog"/> contains further details about Exim&#x2019;s logging, and
27727 section <xref linkend="SECTwhelogwri"/> describes how the contents of <option>log_file_path</option> are
27728 used. If this string is fixed at your installation (contains no expansion
27729 variables) it is recommended that you do not set this option in the
27730 configuration file, but instead supply the path using LOG_FILE_PATH in
27731 <filename>Local/Makefile</filename> so that it is available to Exim for logging errors detected
27732 early on &ndash; in particular, failure to read the configuration file.
27733 </para>
27734 <para>
27735 <indexterm role="option">
27736 <primary><option>log_selector</option></primary>
27737 </indexterm>
27738 </para>
27739 <informaltable frame="all">
27740 <tgroup cols="4" colsep="0" rowsep="0">
27741 <colspec colwidth="8*" align="left"/>
27742 <colspec colwidth="6*" align="center"/>
27743 <colspec colwidth="6*" align="center"/>
27744 <colspec colwidth="6*" align="right"/>
27745 <tbody>
27746 <row>
27747 <entry><option>log_selector</option></entry>
27748 <entry>Use: <emphasis>main</emphasis></entry>
27749 <entry>Type: <emphasis>string</emphasis></entry>
27750 <entry>Default: <emphasis>unset</emphasis></entry>
27751 </row>
27752 </tbody>
27753 </tgroup>
27754 </informaltable>
27755 <para>
27756 <indexterm role="concept">
27757 <primary>log</primary>
27758 <secondary>selectors</secondary>
27759 </indexterm>
27760 This option can be used to reduce or increase the number of things that Exim
27761 writes to its log files. Its argument is made up of names preceded by plus or
27762 minus characters. For example:
27763 </para>
27764 <literallayout class="monospaced">
27765 log_selector = +arguments -retry_defer
27766 </literallayout>
27767 <para>
27768 A list of possible names and what they control is given in the chapter on
27769 logging, in section <xref linkend="SECTlogselector"/>.
27770 </para>
27771 <para>
27772 <indexterm role="option">
27773 <primary><option>log_timezone</option></primary>
27774 </indexterm>
27775 </para>
27776 <informaltable frame="all">
27777 <tgroup cols="4" colsep="0" rowsep="0">
27778 <colspec colwidth="8*" align="left"/>
27779 <colspec colwidth="6*" align="center"/>
27780 <colspec colwidth="6*" align="center"/>
27781 <colspec colwidth="6*" align="right"/>
27782 <tbody>
27783 <row>
27784 <entry><option>log_timezone</option></entry>
27785 <entry>Use: <emphasis>main</emphasis></entry>
27786 <entry>Type: <emphasis>boolean</emphasis></entry>
27787 <entry>Default: <emphasis>false</emphasis></entry>
27788 </row>
27789 </tbody>
27790 </tgroup>
27791 </informaltable>
27792 <para>
27793 <indexterm role="concept">
27794 <primary>log</primary>
27795 <secondary>timezone for entries</secondary>
27796 </indexterm>
27797 <indexterm role="variable">
27798 <primary><varname>$tod_log</varname></primary>
27799 </indexterm>
27800 <indexterm role="variable">
27801 <primary><varname>$tod_zone</varname></primary>
27802 </indexterm>
27803 By default, the timestamps on log lines are in local time without the
27804 timezone. This means that if your timezone changes twice a year, the timestamps
27805 in log lines are ambiguous for an hour when the clocks go back. One way of
27806 avoiding this problem is to set the timezone to UTC. An alternative is to set
27807 <option>log_timezone</option> true. This turns on the addition of the timezone offset to
27808 timestamps in log lines. Turning on this option can add quite a lot to the size
27809 of log files because each line is extended by 6 characters. Note that the
27810 <varname>$tod_log</varname> variable contains the log timestamp without the zone, but there is
27811 another variable called <varname>$tod_zone</varname> that contains just the timezone offset.
27812 </para>
27813 <para>
27814 <indexterm role="option">
27815 <primary><option>lookup_open_max</option></primary>
27816 </indexterm>
27817 </para>
27818 <informaltable frame="all">
27819 <tgroup cols="4" colsep="0" rowsep="0">
27820 <colspec colwidth="8*" align="left"/>
27821 <colspec colwidth="6*" align="center"/>
27822 <colspec colwidth="6*" align="center"/>
27823 <colspec colwidth="6*" align="right"/>
27824 <tbody>
27825 <row>
27826 <entry><option>lookup_open_max</option></entry>
27827 <entry>Use: <emphasis>main</emphasis></entry>
27828 <entry>Type: <emphasis>integer</emphasis></entry>
27829 <entry>Default: <emphasis>25</emphasis></entry>
27830 </row>
27831 </tbody>
27832 </tgroup>
27833 </informaltable>
27834 <para>
27835 <indexterm role="concept">
27836 <primary>too many open files</primary>
27837 </indexterm>
27838 <indexterm role="concept">
27839 <primary>open files, too many</primary>
27840 </indexterm>
27841 <indexterm role="concept">
27842 <primary>file</primary>
27843 <secondary>too many open</secondary>
27844 </indexterm>
27845 <indexterm role="concept">
27846 <primary>lookup</primary>
27847 <secondary>maximum open files</secondary>
27848 </indexterm>
27849 <indexterm role="concept">
27850 <primary>limit</primary>
27851 <secondary>open files for lookups</secondary>
27852 </indexterm>
27853 This option limits the number of simultaneously open files for single-key
27854 lookups that use regular files (that is, <command>lsearch</command>, <command>dbm</command>, and <command>cdb</command>).
27855 Exim normally keeps these files open during routing, because often the same
27856 file is required several times. If the limit is reached, Exim closes the least
27857 recently used file. Note that if you are using the <emphasis>ndbm</emphasis> library, it
27858 actually opens two files for each logical DBM database, though it still counts
27859 as one for the purposes of <option>lookup_open_max</option>. If you are getting <quote>too many
27860 open files</quote> errors with NDBM, you need to reduce the value of
27861 <option>lookup_open_max</option>.
27862 </para>
27863 <para>
27864 <indexterm role="option">
27865 <primary><option>max_username_length</option></primary>
27866 </indexterm>
27867 </para>
27868 <informaltable frame="all">
27869 <tgroup cols="4" colsep="0" rowsep="0">
27870 <colspec colwidth="8*" align="left"/>
27871 <colspec colwidth="6*" align="center"/>
27872 <colspec colwidth="6*" align="center"/>
27873 <colspec colwidth="6*" align="right"/>
27874 <tbody>
27875 <row>
27876 <entry><option>max_username_length</option></entry>
27877 <entry>Use: <emphasis>main</emphasis></entry>
27878 <entry>Type: <emphasis>integer</emphasis></entry>
27879 <entry>Default: <emphasis>0</emphasis></entry>
27880 </row>
27881 </tbody>
27882 </tgroup>
27883 </informaltable>
27884 <para>
27885 <indexterm role="concept">
27886 <primary>length of login name</primary>
27887 </indexterm>
27888 <indexterm role="concept">
27889 <primary>user name</primary>
27890 <secondary>maximum length</secondary>
27891 </indexterm>
27892 <indexterm role="concept">
27893 <primary>limit</primary>
27894 <secondary>user name length</secondary>
27895 </indexterm>
27896 Some operating systems are broken in that they truncate long arguments to
27897 <function>getpwnam()</function> to eight characters, instead of returning <quote>no such user</quote>. If
27898 this option is set greater than zero, any attempt to call <function>getpwnam()</function> with
27899 an argument that is longer behaves as if <function>getpwnam()</function> failed.
27900 </para>
27901 <para>
27902 <indexterm role="option">
27903 <primary><option>message_body_newlines</option></primary>
27904 </indexterm>
27905 </para>
27906 <informaltable frame="all">
27907 <tgroup cols="4" colsep="0" rowsep="0">
27908 <colspec colwidth="8*" align="left"/>
27909 <colspec colwidth="6*" align="center"/>
27910 <colspec colwidth="6*" align="center"/>
27911 <colspec colwidth="6*" align="right"/>
27912 <tbody>
27913 <row>
27914 <entry><option>message_body_newlines</option></entry>
27915 <entry>Use: <emphasis>main</emphasis></entry>
27916 <entry>Type: <emphasis>bool</emphasis></entry>
27917 <entry>Default: <emphasis>false</emphasis></entry>
27918 </row>
27919 </tbody>
27920 </tgroup>
27921 </informaltable>
27922 <para>
27923 <indexterm role="concept">
27924 <primary>message body</primary>
27925 <secondary>newlines in variables</secondary>
27926 </indexterm>
27927 <indexterm role="concept">
27928 <primary>newline</primary>
27929 <secondary>in message body variables</secondary>
27930 </indexterm>
27931 <indexterm role="variable">
27932 <primary><varname>$message_body</varname></primary>
27933 </indexterm>
27934 <indexterm role="variable">
27935 <primary><varname>$message_body_end</varname></primary>
27936 </indexterm>
27937 By default, newlines in the message body are replaced by spaces when setting
27938 the <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables. If this
27939 option is set true, this no longer happens.
27940 </para>
27941 <para>
27942 <indexterm role="option">
27943 <primary><option>message_body_visible</option></primary>
27944 </indexterm>
27945 </para>
27946 <informaltable frame="all">
27947 <tgroup cols="4" colsep="0" rowsep="0">
27948 <colspec colwidth="8*" align="left"/>
27949 <colspec colwidth="6*" align="center"/>
27950 <colspec colwidth="6*" align="center"/>
27951 <colspec colwidth="6*" align="right"/>
27952 <tbody>
27953 <row>
27954 <entry><option>message_body_visible</option></entry>
27955 <entry>Use: <emphasis>main</emphasis></entry>
27956 <entry>Type: <emphasis>integer</emphasis></entry>
27957 <entry>Default: <emphasis>500</emphasis></entry>
27958 </row>
27959 </tbody>
27960 </tgroup>
27961 </informaltable>
27962 <para>
27963 <indexterm role="concept">
27964 <primary>body of message</primary>
27965 <secondary>visible size</secondary>
27966 </indexterm>
27967 <indexterm role="concept">
27968 <primary>message body</primary>
27969 <secondary>visible size</secondary>
27970 </indexterm>
27971 <indexterm role="variable">
27972 <primary><varname>$message_body</varname></primary>
27973 </indexterm>
27974 <indexterm role="variable">
27975 <primary><varname>$message_body_end</varname></primary>
27976 </indexterm>
27977 This option specifies how much of a message&#x2019;s body is to be included in the
27978 <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables.
27979 </para>
27980 <para>
27981 <indexterm role="option">
27982 <primary><option>message_id_header_domain</option></primary>
27983 </indexterm>
27984 </para>
27985 <informaltable frame="all">
27986 <tgroup cols="4" colsep="0" rowsep="0">
27987 <colspec colwidth="8*" align="left"/>
27988 <colspec colwidth="6*" align="center"/>
27989 <colspec colwidth="6*" align="center"/>
27990 <colspec colwidth="6*" align="right"/>
27991 <tbody>
27992 <row>
27993 <entry><option>message_id_header_domain</option></entry>
27994 <entry>Use: <emphasis>main</emphasis></entry>
27995 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27996 <entry>Default: <emphasis>unset</emphasis></entry>
27997 </row>
27998 </tbody>
27999 </tgroup>
28000 </informaltable>
28001 <para>
28002 <indexterm role="concept">
28003 <primary><emphasis>Message-ID:</emphasis> header line</primary>
28004 </indexterm>
28005 If this option is set, the string is expanded and used as the right hand side
28006 (domain) of the <emphasis>Message-ID:</emphasis> header that Exim creates if a
28007 locally-originated incoming message does not have one. <quote>Locally-originated</quote>
28008 means <quote>not received over TCP/IP.</quote>
28009 Otherwise, the primary host name is used.
28010 Only letters, digits, dot and hyphen are accepted; any other characters are
28011 replaced by hyphens. If the expansion is forced to fail, or if the result is an
28012 empty string, the option is ignored.
28013 </para>
28014 <para>
28015 <indexterm role="option">
28016 <primary><option>message_id_header_text</option></primary>
28017 </indexterm>
28018 </para>
28019 <informaltable frame="all">
28020 <tgroup cols="4" colsep="0" rowsep="0">
28021 <colspec colwidth="8*" align="left"/>
28022 <colspec colwidth="6*" align="center"/>
28023 <colspec colwidth="6*" align="center"/>
28024 <colspec colwidth="6*" align="right"/>
28025 <tbody>
28026 <row>
28027 <entry><option>message_id_header_text</option></entry>
28028 <entry>Use: <emphasis>main</emphasis></entry>
28029 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28030 <entry>Default: <emphasis>unset</emphasis></entry>
28031 </row>
28032 </tbody>
28033 </tgroup>
28034 </informaltable>
28035 <para>
28036 If this variable is set, the string is expanded and used to augment the text of
28037 the <emphasis>Message-id:</emphasis> header that Exim creates if a locally-originated incoming
28038 message does not have one. The text of this header is required by RFC 2822 to
28039 take the form of an address. By default, Exim uses its internal message id as
28040 the local part, and the primary host name as the domain. If this option is set,
28041 it is expanded, and provided the expansion is not forced to fail, and does not
28042 yield an empty string, the result is inserted into the header immediately
28043 before the @, separated from the internal message id by a dot. Any characters
28044 that are illegal in an address are automatically converted into hyphens. This
28045 means that variables such as <varname>$tod_log</varname> can be used, because the spaces and
28046 colons will become hyphens.
28047 </para>
28048 <para>
28049 <indexterm role="option">
28050 <primary><option>message_logs</option></primary>
28051 </indexterm>
28052 </para>
28053 <informaltable frame="all">
28054 <tgroup cols="4" colsep="0" rowsep="0">
28055 <colspec colwidth="8*" align="left"/>
28056 <colspec colwidth="6*" align="center"/>
28057 <colspec colwidth="6*" align="center"/>
28058 <colspec colwidth="6*" align="right"/>
28059 <tbody>
28060 <row>
28061 <entry><option>message_logs</option></entry>
28062 <entry>Use: <emphasis>main</emphasis></entry>
28063 <entry>Type: <emphasis>boolean</emphasis></entry>
28064 <entry>Default: <emphasis>true</emphasis></entry>
28065 </row>
28066 </tbody>
28067 </tgroup>
28068 </informaltable>
28069 <para>
28070 <indexterm role="concept">
28071 <primary>message logs</primary>
28072 <secondary>disabling</secondary>
28073 </indexterm>
28074 <indexterm role="concept">
28075 <primary>log</primary>
28076 <secondary>message log; disabling</secondary>
28077 </indexterm>
28078 If this option is turned off, per-message log files are not created in the
28079 <filename>msglog</filename> spool sub-directory. This reduces the amount of disk I/O required by
28080 Exim, by reducing the number of files involved in handling a message from a
28081 minimum of four (header spool file, body spool file, delivery journal, and
28082 per-message log) to three. The other major I/O activity is Exim&#x2019;s main log,
28083 which is not affected by this option.
28084 </para>
28085 <para>
28086 <indexterm role="option">
28087 <primary><option>message_size_limit</option></primary>
28088 </indexterm>
28089 </para>
28090 <informaltable frame="all">
28091 <tgroup cols="4" colsep="0" rowsep="0">
28092 <colspec colwidth="8*" align="left"/>
28093 <colspec colwidth="6*" align="center"/>
28094 <colspec colwidth="6*" align="center"/>
28095 <colspec colwidth="6*" align="right"/>
28096 <tbody>
28097 <row>
28098 <entry><option>message_size_limit</option></entry>
28099 <entry>Use: <emphasis>main</emphasis></entry>
28100 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28101 <entry>Default: <emphasis>50M</emphasis></entry>
28102 </row>
28103 </tbody>
28104 </tgroup>
28105 </informaltable>
28106 <para>
28107 <indexterm role="concept">
28108 <primary>message</primary>
28109 <secondary>size limit</secondary>
28110 </indexterm>
28111 <indexterm role="concept">
28112 <primary>limit</primary>
28113 <secondary>message size</secondary>
28114 </indexterm>
28115 <indexterm role="concept">
28116 <primary>size</primary>
28117 <secondary>of message, limit</secondary>
28118 </indexterm>
28119 This option limits the maximum size of message that Exim will process. The
28120 value is expanded for each incoming connection so, for example, it can be made
28121 to depend on the IP address of the remote host for messages arriving via
28122 TCP/IP. After expansion, the value must be a sequence of decimal digits,
28123 optionally followed by K or M.
28124 </para>
28125 <para>
28126 <emphasis role="bold">Note</emphasis>: This limit cannot be made to depend on a message&#x2019;s sender or any
28127 other properties of an individual message, because it has to be advertised in
28128 the server&#x2019;s response to EHLO. String expansion failure causes a temporary
28129 error. A value of zero means no limit, but its use is not recommended. See also
28130 <option>bounce_return_size_limit</option>.
28131 </para>
28132 <para>
28133 Incoming SMTP messages are failed with a 552 error if the limit is
28134 exceeded; locally-generated messages either get a stderr message or a delivery
28135 failure message to the sender, depending on the <option>-oe</option> setting. Rejection of
28136 an oversized message is logged in both the main and the reject logs. See also
28137 the generic transport option <option>message_size_limit</option>, which limits the size of
28138 message that an individual transport can process.
28139 </para>
28140 <para>
28141 If you use a virus-scanner and set this option to to a value larger than the
28142 maximum size that your virus-scanner is configured to support, you may get
28143 failures triggered by large mails.  The right size to configure for the
28144 virus-scanner depends upon what data is passed and the options in use but it&#x2019;s
28145 probably safest to just set it to a little larger than this value.  E.g., with a
28146 default Exim message size of 50M and a default ClamAV StreamMaxLength of 10M,
28147 some problems may result.
28148 </para>
28149 <para>
28150 A value of 0 will disable size limit checking; Exim will still advertise the
28151 SIZE extension in an EHLO response, but without a limit, so as to permit
28152 SMTP clients to still indicate the message size along with the MAIL verb.
28153 </para>
28154 <para>
28155 <indexterm role="option">
28156 <primary><option>move_frozen_messages</option></primary>
28157 </indexterm>
28158 </para>
28159 <informaltable frame="all">
28160 <tgroup cols="4" colsep="0" rowsep="0">
28161 <colspec colwidth="8*" align="left"/>
28162 <colspec colwidth="6*" align="center"/>
28163 <colspec colwidth="6*" align="center"/>
28164 <colspec colwidth="6*" align="right"/>
28165 <tbody>
28166 <row>
28167 <entry><option>move_frozen_messages</option></entry>
28168 <entry>Use: <emphasis>main</emphasis></entry>
28169 <entry>Type: <emphasis>boolean</emphasis></entry>
28170 <entry>Default: <emphasis>false</emphasis></entry>
28171 </row>
28172 </tbody>
28173 </tgroup>
28174 </informaltable>
28175 <para>
28176 <indexterm role="concept">
28177 <primary>frozen messages</primary>
28178 <secondary>moving</secondary>
28179 </indexterm>
28180 This option, which is available only if Exim has been built with the setting
28181 </para>
28182 <literallayout class="monospaced">
28183 SUPPORT_MOVE_FROZEN_MESSAGES=yes
28184 </literallayout>
28185 <para>
28186 in <filename>Local/Makefile</filename>, causes frozen messages and their message logs to be
28187 moved from the <filename>input</filename> and <filename>msglog</filename> directories on the spool to <filename>Finput</filename>
28188 and <filename>Fmsglog</filename>, respectively. There is currently no support in Exim or the
28189 standard utilities for handling such moved messages, and they do not show up in
28190 lists generated by <option>-bp</option> or by the Exim monitor.
28191 </para>
28192 <para>
28193 <indexterm role="option">
28194 <primary><option>mua_wrapper</option></primary>
28195 </indexterm>
28196 </para>
28197 <informaltable frame="all">
28198 <tgroup cols="4" colsep="0" rowsep="0">
28199 <colspec colwidth="8*" align="left"/>
28200 <colspec colwidth="6*" align="center"/>
28201 <colspec colwidth="6*" align="center"/>
28202 <colspec colwidth="6*" align="right"/>
28203 <tbody>
28204 <row>
28205 <entry><option>mua_wrapper</option></entry>
28206 <entry>Use: <emphasis>main</emphasis></entry>
28207 <entry>Type: <emphasis>boolean</emphasis></entry>
28208 <entry>Default: <emphasis>false</emphasis></entry>
28209 </row>
28210 </tbody>
28211 </tgroup>
28212 </informaltable>
28213 <para>
28214 Setting this option true causes Exim to run in a very restrictive mode in which
28215 it passes messages synchronously to a smart host. Chapter <xref linkend="CHAPnonqueueing"/>
28216 contains a full description of this facility.
28217 </para>
28218 <para>
28219 <indexterm role="option">
28220 <primary><option>mysql_servers</option></primary>
28221 </indexterm>
28222 </para>
28223 <informaltable frame="all">
28224 <tgroup cols="4" colsep="0" rowsep="0">
28225 <colspec colwidth="8*" align="left"/>
28226 <colspec colwidth="6*" align="center"/>
28227 <colspec colwidth="6*" align="center"/>
28228 <colspec colwidth="6*" align="right"/>
28229 <tbody>
28230 <row>
28231 <entry><option>mysql_servers</option></entry>
28232 <entry>Use: <emphasis>main</emphasis></entry>
28233 <entry>Type: <emphasis>string list</emphasis></entry>
28234 <entry>Default: <emphasis>unset</emphasis></entry>
28235 </row>
28236 </tbody>
28237 </tgroup>
28238 </informaltable>
28239 <para>
28240 <indexterm role="concept">
28241 <primary>MySQL</primary>
28242 <secondary>server list</secondary>
28243 </indexterm>
28244 This option provides a list of MySQL servers and associated connection data, to
28245 be used in conjunction with <command>mysql</command> lookups (see section <xref linkend="SECID72"/>). The
28246 option is available only if Exim has been built with MySQL support.
28247 </para>
28248 <para>
28249 <indexterm role="option">
28250 <primary><option>never_users</option></primary>
28251 </indexterm>
28252 </para>
28253 <informaltable frame="all">
28254 <tgroup cols="4" colsep="0" rowsep="0">
28255 <colspec colwidth="8*" align="left"/>
28256 <colspec colwidth="6*" align="center"/>
28257 <colspec colwidth="6*" align="center"/>
28258 <colspec colwidth="6*" align="right"/>
28259 <tbody>
28260 <row>
28261 <entry><option>never_users</option></entry>
28262 <entry>Use: <emphasis>main</emphasis></entry>
28263 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
28264 <entry>Default: <emphasis>unset</emphasis></entry>
28265 </row>
28266 </tbody>
28267 </tgroup>
28268 </informaltable>
28269 <para>
28270 This option is expanded just once, at the start of Exim&#x2019;s processing. Local
28271 message deliveries are normally run in processes that are setuid to the
28272 recipient, and remote deliveries are normally run under Exim&#x2019;s own uid and gid.
28273 It is usually desirable to prevent any deliveries from running as root, as a
28274 safety precaution.
28275 </para>
28276 <para>
28277 When Exim is built, an option called FIXED_NEVER_USERS can be set to a
28278 list of users that must not be used for local deliveries. This list is fixed in
28279 the binary and cannot be overridden by the configuration file. By default, it
28280 contains just the single user name <quote>root</quote>. The <option>never_users</option> runtime option
28281 can be used to add more users to the fixed list.
28282 </para>
28283 <para>
28284 If a message is to be delivered as one of the users on the fixed list or the
28285 <option>never_users</option> list, an error occurs, and delivery is deferred. A common
28286 example is
28287 </para>
28288 <literallayout class="monospaced">
28289 never_users = root:daemon:bin
28290 </literallayout>
28291 <para>
28292 Including root is redundant if it is also on the fixed list, but it does no
28293 harm. This option overrides the <option>pipe_as_creator</option> option of the <command>pipe</command>
28294 transport driver.
28295 </para>
28296 <para>
28297 <indexterm role="option">
28298 <primary><option>openssl_options</option></primary>
28299 </indexterm>
28300 </para>
28301 <informaltable frame="all">
28302 <tgroup cols="4" colsep="0" rowsep="0">
28303 <colspec colwidth="8*" align="left"/>
28304 <colspec colwidth="6*" align="center"/>
28305 <colspec colwidth="6*" align="center"/>
28306 <colspec colwidth="6*" align="right"/>
28307 <tbody>
28308 <row>
28309 <entry><option>openssl_options</option></entry>
28310 <entry>Use: <emphasis>main</emphasis></entry>
28311 <entry>Type: <emphasis>string list</emphasis></entry>
28312 <entry>Default: <emphasis>+no_sslv2 +single_dh_use +no_ticket</emphasis></entry>
28313 </row>
28314 </tbody>
28315 </tgroup>
28316 </informaltable>
28317 <para>
28318 <indexterm role="concept">
28319 <primary>OpenSSL </primary>
28320 <secondary>compatibility</secondary>
28321 </indexterm>
28322 This option allows an administrator to adjust the SSL options applied
28323 by OpenSSL to connections.  It is given as a space-separated list of items,
28324 each one to be +added or -subtracted from the current value.
28325 </para>
28326 <para>
28327 This option is only available if Exim is built against OpenSSL.  The values
28328 available for this option vary according to the age of your OpenSSL install.
28329 The <quote>all</quote> value controls a subset of flags which are available, typically
28330 the bug workaround options.  The <emphasis>SSL_CTX_set_options</emphasis> man page will
28331 list the values known on your system and Exim should support all the
28332 <quote>bug workaround</quote> options and many of the <quote>modifying</quote> options.  The Exim
28333 names lose the leading <quote>SSL_OP_</quote> and are lower-cased.
28334 </para>
28335 <para>
28336 Note that adjusting the options can have severe impact upon the security of
28337 SSL as used by Exim.  It is possible to disable safety checks and shoot
28338 yourself in the foot in various unpleasant ways.  This option should not be
28339 adjusted lightly.  An unrecognised item will be detected at startup, by
28340 invoking Exim with the <option>-bV</option> flag.
28341 </para>
28342 <para>
28343 The option affects Exim operating both as a server and as a client.
28344 </para>
28345 <para>
28346 Historical note: prior to release 4.80, Exim defaulted this value to
28347 "+dont_insert_empty_fragments", which may still be needed for compatibility
28348 with some clients, but which lowers security by increasing exposure to
28349 some now infamous attacks.
28350 </para>
28351 <para>
28352 Examples:
28353 </para>
28354 <literallayout class="monospaced">
28355 # Make both old MS and old Eudora happy:
28356 openssl_options = -all +microsoft_big_sslv3_buffer \
28357                        +dont_insert_empty_fragments
28358
28359 # Disable older protocol versions:
28360 openssl_options = +no_sslv2 +no_sslv3
28361 </literallayout>
28362 <para>
28363 Possible options may include:
28364 </para>
28365 <itemizedlist>
28366 <listitem>
28367 <para>
28368 <literal>all</literal>
28369 </para>
28370 </listitem>
28371 <listitem>
28372 <para>
28373 <literal>allow_unsafe_legacy_renegotiation</literal>
28374 </para>
28375 </listitem>
28376 <listitem>
28377 <para>
28378 <literal>cipher_server_preference</literal>
28379 </para>
28380 </listitem>
28381 <listitem>
28382 <para>
28383 <literal>dont_insert_empty_fragments</literal>
28384 </para>
28385 </listitem>
28386 <listitem>
28387 <para>
28388 <literal>ephemeral_rsa</literal>
28389 </para>
28390 </listitem>
28391 <listitem>
28392 <para>
28393 <literal>legacy_server_connect</literal>
28394 </para>
28395 </listitem>
28396 <listitem>
28397 <para>
28398 <literal>microsoft_big_sslv3_buffer</literal>
28399 </para>
28400 </listitem>
28401 <listitem>
28402 <para>
28403 <literal>microsoft_sess_id_bug</literal>
28404 </para>
28405 </listitem>
28406 <listitem>
28407 <para>
28408 <literal>msie_sslv2_rsa_padding</literal>
28409 </para>
28410 </listitem>
28411 <listitem>
28412 <para>
28413 <literal>netscape_challenge_bug</literal>
28414 </para>
28415 </listitem>
28416 <listitem>
28417 <para>
28418 <literal>netscape_reuse_cipher_change_bug</literal>
28419 </para>
28420 </listitem>
28421 <listitem>
28422 <para>
28423 <literal>no_compression</literal>
28424 </para>
28425 </listitem>
28426 <listitem>
28427 <para>
28428 <literal>no_session_resumption_on_renegotiation</literal>
28429 </para>
28430 </listitem>
28431 <listitem>
28432 <para>
28433 <literal>no_sslv2</literal>
28434 </para>
28435 </listitem>
28436 <listitem>
28437 <para>
28438 <literal>no_sslv3</literal>
28439 </para>
28440 </listitem>
28441 <listitem>
28442 <para>
28443 <literal>no_ticket</literal>
28444 </para>
28445 </listitem>
28446 <listitem>
28447 <para>
28448 <literal>no_tlsv1</literal>
28449 </para>
28450 </listitem>
28451 <listitem>
28452 <para>
28453 <literal>no_tlsv1_1</literal>
28454 </para>
28455 </listitem>
28456 <listitem>
28457 <para>
28458 <literal>no_tlsv1_2</literal>
28459 </para>
28460 </listitem>
28461 <listitem>
28462 <para>
28463 <literal>safari_ecdhe_ecdsa_bug</literal>
28464 </para>
28465 </listitem>
28466 <listitem>
28467 <para>
28468 <literal>single_dh_use</literal>
28469 </para>
28470 </listitem>
28471 <listitem>
28472 <para>
28473 <literal>single_ecdh_use</literal>
28474 </para>
28475 </listitem>
28476 <listitem>
28477 <para>
28478 <literal>ssleay_080_client_dh_bug</literal>
28479 </para>
28480 </listitem>
28481 <listitem>
28482 <para>
28483 <literal>sslref2_reuse_cert_type_bug</literal>
28484 </para>
28485 </listitem>
28486 <listitem>
28487 <para>
28488 <literal>tls_block_padding_bug</literal>
28489 </para>
28490 </listitem>
28491 <listitem>
28492 <para>
28493 <literal>tls_d5_bug</literal>
28494 </para>
28495 </listitem>
28496 <listitem>
28497 <para>
28498 <literal>tls_rollback_bug</literal>
28499 </para>
28500 </listitem>
28501 </itemizedlist>
28502 <para>
28503 As an aside, the <literal>safari_ecdhe_ecdsa_bug</literal> item is a misnomer and affects
28504 all clients connecting using the MacOS SecureTransport TLS facility prior
28505 to MacOS 10.8.4, including email clients.  If you see old MacOS clients failing
28506 to negotiate TLS then this option value might help, provided that your OpenSSL
28507 release is new enough to contain this work-around.  This may be a situation
28508 where you have to upgrade OpenSSL to get buggy clients working.
28509 </para>
28510 <para>
28511 <indexterm role="option">
28512 <primary><option>oracle_servers</option></primary>
28513 </indexterm>
28514 </para>
28515 <informaltable frame="all">
28516 <tgroup cols="4" colsep="0" rowsep="0">
28517 <colspec colwidth="8*" align="left"/>
28518 <colspec colwidth="6*" align="center"/>
28519 <colspec colwidth="6*" align="center"/>
28520 <colspec colwidth="6*" align="right"/>
28521 <tbody>
28522 <row>
28523 <entry><option>oracle_servers</option></entry>
28524 <entry>Use: <emphasis>main</emphasis></entry>
28525 <entry>Type: <emphasis>string list</emphasis></entry>
28526 <entry>Default: <emphasis>unset</emphasis></entry>
28527 </row>
28528 </tbody>
28529 </tgroup>
28530 </informaltable>
28531 <para>
28532 <indexterm role="concept">
28533 <primary>Oracle</primary>
28534 <secondary>server list</secondary>
28535 </indexterm>
28536 This option provides a list of Oracle servers and associated connection data,
28537 to be used in conjunction with <command>oracle</command> lookups (see section <xref linkend="SECID72"/>).
28538 The option is available only if Exim has been built with Oracle support.
28539 </para>
28540 <para>
28541 <indexterm role="option">
28542 <primary><option>percent_hack_domains</option></primary>
28543 </indexterm>
28544 </para>
28545 <informaltable frame="all">
28546 <tgroup cols="4" colsep="0" rowsep="0">
28547 <colspec colwidth="8*" align="left"/>
28548 <colspec colwidth="6*" align="center"/>
28549 <colspec colwidth="6*" align="center"/>
28550 <colspec colwidth="6*" align="right"/>
28551 <tbody>
28552 <row>
28553 <entry><option>percent_hack_domains</option></entry>
28554 <entry>Use: <emphasis>main</emphasis></entry>
28555 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
28556 <entry>Default: <emphasis>unset</emphasis></entry>
28557 </row>
28558 </tbody>
28559 </tgroup>
28560 </informaltable>
28561 <para>
28562 <indexterm role="concept">
28563 <primary><quote>percent hack</quote></primary>
28564 </indexterm>
28565 <indexterm role="concept">
28566 <primary>source routing</primary>
28567 <secondary>in email address</secondary>
28568 </indexterm>
28569 <indexterm role="concept">
28570 <primary>address</primary>
28571 <secondary>source-routed</secondary>
28572 </indexterm>
28573 The <quote>percent hack</quote> is the convention whereby a local part containing a
28574 percent sign is re-interpreted as a new email address, with the percent
28575 replaced by @. This is sometimes called <quote>source routing</quote>, though that term is
28576 also applied to RFC 2822 addresses that begin with an @ character. If this
28577 option is set, Exim implements the percent facility for those domains listed,
28578 but no others. This happens before an incoming SMTP address is tested against
28579 an ACL.
28580 </para>
28581 <para>
28582 <emphasis role="bold">Warning</emphasis>: The <quote>percent hack</quote> has often been abused by people who are
28583 trying to get round relaying restrictions. For this reason, it is best avoided
28584 if at all possible. Unfortunately, a number of less security-conscious MTAs
28585 implement it unconditionally. If you are running Exim on a gateway host, and
28586 routing mail through to internal MTAs without processing the local parts, it is
28587 a good idea to reject recipient addresses with percent characters in their
28588 local parts. Exim&#x2019;s default configuration does this.
28589 </para>
28590 <para>
28591 <indexterm role="option">
28592 <primary><option>perl_at_start</option></primary>
28593 </indexterm>
28594 </para>
28595 <informaltable frame="all">
28596 <tgroup cols="4" colsep="0" rowsep="0">
28597 <colspec colwidth="8*" align="left"/>
28598 <colspec colwidth="6*" align="center"/>
28599 <colspec colwidth="6*" align="center"/>
28600 <colspec colwidth="6*" align="right"/>
28601 <tbody>
28602 <row>
28603 <entry><option>perl_at_start</option></entry>
28604 <entry>Use: <emphasis>main</emphasis></entry>
28605 <entry>Type: <emphasis>boolean</emphasis></entry>
28606 <entry>Default: <emphasis>false</emphasis></entry>
28607 </row>
28608 </tbody>
28609 </tgroup>
28610 </informaltable>
28611 <para>
28612 <indexterm role="concept">
28613 <primary>Perl</primary>
28614 </indexterm>
28615 This option is available only when Exim is built with an embedded Perl
28616 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
28617 </para>
28618 <para>
28619 <indexterm role="option">
28620 <primary><option>perl_startup</option></primary>
28621 </indexterm>
28622 </para>
28623 <informaltable frame="all">
28624 <tgroup cols="4" colsep="0" rowsep="0">
28625 <colspec colwidth="8*" align="left"/>
28626 <colspec colwidth="6*" align="center"/>
28627 <colspec colwidth="6*" align="center"/>
28628 <colspec colwidth="6*" align="right"/>
28629 <tbody>
28630 <row>
28631 <entry><option>perl_startup</option></entry>
28632 <entry>Use: <emphasis>main</emphasis></entry>
28633 <entry>Type: <emphasis>string</emphasis></entry>
28634 <entry>Default: <emphasis>unset</emphasis></entry>
28635 </row>
28636 </tbody>
28637 </tgroup>
28638 </informaltable>
28639 <para>
28640 <indexterm role="concept">
28641 <primary>Perl</primary>
28642 </indexterm>
28643 This option is available only when Exim is built with an embedded Perl
28644 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
28645 </para>
28646 <para>
28647 <indexterm role="option">
28648 <primary><option>perl_startup</option></primary>
28649 </indexterm>
28650 </para>
28651 <informaltable frame="all">
28652 <tgroup cols="4" colsep="0" rowsep="0">
28653 <colspec colwidth="8*" align="left"/>
28654 <colspec colwidth="6*" align="center"/>
28655 <colspec colwidth="6*" align="center"/>
28656 <colspec colwidth="6*" align="right"/>
28657 <tbody>
28658 <row>
28659 <entry><option>perl_startup</option></entry>
28660 <entry>Use: <emphasis>main</emphasis></entry>
28661 <entry>Type: <emphasis>boolean</emphasis></entry>
28662 <entry>Default: <emphasis>false</emphasis></entry>
28663 </row>
28664 </tbody>
28665 </tgroup>
28666 </informaltable>
28667 <para>
28668 <indexterm role="concept">
28669 <primary>Perl</primary>
28670 </indexterm>
28671 This Option enables the taint mode of the embedded Perl interpreter.
28672 </para>
28673 <para>
28674 <indexterm role="option">
28675 <primary><option>pgsql_servers</option></primary>
28676 </indexterm>
28677 </para>
28678 <informaltable frame="all">
28679 <tgroup cols="4" colsep="0" rowsep="0">
28680 <colspec colwidth="8*" align="left"/>
28681 <colspec colwidth="6*" align="center"/>
28682 <colspec colwidth="6*" align="center"/>
28683 <colspec colwidth="6*" align="right"/>
28684 <tbody>
28685 <row>
28686 <entry><option>pgsql_servers</option></entry>
28687 <entry>Use: <emphasis>main</emphasis></entry>
28688 <entry>Type: <emphasis>string list</emphasis></entry>
28689 <entry>Default: <emphasis>unset</emphasis></entry>
28690 </row>
28691 </tbody>
28692 </tgroup>
28693 </informaltable>
28694 <para>
28695 <indexterm role="concept">
28696 <primary>PostgreSQL lookup type</primary>
28697 <secondary>server list</secondary>
28698 </indexterm>
28699 This option provides a list of PostgreSQL servers and associated connection
28700 data, to be used in conjunction with <command>pgsql</command> lookups (see section
28701 <xref linkend="SECID72"/>). The option is available only if Exim has been built with
28702 PostgreSQL support.
28703 </para>
28704 <para>
28705 <indexterm role="option">
28706 <primary><option>pid_file_path</option></primary>
28707 </indexterm>
28708 </para>
28709 <informaltable frame="all">
28710 <tgroup cols="4" colsep="0" rowsep="0">
28711 <colspec colwidth="8*" align="left"/>
28712 <colspec colwidth="6*" align="center"/>
28713 <colspec colwidth="6*" align="center"/>
28714 <colspec colwidth="6*" align="right"/>
28715 <tbody>
28716 <row>
28717 <entry><option>pid_file_path</option></entry>
28718 <entry>Use: <emphasis>main</emphasis></entry>
28719 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28720 <entry>Default: <emphasis>set at compile time</emphasis></entry>
28721 </row>
28722 </tbody>
28723 </tgroup>
28724 </informaltable>
28725 <para>
28726 <indexterm role="concept">
28727 <primary>daemon</primary>
28728 <secondary>pid file path</secondary>
28729 </indexterm>
28730 <indexterm role="concept">
28731 <primary>pid file, path for</primary>
28732 </indexterm>
28733 This option sets the name of the file to which the Exim daemon writes its
28734 process id. The string is expanded, so it can contain, for example, references
28735 to the host name:
28736 </para>
28737 <literallayout class="monospaced">
28738 pid_file_path = /var/log/$primary_hostname/exim.pid
28739 </literallayout>
28740 <para>
28741 If no path is set, the pid is written to the file <filename>exim-daemon.pid</filename> in Exim&#x2019;s
28742 spool directory.
28743 The value set by the option can be overridden by the <option>-oP</option> command line
28744 option. A pid file is not written if a <quote>non-standard</quote> daemon is run by means
28745 of the <option>-oX</option> option, unless a path is explicitly supplied by <option>-oP</option>.
28746 </para>
28747 <para>
28748 <indexterm role="option">
28749 <primary><option>pipelining_advertise_hosts</option></primary>
28750 </indexterm>
28751 </para>
28752 <informaltable frame="all">
28753 <tgroup cols="4" colsep="0" rowsep="0">
28754 <colspec colwidth="8*" align="left"/>
28755 <colspec colwidth="6*" align="center"/>
28756 <colspec colwidth="6*" align="center"/>
28757 <colspec colwidth="6*" align="right"/>
28758 <tbody>
28759 <row>
28760 <entry><option>pipelining_advertise_hosts</option></entry>
28761 <entry>Use: <emphasis>main</emphasis></entry>
28762 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28763 <entry>Default: <emphasis>*</emphasis></entry>
28764 </row>
28765 </tbody>
28766 </tgroup>
28767 </informaltable>
28768 <para>
28769 <indexterm role="concept">
28770 <primary>PIPELINING</primary>
28771 <secondary>suppressing advertising</secondary>
28772 </indexterm>
28773 This option can be used to suppress the advertisement of the SMTP
28774 PIPELINING extension to specific hosts. See also the <emphasis role="bold">no_pipelining</emphasis>
28775 control in section <xref linkend="SECTcontrols"/>. When PIPELINING is not advertised and
28776 <option>smtp_enforce_sync</option> is true, an Exim server enforces strict synchronization
28777 for each SMTP command and response. When PIPELINING is advertised, Exim assumes
28778 that clients will use it; <quote>out of order</quote> commands that are <quote>expected</quote> do
28779 not count as protocol errors (see <option>smtp_max_synprot_errors</option>).
28780 </para>
28781 <para>
28782 <indexterm role="option">
28783 <primary><option>prdr_enable</option></primary>
28784 </indexterm>
28785 </para>
28786 <informaltable frame="all">
28787 <tgroup cols="4" colsep="0" rowsep="0">
28788 <colspec colwidth="8*" align="left"/>
28789 <colspec colwidth="6*" align="center"/>
28790 <colspec colwidth="6*" align="center"/>
28791 <colspec colwidth="6*" align="right"/>
28792 <tbody>
28793 <row>
28794 <entry><option>prdr_enable</option></entry>
28795 <entry>Use: <emphasis>main</emphasis></entry>
28796 <entry>Type: <emphasis>boolean</emphasis></entry>
28797 <entry>Default: <emphasis>false</emphasis></entry>
28798 </row>
28799 </tbody>
28800 </tgroup>
28801 </informaltable>
28802 <para>
28803 <indexterm role="concept">
28804 <primary>PRDR</primary>
28805 <secondary>enabling on server</secondary>
28806 </indexterm>
28807 This option can be used to enable the Per-Recipient Data Response extension
28808 to SMTP, defined by Eric Hall.
28809 If the option is set, PRDR is advertised by Exim when operating as a server.
28810 If the client requests PRDR, and more than one recipient, for a message
28811 an additional ACL is called for each recipient after the message content
28812 is received.  See section <xref linkend="SECTPRDRACL"/>.
28813 </para>
28814 <para>
28815 <indexterm role="option">
28816 <primary><option>preserve_message_logs</option></primary>
28817 </indexterm>
28818 </para>
28819 <informaltable frame="all">
28820 <tgroup cols="4" colsep="0" rowsep="0">
28821 <colspec colwidth="8*" align="left"/>
28822 <colspec colwidth="6*" align="center"/>
28823 <colspec colwidth="6*" align="center"/>
28824 <colspec colwidth="6*" align="right"/>
28825 <tbody>
28826 <row>
28827 <entry><option>preserve_message_logs</option></entry>
28828 <entry>Use: <emphasis>main</emphasis></entry>
28829 <entry>Type: <emphasis>boolean</emphasis></entry>
28830 <entry>Default: <emphasis>false</emphasis></entry>
28831 </row>
28832 </tbody>
28833 </tgroup>
28834 </informaltable>
28835 <para>
28836 <indexterm role="concept">
28837 <primary>message logs</primary>
28838 <secondary>preserving</secondary>
28839 </indexterm>
28840 If this option is set, message log files are not deleted when messages are
28841 completed. Instead, they are moved to a sub-directory of the spool directory
28842 called <filename>msglog.OLD</filename>, where they remain available for statistical or debugging
28843 purposes. This is a dangerous option to set on systems with any appreciable
28844 volume of mail. Use with care!
28845 </para>
28846 <para>
28847 <indexterm role="option">
28848 <primary><option>primary_hostname</option></primary>
28849 </indexterm>
28850 </para>
28851 <informaltable frame="all">
28852 <tgroup cols="4" colsep="0" rowsep="0">
28853 <colspec colwidth="8*" align="left"/>
28854 <colspec colwidth="6*" align="center"/>
28855 <colspec colwidth="6*" align="center"/>
28856 <colspec colwidth="6*" align="right"/>
28857 <tbody>
28858 <row>
28859 <entry><option>primary_hostname</option></entry>
28860 <entry>Use: <emphasis>main</emphasis></entry>
28861 <entry>Type: <emphasis>string</emphasis></entry>
28862 <entry>Default: <emphasis>see below</emphasis></entry>
28863 </row>
28864 </tbody>
28865 </tgroup>
28866 </informaltable>
28867 <para>
28868 <indexterm role="concept">
28869 <primary>name</primary>
28870 <secondary>of local host</secondary>
28871 </indexterm>
28872 <indexterm role="concept">
28873 <primary>host</primary>
28874 <secondary>name of local</secondary>
28875 </indexterm>
28876 <indexterm role="concept">
28877 <primary>local host</primary>
28878 <secondary>name of</secondary>
28879 </indexterm>
28880 <indexterm role="variable">
28881 <primary><varname>$primary_hostname</varname></primary>
28882 </indexterm>
28883 This specifies the name of the current host. It is used in the default EHLO or
28884 HELO command for outgoing SMTP messages (changeable via the <option>helo_data</option>
28885 option in the <command>smtp</command> transport), and as the default for <option>qualify_domain</option>.
28886 The value is also used by default in some SMTP response messages from an Exim
28887 server. This can be changed dynamically by setting <option>smtp_active_hostname</option>.
28888 </para>
28889 <para>
28890 If <option>primary_hostname</option> is not set, Exim calls <function>uname()</function> to find the host
28891 name. If this fails, Exim panics and dies. If the name returned by <function>uname()</function>
28892 contains only one component, Exim passes it to <function>gethostbyname()</function> (or
28893 <function>getipnodebyname()</function> when available) in order to obtain the fully qualified
28894 version. The variable <varname>$primary_hostname</varname> contains the host name, whether set
28895 explicitly by this option, or defaulted.
28896 </para>
28897 <para>
28898 <indexterm role="option">
28899 <primary><option>print_topbitchars</option></primary>
28900 </indexterm>
28901 </para>
28902 <informaltable frame="all">
28903 <tgroup cols="4" colsep="0" rowsep="0">
28904 <colspec colwidth="8*" align="left"/>
28905 <colspec colwidth="6*" align="center"/>
28906 <colspec colwidth="6*" align="center"/>
28907 <colspec colwidth="6*" align="right"/>
28908 <tbody>
28909 <row>
28910 <entry><option>print_topbitchars</option></entry>
28911 <entry>Use: <emphasis>main</emphasis></entry>
28912 <entry>Type: <emphasis>boolean</emphasis></entry>
28913 <entry>Default: <emphasis>false</emphasis></entry>
28914 </row>
28915 </tbody>
28916 </tgroup>
28917 </informaltable>
28918 <para>
28919 <indexterm role="concept">
28920 <primary>printing characters</primary>
28921 </indexterm>
28922 <indexterm role="concept">
28923 <primary>8-bit characters</primary>
28924 </indexterm>
28925 By default, Exim considers only those characters whose codes lie in the range
28926 32&ndash;126 to be printing characters. In a number of circumstances (for example,
28927 when writing log entries) non-printing characters are converted into escape
28928 sequences, primarily to avoid messing up the layout. If <option>print_topbitchars</option>
28929 is set, code values of 128 and above are also considered to be printing
28930 characters.
28931 </para>
28932 <para>
28933 This option also affects the header syntax checks performed by the
28934 <command>autoreply</command> transport, and whether Exim uses RFC 2047 encoding of
28935 the user&#x2019;s full name when constructing From: and Sender: addresses (as
28936 described in section <xref linkend="SECTconstr"/>). Setting this option can cause
28937 Exim to generate eight bit message headers that do not conform to the
28938 standards.
28939 </para>
28940 <para>
28941 <indexterm role="option">
28942 <primary><option>process_log_path</option></primary>
28943 </indexterm>
28944 </para>
28945 <informaltable frame="all">
28946 <tgroup cols="4" colsep="0" rowsep="0">
28947 <colspec colwidth="8*" align="left"/>
28948 <colspec colwidth="6*" align="center"/>
28949 <colspec colwidth="6*" align="center"/>
28950 <colspec colwidth="6*" align="right"/>
28951 <tbody>
28952 <row>
28953 <entry><option>process_log_path</option></entry>
28954 <entry>Use: <emphasis>main</emphasis></entry>
28955 <entry>Type: <emphasis>string</emphasis></entry>
28956 <entry>Default: <emphasis>unset</emphasis></entry>
28957 </row>
28958 </tbody>
28959 </tgroup>
28960 </informaltable>
28961 <para>
28962 <indexterm role="concept">
28963 <primary>process log path</primary>
28964 </indexterm>
28965 <indexterm role="concept">
28966 <primary>log</primary>
28967 <secondary>process log</secondary>
28968 </indexterm>
28969 <indexterm role="concept">
28970 <primary><emphasis>exiwhat</emphasis></primary>
28971 </indexterm>
28972 This option sets the name of the file to which an Exim process writes its
28973 <quote>process log</quote> when sent a USR1 signal. This is used by the <emphasis>exiwhat</emphasis>
28974 utility script. If this option is unset, the file called <filename>exim-process.info</filename>
28975 in Exim&#x2019;s spool directory is used. The ability to specify the name explicitly
28976 can be useful in environments where two different Exims are running, using
28977 different spool directories.
28978 </para>
28979 <para>
28980 <indexterm role="option">
28981 <primary><option>prod_requires_admin</option></primary>
28982 </indexterm>
28983 </para>
28984 <informaltable frame="all">
28985 <tgroup cols="4" colsep="0" rowsep="0">
28986 <colspec colwidth="8*" align="left"/>
28987 <colspec colwidth="6*" align="center"/>
28988 <colspec colwidth="6*" align="center"/>
28989 <colspec colwidth="6*" align="right"/>
28990 <tbody>
28991 <row>
28992 <entry><option>prod_requires_admin</option></entry>
28993 <entry>Use: <emphasis>main</emphasis></entry>
28994 <entry>Type: <emphasis>boolean</emphasis></entry>
28995 <entry>Default: <emphasis>true</emphasis></entry>
28996 </row>
28997 </tbody>
28998 </tgroup>
28999 </informaltable>
29000 <para>
29001 <indexterm role="concept">
29002 <primary>restricting access to features</primary>
29003 </indexterm>
29004 <indexterm role="option">
29005 <primary><option>-M</option></primary>
29006 </indexterm>
29007 <indexterm role="option">
29008 <primary><option>-R</option></primary>
29009 </indexterm>
29010 <indexterm role="option">
29011 <primary><option>-q</option></primary>
29012 </indexterm>
29013 The <option>-M</option>, <option>-R</option>, and <option>-q</option> command-line options require the caller to be an
29014 admin user unless <option>prod_requires_admin</option> is set false. See also
29015 <option>queue_list_requires_admin</option> and <option>commandline_checks_require_admin</option>.
29016 </para>
29017 <para>
29018 <indexterm role="option">
29019 <primary><option>qualify_domain</option></primary>
29020 </indexterm>
29021 </para>
29022 <informaltable frame="all">
29023 <tgroup cols="4" colsep="0" rowsep="0">
29024 <colspec colwidth="8*" align="left"/>
29025 <colspec colwidth="6*" align="center"/>
29026 <colspec colwidth="6*" align="center"/>
29027 <colspec colwidth="6*" align="right"/>
29028 <tbody>
29029 <row>
29030 <entry><option>qualify_domain</option></entry>
29031 <entry>Use: <emphasis>main</emphasis></entry>
29032 <entry>Type: <emphasis>string</emphasis></entry>
29033 <entry>Default: <emphasis>see below</emphasis></entry>
29034 </row>
29035 </tbody>
29036 </tgroup>
29037 </informaltable>
29038 <para>
29039 <indexterm role="concept">
29040 <primary>domain</primary>
29041 <secondary>for qualifying addresses</secondary>
29042 </indexterm>
29043 <indexterm role="concept">
29044 <primary>address</primary>
29045 <secondary>qualification</secondary>
29046 </indexterm>
29047 This option specifies the domain name that is added to any envelope sender
29048 addresses that do not have a domain qualification. It also applies to
29049 recipient addresses if <option>qualify_recipient</option> is not set. Unqualified addresses
29050 are accepted by default only for locally-generated messages. Qualification is
29051 also applied to addresses in header lines such as <emphasis>From:</emphasis> and <emphasis>To:</emphasis> for
29052 locally-generated messages, unless the <option>-bnq</option> command line option is used.
29053 </para>
29054 <para>
29055 Messages from external sources must always contain fully qualified addresses,
29056 unless the sending host matches <option>sender_unqualified_hosts</option> or
29057 <option>recipient_unqualified_hosts</option> (as appropriate), in which case incoming
29058 addresses are qualified with <option>qualify_domain</option> or <option>qualify_recipient</option> as
29059 necessary. Internally, Exim always works with fully qualified envelope
29060 addresses. If <option>qualify_domain</option> is not set, it defaults to the
29061 <option>primary_hostname</option> value.
29062 </para>
29063 <para>
29064 <indexterm role="option">
29065 <primary><option>qualify_recipient</option></primary>
29066 </indexterm>
29067 </para>
29068 <informaltable frame="all">
29069 <tgroup cols="4" colsep="0" rowsep="0">
29070 <colspec colwidth="8*" align="left"/>
29071 <colspec colwidth="6*" align="center"/>
29072 <colspec colwidth="6*" align="center"/>
29073 <colspec colwidth="6*" align="right"/>
29074 <tbody>
29075 <row>
29076 <entry><option>qualify_recipient</option></entry>
29077 <entry>Use: <emphasis>main</emphasis></entry>
29078 <entry>Type: <emphasis>string</emphasis></entry>
29079 <entry>Default: <emphasis>see below</emphasis></entry>
29080 </row>
29081 </tbody>
29082 </tgroup>
29083 </informaltable>
29084 <para>
29085 This option allows you to specify a different domain for qualifying recipient
29086 addresses to the one that is used for senders. See <option>qualify_domain</option> above.
29087 </para>
29088 <para>
29089 <indexterm role="option">
29090 <primary><option>queue_domains</option></primary>
29091 </indexterm>
29092 </para>
29093 <informaltable frame="all">
29094 <tgroup cols="4" colsep="0" rowsep="0">
29095 <colspec colwidth="8*" align="left"/>
29096 <colspec colwidth="6*" align="center"/>
29097 <colspec colwidth="6*" align="center"/>
29098 <colspec colwidth="6*" align="right"/>
29099 <tbody>
29100 <row>
29101 <entry><option>queue_domains</option></entry>
29102 <entry>Use: <emphasis>main</emphasis></entry>
29103 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
29104 <entry>Default: <emphasis>unset</emphasis></entry>
29105 </row>
29106 </tbody>
29107 </tgroup>
29108 </informaltable>
29109 <para>
29110 <indexterm role="concept">
29111 <primary>domain</primary>
29112 <secondary>specifying non-immediate delivery</secondary>
29113 </indexterm>
29114 <indexterm role="concept">
29115 <primary>queueing incoming messages</primary>
29116 </indexterm>
29117 <indexterm role="concept">
29118 <primary>message</primary>
29119 <secondary>queueing certain domains</secondary>
29120 </indexterm>
29121 This option lists domains for which immediate delivery is not required.
29122 A delivery process is started whenever a message is received, but only those
29123 domains that do not match are processed. All other deliveries wait until the
29124 next queue run. See also <option>hold_domains</option> and <option>queue_smtp_domains</option>.
29125 </para>
29126 <para>
29127 <indexterm role="option">
29128 <primary><option>queue_list_requires_admin</option></primary>
29129 </indexterm>
29130 </para>
29131 <informaltable frame="all">
29132 <tgroup cols="4" colsep="0" rowsep="0">
29133 <colspec colwidth="8*" align="left"/>
29134 <colspec colwidth="6*" align="center"/>
29135 <colspec colwidth="6*" align="center"/>
29136 <colspec colwidth="6*" align="right"/>
29137 <tbody>
29138 <row>
29139 <entry><option>queue_list_requires_admin</option></entry>
29140 <entry>Use: <emphasis>main</emphasis></entry>
29141 <entry>Type: <emphasis>boolean</emphasis></entry>
29142 <entry>Default: <emphasis>true</emphasis></entry>
29143 </row>
29144 </tbody>
29145 </tgroup>
29146 </informaltable>
29147 <para>
29148 <indexterm role="concept">
29149 <primary>restricting access to features</primary>
29150 </indexterm>
29151 <indexterm role="option">
29152 <primary><option>-bp</option></primary>
29153 </indexterm>
29154 The <option>-bp</option> command-line option, which lists the messages that are on the
29155 queue, requires the caller to be an admin user unless
29156 <option>queue_list_requires_admin</option> is set false.
29157 See also <option>prod_requires_admin</option> and <option>commandline_checks_require_admin</option>.
29158 </para>
29159 <para>
29160 <indexterm role="option">
29161 <primary><option>queue_only</option></primary>
29162 </indexterm>
29163 </para>
29164 <informaltable frame="all">
29165 <tgroup cols="4" colsep="0" rowsep="0">
29166 <colspec colwidth="8*" align="left"/>
29167 <colspec colwidth="6*" align="center"/>
29168 <colspec colwidth="6*" align="center"/>
29169 <colspec colwidth="6*" align="right"/>
29170 <tbody>
29171 <row>
29172 <entry><option>queue_only</option></entry>
29173 <entry>Use: <emphasis>main</emphasis></entry>
29174 <entry>Type: <emphasis>boolean</emphasis></entry>
29175 <entry>Default: <emphasis>false</emphasis></entry>
29176 </row>
29177 </tbody>
29178 </tgroup>
29179 </informaltable>
29180 <para>
29181 <indexterm role="concept">
29182 <primary>queueing incoming messages</primary>
29183 </indexterm>
29184 <indexterm role="concept">
29185 <primary>message</primary>
29186 <secondary>queueing unconditionally</secondary>
29187 </indexterm>
29188 If <option>queue_only</option> is set, a delivery process is not automatically started
29189 whenever a message is received. Instead, the message waits in the queue for the
29190 next queue run. Even if <option>queue_only</option> is false, incoming messages may not get
29191 delivered immediately when certain conditions (such as heavy load) occur.
29192 </para>
29193 <para>
29194 The <option>-odq</option> command line has the same effect as <option>queue_only</option>. The <option>-odb</option>
29195 and <option>-odi</option> command line options override <option>queue_only</option> unless
29196 <option>queue_only_override</option> is set false. See also <option>queue_only_file</option>,
29197 <option>queue_only_load</option>, and <option>smtp_accept_queue</option>.
29198 </para>
29199 <para>
29200 <indexterm role="option">
29201 <primary><option>queue_only_file</option></primary>
29202 </indexterm>
29203 </para>
29204 <informaltable frame="all">
29205 <tgroup cols="4" colsep="0" rowsep="0">
29206 <colspec colwidth="8*" align="left"/>
29207 <colspec colwidth="6*" align="center"/>
29208 <colspec colwidth="6*" align="center"/>
29209 <colspec colwidth="6*" align="right"/>
29210 <tbody>
29211 <row>
29212 <entry><option>queue_only_file</option></entry>
29213 <entry>Use: <emphasis>main</emphasis></entry>
29214 <entry>Type: <emphasis>string</emphasis></entry>
29215 <entry>Default: <emphasis>unset</emphasis></entry>
29216 </row>
29217 </tbody>
29218 </tgroup>
29219 </informaltable>
29220 <para>
29221 <indexterm role="concept">
29222 <primary>queueing incoming messages</primary>
29223 </indexterm>
29224 <indexterm role="concept">
29225 <primary>message</primary>
29226 <secondary>queueing by file existence</secondary>
29227 </indexterm>
29228 This option can be set to a colon-separated list of absolute path names, each
29229 one optionally preceded by <quote>smtp</quote>. When Exim is receiving a message,
29230 it tests for the existence of each listed path using a call to <function>stat()</function>. For
29231 each path that exists, the corresponding queueing option is set.
29232 For paths with no prefix, <option>queue_only</option> is set; for paths prefixed by
29233 <quote>smtp</quote>, <option>queue_smtp_domains</option> is set to match all domains. So, for example,
29234 </para>
29235 <literallayout class="monospaced">
29236 queue_only_file = smtp/some/file
29237 </literallayout>
29238 <para>
29239 causes Exim to behave as if <option>queue_smtp_domains</option> were set to <quote>*</quote> whenever
29240 <filename>/some/file</filename> exists.
29241 </para>
29242 <para>
29243 <indexterm role="option">
29244 <primary><option>queue_only_load</option></primary>
29245 </indexterm>
29246 </para>
29247 <informaltable frame="all">
29248 <tgroup cols="4" colsep="0" rowsep="0">
29249 <colspec colwidth="8*" align="left"/>
29250 <colspec colwidth="6*" align="center"/>
29251 <colspec colwidth="6*" align="center"/>
29252 <colspec colwidth="6*" align="right"/>
29253 <tbody>
29254 <row>
29255 <entry><option>queue_only_load</option></entry>
29256 <entry>Use: <emphasis>main</emphasis></entry>
29257 <entry>Type: <emphasis>fixed-point</emphasis></entry>
29258 <entry>Default: <emphasis>unset</emphasis></entry>
29259 </row>
29260 </tbody>
29261 </tgroup>
29262 </informaltable>
29263 <para>
29264 <indexterm role="concept">
29265 <primary>load average</primary>
29266 </indexterm>
29267 <indexterm role="concept">
29268 <primary>queueing incoming messages</primary>
29269 </indexterm>
29270 <indexterm role="concept">
29271 <primary>message</primary>
29272 <secondary>queueing by load</secondary>
29273 </indexterm>
29274 If the system load average is higher than this value, incoming messages from
29275 all sources are queued, and no automatic deliveries are started. If this
29276 happens during local or remote SMTP input, all subsequent messages received on
29277 the same SMTP connection are queued by default, whatever happens to the load in
29278 the meantime, but this can be changed by setting <option>queue_only_load_latch</option>
29279 false.
29280 </para>
29281 <para>
29282 Deliveries will subsequently be performed by queue runner processes. This
29283 option has no effect on ancient operating systems on which Exim cannot
29284 determine the load average. See also <option>deliver_queue_load_max</option> and
29285 <option>smtp_load_reserve</option>.
29286 </para>
29287 <para>
29288 <indexterm role="option">
29289 <primary><option>queue_only_load_latch</option></primary>
29290 </indexterm>
29291 </para>
29292 <informaltable frame="all">
29293 <tgroup cols="4" colsep="0" rowsep="0">
29294 <colspec colwidth="8*" align="left"/>
29295 <colspec colwidth="6*" align="center"/>
29296 <colspec colwidth="6*" align="center"/>
29297 <colspec colwidth="6*" align="right"/>
29298 <tbody>
29299 <row>
29300 <entry><option>queue_only_load_latch</option></entry>
29301 <entry>Use: <emphasis>main</emphasis></entry>
29302 <entry>Type: <emphasis>boolean</emphasis></entry>
29303 <entry>Default: <emphasis>true</emphasis></entry>
29304 </row>
29305 </tbody>
29306 </tgroup>
29307 </informaltable>
29308 <para>
29309 <indexterm role="concept">
29310 <primary>load average</primary>
29311 <secondary>re-evaluating per message</secondary>
29312 </indexterm>
29313 When this option is true (the default), once one message has been queued
29314 because the load average is higher than the value set by <option>queue_only_load</option>,
29315 all subsequent messages received on the same SMTP connection are also queued.
29316 This is a deliberate choice; even though the load average may fall below the
29317 threshold, it doesn&#x2019;t seem right to deliver later messages on the same
29318 connection when not delivering earlier ones. However, there are special
29319 circumstances such as very long-lived connections from scanning appliances
29320 where this is not the best strategy. In such cases, <option>queue_only_load_latch</option>
29321 should be set false. This causes the value of the load average to be
29322 re-evaluated for each message.
29323 </para>
29324 <para>
29325 <indexterm role="option">
29326 <primary><option>queue_only_override</option></primary>
29327 </indexterm>
29328 </para>
29329 <informaltable frame="all">
29330 <tgroup cols="4" colsep="0" rowsep="0">
29331 <colspec colwidth="8*" align="left"/>
29332 <colspec colwidth="6*" align="center"/>
29333 <colspec colwidth="6*" align="center"/>
29334 <colspec colwidth="6*" align="right"/>
29335 <tbody>
29336 <row>
29337 <entry><option>queue_only_override</option></entry>
29338 <entry>Use: <emphasis>main</emphasis></entry>
29339 <entry>Type: <emphasis>boolean</emphasis></entry>
29340 <entry>Default: <emphasis>true</emphasis></entry>
29341 </row>
29342 </tbody>
29343 </tgroup>
29344 </informaltable>
29345 <para>
29346 <indexterm role="concept">
29347 <primary>queueing incoming messages</primary>
29348 </indexterm>
29349 When this option is true, the <option>-od</option><emphasis>x</emphasis> command line options override the
29350 setting of <option>queue_only</option> or <option>queue_only_file</option> in the configuration file. If
29351 <option>queue_only_override</option> is set false, the <option>-od</option><emphasis>x</emphasis> options cannot be used
29352 to override; they are accepted, but ignored.
29353 </para>
29354 <para>
29355 <indexterm role="option">
29356 <primary><option>queue_run_in_order</option></primary>
29357 </indexterm>
29358 </para>
29359 <informaltable frame="all">
29360 <tgroup cols="4" colsep="0" rowsep="0">
29361 <colspec colwidth="8*" align="left"/>
29362 <colspec colwidth="6*" align="center"/>
29363 <colspec colwidth="6*" align="center"/>
29364 <colspec colwidth="6*" align="right"/>
29365 <tbody>
29366 <row>
29367 <entry><option>queue_run_in_order</option></entry>
29368 <entry>Use: <emphasis>main</emphasis></entry>
29369 <entry>Type: <emphasis>boolean</emphasis></entry>
29370 <entry>Default: <emphasis>false</emphasis></entry>
29371 </row>
29372 </tbody>
29373 </tgroup>
29374 </informaltable>
29375 <para>
29376 <indexterm role="concept">
29377 <primary>queue runner</primary>
29378 <secondary>processing messages in order</secondary>
29379 </indexterm>
29380 If this option is set, queue runs happen in order of message arrival instead of
29381 in an arbitrary order. For this to happen, a complete list of the entire queue
29382 must be set up before the deliveries start. When the queue is all held in a
29383 single directory (the default), a single list is created for both the ordered
29384 and the non-ordered cases. However, if <option>split_spool_directory</option> is set, a
29385 single list is not created when <option>queue_run_in_order</option> is false. In this case,
29386 the sub-directories are processed one at a time (in a random order), and this
29387 avoids setting up one huge list for the whole queue. Thus, setting
29388 <option>queue_run_in_order</option> with <option>split_spool_directory</option> may degrade performance
29389 when the queue is large, because of the extra work in setting up the single,
29390 large list. In most situations, <option>queue_run_in_order</option> should not be set.
29391 </para>
29392 <para>
29393 <indexterm role="option">
29394 <primary><option>queue_run_max</option></primary>
29395 </indexterm>
29396 </para>
29397 <informaltable frame="all">
29398 <tgroup cols="4" colsep="0" rowsep="0">
29399 <colspec colwidth="8*" align="left"/>
29400 <colspec colwidth="6*" align="center"/>
29401 <colspec colwidth="6*" align="center"/>
29402 <colspec colwidth="6*" align="right"/>
29403 <tbody>
29404 <row>
29405 <entry><option>queue_run_max</option></entry>
29406 <entry>Use: <emphasis>main</emphasis></entry>
29407 <entry>Type: <emphasis>integer</emphasis>&dagger;<emphasis></emphasis></entry>
29408 <entry>Default: <emphasis>5</emphasis></entry>
29409 </row>
29410 </tbody>
29411 </tgroup>
29412 </informaltable>
29413 <para>
29414 <indexterm role="concept">
29415 <primary>queue runner</primary>
29416 <secondary>maximum number of</secondary>
29417 </indexterm>
29418 This controls the maximum number of queue runner processes that an Exim daemon
29419 can run simultaneously. This does not mean that it starts them all at once,
29420 but rather that if the maximum number are still running when the time comes to
29421 start another one, it refrains from starting another one. This can happen with
29422 very large queues and/or very sluggish deliveries. This option does not,
29423 however, interlock with other processes, so additional queue runners can be
29424 started by other means, or by killing and restarting the daemon.
29425 </para>
29426 <para>
29427 Setting this option to zero does not suppress queue runs; rather, it disables
29428 the limit, allowing any number of simultaneous queue runner processes to be
29429 run. If you do not want queue runs to occur, omit the <option>-q</option><emphasis>xx</emphasis> setting on
29430 the daemon&#x2019;s command line.
29431 </para>
29432 <para>
29433 <indexterm role="concept">
29434 <primary>queues</primary>
29435 <secondary>named</secondary>
29436 </indexterm>
29437 <indexterm role="concept">
29438 <primary>named queues</primary>
29439 </indexterm>
29440 To set limits for different named queues use
29441 an expansion depending on the <varname>$queue_name</varname> variable.
29442 </para>
29443 <para>
29444 <indexterm role="option">
29445 <primary><option>queue_smtp_domains</option></primary>
29446 </indexterm>
29447 </para>
29448 <informaltable frame="all">
29449 <tgroup cols="4" colsep="0" rowsep="0">
29450 <colspec colwidth="8*" align="left"/>
29451 <colspec colwidth="6*" align="center"/>
29452 <colspec colwidth="6*" align="center"/>
29453 <colspec colwidth="6*" align="right"/>
29454 <tbody>
29455 <row>
29456 <entry><option>queue_smtp_domains</option></entry>
29457 <entry>Use: <emphasis>main</emphasis></entry>
29458 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
29459 <entry>Default: <emphasis>unset</emphasis></entry>
29460 </row>
29461 </tbody>
29462 </tgroup>
29463 </informaltable>
29464 <para>
29465 <indexterm role="concept">
29466 <primary>queueing incoming messages</primary>
29467 </indexterm>
29468 <indexterm role="concept">
29469 <primary>message</primary>
29470 <secondary>queueing remote deliveries</secondary>
29471 </indexterm>
29472 When this option is set, a delivery process is started whenever a message is
29473 received, routing is performed, and local deliveries take place.
29474 However, if any SMTP deliveries are required for domains that match
29475 <option>queue_smtp_domains</option>, they are not immediately delivered, but instead the
29476 message waits in the queue for the next queue run. Since routing of the message
29477 has taken place, Exim knows to which remote hosts it must be delivered, and so
29478 when the queue run happens, multiple messages for the same host are delivered
29479 over a single SMTP connection. The <option>-odqs</option> command line option causes all
29480 SMTP deliveries to be queued in this way, and is equivalent to setting
29481 <option>queue_smtp_domains</option> to <quote>*</quote>. See also <option>hold_domains</option> and
29482 <option>queue_domains</option>.
29483 </para>
29484 <para>
29485 <indexterm role="option">
29486 <primary><option>receive_timeout</option></primary>
29487 </indexterm>
29488 </para>
29489 <informaltable frame="all">
29490 <tgroup cols="4" colsep="0" rowsep="0">
29491 <colspec colwidth="8*" align="left"/>
29492 <colspec colwidth="6*" align="center"/>
29493 <colspec colwidth="6*" align="center"/>
29494 <colspec colwidth="6*" align="right"/>
29495 <tbody>
29496 <row>
29497 <entry><option>receive_timeout</option></entry>
29498 <entry>Use: <emphasis>main</emphasis></entry>
29499 <entry>Type: <emphasis>time</emphasis></entry>
29500 <entry>Default: <emphasis>0s</emphasis></entry>
29501 </row>
29502 </tbody>
29503 </tgroup>
29504 </informaltable>
29505 <para>
29506 <indexterm role="concept">
29507 <primary>timeout</primary>
29508 <secondary>for non-SMTP input</secondary>
29509 </indexterm>
29510 This option sets the timeout for accepting a non-SMTP message, that is, the
29511 maximum time that Exim waits when reading a message on the standard input. If
29512 the value is zero, it will wait forever. This setting is overridden by the
29513 <option>-or</option> command line option. The timeout for incoming SMTP messages is
29514 controlled by <option>smtp_receive_timeout</option>.
29515 </para>
29516 <para>
29517 <indexterm role="option">
29518 <primary><option>received_header_text</option></primary>
29519 </indexterm>
29520 </para>
29521 <informaltable frame="all">
29522 <tgroup cols="4" colsep="0" rowsep="0">
29523 <colspec colwidth="8*" align="left"/>
29524 <colspec colwidth="6*" align="center"/>
29525 <colspec colwidth="6*" align="center"/>
29526 <colspec colwidth="6*" align="right"/>
29527 <tbody>
29528 <row>
29529 <entry><option>received_header_text</option></entry>
29530 <entry>Use: <emphasis>main</emphasis></entry>
29531 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29532 <entry>Default: <emphasis>see below</emphasis></entry>
29533 </row>
29534 </tbody>
29535 </tgroup>
29536 </informaltable>
29537 <para>
29538 <indexterm role="concept">
29539 <primary>customizing</primary>
29540 <secondary><emphasis>Received:</emphasis> header</secondary>
29541 </indexterm>
29542 <indexterm role="concept">
29543 <primary><emphasis>Received:</emphasis> header line</primary>
29544 <secondary>customizing</secondary>
29545 </indexterm>
29546 This string defines the contents of the <emphasis>Received:</emphasis> message header that is
29547 added to each message, except for the timestamp, which is automatically added
29548 on at the end (preceded by a semicolon). The string is expanded each time it is
29549 used. If the expansion yields an empty string, no <emphasis>Received:</emphasis> header line is
29550 added to the message. Otherwise, the string should start with the text
29551 <quote>Received:</quote> and conform to the RFC 2822 specification for <emphasis>Received:</emphasis>
29552 header lines. The default setting is:
29553 </para>
29554 <literallayout class="monospaced">
29555 received_header_text = Received: \
29556   ${if def:sender_rcvhost {from $sender_rcvhost\n\t}\
29557   {${if def:sender_ident \
29558   {from ${quote_local_part:$sender_ident} }}\
29559   ${if def:sender_helo_name {(helo=$sender_helo_name)\n\t}}}}\
29560   by $primary_hostname \
29561   ${if def:received_protocol {with $received_protocol}} \
29562   ${if def:tls_in_cipher {($tls_in_cipher)\n\t}}\
29563   (Exim $version_number)\n\t\
29564   ${if def:sender_address \
29565   {(envelope-from &lt;$sender_address&gt;)\n\t}}\
29566   id $message_exim_id\
29567   ${if def:received_for {\n\tfor $received_for}}
29568 </literallayout>
29569 <para>
29570 The reference to the TLS cipher is omitted when Exim is built without TLS
29571 support. The use of conditional expansions ensures that this works for both
29572 locally generated messages and messages received from remote hosts, giving
29573 header lines such as the following:
29574 </para>
29575 <literallayout class="monospaced">
29576 Received: from scrooge.carol.example ([192.168.12.25] ident=root)
29577 by marley.carol.example with esmtp (Exim 4.00)
29578 (envelope-from &lt;bob@carol.example&gt;)
29579 id 16IOWa-00019l-00
29580 for chas@dickens.example; Tue, 25 Dec 2001 14:43:44 +0000
29581 Received: by scrooge.carol.example with local (Exim 4.00)
29582 id 16IOWW-000083-00; Tue, 25 Dec 2001 14:43:41 +0000
29583 </literallayout>
29584 <para>
29585 Until the body of the message has been received, the timestamp is the time when
29586 the message started to be received. Once the body has arrived, and all policy
29587 checks have taken place, the timestamp is updated to the time at which the
29588 message was accepted.
29589 </para>
29590 <para>
29591 <indexterm role="option">
29592 <primary><option>received_headers_max</option></primary>
29593 </indexterm>
29594 </para>
29595 <informaltable frame="all">
29596 <tgroup cols="4" colsep="0" rowsep="0">
29597 <colspec colwidth="8*" align="left"/>
29598 <colspec colwidth="6*" align="center"/>
29599 <colspec colwidth="6*" align="center"/>
29600 <colspec colwidth="6*" align="right"/>
29601 <tbody>
29602 <row>
29603 <entry><option>received_headers_max</option></entry>
29604 <entry>Use: <emphasis>main</emphasis></entry>
29605 <entry>Type: <emphasis>integer</emphasis></entry>
29606 <entry>Default: <emphasis>30</emphasis></entry>
29607 </row>
29608 </tbody>
29609 </tgroup>
29610 </informaltable>
29611 <para>
29612 <indexterm role="concept">
29613 <primary>loop</primary>
29614 <secondary>prevention</secondary>
29615 </indexterm>
29616 <indexterm role="concept">
29617 <primary>mail loop prevention</primary>
29618 </indexterm>
29619 <indexterm role="concept">
29620 <primary><emphasis>Received:</emphasis> header line</primary>
29621 <secondary>counting</secondary>
29622 </indexterm>
29623 When a message is to be delivered, the number of <emphasis>Received:</emphasis> headers is
29624 counted, and if it is greater than this parameter, a mail loop is assumed to
29625 have occurred, the delivery is abandoned, and an error message is generated.
29626 This applies to both local and remote deliveries.
29627 </para>
29628 <para>
29629 <indexterm role="option">
29630 <primary><option>recipient_unqualified_hosts</option></primary>
29631 </indexterm>
29632 </para>
29633 <informaltable frame="all">
29634 <tgroup cols="4" colsep="0" rowsep="0">
29635 <colspec colwidth="8*" align="left"/>
29636 <colspec colwidth="6*" align="center"/>
29637 <colspec colwidth="6*" align="center"/>
29638 <colspec colwidth="6*" align="right"/>
29639 <tbody>
29640 <row>
29641 <entry><option>recipient_unqualified_hosts</option></entry>
29642 <entry>Use: <emphasis>main</emphasis></entry>
29643 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
29644 <entry>Default: <emphasis>unset</emphasis></entry>
29645 </row>
29646 </tbody>
29647 </tgroup>
29648 </informaltable>
29649 <para>
29650 <indexterm role="concept">
29651 <primary>unqualified addresses</primary>
29652 </indexterm>
29653 <indexterm role="concept">
29654 <primary>host</primary>
29655 <secondary>unqualified addresses from</secondary>
29656 </indexterm>
29657 This option lists those hosts from which Exim is prepared to accept unqualified
29658 recipient addresses in message envelopes. The addresses are made fully
29659 qualified by the addition of the <option>qualify_recipient</option> value. This option also
29660 affects message header lines. Exim does not reject unqualified recipient
29661 addresses in headers, but it qualifies them only if the message came from a
29662 host that matches <option>recipient_unqualified_hosts</option>,
29663 or if the message was submitted locally (not using TCP/IP), and the <option>-bnq</option>
29664 option was not set.
29665 </para>
29666 <para>
29667 <indexterm role="option">
29668 <primary><option>recipients_max</option></primary>
29669 </indexterm>
29670 </para>
29671 <informaltable frame="all">
29672 <tgroup cols="4" colsep="0" rowsep="0">
29673 <colspec colwidth="8*" align="left"/>
29674 <colspec colwidth="6*" align="center"/>
29675 <colspec colwidth="6*" align="center"/>
29676 <colspec colwidth="6*" align="right"/>
29677 <tbody>
29678 <row>
29679 <entry><option>recipients_max</option></entry>
29680 <entry>Use: <emphasis>main</emphasis></entry>
29681 <entry>Type: <emphasis>integer</emphasis></entry>
29682 <entry>Default: <emphasis>0</emphasis></entry>
29683 </row>
29684 </tbody>
29685 </tgroup>
29686 </informaltable>
29687 <para>
29688 <indexterm role="concept">
29689 <primary>limit</primary>
29690 <secondary>number of recipients</secondary>
29691 </indexterm>
29692 <indexterm role="concept">
29693 <primary>recipient</primary>
29694 <secondary>maximum number</secondary>
29695 </indexterm>
29696 If this option is set greater than zero, it specifies the maximum number of
29697 original recipients for any message. Additional recipients that are generated
29698 by aliasing or forwarding do not count. SMTP messages get a 452 response for
29699 all recipients over the limit; earlier recipients are delivered as normal.
29700 Non-SMTP messages with too many recipients are failed, and no deliveries are
29701 done.
29702 </para>
29703 <para>
29704 <indexterm role="concept">
29705 <primary>RCPT</primary>
29706 <secondary>maximum number of incoming</secondary>
29707 </indexterm>
29708 <emphasis role="bold">Note</emphasis>: The RFCs specify that an SMTP server should accept at least 100
29709 RCPT commands in a single message.
29710 </para>
29711 <para>
29712 <indexterm role="option">
29713 <primary><option>recipients_max_reject</option></primary>
29714 </indexterm>
29715 </para>
29716 <informaltable frame="all">
29717 <tgroup cols="4" colsep="0" rowsep="0">
29718 <colspec colwidth="8*" align="left"/>
29719 <colspec colwidth="6*" align="center"/>
29720 <colspec colwidth="6*" align="center"/>
29721 <colspec colwidth="6*" align="right"/>
29722 <tbody>
29723 <row>
29724 <entry><option>recipients_max_reject</option></entry>
29725 <entry>Use: <emphasis>main</emphasis></entry>
29726 <entry>Type: <emphasis>boolean</emphasis></entry>
29727 <entry>Default: <emphasis>false</emphasis></entry>
29728 </row>
29729 </tbody>
29730 </tgroup>
29731 </informaltable>
29732 <para>
29733 If this option is set true, Exim rejects SMTP messages containing too many
29734 recipients by giving 552 errors to the surplus RCPT commands, and a 554
29735 error to the eventual DATA command. Otherwise (the default) it gives a 452
29736 error to the surplus RCPT commands and accepts the message on behalf of the
29737 initial set of recipients. The remote server should then re-send the message
29738 for the remaining recipients at a later time.
29739 </para>
29740 <para>
29741 <indexterm role="option">
29742 <primary><option>remote_max_parallel</option></primary>
29743 </indexterm>
29744 </para>
29745 <informaltable frame="all">
29746 <tgroup cols="4" colsep="0" rowsep="0">
29747 <colspec colwidth="8*" align="left"/>
29748 <colspec colwidth="6*" align="center"/>
29749 <colspec colwidth="6*" align="center"/>
29750 <colspec colwidth="6*" align="right"/>
29751 <tbody>
29752 <row>
29753 <entry><option>remote_max_parallel</option></entry>
29754 <entry>Use: <emphasis>main</emphasis></entry>
29755 <entry>Type: <emphasis>integer</emphasis></entry>
29756 <entry>Default: <emphasis>2</emphasis></entry>
29757 </row>
29758 </tbody>
29759 </tgroup>
29760 </informaltable>
29761 <para>
29762 <indexterm role="concept">
29763 <primary>delivery</primary>
29764 <secondary>parallelism for remote</secondary>
29765 </indexterm>
29766 This option controls parallel delivery of one message to a number of remote
29767 hosts. If the value is less than 2, parallel delivery is disabled, and Exim
29768 does all the remote deliveries for a message one by one. Otherwise, if a single
29769 message has to be delivered to more than one remote host, or if several copies
29770 have to be sent to the same remote host, up to <option>remote_max_parallel</option>
29771 deliveries are done simultaneously. If more than <option>remote_max_parallel</option>
29772 deliveries are required, the maximum number of processes are started, and as
29773 each one finishes, another is begun. The order of starting processes is the
29774 same as if sequential delivery were being done, and can be controlled by the
29775 <option>remote_sort_domains</option> option. If parallel delivery takes place while running
29776 with debugging turned on, the debugging output from each delivery process is
29777 tagged with its process id.
29778 </para>
29779 <para>
29780 This option controls only the maximum number of parallel deliveries for one
29781 message in one Exim delivery process. Because Exim has no central queue
29782 manager, there is no way of controlling the total number of simultaneous
29783 deliveries if the configuration allows a delivery attempt as soon as a message
29784 is received.
29785 </para>
29786 <para>
29787 <indexterm role="concept">
29788 <primary>number of deliveries</primary>
29789 </indexterm>
29790 <indexterm role="concept">
29791 <primary>delivery</primary>
29792 <secondary>maximum number of</secondary>
29793 </indexterm>
29794 If you want to control the total number of deliveries on the system, you
29795 need to set the <option>queue_only</option> option. This ensures that all incoming messages
29796 are added to the queue without starting a delivery process. Then set up an Exim
29797 daemon to start queue runner processes at appropriate intervals (probably
29798 fairly often, for example, every minute), and limit the total number of queue
29799 runners by setting the <option>queue_run_max</option> parameter. Because each queue runner
29800 delivers only one message at a time, the maximum number of deliveries that can
29801 then take place at once is <option>queue_run_max</option> multiplied by
29802 <option>remote_max_parallel</option>.
29803 </para>
29804 <para>
29805 If it is purely remote deliveries you want to control, use
29806 <option>queue_smtp_domains</option> instead of <option>queue_only</option>. This has the added benefit of
29807 doing the SMTP routing before queueing, so that several messages for the same
29808 host will eventually get delivered down the same connection.
29809 </para>
29810 <para>
29811 <indexterm role="option">
29812 <primary><option>remote_sort_domains</option></primary>
29813 </indexterm>
29814 </para>
29815 <informaltable frame="all">
29816 <tgroup cols="4" colsep="0" rowsep="0">
29817 <colspec colwidth="8*" align="left"/>
29818 <colspec colwidth="6*" align="center"/>
29819 <colspec colwidth="6*" align="center"/>
29820 <colspec colwidth="6*" align="right"/>
29821 <tbody>
29822 <row>
29823 <entry><option>remote_sort_domains</option></entry>
29824 <entry>Use: <emphasis>main</emphasis></entry>
29825 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
29826 <entry>Default: <emphasis>unset</emphasis></entry>
29827 </row>
29828 </tbody>
29829 </tgroup>
29830 </informaltable>
29831 <para>
29832 <indexterm role="concept">
29833 <primary>sorting remote deliveries</primary>
29834 </indexterm>
29835 <indexterm role="concept">
29836 <primary>delivery</primary>
29837 <secondary>sorting remote</secondary>
29838 </indexterm>
29839 When there are a number of remote deliveries for a message, they are sorted by
29840 domain into the order given by this list. For example,
29841 </para>
29842 <literallayout class="monospaced">
29843 remote_sort_domains = *.cam.ac.uk:*.uk
29844 </literallayout>
29845 <para>
29846 would attempt to deliver to all addresses in the <emphasis>cam.ac.uk</emphasis> domain first,
29847 then to those in the <option>uk</option> domain, then to any others.
29848 </para>
29849 <para>
29850 <indexterm role="option">
29851 <primary><option>retry_data_expire</option></primary>
29852 </indexterm>
29853 </para>
29854 <informaltable frame="all">
29855 <tgroup cols="4" colsep="0" rowsep="0">
29856 <colspec colwidth="8*" align="left"/>
29857 <colspec colwidth="6*" align="center"/>
29858 <colspec colwidth="6*" align="center"/>
29859 <colspec colwidth="6*" align="right"/>
29860 <tbody>
29861 <row>
29862 <entry><option>retry_data_expire</option></entry>
29863 <entry>Use: <emphasis>main</emphasis></entry>
29864 <entry>Type: <emphasis>time</emphasis></entry>
29865 <entry>Default: <emphasis>7d</emphasis></entry>
29866 </row>
29867 </tbody>
29868 </tgroup>
29869 </informaltable>
29870 <para>
29871 <indexterm role="concept">
29872 <primary>hints database</primary>
29873 <secondary>data expiry</secondary>
29874 </indexterm>
29875 This option sets a <quote>use before</quote> time on retry information in Exim&#x2019;s hints
29876 database. Any older retry data is ignored. This means that, for example, once a
29877 host has not been tried for 7 days, Exim behaves as if it has no knowledge of
29878 past failures.
29879 </para>
29880 <para>
29881 <indexterm role="option">
29882 <primary><option>retry_interval_max</option></primary>
29883 </indexterm>
29884 </para>
29885 <informaltable frame="all">
29886 <tgroup cols="4" colsep="0" rowsep="0">
29887 <colspec colwidth="8*" align="left"/>
29888 <colspec colwidth="6*" align="center"/>
29889 <colspec colwidth="6*" align="center"/>
29890 <colspec colwidth="6*" align="right"/>
29891 <tbody>
29892 <row>
29893 <entry><option>retry_interval_max</option></entry>
29894 <entry>Use: <emphasis>main</emphasis></entry>
29895 <entry>Type: <emphasis>time</emphasis></entry>
29896 <entry>Default: <emphasis>24h</emphasis></entry>
29897 </row>
29898 </tbody>
29899 </tgroup>
29900 </informaltable>
29901 <para>
29902 <indexterm role="concept">
29903 <primary>retry</primary>
29904 <secondary>limit on interval</secondary>
29905 </indexterm>
29906 <indexterm role="concept">
29907 <primary>limit</primary>
29908 <secondary>on retry interval</secondary>
29909 </indexterm>
29910 Chapter <xref linkend="CHAPretry"/> describes Exim&#x2019;s mechanisms for controlling the
29911 intervals between delivery attempts for messages that cannot be delivered
29912 straight away. This option sets an overall limit to the length of time between
29913 retries. It cannot be set greater than 24 hours; any attempt to do so forces
29914 the default value.
29915 </para>
29916 <para>
29917 <indexterm role="option">
29918 <primary><option>return_path_remove</option></primary>
29919 </indexterm>
29920 </para>
29921 <informaltable frame="all">
29922 <tgroup cols="4" colsep="0" rowsep="0">
29923 <colspec colwidth="8*" align="left"/>
29924 <colspec colwidth="6*" align="center"/>
29925 <colspec colwidth="6*" align="center"/>
29926 <colspec colwidth="6*" align="right"/>
29927 <tbody>
29928 <row>
29929 <entry><option>return_path_remove</option></entry>
29930 <entry>Use: <emphasis>main</emphasis></entry>
29931 <entry>Type: <emphasis>boolean</emphasis></entry>
29932 <entry>Default: <emphasis>true</emphasis></entry>
29933 </row>
29934 </tbody>
29935 </tgroup>
29936 </informaltable>
29937 <para>
29938 <indexterm role="concept">
29939 <primary><emphasis>Return-path:</emphasis> header line</primary>
29940 <secondary>removing</secondary>
29941 </indexterm>
29942 RFC 2821, section 4.4, states that an SMTP server must insert a
29943 <emphasis>Return-path:</emphasis> header line into a message when it makes a <quote>final delivery</quote>.
29944 The <emphasis>Return-path:</emphasis> header preserves the sender address as received in the
29945 MAIL command. This description implies that this header should not be present
29946 in an incoming message. If <option>return_path_remove</option> is true, any existing
29947 <emphasis>Return-path:</emphasis> headers are removed from messages at the time they are
29948 received. Exim&#x2019;s transports have options for adding <emphasis>Return-path:</emphasis> headers at
29949 the time of delivery. They are normally used only for final local deliveries.
29950 </para>
29951 <para>
29952 <indexterm role="option">
29953 <primary><option>return_size_limit</option></primary>
29954 </indexterm>
29955 </para>
29956 <informaltable frame="all">
29957 <tgroup cols="4" colsep="0" rowsep="0">
29958 <colspec colwidth="8*" align="left"/>
29959 <colspec colwidth="6*" align="center"/>
29960 <colspec colwidth="6*" align="center"/>
29961 <colspec colwidth="6*" align="right"/>
29962 <tbody>
29963 <row>
29964 <entry><option>return_size_limit</option></entry>
29965 <entry>Use: <emphasis>main</emphasis></entry>
29966 <entry>Type: <emphasis>integer</emphasis></entry>
29967 <entry>Default: <emphasis>100K</emphasis></entry>
29968 </row>
29969 </tbody>
29970 </tgroup>
29971 </informaltable>
29972 <para>
29973 This option is an obsolete synonym for <option>bounce_return_size_limit</option>.
29974 </para>
29975 <para>
29976 <indexterm role="option">
29977 <primary><option>rfc1413_hosts</option></primary>
29978 </indexterm>
29979 </para>
29980 <informaltable frame="all">
29981 <tgroup cols="4" colsep="0" rowsep="0">
29982 <colspec colwidth="8*" align="left"/>
29983 <colspec colwidth="6*" align="center"/>
29984 <colspec colwidth="6*" align="center"/>
29985 <colspec colwidth="6*" align="right"/>
29986 <tbody>
29987 <row>
29988 <entry><option>rfc1413_hosts</option></entry>
29989 <entry>Use: <emphasis>main</emphasis></entry>
29990 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
29991 <entry>Default: <emphasis>@[]</emphasis></entry>
29992 </row>
29993 </tbody>
29994 </tgroup>
29995 </informaltable>
29996 <para>
29997 <indexterm role="concept">
29998 <primary>RFC 1413</primary>
29999 </indexterm>
30000 <indexterm role="concept">
30001 <primary>host</primary>
30002 <secondary>for RFC 1413 calls</secondary>
30003 </indexterm>
30004 RFC 1413 identification calls are made to any client host which matches
30005 an item in the list.
30006 The default value specifies just this host, being any local interface
30007 for the system.
30008 </para>
30009 <para>
30010 <indexterm role="option">
30011 <primary><option>rfc1413_query_timeout</option></primary>
30012 </indexterm>
30013 </para>
30014 <informaltable frame="all">
30015 <tgroup cols="4" colsep="0" rowsep="0">
30016 <colspec colwidth="8*" align="left"/>
30017 <colspec colwidth="6*" align="center"/>
30018 <colspec colwidth="6*" align="center"/>
30019 <colspec colwidth="6*" align="right"/>
30020 <tbody>
30021 <row>
30022 <entry><option>rfc1413_query_timeout</option></entry>
30023 <entry>Use: <emphasis>main</emphasis></entry>
30024 <entry>Type: <emphasis>time</emphasis></entry>
30025 <entry>Default: <emphasis>0s</emphasis></entry>
30026 </row>
30027 </tbody>
30028 </tgroup>
30029 </informaltable>
30030 <para>
30031 <indexterm role="concept">
30032 <primary>RFC 1413</primary>
30033 <secondary>query timeout</secondary>
30034 </indexterm>
30035 <indexterm role="concept">
30036 <primary>timeout</primary>
30037 <secondary>for RFC 1413 call</secondary>
30038 </indexterm>
30039 This sets the timeout on RFC 1413 identification calls. If it is set to zero,
30040 no RFC 1413 calls are ever made.
30041 </para>
30042 <para>
30043 <indexterm role="option">
30044 <primary><option>sender_unqualified_hosts</option></primary>
30045 </indexterm>
30046 </para>
30047 <informaltable frame="all">
30048 <tgroup cols="4" colsep="0" rowsep="0">
30049 <colspec colwidth="8*" align="left"/>
30050 <colspec colwidth="6*" align="center"/>
30051 <colspec colwidth="6*" align="center"/>
30052 <colspec colwidth="6*" align="right"/>
30053 <tbody>
30054 <row>
30055 <entry><option>sender_unqualified_hosts</option></entry>
30056 <entry>Use: <emphasis>main</emphasis></entry>
30057 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
30058 <entry>Default: <emphasis>unset</emphasis></entry>
30059 </row>
30060 </tbody>
30061 </tgroup>
30062 </informaltable>
30063 <para>
30064 <indexterm role="concept">
30065 <primary>unqualified addresses</primary>
30066 </indexterm>
30067 <indexterm role="concept">
30068 <primary>host</primary>
30069 <secondary>unqualified addresses from</secondary>
30070 </indexterm>
30071 This option lists those hosts from which Exim is prepared to accept unqualified
30072 sender addresses. The addresses are made fully qualified by the addition of
30073 <option>qualify_domain</option>. This option also affects message header lines. Exim does
30074 not reject unqualified addresses in headers that contain sender addresses, but
30075 it qualifies them only if the message came from a host that matches
30076 <option>sender_unqualified_hosts</option>, or if the message was submitted locally (not
30077 using TCP/IP), and the <option>-bnq</option> option was not set.
30078 </para>
30079 <para>
30080 <indexterm role="option">
30081 <primary><option>set_environment</option></primary>
30082 </indexterm>
30083 </para>
30084 <informaltable frame="all">
30085 <tgroup cols="4" colsep="0" rowsep="0">
30086 <colspec colwidth="8*" align="left"/>
30087 <colspec colwidth="6*" align="center"/>
30088 <colspec colwidth="6*" align="center"/>
30089 <colspec colwidth="6*" align="right"/>
30090 <tbody>
30091 <row>
30092 <entry><option>set_environment</option></entry>
30093 <entry>Use: <emphasis>main</emphasis></entry>
30094 <entry>Type: <emphasis>string list</emphasis></entry>
30095 <entry>Default: <emphasis>empty</emphasis></entry>
30096 </row>
30097 </tbody>
30098 </tgroup>
30099 </informaltable>
30100 <para>
30101 <indexterm role="concept">
30102 <primary>environment</primary>
30103 </indexterm>
30104 This option allows to set individual environment variables that the
30105 currently linked libraries and programs in child processes use. The
30106 default list is empty,
30107 </para>
30108 <para>
30109 <indexterm role="option">
30110 <primary><option>slow_lookup_log</option></primary>
30111 </indexterm>
30112 </para>
30113 <informaltable frame="all">
30114 <tgroup cols="4" colsep="0" rowsep="0">
30115 <colspec colwidth="8*" align="left"/>
30116 <colspec colwidth="6*" align="center"/>
30117 <colspec colwidth="6*" align="center"/>
30118 <colspec colwidth="6*" align="right"/>
30119 <tbody>
30120 <row>
30121 <entry><option>slow_lookup_log</option></entry>
30122 <entry>Use: <emphasis>main</emphasis></entry>
30123 <entry>Type: <emphasis>integer</emphasis></entry>
30124 <entry>Default: <emphasis>0</emphasis></entry>
30125 </row>
30126 </tbody>
30127 </tgroup>
30128 </informaltable>
30129 <para>
30130 <indexterm role="concept">
30131 <primary>logging</primary>
30132 <secondary>slow lookups</secondary>
30133 </indexterm>
30134 <indexterm role="concept">
30135 <primary>dns</primary>
30136 <secondary>logging slow lookups</secondary>
30137 </indexterm>
30138 This option controls logging of slow lookups.
30139 If the value is nonzero it is taken as a number of milliseconds
30140 and lookups taking longer than this are logged.
30141 Currently this applies only to DNS lookups.
30142 </para>
30143 <para>
30144 <indexterm role="option">
30145 <primary><option>smtp_accept_keepalive</option></primary>
30146 </indexterm>
30147 </para>
30148 <informaltable frame="all">
30149 <tgroup cols="4" colsep="0" rowsep="0">
30150 <colspec colwidth="8*" align="left"/>
30151 <colspec colwidth="6*" align="center"/>
30152 <colspec colwidth="6*" align="center"/>
30153 <colspec colwidth="6*" align="right"/>
30154 <tbody>
30155 <row>
30156 <entry><option>smtp_accept_keepalive</option></entry>
30157 <entry>Use: <emphasis>main</emphasis></entry>
30158 <entry>Type: <emphasis>boolean</emphasis></entry>
30159 <entry>Default: <emphasis>true</emphasis></entry>
30160 </row>
30161 </tbody>
30162 </tgroup>
30163 </informaltable>
30164 <para>
30165 <indexterm role="concept">
30166 <primary>keepalive</primary>
30167 <secondary>on incoming connection</secondary>
30168 </indexterm>
30169 This option controls the setting of the SO_KEEPALIVE option on incoming
30170 TCP/IP socket connections. When set, it causes the kernel to probe idle
30171 connections periodically, by sending packets with <quote>old</quote> sequence numbers. The
30172 other end of the connection should send an acknowledgment if the connection is
30173 still okay or a reset if the connection has been aborted. The reason for doing
30174 this is that it has the beneficial effect of freeing up certain types of
30175 connection that can get stuck when the remote host is disconnected without
30176 tidying up the TCP/IP call properly. The keepalive mechanism takes several
30177 hours to detect unreachable hosts.
30178 </para>
30179 <para>
30180 <indexterm role="option">
30181 <primary><option>smtp_accept_max</option></primary>
30182 </indexterm>
30183 </para>
30184 <informaltable frame="all">
30185 <tgroup cols="4" colsep="0" rowsep="0">
30186 <colspec colwidth="8*" align="left"/>
30187 <colspec colwidth="6*" align="center"/>
30188 <colspec colwidth="6*" align="center"/>
30189 <colspec colwidth="6*" align="right"/>
30190 <tbody>
30191 <row>
30192 <entry><option>smtp_accept_max</option></entry>
30193 <entry>Use: <emphasis>main</emphasis></entry>
30194 <entry>Type: <emphasis>integer</emphasis></entry>
30195 <entry>Default: <emphasis>20</emphasis></entry>
30196 </row>
30197 </tbody>
30198 </tgroup>
30199 </informaltable>
30200 <para>
30201 <indexterm role="concept">
30202 <primary>limit</primary>
30203 <secondary>incoming SMTP connections</secondary>
30204 </indexterm>
30205 <indexterm role="concept">
30206 <primary>SMTP</primary>
30207 <secondary>incoming connection count</secondary>
30208 </indexterm>
30209 <indexterm role="concept">
30210 <primary>inetd</primary>
30211 </indexterm>
30212 This option specifies the maximum number of simultaneous incoming SMTP calls
30213 that Exim will accept. It applies only to the listening daemon; there is no
30214 control (in Exim) when incoming SMTP is being handled by <emphasis>inetd</emphasis>. If the
30215 value is set to zero, no limit is applied. However, it is required to be
30216 non-zero if either <option>smtp_accept_max_per_host</option> or <option>smtp_accept_queue</option> is
30217 set. See also <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option>.
30218 </para>
30219 <para>
30220 A new SMTP connection is immediately rejected if the <option>smtp_accept_max</option> limit
30221 has been reached. If not, Exim first checks <option>smtp_accept_max_per_host</option>. If
30222 that limit has not been reached for the client host, <option>smtp_accept_reserve</option>
30223 and <option>smtp_load_reserve</option> are then checked before accepting the connection.
30224 </para>
30225 <para>
30226 <indexterm role="option">
30227 <primary><option>smtp_accept_max_nonmail</option></primary>
30228 </indexterm>
30229 </para>
30230 <informaltable frame="all">
30231 <tgroup cols="4" colsep="0" rowsep="0">
30232 <colspec colwidth="8*" align="left"/>
30233 <colspec colwidth="6*" align="center"/>
30234 <colspec colwidth="6*" align="center"/>
30235 <colspec colwidth="6*" align="right"/>
30236 <tbody>
30237 <row>
30238 <entry><option>smtp_accept_max_nonmail</option></entry>
30239 <entry>Use: <emphasis>main</emphasis></entry>
30240 <entry>Type: <emphasis>integer</emphasis></entry>
30241 <entry>Default: <emphasis>10</emphasis></entry>
30242 </row>
30243 </tbody>
30244 </tgroup>
30245 </informaltable>
30246 <para>
30247 <indexterm role="concept">
30248 <primary>limit</primary>
30249 <secondary>non-mail SMTP commands</secondary>
30250 </indexterm>
30251 <indexterm role="concept">
30252 <primary>SMTP</primary>
30253 <secondary>limiting non-mail commands</secondary>
30254 </indexterm>
30255 Exim counts the number of <quote>non-mail</quote> commands in an SMTP session, and drops
30256 the connection if there are too many. This option defines <quote>too many</quote>. The
30257 check catches some denial-of-service attacks, repeated failing AUTHs, or a mad
30258 client looping sending EHLO, for example. The check is applied only if the
30259 client host matches <option>smtp_accept_max_nonmail_hosts</option>.
30260 </para>
30261 <para>
30262 When a new message is expected, one occurrence of RSET is not counted. This
30263 allows a client to send one RSET between messages (this is not necessary,
30264 but some clients do it). Exim also allows one uncounted occurrence of HELO
30265 or EHLO, and one occurrence of STARTTLS between messages. After
30266 starting up a TLS session, another EHLO is expected, and so it too is not
30267 counted. The first occurrence of AUTH in a connection, or immediately
30268 following STARTTLS is not counted. Otherwise, all commands other than
30269 MAIL, RCPT, DATA, and QUIT are counted.
30270 </para>
30271 <para>
30272 <indexterm role="option">
30273 <primary><option>smtp_accept_max_nonmail_hosts</option></primary>
30274 </indexterm>
30275 </para>
30276 <informaltable frame="all">
30277 <tgroup cols="4" colsep="0" rowsep="0">
30278 <colspec colwidth="8*" align="left"/>
30279 <colspec colwidth="6*" align="center"/>
30280 <colspec colwidth="6*" align="center"/>
30281 <colspec colwidth="6*" align="right"/>
30282 <tbody>
30283 <row>
30284 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
30285 <entry>Use: <emphasis>main</emphasis></entry>
30286 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
30287 <entry>Default: <emphasis>*</emphasis></entry>
30288 </row>
30289 </tbody>
30290 </tgroup>
30291 </informaltable>
30292 <para>
30293 You can control which hosts are subject to the <option>smtp_accept_max_nonmail</option>
30294 check by setting this option. The default value makes it apply to all hosts. By
30295 changing the value, you can exclude any badly-behaved hosts that you have to
30296 live with.
30297 </para>
30298 <para>
30299 <indexterm role="option">
30300 <primary><option>smtp_accept_max_per_connection</option></primary>
30301 </indexterm>
30302 </para>
30303 <informaltable frame="all">
30304 <tgroup cols="4" colsep="0" rowsep="0">
30305 <colspec colwidth="8*" align="left"/>
30306 <colspec colwidth="6*" align="center"/>
30307 <colspec colwidth="6*" align="center"/>
30308 <colspec colwidth="6*" align="right"/>
30309 <tbody>
30310 <row>
30311 <entry><option>smtp_accept_max_per_connection</option></entry>
30312 <entry>Use: <emphasis>main</emphasis></entry>
30313 <entry>Type: <emphasis>integer</emphasis></entry>
30314 <entry>Default: <emphasis>1000</emphasis></entry>
30315 </row>
30316 </tbody>
30317 </tgroup>
30318 </informaltable>
30319 <para>
30320 <indexterm role="concept">
30321 <primary>SMTP</primary>
30322 <secondary>limiting incoming message count</secondary>
30323 </indexterm>
30324 <indexterm role="concept">
30325 <primary>limit</primary>
30326 <secondary>messages per SMTP connection</secondary>
30327 </indexterm>
30328 The value of this option limits the number of MAIL commands that Exim is
30329 prepared to accept over a single SMTP connection, whether or not each command
30330 results in the transfer of a message. After the limit is reached, a 421
30331 response is given to subsequent MAIL commands. This limit is a safety
30332 precaution against a client that goes mad (incidents of this type have been
30333 seen).
30334 </para>
30335 <para>
30336 <indexterm role="option">
30337 <primary><option>smtp_accept_max_per_host</option></primary>
30338 </indexterm>
30339 </para>
30340 <informaltable frame="all">
30341 <tgroup cols="4" colsep="0" rowsep="0">
30342 <colspec colwidth="8*" align="left"/>
30343 <colspec colwidth="6*" align="center"/>
30344 <colspec colwidth="6*" align="center"/>
30345 <colspec colwidth="6*" align="right"/>
30346 <tbody>
30347 <row>
30348 <entry><option>smtp_accept_max_per_host</option></entry>
30349 <entry>Use: <emphasis>main</emphasis></entry>
30350 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30351 <entry>Default: <emphasis>unset</emphasis></entry>
30352 </row>
30353 </tbody>
30354 </tgroup>
30355 </informaltable>
30356 <para>
30357 <indexterm role="concept">
30358 <primary>limit</primary>
30359 <secondary>SMTP connections from one host</secondary>
30360 </indexterm>
30361 <indexterm role="concept">
30362 <primary>host</primary>
30363 <secondary>limiting SMTP connections from</secondary>
30364 </indexterm>
30365 This option restricts the number of simultaneous IP connections from a single
30366 host (strictly, from a single IP address) to the Exim daemon. The option is
30367 expanded, to enable different limits to be applied to different hosts by
30368 reference to <varname>$sender_host_address</varname>. Once the limit is reached, additional
30369 connection attempts from the same host are rejected with error code 421. This
30370 is entirely independent of <option>smtp_accept_reserve</option>. The option&#x2019;s default value
30371 of zero imposes no limit. If this option is set greater than zero, it is
30372 required that <option>smtp_accept_max</option> be non-zero.
30373 </para>
30374 <para>
30375 <emphasis role="bold">Warning</emphasis>: When setting this option you should not use any expansion
30376 constructions that take an appreciable amount of time. The expansion and test
30377 happen in the main daemon loop, in order to reject additional connections
30378 without forking additional processes (otherwise a denial-of-service attack
30379 could cause a vast number or processes to be created). While the daemon is
30380 doing this processing, it cannot accept any other incoming connections.
30381 </para>
30382 <para>
30383 <indexterm role="option">
30384 <primary><option>smtp_accept_queue</option></primary>
30385 </indexterm>
30386 </para>
30387 <informaltable frame="all">
30388 <tgroup cols="4" colsep="0" rowsep="0">
30389 <colspec colwidth="8*" align="left"/>
30390 <colspec colwidth="6*" align="center"/>
30391 <colspec colwidth="6*" align="center"/>
30392 <colspec colwidth="6*" align="right"/>
30393 <tbody>
30394 <row>
30395 <entry><option>smtp_accept_queue</option></entry>
30396 <entry>Use: <emphasis>main</emphasis></entry>
30397 <entry>Type: <emphasis>integer</emphasis></entry>
30398 <entry>Default: <emphasis>0</emphasis></entry>
30399 </row>
30400 </tbody>
30401 </tgroup>
30402 </informaltable>
30403 <para>
30404 <indexterm role="concept">
30405 <primary>SMTP</primary>
30406 <secondary>incoming connection count</secondary>
30407 </indexterm>
30408 <indexterm role="concept">
30409 <primary>queueing incoming messages</primary>
30410 </indexterm>
30411 <indexterm role="concept">
30412 <primary>message</primary>
30413 <secondary>queueing by SMTP connection count</secondary>
30414 </indexterm>
30415 If the number of simultaneous incoming SMTP connections being handled via the
30416 listening daemon exceeds this value, messages received by SMTP are just placed
30417 in the queue; no delivery processes are started automatically. The count is
30418 fixed at the start of an SMTP connection. It cannot be updated in the
30419 subprocess that receives messages, and so the queueing or not queueing applies
30420 to all messages received in the same connection.
30421 </para>
30422 <para>
30423 A value of zero implies no limit, and clearly any non-zero value is useful only
30424 if it is less than the <option>smtp_accept_max</option> value (unless that is zero). See
30425 also <option>queue_only</option>, <option>queue_only_load</option>, <option>queue_smtp_domains</option>, and the
30426 various <option>-od</option><emphasis>x</emphasis> command line options.
30427 </para>
30428 <para>
30429 <indexterm role="option">
30430 <primary><option>smtp_accept_queue_per_connection</option></primary>
30431 </indexterm>
30432 </para>
30433 <informaltable frame="all">
30434 <tgroup cols="4" colsep="0" rowsep="0">
30435 <colspec colwidth="8*" align="left"/>
30436 <colspec colwidth="6*" align="center"/>
30437 <colspec colwidth="6*" align="center"/>
30438 <colspec colwidth="6*" align="right"/>
30439 <tbody>
30440 <row>
30441 <entry><option>smtp_accept_queue_per_connection</option></entry>
30442 <entry>Use: <emphasis>main</emphasis></entry>
30443 <entry>Type: <emphasis>integer</emphasis></entry>
30444 <entry>Default: <emphasis>10</emphasis></entry>
30445 </row>
30446 </tbody>
30447 </tgroup>
30448 </informaltable>
30449 <para>
30450 <indexterm role="concept">
30451 <primary>queueing incoming messages</primary>
30452 </indexterm>
30453 <indexterm role="concept">
30454 <primary>message</primary>
30455 <secondary>queueing by message count</secondary>
30456 </indexterm>
30457 This option limits the number of delivery processes that Exim starts
30458 automatically when receiving messages via SMTP, whether via the daemon or by
30459 the use of <option>-bs</option> or <option>-bS</option>. If the value of the option is greater than zero,
30460 and the number of messages received in a single SMTP session exceeds this
30461 number, subsequent messages are placed in the queue, but no delivery processes
30462 are started. This helps to limit the number of Exim processes when a server
30463 restarts after downtime and there is a lot of mail waiting for it on other
30464 systems. On large systems, the default should probably be increased, and on
30465 dial-in client systems it should probably be set to zero (that is, disabled).
30466 </para>
30467 <para>
30468 <indexterm role="option">
30469 <primary><option>smtp_accept_reserve</option></primary>
30470 </indexterm>
30471 </para>
30472 <informaltable frame="all">
30473 <tgroup cols="4" colsep="0" rowsep="0">
30474 <colspec colwidth="8*" align="left"/>
30475 <colspec colwidth="6*" align="center"/>
30476 <colspec colwidth="6*" align="center"/>
30477 <colspec colwidth="6*" align="right"/>
30478 <tbody>
30479 <row>
30480 <entry><option>smtp_accept_reserve</option></entry>
30481 <entry>Use: <emphasis>main</emphasis></entry>
30482 <entry>Type: <emphasis>integer</emphasis></entry>
30483 <entry>Default: <emphasis>0</emphasis></entry>
30484 </row>
30485 </tbody>
30486 </tgroup>
30487 </informaltable>
30488 <para>
30489 <indexterm role="concept">
30490 <primary>SMTP</primary>
30491 <secondary>incoming call count</secondary>
30492 </indexterm>
30493 <indexterm role="concept">
30494 <primary>host</primary>
30495 <secondary>reserved</secondary>
30496 </indexterm>
30497 When <option>smtp_accept_max</option> is set greater than zero, this option specifies a
30498 number of SMTP connections that are reserved for connections from the hosts
30499 that are specified in <option>smtp_reserve_hosts</option>. The value set in
30500 <option>smtp_accept_max</option> includes this reserve pool. The specified hosts are not
30501 restricted to this number of connections; the option specifies a minimum number
30502 of connection slots for them, not a maximum. It is a guarantee that this group
30503 of hosts can always get at least <option>smtp_accept_reserve</option> connections. However,
30504 the limit specified by <option>smtp_accept_max_per_host</option> is still applied to each
30505 individual host.
30506 </para>
30507 <para>
30508 For example, if <option>smtp_accept_max</option> is set to 50 and <option>smtp_accept_reserve</option> is
30509 set to 5, once there are 45 active connections (from any hosts), new
30510 connections are accepted only from hosts listed in <option>smtp_reserve_hosts</option>,
30511 provided the other criteria for acceptance are met.
30512 </para>
30513 <para>
30514 <indexterm role="option">
30515 <primary><option>smtp_active_hostname</option></primary>
30516 </indexterm>
30517 </para>
30518 <informaltable frame="all">
30519 <tgroup cols="4" colsep="0" rowsep="0">
30520 <colspec colwidth="8*" align="left"/>
30521 <colspec colwidth="6*" align="center"/>
30522 <colspec colwidth="6*" align="center"/>
30523 <colspec colwidth="6*" align="right"/>
30524 <tbody>
30525 <row>
30526 <entry><option>smtp_active_hostname</option></entry>
30527 <entry>Use: <emphasis>main</emphasis></entry>
30528 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30529 <entry>Default: <emphasis>unset</emphasis></entry>
30530 </row>
30531 </tbody>
30532 </tgroup>
30533 </informaltable>
30534 <para>
30535 <indexterm role="concept">
30536 <primary>host</primary>
30537 <secondary>name in SMTP responses</secondary>
30538 </indexterm>
30539 <indexterm role="concept">
30540 <primary>SMTP</primary>
30541 <secondary>host name in responses</secondary>
30542 </indexterm>
30543 <indexterm role="variable">
30544 <primary><varname>$primary_hostname</varname></primary>
30545 </indexterm>
30546 This option is provided for multi-homed servers that want to masquerade as
30547 several different hosts. At the start of an incoming SMTP connection, its value
30548 is expanded and used instead of the value of <varname>$primary_hostname</varname> in SMTP
30549 responses. For example, it is used as domain name in the response to an
30550 incoming HELO or EHLO command.
30551 </para>
30552 <para>
30553 <indexterm role="variable">
30554 <primary><varname>$smtp_active_hostname</varname></primary>
30555 </indexterm>
30556 The active hostname is placed in the <varname>$smtp_active_hostname</varname> variable, which
30557 is saved with any messages that are received. It is therefore available for use
30558 in routers and transports when the message is later delivered.
30559 </para>
30560 <para>
30561 If this option is unset, or if its expansion is forced to fail, or if the
30562 expansion results in an empty string, the value of <varname>$primary_hostname</varname> is
30563 used. Other expansion failures cause a message to be written to the main and
30564 panic logs, and the SMTP command receives a temporary error. Typically, the
30565 value of <option>smtp_active_hostname</option> depends on the incoming interface address.
30566 For example:
30567 </para>
30568 <literallayout class="monospaced">
30569 smtp_active_hostname = ${if eq{$received_ip_address}{10.0.0.1}\
30570   {cox.mydomain}{box.mydomain}}
30571 </literallayout>
30572 <para>
30573 Although <varname>$smtp_active_hostname</varname> is primarily concerned with incoming
30574 messages, it is also used as the default for HELO commands in callout
30575 verification if there is no remote transport from which to obtain a
30576 <option>helo_data</option> value.
30577 </para>
30578 <para>
30579 <indexterm role="option">
30580 <primary><option>smtp_banner</option></primary>
30581 </indexterm>
30582 </para>
30583 <informaltable frame="all">
30584 <tgroup cols="4" colsep="0" rowsep="0">
30585 <colspec colwidth="8*" align="left"/>
30586 <colspec colwidth="6*" align="center"/>
30587 <colspec colwidth="6*" align="center"/>
30588 <colspec colwidth="6*" align="right"/>
30589 <tbody>
30590 <row>
30591 <entry><option>smtp_banner</option></entry>
30592 <entry>Use: <emphasis>main</emphasis></entry>
30593 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30594 <entry>Default: <emphasis>see below</emphasis></entry>
30595 </row>
30596 </tbody>
30597 </tgroup>
30598 </informaltable>
30599 <para>
30600 <indexterm role="concept">
30601 <primary>SMTP</primary>
30602 <secondary>welcome banner</secondary>
30603 </indexterm>
30604 <indexterm role="concept">
30605 <primary>banner for SMTP</primary>
30606 </indexterm>
30607 <indexterm role="concept">
30608 <primary>welcome banner for SMTP</primary>
30609 </indexterm>
30610 <indexterm role="concept">
30611 <primary>customizing</primary>
30612 <secondary>SMTP banner</secondary>
30613 </indexterm>
30614 This string, which is expanded every time it is used, is output as the initial
30615 positive response to an SMTP connection. The default setting is:
30616 </para>
30617 <literallayout class="monospaced">
30618 smtp_banner = $smtp_active_hostname ESMTP Exim \
30619   $version_number $tod_full
30620 </literallayout>
30621 <para>
30622 Failure to expand the string causes a panic error. If you want to create a
30623 multiline response to the initial SMTP connection, use <quote>\n</quote> in the string at
30624 appropriate points, but not at the end. Note that the 220 code is not included
30625 in this string. Exim adds it automatically (several times in the case of a
30626 multiline response).
30627 </para>
30628 <para>
30629 <indexterm role="option">
30630 <primary><option>smtp_check_spool_space</option></primary>
30631 </indexterm>
30632 </para>
30633 <informaltable frame="all">
30634 <tgroup cols="4" colsep="0" rowsep="0">
30635 <colspec colwidth="8*" align="left"/>
30636 <colspec colwidth="6*" align="center"/>
30637 <colspec colwidth="6*" align="center"/>
30638 <colspec colwidth="6*" align="right"/>
30639 <tbody>
30640 <row>
30641 <entry><option>smtp_check_spool_space</option></entry>
30642 <entry>Use: <emphasis>main</emphasis></entry>
30643 <entry>Type: <emphasis>boolean</emphasis></entry>
30644 <entry>Default: <emphasis>true</emphasis></entry>
30645 </row>
30646 </tbody>
30647 </tgroup>
30648 </informaltable>
30649 <para>
30650 <indexterm role="concept">
30651 <primary>checking disk space</primary>
30652 </indexterm>
30653 <indexterm role="concept">
30654 <primary>disk space, checking</primary>
30655 </indexterm>
30656 <indexterm role="concept">
30657 <primary>spool directory</primary>
30658 <secondary>checking space</secondary>
30659 </indexterm>
30660 When this option is set, if an incoming SMTP session encounters the SIZE
30661 option on a MAIL command, it checks that there is enough space in the
30662 spool directory&#x2019;s partition to accept a message of that size, while still
30663 leaving free the amount specified by <option>check_spool_space</option> (even if that value
30664 is zero). If there isn&#x2019;t enough space, a temporary error code is returned.
30665 </para>
30666 <para>
30667 <indexterm role="option">
30668 <primary><option>smtp_connect_backlog</option></primary>
30669 </indexterm>
30670 </para>
30671 <informaltable frame="all">
30672 <tgroup cols="4" colsep="0" rowsep="0">
30673 <colspec colwidth="8*" align="left"/>
30674 <colspec colwidth="6*" align="center"/>
30675 <colspec colwidth="6*" align="center"/>
30676 <colspec colwidth="6*" align="right"/>
30677 <tbody>
30678 <row>
30679 <entry><option>smtp_connect_backlog</option></entry>
30680 <entry>Use: <emphasis>main</emphasis></entry>
30681 <entry>Type: <emphasis>integer</emphasis></entry>
30682 <entry>Default: <emphasis>20</emphasis></entry>
30683 </row>
30684 </tbody>
30685 </tgroup>
30686 </informaltable>
30687 <para>
30688 <indexterm role="concept">
30689 <primary>connection backlog</primary>
30690 </indexterm>
30691 <indexterm role="concept">
30692 <primary>SMTP</primary>
30693 <secondary>connection backlog</secondary>
30694 </indexterm>
30695 <indexterm role="concept">
30696 <primary>backlog of connections</primary>
30697 </indexterm>
30698 This option specifies a maximum number of waiting SMTP connections. Exim passes
30699 this value to the TCP/IP system when it sets up its listener. Once this number
30700 of connections are waiting for the daemon&#x2019;s attention, subsequent connection
30701 attempts are refused at the TCP/IP level. At least, that is what the manuals
30702 say; in some circumstances such connection attempts have been observed to time
30703 out instead. For large systems it is probably a good idea to increase the
30704 value (to 50, say). It also gives some protection against denial-of-service
30705 attacks by SYN flooding.
30706 </para>
30707 <para>
30708 <indexterm role="option">
30709 <primary><option>smtp_enforce_sync</option></primary>
30710 </indexterm>
30711 </para>
30712 <informaltable frame="all">
30713 <tgroup cols="4" colsep="0" rowsep="0">
30714 <colspec colwidth="8*" align="left"/>
30715 <colspec colwidth="6*" align="center"/>
30716 <colspec colwidth="6*" align="center"/>
30717 <colspec colwidth="6*" align="right"/>
30718 <tbody>
30719 <row>
30720 <entry><option>smtp_enforce_sync</option></entry>
30721 <entry>Use: <emphasis>main</emphasis></entry>
30722 <entry>Type: <emphasis>boolean</emphasis></entry>
30723 <entry>Default: <emphasis>true</emphasis></entry>
30724 </row>
30725 </tbody>
30726 </tgroup>
30727 </informaltable>
30728 <para>
30729 <indexterm role="concept">
30730 <primary>SMTP</primary>
30731 <secondary>synchronization checking</secondary>
30732 </indexterm>
30733 <indexterm role="concept">
30734 <primary>synchronization checking in SMTP</primary>
30735 </indexterm>
30736 The SMTP protocol specification requires the client to wait for a response from
30737 the server at certain points in the dialogue. Without PIPELINING these
30738 synchronization points are after every command; with PIPELINING they are
30739 fewer, but they still exist.
30740 </para>
30741 <para>
30742 Some spamming sites send out a complete set of SMTP commands without waiting
30743 for any response. Exim protects against this by rejecting a message if the
30744 client has sent further input when it should not have. The error response <quote>554
30745 SMTP synchronization error</quote> is sent, and the connection is dropped. Testing
30746 for this error cannot be perfect because of transmission delays (unexpected
30747 input may be on its way but not yet received when Exim checks). However, it
30748 does detect many instances.
30749 </para>
30750 <para>
30751 The check can be globally disabled by setting <option>smtp_enforce_sync</option> false.
30752 If you want to disable the check selectively (for example, only for certain
30753 hosts), you can do so by an appropriate use of a <option>control</option> modifier in an ACL
30754 (see section <xref linkend="SECTcontrols"/>). See also <option>pipelining_advertise_hosts</option>.
30755 </para>
30756 <para>
30757 <indexterm role="option">
30758 <primary><option>smtp_etrn_command</option></primary>
30759 </indexterm>
30760 </para>
30761 <informaltable frame="all">
30762 <tgroup cols="4" colsep="0" rowsep="0">
30763 <colspec colwidth="8*" align="left"/>
30764 <colspec colwidth="6*" align="center"/>
30765 <colspec colwidth="6*" align="center"/>
30766 <colspec colwidth="6*" align="right"/>
30767 <tbody>
30768 <row>
30769 <entry><option>smtp_etrn_command</option></entry>
30770 <entry>Use: <emphasis>main</emphasis></entry>
30771 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30772 <entry>Default: <emphasis>unset</emphasis></entry>
30773 </row>
30774 </tbody>
30775 </tgroup>
30776 </informaltable>
30777 <para>
30778 <indexterm role="concept">
30779 <primary>ETRN</primary>
30780 <secondary>command to be run</secondary>
30781 </indexterm>
30782 <indexterm role="variable">
30783 <primary><varname>$domain</varname></primary>
30784 </indexterm>
30785 If this option is set, the given command is run whenever an SMTP ETRN
30786 command is received from a host that is permitted to issue such commands (see
30787 chapter <xref linkend="CHAPACL"/>). The string is split up into separate arguments which
30788 are independently expanded. The expansion variable <varname>$domain</varname> is set to the
30789 argument of the ETRN command, and no syntax checking is done on it. For
30790 example:
30791 </para>
30792 <literallayout class="monospaced">
30793 smtp_etrn_command = /etc/etrn_command $domain \
30794                     $sender_host_address
30795 </literallayout>
30796 <para>
30797 A new process is created to run the command, but Exim does not wait for it to
30798 complete. Consequently, its status cannot be checked. If the command cannot be
30799 run, a line is written to the panic log, but the ETRN caller still receives
30800 a 250 success response. Exim is normally running under its own uid when
30801 receiving SMTP, so it is not possible for it to change the uid before running
30802 the command.
30803 </para>
30804 <para>
30805 <indexterm role="option">
30806 <primary><option>smtp_etrn_serialize</option></primary>
30807 </indexterm>
30808 </para>
30809 <informaltable frame="all">
30810 <tgroup cols="4" colsep="0" rowsep="0">
30811 <colspec colwidth="8*" align="left"/>
30812 <colspec colwidth="6*" align="center"/>
30813 <colspec colwidth="6*" align="center"/>
30814 <colspec colwidth="6*" align="right"/>
30815 <tbody>
30816 <row>
30817 <entry><option>smtp_etrn_serialize</option></entry>
30818 <entry>Use: <emphasis>main</emphasis></entry>
30819 <entry>Type: <emphasis>boolean</emphasis></entry>
30820 <entry>Default: <emphasis>true</emphasis></entry>
30821 </row>
30822 </tbody>
30823 </tgroup>
30824 </informaltable>
30825 <para>
30826 <indexterm role="concept">
30827 <primary>ETRN</primary>
30828 <secondary>serializing</secondary>
30829 </indexterm>
30830 When this option is set, it prevents the simultaneous execution of more than
30831 one identical command as a result of ETRN in an SMTP connection. See
30832 section <xref linkend="SECTETRN"/> for details.
30833 </para>
30834 <para>
30835 <indexterm role="option">
30836 <primary><option>smtp_load_reserve</option></primary>
30837 </indexterm>
30838 </para>
30839 <informaltable frame="all">
30840 <tgroup cols="4" colsep="0" rowsep="0">
30841 <colspec colwidth="8*" align="left"/>
30842 <colspec colwidth="6*" align="center"/>
30843 <colspec colwidth="6*" align="center"/>
30844 <colspec colwidth="6*" align="right"/>
30845 <tbody>
30846 <row>
30847 <entry><option>smtp_load_reserve</option></entry>
30848 <entry>Use: <emphasis>main</emphasis></entry>
30849 <entry>Type: <emphasis>fixed-point</emphasis></entry>
30850 <entry>Default: <emphasis>unset</emphasis></entry>
30851 </row>
30852 </tbody>
30853 </tgroup>
30854 </informaltable>
30855 <para>
30856 <indexterm role="concept">
30857 <primary>load average</primary>
30858 </indexterm>
30859 If the system load average ever gets higher than this, incoming SMTP calls are
30860 accepted only from those hosts that match an entry in <option>smtp_reserve_hosts</option>.
30861 If <option>smtp_reserve_hosts</option> is not set, no incoming SMTP calls are accepted when
30862 the load is over the limit. The option has no effect on ancient operating
30863 systems on which Exim cannot determine the load average. See also
30864 <option>deliver_queue_load_max</option> and <option>queue_only_load</option>.
30865 </para>
30866 <para>
30867 <indexterm role="option">
30868 <primary><option>smtp_max_synprot_errors</option></primary>
30869 </indexterm>
30870 </para>
30871 <informaltable frame="all">
30872 <tgroup cols="4" colsep="0" rowsep="0">
30873 <colspec colwidth="8*" align="left"/>
30874 <colspec colwidth="6*" align="center"/>
30875 <colspec colwidth="6*" align="center"/>
30876 <colspec colwidth="6*" align="right"/>
30877 <tbody>
30878 <row>
30879 <entry><option>smtp_max_synprot_errors</option></entry>
30880 <entry>Use: <emphasis>main</emphasis></entry>
30881 <entry>Type: <emphasis>integer</emphasis></entry>
30882 <entry>Default: <emphasis>3</emphasis></entry>
30883 </row>
30884 </tbody>
30885 </tgroup>
30886 </informaltable>
30887 <para>
30888 <indexterm role="concept">
30889 <primary>SMTP</primary>
30890 <secondary>limiting syntax and protocol errors</secondary>
30891 </indexterm>
30892 <indexterm role="concept">
30893 <primary>limit</primary>
30894 <secondary>SMTP syntax and protocol errors</secondary>
30895 </indexterm>
30896 Exim rejects SMTP commands that contain syntax or protocol errors. In
30897 particular, a syntactically invalid email address, as in this command:
30898 </para>
30899 <literallayout class="monospaced">
30900 RCPT TO:&lt;abc xyz@a.b.c&gt;
30901 </literallayout>
30902 <para>
30903 causes immediate rejection of the command, before any other tests are done.
30904 (The ACL cannot be run if there is no valid address to set up for it.) An
30905 example of a protocol error is receiving RCPT before MAIL. If there are
30906 too many syntax or protocol errors in one SMTP session, the connection is
30907 dropped. The limit is set by this option.
30908 </para>
30909 <para>
30910 <indexterm role="concept">
30911 <primary>PIPELINING</primary>
30912 <secondary>expected errors</secondary>
30913 </indexterm>
30914 When the PIPELINING extension to SMTP is in use, some protocol errors are
30915 <quote>expected</quote>, for instance, a RCPT command after a rejected MAIL command.
30916 Exim assumes that PIPELINING will be used if it advertises it (see
30917 <option>pipelining_advertise_hosts</option>), and in this situation, <quote>expected</quote> errors do
30918 not count towards the limit.
30919 </para>
30920 <para>
30921 <indexterm role="option">
30922 <primary><option>smtp_max_unknown_commands</option></primary>
30923 </indexterm>
30924 </para>
30925 <informaltable frame="all">
30926 <tgroup cols="4" colsep="0" rowsep="0">
30927 <colspec colwidth="8*" align="left"/>
30928 <colspec colwidth="6*" align="center"/>
30929 <colspec colwidth="6*" align="center"/>
30930 <colspec colwidth="6*" align="right"/>
30931 <tbody>
30932 <row>
30933 <entry><option>smtp_max_unknown_commands</option></entry>
30934 <entry>Use: <emphasis>main</emphasis></entry>
30935 <entry>Type: <emphasis>integer</emphasis></entry>
30936 <entry>Default: <emphasis>3</emphasis></entry>
30937 </row>
30938 </tbody>
30939 </tgroup>
30940 </informaltable>
30941 <para>
30942 <indexterm role="concept">
30943 <primary>SMTP</primary>
30944 <secondary>limiting unknown commands</secondary>
30945 </indexterm>
30946 <indexterm role="concept">
30947 <primary>limit</primary>
30948 <secondary>unknown SMTP commands</secondary>
30949 </indexterm>
30950 If there are too many unrecognized commands in an incoming SMTP session, an
30951 Exim server drops the connection. This is a defence against some kinds of abuse
30952 that subvert web
30953 clients
30954 into making connections to SMTP ports; in these circumstances, a number of
30955 non-SMTP command lines are sent first.
30956 </para>
30957 <para>
30958 <indexterm role="option">
30959 <primary><option>smtp_ratelimit_hosts</option></primary>
30960 </indexterm>
30961 </para>
30962 <informaltable frame="all">
30963 <tgroup cols="4" colsep="0" rowsep="0">
30964 <colspec colwidth="8*" align="left"/>
30965 <colspec colwidth="6*" align="center"/>
30966 <colspec colwidth="6*" align="center"/>
30967 <colspec colwidth="6*" align="right"/>
30968 <tbody>
30969 <row>
30970 <entry><option>smtp_ratelimit_hosts</option></entry>
30971 <entry>Use: <emphasis>main</emphasis></entry>
30972 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
30973 <entry>Default: <emphasis>unset</emphasis></entry>
30974 </row>
30975 </tbody>
30976 </tgroup>
30977 </informaltable>
30978 <para>
30979 <indexterm role="concept">
30980 <primary>SMTP</primary>
30981 <secondary>rate limiting</secondary>
30982 </indexterm>
30983 <indexterm role="concept">
30984 <primary>limit</primary>
30985 <secondary>rate of message arrival</secondary>
30986 </indexterm>
30987 <indexterm role="concept">
30988 <primary>RCPT</primary>
30989 <secondary>rate limiting</secondary>
30990 </indexterm>
30991 Some sites find it helpful to be able to limit the rate at which certain hosts
30992 can send them messages, and the rate at which an individual message can specify
30993 recipients.
30994 </para>
30995 <para>
30996 Exim has two rate-limiting facilities. This section describes the older
30997 facility, which can limit rates within a single connection. The newer
30998 <option>ratelimit</option> ACL condition can limit rates across all connections. See section
30999 <xref linkend="SECTratelimiting"/> for details of the newer facility.
31000 </para>
31001 <para>
31002 When a host matches <option>smtp_ratelimit_hosts</option>, the values of
31003 <option>smtp_ratelimit_mail</option> and <option>smtp_ratelimit_rcpt</option> are used to control the
31004 rate of acceptance of MAIL and RCPT commands in a single SMTP session,
31005 respectively. Each option, if set, must contain a set of four comma-separated
31006 values:
31007 </para>
31008 <itemizedlist>
31009 <listitem>
31010 <para>
31011 A threshold, before which there is no rate limiting.
31012 </para>
31013 </listitem>
31014 <listitem>
31015 <para>
31016 An initial time delay. Unlike other times in Exim, numbers with decimal
31017 fractional parts are allowed here.
31018 </para>
31019 </listitem>
31020 <listitem>
31021 <para>
31022 A factor by which to increase the delay each time.
31023 </para>
31024 </listitem>
31025 <listitem>
31026 <para>
31027 A maximum value for the delay. This should normally be less than 5 minutes,
31028 because after that time, the client is liable to timeout the SMTP command.
31029 </para>
31030 </listitem>
31031 </itemizedlist>
31032 <para>
31033 For example, these settings have been used successfully at the site which
31034 first suggested this feature, for controlling mail from their customers:
31035 </para>
31036 <literallayout class="monospaced">
31037 smtp_ratelimit_mail = 2,0.5s,1.05,4m
31038 smtp_ratelimit_rcpt = 4,0.25s,1.015,4m
31039 </literallayout>
31040 <para>
31041 The first setting specifies delays that are applied to MAIL commands after
31042 two have been received over a single connection. The initial delay is 0.5
31043 seconds, increasing by a factor of 1.05 each time. The second setting applies
31044 delays to RCPT commands when more than four occur in a single message.
31045 </para>
31046 <para>
31047 <indexterm role="option">
31048 <primary><option>smtp_ratelimit_mail</option></primary>
31049 </indexterm>
31050 </para>
31051 <informaltable frame="all">
31052 <tgroup cols="4" colsep="0" rowsep="0">
31053 <colspec colwidth="8*" align="left"/>
31054 <colspec colwidth="6*" align="center"/>
31055 <colspec colwidth="6*" align="center"/>
31056 <colspec colwidth="6*" align="right"/>
31057 <tbody>
31058 <row>
31059 <entry><option>smtp_ratelimit_mail</option></entry>
31060 <entry>Use: <emphasis>main</emphasis></entry>
31061 <entry>Type: <emphasis>string</emphasis></entry>
31062 <entry>Default: <emphasis>unset</emphasis></entry>
31063 </row>
31064 </tbody>
31065 </tgroup>
31066 </informaltable>
31067 <para>
31068 See <option>smtp_ratelimit_hosts</option> above.
31069 </para>
31070 <para>
31071 <indexterm role="option">
31072 <primary><option>smtp_ratelimit_rcpt</option></primary>
31073 </indexterm>
31074 </para>
31075 <informaltable frame="all">
31076 <tgroup cols="4" colsep="0" rowsep="0">
31077 <colspec colwidth="8*" align="left"/>
31078 <colspec colwidth="6*" align="center"/>
31079 <colspec colwidth="6*" align="center"/>
31080 <colspec colwidth="6*" align="right"/>
31081 <tbody>
31082 <row>
31083 <entry><option>smtp_ratelimit_rcpt</option></entry>
31084 <entry>Use: <emphasis>main</emphasis></entry>
31085 <entry>Type: <emphasis>string</emphasis></entry>
31086 <entry>Default: <emphasis>unset</emphasis></entry>
31087 </row>
31088 </tbody>
31089 </tgroup>
31090 </informaltable>
31091 <para>
31092 See <option>smtp_ratelimit_hosts</option> above.
31093 </para>
31094 <para>
31095 <indexterm role="option">
31096 <primary><option>smtp_receive_timeout</option></primary>
31097 </indexterm>
31098 </para>
31099 <informaltable frame="all">
31100 <tgroup cols="4" colsep="0" rowsep="0">
31101 <colspec colwidth="8*" align="left"/>
31102 <colspec colwidth="6*" align="center"/>
31103 <colspec colwidth="6*" align="center"/>
31104 <colspec colwidth="6*" align="right"/>
31105 <tbody>
31106 <row>
31107 <entry><option>smtp_receive_timeout</option></entry>
31108 <entry>Use: <emphasis>main</emphasis></entry>
31109 <entry>Type: <emphasis>time</emphasis>&dagger;<emphasis></emphasis></entry>
31110 <entry>Default: <emphasis>5m</emphasis></entry>
31111 </row>
31112 </tbody>
31113 </tgroup>
31114 </informaltable>
31115 <para>
31116 <indexterm role="concept">
31117 <primary>timeout</primary>
31118 <secondary>for SMTP input</secondary>
31119 </indexterm>
31120 <indexterm role="concept">
31121 <primary>SMTP</primary>
31122 <secondary>input timeout</secondary>
31123 </indexterm>
31124 This sets a timeout value for SMTP reception. It applies to all forms of SMTP
31125 input, including batch SMTP. If a line of input (either an SMTP command or a
31126 data line) is not received within this time, the SMTP connection is dropped and
31127 the message is abandoned.
31128 A line is written to the log containing one of the following messages:
31129 </para>
31130 <literallayout class="monospaced">
31131 SMTP command timeout on connection from...
31132 SMTP data timeout on connection from...
31133 </literallayout>
31134 <para>
31135 The former means that Exim was expecting to read an SMTP command; the latter
31136 means that it was in the DATA phase, reading the contents of a message.
31137 </para>
31138 <para>
31139 If the first character of the option is a <quote>$</quote> the option is
31140 expanded before use and may depend on
31141 <varname>$sender_host_name</varname>, <varname>$sender_host_address</varname> and <varname>$sender_host_port</varname>.
31142 </para>
31143 <para>
31144 <indexterm role="option">
31145 <primary><option>-os</option></primary>
31146 </indexterm>
31147 The value set by this option can be overridden by the
31148 <option>-os</option> command-line option. A setting of zero time disables the timeout, but
31149 this should never be used for SMTP over TCP/IP. (It can be useful in some cases
31150 of local input using <option>-bs</option> or <option>-bS</option>.) For non-SMTP input, the reception
31151 timeout is controlled by <option>receive_timeout</option> and <option>-or</option>.
31152 </para>
31153 <para>
31154 <indexterm role="option">
31155 <primary><option>smtp_reserve_hosts</option></primary>
31156 </indexterm>
31157 </para>
31158 <informaltable frame="all">
31159 <tgroup cols="4" colsep="0" rowsep="0">
31160 <colspec colwidth="8*" align="left"/>
31161 <colspec colwidth="6*" align="center"/>
31162 <colspec colwidth="6*" align="center"/>
31163 <colspec colwidth="6*" align="right"/>
31164 <tbody>
31165 <row>
31166 <entry><option>smtp_reserve_hosts</option></entry>
31167 <entry>Use: <emphasis>main</emphasis></entry>
31168 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
31169 <entry>Default: <emphasis>unset</emphasis></entry>
31170 </row>
31171 </tbody>
31172 </tgroup>
31173 </informaltable>
31174 <para>
31175 This option defines hosts for which SMTP connections are reserved; see
31176 <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option> above.
31177 </para>
31178 <para>
31179 <indexterm role="option">
31180 <primary><option>smtp_return_error_details</option></primary>
31181 </indexterm>
31182 </para>
31183 <informaltable frame="all">
31184 <tgroup cols="4" colsep="0" rowsep="0">
31185 <colspec colwidth="8*" align="left"/>
31186 <colspec colwidth="6*" align="center"/>
31187 <colspec colwidth="6*" align="center"/>
31188 <colspec colwidth="6*" align="right"/>
31189 <tbody>
31190 <row>
31191 <entry><option>smtp_return_error_details</option></entry>
31192 <entry>Use: <emphasis>main</emphasis></entry>
31193 <entry>Type: <emphasis>boolean</emphasis></entry>
31194 <entry>Default: <emphasis>false</emphasis></entry>
31195 </row>
31196 </tbody>
31197 </tgroup>
31198 </informaltable>
31199 <para>
31200 <indexterm role="concept">
31201 <primary>SMTP</primary>
31202 <secondary>details policy failures</secondary>
31203 </indexterm>
31204 <indexterm role="concept">
31205 <primary>policy control</primary>
31206 <secondary>rejection, returning details</secondary>
31207 </indexterm>
31208 In the default state, Exim uses bland messages such as
31209 <quote>Administrative prohibition</quote> when it rejects SMTP commands for policy
31210 reasons. Many sysadmins like this because it gives away little information
31211 to spammers. However, some other sysadmins who are applying strict checking
31212 policies want to give out much fuller information about failures. Setting
31213 <option>smtp_return_error_details</option> true causes Exim to be more forthcoming. For
31214 example, instead of <quote>Administrative prohibition</quote>, it might give:
31215 </para>
31216 <literallayout class="monospaced">
31217 550-Rejected after DATA: '&gt;' missing at end of address:
31218 550 failing address in "From" header is: &lt;user@dom.ain
31219 </literallayout>
31220 <para>
31221 <indexterm role="option">
31222 <primary><option>smtputf8_advertise_hosts</option></primary>
31223 </indexterm>
31224 </para>
31225 <informaltable frame="all">
31226 <tgroup cols="4" colsep="0" rowsep="0">
31227 <colspec colwidth="8*" align="left"/>
31228 <colspec colwidth="6*" align="center"/>
31229 <colspec colwidth="6*" align="center"/>
31230 <colspec colwidth="6*" align="right"/>
31231 <tbody>
31232 <row>
31233 <entry><option>smtputf8_advertise_hosts</option></entry>
31234 <entry>Use: <emphasis>main</emphasis></entry>
31235 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
31236 <entry>Default: <emphasis>*</emphasis></entry>
31237 </row>
31238 </tbody>
31239 </tgroup>
31240 </informaltable>
31241 <para>
31242 <indexterm role="concept">
31243 <primary>SMTPUTF8</primary>
31244 <secondary>advertising</secondary>
31245 </indexterm>
31246 When Exim is built with support for internationalised mail names,
31247 the availability thereof is advertised in
31248 response to EHLO only to those client hosts that match this option. See
31249 chapter <xref linkend="CHAPi18n"/> for details of Exim&#x2019;s support for internationalisation.
31250 </para>
31251 <para>
31252 <indexterm role="option">
31253 <primary><option>spamd_address</option></primary>
31254 </indexterm>
31255 </para>
31256 <informaltable frame="all">
31257 <tgroup cols="4" colsep="0" rowsep="0">
31258 <colspec colwidth="8*" align="left"/>
31259 <colspec colwidth="6*" align="center"/>
31260 <colspec colwidth="6*" align="center"/>
31261 <colspec colwidth="6*" align="right"/>
31262 <tbody>
31263 <row>
31264 <entry><option>spamd_address</option></entry>
31265 <entry>Use: <emphasis>main</emphasis></entry>
31266 <entry>Type: <emphasis>string</emphasis></entry>
31267 <entry>Default: <emphasis>127.0.0.1 783</emphasis></entry>
31268 </row>
31269 </tbody>
31270 </tgroup>
31271 </informaltable>
31272 <para>
31273 This option is available when Exim is compiled with the content-scanning
31274 extension. It specifies how Exim connects to SpamAssassin&#x2019;s <option>spamd</option> daemon.
31275 See section <xref linkend="SECTscanspamass"/> for more details.
31276 </para>
31277 <para>
31278 <indexterm role="option">
31279 <primary><option>spf_guess</option></primary>
31280 </indexterm>
31281 </para>
31282 <informaltable frame="all">
31283 <tgroup cols="4" colsep="0" rowsep="0">
31284 <colspec colwidth="8*" align="left"/>
31285 <colspec colwidth="6*" align="center"/>
31286 <colspec colwidth="6*" align="center"/>
31287 <colspec colwidth="6*" align="right"/>
31288 <tbody>
31289 <row>
31290 <entry><option>spf_guess</option></entry>
31291 <entry>Use: <emphasis>main</emphasis></entry>
31292 <entry>Type: <emphasis>string</emphasis></entry>
31293 <entry>Default: <emphasis>v=spf1 a/24 mx/24 ptr ?all</emphasis></entry>
31294 </row>
31295 </tbody>
31296 </tgroup>
31297 </informaltable>
31298 <para>
31299 This option is available when Exim is compiled with SPF support.
31300 See section <xref linkend="SECSPF"/> for more details.
31301 </para>
31302 <para>
31303 <indexterm role="option">
31304 <primary><option>split_spool_directory</option></primary>
31305 </indexterm>
31306 </para>
31307 <informaltable frame="all">
31308 <tgroup cols="4" colsep="0" rowsep="0">
31309 <colspec colwidth="8*" align="left"/>
31310 <colspec colwidth="6*" align="center"/>
31311 <colspec colwidth="6*" align="center"/>
31312 <colspec colwidth="6*" align="right"/>
31313 <tbody>
31314 <row>
31315 <entry><option>split_spool_directory</option></entry>
31316 <entry>Use: <emphasis>main</emphasis></entry>
31317 <entry>Type: <emphasis>boolean</emphasis></entry>
31318 <entry>Default: <emphasis>false</emphasis></entry>
31319 </row>
31320 </tbody>
31321 </tgroup>
31322 </informaltable>
31323 <para>
31324 <indexterm role="concept">
31325 <primary>multiple spool directories</primary>
31326 </indexterm>
31327 <indexterm role="concept">
31328 <primary>spool directory</primary>
31329 <secondary>split</secondary>
31330 </indexterm>
31331 <indexterm role="concept">
31332 <primary>directories, multiple</primary>
31333 </indexterm>
31334 If this option is set, it causes Exim to split its input directory into 62
31335 subdirectories, each with a single alphanumeric character as its name. The
31336 sixth character of the message id is used to allocate messages to
31337 subdirectories; this is the least significant base-62 digit of the time of
31338 arrival of the message.
31339 </para>
31340 <para>
31341 Splitting up the spool in this way may provide better performance on systems
31342 where there are long mail queues, by reducing the number of files in any one
31343 directory. The msglog directory is also split up in a similar way to the input
31344 directory; however, if <option>preserve_message_logs</option> is set, all old msglog files
31345 are still placed in the single directory <filename>msglog.OLD</filename>.
31346 </para>
31347 <para>
31348 It is not necessary to take any special action for existing messages when
31349 changing <option>split_spool_directory</option>. Exim notices messages that are in the
31350 <quote>wrong</quote> place, and continues to process them. If the option is turned off
31351 after a period of being on, the subdirectories will eventually empty and be
31352 automatically deleted.
31353 </para>
31354 <para>
31355 When <option>split_spool_directory</option> is set, the behaviour of queue runner processes
31356 changes. Instead of creating a list of all messages in the queue, and then
31357 trying to deliver each one, in turn, it constructs a list of those in one
31358 sub-directory and tries to deliver them, before moving on to the next
31359 sub-directory. The sub-directories are processed in a random order. This
31360 spreads out the scanning of the input directories, and uses less memory. It is
31361 particularly beneficial when there are lots of messages in the queue. However,
31362 if <option>queue_run_in_order</option> is set, none of this new processing happens. The
31363 entire queue has to be scanned and sorted before any deliveries can start.
31364 </para>
31365 <para>
31366 <indexterm role="option">
31367 <primary><option>spool_directory</option></primary>
31368 </indexterm>
31369 </para>
31370 <informaltable frame="all">
31371 <tgroup cols="4" colsep="0" rowsep="0">
31372 <colspec colwidth="8*" align="left"/>
31373 <colspec colwidth="6*" align="center"/>
31374 <colspec colwidth="6*" align="center"/>
31375 <colspec colwidth="6*" align="right"/>
31376 <tbody>
31377 <row>
31378 <entry><option>spool_directory</option></entry>
31379 <entry>Use: <emphasis>main</emphasis></entry>
31380 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31381 <entry>Default: <emphasis>set at compile time</emphasis></entry>
31382 </row>
31383 </tbody>
31384 </tgroup>
31385 </informaltable>
31386 <para>
31387 <indexterm role="concept">
31388 <primary>spool directory</primary>
31389 <secondary>path to</secondary>
31390 </indexterm>
31391 This defines the directory in which Exim keeps its spool, that is, the messages
31392 it is waiting to deliver. The default value is taken from the compile-time
31393 configuration setting, if there is one. If not, this option must be set. The
31394 string is expanded, so it can contain, for example, a reference to
31395 <varname>$primary_hostname</varname>.
31396 </para>
31397 <para>
31398 If the spool directory name is fixed on your installation, it is recommended
31399 that you set it at build time rather than from this option, particularly if the
31400 log files are being written to the spool directory (see <option>log_file_path</option>).
31401 Otherwise log files cannot be used for errors that are detected early on, such
31402 as failures in the configuration file.
31403 </para>
31404 <para>
31405 By using this option to override the compiled-in path, it is possible to run
31406 tests of Exim without using the standard spool.
31407 </para>
31408 <para>
31409 <indexterm role="option">
31410 <primary><option>spool_wireformat</option></primary>
31411 </indexterm>
31412 </para>
31413 <informaltable frame="all">
31414 <tgroup cols="4" colsep="0" rowsep="0">
31415 <colspec colwidth="8*" align="left"/>
31416 <colspec colwidth="6*" align="center"/>
31417 <colspec colwidth="6*" align="center"/>
31418 <colspec colwidth="6*" align="right"/>
31419 <tbody>
31420 <row>
31421 <entry><option>spool_wireformat</option></entry>
31422 <entry>Use: <emphasis>main</emphasis></entry>
31423 <entry>Type: <emphasis>boolean</emphasis></entry>
31424 <entry>Default: <emphasis>false</emphasis></entry>
31425 </row>
31426 </tbody>
31427 </tgroup>
31428 </informaltable>
31429 <para>
31430 <indexterm role="concept">
31431 <primary>spool directory</primary>
31432 <secondary>file formats</secondary>
31433 </indexterm>
31434 If this option is set, Exim may for some messages use an alternative format
31435 for data-files in the spool which matches the wire format.
31436 Doing this permits more efficient message reception and transmission.
31437 Currently it is only done for messages received using the ESMTP CHUNKING
31438 option.
31439 </para>
31440 <para>
31441 The following variables will not have useful values:
31442 </para>
31443 <literallayout class="monospaced">
31444 $max_received_linelength
31445 $body_linecount
31446 $body_zerocount
31447 </literallayout>
31448 <para>
31449 Users of the local_scan() API (see <xref linkend="CHAPlocalscan"/>),
31450 and any external programs which are passed a reference to a message data file
31451 (except via the <quote>regex</quote>, <quote>malware</quote> or <quote>spam</quote>) ACL conditions)
31452 will need to be aware of the different formats potentially available.
31453 </para>
31454 <para>
31455 Using any of the ACL conditions noted will negate the reception benefit
31456 (as a Unix-mbox-format file is constructed for them).
31457 The transmission benefit is maintained.
31458 </para>
31459 <para>
31460 <indexterm role="option">
31461 <primary><option>sqlite_lock_timeout</option></primary>
31462 </indexterm>
31463 </para>
31464 <informaltable frame="all">
31465 <tgroup cols="4" colsep="0" rowsep="0">
31466 <colspec colwidth="8*" align="left"/>
31467 <colspec colwidth="6*" align="center"/>
31468 <colspec colwidth="6*" align="center"/>
31469 <colspec colwidth="6*" align="right"/>
31470 <tbody>
31471 <row>
31472 <entry><option>sqlite_lock_timeout</option></entry>
31473 <entry>Use: <emphasis>main</emphasis></entry>
31474 <entry>Type: <emphasis>time</emphasis></entry>
31475 <entry>Default: <emphasis>5s</emphasis></entry>
31476 </row>
31477 </tbody>
31478 </tgroup>
31479 </informaltable>
31480 <para>
31481 <indexterm role="concept">
31482 <primary>sqlite lookup type</primary>
31483 <secondary>lock timeout</secondary>
31484 </indexterm>
31485 This option controls the timeout that the <command>sqlite</command> lookup uses when trying to
31486 access an SQLite database. See section <xref linkend="SECTsqlite"/> for more details.
31487 </para>
31488 <para>
31489 <indexterm role="option">
31490 <primary><option>strict_acl_vars</option></primary>
31491 </indexterm>
31492 </para>
31493 <informaltable frame="all">
31494 <tgroup cols="4" colsep="0" rowsep="0">
31495 <colspec colwidth="8*" align="left"/>
31496 <colspec colwidth="6*" align="center"/>
31497 <colspec colwidth="6*" align="center"/>
31498 <colspec colwidth="6*" align="right"/>
31499 <tbody>
31500 <row>
31501 <entry><option>strict_acl_vars</option></entry>
31502 <entry>Use: <emphasis>main</emphasis></entry>
31503 <entry>Type: <emphasis>boolean</emphasis></entry>
31504 <entry>Default: <emphasis>false</emphasis></entry>
31505 </row>
31506 </tbody>
31507 </tgroup>
31508 </informaltable>
31509 <para>
31510 <indexterm role="concept">
31511 <primary>access control lists (ACLs)</primary>
31512 <secondary>variables, handling unset</secondary>
31513 </indexterm>
31514 This option controls what happens if a syntactically valid but undefined ACL
31515 variable is referenced. If it is false (the default), an empty string
31516 is substituted; if it is true, an error is generated. See section
31517 <xref linkend="SECTaclvariables"/> for details of ACL variables.
31518 </para>
31519 <para>
31520 <indexterm role="option">
31521 <primary><option>strip_excess_angle_brackets</option></primary>
31522 </indexterm>
31523 </para>
31524 <informaltable frame="all">
31525 <tgroup cols="4" colsep="0" rowsep="0">
31526 <colspec colwidth="8*" align="left"/>
31527 <colspec colwidth="6*" align="center"/>
31528 <colspec colwidth="6*" align="center"/>
31529 <colspec colwidth="6*" align="right"/>
31530 <tbody>
31531 <row>
31532 <entry><option>strip_excess_angle_brackets</option></entry>
31533 <entry>Use: <emphasis>main</emphasis></entry>
31534 <entry>Type: <emphasis>boolean</emphasis></entry>
31535 <entry>Default: <emphasis>false</emphasis></entry>
31536 </row>
31537 </tbody>
31538 </tgroup>
31539 </informaltable>
31540 <para>
31541 <indexterm role="concept">
31542 <primary>angle brackets, excess</primary>
31543 </indexterm>
31544 If this option is set, redundant pairs of angle brackets round <quote>route-addr</quote>
31545 items in addresses are stripped. For example, <emphasis>&lt;&lt;xxx@a.b.c.d&gt;&gt;</emphasis> is
31546 treated as <emphasis>&lt;xxx@a.b.c.d&gt;</emphasis>. If this is in the envelope and the message is
31547 passed on to another MTA, the excess angle brackets are not passed on. If this
31548 option is not set, multiple pairs of angle brackets cause a syntax error.
31549 </para>
31550 <para>
31551 <indexterm role="option">
31552 <primary><option>strip_trailing_dot</option></primary>
31553 </indexterm>
31554 </para>
31555 <informaltable frame="all">
31556 <tgroup cols="4" colsep="0" rowsep="0">
31557 <colspec colwidth="8*" align="left"/>
31558 <colspec colwidth="6*" align="center"/>
31559 <colspec colwidth="6*" align="center"/>
31560 <colspec colwidth="6*" align="right"/>
31561 <tbody>
31562 <row>
31563 <entry><option>strip_trailing_dot</option></entry>
31564 <entry>Use: <emphasis>main</emphasis></entry>
31565 <entry>Type: <emphasis>boolean</emphasis></entry>
31566 <entry>Default: <emphasis>false</emphasis></entry>
31567 </row>
31568 </tbody>
31569 </tgroup>
31570 </informaltable>
31571 <para>
31572 <indexterm role="concept">
31573 <primary>trailing dot on domain</primary>
31574 </indexterm>
31575 <indexterm role="concept">
31576 <primary>dot</primary>
31577 <secondary>trailing on domain</secondary>
31578 </indexterm>
31579 If this option is set, a trailing dot at the end of a domain in an address is
31580 ignored. If this is in the envelope and the message is passed on to another
31581 MTA, the dot is not passed on. If this option is not set, a dot at the end of a
31582 domain causes a syntax error.
31583 However, addresses in header lines are checked only when an ACL requests header
31584 syntax checking.
31585 </para>
31586 <para>
31587 <indexterm role="option">
31588 <primary><option>syslog_duplication</option></primary>
31589 </indexterm>
31590 </para>
31591 <informaltable frame="all">
31592 <tgroup cols="4" colsep="0" rowsep="0">
31593 <colspec colwidth="8*" align="left"/>
31594 <colspec colwidth="6*" align="center"/>
31595 <colspec colwidth="6*" align="center"/>
31596 <colspec colwidth="6*" align="right"/>
31597 <tbody>
31598 <row>
31599 <entry><option>syslog_duplication</option></entry>
31600 <entry>Use: <emphasis>main</emphasis></entry>
31601 <entry>Type: <emphasis>boolean</emphasis></entry>
31602 <entry>Default: <emphasis>true</emphasis></entry>
31603 </row>
31604 </tbody>
31605 </tgroup>
31606 </informaltable>
31607 <para>
31608 <indexterm role="concept">
31609 <primary>syslog</primary>
31610 <secondary>duplicate log lines; suppressing</secondary>
31611 </indexterm>
31612 When Exim is logging to syslog, it writes the log lines for its three
31613 separate logs at different syslog priorities so that they can in principle
31614 be separated on the logging hosts. Some installations do not require this
31615 separation, and in those cases, the duplication of certain log lines is a
31616 nuisance. If <option>syslog_duplication</option> is set false, only one copy of any
31617 particular log line is written to syslog. For lines that normally go to
31618 both the main log and the reject log, the reject log version (possibly
31619 containing message header lines) is written, at LOG_NOTICE priority.
31620 Lines that normally go to both the main and the panic log are written at
31621 the LOG_ALERT priority.
31622 </para>
31623 <para>
31624 <indexterm role="option">
31625 <primary><option>syslog_facility</option></primary>
31626 </indexterm>
31627 </para>
31628 <informaltable frame="all">
31629 <tgroup cols="4" colsep="0" rowsep="0">
31630 <colspec colwidth="8*" align="left"/>
31631 <colspec colwidth="6*" align="center"/>
31632 <colspec colwidth="6*" align="center"/>
31633 <colspec colwidth="6*" align="right"/>
31634 <tbody>
31635 <row>
31636 <entry><option>syslog_facility</option></entry>
31637 <entry>Use: <emphasis>main</emphasis></entry>
31638 <entry>Type: <emphasis>string</emphasis></entry>
31639 <entry>Default: <emphasis>unset</emphasis></entry>
31640 </row>
31641 </tbody>
31642 </tgroup>
31643 </informaltable>
31644 <para>
31645 <indexterm role="concept">
31646 <primary>syslog</primary>
31647 <secondary>facility; setting</secondary>
31648 </indexterm>
31649 This option sets the syslog <quote>facility</quote> name, used when Exim is logging to
31650 syslog. The value must be one of the strings <quote>mail</quote>, <quote>user</quote>, <quote>news</quote>,
31651 <quote>uucp</quote>, <quote>daemon</quote>, or <quote>local<emphasis>x</emphasis></quote> where <emphasis>x</emphasis> is a digit between 0 and 7.
31652 If this option is unset, <quote>mail</quote> is used. See chapter <xref linkend="CHAPlog"/> for
31653 details of Exim&#x2019;s logging.
31654 </para>
31655 <para>
31656 <indexterm role="option">
31657 <primary><option>syslog_pid</option></primary>
31658 </indexterm>
31659 </para>
31660 <informaltable frame="all">
31661 <tgroup cols="4" colsep="0" rowsep="0">
31662 <colspec colwidth="8*" align="left"/>
31663 <colspec colwidth="6*" align="center"/>
31664 <colspec colwidth="6*" align="center"/>
31665 <colspec colwidth="6*" align="right"/>
31666 <tbody>
31667 <row>
31668 <entry><option>syslog_pid</option></entry>
31669 <entry>Use: <emphasis>main</emphasis></entry>
31670 <entry>Type: <emphasis>boolean</emphasis></entry>
31671 <entry>Default: <emphasis>true</emphasis></entry>
31672 </row>
31673 </tbody>
31674 </tgroup>
31675 </informaltable>
31676 <para>
31677 <indexterm role="concept">
31678 <primary>syslog</primary>
31679 <secondary>pid</secondary>
31680 </indexterm>
31681 If <option>syslog_pid</option> is set false, the PID on Exim&#x2019;s log lines are
31682 omitted when these lines are sent to syslog. (Syslog normally prefixes
31683 the log lines with the PID of the logging process automatically.) You need
31684 to enable the <literal>+pid</literal> log selector item, if you want Exim to write it&#x2019;s PID
31685 into the logs.) See chapter <xref linkend="CHAPlog"/> for details of Exim&#x2019;s logging.
31686 </para>
31687 <para>
31688 <indexterm role="option">
31689 <primary><option>syslog_processname</option></primary>
31690 </indexterm>
31691 </para>
31692 <informaltable frame="all">
31693 <tgroup cols="4" colsep="0" rowsep="0">
31694 <colspec colwidth="8*" align="left"/>
31695 <colspec colwidth="6*" align="center"/>
31696 <colspec colwidth="6*" align="center"/>
31697 <colspec colwidth="6*" align="right"/>
31698 <tbody>
31699 <row>
31700 <entry><option>syslog_processname</option></entry>
31701 <entry>Use: <emphasis>main</emphasis></entry>
31702 <entry>Type: <emphasis>string</emphasis></entry>
31703 <entry>Default: <emphasis><literal>exim</literal></emphasis></entry>
31704 </row>
31705 </tbody>
31706 </tgroup>
31707 </informaltable>
31708 <para>
31709 <indexterm role="concept">
31710 <primary>syslog</primary>
31711 <secondary>process name; setting</secondary>
31712 </indexterm>
31713 This option sets the syslog <quote>ident</quote> name, used when Exim is logging to
31714 syslog. The value must be no longer than 32 characters. See chapter
31715 <xref linkend="CHAPlog"/> for details of Exim&#x2019;s logging.
31716 </para>
31717 <para>
31718 <indexterm role="option">
31719 <primary><option>syslog_timestamp</option></primary>
31720 </indexterm>
31721 </para>
31722 <informaltable frame="all">
31723 <tgroup cols="4" colsep="0" rowsep="0">
31724 <colspec colwidth="8*" align="left"/>
31725 <colspec colwidth="6*" align="center"/>
31726 <colspec colwidth="6*" align="center"/>
31727 <colspec colwidth="6*" align="right"/>
31728 <tbody>
31729 <row>
31730 <entry><option>syslog_timestamp</option></entry>
31731 <entry>Use: <emphasis>main</emphasis></entry>
31732 <entry>Type: <emphasis>boolean</emphasis></entry>
31733 <entry>Default: <emphasis>true</emphasis></entry>
31734 </row>
31735 </tbody>
31736 </tgroup>
31737 </informaltable>
31738 <para>
31739 <indexterm role="concept">
31740 <primary>syslog</primary>
31741 <secondary>timestamps</secondary>
31742 </indexterm>
31743 If <option>syslog_timestamp</option> is set false, the timestamps on Exim&#x2019;s log lines are
31744 omitted when these lines are sent to syslog. See chapter <xref linkend="CHAPlog"/> for
31745 details of Exim&#x2019;s logging.
31746 </para>
31747 <para>
31748 <indexterm role="option">
31749 <primary><option>system_filter</option></primary>
31750 </indexterm>
31751 </para>
31752 <informaltable frame="all">
31753 <tgroup cols="4" colsep="0" rowsep="0">
31754 <colspec colwidth="8*" align="left"/>
31755 <colspec colwidth="6*" align="center"/>
31756 <colspec colwidth="6*" align="center"/>
31757 <colspec colwidth="6*" align="right"/>
31758 <tbody>
31759 <row>
31760 <entry><option>system_filter</option></entry>
31761 <entry>Use: <emphasis>main</emphasis></entry>
31762 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31763 <entry>Default: <emphasis>unset</emphasis></entry>
31764 </row>
31765 </tbody>
31766 </tgroup>
31767 </informaltable>
31768 <para>
31769 <indexterm role="concept">
31770 <primary>filter</primary>
31771 <secondary>system filter</secondary>
31772 </indexterm>
31773 <indexterm role="concept">
31774 <primary>system filter</primary>
31775 <secondary>specifying</secondary>
31776 </indexterm>
31777 <indexterm role="concept">
31778 <primary>Sieve filter</primary>
31779 <secondary>not available for system filter</secondary>
31780 </indexterm>
31781 This option specifies an Exim filter file that is applied to all messages at
31782 the start of each delivery attempt, before any routing is done. System filters
31783 must be Exim filters; they cannot be Sieve filters. If the system filter
31784 generates any deliveries to files or pipes, or any new mail messages, the
31785 appropriate <option>system_filter_..._transport</option> option(s) must be set, to define
31786 which transports are to be used. Details of this facility are given in chapter
31787 <xref linkend="CHAPsystemfilter"/>.
31788 A forced expansion failure results in no filter operation.
31789 </para>
31790 <para>
31791 <indexterm role="option">
31792 <primary><option>system_filter_directory_transport</option></primary>
31793 </indexterm>
31794 </para>
31795 <informaltable frame="all">
31796 <tgroup cols="4" colsep="0" rowsep="0">
31797 <colspec colwidth="8*" align="left"/>
31798 <colspec colwidth="6*" align="center"/>
31799 <colspec colwidth="6*" align="center"/>
31800 <colspec colwidth="6*" align="right"/>
31801 <tbody>
31802 <row>
31803 <entry><option>system_filter_directory_transport</option></entry>
31804 <entry>Use: <emphasis>main</emphasis></entry>
31805 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31806 <entry>Default: <emphasis>unset</emphasis></entry>
31807 </row>
31808 </tbody>
31809 </tgroup>
31810 </informaltable>
31811 <para>
31812 <indexterm role="variable">
31813 <primary><varname>$address_file</varname></primary>
31814 </indexterm>
31815 This sets the name of the transport driver that is to be used when the
31816 <option>save</option> command in a system message filter specifies a path ending in <quote>/</quote>,
31817 implying delivery of each message into a separate file in some directory.
31818 During the delivery, the variable <varname>$address_file</varname> contains the path name.
31819 </para>
31820 <para>
31821 <indexterm role="option">
31822 <primary><option>system_filter_file_transport</option></primary>
31823 </indexterm>
31824 </para>
31825 <informaltable frame="all">
31826 <tgroup cols="4" colsep="0" rowsep="0">
31827 <colspec colwidth="8*" align="left"/>
31828 <colspec colwidth="6*" align="center"/>
31829 <colspec colwidth="6*" align="center"/>
31830 <colspec colwidth="6*" align="right"/>
31831 <tbody>
31832 <row>
31833 <entry><option>system_filter_file_transport</option></entry>
31834 <entry>Use: <emphasis>main</emphasis></entry>
31835 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31836 <entry>Default: <emphasis>unset</emphasis></entry>
31837 </row>
31838 </tbody>
31839 </tgroup>
31840 </informaltable>
31841 <para>
31842 <indexterm role="concept">
31843 <primary>file</primary>
31844 <secondary>transport for system filter</secondary>
31845 </indexterm>
31846 This sets the name of the transport driver that is to be used when the <option>save</option>
31847 command in a system message filter specifies a path not ending in <quote>/</quote>. During
31848 the delivery, the variable <varname>$address_file</varname> contains the path name.
31849 </para>
31850 <para>
31851 <indexterm role="option">
31852 <primary><option>system_filter_group</option></primary>
31853 </indexterm>
31854 </para>
31855 <informaltable frame="all">
31856 <tgroup cols="4" colsep="0" rowsep="0">
31857 <colspec colwidth="8*" align="left"/>
31858 <colspec colwidth="6*" align="center"/>
31859 <colspec colwidth="6*" align="center"/>
31860 <colspec colwidth="6*" align="right"/>
31861 <tbody>
31862 <row>
31863 <entry><option>system_filter_group</option></entry>
31864 <entry>Use: <emphasis>main</emphasis></entry>
31865 <entry>Type: <emphasis>string</emphasis></entry>
31866 <entry>Default: <emphasis>unset</emphasis></entry>
31867 </row>
31868 </tbody>
31869 </tgroup>
31870 </informaltable>
31871 <para>
31872 <indexterm role="concept">
31873 <primary>gid (group id)</primary>
31874 <secondary>system filter</secondary>
31875 </indexterm>
31876 This option is used only when <option>system_filter_user</option> is also set. It sets the
31877 gid under which the system filter is run, overriding any gid that is associated
31878 with the user. The value may be numerical or symbolic.
31879 </para>
31880 <para>
31881 <indexterm role="option">
31882 <primary><option>system_filter_pipe_transport</option></primary>
31883 </indexterm>
31884 </para>
31885 <informaltable frame="all">
31886 <tgroup cols="4" colsep="0" rowsep="0">
31887 <colspec colwidth="8*" align="left"/>
31888 <colspec colwidth="6*" align="center"/>
31889 <colspec colwidth="6*" align="center"/>
31890 <colspec colwidth="6*" align="right"/>
31891 <tbody>
31892 <row>
31893 <entry><option>system_filter_pipe_transport</option></entry>
31894 <entry>Use: <emphasis>main</emphasis></entry>
31895 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31896 <entry>Default: <emphasis>unset</emphasis></entry>
31897 </row>
31898 </tbody>
31899 </tgroup>
31900 </informaltable>
31901 <para>
31902 <indexterm role="concept">
31903 <primary><command>pipe</command> transport</primary>
31904 <secondary>for system filter</secondary>
31905 </indexterm>
31906 <indexterm role="variable">
31907 <primary><varname>$address_pipe</varname></primary>
31908 </indexterm>
31909 This specifies the transport driver that is to be used when a <option>pipe</option> command
31910 is used in a system filter. During the delivery, the variable <varname>$address_pipe</varname>
31911 contains the pipe command.
31912 </para>
31913 <para>
31914 <indexterm role="option">
31915 <primary><option>system_filter_reply_transport</option></primary>
31916 </indexterm>
31917 </para>
31918 <informaltable frame="all">
31919 <tgroup cols="4" colsep="0" rowsep="0">
31920 <colspec colwidth="8*" align="left"/>
31921 <colspec colwidth="6*" align="center"/>
31922 <colspec colwidth="6*" align="center"/>
31923 <colspec colwidth="6*" align="right"/>
31924 <tbody>
31925 <row>
31926 <entry><option>system_filter_reply_transport</option></entry>
31927 <entry>Use: <emphasis>main</emphasis></entry>
31928 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31929 <entry>Default: <emphasis>unset</emphasis></entry>
31930 </row>
31931 </tbody>
31932 </tgroup>
31933 </informaltable>
31934 <para>
31935 <indexterm role="concept">
31936 <primary><command>autoreply</command> transport</primary>
31937 <secondary>for system filter</secondary>
31938 </indexterm>
31939 This specifies the transport driver that is to be used when a <option>mail</option> command
31940 is used in a system filter.
31941 </para>
31942 <para>
31943 <indexterm role="option">
31944 <primary><option>system_filter_user</option></primary>
31945 </indexterm>
31946 </para>
31947 <informaltable frame="all">
31948 <tgroup cols="4" colsep="0" rowsep="0">
31949 <colspec colwidth="8*" align="left"/>
31950 <colspec colwidth="6*" align="center"/>
31951 <colspec colwidth="6*" align="center"/>
31952 <colspec colwidth="6*" align="right"/>
31953 <tbody>
31954 <row>
31955 <entry><option>system_filter_user</option></entry>
31956 <entry>Use: <emphasis>main</emphasis></entry>
31957 <entry>Type: <emphasis>string</emphasis></entry>
31958 <entry>Default: <emphasis>unset</emphasis></entry>
31959 </row>
31960 </tbody>
31961 </tgroup>
31962 </informaltable>
31963 <para>
31964 <indexterm role="concept">
31965 <primary>uid (user id)</primary>
31966 <secondary>system filter</secondary>
31967 </indexterm>
31968 If this option is set to root, the system filter is run in the main Exim
31969 delivery process, as root.  Otherwise, the system filter runs in a separate
31970 process, as the given user, defaulting to the Exim run-time user.
31971 Unless the string consists entirely of digits, it
31972 is looked up in the password data. Failure to find the named user causes a
31973 configuration error. The gid is either taken from the password data, or
31974 specified by <option>system_filter_group</option>. When the uid is specified numerically,
31975 <option>system_filter_group</option> is required to be set.
31976 </para>
31977 <para>
31978 If the system filter generates any pipe, file, or reply deliveries, the uid
31979 under which the filter is run is used when transporting them, unless a
31980 transport option overrides.
31981 </para>
31982 <para>
31983 <indexterm role="option">
31984 <primary><option>tcp_nodelay</option></primary>
31985 </indexterm>
31986 </para>
31987 <informaltable frame="all">
31988 <tgroup cols="4" colsep="0" rowsep="0">
31989 <colspec colwidth="8*" align="left"/>
31990 <colspec colwidth="6*" align="center"/>
31991 <colspec colwidth="6*" align="center"/>
31992 <colspec colwidth="6*" align="right"/>
31993 <tbody>
31994 <row>
31995 <entry><option>tcp_nodelay</option></entry>
31996 <entry>Use: <emphasis>main</emphasis></entry>
31997 <entry>Type: <emphasis>boolean</emphasis></entry>
31998 <entry>Default: <emphasis>true</emphasis></entry>
31999 </row>
32000 </tbody>
32001 </tgroup>
32002 </informaltable>
32003 <para>
32004 <indexterm role="concept">
32005 <primary>daemon</primary>
32006 <secondary>TCP_NODELAY on sockets</secondary>
32007 </indexterm>
32008 <indexterm role="concept">
32009 <primary>Nagle algorithm</primary>
32010 </indexterm>
32011 <indexterm role="concept">
32012 <primary>TCP_NODELAY on listening sockets</primary>
32013 </indexterm>
32014 If this option is set false, it stops the Exim daemon setting the
32015 TCP_NODELAY option on its listening sockets. Setting TCP_NODELAY
32016 turns off the <quote>Nagle algorithm</quote>, which is a way of improving network
32017 performance in interactive (character-by-character) situations. Turning it off
32018 should improve Exim&#x2019;s performance a bit, so that is what happens by default.
32019 However, it appears that some broken clients cannot cope, and time out. Hence
32020 this option. It affects only those sockets that are set up for listening by the
32021 daemon. Sockets created by the smtp transport for delivering mail always set
32022 TCP_NODELAY.
32023 </para>
32024 <para>
32025 <indexterm role="option">
32026 <primary><option>timeout_frozen_after</option></primary>
32027 </indexterm>
32028 </para>
32029 <informaltable frame="all">
32030 <tgroup cols="4" colsep="0" rowsep="0">
32031 <colspec colwidth="8*" align="left"/>
32032 <colspec colwidth="6*" align="center"/>
32033 <colspec colwidth="6*" align="center"/>
32034 <colspec colwidth="6*" align="right"/>
32035 <tbody>
32036 <row>
32037 <entry><option>timeout_frozen_after</option></entry>
32038 <entry>Use: <emphasis>main</emphasis></entry>
32039 <entry>Type: <emphasis>time</emphasis></entry>
32040 <entry>Default: <emphasis>0s</emphasis></entry>
32041 </row>
32042 </tbody>
32043 </tgroup>
32044 </informaltable>
32045 <para>
32046 <indexterm role="concept">
32047 <primary>frozen messages</primary>
32048 <secondary>timing out</secondary>
32049 </indexterm>
32050 <indexterm role="concept">
32051 <primary>timeout</primary>
32052 <secondary>frozen messages</secondary>
32053 </indexterm>
32054 If <option>timeout_frozen_after</option> is set to a time greater than zero, a frozen
32055 message of any kind that has been in the queue for longer than the given time
32056 is automatically cancelled at the next queue run. If the frozen message is a
32057 bounce message, it is just discarded; otherwise, a bounce is sent to the
32058 sender, in a similar manner to cancellation by the <option>-Mg</option> command line option.
32059 If you want to timeout frozen bounce messages earlier than other kinds of
32060 frozen message, see <option>ignore_bounce_errors_after</option>.
32061 </para>
32062 <para>
32063 <emphasis role="bold">Note:</emphasis> the default value of zero means no timeouts; with this setting,
32064 frozen messages remain in the queue forever (except for any frozen bounce
32065 messages that are released by <option>ignore_bounce_errors_after</option>).
32066 </para>
32067 <para>
32068 <indexterm role="option">
32069 <primary><option>timezone</option></primary>
32070 </indexterm>
32071 </para>
32072 <informaltable frame="all">
32073 <tgroup cols="4" colsep="0" rowsep="0">
32074 <colspec colwidth="8*" align="left"/>
32075 <colspec colwidth="6*" align="center"/>
32076 <colspec colwidth="6*" align="center"/>
32077 <colspec colwidth="6*" align="right"/>
32078 <tbody>
32079 <row>
32080 <entry><option>timezone</option></entry>
32081 <entry>Use: <emphasis>main</emphasis></entry>
32082 <entry>Type: <emphasis>string</emphasis></entry>
32083 <entry>Default: <emphasis>unset</emphasis></entry>
32084 </row>
32085 </tbody>
32086 </tgroup>
32087 </informaltable>
32088 <para>
32089 <indexterm role="concept">
32090 <primary>timezone, setting</primary>
32091 </indexterm>
32092 <indexterm role="concept">
32093 <primary>environment</primary>
32094 <secondary>values from</secondary>
32095 </indexterm>
32096 The value of <option>timezone</option> is used to set the environment variable TZ while
32097 running Exim (if it is different on entry). This ensures that all timestamps
32098 created by Exim are in the required timezone. If you want all your timestamps
32099 to be in UTC (aka GMT) you should set
32100 </para>
32101 <literallayout class="monospaced">
32102 timezone = UTC
32103 </literallayout>
32104 <para>
32105 The default value is taken from TIMEZONE_DEFAULT in <filename>Local/Makefile</filename>,
32106 or, if that is not set, from the value of the TZ environment variable when Exim
32107 is built. If <option>timezone</option> is set to the empty string, either at build or run
32108 time, any existing TZ variable is removed from the environment when Exim
32109 runs. This is appropriate behaviour for obtaining wall-clock time on some, but
32110 unfortunately not all, operating systems.
32111 </para>
32112 <para>
32113 <indexterm role="option">
32114 <primary><option>tls_advertise_hosts</option></primary>
32115 </indexterm>
32116 </para>
32117 <informaltable frame="all">
32118 <tgroup cols="4" colsep="0" rowsep="0">
32119 <colspec colwidth="8*" align="left"/>
32120 <colspec colwidth="6*" align="center"/>
32121 <colspec colwidth="6*" align="center"/>
32122 <colspec colwidth="6*" align="right"/>
32123 <tbody>
32124 <row>
32125 <entry><option>tls_advertise_hosts</option></entry>
32126 <entry>Use: <emphasis>main</emphasis></entry>
32127 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
32128 <entry>Default: <emphasis>*</emphasis></entry>
32129 </row>
32130 </tbody>
32131 </tgroup>
32132 </informaltable>
32133 <para>
32134 <indexterm role="concept">
32135 <primary>TLS</primary>
32136 <secondary>advertising</secondary>
32137 </indexterm>
32138 <indexterm role="concept">
32139 <primary>encryption</primary>
32140 <secondary>on SMTP connection</secondary>
32141 </indexterm>
32142 <indexterm role="concept">
32143 <primary>SMTP</primary>
32144 <secondary>encrypted connection</secondary>
32145 </indexterm>
32146 When Exim is built with support for TLS encrypted connections, the availability
32147 of the STARTTLS command to set up an encrypted session is advertised in
32148 response to EHLO only to those client hosts that match this option. See
32149 chapter <xref linkend="CHAPTLS"/> for details of Exim&#x2019;s support for TLS.
32150 Note that the default value requires that a certificate be supplied
32151 using the <option>tls_certificate</option> option.  If TLS support for incoming connections
32152 is not required the <option>tls_advertise_hosts</option> option should be set empty.
32153 </para>
32154 <para>
32155 <indexterm role="option">
32156 <primary><option>unset</option></primary>
32157 </indexterm>
32158 </para>
32159 <informaltable frame="all">
32160 <tgroup cols="4" colsep="0" rowsep="0">
32161 <colspec colwidth="8*" align="left"/>
32162 <colspec colwidth="6*" align="center"/>
32163 <colspec colwidth="6*" align="center"/>
32164 <colspec colwidth="6*" align="right"/>
32165 <tbody>
32166 <row>
32167 <entry><option>tls_certificate</option></entry>
32168 <entry>Use: <emphasis>main</emphasis></entry>
32169 <entry>Type: <emphasis>string</emphasis></entry>
32170 <entry>Default: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
32171 </row>
32172 </tbody>
32173 </tgroup>
32174 </informaltable>
32175 <para>
32176 <indexterm role="concept">
32177 <primary>TLS</primary>
32178 <secondary>server certificate; location of</secondary>
32179 </indexterm>
32180 <indexterm role="concept">
32181 <primary>certificate</primary>
32182 <secondary>server, location of</secondary>
32183 </indexterm>
32184 The value of this option is expanded, and must then be a list of absolute paths to
32185 files which contains the server&#x2019;s certificates.  Commonly only one file is
32186 needed.
32187 The server&#x2019;s private key is also
32188 assumed to be in this file if <option>tls_privatekey</option> is unset. See chapter
32189 <xref linkend="CHAPTLS"/> for further details.
32190 </para>
32191 <para>
32192 <emphasis role="bold">Note</emphasis>: The certificates defined by this option are used only when Exim is
32193 receiving incoming messages as a server. If you want to supply certificates for
32194 use when sending messages as a client, you must set the <option>tls_certificate</option>
32195 option in the relevant <command>smtp</command> transport.
32196 </para>
32197 <para>
32198 <emphasis role="bold">Note</emphasis>: If you use filenames based on IP addresses, change the list
32199 separator in the usual way (<xref linkend="SECTlistsepchange"/>) &gt;to avoid confusion under IPv6.
32200 </para>
32201 <para>
32202 <emphasis role="bold">Note</emphasis>: Under versions of OpenSSL preceding 1.1.1,
32203 when a list of more than one
32204 file is used, the <varname>$tls_in_ourcert</varname> variable is unreliable.
32205 </para>
32206 <para>
32207 <emphasis role="bold">Note</emphasis>: OCSP stapling is not usable under OpenSSL
32208 when a list of more than one file is used.
32209 </para>
32210 <para>
32211 If the option contains <varname>$tls_out_sni</varname> and Exim is built against OpenSSL, then
32212 if the OpenSSL build supports TLS extensions and the TLS client sends the
32213 Server Name Indication extension, then this option and others documented in
32214 <xref linkend="SECTtlssni"/> will be re-expanded.
32215 </para>
32216 <para>
32217 If this option is unset or empty a fresh self-signed certificate will be
32218 generated for every connection.
32219 </para>
32220 <para>
32221 <indexterm role="option">
32222 <primary><option>tls_crl</option></primary>
32223 </indexterm>
32224 </para>
32225 <informaltable frame="all">
32226 <tgroup cols="4" colsep="0" rowsep="0">
32227 <colspec colwidth="8*" align="left"/>
32228 <colspec colwidth="6*" align="center"/>
32229 <colspec colwidth="6*" align="center"/>
32230 <colspec colwidth="6*" align="right"/>
32231 <tbody>
32232 <row>
32233 <entry><option>tls_crl</option></entry>
32234 <entry>Use: <emphasis>main</emphasis></entry>
32235 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32236 <entry>Default: <emphasis>unset</emphasis></entry>
32237 </row>
32238 </tbody>
32239 </tgroup>
32240 </informaltable>
32241 <para>
32242 <indexterm role="concept">
32243 <primary>TLS</primary>
32244 <secondary>server certificate revocation list</secondary>
32245 </indexterm>
32246 <indexterm role="concept">
32247 <primary>certificate</primary>
32248 <secondary>revocation list for server</secondary>
32249 </indexterm>
32250 This option specifies a certificate revocation list. The expanded value must
32251 be the name of a file that contains CRLs in PEM format.
32252 </para>
32253 <para>
32254 Under OpenSSL the option can specify a directory with CRL files.
32255 </para>
32256 <para>
32257 <emphasis role="bold">Note:</emphasis> Under OpenSSL the option must, if given, supply a CRL
32258 for each signing element of the certificate chain (i.e. all but the leaf).
32259 For the file variant this can be multiple PEM blocks in the one file.
32260 </para>
32261 <para>
32262 See <xref linkend="SECTtlssni"/> for discussion of when this option might be re-expanded.
32263 </para>
32264 <para>
32265 <indexterm role="option">
32266 <primary><option>tls_dh_max_bits</option></primary>
32267 </indexterm>
32268 </para>
32269 <informaltable frame="all">
32270 <tgroup cols="4" colsep="0" rowsep="0">
32271 <colspec colwidth="8*" align="left"/>
32272 <colspec colwidth="6*" align="center"/>
32273 <colspec colwidth="6*" align="center"/>
32274 <colspec colwidth="6*" align="right"/>
32275 <tbody>
32276 <row>
32277 <entry><option>tls_dh_max_bits</option></entry>
32278 <entry>Use: <emphasis>main</emphasis></entry>
32279 <entry>Type: <emphasis>integer</emphasis></entry>
32280 <entry>Default: <emphasis>2236</emphasis></entry>
32281 </row>
32282 </tbody>
32283 </tgroup>
32284 </informaltable>
32285 <para>
32286 <indexterm role="concept">
32287 <primary>TLS</primary>
32288 <secondary>D-H bit count</secondary>
32289 </indexterm>
32290 The number of bits used for Diffie-Hellman key-exchange may be suggested by
32291 the chosen TLS library.  That value might prove to be too high for
32292 interoperability.  This option provides a maximum clamp on the value
32293 suggested, trading off security for interoperability.
32294 </para>
32295 <para>
32296 The value must be at least 1024.
32297 </para>
32298 <para>
32299 The value 2236 was chosen because, at time of adding the option, it was the
32300 hard-coded maximum value supported by the NSS cryptographic library, as used
32301 by Thunderbird, while GnuTLS was suggesting 2432 bits as normal.
32302 </para>
32303 <para>
32304 If you prefer more security and are willing to break some clients, raise this
32305 number.
32306 </para>
32307 <para>
32308 Note that the value passed to GnuTLS for *generating* a new prime may be a
32309 little less than this figure, because GnuTLS is inexact and may produce a
32310 larger prime than requested.
32311 </para>
32312 <para>
32313 <indexterm role="option">
32314 <primary><option>tls_dhparam</option></primary>
32315 </indexterm>
32316 </para>
32317 <informaltable frame="all">
32318 <tgroup cols="4" colsep="0" rowsep="0">
32319 <colspec colwidth="8*" align="left"/>
32320 <colspec colwidth="6*" align="center"/>
32321 <colspec colwidth="6*" align="center"/>
32322 <colspec colwidth="6*" align="right"/>
32323 <tbody>
32324 <row>
32325 <entry><option>tls_dhparam</option></entry>
32326 <entry>Use: <emphasis>main</emphasis></entry>
32327 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32328 <entry>Default: <emphasis>unset</emphasis></entry>
32329 </row>
32330 </tbody>
32331 </tgroup>
32332 </informaltable>
32333 <para>
32334 <indexterm role="concept">
32335 <primary>TLS</primary>
32336 <secondary>D-H parameters for server</secondary>
32337 </indexterm>
32338 The value of this option is expanded and indicates the source of DH parameters
32339 to be used by Exim.
32340 </para>
32341 <para>
32342 <emphasis role="bold">Note: The Exim Maintainers strongly recommend using a filename with site-generated
32343 local DH parameters</emphasis>, which has been supported across all versions of Exim.  The
32344 other specific constants available are a fallback so that even when
32345 "unconfigured", Exim can offer Perfect Forward Secrecy in older ciphersuites in TLS.
32346 </para>
32347 <para>
32348 If <option>tls_dhparam</option> is a filename starting with a <literal>/</literal>,
32349 then it names a file from which DH
32350 parameters should be loaded.  If the file exists, it should hold a PEM-encoded
32351 PKCS#3 representation of the DH prime.  If the file does not exist, for
32352 OpenSSL it is an error.  For GnuTLS, Exim will attempt to create the file and
32353 fill it with a generated DH prime.  For OpenSSL, if the DH bit-count from
32354 loading the file is greater than <option>tls_dh_max_bits</option> then it will be ignored,
32355 and treated as though the <option>tls_dhparam</option> were set to "none".
32356 </para>
32357 <para>
32358 If this option expands to the string "none", then no DH parameters will be
32359 loaded by Exim.
32360 </para>
32361 <para>
32362 If this option expands to the string "historic" and Exim is using GnuTLS, then
32363 Exim will attempt to load a file from inside the spool directory.  If the file
32364 does not exist, Exim will attempt to create it.
32365 See section <xref linkend="SECTgnutlsparam"/> for further details.
32366 </para>
32367 <para>
32368 If Exim is using OpenSSL and this option is empty or unset, then Exim will load
32369 a default DH prime; the default is Exim-specific but lacks verifiable provenance.
32370 </para>
32371 <para>
32372 In older versions of Exim the default was the 2048 bit prime described in section
32373 2.2 of RFC 5114, "2048-bit MODP Group with 224-bit Prime Order Subgroup", which
32374 in IKE is assigned number 23.
32375 </para>
32376 <para>
32377 Otherwise, the option must expand to the name used by Exim for any of a number
32378 of DH primes specified in RFC 2409, RFC 3526, RFC 5114, RFC 7919, or from other
32379 sources.  As names, Exim uses a standard specified name, else "ike" followed by
32380 the number used by IKE, or "default" which corresponds to
32381 <literal>exim.dev.20160529.3</literal>.
32382 </para>
32383 <para>
32384 The available standard primes are:
32385 <literal>ffdhe2048</literal>, <literal>ffdhe3072</literal>, <literal>ffdhe4096</literal>, <literal>ffdhe6144</literal>, <literal>ffdhe8192</literal>,
32386 <literal>ike1</literal>, <literal>ike2</literal>, <literal>ike5</literal>,
32387 <literal>ike14</literal>, <literal>ike15</literal>, <literal>ike16</literal>, <literal>ike17</literal>, <literal>ike18</literal>,
32388 <literal>ike22</literal>, <literal>ike23</literal> and <literal>ike24</literal>.
32389 </para>
32390 <para>
32391 The available additional primes are:
32392 <literal>exim.dev.20160529.1</literal>, <literal>exim.dev.20160529.2</literal> and <literal>exim.dev.20160529.3</literal>.
32393 </para>
32394 <para>
32395 Some of these will be too small to be accepted by clients.
32396 Some may be too large to be accepted by clients.
32397 The open cryptographic community has suspicions about the integrity of some
32398 of the later IKE values, which led into RFC7919 providing new fixed constants
32399 (the "ffdhe" identifiers).
32400 </para>
32401 <para>
32402 At this point, all of the "ike" values should be considered obsolete;
32403 they&#x2019;re still in Exim to avoid breaking unusual configurations, but are
32404 candidates for removal the next time we have backwards-incompatible changes.
32405 </para>
32406 <para>
32407 The TLS protocol does not negotiate an acceptable size for this; clients tend
32408 to hard-drop connections if what is offered by the server is unacceptable,
32409 whether too large or too small, and there&#x2019;s no provision for the client to
32410 tell the server what these constraints are.  Thus, as a server operator, you
32411 need to make an educated guess as to what is most likely to work for your
32412 userbase.
32413 </para>
32414 <para>
32415 Some known size constraints suggest that a bit-size in the range 2048 to 2236
32416 is most likely to maximise interoperability.  The upper bound comes from
32417 applications using the Mozilla Network Security Services (NSS) library, which
32418 used to set its <literal>DH_MAX_P_BITS</literal> upper-bound to 2236.  This affects many
32419 mail user agents (MUAs). The lower bound comes from Debian installs of Exim4
32420 prior to the 4.80 release, as Debian used to patch Exim to raise the minimum
32421 acceptable bound from 1024 to 2048.
32422 </para>
32423 <para>
32424 <indexterm role="option">
32425 <primary><option>tls_eccurve</option></primary>
32426 </indexterm>
32427 </para>
32428 <informaltable frame="all">
32429 <tgroup cols="4" colsep="0" rowsep="0">
32430 <colspec colwidth="8*" align="left"/>
32431 <colspec colwidth="6*" align="center"/>
32432 <colspec colwidth="6*" align="center"/>
32433 <colspec colwidth="6*" align="right"/>
32434 <tbody>
32435 <row>
32436 <entry><option>tls_eccurve</option></entry>
32437 <entry>Use: <emphasis>main</emphasis></entry>
32438 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32439 <entry>Default: <emphasis><literal>auto</literal></emphasis></entry>
32440 </row>
32441 </tbody>
32442 </tgroup>
32443 </informaltable>
32444 <para>
32445 <indexterm role="concept">
32446 <primary>TLS</primary>
32447 <secondary>EC cryptography</secondary>
32448 </indexterm>
32449 This option selects a EC curve for use by Exim when used with OpenSSL.
32450 It has no effect when Exim is used with GnuTLS.
32451 </para>
32452 <para>
32453 After expansion it must contain a valid EC curve parameter, such as
32454 <literal>prime256v1</literal>, <literal>secp384r1</literal>, or <literal>P-512</literal>. Consult your OpenSSL manual
32455 for valid selections.
32456 </para>
32457 <para>
32458 For OpenSSL versions before (and not including) 1.0.2, the string
32459 <literal>auto</literal> selects <literal>prime256v1</literal>. For more recent OpenSSL versions
32460 <literal>auto</literal> tells the library to choose.
32461 </para>
32462 <para>
32463 If the option expands to an empty string, no EC curves will be enabled.
32464 </para>
32465 <para>
32466 <indexterm role="option">
32467 <primary><option>tls_ocsp_file</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>tls_ocsp_file</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>TLS</primary>
32489 <secondary>certificate status</secondary>
32490 </indexterm>
32491 <indexterm role="concept">
32492 <primary>TLS</primary>
32493 <secondary>OCSP proof file</secondary>
32494 </indexterm>
32495 This option
32496 must if set expand to the absolute path to a file which contains a current
32497 status proof for the server&#x2019;s certificate, as obtained from the
32498 Certificate Authority.
32499 </para>
32500 <para>
32501 Usable for GnuTLS 3.4.4 or 3.3.17 or OpenSSL 1.1.0 (or later).
32502 </para>
32503 <para>
32504 For GnuTLS 3.5.6 or later the expanded value of this option can be a list
32505 of files, to match a list given for the <option>tls_certificate</option> option.
32506 The ordering of the two lists must match.
32507 </para>
32508 <para>
32509 <indexterm role="option">
32510 <primary><option>tls_on_connect_ports</option></primary>
32511 </indexterm>
32512 </para>
32513 <informaltable frame="all">
32514 <tgroup cols="4" colsep="0" rowsep="0">
32515 <colspec colwidth="8*" align="left"/>
32516 <colspec colwidth="6*" align="center"/>
32517 <colspec colwidth="6*" align="center"/>
32518 <colspec colwidth="6*" align="right"/>
32519 <tbody>
32520 <row>
32521 <entry><option>tls_on_connect_ports</option></entry>
32522 <entry>Use: <emphasis>main</emphasis></entry>
32523 <entry>Type: <emphasis>string list</emphasis></entry>
32524 <entry>Default: <emphasis>unset</emphasis></entry>
32525 </row>
32526 </tbody>
32527 </tgroup>
32528 </informaltable>
32529 <para>
32530 <indexterm role="concept">
32531 <primary>SSMTP</primary>
32532 </indexterm>
32533 <indexterm role="concept">
32534 <primary>SMTPS</primary>
32535 </indexterm>
32536 This option specifies a list of incoming SSMTP (aka SMTPS) ports that should
32537 operate the SSMTP (SMTPS) protocol, where a TLS session is immediately
32538 set up without waiting for the client to issue a STARTTLS command. For
32539 further details, see section <xref linkend="SECTsupobssmt"/>.
32540 </para>
32541 <para>
32542 <indexterm role="option">
32543 <primary><option>unset</option></primary>
32544 </indexterm>
32545 </para>
32546 <informaltable frame="all">
32547 <tgroup cols="4" colsep="0" rowsep="0">
32548 <colspec colwidth="8*" align="left"/>
32549 <colspec colwidth="6*" align="center"/>
32550 <colspec colwidth="6*" align="center"/>
32551 <colspec colwidth="6*" align="right"/>
32552 <tbody>
32553 <row>
32554 <entry><option>tls_privatekey</option></entry>
32555 <entry>Use: <emphasis>main</emphasis></entry>
32556 <entry>Type: <emphasis>string</emphasis></entry>
32557 <entry>Default: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
32558 </row>
32559 </tbody>
32560 </tgroup>
32561 </informaltable>
32562 <para>
32563 <indexterm role="concept">
32564 <primary>TLS</primary>
32565 <secondary>server private key; location of</secondary>
32566 </indexterm>
32567 The value of this option is expanded, and must then be a list of absolute paths to
32568 files which contains the server&#x2019;s private keys.
32569 If this option is unset, or if
32570 the expansion is forced to fail, or the result is an empty string, the private
32571 key is assumed to be in the same file as the server&#x2019;s certificates. See chapter
32572 <xref linkend="CHAPTLS"/> for further details.
32573 </para>
32574 <para>
32575 See <xref linkend="SECTtlssni"/> for discussion of when this option might be re-expanded.
32576 </para>
32577 <para>
32578 <indexterm role="option">
32579 <primary><option>tls_remember_esmtp</option></primary>
32580 </indexterm>
32581 </para>
32582 <informaltable frame="all">
32583 <tgroup cols="4" colsep="0" rowsep="0">
32584 <colspec colwidth="8*" align="left"/>
32585 <colspec colwidth="6*" align="center"/>
32586 <colspec colwidth="6*" align="center"/>
32587 <colspec colwidth="6*" align="right"/>
32588 <tbody>
32589 <row>
32590 <entry><option>tls_remember_esmtp</option></entry>
32591 <entry>Use: <emphasis>main</emphasis></entry>
32592 <entry>Type: <emphasis>boolean</emphasis></entry>
32593 <entry>Default: <emphasis>false</emphasis></entry>
32594 </row>
32595 </tbody>
32596 </tgroup>
32597 </informaltable>
32598 <para>
32599 <indexterm role="concept">
32600 <primary>TLS</primary>
32601 <secondary>esmtp state; remembering</secondary>
32602 </indexterm>
32603 <indexterm role="concept">
32604 <primary>TLS</primary>
32605 <secondary>broken clients</secondary>
32606 </indexterm>
32607 If this option is set true, Exim violates the RFCs by remembering that it is in
32608 <quote>esmtp</quote> state after successfully negotiating a TLS session. This provides
32609 support for broken clients that fail to send a new EHLO after starting a
32610 TLS session.
32611 </para>
32612 <para>
32613 <indexterm role="option">
32614 <primary><option>tls_require_ciphers</option></primary>
32615 </indexterm>
32616 </para>
32617 <informaltable frame="all">
32618 <tgroup cols="4" colsep="0" rowsep="0">
32619 <colspec colwidth="8*" align="left"/>
32620 <colspec colwidth="6*" align="center"/>
32621 <colspec colwidth="6*" align="center"/>
32622 <colspec colwidth="6*" align="right"/>
32623 <tbody>
32624 <row>
32625 <entry><option>tls_require_ciphers</option></entry>
32626 <entry>Use: <emphasis>main</emphasis></entry>
32627 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32628 <entry>Default: <emphasis>unset</emphasis></entry>
32629 </row>
32630 </tbody>
32631 </tgroup>
32632 </informaltable>
32633 <para>
32634 <indexterm role="concept">
32635 <primary>TLS</primary>
32636 <secondary>requiring specific ciphers</secondary>
32637 </indexterm>
32638 <indexterm role="concept">
32639 <primary>cipher</primary>
32640 <secondary>requiring specific</secondary>
32641 </indexterm>
32642 This option controls which ciphers can be used for incoming TLS connections.
32643 The <command>smtp</command> transport has an option of the same name for controlling outgoing
32644 connections. This option is expanded for each connection, so can be varied for
32645 different clients if required. The value of this option must be a list of
32646 permitted cipher suites. The OpenSSL and GnuTLS libraries handle cipher control
32647 in somewhat different ways. If GnuTLS is being used, the client controls the
32648 preference order of the available ciphers. Details are given in sections
32649 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
32650 </para>
32651 <para>
32652 <indexterm role="option">
32653 <primary><option>tls_try_verify_hosts</option></primary>
32654 </indexterm>
32655 </para>
32656 <informaltable frame="all">
32657 <tgroup cols="4" colsep="0" rowsep="0">
32658 <colspec colwidth="8*" align="left"/>
32659 <colspec colwidth="6*" align="center"/>
32660 <colspec colwidth="6*" align="center"/>
32661 <colspec colwidth="6*" align="right"/>
32662 <tbody>
32663 <row>
32664 <entry><option>tls_try_verify_hosts</option></entry>
32665 <entry>Use: <emphasis>main</emphasis></entry>
32666 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
32667 <entry>Default: <emphasis>unset</emphasis></entry>
32668 </row>
32669 </tbody>
32670 </tgroup>
32671 </informaltable>
32672 <para>
32673 <indexterm role="concept">
32674 <primary>TLS</primary>
32675 <secondary>client certificate verification</secondary>
32676 </indexterm>
32677 <indexterm role="concept">
32678 <primary>certificate</primary>
32679 <secondary>verification of client</secondary>
32680 </indexterm>
32681 See <option>tls_verify_hosts</option> below.
32682 </para>
32683 <para>
32684 <indexterm role="option">
32685 <primary><option>tls_verify_certificates</option></primary>
32686 </indexterm>
32687 </para>
32688 <informaltable frame="all">
32689 <tgroup cols="4" colsep="0" rowsep="0">
32690 <colspec colwidth="8*" align="left"/>
32691 <colspec colwidth="6*" align="center"/>
32692 <colspec colwidth="6*" align="center"/>
32693 <colspec colwidth="6*" align="right"/>
32694 <tbody>
32695 <row>
32696 <entry><option>tls_verify_certificates</option></entry>
32697 <entry>Use: <emphasis>main</emphasis></entry>
32698 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32699 <entry>Default: <emphasis>system</emphasis></entry>
32700 </row>
32701 </tbody>
32702 </tgroup>
32703 </informaltable>
32704 <para>
32705 <indexterm role="concept">
32706 <primary>TLS</primary>
32707 <secondary>client certificate verification</secondary>
32708 </indexterm>
32709 <indexterm role="concept">
32710 <primary>certificate</primary>
32711 <secondary>verification of client</secondary>
32712 </indexterm>
32713 The value of this option is expanded, and must then be either the
32714 word "system"
32715 or the absolute path to
32716 a file or directory containing permitted certificates for clients that
32717 match <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option>.
32718 </para>
32719 <para>
32720 The "system" value for the option will use a
32721 system default location compiled into the SSL library.
32722 This is not available for GnuTLS versions preceding 3.0.20,
32723 and will be taken as empty; an explicit location
32724 must be specified.
32725 </para>
32726 <para>
32727 The use of a directory for the option value is not available for GnuTLS versions
32728 preceding 3.3.6 and a single file must be used.
32729 </para>
32730 <para>
32731 With OpenSSL the certificates specified
32732 explicitly
32733 either by file or directory
32734 are added to those given by the system default location.
32735 </para>
32736 <para>
32737 These certificates should be for the certificate authorities trusted, rather
32738 than the public cert of individual clients.  With both OpenSSL and GnuTLS, if
32739 the value is a file then the certificates are sent by Exim as a server to
32740 connecting clients, defining the list of accepted certificate authorities.
32741 Thus the values defined should be considered public data.  To avoid this,
32742 use the explicit directory version.
32743 </para>
32744 <para>
32745 See <xref linkend="SECTtlssni"/> for discussion of when this option might be re-expanded.
32746 </para>
32747 <para>
32748 A forced expansion failure or setting to an empty string is equivalent to
32749 being unset.
32750 </para>
32751 <para>
32752 <indexterm role="option">
32753 <primary><option>tls_verify_hosts</option></primary>
32754 </indexterm>
32755 </para>
32756 <informaltable frame="all">
32757 <tgroup cols="4" colsep="0" rowsep="0">
32758 <colspec colwidth="8*" align="left"/>
32759 <colspec colwidth="6*" align="center"/>
32760 <colspec colwidth="6*" align="center"/>
32761 <colspec colwidth="6*" align="right"/>
32762 <tbody>
32763 <row>
32764 <entry><option>tls_verify_hosts</option></entry>
32765 <entry>Use: <emphasis>main</emphasis></entry>
32766 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
32767 <entry>Default: <emphasis>unset</emphasis></entry>
32768 </row>
32769 </tbody>
32770 </tgroup>
32771 </informaltable>
32772 <para>
32773 <indexterm role="concept">
32774 <primary>TLS</primary>
32775 <secondary>client certificate verification</secondary>
32776 </indexterm>
32777 <indexterm role="concept">
32778 <primary>certificate</primary>
32779 <secondary>verification of client</secondary>
32780 </indexterm>
32781 This option, along with <option>tls_try_verify_hosts</option>, controls the checking of
32782 certificates from clients. The expected certificates are defined by
32783 <option>tls_verify_certificates</option>, which must be set. A configuration error occurs if
32784 either <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> is set and
32785 <option>tls_verify_certificates</option> is not set.
32786 </para>
32787 <para>
32788 Any client that matches <option>tls_verify_hosts</option> is constrained by
32789 <option>tls_verify_certificates</option>. When the client initiates a TLS session, it must
32790 present one of the listed certificates. If it does not, the connection is
32791 aborted. <emphasis role="bold">Warning</emphasis>: Including a host in <option>tls_verify_hosts</option> does not require
32792 the host to use TLS. It can still send SMTP commands through unencrypted
32793 connections. Forcing a client to use TLS has to be done separately using an
32794 ACL to reject inappropriate commands when the connection is not encrypted.
32795 </para>
32796 <para>
32797 A weaker form of checking is provided by <option>tls_try_verify_hosts</option>. If a client
32798 matches this option (but not <option>tls_verify_hosts</option>), Exim requests a
32799 certificate and checks it against <option>tls_verify_certificates</option>, but does not
32800 abort the connection if there is no certificate or if it does not match. This
32801 state can be detected in an ACL, which makes it possible to implement policies
32802 such as <quote>accept for relay only if a verified certificate has been received,
32803 but accept for local delivery if encrypted, even without a verified
32804 certificate</quote>.
32805 </para>
32806 <para>
32807 Client hosts that match neither of these lists are not asked to present
32808 certificates.
32809 </para>
32810 <para>
32811 <indexterm role="option">
32812 <primary><option>trusted_groups</option></primary>
32813 </indexterm>
32814 </para>
32815 <informaltable frame="all">
32816 <tgroup cols="4" colsep="0" rowsep="0">
32817 <colspec colwidth="8*" align="left"/>
32818 <colspec colwidth="6*" align="center"/>
32819 <colspec colwidth="6*" align="center"/>
32820 <colspec colwidth="6*" align="right"/>
32821 <tbody>
32822 <row>
32823 <entry><option>trusted_groups</option></entry>
32824 <entry>Use: <emphasis>main</emphasis></entry>
32825 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
32826 <entry>Default: <emphasis>unset</emphasis></entry>
32827 </row>
32828 </tbody>
32829 </tgroup>
32830 </informaltable>
32831 <para>
32832 <indexterm role="concept">
32833 <primary>trusted groups</primary>
32834 </indexterm>
32835 <indexterm role="concept">
32836 <primary>groups</primary>
32837 <secondary>trusted</secondary>
32838 </indexterm>
32839 This option is expanded just once, at the start of Exim&#x2019;s processing. If this
32840 option is set, any process that is running in one of the listed groups, or
32841 which has one of them as a supplementary group, is trusted. The groups can be
32842 specified numerically or by name. See section <xref linkend="SECTtrustedadmin"/> for
32843 details of what trusted callers are permitted to do. If neither
32844 <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the Exim user
32845 are trusted.
32846 </para>
32847 <para>
32848 <indexterm role="option">
32849 <primary><option>trusted_users</option></primary>
32850 </indexterm>
32851 </para>
32852 <informaltable frame="all">
32853 <tgroup cols="4" colsep="0" rowsep="0">
32854 <colspec colwidth="8*" align="left"/>
32855 <colspec colwidth="6*" align="center"/>
32856 <colspec colwidth="6*" align="center"/>
32857 <colspec colwidth="6*" align="right"/>
32858 <tbody>
32859 <row>
32860 <entry><option>trusted_users</option></entry>
32861 <entry>Use: <emphasis>main</emphasis></entry>
32862 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
32863 <entry>Default: <emphasis>unset</emphasis></entry>
32864 </row>
32865 </tbody>
32866 </tgroup>
32867 </informaltable>
32868 <para>
32869 <indexterm role="concept">
32870 <primary>trusted users</primary>
32871 </indexterm>
32872 <indexterm role="concept">
32873 <primary>user</primary>
32874 <secondary>trusted</secondary>
32875 </indexterm>
32876 This option is expanded just once, at the start of Exim&#x2019;s processing. If this
32877 option is set, any process that is running as one of the listed users is
32878 trusted. The users can be specified numerically or by name. See section
32879 <xref linkend="SECTtrustedadmin"/> for details of what trusted callers are permitted to do.
32880 If neither <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the
32881 Exim user are trusted.
32882 </para>
32883 <para>
32884 <indexterm role="option">
32885 <primary><option>unknown_login</option></primary>
32886 </indexterm>
32887 </para>
32888 <informaltable frame="all">
32889 <tgroup cols="4" colsep="0" rowsep="0">
32890 <colspec colwidth="8*" align="left"/>
32891 <colspec colwidth="6*" align="center"/>
32892 <colspec colwidth="6*" align="center"/>
32893 <colspec colwidth="6*" align="right"/>
32894 <tbody>
32895 <row>
32896 <entry><option>unknown_login</option></entry>
32897 <entry>Use: <emphasis>main</emphasis></entry>
32898 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32899 <entry>Default: <emphasis>unset</emphasis></entry>
32900 </row>
32901 </tbody>
32902 </tgroup>
32903 </informaltable>
32904 <para>
32905 <indexterm role="concept">
32906 <primary>uid (user id)</primary>
32907 <secondary>unknown caller</secondary>
32908 </indexterm>
32909 <indexterm role="variable">
32910 <primary><varname>$caller_uid</varname></primary>
32911 </indexterm>
32912 This is a specialized feature for use in unusual configurations. By default, if
32913 the uid of the caller of Exim cannot be looked up using <function>getpwuid()</function>, Exim
32914 gives up. The <option>unknown_login</option> option can be used to set a login name to be
32915 used in this circumstance. It is expanded, so values like <option>user$caller_uid</option>
32916 can be set. When <option>unknown_login</option> is used, the value of <option>unknown_username</option>
32917 is used for the user&#x2019;s real name (gecos field), unless this has been set by the
32918 <option>-F</option> option.
32919 </para>
32920 <para>
32921 <indexterm role="option">
32922 <primary><option>unknown_username</option></primary>
32923 </indexterm>
32924 </para>
32925 <informaltable frame="all">
32926 <tgroup cols="4" colsep="0" rowsep="0">
32927 <colspec colwidth="8*" align="left"/>
32928 <colspec colwidth="6*" align="center"/>
32929 <colspec colwidth="6*" align="center"/>
32930 <colspec colwidth="6*" align="right"/>
32931 <tbody>
32932 <row>
32933 <entry><option>unknown_username</option></entry>
32934 <entry>Use: <emphasis>main</emphasis></entry>
32935 <entry>Type: <emphasis>string</emphasis></entry>
32936 <entry>Default: <emphasis>unset</emphasis></entry>
32937 </row>
32938 </tbody>
32939 </tgroup>
32940 </informaltable>
32941 <para>
32942 See <option>unknown_login</option>.
32943 </para>
32944 <para>
32945 <indexterm role="option">
32946 <primary><option>untrusted_set_sender</option></primary>
32947 </indexterm>
32948 </para>
32949 <informaltable frame="all">
32950 <tgroup cols="4" colsep="0" rowsep="0">
32951 <colspec colwidth="8*" align="left"/>
32952 <colspec colwidth="6*" align="center"/>
32953 <colspec colwidth="6*" align="center"/>
32954 <colspec colwidth="6*" align="right"/>
32955 <tbody>
32956 <row>
32957 <entry><option>untrusted_set_sender</option></entry>
32958 <entry>Use: <emphasis>main</emphasis></entry>
32959 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
32960 <entry>Default: <emphasis>unset</emphasis></entry>
32961 </row>
32962 </tbody>
32963 </tgroup>
32964 </informaltable>
32965 <para>
32966 <indexterm role="concept">
32967 <primary>trusted users</primary>
32968 </indexterm>
32969 <indexterm role="concept">
32970 <primary>sender</primary>
32971 <secondary>setting by untrusted user</secondary>
32972 </indexterm>
32973 <indexterm role="concept">
32974 <primary>untrusted user setting sender</primary>
32975 </indexterm>
32976 <indexterm role="concept">
32977 <primary>user</primary>
32978 <secondary>untrusted setting sender</secondary>
32979 </indexterm>
32980 <indexterm role="concept">
32981 <primary>envelope sender</primary>
32982 </indexterm>
32983 When an untrusted user submits a message to Exim using the standard input, Exim
32984 normally creates an envelope sender address from the user&#x2019;s login and the
32985 default qualification domain. Data from the <option>-f</option> option (for setting envelope
32986 senders on non-SMTP messages) or the SMTP MAIL command (if <option>-bs</option> or <option>-bS</option>
32987 is used) is ignored.
32988 </para>
32989 <para>
32990 However, untrusted users are permitted to set an empty envelope sender address,
32991 to declare that a message should never generate any bounces. For example:
32992 </para>
32993 <literallayout class="monospaced">
32994 exim -f '&lt;&gt;' user@domain.example
32995 </literallayout>
32996 <para>
32997 <indexterm role="variable">
32998 <primary><varname>$sender_ident</varname></primary>
32999 </indexterm>
33000 The <option>untrusted_set_sender</option> option allows you to permit untrusted users to set
33001 other envelope sender addresses in a controlled way. When it is set, untrusted
33002 users are allowed to set envelope sender addresses that match any of the
33003 patterns in the list. Like all address lists, the string is expanded. The
33004 identity of the user is in <varname>$sender_ident</varname>, so you can, for example, restrict
33005 users to setting senders that start with their login ids
33006 followed by a hyphen
33007 by a setting like this:
33008 </para>
33009 <literallayout class="monospaced">
33010 untrusted_set_sender = ^$sender_ident-
33011 </literallayout>
33012 <para>
33013 If you want to allow untrusted users to set envelope sender addresses without
33014 restriction, you can use
33015 </para>
33016 <literallayout class="monospaced">
33017 untrusted_set_sender = *
33018 </literallayout>
33019 <para>
33020 The <option>untrusted_set_sender</option> option applies to all forms of local input, but
33021 only to the setting of the envelope sender. It does not permit untrusted users
33022 to use the other options which trusted user can use to override message
33023 parameters. Furthermore, it does not stop Exim from removing an existing
33024 <emphasis>Sender:</emphasis> header in the message, or from adding a <emphasis>Sender:</emphasis> header if
33025 necessary. See <option>local_sender_retain</option> and <option>local_from_check</option> for ways of
33026 overriding these actions. The handling of the <emphasis>Sender:</emphasis> header is also
33027 described in section <xref linkend="SECTthesenhea"/>.
33028 </para>
33029 <para>
33030 The log line for a message&#x2019;s arrival shows the envelope sender following
33031 <quote>&lt;=</quote>. For local messages, the user&#x2019;s login always follows, after <quote>U=</quote>. In
33032 <option>-bp</option> displays, and in the Exim monitor, if an untrusted user sets an
33033 envelope sender address, the user&#x2019;s login is shown in parentheses after the
33034 sender address.
33035 </para>
33036 <para>
33037 <indexterm role="option">
33038 <primary><option>uucp_from_pattern</option></primary>
33039 </indexterm>
33040 </para>
33041 <informaltable frame="all">
33042 <tgroup cols="4" colsep="0" rowsep="0">
33043 <colspec colwidth="8*" align="left"/>
33044 <colspec colwidth="6*" align="center"/>
33045 <colspec colwidth="6*" align="center"/>
33046 <colspec colwidth="6*" align="right"/>
33047 <tbody>
33048 <row>
33049 <entry><option>uucp_from_pattern</option></entry>
33050 <entry>Use: <emphasis>main</emphasis></entry>
33051 <entry>Type: <emphasis>string</emphasis></entry>
33052 <entry>Default: <emphasis>see below</emphasis></entry>
33053 </row>
33054 </tbody>
33055 </tgroup>
33056 </informaltable>
33057 <para>
33058 <indexterm role="concept">
33059 <primary><quote>From</quote> line</primary>
33060 </indexterm>
33061 <indexterm role="concept">
33062 <primary>UUCP</primary>
33063 <secondary><quote>From</quote> line</secondary>
33064 </indexterm>
33065 Some applications that pass messages to an MTA via a command line interface use
33066 an initial line starting with <quote>From&nbsp;</quote> to pass the envelope sender. In
33067 particular, this is used by UUCP software. Exim recognizes such a line by means
33068 of a regular expression that is set in <option>uucp_from_pattern</option>. When the pattern
33069 matches, the sender address is constructed by expanding the contents of
33070 <option>uucp_from_sender</option>, provided that the caller of Exim is a trusted user. The
33071 default pattern recognizes lines in the following two forms:
33072 </para>
33073 <literallayout class="monospaced">
33074 From ph10 Fri Jan  5 12:35 GMT 1996
33075 From ph10 Fri, 7 Jan 97 14:00:00 GMT
33076 </literallayout>
33077 <para>
33078 The pattern can be seen by running
33079 </para>
33080 <literallayout class="monospaced">
33081 exim -bP uucp_from_pattern
33082 </literallayout>
33083 <para>
33084 It checks only up to the hours and minutes, and allows for a 2-digit or 4-digit
33085 year in the second case. The first word after <quote>From&nbsp;</quote> is matched in the
33086 regular expression by a parenthesized subpattern. The default value for
33087 <option>uucp_from_sender</option> is <quote>$1</quote>, which therefore just uses this first word
33088 (<quote>ph10</quote> in the example above) as the message&#x2019;s sender. See also
33089 <option>ignore_fromline_hosts</option>.
33090 </para>
33091 <para>
33092 <indexterm role="option">
33093 <primary><option>uucp_from_sender</option></primary>
33094 </indexterm>
33095 </para>
33096 <informaltable frame="all">
33097 <tgroup cols="4" colsep="0" rowsep="0">
33098 <colspec colwidth="8*" align="left"/>
33099 <colspec colwidth="6*" align="center"/>
33100 <colspec colwidth="6*" align="center"/>
33101 <colspec colwidth="6*" align="right"/>
33102 <tbody>
33103 <row>
33104 <entry><option>uucp_from_sender</option></entry>
33105 <entry>Use: <emphasis>main</emphasis></entry>
33106 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33107 <entry>Default: <emphasis><literal>$1</literal></emphasis></entry>
33108 </row>
33109 </tbody>
33110 </tgroup>
33111 </informaltable>
33112 <para>
33113 See <option>uucp_from_pattern</option> above.
33114 </para>
33115 <para>
33116 <indexterm role="option">
33117 <primary><option>warn_message_file</option></primary>
33118 </indexterm>
33119 </para>
33120 <informaltable frame="all">
33121 <tgroup cols="4" colsep="0" rowsep="0">
33122 <colspec colwidth="8*" align="left"/>
33123 <colspec colwidth="6*" align="center"/>
33124 <colspec colwidth="6*" align="center"/>
33125 <colspec colwidth="6*" align="right"/>
33126 <tbody>
33127 <row>
33128 <entry><option>warn_message_file</option></entry>
33129 <entry>Use: <emphasis>main</emphasis></entry>
33130 <entry>Type: <emphasis>string</emphasis></entry>
33131 <entry>Default: <emphasis>unset</emphasis></entry>
33132 </row>
33133 </tbody>
33134 </tgroup>
33135 </informaltable>
33136 <para>
33137 <indexterm role="concept">
33138 <primary>warning of delay</primary>
33139 <secondary>customizing the message</secondary>
33140 </indexterm>
33141 <indexterm role="concept">
33142 <primary>customizing</primary>
33143 <secondary>warning message</secondary>
33144 </indexterm>
33145 This option defines a template file containing paragraphs of text to be used
33146 for constructing the warning message which is sent by Exim when a message has
33147 been in the queue for a specified amount of time, as specified by
33148 <option>delay_warning</option>. Details of the file&#x2019;s contents are given in chapter
33149 <xref linkend="CHAPemsgcust"/>. See also <option>bounce_message_file</option>.
33150 </para>
33151 <para>
33152 <indexterm role="option">
33153 <primary><option>write_rejectlog</option></primary>
33154 </indexterm>
33155 </para>
33156 <informaltable frame="all">
33157 <tgroup cols="4" colsep="0" rowsep="0">
33158 <colspec colwidth="8*" align="left"/>
33159 <colspec colwidth="6*" align="center"/>
33160 <colspec colwidth="6*" align="center"/>
33161 <colspec colwidth="6*" align="right"/>
33162 <tbody>
33163 <row>
33164 <entry><option>write_rejectlog</option></entry>
33165 <entry>Use: <emphasis>main</emphasis></entry>
33166 <entry>Type: <emphasis>boolean</emphasis></entry>
33167 <entry>Default: <emphasis>true</emphasis></entry>
33168 </row>
33169 </tbody>
33170 </tgroup>
33171 </informaltable>
33172 <para>
33173 <indexterm role="concept">
33174 <primary>reject log</primary>
33175 <secondary>disabling</secondary>
33176 </indexterm>
33177 If this option is set false, Exim no longer writes anything to the reject log.
33178 See chapter <xref linkend="CHAPlog"/> for details of what Exim writes to its logs.
33179 <indexterm role="concept" startref="IIDconfima" class="endofrange"/>
33180 <indexterm role="concept" startref="IIDmaiconf" class="endofrange"/>
33181 </para>
33182 </section>
33183 </chapter>
33184
33185 <chapter id="CHAProutergeneric">
33186 <title>Generic options for routers</title>
33187 <para>
33188 <indexterm role="concept" id="IIDgenoprou1" class="startofrange">
33189 <primary>options</primary>
33190 <secondary>generic; for routers</secondary>
33191 </indexterm>
33192 <indexterm role="concept" id="IIDgenoprou2" class="startofrange">
33193 <primary>generic options</primary>
33194 <secondary>router</secondary>
33195 </indexterm>
33196 This chapter describes the generic options that apply to all routers.
33197 Those that are preconditions are marked with &Dagger; in the <quote>use</quote> field.
33198 </para>
33199 <para>
33200 For a general description of how a router operates, see sections
33201 <xref linkend="SECTrunindrou"/> and <xref linkend="SECTrouprecon"/>. The latter specifies the order in
33202 which the preconditions are tested. The order of expansion of the options that
33203 provide data for a transport is: <option>errors_to</option>, <option>headers_add</option>,
33204 <option>headers_remove</option>, <option>transport</option>.
33205 </para>
33206 <para>
33207 <indexterm role="option">
33208 <primary><option>address_data</option></primary>
33209 </indexterm>
33210 </para>
33211 <informaltable frame="all">
33212 <tgroup cols="4" colsep="0" rowsep="0">
33213 <colspec colwidth="8*" align="left"/>
33214 <colspec colwidth="6*" align="center"/>
33215 <colspec colwidth="6*" align="center"/>
33216 <colspec colwidth="6*" align="right"/>
33217 <tbody>
33218 <row>
33219 <entry><option>address_data</option></entry>
33220 <entry>Use: <emphasis>routers</emphasis></entry>
33221 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33222 <entry>Default: <emphasis>unset</emphasis></entry>
33223 </row>
33224 </tbody>
33225 </tgroup>
33226 </informaltable>
33227 <para>
33228 <indexterm role="concept">
33229 <primary>router</primary>
33230 <secondary>data attached to address</secondary>
33231 </indexterm>
33232 The string is expanded just before the router is run, that is, after all the
33233 precondition tests have succeeded. If the expansion is forced to fail, the
33234 router declines, the value of <option>address_data</option> remains unchanged, and the
33235 <option>more</option> option controls what happens next. Other expansion failures cause
33236 delivery of the address to be deferred.
33237 </para>
33238 <para>
33239 <indexterm role="variable">
33240 <primary><varname>$address_data</varname></primary>
33241 </indexterm>
33242 When the expansion succeeds, the value is retained with the address, and can be
33243 accessed using the variable <varname>$address_data</varname> in the current router, subsequent
33244 routers, and the eventual transport.
33245 </para>
33246 <para>
33247 <emphasis role="bold">Warning</emphasis>: If the current or any subsequent router is a <command>redirect</command> router
33248 that runs a user&#x2019;s filter file, the contents of <varname>$address_data</varname> are accessible
33249 in the filter. This is not normally a problem, because such data is usually
33250 either not confidential or it <quote>belongs</quote> to the current user, but if you do
33251 put confidential data into <varname>$address_data</varname> you need to remember this point.
33252 </para>
33253 <para>
33254 Even if the router declines or passes, the value of <varname>$address_data</varname> remains
33255 with the address, though it can be changed by another <option>address_data</option> setting
33256 on a subsequent router. If a router generates child addresses, the value of
33257 <varname>$address_data</varname> propagates to them. This also applies to the special kind of
33258 <quote>child</quote> that is generated by a router with the <option>unseen</option> option.
33259 </para>
33260 <para>
33261 The idea of <option>address_data</option> is that you can use it to look up a lot of data
33262 for the address once, and then pick out parts of the data later. For example,
33263 you could use a single LDAP lookup to return a string of the form
33264 </para>
33265 <literallayout class="monospaced">
33266 uid=1234 gid=5678 mailbox=/mail/xyz forward=/home/xyz/.forward
33267 </literallayout>
33268 <para>
33269 In the transport you could pick out the mailbox by a setting such as
33270 </para>
33271 <literallayout class="monospaced">
33272 file = ${extract{mailbox}{$address_data}}
33273 </literallayout>
33274 <para>
33275 This makes the configuration file less messy, and also reduces the number of
33276 lookups (though Exim does cache lookups).
33277 </para>
33278 <para>
33279 <indexterm role="variable">
33280 <primary><varname>$sender_address_data</varname></primary>
33281 </indexterm>
33282 <indexterm role="variable">
33283 <primary><varname>$address_data</varname></primary>
33284 </indexterm>
33285 The <option>address_data</option> facility is also useful as a means of passing information
33286 from one router to another, and from a router to a transport. In addition, if
33287 <varname>$address_data</varname> is set by a router when verifying a recipient address from an
33288 ACL, it remains available for use in the rest of the ACL statement. After
33289 verifying a sender, the value is transferred to <varname>$sender_address_data</varname>.
33290 </para>
33291 <para>
33292 <indexterm role="option">
33293 <primary><option>address_test</option></primary>
33294 </indexterm>
33295 </para>
33296 <informaltable frame="all">
33297 <tgroup cols="4" colsep="0" rowsep="0">
33298 <colspec colwidth="8*" align="left"/>
33299 <colspec colwidth="6*" align="center"/>
33300 <colspec colwidth="6*" align="center"/>
33301 <colspec colwidth="6*" align="right"/>
33302 <tbody>
33303 <row>
33304 <entry><option>address_test</option></entry>
33305 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
33306 <entry>Type: <emphasis>boolean</emphasis></entry>
33307 <entry>Default: <emphasis>true</emphasis></entry>
33308 </row>
33309 </tbody>
33310 </tgroup>
33311 </informaltable>
33312 <para>
33313 <indexterm role="option">
33314 <primary><option>-bt</option></primary>
33315 </indexterm>
33316 <indexterm role="concept">
33317 <primary>router</primary>
33318 <secondary>skipping when address testing</secondary>
33319 </indexterm>
33320 If this option is set false, the router is skipped when routing is being tested
33321 by means of the <option>-bt</option> command line option. This can be a convenience when
33322 your first router sends messages to an external scanner, because it saves you
33323 having to set the <quote>already scanned</quote> indicator when testing real address
33324 routing.
33325 </para>
33326 <para>
33327 <indexterm role="option">
33328 <primary><option>cannot_route_message</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>cannot_route_message</option></entry>
33340 <entry>Use: <emphasis>routers</emphasis></entry>
33341 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33342 <entry>Default: <emphasis>unset</emphasis></entry>
33343 </row>
33344 </tbody>
33345 </tgroup>
33346 </informaltable>
33347 <para>
33348 <indexterm role="concept">
33349 <primary>router</primary>
33350 <secondary>customizing <quote>cannot route</quote> message</secondary>
33351 </indexterm>
33352 <indexterm role="concept">
33353 <primary>customizing</primary>
33354 <secondary><quote>cannot route</quote> message</secondary>
33355 </indexterm>
33356 This option specifies a text message that is used when an address cannot be
33357 routed because Exim has run out of routers. The default message is
33358 <quote>Unrouteable address</quote>. This option is useful only on routers that have
33359 <option>more</option> set false, or on the very last router in a configuration, because the
33360 value that is used is taken from the last router that is considered. This
33361 includes a router that is skipped because its preconditions are not met, as
33362 well as a router that declines. For example, using the default configuration,
33363 you could put:
33364 </para>
33365 <literallayout class="monospaced">
33366 cannot_route_message = Remote domain not found in DNS
33367 </literallayout>
33368 <para>
33369 on the first router, which is a <command>dnslookup</command> router with <option>more</option> set false,
33370 and
33371 </para>
33372 <literallayout class="monospaced">
33373 cannot_route_message = Unknown local user
33374 </literallayout>
33375 <para>
33376 on the final router that checks for local users. If string expansion fails for
33377 this option, the default message is used. Unless the expansion failure was
33378 explicitly forced, a message about the failure is written to the main and panic
33379 logs, in addition to the normal message about the routing failure.
33380 </para>
33381 <para>
33382 <indexterm role="option">
33383 <primary><option>caseful_local_part</option></primary>
33384 </indexterm>
33385 </para>
33386 <informaltable frame="all">
33387 <tgroup cols="4" colsep="0" rowsep="0">
33388 <colspec colwidth="8*" align="left"/>
33389 <colspec colwidth="6*" align="center"/>
33390 <colspec colwidth="6*" align="center"/>
33391 <colspec colwidth="6*" align="right"/>
33392 <tbody>
33393 <row>
33394 <entry><option>caseful_local_part</option></entry>
33395 <entry>Use: <emphasis>routers</emphasis></entry>
33396 <entry>Type: <emphasis>boolean</emphasis></entry>
33397 <entry>Default: <emphasis>false</emphasis></entry>
33398 </row>
33399 </tbody>
33400 </tgroup>
33401 </informaltable>
33402 <para>
33403 <indexterm role="concept">
33404 <primary>case of local parts</primary>
33405 </indexterm>
33406 <indexterm role="concept">
33407 <primary>router</primary>
33408 <secondary>case of local parts</secondary>
33409 </indexterm>
33410 By default, routers handle the local parts of addresses in a case-insensitive
33411 manner, though the actual case is preserved for transmission with the message.
33412 If you want the case of letters to be significant in a router, you must set
33413 this option true. For individual router options that contain address or local
33414 part lists (for example, <option>local_parts</option>), case-sensitive matching can be
33415 turned on by <quote>+caseful</quote> as a list item. See section <xref linkend="SECTcasletadd"/> for
33416 more details.
33417 </para>
33418 <para>
33419 <indexterm role="variable">
33420 <primary><varname>$local_part</varname></primary>
33421 </indexterm>
33422 <indexterm role="variable">
33423 <primary><varname>$original_local_part</varname></primary>
33424 </indexterm>
33425 <indexterm role="variable">
33426 <primary><varname>$parent_local_part</varname></primary>
33427 </indexterm>
33428 The value of the <varname>$local_part</varname> variable is forced to lower case while a
33429 router is running unless <option>caseful_local_part</option> is set. When a router assigns
33430 an address to a transport, the value of <varname>$local_part</varname> when the transport runs
33431 is the same as it was in the router. Similarly, when a router generates child
33432 addresses by aliasing or forwarding, the values of <varname>$original_local_part</varname>
33433 and <varname>$parent_local_part</varname> are those that were used by the redirecting router.
33434 </para>
33435 <para>
33436 This option applies to the processing of an address by a router. When a
33437 recipient address is being processed in an ACL, there is a separate <option>control</option>
33438 modifier that can be used to specify case-sensitive processing within the ACL
33439 (see section <xref linkend="SECTcontrols"/>).
33440 </para>
33441 <para>
33442 <indexterm role="option">
33443 <primary><option>check_local_user</option></primary>
33444 </indexterm>
33445 </para>
33446 <informaltable frame="all">
33447 <tgroup cols="4" colsep="0" rowsep="0">
33448 <colspec colwidth="8*" align="left"/>
33449 <colspec colwidth="6*" align="center"/>
33450 <colspec colwidth="6*" align="center"/>
33451 <colspec colwidth="6*" align="right"/>
33452 <tbody>
33453 <row>
33454 <entry><option>check_local_user</option></entry>
33455 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
33456 <entry>Type: <emphasis>boolean</emphasis></entry>
33457 <entry>Default: <emphasis>false</emphasis></entry>
33458 </row>
33459 </tbody>
33460 </tgroup>
33461 </informaltable>
33462 <para>
33463 <indexterm role="concept">
33464 <primary>local user, checking in router</primary>
33465 </indexterm>
33466 <indexterm role="concept">
33467 <primary>router</primary>
33468 <secondary>checking for local user</secondary>
33469 </indexterm>
33470 <indexterm role="concept">
33471 <primary><filename>/etc/passwd</filename></primary>
33472 </indexterm>
33473 <indexterm role="variable">
33474 <primary><varname>$home</varname></primary>
33475 </indexterm>
33476 When this option is true, Exim checks that the local part of the recipient
33477 address (with affixes removed if relevant) is the name of an account on the
33478 local system. The check is done by calling the <function>getpwnam()</function> function rather
33479 than trying to read <filename>/etc/passwd</filename> directly. This means that other methods of
33480 holding password data (such as NIS) are supported. If the local part is a local
33481 user, <varname>$home</varname> is set from the password data, and can be tested in other
33482 preconditions that are evaluated after this one (the order of evaluation is
33483 given in section <xref linkend="SECTrouprecon"/>). However, the value of <varname>$home</varname> can be
33484 overridden by <option>router_home_directory</option>. If the local part is not a local user,
33485 the router is skipped.
33486 </para>
33487 <para>
33488 If you want to check that the local part is either the name of a local user
33489 or matches something else, you cannot combine <option>check_local_user</option> with a
33490 setting of <option>local_parts</option>, because that specifies the logical <emphasis>and</emphasis> of the
33491 two conditions. However, you can use a <command>passwd</command> lookup in a <option>local_parts</option>
33492 setting to achieve this. For example:
33493 </para>
33494 <literallayout class="monospaced">
33495 local_parts = passwd;$local_part : lsearch;/etc/other/users
33496 </literallayout>
33497 <para>
33498 Note, however, that the side effects of <option>check_local_user</option> (such as setting
33499 up a home directory) do not occur when a <command>passwd</command> lookup is used in a
33500 <option>local_parts</option> (or any other) precondition.
33501 </para>
33502 <para>
33503 <indexterm role="option">
33504 <primary><option>condition</option></primary>
33505 </indexterm>
33506 </para>
33507 <informaltable frame="all">
33508 <tgroup cols="4" colsep="0" rowsep="0">
33509 <colspec colwidth="8*" align="left"/>
33510 <colspec colwidth="6*" align="center"/>
33511 <colspec colwidth="6*" align="center"/>
33512 <colspec colwidth="6*" align="right"/>
33513 <tbody>
33514 <row>
33515 <entry><option>condition</option></entry>
33516 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
33517 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33518 <entry>Default: <emphasis>unset</emphasis></entry>
33519 </row>
33520 </tbody>
33521 </tgroup>
33522 </informaltable>
33523 <para>
33524 <indexterm role="concept">
33525 <primary>router</primary>
33526 <secondary>customized precondition</secondary>
33527 </indexterm>
33528 This option specifies a general precondition test that has to succeed for the
33529 router to be called. The <option>condition</option> option is the last precondition to be
33530 evaluated (see section <xref linkend="SECTrouprecon"/>). The string is expanded, and if the
33531 result is a forced failure, or an empty string, or one of the strings <quote>0</quote> or
33532 <quote>no</quote> or <quote>false</quote> (checked without regard to the case of the letters), the
33533 router is skipped, and the address is offered to the next one.
33534 </para>
33535 <para>
33536 If the result is any other value, the router is run (as this is the last
33537 precondition to be evaluated, all the other preconditions must be true).
33538 </para>
33539 <para>
33540 This option is unusual in that multiple <option>condition</option> options may be present.
33541 All <option>condition</option> options must succeed.
33542 </para>
33543 <para>
33544 The <option>condition</option> option provides a means of applying custom conditions to the
33545 running of routers. Note that in the case of a simple conditional expansion,
33546 the default expansion values are exactly what is wanted. For example:
33547 </para>
33548 <literallayout class="monospaced">
33549 condition = ${if &gt;{$message_age}{600}}
33550 </literallayout>
33551 <para>
33552 Because of the default behaviour of the string expansion, this is equivalent to
33553 </para>
33554 <literallayout class="monospaced">
33555 condition = ${if &gt;{$message_age}{600}{true}{}}
33556 </literallayout>
33557 <para>
33558 A multiple condition example, which succeeds:
33559 </para>
33560 <literallayout class="monospaced">
33561 condition = ${if &gt;{$message_age}{600}}
33562 condition = ${if !eq{${lc:$local_part}}{postmaster}}
33563 condition = foobar
33564 </literallayout>
33565 <para>
33566 If the expansion fails (other than forced failure) delivery is deferred. Some
33567 of the other precondition options are common special cases that could in fact
33568 be specified using <option>condition</option>.
33569 </para>
33570 <para>
33571 Historical note: We have <option>condition</option> on ACLs and on Routers.  Routers
33572 are far older, and use one set of semantics.  ACLs are newer and when
33573 they were created, the ACL <option>condition</option> process was given far stricter
33574 parse semantics.  The <option>bool{}</option> expansion condition uses the same rules as
33575 ACLs.  The <option>bool_lax{}</option> expansion condition uses the same rules as
33576 Routers.  More pointedly, the <option>bool_lax{}</option> was written to match the existing
33577 Router rules processing behavior.
33578 </para>
33579 <para>
33580 This is best illustrated in an example:
33581 </para>
33582 <literallayout class="monospaced">
33583 # If used in an ACL condition will fail with a syntax error, but
33584 # in a router condition any extra characters are treated as a string
33585
33586 $ exim -be '${if eq {${lc:GOOGLE.com}} {google.com}} {yes} {no}}'
33587 true {yes} {no}}
33588
33589 $ exim -be '${if eq {${lc:WHOIS.com}} {google.com}} {yes} {no}}'
33590  {yes} {no}}
33591 </literallayout>
33592 <para>
33593 In each example above, the <option>if</option> statement actually ends after
33594 <quote>{google.com}}</quote>.  Since no true or false braces were defined, the
33595 default <option>if</option> behavior is to return a boolean true or a null answer
33596 (which evaluates to false). The rest of the line is then treated as a
33597 string. So the first example resulted in the boolean answer <quote>true</quote>
33598 with the string <quote> {yes} {no}}</quote> appended to it. The second example
33599 resulted in the null output (indicating false) with the string
33600 <quote> {yes} {no}}</quote> appended to it.
33601 </para>
33602 <para>
33603 In fact you can put excess forward braces in too.  In the router
33604 <option>condition</option>, Exim&#x2019;s parser only looks for <quote>{</quote> symbols when they
33605 mean something, like after a <quote>$</quote> or when required as part of a
33606 conditional.  But otherwise <quote>{</quote> and <quote>}</quote> are treated as ordinary
33607 string characters.
33608 </para>
33609 <para>
33610 Thus, in a Router, the above expansion strings will both always evaluate
33611 true, as the result of expansion is a non-empty string which doesn&#x2019;t
33612 match an explicit false value.  This can be tricky to debug.  By
33613 contrast, in an ACL either of those strings will always result in an
33614 expansion error because the result doesn&#x2019;t look sufficiently boolean.
33615 </para>
33616 <para>
33617 <indexterm role="option">
33618 <primary><option>debug_print</option></primary>
33619 </indexterm>
33620 </para>
33621 <informaltable frame="all">
33622 <tgroup cols="4" colsep="0" rowsep="0">
33623 <colspec colwidth="8*" align="left"/>
33624 <colspec colwidth="6*" align="center"/>
33625 <colspec colwidth="6*" align="center"/>
33626 <colspec colwidth="6*" align="right"/>
33627 <tbody>
33628 <row>
33629 <entry><option>debug_print</option></entry>
33630 <entry>Use: <emphasis>routers</emphasis></entry>
33631 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33632 <entry>Default: <emphasis>unset</emphasis></entry>
33633 </row>
33634 </tbody>
33635 </tgroup>
33636 </informaltable>
33637 <para>
33638 <indexterm role="concept">
33639 <primary>testing</primary>
33640 <secondary>variables in drivers</secondary>
33641 </indexterm>
33642 If this option is set and debugging is enabled (see the <option>-d</option> command line
33643 option) or in address-testing mode (see the <option>-bt</option> command line option),
33644 the string is expanded and included in the debugging output.
33645 If expansion of the string fails, the error message is written to the debugging
33646 output, and Exim carries on processing.
33647 This option is provided to help with checking out the values of variables and
33648 so on when debugging router configurations. For example, if a <option>condition</option>
33649 option appears not to be working, <option>debug_print</option> can be used to output the
33650 variables it references. The output happens after checks for <option>domains</option>,
33651 <option>local_parts</option>, and <option>check_local_user</option> but before any other preconditions
33652 are tested. A newline is added to the text if it does not end with one.
33653 The variable <varname>$router_name</varname> contains the name of the router.
33654 </para>
33655 <para>
33656 <indexterm role="option">
33657 <primary><option>disable_logging</option></primary>
33658 </indexterm>
33659 </para>
33660 <informaltable frame="all">
33661 <tgroup cols="4" colsep="0" rowsep="0">
33662 <colspec colwidth="8*" align="left"/>
33663 <colspec colwidth="6*" align="center"/>
33664 <colspec colwidth="6*" align="center"/>
33665 <colspec colwidth="6*" align="right"/>
33666 <tbody>
33667 <row>
33668 <entry><option>disable_logging</option></entry>
33669 <entry>Use: <emphasis>routers</emphasis></entry>
33670 <entry>Type: <emphasis>boolean</emphasis></entry>
33671 <entry>Default: <emphasis>false</emphasis></entry>
33672 </row>
33673 </tbody>
33674 </tgroup>
33675 </informaltable>
33676 <para>
33677 If this option is set true, nothing is logged for any routing errors
33678 or for any deliveries caused by this router. You should not set this option
33679 unless you really, really know what you are doing. See also the generic
33680 transport option of the same name.
33681 </para>
33682 <para>
33683 <indexterm role="option">
33684 <primary><option>dnssec_request_domains</option></primary>
33685 </indexterm>
33686 </para>
33687 <informaltable frame="all">
33688 <tgroup cols="4" colsep="0" rowsep="0">
33689 <colspec colwidth="8*" align="left"/>
33690 <colspec colwidth="6*" align="center"/>
33691 <colspec colwidth="6*" align="center"/>
33692 <colspec colwidth="6*" align="right"/>
33693 <tbody>
33694 <row>
33695 <entry><option>dnssec_request_domains</option></entry>
33696 <entry>Use: <emphasis>routers</emphasis></entry>
33697 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
33698 <entry>Default: <emphasis>unset</emphasis></entry>
33699 </row>
33700 </tbody>
33701 </tgroup>
33702 </informaltable>
33703 <para>
33704 <indexterm role="concept">
33705 <primary>MX record</primary>
33706 <secondary>security</secondary>
33707 </indexterm>
33708 <indexterm role="concept">
33709 <primary>DNSSEC</primary>
33710 <secondary>MX lookup</secondary>
33711 </indexterm>
33712 <indexterm role="concept">
33713 <primary>security</primary>
33714 <secondary>MX lookup</secondary>
33715 </indexterm>
33716 <indexterm role="concept">
33717 <primary>DNS</primary>
33718 <secondary>DNSSEC</secondary>
33719 </indexterm>
33720 DNS lookups for domains matching <option>dnssec_request_domains</option> will be done with
33721 the dnssec request bit set.
33722 This applies to all of the SRV, MX, AAAA, A lookup sequence.
33723 </para>
33724 <para>
33725 <indexterm role="option">
33726 <primary><option>dnssec_require_domains</option></primary>
33727 </indexterm>
33728 </para>
33729 <informaltable frame="all">
33730 <tgroup cols="4" colsep="0" rowsep="0">
33731 <colspec colwidth="8*" align="left"/>
33732 <colspec colwidth="6*" align="center"/>
33733 <colspec colwidth="6*" align="center"/>
33734 <colspec colwidth="6*" align="right"/>
33735 <tbody>
33736 <row>
33737 <entry><option>dnssec_require_domains</option></entry>
33738 <entry>Use: <emphasis>routers</emphasis></entry>
33739 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
33740 <entry>Default: <emphasis>unset</emphasis></entry>
33741 </row>
33742 </tbody>
33743 </tgroup>
33744 </informaltable>
33745 <para>
33746 <indexterm role="concept">
33747 <primary>MX record</primary>
33748 <secondary>security</secondary>
33749 </indexterm>
33750 <indexterm role="concept">
33751 <primary>DNSSEC</primary>
33752 <secondary>MX lookup</secondary>
33753 </indexterm>
33754 <indexterm role="concept">
33755 <primary>security</primary>
33756 <secondary>MX lookup</secondary>
33757 </indexterm>
33758 <indexterm role="concept">
33759 <primary>DNS</primary>
33760 <secondary>DNSSEC</secondary>
33761 </indexterm>
33762 DNS lookups for domains matching <option>dnssec_require_domains</option> will be done with
33763 the dnssec request bit set.  Any returns not having the Authenticated Data bit
33764 (AD bit) set will be ignored and logged as a host-lookup failure.
33765 This applies to all of the SRV, MX, AAAA, A lookup sequence.
33766 </para>
33767 <para>
33768 <indexterm role="option">
33769 <primary><option>domains</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>domains</option></entry>
33781 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
33782 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
33783 <entry>Default: <emphasis>unset</emphasis></entry>
33784 </row>
33785 </tbody>
33786 </tgroup>
33787 </informaltable>
33788 <para>
33789 <indexterm role="concept">
33790 <primary>router</primary>
33791 <secondary>restricting to specific domains</secondary>
33792 </indexterm>
33793 <indexterm role="variable">
33794 <primary><varname>$domain_data</varname></primary>
33795 </indexterm>
33796 If this option is set, the router is skipped unless the current domain matches
33797 the list. If the match is achieved by means of a file lookup, the data that the
33798 lookup returned for the domain is placed in <varname>$domain_data</varname> for use in string
33799 expansions of the driver&#x2019;s private options. See section <xref linkend="SECTrouprecon"/> for
33800 a list of the order in which preconditions are evaluated.
33801 </para>
33802 <para>
33803 <indexterm role="option">
33804 <primary><option>driver</option></primary>
33805 </indexterm>
33806 </para>
33807 <informaltable frame="all">
33808 <tgroup cols="4" colsep="0" rowsep="0">
33809 <colspec colwidth="8*" align="left"/>
33810 <colspec colwidth="6*" align="center"/>
33811 <colspec colwidth="6*" align="center"/>
33812 <colspec colwidth="6*" align="right"/>
33813 <tbody>
33814 <row>
33815 <entry><option>driver</option></entry>
33816 <entry>Use: <emphasis>routers</emphasis></entry>
33817 <entry>Type: <emphasis>string</emphasis></entry>
33818 <entry>Default: <emphasis>unset</emphasis></entry>
33819 </row>
33820 </tbody>
33821 </tgroup>
33822 </informaltable>
33823 <para>
33824 This option must always be set. It specifies which of the available routers is
33825 to be used.
33826 </para>
33827 <para>
33828 <indexterm role="option">
33829 <primary><option>dsn_lasthop</option></primary>
33830 </indexterm>
33831 </para>
33832 <informaltable frame="all">
33833 <tgroup cols="4" colsep="0" rowsep="0">
33834 <colspec colwidth="8*" align="left"/>
33835 <colspec colwidth="6*" align="center"/>
33836 <colspec colwidth="6*" align="center"/>
33837 <colspec colwidth="6*" align="right"/>
33838 <tbody>
33839 <row>
33840 <entry><option>dsn_lasthop</option></entry>
33841 <entry>Use: <emphasis>routers</emphasis></entry>
33842 <entry>Type: <emphasis>boolean</emphasis></entry>
33843 <entry>Default: <emphasis>false</emphasis></entry>
33844 </row>
33845 </tbody>
33846 </tgroup>
33847 </informaltable>
33848 <para>
33849 <indexterm role="concept">
33850 <primary>DSN</primary>
33851 <secondary>success</secondary>
33852 </indexterm>
33853 <indexterm role="concept">
33854 <primary>Delivery Status Notification</primary>
33855 <secondary>success</secondary>
33856 </indexterm>
33857 If this option is set true, and extended DSN (RFC3461) processing is in effect,
33858 Exim will not pass on DSN requests to downstream DSN-aware hosts but will
33859 instead send a success DSN as if the next hop does not support DSN.
33860 Not effective on redirect routers.
33861 </para>
33862 <para>
33863 <indexterm role="option">
33864 <primary><option>errors_to</option></primary>
33865 </indexterm>
33866 </para>
33867 <informaltable frame="all">
33868 <tgroup cols="4" colsep="0" rowsep="0">
33869 <colspec colwidth="8*" align="left"/>
33870 <colspec colwidth="6*" align="center"/>
33871 <colspec colwidth="6*" align="center"/>
33872 <colspec colwidth="6*" align="right"/>
33873 <tbody>
33874 <row>
33875 <entry><option>errors_to</option></entry>
33876 <entry>Use: <emphasis>routers</emphasis></entry>
33877 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33878 <entry>Default: <emphasis>unset</emphasis></entry>
33879 </row>
33880 </tbody>
33881 </tgroup>
33882 </informaltable>
33883 <para>
33884 <indexterm role="concept">
33885 <primary>envelope sender</primary>
33886 </indexterm>
33887 <indexterm role="concept">
33888 <primary>router</primary>
33889 <secondary>changing address for errors</secondary>
33890 </indexterm>
33891 If a router successfully handles an address, it may assign the address to a
33892 transport for delivery or it may generate child addresses. In both cases, if
33893 there is a delivery problem during later processing, the resulting bounce
33894 message is sent to the address that results from expanding this string,
33895 provided that the address verifies successfully. The <option>errors_to</option> option is
33896 expanded before <option>headers_add</option>, <option>headers_remove</option>, and <option>transport</option>.
33897 </para>
33898 <para>
33899 The <option>errors_to</option> setting associated with an address can be overridden if it
33900 subsequently passes through other routers that have their own <option>errors_to</option>
33901 settings, or if the message is delivered by a transport with a <option>return_path</option>
33902 setting.
33903 </para>
33904 <para>
33905 If <option>errors_to</option> is unset, or the expansion is forced to fail, or the result of
33906 the expansion fails to verify, the errors address associated with the incoming
33907 address is used. At top level, this is the envelope sender. A non-forced
33908 expansion failure causes delivery to be deferred.
33909 </para>
33910 <para>
33911 If an address for which <option>errors_to</option> has been set ends up being delivered over
33912 SMTP, the envelope sender for that delivery is the <option>errors_to</option> value, so that
33913 any bounces that are generated by other MTAs on the delivery route are also
33914 sent there. You can set <option>errors_to</option> to the empty string by either of these
33915 settings:
33916 </para>
33917 <literallayout class="monospaced">
33918 errors_to =
33919 errors_to = ""
33920 </literallayout>
33921 <para>
33922 An expansion item that yields an empty string has the same effect. If you do
33923 this, a locally detected delivery error for addresses processed by this router
33924 no longer gives rise to a bounce message; the error is discarded. If the
33925 address is delivered to a remote host, the return path is set to <literal>&lt;&gt;</literal>, unless
33926 overridden by the <option>return_path</option> option on the transport.
33927 </para>
33928 <para>
33929 <indexterm role="variable">
33930 <primary><varname>$address_data</varname></primary>
33931 </indexterm>
33932 If for some reason you want to discard local errors, but use a non-empty
33933 MAIL command for remote delivery, you can preserve the original return
33934 path in <varname>$address_data</varname> in the router, and reinstate it in the transport by
33935 setting <option>return_path</option>.
33936 </para>
33937 <para>
33938 The most common use of <option>errors_to</option> is to direct mailing list bounces to the
33939 manager of the list, as described in section <xref linkend="SECTmailinglists"/>, or to
33940 implement VERP (Variable Envelope Return Paths) (see section <xref linkend="SECTverp"/>).
33941 </para>
33942 <para>
33943 <indexterm role="option">
33944 <primary><option>expn</option></primary>
33945 </indexterm>
33946 </para>
33947 <informaltable frame="all">
33948 <tgroup cols="4" colsep="0" rowsep="0">
33949 <colspec colwidth="8*" align="left"/>
33950 <colspec colwidth="6*" align="center"/>
33951 <colspec colwidth="6*" align="center"/>
33952 <colspec colwidth="6*" align="right"/>
33953 <tbody>
33954 <row>
33955 <entry><option>expn</option></entry>
33956 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
33957 <entry>Type: <emphasis>boolean</emphasis></entry>
33958 <entry>Default: <emphasis>true</emphasis></entry>
33959 </row>
33960 </tbody>
33961 </tgroup>
33962 </informaltable>
33963 <para>
33964 <indexterm role="concept">
33965 <primary>address</primary>
33966 <secondary>testing</secondary>
33967 </indexterm>
33968 <indexterm role="concept">
33969 <primary>testing</primary>
33970 <secondary>addresses</secondary>
33971 </indexterm>
33972 <indexterm role="concept">
33973 <primary>EXPN</primary>
33974 <secondary>router skipping</secondary>
33975 </indexterm>
33976 <indexterm role="concept">
33977 <primary>router</primary>
33978 <secondary>skipping for EXPN</secondary>
33979 </indexterm>
33980 If this option is turned off, the router is skipped when testing an address
33981 as a result of processing an SMTP EXPN command. You might, for example,
33982 want to turn it off on a router for users&#x2019; <filename>.forward</filename> files, while leaving it
33983 on for the system alias file.
33984 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
33985 are evaluated.
33986 </para>
33987 <para>
33988 The use of the SMTP EXPN command is controlled by an ACL (see chapter
33989 <xref linkend="CHAPACL"/>). When Exim is running an EXPN command, it is similar to testing
33990 an address with <option>-bt</option>. Compare VRFY, whose counterpart is <option>-bv</option>.
33991 </para>
33992 <para>
33993 <indexterm role="option">
33994 <primary><option>fail_verify</option></primary>
33995 </indexterm>
33996 </para>
33997 <informaltable frame="all">
33998 <tgroup cols="4" colsep="0" rowsep="0">
33999 <colspec colwidth="8*" align="left"/>
34000 <colspec colwidth="6*" align="center"/>
34001 <colspec colwidth="6*" align="center"/>
34002 <colspec colwidth="6*" align="right"/>
34003 <tbody>
34004 <row>
34005 <entry><option>fail_verify</option></entry>
34006 <entry>Use: <emphasis>routers</emphasis></entry>
34007 <entry>Type: <emphasis>boolean</emphasis></entry>
34008 <entry>Default: <emphasis>false</emphasis></entry>
34009 </row>
34010 </tbody>
34011 </tgroup>
34012 </informaltable>
34013 <para>
34014 <indexterm role="concept">
34015 <primary>router</primary>
34016 <secondary>forcing verification failure</secondary>
34017 </indexterm>
34018 Setting this option has the effect of setting both <option>fail_verify_sender</option> and
34019 <option>fail_verify_recipient</option> to the same value.
34020 </para>
34021 <para>
34022 <indexterm role="option">
34023 <primary><option>fail_verify_recipient</option></primary>
34024 </indexterm>
34025 </para>
34026 <informaltable frame="all">
34027 <tgroup cols="4" colsep="0" rowsep="0">
34028 <colspec colwidth="8*" align="left"/>
34029 <colspec colwidth="6*" align="center"/>
34030 <colspec colwidth="6*" align="center"/>
34031 <colspec colwidth="6*" align="right"/>
34032 <tbody>
34033 <row>
34034 <entry><option>fail_verify_recipient</option></entry>
34035 <entry>Use: <emphasis>routers</emphasis></entry>
34036 <entry>Type: <emphasis>boolean</emphasis></entry>
34037 <entry>Default: <emphasis>false</emphasis></entry>
34038 </row>
34039 </tbody>
34040 </tgroup>
34041 </informaltable>
34042 <para>
34043 If this option is true and an address is accepted by this router when
34044 verifying a recipient, verification fails.
34045 </para>
34046 <para>
34047 <indexterm role="option">
34048 <primary><option>fail_verify_sender</option></primary>
34049 </indexterm>
34050 </para>
34051 <informaltable frame="all">
34052 <tgroup cols="4" colsep="0" rowsep="0">
34053 <colspec colwidth="8*" align="left"/>
34054 <colspec colwidth="6*" align="center"/>
34055 <colspec colwidth="6*" align="center"/>
34056 <colspec colwidth="6*" align="right"/>
34057 <tbody>
34058 <row>
34059 <entry><option>fail_verify_sender</option></entry>
34060 <entry>Use: <emphasis>routers</emphasis></entry>
34061 <entry>Type: <emphasis>boolean</emphasis></entry>
34062 <entry>Default: <emphasis>false</emphasis></entry>
34063 </row>
34064 </tbody>
34065 </tgroup>
34066 </informaltable>
34067 <para>
34068 If this option is true and an address is accepted by this router when
34069 verifying a sender, verification fails.
34070 </para>
34071 <para>
34072 <indexterm role="option">
34073 <primary><option>fallback_hosts</option></primary>
34074 </indexterm>
34075 </para>
34076 <informaltable frame="all">
34077 <tgroup cols="4" colsep="0" rowsep="0">
34078 <colspec colwidth="8*" align="left"/>
34079 <colspec colwidth="6*" align="center"/>
34080 <colspec colwidth="6*" align="center"/>
34081 <colspec colwidth="6*" align="right"/>
34082 <tbody>
34083 <row>
34084 <entry><option>fallback_hosts</option></entry>
34085 <entry>Use: <emphasis>routers</emphasis></entry>
34086 <entry>Type: <emphasis>string list</emphasis></entry>
34087 <entry>Default: <emphasis>unset</emphasis></entry>
34088 </row>
34089 </tbody>
34090 </tgroup>
34091 </informaltable>
34092 <para>
34093 <indexterm role="concept">
34094 <primary>router</primary>
34095 <secondary>fallback hosts</secondary>
34096 </indexterm>
34097 <indexterm role="concept">
34098 <primary>fallback</primary>
34099 <secondary>hosts specified on router</secondary>
34100 </indexterm>
34101 String expansion is not applied to this option. The argument must be a
34102 colon-separated list of host names or IP addresses. The list separator can be
34103 changed (see section <xref linkend="SECTlistsepchange"/>), and a port can be specified with
34104 each name or address. In fact, the format of each item is exactly the same as
34105 defined for the list of hosts in a <command>manualroute</command> router (see section
34106 <xref linkend="SECTformatonehostitem"/>).
34107 </para>
34108 <para>
34109 If a router queues an address for a remote transport, this host list is
34110 associated with the address, and used instead of the transport&#x2019;s fallback host
34111 list. If <option>hosts_randomize</option> is set on the transport, the order of the list is
34112 randomized for each use. See the <option>fallback_hosts</option> option of the <command>smtp</command>
34113 transport for further details.
34114 </para>
34115 <para>
34116 <indexterm role="option">
34117 <primary><option>group</option></primary>
34118 </indexterm>
34119 </para>
34120 <informaltable frame="all">
34121 <tgroup cols="4" colsep="0" rowsep="0">
34122 <colspec colwidth="8*" align="left"/>
34123 <colspec colwidth="6*" align="center"/>
34124 <colspec colwidth="6*" align="center"/>
34125 <colspec colwidth="6*" align="right"/>
34126 <tbody>
34127 <row>
34128 <entry><option>group</option></entry>
34129 <entry>Use: <emphasis>routers</emphasis></entry>
34130 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34131 <entry>Default: <emphasis>see below</emphasis></entry>
34132 </row>
34133 </tbody>
34134 </tgroup>
34135 </informaltable>
34136 <para>
34137 <indexterm role="concept">
34138 <primary>gid (group id)</primary>
34139 <secondary>local delivery</secondary>
34140 </indexterm>
34141 <indexterm role="concept">
34142 <primary>local transports</primary>
34143 <secondary>uid and gid</secondary>
34144 </indexterm>
34145 <indexterm role="concept">
34146 <primary>transport</primary>
34147 <secondary>local</secondary>
34148 </indexterm>
34149 <indexterm role="concept">
34150 <primary>router</primary>
34151 <secondary>setting group</secondary>
34152 </indexterm>
34153 When a router queues an address for a transport, and the transport does not
34154 specify a group, the group given here is used when running the delivery
34155 process.
34156 The group may be specified numerically or by name. If expansion fails, the
34157 error is logged and delivery is deferred.
34158 The default is unset, unless <option>check_local_user</option> is set, when the default
34159 is taken from the password information. See also <option>initgroups</option> and <option>user</option>
34160 and the discussion in chapter <xref linkend="CHAPenvironment"/>.
34161 </para>
34162 <para>
34163 <indexterm role="option">
34164 <primary><option>headers_add</option></primary>
34165 </indexterm>
34166 </para>
34167 <informaltable frame="all">
34168 <tgroup cols="4" colsep="0" rowsep="0">
34169 <colspec colwidth="8*" align="left"/>
34170 <colspec colwidth="6*" align="center"/>
34171 <colspec colwidth="6*" align="center"/>
34172 <colspec colwidth="6*" align="right"/>
34173 <tbody>
34174 <row>
34175 <entry><option>headers_add</option></entry>
34176 <entry>Use: <emphasis>routers</emphasis></entry>
34177 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
34178 <entry>Default: <emphasis>unset</emphasis></entry>
34179 </row>
34180 </tbody>
34181 </tgroup>
34182 </informaltable>
34183 <para>
34184 <indexterm role="concept">
34185 <primary>header lines</primary>
34186 <secondary>adding</secondary>
34187 </indexterm>
34188 <indexterm role="concept">
34189 <primary>router</primary>
34190 <secondary>adding header lines</secondary>
34191 </indexterm>
34192 This option specifies a list of text headers,
34193 newline-separated (by default, changeable in the usual way <xref linkend="SECTlistsepchange"/>),
34194 that is associated with any addresses that are accepted by the router.
34195 Each item is separately expanded, at routing time.  However, this
34196 option has no effect when an address is just being verified. The way in which
34197 the text is used to add header lines at transport time is described in section
34198 <xref linkend="SECTheadersaddrem"/>. New header lines are not actually added until the
34199 message is in the process of being transported. This means that references to
34200 header lines in string expansions in the transport&#x2019;s configuration do not
34201 <quote>see</quote> the added header lines.
34202 </para>
34203 <para>
34204 The <option>headers_add</option> option is expanded after <option>errors_to</option>, but before
34205 <option>headers_remove</option> and <option>transport</option>. If an item is empty, or if
34206 an item expansion is forced to fail, the item has no effect. Other expansion
34207 failures are treated as configuration errors.
34208 </para>
34209 <para>
34210 Unlike most options, <option>headers_add</option> can be specified multiple times
34211 for a router; all listed headers are added.
34212 </para>
34213 <para>
34214 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_add</option> option cannot be used for a <command>redirect</command>
34215 router that has the <option>one_time</option> option set.
34216 </para>
34217 <para>
34218 <indexterm role="concept">
34219 <primary>duplicate addresses</primary>
34220 </indexterm>
34221 <indexterm role="option">
34222 <primary><option>unseen</option></primary>
34223 </indexterm>
34224 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
34225 additions are deleted when the address is passed on to subsequent routers.
34226 For a <option>redirect</option> router, if a generated address is the same as the incoming
34227 address, this can lead to duplicate addresses with different header
34228 modifications. Exim does not do duplicate deliveries (except, in certain
34229 circumstances, to pipes -- see section <xref linkend="SECTdupaddr"/>), but it is undefined
34230 which of the duplicates is discarded, so this ambiguous situation should be
34231 avoided. The <option>repeat_use</option> option of the <option>redirect</option> router may be of help.
34232 </para>
34233 <para>
34234 <indexterm role="option">
34235 <primary><option>headers_remove</option></primary>
34236 </indexterm>
34237 </para>
34238 <informaltable frame="all">
34239 <tgroup cols="4" colsep="0" rowsep="0">
34240 <colspec colwidth="8*" align="left"/>
34241 <colspec colwidth="6*" align="center"/>
34242 <colspec colwidth="6*" align="center"/>
34243 <colspec colwidth="6*" align="right"/>
34244 <tbody>
34245 <row>
34246 <entry><option>headers_remove</option></entry>
34247 <entry>Use: <emphasis>routers</emphasis></entry>
34248 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
34249 <entry>Default: <emphasis>unset</emphasis></entry>
34250 </row>
34251 </tbody>
34252 </tgroup>
34253 </informaltable>
34254 <para>
34255 <indexterm role="concept">
34256 <primary>header lines</primary>
34257 <secondary>removing</secondary>
34258 </indexterm>
34259 <indexterm role="concept">
34260 <primary>router</primary>
34261 <secondary>removing header lines</secondary>
34262 </indexterm>
34263 This option specifies a list of text headers,
34264 colon-separated (by default, changeable in the usual way <xref linkend="SECTlistsepchange"/>),
34265 that is associated with any addresses that are accepted by the router.
34266 Each item is separately expanded, at routing time.  However, this
34267 option has no effect when an address is just being verified. The way in which
34268 the text is used to remove header lines at transport time is described in
34269 section <xref linkend="SECTheadersaddrem"/>. Header lines are not actually removed until
34270 the message is in the process of being transported. This means that references
34271 to header lines in string expansions in the transport&#x2019;s configuration still
34272 <quote>see</quote> the original header lines.
34273 </para>
34274 <para>
34275 The <option>headers_remove</option> option is expanded after <option>errors_to</option> and
34276 <option>headers_add</option>, but before <option>transport</option>. If an item expansion is forced to fail,
34277 the item has no effect. Other expansion failures are treated as configuration
34278 errors.
34279 </para>
34280 <para>
34281 Unlike most options, <option>headers_remove</option> can be specified multiple times
34282 for a router; all listed headers are removed.
34283 </para>
34284 <para>
34285 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_remove</option> option cannot be used for a <command>redirect</command>
34286 router that has the <option>one_time</option> option set.
34287 </para>
34288 <para>
34289 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
34290 removal requests are deleted when the address is passed on to subsequent
34291 routers, and this can lead to problems with duplicates -- see the similar
34292 warning for <option>headers_add</option> above.
34293 </para>
34294 <para>
34295 <emphasis role="bold">Warning 3</emphasis>: Because of the separate expansion of the list items,
34296 items that contain a list separator must have it doubled.
34297 To avoid this, change the list separator (<xref linkend="SECTlistsepchange"/>).
34298 </para>
34299 <para>
34300 <indexterm role="option">
34301 <primary><option>ignore_target_hosts</option></primary>
34302 </indexterm>
34303 </para>
34304 <informaltable frame="all">
34305 <tgroup cols="4" colsep="0" rowsep="0">
34306 <colspec colwidth="8*" align="left"/>
34307 <colspec colwidth="6*" align="center"/>
34308 <colspec colwidth="6*" align="center"/>
34309 <colspec colwidth="6*" align="right"/>
34310 <tbody>
34311 <row>
34312 <entry><option>ignore_target_hosts</option></entry>
34313 <entry>Use: <emphasis>routers</emphasis></entry>
34314 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
34315 <entry>Default: <emphasis>unset</emphasis></entry>
34316 </row>
34317 </tbody>
34318 </tgroup>
34319 </informaltable>
34320 <para>
34321 <indexterm role="concept">
34322 <primary>IP address</primary>
34323 <secondary>discarding</secondary>
34324 </indexterm>
34325 <indexterm role="concept">
34326 <primary>router</primary>
34327 <secondary>discarding IP addresses</secondary>
34328 </indexterm>
34329 Although this option is a host list, it should normally contain IP address
34330 entries rather than names. If any host that is looked up by the router has an
34331 IP address that matches an item in this list, Exim behaves as if that IP
34332 address did not exist. This option allows you to cope with rogue DNS entries
34333 like
34334 </para>
34335 <literallayout class="monospaced">
34336 remote.domain.example.  A  127.0.0.1
34337 </literallayout>
34338 <para>
34339 by setting
34340 </para>
34341 <literallayout class="monospaced">
34342 ignore_target_hosts = 127.0.0.1
34343 </literallayout>
34344 <para>
34345 on the relevant router. If all the hosts found by a <command>dnslookup</command> router are
34346 discarded in this way, the router declines. In a conventional configuration, an
34347 attempt to mail to such a domain would normally provoke the <quote>unrouteable
34348 domain</quote> error, and an attempt to verify an address in the domain would fail.
34349 Similarly, if <option>ignore_target_hosts</option> is set on an <command>ipliteral</command> router, the
34350 router declines if presented with one of the listed addresses.
34351 </para>
34352 <para>
34353 You can use this option to disable the use of IPv4 or IPv6 for mail delivery by
34354 means of the first or the second of the following settings, respectively:
34355 </para>
34356 <literallayout class="monospaced">
34357 ignore_target_hosts = 0.0.0.0/0
34358 ignore_target_hosts = &lt;; 0::0/0
34359 </literallayout>
34360 <para>
34361 The pattern in the first line matches all IPv4 addresses, whereas the pattern
34362 in the second line matches all IPv6 addresses.
34363 </para>
34364 <para>
34365 This option may also be useful for ignoring link-local and site-local IPv6
34366 addresses. Because, like all host lists, the value of <option>ignore_target_hosts</option>
34367 is expanded before use as a list, it is possible to make it dependent on the
34368 domain that is being routed.
34369 </para>
34370 <para>
34371 <indexterm role="variable">
34372 <primary><varname>$host_address</varname></primary>
34373 </indexterm>
34374 During its expansion, <varname>$host_address</varname> is set to the IP address that is being
34375 checked.
34376 </para>
34377 <para>
34378 <indexterm role="option">
34379 <primary><option>initgroups</option></primary>
34380 </indexterm>
34381 </para>
34382 <informaltable frame="all">
34383 <tgroup cols="4" colsep="0" rowsep="0">
34384 <colspec colwidth="8*" align="left"/>
34385 <colspec colwidth="6*" align="center"/>
34386 <colspec colwidth="6*" align="center"/>
34387 <colspec colwidth="6*" align="right"/>
34388 <tbody>
34389 <row>
34390 <entry><option>initgroups</option></entry>
34391 <entry>Use: <emphasis>routers</emphasis></entry>
34392 <entry>Type: <emphasis>boolean</emphasis></entry>
34393 <entry>Default: <emphasis>false</emphasis></entry>
34394 </row>
34395 </tbody>
34396 </tgroup>
34397 </informaltable>
34398 <para>
34399 <indexterm role="concept">
34400 <primary>additional groups</primary>
34401 </indexterm>
34402 <indexterm role="concept">
34403 <primary>groups</primary>
34404 <secondary>additional</secondary>
34405 </indexterm>
34406 <indexterm role="concept">
34407 <primary>local transports</primary>
34408 <secondary>uid and gid</secondary>
34409 </indexterm>
34410 <indexterm role="concept">
34411 <primary>transport</primary>
34412 <secondary>local</secondary>
34413 </indexterm>
34414 If the router queues an address for a transport, and this option is true, and
34415 the uid supplied by the router is not overridden by the transport, the
34416 <function>initgroups()</function> function is called when running the transport to ensure that
34417 any additional groups associated with the uid are set up. See also <option>group</option>
34418 and <option>user</option> and the discussion in chapter <xref linkend="CHAPenvironment"/>.
34419 </para>
34420 <para>
34421 <indexterm role="option">
34422 <primary><option>local_part_prefix</option></primary>
34423 </indexterm>
34424 </para>
34425 <informaltable frame="all">
34426 <tgroup cols="4" colsep="0" rowsep="0">
34427 <colspec colwidth="8*" align="left"/>
34428 <colspec colwidth="6*" align="center"/>
34429 <colspec colwidth="6*" align="center"/>
34430 <colspec colwidth="6*" align="right"/>
34431 <tbody>
34432 <row>
34433 <entry><option>local_part_prefix</option></entry>
34434 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
34435 <entry>Type: <emphasis>string list</emphasis></entry>
34436 <entry>Default: <emphasis>unset</emphasis></entry>
34437 </row>
34438 </tbody>
34439 </tgroup>
34440 </informaltable>
34441 <para>
34442 <indexterm role="concept">
34443 <primary>affix</primary>
34444 <secondary>router precondition</secondary>
34445 </indexterm>
34446 <indexterm role="concept">
34447 <primary>router</primary>
34448 <secondary>prefix for local part</secondary>
34449 </indexterm>
34450 <indexterm role="concept">
34451 <primary>prefix</primary>
34452 <secondary>for local part, used in router</secondary>
34453 </indexterm>
34454 If this option is set, the router is skipped unless the local part starts with
34455 one of the given strings, or <option>local_part_prefix_optional</option> is true. See
34456 section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions are
34457 evaluated.
34458 </para>
34459 <para>
34460 The list is scanned from left to right, and the first prefix that matches is
34461 used. A limited form of wildcard is available; if the prefix begins with an
34462 asterisk, it matches the longest possible sequence of arbitrary characters at
34463 the start of the local part. An asterisk should therefore always be followed by
34464 some character that does not occur in normal local parts.
34465 <indexterm role="concept">
34466 <primary>multiple mailboxes</primary>
34467 </indexterm>
34468 <indexterm role="concept">
34469 <primary>mailbox</primary>
34470 <secondary>multiple</secondary>
34471 </indexterm>
34472 Wildcarding can be used to set up multiple user mailboxes, as described in
34473 section <xref linkend="SECTmulbox"/>.
34474 </para>
34475 <para>
34476 <indexterm role="variable">
34477 <primary><varname>$local_part</varname></primary>
34478 </indexterm>
34479 <indexterm role="variable">
34480 <primary><varname>$local_part_prefix</varname></primary>
34481 </indexterm>
34482 During the testing of the <option>local_parts</option> option, and while the router is
34483 running, the prefix is removed from the local part, and is available in the
34484 expansion variable <varname>$local_part_prefix</varname>. When a message is being delivered, if
34485 the router accepts the address, this remains true during subsequent delivery by
34486 a transport. In particular, the local part that is transmitted in the RCPT
34487 command for LMTP, SMTP, and BSMTP deliveries has the prefix removed by default.
34488 This behaviour can be overridden by setting <option>rcpt_include_affixes</option> true on
34489 the relevant transport.
34490 </para>
34491 <para>
34492 When an address is being verified, <option>local_part_prefix</option> affects only the
34493 behaviour of the router. If the callout feature of verification is in use, this
34494 means that the full address, including the prefix, will be used during the
34495 callout.
34496 </para>
34497 <para>
34498 The prefix facility is commonly used to handle local parts of the form
34499 <option>owner-something</option>. Another common use is to support local parts of the form
34500 <option>real-username</option> to bypass a user&#x2019;s <filename>.forward</filename> file &ndash; helpful when trying
34501 to tell a user their forwarding is broken &ndash; by placing a router like this one
34502 immediately before the router that handles <filename>.forward</filename> files:
34503 </para>
34504 <literallayout class="monospaced">
34505 real_localuser:
34506   driver = accept
34507   local_part_prefix = real-
34508   check_local_user
34509   transport = local_delivery
34510 </literallayout>
34511 <para>
34512 For security, it would probably be a good idea to restrict the use of this
34513 router to locally-generated messages, using a condition such as this:
34514 </para>
34515 <literallayout class="monospaced">
34516   condition = ${if match {$sender_host_address}\
34517                          {\N^(|127\.0\.0\.1)$\N}}
34518 </literallayout>
34519 <para>
34520 If both <option>local_part_prefix</option> and <option>local_part_suffix</option> are set for a router,
34521 both conditions must be met if not optional. Care must be taken if wildcards
34522 are used in both a prefix and a suffix on the same router. Different
34523 separator characters must be used to avoid ambiguity.
34524 </para>
34525 <para>
34526 <indexterm role="option">
34527 <primary><option>local_part_prefix_optional</option></primary>
34528 </indexterm>
34529 </para>
34530 <informaltable frame="all">
34531 <tgroup cols="4" colsep="0" rowsep="0">
34532 <colspec colwidth="8*" align="left"/>
34533 <colspec colwidth="6*" align="center"/>
34534 <colspec colwidth="6*" align="center"/>
34535 <colspec colwidth="6*" align="right"/>
34536 <tbody>
34537 <row>
34538 <entry><option>local_part_prefix_optional</option></entry>
34539 <entry>Use: <emphasis>routers</emphasis></entry>
34540 <entry>Type: <emphasis>boolean</emphasis></entry>
34541 <entry>Default: <emphasis>false</emphasis></entry>
34542 </row>
34543 </tbody>
34544 </tgroup>
34545 </informaltable>
34546 <para>
34547 See <option>local_part_prefix</option> above.
34548 </para>
34549 <para>
34550 <indexterm role="option">
34551 <primary><option>local_part_suffix</option></primary>
34552 </indexterm>
34553 </para>
34554 <informaltable frame="all">
34555 <tgroup cols="4" colsep="0" rowsep="0">
34556 <colspec colwidth="8*" align="left"/>
34557 <colspec colwidth="6*" align="center"/>
34558 <colspec colwidth="6*" align="center"/>
34559 <colspec colwidth="6*" align="right"/>
34560 <tbody>
34561 <row>
34562 <entry><option>local_part_suffix</option></entry>
34563 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
34564 <entry>Type: <emphasis>string list</emphasis></entry>
34565 <entry>Default: <emphasis>unset</emphasis></entry>
34566 </row>
34567 </tbody>
34568 </tgroup>
34569 </informaltable>
34570 <para>
34571 <indexterm role="concept">
34572 <primary>router</primary>
34573 <secondary>suffix for local part</secondary>
34574 </indexterm>
34575 <indexterm role="concept">
34576 <primary>suffix for local part</primary>
34577 <secondary>used in router</secondary>
34578 </indexterm>
34579 This option operates in the same way as <option>local_part_prefix</option>, except that the
34580 local part must end (rather than start) with the given string, the
34581 <option>local_part_suffix_optional</option> option determines whether the suffix is
34582 mandatory, and the wildcard * character, if present, must be the last
34583 character of the suffix. This option facility is commonly used to handle local
34584 parts of the form <option>something-request</option> and multiple user mailboxes of the form
34585 <option>username-foo</option>.
34586 </para>
34587 <para>
34588 <indexterm role="option">
34589 <primary><option>local_part_suffix_optional</option></primary>
34590 </indexterm>
34591 </para>
34592 <informaltable frame="all">
34593 <tgroup cols="4" colsep="0" rowsep="0">
34594 <colspec colwidth="8*" align="left"/>
34595 <colspec colwidth="6*" align="center"/>
34596 <colspec colwidth="6*" align="center"/>
34597 <colspec colwidth="6*" align="right"/>
34598 <tbody>
34599 <row>
34600 <entry><option>local_part_suffix_optional</option></entry>
34601 <entry>Use: <emphasis>routers</emphasis></entry>
34602 <entry>Type: <emphasis>boolean</emphasis></entry>
34603 <entry>Default: <emphasis>false</emphasis></entry>
34604 </row>
34605 </tbody>
34606 </tgroup>
34607 </informaltable>
34608 <para>
34609 See <option>local_part_suffix</option> above.
34610 </para>
34611 <para>
34612 <indexterm role="option">
34613 <primary><option>local_parts</option></primary>
34614 </indexterm>
34615 </para>
34616 <informaltable frame="all">
34617 <tgroup cols="4" colsep="0" rowsep="0">
34618 <colspec colwidth="8*" align="left"/>
34619 <colspec colwidth="6*" align="center"/>
34620 <colspec colwidth="6*" align="center"/>
34621 <colspec colwidth="6*" align="right"/>
34622 <tbody>
34623 <row>
34624 <entry><option>local_parts</option></entry>
34625 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
34626 <entry>Type: <emphasis>local part list</emphasis>&dagger;<emphasis></emphasis></entry>
34627 <entry>Default: <emphasis>unset</emphasis></entry>
34628 </row>
34629 </tbody>
34630 </tgroup>
34631 </informaltable>
34632 <para>
34633 <indexterm role="concept">
34634 <primary>router</primary>
34635 <secondary>restricting to specific local parts</secondary>
34636 </indexterm>
34637 <indexterm role="concept">
34638 <primary>local part</primary>
34639 <secondary>checking in router</secondary>
34640 </indexterm>
34641 The router is run only if the local part of the address matches the list.
34642 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
34643 are evaluated, and
34644 section <xref linkend="SECTlocparlis"/> for a discussion of local part lists. Because the
34645 string is expanded, it is possible to make it depend on the domain, for
34646 example:
34647 </para>
34648 <literallayout class="monospaced">
34649 local_parts = dbm;/usr/local/specials/$domain
34650 </literallayout>
34651 <para>
34652 <indexterm role="variable">
34653 <primary><varname>$local_part_data</varname></primary>
34654 </indexterm>
34655 If the match is achieved by a lookup, the data that the lookup returned
34656 for the local part is placed in the variable <varname>$local_part_data</varname> for use in
34657 expansions of the router&#x2019;s private options. You might use this option, for
34658 example, if you have a large number of local virtual domains, and you want to
34659 send all postmaster mail to the same place without having to set up an alias in
34660 each virtual domain:
34661 </para>
34662 <literallayout class="monospaced">
34663 postmaster:
34664   driver = redirect
34665   local_parts = postmaster
34666   data = postmaster@real.domain.example
34667 </literallayout>
34668 <para>
34669 <indexterm role="option">
34670 <primary><option>log_as_local</option></primary>
34671 </indexterm>
34672 </para>
34673 <informaltable frame="all">
34674 <tgroup cols="4" colsep="0" rowsep="0">
34675 <colspec colwidth="8*" align="left"/>
34676 <colspec colwidth="6*" align="center"/>
34677 <colspec colwidth="6*" align="center"/>
34678 <colspec colwidth="6*" align="right"/>
34679 <tbody>
34680 <row>
34681 <entry><option>log_as_local</option></entry>
34682 <entry>Use: <emphasis>routers</emphasis></entry>
34683 <entry>Type: <emphasis>boolean</emphasis></entry>
34684 <entry>Default: <emphasis>see below</emphasis></entry>
34685 </row>
34686 </tbody>
34687 </tgroup>
34688 </informaltable>
34689 <para>
34690 <indexterm role="concept">
34691 <primary>log</primary>
34692 <secondary>delivery line</secondary>
34693 </indexterm>
34694 <indexterm role="concept">
34695 <primary>delivery</primary>
34696 <secondary>log line format</secondary>
34697 </indexterm>
34698 Exim has two logging styles for delivery, the idea being to make local
34699 deliveries stand out more visibly from remote ones. In the <quote>local</quote> style, the
34700 recipient address is given just as the local part, without a domain. The use of
34701 this style is controlled by this option. It defaults to true for the <command>accept</command>
34702 router, and false for all the others. This option applies only when a
34703 router assigns an address to a transport. It has no effect on routers that
34704 redirect addresses.
34705 </para>
34706 <para>
34707 <indexterm role="option">
34708 <primary><option>more</option></primary>
34709 </indexterm>
34710 </para>
34711 <informaltable frame="all">
34712 <tgroup cols="4" colsep="0" rowsep="0">
34713 <colspec colwidth="8*" align="left"/>
34714 <colspec colwidth="6*" align="center"/>
34715 <colspec colwidth="6*" align="center"/>
34716 <colspec colwidth="6*" align="right"/>
34717 <tbody>
34718 <row>
34719 <entry><option>more</option></entry>
34720 <entry>Use: <emphasis>routers</emphasis></entry>
34721 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
34722 <entry>Default: <emphasis>true</emphasis></entry>
34723 </row>
34724 </tbody>
34725 </tgroup>
34726 </informaltable>
34727 <para>
34728 The result of string expansion for this option must be a valid boolean value,
34729 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
34730 result causes an error, and delivery is deferred. If the expansion is forced to
34731 fail, the default value for the option (true) is used. Other failures cause
34732 delivery to be deferred.
34733 </para>
34734 <para>
34735 If this option is set false, and the router declines to handle the address, no
34736 further routers are tried, routing fails, and the address is bounced.
34737 <indexterm role="option">
34738 <primary><option>self</option></primary>
34739 </indexterm>
34740 However, if the router explicitly passes an address to the following router by
34741 means of the setting
34742 </para>
34743 <literallayout class="monospaced">
34744 self = pass
34745 </literallayout>
34746 <para>
34747 or otherwise, the setting of <option>more</option> is ignored. Also, the setting of <option>more</option>
34748 does not affect the behaviour if one of the precondition tests fails. In that
34749 case, the address is always passed to the next router.
34750 </para>
34751 <para>
34752 Note that <option>address_data</option> is not considered to be a precondition. If its
34753 expansion is forced to fail, the router declines, and the value of <option>more</option>
34754 controls what happens next.
34755 </para>
34756 <para>
34757 <indexterm role="option">
34758 <primary><option>pass_on_timeout</option></primary>
34759 </indexterm>
34760 </para>
34761 <informaltable frame="all">
34762 <tgroup cols="4" colsep="0" rowsep="0">
34763 <colspec colwidth="8*" align="left"/>
34764 <colspec colwidth="6*" align="center"/>
34765 <colspec colwidth="6*" align="center"/>
34766 <colspec colwidth="6*" align="right"/>
34767 <tbody>
34768 <row>
34769 <entry><option>pass_on_timeout</option></entry>
34770 <entry>Use: <emphasis>routers</emphasis></entry>
34771 <entry>Type: <emphasis>boolean</emphasis></entry>
34772 <entry>Default: <emphasis>false</emphasis></entry>
34773 </row>
34774 </tbody>
34775 </tgroup>
34776 </informaltable>
34777 <para>
34778 <indexterm role="concept">
34779 <primary>timeout</primary>
34780 <secondary>of router</secondary>
34781 </indexterm>
34782 <indexterm role="concept">
34783 <primary>router</primary>
34784 <secondary>timeout</secondary>
34785 </indexterm>
34786 If a router times out during a host lookup, it normally causes deferral of the
34787 address. If <option>pass_on_timeout</option> is set, the address is passed on to the next
34788 router, overriding <option>no_more</option>. This may be helpful for systems that are
34789 intermittently connected to the Internet, or those that want to pass to a smart
34790 host any messages that cannot immediately be delivered.
34791 </para>
34792 <para>
34793 There are occasional other temporary errors that can occur while doing DNS
34794 lookups. They are treated in the same way as a timeout, and this option
34795 applies to all of them.
34796 </para>
34797 <para>
34798 <indexterm role="option">
34799 <primary><option>pass_router</option></primary>
34800 </indexterm>
34801 </para>
34802 <informaltable frame="all">
34803 <tgroup cols="4" colsep="0" rowsep="0">
34804 <colspec colwidth="8*" align="left"/>
34805 <colspec colwidth="6*" align="center"/>
34806 <colspec colwidth="6*" align="center"/>
34807 <colspec colwidth="6*" align="right"/>
34808 <tbody>
34809 <row>
34810 <entry><option>pass_router</option></entry>
34811 <entry>Use: <emphasis>routers</emphasis></entry>
34812 <entry>Type: <emphasis>string</emphasis></entry>
34813 <entry>Default: <emphasis>unset</emphasis></entry>
34814 </row>
34815 </tbody>
34816 </tgroup>
34817 </informaltable>
34818 <para>
34819 <indexterm role="concept">
34820 <primary>router</primary>
34821 <secondary>go to after <quote>pass</quote></secondary>
34822 </indexterm>
34823 Routers that recognize the generic <option>self</option> option (<command>dnslookup</command>,
34824 <command>ipliteral</command>, and <command>manualroute</command>) are able to return <quote>pass</quote>, forcing
34825 routing to continue, and overriding a false setting of <option>more</option>. When one of
34826 these routers returns <quote>pass</quote>, the address is normally handed on to the next
34827 router in sequence. This can be changed by setting <option>pass_router</option> to the name
34828 of another router. However (unlike <option>redirect_router</option>) the named router must
34829 be below the current router, to avoid loops. Note that this option applies only
34830 to the special case of <quote>pass</quote>. It does not apply when a router returns
34831 <quote>decline</quote> because it cannot handle an address.
34832 </para>
34833 <para>
34834 <indexterm role="option">
34835 <primary><option>redirect_router</option></primary>
34836 </indexterm>
34837 </para>
34838 <informaltable frame="all">
34839 <tgroup cols="4" colsep="0" rowsep="0">
34840 <colspec colwidth="8*" align="left"/>
34841 <colspec colwidth="6*" align="center"/>
34842 <colspec colwidth="6*" align="center"/>
34843 <colspec colwidth="6*" align="right"/>
34844 <tbody>
34845 <row>
34846 <entry><option>redirect_router</option></entry>
34847 <entry>Use: <emphasis>routers</emphasis></entry>
34848 <entry>Type: <emphasis>string</emphasis></entry>
34849 <entry>Default: <emphasis>unset</emphasis></entry>
34850 </row>
34851 </tbody>
34852 </tgroup>
34853 </informaltable>
34854 <para>
34855 <indexterm role="concept">
34856 <primary>router</primary>
34857 <secondary>start at after redirection</secondary>
34858 </indexterm>
34859 Sometimes an administrator knows that it is pointless to reprocess addresses
34860 generated from alias or forward files with the same router again. For
34861 example, if an alias file translates real names into login ids there is no
34862 point searching the alias file a second time, especially if it is a large file.
34863 </para>
34864 <para>
34865 The <option>redirect_router</option> option can be set to the name of any router instance.
34866 It causes the routing of any generated addresses to start at the named router
34867 instead of at the first router. This option has no effect if the router in
34868 which it is set does not generate new addresses.
34869 </para>
34870 <para>
34871 <indexterm role="option">
34872 <primary><option>require_files</option></primary>
34873 </indexterm>
34874 </para>
34875 <informaltable frame="all">
34876 <tgroup cols="4" colsep="0" rowsep="0">
34877 <colspec colwidth="8*" align="left"/>
34878 <colspec colwidth="6*" align="center"/>
34879 <colspec colwidth="6*" align="center"/>
34880 <colspec colwidth="6*" align="right"/>
34881 <tbody>
34882 <row>
34883 <entry><option>require_files</option></entry>
34884 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
34885 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
34886 <entry>Default: <emphasis>unset</emphasis></entry>
34887 </row>
34888 </tbody>
34889 </tgroup>
34890 </informaltable>
34891 <para>
34892 <indexterm role="concept">
34893 <primary>file</primary>
34894 <secondary>requiring for router</secondary>
34895 </indexterm>
34896 <indexterm role="concept">
34897 <primary>router</primary>
34898 <secondary>requiring file existence</secondary>
34899 </indexterm>
34900 This option provides a general mechanism for predicating the running of a
34901 router on the existence or non-existence of certain files or directories.
34902 Before running a router, as one of its precondition tests, Exim works its way
34903 through the <option>require_files</option> list, expanding each item separately.
34904 </para>
34905 <para>
34906 Because the list is split before expansion, any colons in expansion items must
34907 be doubled, or the facility for using a different list separator must be used
34908 (<xref linkend="SECTlistsepchange"/>).
34909 If any expansion is forced to fail, the item is ignored. Other expansion
34910 failures cause routing of the address to be deferred.
34911 </para>
34912 <para>
34913 If any expanded string is empty, it is ignored. Otherwise, except as described
34914 below, each string must be a fully qualified file path, optionally preceded by
34915 <quote>!</quote>. The paths are passed to the <function>stat()</function> function to test for the
34916 existence of the files or directories. The router is skipped if any paths not
34917 preceded by <quote>!</quote> do not exist, or if any paths preceded by <quote>!</quote> do exist.
34918 </para>
34919 <para>
34920 <indexterm role="concept">
34921 <primary>NFS</primary>
34922 </indexterm>
34923 If <function>stat()</function> cannot determine whether a file exists or not, delivery of
34924 the message is deferred. This can happen when NFS-mounted filesystems are
34925 unavailable.
34926 </para>
34927 <para>
34928 This option is checked after the <option>domains</option>, <option>local_parts</option>, and <option>senders</option>
34929 options, so you cannot use it to check for the existence of a file in which to
34930 look up a domain, local part, or sender. (See section <xref linkend="SECTrouprecon"/> for a
34931 full list of the order in which preconditions are evaluated.) However, as
34932 these options are all expanded, you can use the <option>exists</option> expansion condition
34933 to make such tests. The <option>require_files</option> option is intended for checking files
34934 that the router may be going to use internally, or which are needed by a
34935 transport (e.g., <filename>.procmailrc</filename>).
34936 </para>
34937 <para>
34938 During delivery, the <function>stat()</function> function is run as root, but there is a
34939 facility for some checking of the accessibility of a file by another user.
34940 This is not a proper permissions check, but just a <quote>rough</quote> check that
34941 operates as follows:
34942 </para>
34943 <para>
34944 If an item in a <option>require_files</option> list does not contain any forward slash
34945 characters, it is taken to be the user (and optional group, separated by a
34946 comma) to be checked for subsequent files in the list. If no group is specified
34947 but the user is specified symbolically, the gid associated with the uid is
34948 used. For example:
34949 </para>
34950 <literallayout class="monospaced">
34951 require_files = mail:/some/file
34952 require_files = $local_part:$home/.procmailrc
34953 </literallayout>
34954 <para>
34955 If a user or group name in a <option>require_files</option> list does not exist, the
34956 <option>require_files</option> condition fails.
34957 </para>
34958 <para>
34959 Exim performs the check by scanning along the components of the file path, and
34960 checking the access for the given uid and gid. It checks for <quote>x</quote> access on
34961 directories, and <quote>r</quote> access on the final file. Note that this means that file
34962 access control lists, if the operating system has them, are ignored.
34963 </para>
34964 <para>
34965 <emphasis role="bold">Warning 1</emphasis>: When the router is being run to verify addresses for an
34966 incoming SMTP message, Exim is not running as root, but under its own uid. This
34967 may affect the result of a <option>require_files</option> check. In particular, <function>stat()</function>
34968 may yield the error EACCES (<quote>Permission denied</quote>). This means that the Exim
34969 user is not permitted to read one of the directories on the file&#x2019;s path.
34970 </para>
34971 <para>
34972 <emphasis role="bold">Warning 2</emphasis>: Even when Exim is running as root while delivering a message,
34973 <function>stat()</function> can yield EACCES for a file in an NFS directory that is mounted
34974 without root access. In this case, if a check for access by a particular user
34975 is requested, Exim creates a subprocess that runs as that user, and tries the
34976 check again in that process.
34977 </para>
34978 <para>
34979 The default action for handling an unresolved EACCES is to consider it to
34980 be caused by a configuration error, and routing is deferred because the
34981 existence or non-existence of the file cannot be determined. However, in some
34982 circumstances it may be desirable to treat this condition as if the file did
34983 not exist. If the filename (or the exclamation mark that precedes the filename
34984 for non-existence) is preceded by a plus sign, the EACCES error is treated
34985 as if the file did not exist. For example:
34986 </para>
34987 <literallayout class="monospaced">
34988 require_files = +/some/file
34989 </literallayout>
34990 <para>
34991 If the router is not an essential part of verification (for example, it
34992 handles users&#x2019; <filename>.forward</filename> files), another solution is to set the <option>verify</option>
34993 option false so that the router is skipped when verifying.
34994 </para>
34995 <para>
34996 <indexterm role="option">
34997 <primary><option>retry_use_local_part</option></primary>
34998 </indexterm>
34999 </para>
35000 <informaltable frame="all">
35001 <tgroup cols="4" colsep="0" rowsep="0">
35002 <colspec colwidth="8*" align="left"/>
35003 <colspec colwidth="6*" align="center"/>
35004 <colspec colwidth="6*" align="center"/>
35005 <colspec colwidth="6*" align="right"/>
35006 <tbody>
35007 <row>
35008 <entry><option>retry_use_local_part</option></entry>
35009 <entry>Use: <emphasis>routers</emphasis></entry>
35010 <entry>Type: <emphasis>boolean</emphasis></entry>
35011 <entry>Default: <emphasis>see below</emphasis></entry>
35012 </row>
35013 </tbody>
35014 </tgroup>
35015 </informaltable>
35016 <para>
35017 <indexterm role="concept">
35018 <primary>hints database</primary>
35019 <secondary>retry keys</secondary>
35020 </indexterm>
35021 <indexterm role="concept">
35022 <primary>local part</primary>
35023 <secondary>in retry keys</secondary>
35024 </indexterm>
35025 When a delivery suffers a temporary routing failure, a retry record is created
35026 in Exim&#x2019;s hints database. For addresses whose routing depends only on the
35027 domain, the key for the retry record should not involve the local part, but for
35028 other addresses, both the domain and the local part should be included.
35029 Usually, remote routing is of the former kind, and local routing is of the
35030 latter kind.
35031 </para>
35032 <para>
35033 This option controls whether the local part is used to form the key for retry
35034 hints for addresses that suffer temporary errors while being handled by this
35035 router. The default value is true for any router that has <option>check_local_user</option>
35036 set, and false otherwise. Note that this option does not apply to hints keys
35037 for transport delays; they are controlled by a generic transport option of the
35038 same name.
35039 </para>
35040 <para>
35041 The setting of <option>retry_use_local_part</option> applies only to the router on which it
35042 appears. If the router generates child addresses, they are routed
35043 independently; this setting does not become attached to them.
35044 </para>
35045 <para>
35046 <indexterm role="option">
35047 <primary><option>router_home_directory</option></primary>
35048 </indexterm>
35049 </para>
35050 <informaltable frame="all">
35051 <tgroup cols="4" colsep="0" rowsep="0">
35052 <colspec colwidth="8*" align="left"/>
35053 <colspec colwidth="6*" align="center"/>
35054 <colspec colwidth="6*" align="center"/>
35055 <colspec colwidth="6*" align="right"/>
35056 <tbody>
35057 <row>
35058 <entry><option>router_home_directory</option></entry>
35059 <entry>Use: <emphasis>routers</emphasis></entry>
35060 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35061 <entry>Default: <emphasis>unset</emphasis></entry>
35062 </row>
35063 </tbody>
35064 </tgroup>
35065 </informaltable>
35066 <para>
35067 <indexterm role="concept">
35068 <primary>router</primary>
35069 <secondary>home directory for</secondary>
35070 </indexterm>
35071 <indexterm role="concept">
35072 <primary>home directory</primary>
35073 <secondary>for router</secondary>
35074 </indexterm>
35075 <indexterm role="variable">
35076 <primary><varname>$home</varname></primary>
35077 </indexterm>
35078 This option sets a home directory for use while the router is running. (Compare
35079 <option>transport_home_directory</option>, which sets a home directory for later
35080 transporting.) In particular, if used on a <command>redirect</command> router, this option
35081 sets a value for <varname>$home</varname> while a filter is running. The value is expanded;
35082 forced expansion failure causes the option to be ignored &ndash; other failures
35083 cause the router to defer.
35084 </para>
35085 <para>
35086 Expansion of <option>router_home_directory</option> happens immediately after the
35087 <option>check_local_user</option> test (if configured), before any further expansions take
35088 place.
35089 (See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
35090 are evaluated.)
35091 While the router is running, <option>router_home_directory</option> overrides the value of
35092 <varname>$home</varname> that came from <option>check_local_user</option>.
35093 </para>
35094 <para>
35095 When a router accepts an address and assigns it to a local transport (including
35096 the cases when a <command>redirect</command> router generates a pipe, file, or autoreply
35097 delivery), the home directory setting for the transport is taken from the first
35098 of these values that is set:
35099 </para>
35100 <itemizedlist>
35101 <listitem>
35102 <para>
35103 The <option>home_directory</option> option on the transport;
35104 </para>
35105 </listitem>
35106 <listitem>
35107 <para>
35108 The <option>transport_home_directory</option> option on the router;
35109 </para>
35110 </listitem>
35111 <listitem>
35112 <para>
35113 The password data if <option>check_local_user</option> is set on the router;
35114 </para>
35115 </listitem>
35116 <listitem>
35117 <para>
35118 The <option>router_home_directory</option> option on the router.
35119 </para>
35120 </listitem>
35121 </itemizedlist>
35122 <para>
35123 In other words, <option>router_home_directory</option> overrides the password data for the
35124 router, but not for the transport.
35125 </para>
35126 <para>
35127 <indexterm role="option">
35128 <primary><option>self</option></primary>
35129 </indexterm>
35130 </para>
35131 <informaltable frame="all">
35132 <tgroup cols="4" colsep="0" rowsep="0">
35133 <colspec colwidth="8*" align="left"/>
35134 <colspec colwidth="6*" align="center"/>
35135 <colspec colwidth="6*" align="center"/>
35136 <colspec colwidth="6*" align="right"/>
35137 <tbody>
35138 <row>
35139 <entry><option>self</option></entry>
35140 <entry>Use: <emphasis>routers</emphasis></entry>
35141 <entry>Type: <emphasis>string</emphasis></entry>
35142 <entry>Default: <emphasis>freeze</emphasis></entry>
35143 </row>
35144 </tbody>
35145 </tgroup>
35146 </informaltable>
35147 <para>
35148 <indexterm role="concept">
35149 <primary>MX record</primary>
35150 <secondary>pointing to local host</secondary>
35151 </indexterm>
35152 <indexterm role="concept">
35153 <primary>local host</primary>
35154 <secondary>MX pointing to</secondary>
35155 </indexterm>
35156 This option applies to those routers that use a recipient address to find a
35157 list of remote hosts. Currently, these are the <command>dnslookup</command>, <command>ipliteral</command>,
35158 and <command>manualroute</command> routers.
35159 Certain configurations of the <command>queryprogram</command> router can also specify a list
35160 of remote hosts.
35161 Usually such routers are configured to send the message to a remote host via an
35162 <command>smtp</command> transport. The <option>self</option> option specifies what happens when the first
35163 host on the list turns out to be the local host.
35164 The way in which Exim checks for the local host is described in section
35165 <xref linkend="SECTreclocipadd"/>.
35166 </para>
35167 <para>
35168 Normally this situation indicates either an error in Exim&#x2019;s configuration (for
35169 example, the router should be configured not to process this domain), or an
35170 error in the DNS (for example, the MX should not point to this host). For this
35171 reason, the default action is to log the incident, defer the address, and
35172 freeze the message. The following alternatives are provided for use in special
35173 cases:
35174 </para>
35175 <variablelist>
35176 <varlistentry>
35177 <term><option>defer</option></term>
35178 <listitem>
35179 <para>
35180 Delivery of the message is tried again later, but the message is not frozen.
35181 </para>
35182 </listitem></varlistentry>
35183 <varlistentry>
35184 <term><option>reroute</option>: &lt;<emphasis>domain</emphasis>&gt;</term>
35185 <listitem>
35186 <para>
35187 The domain is changed to the given domain, and the address is passed back to
35188 be reprocessed by the routers. No rewriting of headers takes place. This
35189 behaviour is essentially a redirection.
35190 </para>
35191 </listitem></varlistentry>
35192 <varlistentry>
35193 <term><option>reroute: rewrite:</option> &lt;<emphasis>domain</emphasis>&gt;</term>
35194 <listitem>
35195 <para>
35196 The domain is changed to the given domain, and the address is passed back to be
35197 reprocessed by the routers. Any headers that contain the original domain are
35198 rewritten.
35199 </para>
35200 </listitem></varlistentry>
35201 <varlistentry>
35202 <term><option>pass</option></term>
35203 <listitem>
35204 <para>
35205 <indexterm role="option">
35206 <primary><option>more</option></primary>
35207 </indexterm>
35208 <indexterm role="variable">
35209 <primary><varname>$self_hostname</varname></primary>
35210 </indexterm>
35211 The router passes the address to the next router, or to the router named in the
35212 <option>pass_router</option> option if it is set. This overrides <option>no_more</option>. During
35213 subsequent routing and delivery, the variable <varname>$self_hostname</varname> contains the
35214 name of the local host that the router encountered. This can be used to
35215 distinguish between different cases for hosts with multiple names. The
35216 combination
35217 </para>
35218 <literallayout class="monospaced">
35219 self = pass
35220 no_more
35221 </literallayout>
35222 <para>
35223 ensures that only those addresses that routed to the local host are passed on.
35224 Without <option>no_more</option>, addresses that were declined for other reasons would also
35225 be passed to the next router.
35226 </para>
35227 </listitem></varlistentry>
35228 <varlistentry>
35229 <term><option>fail</option></term>
35230 <listitem>
35231 <para>
35232 Delivery fails and an error report is generated.
35233 </para>
35234 </listitem></varlistentry>
35235 <varlistentry>
35236 <term><option>send</option></term>
35237 <listitem>
35238 <para>
35239 <indexterm role="concept">
35240 <primary>local host</primary>
35241 <secondary>sending to</secondary>
35242 </indexterm>
35243 The anomaly is ignored and the address is queued for the transport. This
35244 setting should be used with extreme caution. For an <command>smtp</command> transport, it
35245 makes sense only in cases where the program that is listening on the SMTP port
35246 is not this version of Exim. That is, it must be some other MTA, or Exim with a
35247 different configuration file that handles the domain in another way.
35248 </para>
35249 </listitem></varlistentry>
35250 </variablelist>
35251 <para>
35252 <indexterm role="option">
35253 <primary><option>senders</option></primary>
35254 </indexterm>
35255 </para>
35256 <informaltable frame="all">
35257 <tgroup cols="4" colsep="0" rowsep="0">
35258 <colspec colwidth="8*" align="left"/>
35259 <colspec colwidth="6*" align="center"/>
35260 <colspec colwidth="6*" align="center"/>
35261 <colspec colwidth="6*" align="right"/>
35262 <tbody>
35263 <row>
35264 <entry><option>senders</option></entry>
35265 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
35266 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
35267 <entry>Default: <emphasis>unset</emphasis></entry>
35268 </row>
35269 </tbody>
35270 </tgroup>
35271 </informaltable>
35272 <para>
35273 <indexterm role="concept">
35274 <primary>router</primary>
35275 <secondary>checking senders</secondary>
35276 </indexterm>
35277 If this option is set, the router is skipped unless the message&#x2019;s sender
35278 address matches something on the list.
35279 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
35280 are evaluated.
35281 </para>
35282 <para>
35283 There are issues concerning verification when the running of routers is
35284 dependent on the sender. When Exim is verifying the address in an <option>errors_to</option>
35285 setting, it sets the sender to the null string. When using the <option>-bt</option> option
35286 to check a configuration file, it is necessary also to use the <option>-f</option> option to
35287 set an appropriate sender. For incoming mail, the sender is unset when
35288 verifying the sender, but is available when verifying any recipients. If the
35289 SMTP VRFY command is enabled, it must be used after MAIL if the sender address
35290 matters.
35291 </para>
35292 <para>
35293 <indexterm role="option">
35294 <primary><option>translate_ip_address</option></primary>
35295 </indexterm>
35296 </para>
35297 <informaltable frame="all">
35298 <tgroup cols="4" colsep="0" rowsep="0">
35299 <colspec colwidth="8*" align="left"/>
35300 <colspec colwidth="6*" align="center"/>
35301 <colspec colwidth="6*" align="center"/>
35302 <colspec colwidth="6*" align="right"/>
35303 <tbody>
35304 <row>
35305 <entry><option>translate_ip_address</option></entry>
35306 <entry>Use: <emphasis>routers</emphasis></entry>
35307 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35308 <entry>Default: <emphasis>unset</emphasis></entry>
35309 </row>
35310 </tbody>
35311 </tgroup>
35312 </informaltable>
35313 <para>
35314 <indexterm role="concept">
35315 <primary>IP address</primary>
35316 <secondary>translating</secondary>
35317 </indexterm>
35318 <indexterm role="concept">
35319 <primary>packet radio</primary>
35320 </indexterm>
35321 <indexterm role="concept">
35322 <primary>router</primary>
35323 <secondary>IP address translation</secondary>
35324 </indexterm>
35325 There exist some rare networking situations (for example, packet radio) where
35326 it is helpful to be able to translate IP addresses generated by normal routing
35327 mechanisms into other IP addresses, thus performing a kind of manual IP
35328 routing. This should be done only if the normal IP routing of the TCP/IP stack
35329 is inadequate or broken. Because this is an extremely uncommon requirement, the
35330 code to support this option is not included in the Exim binary unless
35331 SUPPORT_TRANSLATE_IP_ADDRESS=yes is set in <filename>Local/Makefile</filename>.
35332 </para>
35333 <para>
35334 <indexterm role="variable">
35335 <primary><varname>$host_address</varname></primary>
35336 </indexterm>
35337 The <option>translate_ip_address</option> string is expanded for every IP address generated
35338 by the router, with the generated address set in <varname>$host_address</varname>. If the
35339 expansion is forced to fail, no action is taken.
35340 For any other expansion error, delivery of the message is deferred.
35341 If the result of the expansion is an IP address, that replaces the original
35342 address; otherwise the result is assumed to be a host name &ndash; this is looked
35343 up using <function>gethostbyname()</function> (or <function>getipnodebyname()</function> when available) to
35344 produce one or more replacement IP addresses. For example, to subvert all IP
35345 addresses in some specific networks, this could be added to a router:
35346 </para>
35347 <literallayout class="monospaced">
35348 translate_ip_address = \
35349   ${lookup{${mask:$host_address/26}}lsearch{/some/file}\
35350     {$value}fail}}
35351 </literallayout>
35352 <para>
35353 The file would contain lines like
35354 </para>
35355 <literallayout class="monospaced">
35356 10.2.3.128/26    some.host
35357 10.8.4.34/26     10.44.8.15
35358 </literallayout>
35359 <para>
35360 You should not make use of this facility unless you really understand what you
35361 are doing.
35362 </para>
35363 <para>
35364 <indexterm role="option">
35365 <primary><option>transport</option></primary>
35366 </indexterm>
35367 </para>
35368 <informaltable frame="all">
35369 <tgroup cols="4" colsep="0" rowsep="0">
35370 <colspec colwidth="8*" align="left"/>
35371 <colspec colwidth="6*" align="center"/>
35372 <colspec colwidth="6*" align="center"/>
35373 <colspec colwidth="6*" align="right"/>
35374 <tbody>
35375 <row>
35376 <entry><option>transport</option></entry>
35377 <entry>Use: <emphasis>routers</emphasis></entry>
35378 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35379 <entry>Default: <emphasis>unset</emphasis></entry>
35380 </row>
35381 </tbody>
35382 </tgroup>
35383 </informaltable>
35384 <para>
35385 This option specifies the transport to be used when a router accepts an address
35386 and sets it up for delivery. A transport is never needed if a router is used
35387 only for verification. The value of the option is expanded at routing time,
35388 after the expansion of <option>errors_to</option>, <option>headers_add</option>, and <option>headers_remove</option>,
35389 and result must be the name of one of the configured transports. If it is not,
35390 delivery is deferred.
35391 </para>
35392 <para>
35393 The <option>transport</option> option is not used by the <command>redirect</command> router, but it does
35394 have some private options that set up transports for pipe and file deliveries
35395 (see chapter <xref linkend="CHAPredirect"/>).
35396 </para>
35397 <para>
35398 <indexterm role="option">
35399 <primary><option>transport_current_directory</option></primary>
35400 </indexterm>
35401 </para>
35402 <informaltable frame="all">
35403 <tgroup cols="4" colsep="0" rowsep="0">
35404 <colspec colwidth="8*" align="left"/>
35405 <colspec colwidth="6*" align="center"/>
35406 <colspec colwidth="6*" align="center"/>
35407 <colspec colwidth="6*" align="right"/>
35408 <tbody>
35409 <row>
35410 <entry><option>transport_current_directory</option></entry>
35411 <entry>Use: <emphasis>routers</emphasis></entry>
35412 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35413 <entry>Default: <emphasis>unset</emphasis></entry>
35414 </row>
35415 </tbody>
35416 </tgroup>
35417 </informaltable>
35418 <para>
35419 <indexterm role="concept">
35420 <primary>current directory for local transport</primary>
35421 </indexterm>
35422 This option associates a current directory with any address that is routed
35423 to a local transport. This can happen either because a transport is
35424 explicitly configured for the router, or because it generates a delivery to a
35425 file or a pipe. During the delivery process (that is, at transport time), this
35426 option string is expanded and is set as the current directory, unless
35427 overridden by a setting on the transport.
35428 If the expansion fails for any reason, including forced failure, an error is
35429 logged, and delivery is deferred.
35430 See chapter <xref linkend="CHAPenvironment"/> for details of the local delivery
35431 environment.
35432 </para>
35433 <para>
35434 <indexterm role="option">
35435 <primary><option>transport_home_directory</option></primary>
35436 </indexterm>
35437 </para>
35438 <informaltable frame="all">
35439 <tgroup cols="4" colsep="0" rowsep="0">
35440 <colspec colwidth="8*" align="left"/>
35441 <colspec colwidth="6*" align="center"/>
35442 <colspec colwidth="6*" align="center"/>
35443 <colspec colwidth="6*" align="right"/>
35444 <tbody>
35445 <row>
35446 <entry><option>transport_home_directory</option></entry>
35447 <entry>Use: <emphasis>routers</emphasis></entry>
35448 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35449 <entry>Default: <emphasis>see below</emphasis></entry>
35450 </row>
35451 </tbody>
35452 </tgroup>
35453 </informaltable>
35454 <para>
35455 <indexterm role="concept">
35456 <primary>home directory</primary>
35457 <secondary>for local transport</secondary>
35458 </indexterm>
35459 This option associates a home directory with any address that is routed to a
35460 local transport. This can happen either because a transport is explicitly
35461 configured for the router, or because it generates a delivery to a file or a
35462 pipe. During the delivery process (that is, at transport time), the option
35463 string is expanded and is set as the home directory, unless overridden by a
35464 setting of <option>home_directory</option> on the transport.
35465 If the expansion fails for any reason, including forced failure, an error is
35466 logged, and delivery is deferred.
35467 </para>
35468 <para>
35469 If the transport does not specify a home directory, and
35470 <option>transport_home_directory</option> is not set for the router, the home directory for
35471 the transport is taken from the password data if <option>check_local_user</option> is set for
35472 the router. Otherwise it is taken from <option>router_home_directory</option> if that option
35473 is set; if not, no home directory is set for the transport.
35474 </para>
35475 <para>
35476 See chapter <xref linkend="CHAPenvironment"/> for further details of the local delivery
35477 environment.
35478 </para>
35479 <para>
35480 <indexterm role="option">
35481 <primary><option>unseen</option></primary>
35482 </indexterm>
35483 </para>
35484 <informaltable frame="all">
35485 <tgroup cols="4" colsep="0" rowsep="0">
35486 <colspec colwidth="8*" align="left"/>
35487 <colspec colwidth="6*" align="center"/>
35488 <colspec colwidth="6*" align="center"/>
35489 <colspec colwidth="6*" align="right"/>
35490 <tbody>
35491 <row>
35492 <entry><option>unseen</option></entry>
35493 <entry>Use: <emphasis>routers</emphasis></entry>
35494 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
35495 <entry>Default: <emphasis>false</emphasis></entry>
35496 </row>
35497 </tbody>
35498 </tgroup>
35499 </informaltable>
35500 <para>
35501 <indexterm role="concept">
35502 <primary>router</primary>
35503 <secondary>carrying on after success</secondary>
35504 </indexterm>
35505 The result of string expansion for this option must be a valid boolean value,
35506 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
35507 result causes an error, and delivery is deferred. If the expansion is forced to
35508 fail, the default value for the option (false) is used. Other failures cause
35509 delivery to be deferred.
35510 </para>
35511 <para>
35512 When this option is set true, routing does not cease if the router accepts the
35513 address. Instead, a copy of the incoming address is passed to the next router,
35514 overriding a false setting of <option>more</option>. There is little point in setting
35515 <option>more</option> false if <option>unseen</option> is always true, but it may be useful in cases when
35516 the value of <option>unseen</option> contains expansion items (and therefore, presumably, is
35517 sometimes true and sometimes false).
35518 </para>
35519 <para>
35520 <indexterm role="concept">
35521 <primary>copy of message (<option>unseen</option> option)</primary>
35522 </indexterm>
35523 Setting the <option>unseen</option> option has a similar effect to the <option>unseen</option> command
35524 qualifier in filter files. It can be used to cause copies of messages to be
35525 delivered to some other destination, while also carrying out a normal delivery.
35526 In effect, the current address is made into a <quote>parent</quote> that has two children
35527 &ndash; one that is delivered as specified by this router, and a clone that goes on
35528 to be routed further. For this reason, <option>unseen</option> may not be combined with the
35529 <option>one_time</option> option in a <command>redirect</command> router.
35530 </para>
35531 <para>
35532 <emphasis role="bold">Warning</emphasis>: Header lines added to the address (or specified for removal) by
35533 this router or by previous routers affect the <quote>unseen</quote> copy of the message
35534 only. The clone that continues to be processed by further routers starts with
35535 no added headers and none specified for removal. For a <option>redirect</option> router, if
35536 a generated address is the same as the incoming address, this can lead to
35537 duplicate addresses with different header modifications. Exim does not do
35538 duplicate deliveries (except, in certain circumstances, to pipes -- see section
35539 <xref linkend="SECTdupaddr"/>), but it is undefined which of the duplicates is discarded,
35540 so this ambiguous situation should be avoided. The <option>repeat_use</option> option of the
35541 <option>redirect</option> router may be of help.
35542 </para>
35543 <para>
35544 Unlike the handling of header modifications, any data that was set by the
35545 <option>address_data</option> option in the current or previous routers <emphasis>is</emphasis> passed on to
35546 subsequent routers.
35547 </para>
35548 <para>
35549 <indexterm role="option">
35550 <primary><option>user</option></primary>
35551 </indexterm>
35552 </para>
35553 <informaltable frame="all">
35554 <tgroup cols="4" colsep="0" rowsep="0">
35555 <colspec colwidth="8*" align="left"/>
35556 <colspec colwidth="6*" align="center"/>
35557 <colspec colwidth="6*" align="center"/>
35558 <colspec colwidth="6*" align="right"/>
35559 <tbody>
35560 <row>
35561 <entry><option>user</option></entry>
35562 <entry>Use: <emphasis>routers</emphasis></entry>
35563 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35564 <entry>Default: <emphasis>see below</emphasis></entry>
35565 </row>
35566 </tbody>
35567 </tgroup>
35568 </informaltable>
35569 <para>
35570 <indexterm role="concept">
35571 <primary>uid (user id)</primary>
35572 <secondary>local delivery</secondary>
35573 </indexterm>
35574 <indexterm role="concept">
35575 <primary>local transports</primary>
35576 <secondary>uid and gid</secondary>
35577 </indexterm>
35578 <indexterm role="concept">
35579 <primary>transport</primary>
35580 <secondary>local</secondary>
35581 </indexterm>
35582 <indexterm role="concept">
35583 <primary>router</primary>
35584 <secondary>user for filter processing</secondary>
35585 </indexterm>
35586 <indexterm role="concept">
35587 <primary>filter</primary>
35588 <secondary>user for processing</secondary>
35589 </indexterm>
35590 When a router queues an address for a transport, and the transport does not
35591 specify a user, the user given here is used when running the delivery process.
35592 The user may be specified numerically or by name. If expansion fails, the
35593 error is logged and delivery is deferred.
35594 This user is also used by the <command>redirect</command> router when running a filter file.
35595 The default is unset, except when <option>check_local_user</option> is set. In this case,
35596 the default is taken from the password information. If the user is specified as
35597 a name, and <option>group</option> is not set, the group associated with the user is used.
35598 See also <option>initgroups</option> and <option>group</option> and the discussion in chapter
35599 <xref linkend="CHAPenvironment"/>.
35600 </para>
35601 <para>
35602 <indexterm role="option">
35603 <primary><option>verify</option></primary>
35604 </indexterm>
35605 </para>
35606 <informaltable frame="all">
35607 <tgroup cols="4" colsep="0" rowsep="0">
35608 <colspec colwidth="8*" align="left"/>
35609 <colspec colwidth="6*" align="center"/>
35610 <colspec colwidth="6*" align="center"/>
35611 <colspec colwidth="6*" align="right"/>
35612 <tbody>
35613 <row>
35614 <entry><option>verify</option></entry>
35615 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
35616 <entry>Type: <emphasis>boolean</emphasis></entry>
35617 <entry>Default: <emphasis>true</emphasis></entry>
35618 </row>
35619 </tbody>
35620 </tgroup>
35621 </informaltable>
35622 <para>
35623 Setting this option has the effect of setting <option>verify_sender</option> and
35624 <option>verify_recipient</option> to the same value.
35625 </para>
35626 <para>
35627 <indexterm role="option">
35628 <primary><option>verify_only</option></primary>
35629 </indexterm>
35630 </para>
35631 <informaltable frame="all">
35632 <tgroup cols="4" colsep="0" rowsep="0">
35633 <colspec colwidth="8*" align="left"/>
35634 <colspec colwidth="6*" align="center"/>
35635 <colspec colwidth="6*" align="center"/>
35636 <colspec colwidth="6*" align="right"/>
35637 <tbody>
35638 <row>
35639 <entry><option>verify_only</option></entry>
35640 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
35641 <entry>Type: <emphasis>boolean</emphasis></entry>
35642 <entry>Default: <emphasis>false</emphasis></entry>
35643 </row>
35644 </tbody>
35645 </tgroup>
35646 </informaltable>
35647 <para>
35648 <indexterm role="concept">
35649 <primary>EXPN</primary>
35650 <secondary>with <option>verify_only</option></secondary>
35651 </indexterm>
35652 <indexterm role="option">
35653 <primary><option>-bv</option></primary>
35654 </indexterm>
35655 <indexterm role="concept">
35656 <primary>router</primary>
35657 <secondary>used only when verifying</secondary>
35658 </indexterm>
35659 If this option is set, the router is used only when verifying an address,
35660 delivering in cutthrough mode or
35661 testing with the <option>-bv</option> option, not when actually doing a delivery, testing
35662 with the <option>-bt</option> option, or running the SMTP EXPN command. It can be further
35663 restricted to verifying only senders or recipients by means of
35664 <option>verify_sender</option> and <option>verify_recipient</option>.
35665 </para>
35666 <para>
35667 <emphasis role="bold">Warning</emphasis>: When the router is being run to verify addresses for an incoming
35668 SMTP message, Exim is not running as root, but under its own uid. If the router
35669 accesses any files, you need to make sure that they are accessible to the Exim
35670 user or group.
35671 </para>
35672 <para>
35673 <indexterm role="option">
35674 <primary><option>verify_recipient</option></primary>
35675 </indexterm>
35676 </para>
35677 <informaltable frame="all">
35678 <tgroup cols="4" colsep="0" rowsep="0">
35679 <colspec colwidth="8*" align="left"/>
35680 <colspec colwidth="6*" align="center"/>
35681 <colspec colwidth="6*" align="center"/>
35682 <colspec colwidth="6*" align="right"/>
35683 <tbody>
35684 <row>
35685 <entry><option>verify_recipient</option></entry>
35686 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
35687 <entry>Type: <emphasis>boolean</emphasis></entry>
35688 <entry>Default: <emphasis>true</emphasis></entry>
35689 </row>
35690 </tbody>
35691 </tgroup>
35692 </informaltable>
35693 <para>
35694 If this option is false, the router is skipped when verifying recipient
35695 addresses,
35696 delivering in cutthrough mode
35697 or testing recipient verification using <option>-bv</option>.
35698 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
35699 are evaluated.
35700 See also the <varname>$verify_mode</varname> variable.
35701 </para>
35702 <para>
35703 <indexterm role="option">
35704 <primary><option>verify_sender</option></primary>
35705 </indexterm>
35706 </para>
35707 <informaltable frame="all">
35708 <tgroup cols="4" colsep="0" rowsep="0">
35709 <colspec colwidth="8*" align="left"/>
35710 <colspec colwidth="6*" align="center"/>
35711 <colspec colwidth="6*" align="center"/>
35712 <colspec colwidth="6*" align="right"/>
35713 <tbody>
35714 <row>
35715 <entry><option>verify_sender</option></entry>
35716 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
35717 <entry>Type: <emphasis>boolean</emphasis></entry>
35718 <entry>Default: <emphasis>true</emphasis></entry>
35719 </row>
35720 </tbody>
35721 </tgroup>
35722 </informaltable>
35723 <para>
35724 If this option is false, the router is skipped when verifying sender addresses
35725 or testing sender verification using <option>-bvs</option>.
35726 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
35727 are evaluated.
35728 See also the <varname>$verify_mode</varname> variable.
35729 <indexterm role="concept" startref="IIDgenoprou1" class="endofrange"/>
35730 <indexterm role="concept" startref="IIDgenoprou2" class="endofrange"/>
35731 </para>
35732 </chapter>
35733
35734 <chapter id="CHID4">
35735 <title>The accept router</title>
35736 <para>
35737 <indexterm role="concept">
35738 <primary><command>accept</command> router</primary>
35739 </indexterm>
35740 <indexterm role="concept">
35741 <primary>routers</primary>
35742 <secondary><command>accept</command></secondary>
35743 </indexterm>
35744 The <command>accept</command> router has no private options of its own. Unless it is being
35745 used purely for verification (see <option>verify_only</option>) a transport is required to
35746 be defined by the generic <option>transport</option> option. If the preconditions that are
35747 specified by generic options are met, the router accepts the address and queues
35748 it for the given transport. The most common use of this router is for setting
35749 up deliveries to local mailboxes. For example:
35750 </para>
35751 <literallayout class="monospaced">
35752 localusers:
35753   driver = accept
35754   domains = mydomain.example
35755   check_local_user
35756   transport = local_delivery
35757 </literallayout>
35758 <para>
35759 The <option>domains</option> condition in this example checks the domain of the address, and
35760 <option>check_local_user</option> checks that the local part is the login of a local user.
35761 When both preconditions are met, the <command>accept</command> router runs, and queues the
35762 address for the <command>local_delivery</command> transport.
35763 </para>
35764 </chapter>
35765
35766 <chapter id="CHAPdnslookup">
35767 <title>The dnslookup router</title>
35768 <para>
35769 <indexterm role="concept" id="IIDdnsrou1" class="startofrange">
35770 <primary><command>dnslookup</command> router</primary>
35771 </indexterm>
35772 <indexterm role="concept" id="IIDdnsrou2" class="startofrange">
35773 <primary>routers</primary>
35774 <secondary><command>dnslookup</command></secondary>
35775 </indexterm>
35776 The <command>dnslookup</command> router looks up the hosts that handle mail for the
35777 recipient&#x2019;s domain in the DNS. A transport must always be set for this router,
35778 unless <option>verify_only</option> is set.
35779 </para>
35780 <para>
35781 If SRV support is configured (see <option>check_srv</option> below), Exim first searches for
35782 SRV records. If none are found, or if SRV support is not configured,
35783 MX records are looked up. If no MX records exist, address records are sought.
35784 However, <option>mx_domains</option> can be set to disable the direct use of address
35785 records.
35786 </para>
35787 <para>
35788 MX records of equal priority are sorted by Exim into a random order. Exim then
35789 looks for address records for the host names obtained from MX or SRV records.
35790 When a host has more than one IP address, they are sorted into a random order,
35791 except that IPv6 addresses are sorted before IPv4 addresses. If all the
35792 IP addresses found are discarded by a setting of the <option>ignore_target_hosts</option>
35793 generic option, the router declines.
35794 </para>
35795 <para>
35796 Unless they have the highest priority (lowest MX value), MX records that point
35797 to the local host, or to any host name that matches <option>hosts_treat_as_local</option>,
35798 are discarded, together with any other MX records of equal or lower priority.
35799 </para>
35800 <para>
35801 <indexterm role="concept">
35802 <primary>MX record</primary>
35803 <secondary>pointing to local host</secondary>
35804 </indexterm>
35805 <indexterm role="concept">
35806 <primary>local host</primary>
35807 <secondary>MX pointing to</secondary>
35808 </indexterm>
35809 <indexterm role="option">
35810 <primary><option>self</option></primary>
35811 <secondary>in <command>dnslookup</command> router</secondary>
35812 </indexterm>
35813 If the host pointed to by the highest priority MX record, or looked up as an
35814 address record, is the local host, or matches <option>hosts_treat_as_local</option>, what
35815 happens is controlled by the generic <option>self</option> option.
35816 </para>
35817 <section id="SECTprowitdnsloo">
35818 <title>Problems with DNS lookups</title>
35819 <para>
35820 There have been problems with DNS servers when SRV records are looked up.
35821 Some misbehaving servers return a DNS error or timeout when a non-existent
35822 SRV record is sought. Similar problems have in the past been reported for
35823 MX records. The global <option>dns_again_means_nonexist</option> option can help with this
35824 problem, but it is heavy-handed because it is a global option.
35825 </para>
35826 <para>
35827 For this reason, there are two options, <option>srv_fail_domains</option> and
35828 <option>mx_fail_domains</option>, that control what happens when a DNS lookup in a
35829 <command>dnslookup</command> router results in a DNS failure or a <quote>try again</quote> response. If
35830 an attempt to look up an SRV or MX record causes one of these results, and the
35831 domain matches the relevant list, Exim behaves as if the DNS had responded <quote>no
35832 such record</quote>. In the case of an SRV lookup, this means that the router
35833 proceeds to look for MX records; in the case of an MX lookup, it proceeds to
35834 look for A or AAAA records, unless the domain matches <option>mx_domains</option>, in which
35835 case routing fails.
35836 </para>
35837 </section>
35838 <section id="SECTdnslookupdecline">
35839 <title>Declining addresses by dnslookup</title>
35840 <para>
35841 <indexterm role="concept">
35842 <primary><command>dnslookup</command> router</primary>
35843 <secondary>declines</secondary>
35844 </indexterm>
35845 There are a few cases where a <command>dnslookup</command> router will decline to accept
35846 an address; if such a router is expected to handle "all remaining non-local
35847 domains", then it is important to set <option>no_more</option>.
35848 </para>
35849 <para>
35850 The router will defer rather than decline if the domain
35851 is found in the <option>fail_defer_domains</option> router option.
35852 </para>
35853 <para>
35854 Reasons for a <command>dnslookup</command> router to decline currently include:
35855 </para>
35856 <itemizedlist>
35857 <listitem>
35858 <para>
35859 The domain does not exist in DNS
35860 </para>
35861 </listitem>
35862 <listitem>
35863 <para>
35864 The domain exists but the MX record&#x2019;s host part is just "."; this is a common
35865 convention (borrowed from SRV) used to indicate that there is no such service
35866 for this domain and to not fall back to trying A/AAAA records.
35867 </para>
35868 </listitem>
35869 <listitem>
35870 <para>
35871 Ditto, but for SRV records, when <option>check_srv</option> is set on this router.
35872 </para>
35873 </listitem>
35874 <listitem>
35875 <para>
35876 MX record points to a non-existent host.
35877 </para>
35878 </listitem>
35879 <listitem>
35880 <para>
35881 MX record points to an IP address and the main section option
35882 <option>allow_mx_to_ip</option> is not set.
35883 </para>
35884 </listitem>
35885 <listitem>
35886 <para>
35887 MX records exist and point to valid hosts, but all hosts resolve only to
35888 addresses blocked by the <option>ignore_target_hosts</option> generic option on this router.
35889 </para>
35890 </listitem>
35891 <listitem>
35892 <para>
35893 The domain is not syntactically valid (see also <option>allow_utf8_domains</option> and
35894 <option>dns_check_names_pattern</option> for handling one variant of this)
35895 </para>
35896 </listitem>
35897 <listitem>
35898 <para>
35899 <option>check_secondary_mx</option> is set on this router but the local host can
35900 not be found in the MX records (see below)
35901 </para>
35902 </listitem>
35903 </itemizedlist>
35904 </section>
35905 <section id="SECID118">
35906 <title>Private options for dnslookup</title>
35907 <para>
35908 <indexterm role="concept">
35909 <primary>options</primary>
35910 <secondary><command>dnslookup</command> router</secondary>
35911 </indexterm>
35912 The private options for the <command>dnslookup</command> router are as follows:
35913 </para>
35914 <para>
35915 <indexterm role="option">
35916 <primary><option>check_secondary_mx</option></primary>
35917 </indexterm>
35918 </para>
35919 <informaltable frame="all">
35920 <tgroup cols="4" colsep="0" rowsep="0">
35921 <colspec colwidth="8*" align="left"/>
35922 <colspec colwidth="6*" align="center"/>
35923 <colspec colwidth="6*" align="center"/>
35924 <colspec colwidth="6*" align="right"/>
35925 <tbody>
35926 <row>
35927 <entry><option>check_secondary_mx</option></entry>
35928 <entry>Use: <emphasis>dnslookup</emphasis></entry>
35929 <entry>Type: <emphasis>boolean</emphasis></entry>
35930 <entry>Default: <emphasis>false</emphasis></entry>
35931 </row>
35932 </tbody>
35933 </tgroup>
35934 </informaltable>
35935 <para>
35936 <indexterm role="concept">
35937 <primary>MX record</primary>
35938 <secondary>checking for secondary</secondary>
35939 </indexterm>
35940 If this option is set, the router declines unless the local host is found in
35941 (and removed from) the list of hosts obtained by MX lookup. This can be used to
35942 process domains for which the local host is a secondary mail exchanger
35943 differently to other domains. The way in which Exim decides whether a host is
35944 the local host is described in section <xref linkend="SECTreclocipadd"/>.
35945 </para>
35946 <para>
35947 <indexterm role="option">
35948 <primary><option>check_srv</option></primary>
35949 </indexterm>
35950 </para>
35951 <informaltable frame="all">
35952 <tgroup cols="4" colsep="0" rowsep="0">
35953 <colspec colwidth="8*" align="left"/>
35954 <colspec colwidth="6*" align="center"/>
35955 <colspec colwidth="6*" align="center"/>
35956 <colspec colwidth="6*" align="right"/>
35957 <tbody>
35958 <row>
35959 <entry><option>check_srv</option></entry>
35960 <entry>Use: <emphasis>dnslookup</emphasis></entry>
35961 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35962 <entry>Default: <emphasis>unset</emphasis></entry>
35963 </row>
35964 </tbody>
35965 </tgroup>
35966 </informaltable>
35967 <para>
35968 <indexterm role="concept">
35969 <primary>SRV record</primary>
35970 <secondary>enabling use of</secondary>
35971 </indexterm>
35972 The <command>dnslookup</command> router supports the use of SRV records (see RFC 2782) in
35973 addition to MX and address records. The support is disabled by default. To
35974 enable SRV support, set the <option>check_srv</option> option to the name of the service
35975 required. For example,
35976 </para>
35977 <literallayout class="monospaced">
35978 check_srv = smtp
35979 </literallayout>
35980 <para>
35981 looks for SRV records that refer to the normal smtp service. The option is
35982 expanded, so the service name can vary from message to message or address
35983 to address. This might be helpful if SRV records are being used for a
35984 submission service. If the expansion is forced to fail, the <option>check_srv</option>
35985 option is ignored, and the router proceeds to look for MX records in the
35986 normal way.
35987 </para>
35988 <para>
35989 When the expansion succeeds, the router searches first for SRV records for
35990 the given service (it assumes TCP protocol). A single SRV record with a
35991 host name that consists of just a single dot indicates <quote>no such service for
35992 this domain</quote>; if this is encountered, the router declines. If other kinds of
35993 SRV record are found, they are used to construct a host list for delivery
35994 according to the rules of RFC 2782. MX records are not sought in this case.
35995 </para>
35996 <para>
35997 When no SRV records are found, MX records (and address records) are sought in
35998 the traditional way. In other words, SRV records take precedence over MX
35999 records, just as MX records take precedence over address records. Note that
36000 this behaviour is not sanctioned by RFC 2782, though a previous draft RFC
36001 defined it. It is apparently believed that MX records are sufficient for email
36002 and that SRV records should not be used for this purpose. However, SRV records
36003 have an additional <quote>weight</quote> feature which some people might find useful when
36004 trying to split an SMTP load between hosts of different power.
36005 </para>
36006 <para>
36007 See section <xref linkend="SECTprowitdnsloo"/> above for a discussion of Exim&#x2019;s behaviour
36008 when there is a DNS lookup error.
36009 </para>
36010 <para>
36011 <indexterm role="option">
36012 <primary><option>fail_defer_domains</option></primary>
36013 </indexterm>
36014 </para>
36015 <informaltable frame="all">
36016 <tgroup cols="4" colsep="0" rowsep="0">
36017 <colspec colwidth="8*" align="left"/>
36018 <colspec colwidth="6*" align="center"/>
36019 <colspec colwidth="6*" align="center"/>
36020 <colspec colwidth="6*" align="right"/>
36021 <tbody>
36022 <row>
36023 <entry><option>fail_defer_domains</option></entry>
36024 <entry>Use: <emphasis>dnslookup</emphasis></entry>
36025 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
36026 <entry>Default: <emphasis>unset</emphasis></entry>
36027 </row>
36028 </tbody>
36029 </tgroup>
36030 </informaltable>
36031 <para>
36032 <indexterm role="concept">
36033 <primary>MX record</primary>
36034 <secondary>not found</secondary>
36035 </indexterm>
36036 DNS lookups for domains matching <option>fail_defer_domains</option>
36037 which find no matching record will cause the router to defer
36038 rather than the default behaviour of decline.
36039 This maybe be useful for queueing messages for a newly created
36040 domain while the DNS configuration is not ready.
36041 However, it will result in any message with mistyped domains
36042 also being queued.
36043 </para>
36044 <para>
36045 <indexterm role="option">
36046 <primary><option>ipv4_only</option></primary>
36047 </indexterm>
36048 </para>
36049 <informaltable frame="all">
36050 <tgroup cols="4" colsep="0" rowsep="0">
36051 <colspec colwidth="8*" align="left"/>
36052 <colspec colwidth="6*" align="center"/>
36053 <colspec colwidth="6*" align="center"/>
36054 <colspec colwidth="6*" align="right"/>
36055 <tbody>
36056 <row>
36057 <entry><option>ipv4_only</option></entry>
36058 <entry>Use: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36059 <entry>Type: <emphasis>unset</emphasis></entry>
36060 <entry>Default: <emphasis></emphasis></entry>
36061 </row>
36062 </tbody>
36063 </tgroup>
36064 </informaltable>
36065 <para>
36066 <indexterm role="concept">
36067 <primary>IPv6</primary>
36068 <secondary>disabling</secondary>
36069 </indexterm>
36070 <indexterm role="concept">
36071 <primary>DNS</primary>
36072 <secondary>IPv6 disabling</secondary>
36073 </indexterm>
36074 The string is expanded, and if the result is anything but a forced failure,
36075 or an empty string, or one of the strings “0” or “no” or “false”
36076 (checked without regard to the case of the letters),
36077 only A records are used.
36078 </para>
36079 <para>
36080 <indexterm role="option">
36081 <primary><option>ipv4_prefer</option></primary>
36082 </indexterm>
36083 </para>
36084 <informaltable frame="all">
36085 <tgroup cols="4" colsep="0" rowsep="0">
36086 <colspec colwidth="8*" align="left"/>
36087 <colspec colwidth="6*" align="center"/>
36088 <colspec colwidth="6*" align="center"/>
36089 <colspec colwidth="6*" align="right"/>
36090 <tbody>
36091 <row>
36092 <entry><option>ipv4_prefer</option></entry>
36093 <entry>Use: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36094 <entry>Type: <emphasis>unset</emphasis></entry>
36095 <entry>Default: <emphasis></emphasis></entry>
36096 </row>
36097 </tbody>
36098 </tgroup>
36099 </informaltable>
36100 <para>
36101 <indexterm role="concept">
36102 <primary>IPv4</primary>
36103 <secondary>preference</secondary>
36104 </indexterm>
36105 <indexterm role="concept">
36106 <primary>DNS</primary>
36107 <secondary>IPv4 preference</secondary>
36108 </indexterm>
36109 The string is expanded, and if the result is anything but a forced failure,
36110 or an empty string, or one of the strings “0” or “no” or “false”
36111 (checked without regard to the case of the letters),
36112 A records are sorted before AAAA records (inverting the default).
36113 </para>
36114 <para>
36115 <indexterm role="option">
36116 <primary><option>mx_domains</option></primary>
36117 </indexterm>
36118 </para>
36119 <informaltable frame="all">
36120 <tgroup cols="4" colsep="0" rowsep="0">
36121 <colspec colwidth="8*" align="left"/>
36122 <colspec colwidth="6*" align="center"/>
36123 <colspec colwidth="6*" align="center"/>
36124 <colspec colwidth="6*" align="right"/>
36125 <tbody>
36126 <row>
36127 <entry><option>mx_domains</option></entry>
36128 <entry>Use: <emphasis>dnslookup</emphasis></entry>
36129 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
36130 <entry>Default: <emphasis>unset</emphasis></entry>
36131 </row>
36132 </tbody>
36133 </tgroup>
36134 </informaltable>
36135 <para>
36136 <indexterm role="concept">
36137 <primary>MX record</primary>
36138 <secondary>required to exist</secondary>
36139 </indexterm>
36140 <indexterm role="concept">
36141 <primary>SRV record</primary>
36142 <secondary>required to exist</secondary>
36143 </indexterm>
36144 A domain that matches <option>mx_domains</option> is required to have either an MX or an SRV
36145 record in order to be recognized. (The name of this option could be improved.)
36146 For example, if all the mail hosts in <emphasis>fict.example</emphasis> are known to have MX
36147 records, except for those in <emphasis>discworld.fict.example</emphasis>, you could use this
36148 setting:
36149 </para>
36150 <literallayout class="monospaced">
36151 mx_domains = ! *.discworld.fict.example : *.fict.example
36152 </literallayout>
36153 <para>
36154 This specifies that messages addressed to a domain that matches the list but
36155 has no MX record should be bounced immediately instead of being routed using
36156 the address record.
36157 </para>
36158 <para>
36159 <indexterm role="option">
36160 <primary><option>mx_fail_domains</option></primary>
36161 </indexterm>
36162 </para>
36163 <informaltable frame="all">
36164 <tgroup cols="4" colsep="0" rowsep="0">
36165 <colspec colwidth="8*" align="left"/>
36166 <colspec colwidth="6*" align="center"/>
36167 <colspec colwidth="6*" align="center"/>
36168 <colspec colwidth="6*" align="right"/>
36169 <tbody>
36170 <row>
36171 <entry><option>mx_fail_domains</option></entry>
36172 <entry>Use: <emphasis>dnslookup</emphasis></entry>
36173 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
36174 <entry>Default: <emphasis>unset</emphasis></entry>
36175 </row>
36176 </tbody>
36177 </tgroup>
36178 </informaltable>
36179 <para>
36180 If the DNS lookup for MX records for one of the domains in this list causes a
36181 DNS lookup error, Exim behaves as if no MX records were found. See section
36182 <xref linkend="SECTprowitdnsloo"/> for more discussion.
36183 </para>
36184 <para>
36185 <indexterm role="option">
36186 <primary><option>qualify_single</option></primary>
36187 </indexterm>
36188 </para>
36189 <informaltable frame="all">
36190 <tgroup cols="4" colsep="0" rowsep="0">
36191 <colspec colwidth="8*" align="left"/>
36192 <colspec colwidth="6*" align="center"/>
36193 <colspec colwidth="6*" align="center"/>
36194 <colspec colwidth="6*" align="right"/>
36195 <tbody>
36196 <row>
36197 <entry><option>qualify_single</option></entry>
36198 <entry>Use: <emphasis>dnslookup</emphasis></entry>
36199 <entry>Type: <emphasis>boolean</emphasis></entry>
36200 <entry>Default: <emphasis>true</emphasis></entry>
36201 </row>
36202 </tbody>
36203 </tgroup>
36204 </informaltable>
36205 <para>
36206 <indexterm role="concept">
36207 <primary>DNS</primary>
36208 <secondary>resolver options</secondary>
36209 </indexterm>
36210 <indexterm role="concept">
36211 <primary>DNS</primary>
36212 <secondary>qualifying single-component names</secondary>
36213 </indexterm>
36214 When this option is true, the resolver option RES_DEFNAMES is set for DNS
36215 lookups. Typically, but not standardly, this causes the resolver to qualify
36216 single-component names with the default domain. For example, on a machine
36217 called <emphasis>dictionary.ref.example</emphasis>, the domain <emphasis>thesaurus</emphasis> would be changed to
36218 <emphasis>thesaurus.ref.example</emphasis> inside the resolver. For details of what your
36219 resolver actually does, consult your man pages for <emphasis>resolver</emphasis> and
36220 <emphasis>resolv.conf</emphasis>.
36221 </para>
36222 <para>
36223 <indexterm role="option">
36224 <primary><option>rewrite_headers</option></primary>
36225 </indexterm>
36226 </para>
36227 <informaltable frame="all">
36228 <tgroup cols="4" colsep="0" rowsep="0">
36229 <colspec colwidth="8*" align="left"/>
36230 <colspec colwidth="6*" align="center"/>
36231 <colspec colwidth="6*" align="center"/>
36232 <colspec colwidth="6*" align="right"/>
36233 <tbody>
36234 <row>
36235 <entry><option>rewrite_headers</option></entry>
36236 <entry>Use: <emphasis>dnslookup</emphasis></entry>
36237 <entry>Type: <emphasis>boolean</emphasis></entry>
36238 <entry>Default: <emphasis>true</emphasis></entry>
36239 </row>
36240 </tbody>
36241 </tgroup>
36242 </informaltable>
36243 <para>
36244 <indexterm role="concept">
36245 <primary>rewriting</primary>
36246 <secondary>header lines</secondary>
36247 </indexterm>
36248 <indexterm role="concept">
36249 <primary>header lines</primary>
36250 <secondary>rewriting</secondary>
36251 </indexterm>
36252 If the domain name in the address that is being processed is not fully
36253 qualified, it may be expanded to its full form by a DNS lookup. For example, if
36254 an address is specified as <emphasis>dormouse@teaparty</emphasis>, the domain might be
36255 expanded to <emphasis>teaparty.wonderland.fict.example</emphasis>. Domain expansion can also
36256 occur as a result of setting the <option>widen_domains</option> option. If
36257 <option>rewrite_headers</option> is true, all occurrences of the abbreviated domain name in
36258 any <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-to:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>
36259 header lines of the message are rewritten with the full domain name.
36260 </para>
36261 <para>
36262 This option should be turned off only when it is known that no message is
36263 ever going to be sent outside an environment where the abbreviation makes
36264 sense.
36265 </para>
36266 <para>
36267 When an MX record is looked up in the DNS and matches a wildcard record, name
36268 servers normally return a record containing the name that has been looked up,
36269 making it impossible to detect whether a wildcard was present or not. However,
36270 some name servers have recently been seen to return the wildcard entry. If the
36271 name returned by a DNS lookup begins with an asterisk, it is not used for
36272 header rewriting.
36273 </para>
36274 <para>
36275 <indexterm role="option">
36276 <primary><option>same_domain_copy_routing</option></primary>
36277 </indexterm>
36278 </para>
36279 <informaltable frame="all">
36280 <tgroup cols="4" colsep="0" rowsep="0">
36281 <colspec colwidth="8*" align="left"/>
36282 <colspec colwidth="6*" align="center"/>
36283 <colspec colwidth="6*" align="center"/>
36284 <colspec colwidth="6*" align="right"/>
36285 <tbody>
36286 <row>
36287 <entry><option>same_domain_copy_routing</option></entry>
36288 <entry>Use: <emphasis>dnslookup</emphasis></entry>
36289 <entry>Type: <emphasis>boolean</emphasis></entry>
36290 <entry>Default: <emphasis>false</emphasis></entry>
36291 </row>
36292 </tbody>
36293 </tgroup>
36294 </informaltable>
36295 <para>
36296 <indexterm role="concept">
36297 <primary>address</primary>
36298 <secondary>copying routing</secondary>
36299 </indexterm>
36300 Addresses with the same domain are normally routed by the <command>dnslookup</command> router
36301 to the same list of hosts. However, this cannot be presumed, because the router
36302 options and preconditions may refer to the local part of the address. By
36303 default, therefore, Exim routes each address in a message independently. DNS
36304 servers run caches, so repeated DNS lookups are not normally expensive, and in
36305 any case, personal messages rarely have more than a few recipients.
36306 </para>
36307 <para>
36308 If you are running mailing lists with large numbers of subscribers at the same
36309 domain, and you are using a <command>dnslookup</command> router which is independent of the
36310 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
36311 lookups for identical domains in one message. In this case, when <command>dnslookup</command>
36312 routes an address to a remote transport, any other unrouted addresses in the
36313 message that have the same domain are automatically given the same routing
36314 without processing them independently,
36315 provided the following conditions are met:
36316 </para>
36317 <itemizedlist>
36318 <listitem>
36319 <para>
36320 No router that processed the address specified <option>headers_add</option> or
36321 <option>headers_remove</option>.
36322 </para>
36323 </listitem>
36324 <listitem>
36325 <para>
36326 The router did not change the address in any way, for example, by <quote>widening</quote>
36327 the domain.
36328 </para>
36329 </listitem>
36330 </itemizedlist>
36331 <para>
36332 <indexterm role="option">
36333 <primary><option>search_parents</option></primary>
36334 </indexterm>
36335 </para>
36336 <informaltable frame="all">
36337 <tgroup cols="4" colsep="0" rowsep="0">
36338 <colspec colwidth="8*" align="left"/>
36339 <colspec colwidth="6*" align="center"/>
36340 <colspec colwidth="6*" align="center"/>
36341 <colspec colwidth="6*" align="right"/>
36342 <tbody>
36343 <row>
36344 <entry><option>search_parents</option></entry>
36345 <entry>Use: <emphasis>dnslookup</emphasis></entry>
36346 <entry>Type: <emphasis>boolean</emphasis></entry>
36347 <entry>Default: <emphasis>false</emphasis></entry>
36348 </row>
36349 </tbody>
36350 </tgroup>
36351 </informaltable>
36352 <para>
36353 <indexterm role="concept">
36354 <primary>DNS</primary>
36355 <secondary>resolver options</secondary>
36356 </indexterm>
36357 When this option is true, the resolver option RES_DNSRCH is set for DNS
36358 lookups. This is different from the <option>qualify_single</option> option in that it
36359 applies to domains containing dots. Typically, but not standardly, it causes
36360 the resolver to search for the name in the current domain and in parent
36361 domains. For example, on a machine in the <emphasis>fict.example</emphasis> domain, if looking
36362 up <emphasis>teaparty.wonderland</emphasis> failed, the resolver would try
36363 <emphasis>teaparty.wonderland.fict.example</emphasis>. For details of what your resolver
36364 actually does, consult your man pages for <emphasis>resolver</emphasis> and <emphasis>resolv.conf</emphasis>.
36365 </para>
36366 <para>
36367 Setting this option true can cause problems in domains that have a wildcard MX
36368 record, because any domain that does not have its own MX record matches the
36369 local wildcard.
36370 </para>
36371 <para>
36372 <indexterm role="option">
36373 <primary><option>srv_fail_domains</option></primary>
36374 </indexterm>
36375 </para>
36376 <informaltable frame="all">
36377 <tgroup cols="4" colsep="0" rowsep="0">
36378 <colspec colwidth="8*" align="left"/>
36379 <colspec colwidth="6*" align="center"/>
36380 <colspec colwidth="6*" align="center"/>
36381 <colspec colwidth="6*" align="right"/>
36382 <tbody>
36383 <row>
36384 <entry><option>srv_fail_domains</option></entry>
36385 <entry>Use: <emphasis>dnslookup</emphasis></entry>
36386 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
36387 <entry>Default: <emphasis>unset</emphasis></entry>
36388 </row>
36389 </tbody>
36390 </tgroup>
36391 </informaltable>
36392 <para>
36393 If the DNS lookup for SRV records for one of the domains in this list causes a
36394 DNS lookup error, Exim behaves as if no SRV records were found. See section
36395 <xref linkend="SECTprowitdnsloo"/> for more discussion.
36396 </para>
36397 <para>
36398 <indexterm role="option">
36399 <primary><option>widen_domains</option></primary>
36400 </indexterm>
36401 </para>
36402 <informaltable frame="all">
36403 <tgroup cols="4" colsep="0" rowsep="0">
36404 <colspec colwidth="8*" align="left"/>
36405 <colspec colwidth="6*" align="center"/>
36406 <colspec colwidth="6*" align="center"/>
36407 <colspec colwidth="6*" align="right"/>
36408 <tbody>
36409 <row>
36410 <entry><option>widen_domains</option></entry>
36411 <entry>Use: <emphasis>dnslookup</emphasis></entry>
36412 <entry>Type: <emphasis>string list</emphasis></entry>
36413 <entry>Default: <emphasis>unset</emphasis></entry>
36414 </row>
36415 </tbody>
36416 </tgroup>
36417 </informaltable>
36418 <para>
36419 <indexterm role="concept">
36420 <primary>domain</primary>
36421 <secondary>partial; widening</secondary>
36422 </indexterm>
36423 If a DNS lookup fails and this option is set, each of its strings in turn is
36424 added onto the end of the domain, and the lookup is tried again. For example,
36425 if
36426 </para>
36427 <literallayout class="monospaced">
36428 widen_domains = fict.example:ref.example
36429 </literallayout>
36430 <para>
36431 is set and a lookup of <emphasis>klingon.dictionary</emphasis> fails,
36432 <emphasis>klingon.dictionary.fict.example</emphasis> is looked up, and if this fails,
36433 <emphasis>klingon.dictionary.ref.example</emphasis> is tried. Note that the <option>qualify_single</option>
36434 and <option>search_parents</option> options can cause some widening to be undertaken inside
36435 the DNS resolver. <option>widen_domains</option> is not applied to sender addresses
36436 when verifying, unless <option>rewrite_headers</option> is false (not the default).
36437 </para>
36438 </section>
36439 <section id="SECID119">
36440 <title>Effect of qualify_single and search_parents</title>
36441 <para>
36442 When a domain from an envelope recipient is changed by the resolver as a result
36443 of the <option>qualify_single</option> or <option>search_parents</option> options, Exim rewrites the
36444 corresponding address in the message&#x2019;s header lines unless <option>rewrite_headers</option>
36445 is set false. Exim then re-routes the address, using the full domain.
36446 </para>
36447 <para>
36448 These two options affect only the DNS lookup that takes place inside the router
36449 for the domain of the address that is being routed. They do not affect lookups
36450 such as that implied by
36451 </para>
36452 <literallayout class="monospaced">
36453 domains = @mx_any
36454 </literallayout>
36455 <para>
36456 that may happen while processing a router precondition before the router is
36457 entered. No widening ever takes place for these lookups.
36458 <indexterm role="concept" startref="IIDdnsrou1" class="endofrange"/>
36459 <indexterm role="concept" startref="IIDdnsrou2" class="endofrange"/>
36460 </para>
36461 </section>
36462 </chapter>
36463
36464 <chapter id="CHID5">
36465 <title>The ipliteral router</title>
36466 <para>
36467 <indexterm role="concept">
36468 <primary><command>ipliteral</command> router</primary>
36469 </indexterm>
36470 <indexterm role="concept">
36471 <primary>domain literal</primary>
36472 <secondary>routing</secondary>
36473 </indexterm>
36474 <indexterm role="concept">
36475 <primary>routers</primary>
36476 <secondary><command>ipliteral</command></secondary>
36477 </indexterm>
36478 This router has no private options. Unless it is being used purely for
36479 verification (see <option>verify_only</option>) a transport is required to be defined by the
36480 generic <option>transport</option> option. The router accepts the address if its domain part
36481 takes the form of an RFC 2822 domain literal. For example, the <command>ipliteral</command>
36482 router handles the address
36483 </para>
36484 <literallayout class="monospaced">
36485 root@[192.168.1.1]
36486 </literallayout>
36487 <para>
36488 by setting up delivery to the host with that IP address. IPv4 domain literals
36489 consist of an IPv4 address enclosed in square brackets. IPv6 domain literals
36490 are similar, but the address is preceded by <literal>ipv6:</literal>. For example:
36491 </para>
36492 <literallayout class="monospaced">
36493 postmaster@[ipv6:fe80::a00:20ff:fe86:a061.5678]
36494 </literallayout>
36495 <para>
36496 Exim allows <literal>ipv4:</literal> before IPv4 addresses, for consistency, and on the
36497 grounds that sooner or later somebody will try it.
36498 </para>
36499 <para>
36500 <indexterm role="option">
36501 <primary><option>self</option></primary>
36502 <secondary>in <command>ipliteral</command> router</secondary>
36503 </indexterm>
36504 If the IP address matches something in <option>ignore_target_hosts</option>, the router
36505 declines. If an IP literal turns out to refer to the local host, the generic
36506 <option>self</option> option determines what happens.
36507 </para>
36508 <para>
36509 The RFCs require support for domain literals; however, their use is
36510 controversial in today&#x2019;s Internet. If you want to use this router, you must
36511 also set the main configuration option <option>allow_domain_literals</option>. Otherwise,
36512 Exim will not recognize the domain literal syntax in addresses.
36513 </para>
36514 </chapter>
36515
36516 <chapter id="CHID6">
36517 <title>The iplookup router</title>
36518 <para>
36519 <indexterm role="concept">
36520 <primary><command>iplookup</command> router</primary>
36521 </indexterm>
36522 <indexterm role="concept">
36523 <primary>routers</primary>
36524 <secondary><command>iplookup</command></secondary>
36525 </indexterm>
36526 The <command>iplookup</command> router was written to fulfil a specific requirement in
36527 Cambridge University (which in fact no longer exists). For this reason, it is
36528 not included in the binary of Exim by default. If you want to include it, you
36529 must set
36530 </para>
36531 <literallayout class="monospaced">
36532 ROUTER_IPLOOKUP=yes
36533 </literallayout>
36534 <para>
36535 in your <filename>Local/Makefile</filename> configuration file.
36536 </para>
36537 <para>
36538 The <command>iplookup</command> router routes an address by sending it over a TCP or UDP
36539 connection to one or more specific hosts. The host can then return the same or
36540 a different address &ndash; in effect rewriting the recipient address in the
36541 message&#x2019;s envelope. The new address is then passed on to subsequent routers. If
36542 this process fails, the address can be passed on to other routers, or delivery
36543 can be deferred. Since <command>iplookup</command> is just a rewriting router, a transport
36544 must not be specified for it.
36545 </para>
36546 <para>
36547 <indexterm role="concept">
36548 <primary>options</primary>
36549 <secondary><command>iplookup</command> router</secondary>
36550 </indexterm>
36551 <indexterm role="option">
36552 <primary><option>hosts</option></primary>
36553 </indexterm>
36554 </para>
36555 <informaltable frame="all">
36556 <tgroup cols="4" colsep="0" rowsep="0">
36557 <colspec colwidth="8*" align="left"/>
36558 <colspec colwidth="6*" align="center"/>
36559 <colspec colwidth="6*" align="center"/>
36560 <colspec colwidth="6*" align="right"/>
36561 <tbody>
36562 <row>
36563 <entry><option>hosts</option></entry>
36564 <entry>Use: <emphasis>iplookup</emphasis></entry>
36565 <entry>Type: <emphasis>string</emphasis></entry>
36566 <entry>Default: <emphasis>unset</emphasis></entry>
36567 </row>
36568 </tbody>
36569 </tgroup>
36570 </informaltable>
36571 <para>
36572 This option must be supplied. Its value is a colon-separated list of host
36573 names. The hosts are looked up using <function>gethostbyname()</function>
36574 (or <function>getipnodebyname()</function> when available)
36575 and are tried in order until one responds to the query. If none respond, what
36576 happens is controlled by <option>optional</option>.
36577 </para>
36578 <para>
36579 <indexterm role="option">
36580 <primary><option>optional</option></primary>
36581 </indexterm>
36582 </para>
36583 <informaltable frame="all">
36584 <tgroup cols="4" colsep="0" rowsep="0">
36585 <colspec colwidth="8*" align="left"/>
36586 <colspec colwidth="6*" align="center"/>
36587 <colspec colwidth="6*" align="center"/>
36588 <colspec colwidth="6*" align="right"/>
36589 <tbody>
36590 <row>
36591 <entry><option>optional</option></entry>
36592 <entry>Use: <emphasis>iplookup</emphasis></entry>
36593 <entry>Type: <emphasis>boolean</emphasis></entry>
36594 <entry>Default: <emphasis>false</emphasis></entry>
36595 </row>
36596 </tbody>
36597 </tgroup>
36598 </informaltable>
36599 <para>
36600 If <option>optional</option> is true, if no response is obtained from any host, the address
36601 is passed to the next router, overriding <option>no_more</option>. If <option>optional</option> is false,
36602 delivery to the address is deferred.
36603 </para>
36604 <para>
36605 <indexterm role="option">
36606 <primary><option>port</option></primary>
36607 </indexterm>
36608 </para>
36609 <informaltable frame="all">
36610 <tgroup cols="4" colsep="0" rowsep="0">
36611 <colspec colwidth="8*" align="left"/>
36612 <colspec colwidth="6*" align="center"/>
36613 <colspec colwidth="6*" align="center"/>
36614 <colspec colwidth="6*" align="right"/>
36615 <tbody>
36616 <row>
36617 <entry><option>port</option></entry>
36618 <entry>Use: <emphasis>iplookup</emphasis></entry>
36619 <entry>Type: <emphasis>integer</emphasis></entry>
36620 <entry>Default: <emphasis>0</emphasis></entry>
36621 </row>
36622 </tbody>
36623 </tgroup>
36624 </informaltable>
36625 <para>
36626 <indexterm role="concept">
36627 <primary>port</primary>
36628 <secondary><command>iplookup</command> router</secondary>
36629 </indexterm>
36630 This option must be supplied. It specifies the port number for the TCP or UDP
36631 call.
36632 </para>
36633 <para>
36634 <indexterm role="option">
36635 <primary><option>protocol</option></primary>
36636 </indexterm>
36637 </para>
36638 <informaltable frame="all">
36639 <tgroup cols="4" colsep="0" rowsep="0">
36640 <colspec colwidth="8*" align="left"/>
36641 <colspec colwidth="6*" align="center"/>
36642 <colspec colwidth="6*" align="center"/>
36643 <colspec colwidth="6*" align="right"/>
36644 <tbody>
36645 <row>
36646 <entry><option>protocol</option></entry>
36647 <entry>Use: <emphasis>iplookup</emphasis></entry>
36648 <entry>Type: <emphasis>string</emphasis></entry>
36649 <entry>Default: <emphasis>udp</emphasis></entry>
36650 </row>
36651 </tbody>
36652 </tgroup>
36653 </informaltable>
36654 <para>
36655 This option can be set to <quote>udp</quote> or <quote>tcp</quote> to specify which of the two
36656 protocols is to be used.
36657 </para>
36658 <para>
36659 <indexterm role="option">
36660 <primary><option>query</option></primary>
36661 </indexterm>
36662 </para>
36663 <informaltable frame="all">
36664 <tgroup cols="4" colsep="0" rowsep="0">
36665 <colspec colwidth="8*" align="left"/>
36666 <colspec colwidth="6*" align="center"/>
36667 <colspec colwidth="6*" align="center"/>
36668 <colspec colwidth="6*" align="right"/>
36669 <tbody>
36670 <row>
36671 <entry><option>query</option></entry>
36672 <entry>Use: <emphasis>iplookup</emphasis></entry>
36673 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36674 <entry>Default: <emphasis>see below</emphasis></entry>
36675 </row>
36676 </tbody>
36677 </tgroup>
36678 </informaltable>
36679 <para>
36680 This defines the content of the query that is sent to the remote hosts. The
36681 default value is:
36682 </para>
36683 <literallayout class="monospaced">
36684 $local_part@$domain $local_part@$domain
36685 </literallayout>
36686 <para>
36687 The repetition serves as a way of checking that a response is to the correct
36688 query in the default case (see <option>response_pattern</option> below).
36689 </para>
36690 <para>
36691 <indexterm role="option">
36692 <primary><option>reroute</option></primary>
36693 </indexterm>
36694 </para>
36695 <informaltable frame="all">
36696 <tgroup cols="4" colsep="0" rowsep="0">
36697 <colspec colwidth="8*" align="left"/>
36698 <colspec colwidth="6*" align="center"/>
36699 <colspec colwidth="6*" align="center"/>
36700 <colspec colwidth="6*" align="right"/>
36701 <tbody>
36702 <row>
36703 <entry><option>reroute</option></entry>
36704 <entry>Use: <emphasis>iplookup</emphasis></entry>
36705 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36706 <entry>Default: <emphasis>unset</emphasis></entry>
36707 </row>
36708 </tbody>
36709 </tgroup>
36710 </informaltable>
36711 <para>
36712 If this option is not set, the rerouted address is precisely the byte string
36713 returned by the remote host, up to the first white space, if any. If set, the
36714 string is expanded to form the rerouted address. It can include parts matched
36715 in the response by <option>response_pattern</option> by means of numeric variables such as
36716 <varname>$1</varname>, <varname>$2</varname>, etc. The variable <varname>$0</varname> refers to the entire input string,
36717 whether or not a pattern is in use. In all cases, the rerouted address must end
36718 up in the form <emphasis>local_part@domain</emphasis>.
36719 </para>
36720 <para>
36721 <indexterm role="option">
36722 <primary><option>response_pattern</option></primary>
36723 </indexterm>
36724 </para>
36725 <informaltable frame="all">
36726 <tgroup cols="4" colsep="0" rowsep="0">
36727 <colspec colwidth="8*" align="left"/>
36728 <colspec colwidth="6*" align="center"/>
36729 <colspec colwidth="6*" align="center"/>
36730 <colspec colwidth="6*" align="right"/>
36731 <tbody>
36732 <row>
36733 <entry><option>response_pattern</option></entry>
36734 <entry>Use: <emphasis>iplookup</emphasis></entry>
36735 <entry>Type: <emphasis>string</emphasis></entry>
36736 <entry>Default: <emphasis>unset</emphasis></entry>
36737 </row>
36738 </tbody>
36739 </tgroup>
36740 </informaltable>
36741 <para>
36742 This option can be set to a regular expression that is applied to the string
36743 returned from the remote host. If the pattern does not match the response, the
36744 router declines. If <option>response_pattern</option> is not set, no checking of the
36745 response is done, unless the query was defaulted, in which case there is a
36746 check that the text returned after the first white space is the original
36747 address. This checks that the answer that has been received is in response to
36748 the correct question. For example, if the response is just a new domain, the
36749 following could be used:
36750 </para>
36751 <literallayout class="monospaced">
36752 response_pattern = ^([^@]+)$
36753 reroute = $local_part@$1
36754 </literallayout>
36755 <para>
36756 <indexterm role="option">
36757 <primary><option>timeout</option></primary>
36758 </indexterm>
36759 </para>
36760 <informaltable frame="all">
36761 <tgroup cols="4" colsep="0" rowsep="0">
36762 <colspec colwidth="8*" align="left"/>
36763 <colspec colwidth="6*" align="center"/>
36764 <colspec colwidth="6*" align="center"/>
36765 <colspec colwidth="6*" align="right"/>
36766 <tbody>
36767 <row>
36768 <entry><option>timeout</option></entry>
36769 <entry>Use: <emphasis>iplookup</emphasis></entry>
36770 <entry>Type: <emphasis>time</emphasis></entry>
36771 <entry>Default: <emphasis>5s</emphasis></entry>
36772 </row>
36773 </tbody>
36774 </tgroup>
36775 </informaltable>
36776 <para>
36777 This specifies the amount of time to wait for a response from the remote
36778 machine. The same timeout is used for the <function>connect()</function> function for a TCP
36779 call. It does not apply to UDP.
36780 </para>
36781 </chapter>
36782
36783 <chapter id="CHID7">
36784 <title>The manualroute router</title>
36785 <para>
36786 <indexterm role="concept" id="IIDmanrou1" class="startofrange">
36787 <primary><command>manualroute</command> router</primary>
36788 </indexterm>
36789 <indexterm role="concept" id="IIDmanrou2" class="startofrange">
36790 <primary>routers</primary>
36791 <secondary><command>manualroute</command></secondary>
36792 </indexterm>
36793 <indexterm role="concept">
36794 <primary>domain</primary>
36795 <secondary>manually routing</secondary>
36796 </indexterm>
36797 The <command>manualroute</command> router is so-called because it provides a way of manually
36798 routing an address according to its domain. It is mainly used when you want to
36799 route addresses to remote hosts according to your own rules, bypassing the
36800 normal DNS routing that looks up MX records. However, <command>manualroute</command> can also
36801 route to local transports, a facility that may be useful if you want to save
36802 messages for dial-in hosts in local files.
36803 </para>
36804 <para>
36805 The <command>manualroute</command> router compares a list of domain patterns with the domain
36806 it is trying to route. If there is no match, the router declines. Each pattern
36807 has associated with it a list of hosts and some other optional data, which may
36808 include a transport. The combination of a pattern and its data is called a
36809 <quote>routing rule</quote>. For patterns that do not have an associated transport, the
36810 generic <option>transport</option> option must specify a transport, unless the router is
36811 being used purely for verification (see <option>verify_only</option>).
36812 </para>
36813 <para>
36814 <indexterm role="variable">
36815 <primary><varname>$host</varname></primary>
36816 </indexterm>
36817 In the case of verification, matching the domain pattern is sufficient for the
36818 router to accept the address. When actually routing an address for delivery,
36819 an address that matches a domain pattern is queued for the associated
36820 transport. If the transport is not a local one, a host list must be associated
36821 with the pattern; IP addresses are looked up for the hosts, and these are
36822 passed to the transport along with the mail address. For local transports, a
36823 host list is optional. If it is present, it is passed in <varname>$host</varname> as a single
36824 text string.
36825 </para>
36826 <para>
36827 The list of routing rules can be provided as an inline string in
36828 <option>route_list</option>, or the data can be obtained by looking up the domain in a file
36829 or database by setting <option>route_data</option>. Only one of these settings may appear in
36830 any one instance of <command>manualroute</command>. The format of routing rules is described
36831 below, following the list of private options.
36832 </para>
36833 <section id="SECTprioptman">
36834 <title>Private options for manualroute</title>
36835 <para>
36836 <indexterm role="concept">
36837 <primary>options</primary>
36838 <secondary><command>manualroute</command> router</secondary>
36839 </indexterm>
36840 The private options for the <command>manualroute</command> router are as follows:
36841 </para>
36842 <para>
36843 <indexterm role="option">
36844 <primary><option>host_all_ignored</option></primary>
36845 </indexterm>
36846 </para>
36847 <informaltable frame="all">
36848 <tgroup cols="4" colsep="0" rowsep="0">
36849 <colspec colwidth="8*" align="left"/>
36850 <colspec colwidth="6*" align="center"/>
36851 <colspec colwidth="6*" align="center"/>
36852 <colspec colwidth="6*" align="right"/>
36853 <tbody>
36854 <row>
36855 <entry><option>host_all_ignored</option></entry>
36856 <entry>Use: <emphasis>manualroute</emphasis></entry>
36857 <entry>Type: <emphasis>string</emphasis></entry>
36858 <entry>Default: <emphasis>defer</emphasis></entry>
36859 </row>
36860 </tbody>
36861 </tgroup>
36862 </informaltable>
36863 <para>
36864 See <option>host_find_failed</option>.
36865 </para>
36866 <para>
36867 <indexterm role="option">
36868 <primary><option>host_find_failed</option></primary>
36869 </indexterm>
36870 </para>
36871 <informaltable frame="all">
36872 <tgroup cols="4" colsep="0" rowsep="0">
36873 <colspec colwidth="8*" align="left"/>
36874 <colspec colwidth="6*" align="center"/>
36875 <colspec colwidth="6*" align="center"/>
36876 <colspec colwidth="6*" align="right"/>
36877 <tbody>
36878 <row>
36879 <entry><option>host_find_failed</option></entry>
36880 <entry>Use: <emphasis>manualroute</emphasis></entry>
36881 <entry>Type: <emphasis>string</emphasis></entry>
36882 <entry>Default: <emphasis>freeze</emphasis></entry>
36883 </row>
36884 </tbody>
36885 </tgroup>
36886 </informaltable>
36887 <para>
36888 This option controls what happens when <command>manualroute</command> tries to find an IP
36889 address for a host, and the host does not exist. The option can be set to one
36890 of the following values:
36891 </para>
36892 <literallayout class="monospaced">
36893 decline
36894 defer
36895 fail
36896 freeze
36897 ignore
36898 pass
36899 </literallayout>
36900 <para>
36901 The default (<quote>freeze</quote>) assumes that this state is a serious configuration
36902 error. The difference between <quote>pass</quote> and <quote>decline</quote> is that the former
36903 forces the address to be passed to the next router (or the router defined by
36904 <option>pass_router</option>),
36905 <indexterm role="option">
36906 <primary><option>more</option></primary>
36907 </indexterm>
36908 overriding <option>no_more</option>, whereas the latter passes the address to the next
36909 router only if <option>more</option> is true.
36910 </para>
36911 <para>
36912 The value <quote>ignore</quote> causes Exim to completely ignore a host whose IP address
36913 cannot be found. If all the hosts in the list are ignored, the behaviour is
36914 controlled by the <option>host_all_ignored</option> option. This takes the same values
36915 as <option>host_find_failed</option>, except that it cannot be set to <quote>ignore</quote>.
36916 </para>
36917 <para>
36918 The <option>host_find_failed</option> option applies only to a definite <quote>does not exist</quote>
36919 state; if a host lookup gets a temporary error, delivery is deferred unless the
36920 generic <option>pass_on_timeout</option> option is set.
36921 </para>
36922 <para>
36923 <indexterm role="option">
36924 <primary><option>hosts_randomize</option></primary>
36925 </indexterm>
36926 </para>
36927 <informaltable frame="all">
36928 <tgroup cols="4" colsep="0" rowsep="0">
36929 <colspec colwidth="8*" align="left"/>
36930 <colspec colwidth="6*" align="center"/>
36931 <colspec colwidth="6*" align="center"/>
36932 <colspec colwidth="6*" align="right"/>
36933 <tbody>
36934 <row>
36935 <entry><option>hosts_randomize</option></entry>
36936 <entry>Use: <emphasis>manualroute</emphasis></entry>
36937 <entry>Type: <emphasis>boolean</emphasis></entry>
36938 <entry>Default: <emphasis>false</emphasis></entry>
36939 </row>
36940 </tbody>
36941 </tgroup>
36942 </informaltable>
36943 <para>
36944 <indexterm role="concept">
36945 <primary>randomized host list</primary>
36946 </indexterm>
36947 <indexterm role="concept">
36948 <primary>host</primary>
36949 <secondary>list of; randomized</secondary>
36950 </indexterm>
36951 If this option is set, the order of the items in a host list in a routing rule
36952 is randomized each time the list is used, unless an option in the routing rule
36953 overrides (see below). Randomizing the order of a host list can be used to do
36954 crude load sharing. However, if more than one mail address is routed by the
36955 same router to the same host list, the host lists are considered to be the same
36956 (even though they may be randomized into different orders) for the purpose of
36957 deciding whether to batch the deliveries into a single SMTP transaction.
36958 </para>
36959 <para>
36960 When <option>hosts_randomize</option> is true, a host list may be split
36961 into groups whose order is separately randomized. This makes it possible to
36962 set up MX-like behaviour. The boundaries between groups are indicated by an
36963 item that is just <literal>+</literal> in the host list. For example:
36964 </para>
36965 <literallayout class="monospaced">
36966 route_list = * host1:host2:host3:+:host4:host5
36967 </literallayout>
36968 <para>
36969 The order of the first three hosts and the order of the last two hosts is
36970 randomized for each use, but the first three always end up before the last two.
36971 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored. If a
36972 randomized host list is passed to an <command>smtp</command> transport that also has
36973 <option>hosts_randomize set</option>, the list is not re-randomized.
36974 </para>
36975 <para>
36976 <indexterm role="option">
36977 <primary><option>route_data</option></primary>
36978 </indexterm>
36979 </para>
36980 <informaltable frame="all">
36981 <tgroup cols="4" colsep="0" rowsep="0">
36982 <colspec colwidth="8*" align="left"/>
36983 <colspec colwidth="6*" align="center"/>
36984 <colspec colwidth="6*" align="center"/>
36985 <colspec colwidth="6*" align="right"/>
36986 <tbody>
36987 <row>
36988 <entry><option>route_data</option></entry>
36989 <entry>Use: <emphasis>manualroute</emphasis></entry>
36990 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36991 <entry>Default: <emphasis>unset</emphasis></entry>
36992 </row>
36993 </tbody>
36994 </tgroup>
36995 </informaltable>
36996 <para>
36997 If this option is set, it must expand to yield the data part of a routing rule.
36998 Typically, the expansion string includes a lookup based on the domain. For
36999 example:
37000 </para>
37001 <literallayout class="monospaced">
37002 route_data = ${lookup{$domain}dbm{/etc/routes}}
37003 </literallayout>
37004 <para>
37005 If the expansion is forced to fail, or the result is an empty string, the
37006 router declines. Other kinds of expansion failure cause delivery to be
37007 deferred.
37008 </para>
37009 <para>
37010 <indexterm role="option">
37011 <primary><option>route_list</option></primary>
37012 </indexterm>
37013 </para>
37014 <informaltable frame="all">
37015 <tgroup cols="4" colsep="0" rowsep="0">
37016 <colspec colwidth="8*" align="left"/>
37017 <colspec colwidth="6*" align="center"/>
37018 <colspec colwidth="6*" align="center"/>
37019 <colspec colwidth="6*" align="right"/>
37020 <tbody>
37021 <row>
37022 <entry><option>route_list</option></entry>
37023 <entry>Use: <emphasis>manualroute</emphasis></entry>
37024 <entry>Type: <emphasis>string list</emphasis></entry>
37025 <entry>Default: <emphasis>unset</emphasis></entry>
37026 </row>
37027 </tbody>
37028 </tgroup>
37029 </informaltable>
37030 <para>
37031 This string is a list of routing rules, in the form defined below. Note that,
37032 unlike most string lists, the items are separated by semicolons. This is so
37033 that they may contain colon-separated host lists.
37034 </para>
37035 <para>
37036 <indexterm role="option">
37037 <primary><option>same_domain_copy_routing</option></primary>
37038 </indexterm>
37039 </para>
37040 <informaltable frame="all">
37041 <tgroup cols="4" colsep="0" rowsep="0">
37042 <colspec colwidth="8*" align="left"/>
37043 <colspec colwidth="6*" align="center"/>
37044 <colspec colwidth="6*" align="center"/>
37045 <colspec colwidth="6*" align="right"/>
37046 <tbody>
37047 <row>
37048 <entry><option>same_domain_copy_routing</option></entry>
37049 <entry>Use: <emphasis>manualroute</emphasis></entry>
37050 <entry>Type: <emphasis>boolean</emphasis></entry>
37051 <entry>Default: <emphasis>false</emphasis></entry>
37052 </row>
37053 </tbody>
37054 </tgroup>
37055 </informaltable>
37056 <para>
37057 <indexterm role="concept">
37058 <primary>address</primary>
37059 <secondary>copying routing</secondary>
37060 </indexterm>
37061 Addresses with the same domain are normally routed by the <command>manualroute</command>
37062 router to the same list of hosts. However, this cannot be presumed, because the
37063 router options and preconditions may refer to the local part of the address. By
37064 default, therefore, Exim routes each address in a message independently. DNS
37065 servers run caches, so repeated DNS lookups are not normally expensive, and in
37066 any case, personal messages rarely have more than a few recipients.
37067 </para>
37068 <para>
37069 If you are running mailing lists with large numbers of subscribers at the same
37070 domain, and you are using a <command>manualroute</command> router which is independent of the
37071 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
37072 lookups for identical domains in one message. In this case, when
37073 <command>manualroute</command> routes an address to a remote transport, any other unrouted
37074 addresses in the message that have the same domain are automatically given the
37075 same routing without processing them independently. However, this is only done
37076 if <option>headers_add</option> and <option>headers_remove</option> are unset.
37077 </para>
37078 </section>
37079 <section id="SECID120">
37080 <title>Routing rules in route_list</title>
37081 <para>
37082 The value of <option>route_list</option> is a string consisting of a sequence of routing
37083 rules, separated by semicolons. If a semicolon is needed in a rule, it can be
37084 entered as two semicolons. Alternatively, the list separator can be changed as
37085 described (for colon-separated lists) in section <xref linkend="SECTlistconstruct"/>.
37086 Empty rules are ignored. The format of each rule is
37087 </para>
37088 <literallayout>
37089 &lt;<emphasis>domain pattern</emphasis>&gt;  &lt;<emphasis>list of hosts</emphasis>&gt;  &lt;<emphasis>options</emphasis>&gt;
37090 </literallayout>
37091 <para>
37092 The following example contains two rules, each with a simple domain pattern and
37093 no options:
37094 </para>
37095 <literallayout class="monospaced">
37096 route_list = \
37097   dict.ref.example  mail-1.ref.example:mail-2.ref.example ; \
37098   thes.ref.example  mail-3.ref.example:mail-4.ref.example
37099 </literallayout>
37100 <para>
37101 The three parts of a rule are separated by white space. The pattern and the
37102 list of hosts can be enclosed in quotes if necessary, and if they are, the
37103 usual quoting rules apply. Each rule in a <option>route_list</option> must start with a
37104 single domain pattern, which is the only mandatory item in the rule. The
37105 pattern is in the same format as one item in a domain list (see section
37106 <xref linkend="SECTdomainlist"/>),
37107 except that it may not be the name of an interpolated file.
37108 That is, it may be wildcarded, or a regular expression, or a file or database
37109 lookup (with semicolons doubled, because of the use of semicolon as a separator
37110 in a <option>route_list</option>).
37111 </para>
37112 <para>
37113 The rules in <option>route_list</option> are searched in order until one of the patterns
37114 matches the domain that is being routed. The list of hosts and then options are
37115 then used as described below. If there is no match, the router declines. When
37116 <option>route_list</option> is set, <option>route_data</option> must not be set.
37117 </para>
37118 </section>
37119 <section id="SECID121">
37120 <title>Routing rules in route_data</title>
37121 <para>
37122 The use of <option>route_list</option> is convenient when there are only a small number of
37123 routing rules. For larger numbers, it is easier to use a file or database to
37124 hold the routing information, and use the <option>route_data</option> option instead.
37125 The value of <option>route_data</option> is a list of hosts, followed by (optional) options.
37126 Most commonly, <option>route_data</option> is set as a string that contains an
37127 expansion lookup. For example, suppose we place two routing rules in a file
37128 like this:
37129 </para>
37130 <literallayout class="monospaced">
37131 dict.ref.example:  mail-1.ref.example:mail-2.ref.example
37132 thes.ref.example:  mail-3.ref.example:mail-4.ref.example
37133 </literallayout>
37134 <para>
37135 This data can be accessed by setting
37136 </para>
37137 <literallayout class="monospaced">
37138 route_data = ${lookup{$domain}lsearch{/the/file/name}}
37139 </literallayout>
37140 <para>
37141 Failure of the lookup results in an empty string, causing the router to
37142 decline. However, you do not have to use a lookup in <option>route_data</option>. The only
37143 requirement is that the result of expanding the string is a list of hosts,
37144 possibly followed by options, separated by white space. The list of hosts must
37145 be enclosed in quotes if it contains white space.
37146 </para>
37147 </section>
37148 <section id="SECID122">
37149 <title>Format of the list of hosts</title>
37150 <para>
37151 A list of hosts, whether obtained via <option>route_data</option> or <option>route_list</option>, is
37152 always separately expanded before use. If the expansion fails, the router
37153 declines. The result of the expansion must be a colon-separated list of names
37154 and/or IP addresses, optionally also including ports.
37155 If the list is written with spaces, it must be protected with quotes.
37156 The format of each item
37157 in the list is described in the next section. The list separator can be changed
37158 as described in section <xref linkend="SECTlistsepchange"/>.
37159 </para>
37160 <para>
37161 If the list of hosts was obtained from a <option>route_list</option> item, the following
37162 variables are set during its expansion:
37163 </para>
37164 <itemizedlist>
37165 <listitem>
37166 <para>
37167 <indexterm role="concept">
37168 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname>  etc)</primary>
37169 <secondary>in <command>manualroute</command> router</secondary>
37170 </indexterm>
37171 If the domain was matched against a regular expression, the numeric variables
37172 <varname>$1</varname>, <varname>$2</varname>, etc. may be set. For example:
37173 </para>
37174 <literallayout class="monospaced">
37175 route_list = ^domain(\d+)   host-$1.text.example
37176 </literallayout>
37177 </listitem>
37178 <listitem>
37179 <para>
37180 <varname>$0</varname> is always set to the entire domain.
37181 </para>
37182 </listitem>
37183 <listitem>
37184 <para>
37185 <varname>$1</varname> is also set when partial matching is done in a file lookup.
37186 </para>
37187 </listitem>
37188 <listitem>
37189 <para>
37190 <indexterm role="variable">
37191 <primary><varname>$value</varname></primary>
37192 </indexterm>
37193 If the pattern that matched the domain was a lookup item, the data that was
37194 looked up is available in the expansion variable <varname>$value</varname>. For example:
37195 </para>
37196 <literallayout class="monospaced">
37197 route_list = lsearch;;/some/file.routes  $value
37198 </literallayout>
37199 </listitem>
37200 </itemizedlist>
37201 <para>
37202 Note the doubling of the semicolon in the pattern that is necessary because
37203 semicolon is the default route list separator.
37204 </para>
37205 </section>
37206 <section id="SECTformatonehostitem">
37207 <title>Format of one host item</title>
37208 <para>
37209 Each item in the list of hosts is either a host name or an IP address,
37210 optionally with an attached port number. When no port is given, an IP address
37211 is not enclosed in brackets. When a port is specified, it overrides the port
37212 specification on the transport. The port is separated from the name or address
37213 by a colon. This leads to some complications:
37214 </para>
37215 <itemizedlist>
37216 <listitem>
37217 <para>
37218 Because colon is the default separator for the list of hosts, either
37219 the colon that specifies a port must be doubled, or the list separator must
37220 be changed. The following two examples have the same effect:
37221 </para>
37222 <literallayout class="monospaced">
37223 route_list = * "host1.tld::1225 : host2.tld::1226"
37224 route_list = * "&lt;+ host1.tld:1225 + host2.tld:1226"
37225 </literallayout>
37226 </listitem>
37227 <listitem>
37228 <para>
37229 When IPv6 addresses are involved, it gets worse, because they contain
37230 colons of their own. To make this case easier, it is permitted to
37231 enclose an IP address (either v4 or v6) in square brackets if a port
37232 number follows. For example:
37233 </para>
37234 <literallayout class="monospaced">
37235 route_list = * "&lt;/ [10.1.1.1]:1225 / [::1]:1226"
37236 </literallayout>
37237 </listitem>
37238 </itemizedlist>
37239 </section>
37240 <section id="SECThostshowused">
37241 <title>How the list of hosts is used</title>
37242 <para>
37243 When an address is routed to an <command>smtp</command> transport by <command>manualroute</command>, each of
37244 the hosts is tried, in the order specified, when carrying out the SMTP
37245 delivery. However, the order can be changed by setting the <option>hosts_randomize</option>
37246 option, either on the router (see section <xref linkend="SECTprioptman"/> above), or on the
37247 transport.
37248 </para>
37249 <para>
37250 Hosts may be listed by name or by IP address. An unadorned name in the list of
37251 hosts is interpreted as a host name. A name that is followed by <literal>/MX</literal> is
37252 interpreted as an indirection to a sublist of hosts obtained by looking up MX
37253 records in the DNS. For example:
37254 </para>
37255 <literallayout class="monospaced">
37256 route_list = *  x.y.z:p.q.r/MX:e.f.g
37257 </literallayout>
37258 <para>
37259 If this feature is used with a port specifier, the port must come last. For
37260 example:
37261 </para>
37262 <literallayout class="monospaced">
37263 route_list = *  dom1.tld/mx::1225
37264 </literallayout>
37265 <para>
37266 If the <option>hosts_randomize</option> option is set, the order of the items in the list is
37267 randomized before any lookups are done. Exim then scans the list; for any name
37268 that is not followed by <literal>/MX</literal> it looks up an IP address. If this turns out to
37269 be an interface on the local host and the item is not the first in the list,
37270 Exim discards it and any subsequent items. If it is the first item, what
37271 happens is controlled by the
37272 <indexterm role="option">
37273 <primary><option>self</option></primary>
37274 <secondary>in <command>manualroute</command> router</secondary>
37275 </indexterm>
37276 <option>self</option> option of the router.
37277 </para>
37278 <para>
37279 A name on the list that is followed by <literal>/MX</literal> is replaced with the list of
37280 hosts obtained by looking up MX records for the name. This is always a DNS
37281 lookup; the <option>bydns</option> and <option>byname</option> options (see section <xref linkend="SECThowoptused"/>
37282 below) are not relevant here. The order of these hosts is determined by the
37283 preference values in the MX records, according to the usual rules. Because
37284 randomizing happens before the MX lookup, it does not affect the order that is
37285 defined by MX preferences.
37286 </para>
37287 <para>
37288 If the local host is present in the sublist obtained from MX records, but is
37289 not the most preferred host in that list, it and any equally or less
37290 preferred hosts are removed before the sublist is inserted into the main list.
37291 </para>
37292 <para>
37293 If the local host is the most preferred host in the MX list, what happens
37294 depends on where in the original list of hosts the <literal>/MX</literal> item appears. If it
37295 is not the first item (that is, there are previous hosts in the main list),
37296 Exim discards this name and any subsequent items in the main list.
37297 </para>
37298 <para>
37299 If the MX item is first in the list of hosts, and the local host is the
37300 most preferred host, what happens is controlled by the <option>self</option> option of the
37301 router.
37302 </para>
37303 <para>
37304 DNS failures when lookup up the MX records are treated in the same way as DNS
37305 failures when looking up IP addresses: <option>pass_on_timeout</option> and
37306 <option>host_find_failed</option> are used when relevant.
37307 </para>
37308 <para>
37309 The generic <option>ignore_target_hosts</option> option applies to all hosts in the list,
37310 whether obtained from an MX lookup or not.
37311 </para>
37312 </section>
37313 <section id="SECThowoptused">
37314 <title>How the options are used</title>
37315 <para>
37316 The options are a sequence of words, space-separated.
37317 One of the words can be the name of a transport; this overrides the
37318 <option>transport</option> option on the router for this particular routing rule only. The
37319 other words (if present) control randomization of the list of hosts on a
37320 per-rule basis, and how the IP addresses of the hosts are to be found when
37321 routing to a remote transport. These options are as follows:
37322 </para>
37323 <itemizedlist>
37324 <listitem>
37325 <para>
37326 <option>randomize</option>: randomize the order of the hosts in this list, overriding the
37327 setting of <option>hosts_randomize</option> for this routing rule only.
37328 </para>
37329 </listitem>
37330 <listitem>
37331 <para>
37332 <option>no_randomize</option>: do not randomize the order of the hosts in this list,
37333 overriding the setting of <option>hosts_randomize</option> for this routing rule only.
37334 </para>
37335 </listitem>
37336 <listitem>
37337 <para>
37338 <option>byname</option>: use <function>getipnodebyname()</function> (<function>gethostbyname()</function> on older systems) to
37339 find IP addresses. This function may ultimately cause a DNS lookup, but it may
37340 also look in <filename>/etc/hosts</filename> or other sources of information.
37341 </para>
37342 </listitem>
37343 <listitem>
37344 <para>
37345 <option>bydns</option>: look up address records for the hosts directly in the DNS; fail if
37346 no address records are found. If there is a temporary DNS error (such as a
37347 timeout), delivery is deferred.
37348 </para>
37349 </listitem>
37350 <listitem>
37351 <para>
37352 <option>ipv4_only</option>: in direct DNS lookups, look up only A records.
37353 </para>
37354 </listitem>
37355 <listitem>
37356 <para>
37357 <option>ipv4_prefer</option>: in direct DNS lookups, sort A records before AAAA records.
37358 </para>
37359 </listitem>
37360 </itemizedlist>
37361 <para>
37362 For example:
37363 </para>
37364 <literallayout class="monospaced">
37365 route_list = domain1  host1:host2:host3  randomize bydns;\
37366              domain2  host4:host5
37367 </literallayout>
37368 <para>
37369 If neither <option>byname</option> nor <option>bydns</option> is given, Exim behaves as follows: First, a
37370 DNS lookup is done. If this yields anything other than HOST_NOT_FOUND, that
37371 result is used. Otherwise, Exim goes on to try a call to <function>getipnodebyname()</function>
37372 or <function>gethostbyname()</function>, and the result of the lookup is the result of that
37373 call.
37374 </para>
37375 <para>
37376 <emphasis role="bold">Warning</emphasis>: It has been discovered that on some systems, if a DNS lookup
37377 called via <function>getipnodebyname()</function> times out, HOST_NOT_FOUND is returned
37378 instead of TRY_AGAIN. That is why the default action is to try a DNS
37379 lookup first. Only if that gives a definite <quote>no such host</quote> is the local
37380 function called.
37381 </para>
37382 <para>
37383 <emphasis role="bold">Compatibility</emphasis>: From Exim 4.85 until fixed for 4.90, there was an
37384 inadvertent constraint that a transport name as an option had to be the last
37385 option specified.
37386 </para>
37387 <para>
37388 If no IP address for a host can be found, what happens is controlled by the
37389 <option>host_find_failed</option> option.
37390 </para>
37391 <para>
37392 <indexterm role="variable">
37393 <primary><varname>$host</varname></primary>
37394 </indexterm>
37395 When an address is routed to a local transport, IP addresses are not looked up.
37396 The host list is passed to the transport in the <varname>$host</varname> variable.
37397 </para>
37398 </section>
37399 <section id="SECID123">
37400 <title>Manualroute examples</title>
37401 <para>
37402 In some of the examples that follow, the presence of the <option>remote_smtp</option>
37403 transport, as defined in the default configuration file, is assumed:
37404 </para>
37405 <itemizedlist>
37406 <listitem>
37407 <para>
37408 <indexterm role="concept">
37409 <primary>smart host</primary>
37410 <secondary>example router</secondary>
37411 </indexterm>
37412 The <command>manualroute</command> router can be used to forward all external mail to a
37413 <emphasis>smart host</emphasis>. If you have set up, in the main part of the configuration, a
37414 named domain list that contains your local domains, for example:
37415 </para>
37416 <literallayout class="monospaced">
37417 domainlist local_domains = my.domain.example
37418 </literallayout>
37419 <para>
37420 You can arrange for all other domains to be routed to a smart host by making
37421 your first router something like this:
37422 </para>
37423 <literallayout class="monospaced">
37424 smart_route:
37425   driver = manualroute
37426   domains = !+local_domains
37427   transport = remote_smtp
37428   route_list = * smarthost.ref.example
37429 </literallayout>
37430 <para>
37431 This causes all non-local addresses to be sent to the single host
37432 <emphasis>smarthost.ref.example</emphasis>. If a colon-separated list of smart hosts is given,
37433 they are tried in order
37434 (but you can use <option>hosts_randomize</option> to vary the order each time).
37435 Another way of configuring the same thing is this:
37436 </para>
37437 <literallayout class="monospaced">
37438 smart_route:
37439   driver = manualroute
37440   transport = remote_smtp
37441   route_list = !+local_domains  smarthost.ref.example
37442 </literallayout>
37443 <para>
37444 There is no difference in behaviour between these two routers as they stand.
37445 However, they behave differently if <option>no_more</option> is added to them. In the first
37446 example, the router is skipped if the domain does not match the <option>domains</option>
37447 precondition; the following router is always tried. If the router runs, it
37448 always matches the domain and so can never decline. Therefore, <option>no_more</option>
37449 would have no effect. In the second case, the router is never skipped; it
37450 always runs. However, if it doesn&#x2019;t match the domain, it declines. In this case
37451 <option>no_more</option> would prevent subsequent routers from running.
37452 </para>
37453 </listitem>
37454 <listitem>
37455 <para>
37456 <indexterm role="concept">
37457 <primary>mail hub example</primary>
37458 </indexterm>
37459 A <emphasis>mail hub</emphasis> is a host which receives mail for a number of domains via MX
37460 records in the DNS and delivers it via its own private routing mechanism. Often
37461 the final destinations are behind a firewall, with the mail hub being the one
37462 machine that can connect to machines both inside and outside the firewall. The
37463 <command>manualroute</command> router is usually used on a mail hub to route incoming messages
37464 to the correct hosts. For a small number of domains, the routing can be inline,
37465 using the <option>route_list</option> option, but for a larger number a file or database
37466 lookup is easier to manage.
37467 </para>
37468 <para>
37469 If the domain names are in fact the names of the machines to which the mail is
37470 to be sent by the mail hub, the configuration can be quite simple. For
37471 example:
37472 </para>
37473 <literallayout class="monospaced">
37474 hub_route:
37475   driver = manualroute
37476   transport = remote_smtp
37477   route_list = *.rhodes.tvs.example  $domain
37478 </literallayout>
37479 <para>
37480 This configuration routes domains that match <literal>*.rhodes.tvs.example</literal> to hosts
37481 whose names are the same as the mail domains. A similar approach can be taken
37482 if the host name can be obtained from the domain name by a string manipulation
37483 that the expansion facilities can handle. Otherwise, a lookup based on the
37484 domain can be used to find the host:
37485 </para>
37486 <literallayout class="monospaced">
37487 through_firewall:
37488   driver = manualroute
37489   transport = remote_smtp
37490   route_data = ${lookup {$domain} cdb {/internal/host/routes}}
37491 </literallayout>
37492 <para>
37493 The result of the lookup must be the name or IP address of the host (or
37494 hosts) to which the address is to be routed. If the lookup fails, the route
37495 data is empty, causing the router to decline. The address then passes to the
37496 next router.
37497 </para>
37498 </listitem>
37499 <listitem>
37500 <para>
37501 <indexterm role="concept">
37502 <primary>batched SMTP output example</primary>
37503 </indexterm>
37504 <indexterm role="concept">
37505 <primary>SMTP</primary>
37506 <secondary>batched outgoing; example</secondary>
37507 </indexterm>
37508 You can use <command>manualroute</command> to deliver messages to pipes or files in batched
37509 SMTP format for onward transportation by some other means. This is one way of
37510 storing mail for a dial-up host when it is not connected. The route list entry
37511 can be as simple as a single domain name in a configuration like this:
37512 </para>
37513 <literallayout class="monospaced">
37514 save_in_file:
37515   driver = manualroute
37516   transport = batchsmtp_appendfile
37517   route_list = saved.domain.example
37518 </literallayout>
37519 <para>
37520 though often a pattern is used to pick up more than one domain. If there are
37521 several domains or groups of domains with different transport requirements,
37522 different transports can be listed in the routing information:
37523 </para>
37524 <literallayout class="monospaced">
37525 save_in_file:
37526   driver = manualroute
37527   route_list = \
37528     *.saved.domain1.example  $domain  batch_appendfile; \
37529     *.saved.domain2.example  \
37530       ${lookup{$domain}dbm{/domain2/hosts}{$value}fail} \
37531       batch_pipe
37532 </literallayout>
37533 <para>
37534 <indexterm role="variable">
37535 <primary><varname>$domain</varname></primary>
37536 </indexterm>
37537 <indexterm role="variable">
37538 <primary><varname>$host</varname></primary>
37539 </indexterm>
37540 The first of these just passes the domain in the <varname>$host</varname> variable, which
37541 doesn&#x2019;t achieve much (since it is also in <varname>$domain</varname>), but the second does a
37542 file lookup to find a value to pass, causing the router to decline to handle
37543 the address if the lookup fails.
37544 </para>
37545 </listitem>
37546 <listitem>
37547 <para>
37548 <indexterm role="concept">
37549 <primary>UUCP</primary>
37550 <secondary>example of router for</secondary>
37551 </indexterm>
37552 Routing mail directly to UUCP software is a specific case of the use of
37553 <command>manualroute</command> in a gateway to another mail environment. This is an example of
37554 one way it can be done:
37555 </para>
37556 <literallayout class="monospaced">
37557 # Transport
37558 uucp:
37559   driver = pipe
37560   user = nobody
37561   command = /usr/local/bin/uux -r - \
37562     ${substr_-5:$host}!rmail ${local_part}
37563   return_fail_output = true
37564
37565 # Router
37566 uucphost:
37567   transport = uucp
37568   driver = manualroute
37569   route_data = \
37570     ${lookup{$domain}lsearch{/usr/local/exim/uucphosts}}
37571 </literallayout>
37572 <para>
37573 The file <filename>/usr/local/exim/uucphosts</filename> contains entries like
37574 </para>
37575 <literallayout class="monospaced">
37576 darksite.ethereal.example:           darksite.UUCP
37577 </literallayout>
37578 <para>
37579 It can be set up more simply without adding and removing <quote>.UUCP</quote> but this way
37580 makes clear the distinction between the domain name
37581 <emphasis>darksite.ethereal.example</emphasis> and the UUCP host name <emphasis>darksite</emphasis>.
37582 </para>
37583 </listitem>
37584 </itemizedlist>
37585 <para>
37586 <indexterm role="concept" startref="IIDmanrou1" class="endofrange"/>
37587 <indexterm role="concept" startref="IIDmanrou2" class="endofrange"/>
37588 </para>
37589 </section>
37590 </chapter>
37591
37592 <chapter id="CHAPdriverlast">
37593 <title>The queryprogram router</title>
37594 <para>
37595 <indexterm role="concept" id="IIDquerou1" class="startofrange">
37596 <primary><command>queryprogram</command> router</primary>
37597 </indexterm>
37598 <indexterm role="concept" id="IIDquerou2" class="startofrange">
37599 <primary>routers</primary>
37600 <secondary><command>queryprogram</command></secondary>
37601 </indexterm>
37602 <indexterm role="concept">
37603 <primary>routing</primary>
37604 <secondary>by external program</secondary>
37605 </indexterm>
37606 The <command>queryprogram</command> router routes an address by running an external command
37607 and acting on its output. This is an expensive way to route, and is intended
37608 mainly for use in lightly-loaded systems, or for performing experiments.
37609 However, if it is possible to use the precondition options (<option>domains</option>,
37610 <option>local_parts</option>, etc) to skip this router for most addresses, it could sensibly
37611 be used in special cases, even on a busy host. There are the following private
37612 options:
37613 <indexterm role="concept">
37614 <primary>options</primary>
37615 <secondary><command>queryprogram</command> router</secondary>
37616 </indexterm>
37617 </para>
37618 <para>
37619 <indexterm role="option">
37620 <primary><option>command</option></primary>
37621 </indexterm>
37622 </para>
37623 <informaltable frame="all">
37624 <tgroup cols="4" colsep="0" rowsep="0">
37625 <colspec colwidth="8*" align="left"/>
37626 <colspec colwidth="6*" align="center"/>
37627 <colspec colwidth="6*" align="center"/>
37628 <colspec colwidth="6*" align="right"/>
37629 <tbody>
37630 <row>
37631 <entry><option>command</option></entry>
37632 <entry>Use: <emphasis>queryprogram</emphasis></entry>
37633 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37634 <entry>Default: <emphasis>unset</emphasis></entry>
37635 </row>
37636 </tbody>
37637 </tgroup>
37638 </informaltable>
37639 <para>
37640 This option must be set. It specifies the command that is to be run. The
37641 command is split up into a command name and arguments, and then each is
37642 expanded separately (exactly as for a <command>pipe</command> transport, described in chapter
37643 <xref linkend="CHAPpipetransport"/>).
37644 </para>
37645 <para>
37646 <indexterm role="option">
37647 <primary><option>command_group</option></primary>
37648 </indexterm>
37649 </para>
37650 <informaltable frame="all">
37651 <tgroup cols="4" colsep="0" rowsep="0">
37652 <colspec colwidth="8*" align="left"/>
37653 <colspec colwidth="6*" align="center"/>
37654 <colspec colwidth="6*" align="center"/>
37655 <colspec colwidth="6*" align="right"/>
37656 <tbody>
37657 <row>
37658 <entry><option>command_group</option></entry>
37659 <entry>Use: <emphasis>queryprogram</emphasis></entry>
37660 <entry>Type: <emphasis>string</emphasis></entry>
37661 <entry>Default: <emphasis>unset</emphasis></entry>
37662 </row>
37663 </tbody>
37664 </tgroup>
37665 </informaltable>
37666 <para>
37667 <indexterm role="concept">
37668 <primary>gid (group id)</primary>
37669 <secondary>in <command>queryprogram</command> router</secondary>
37670 </indexterm>
37671 This option specifies a gid to be set when running the command while routing an
37672 address for deliver. It must be set if <option>command_user</option> specifies a numerical
37673 uid. If it begins with a digit, it is interpreted as the numerical value of the
37674 gid. Otherwise it is looked up using <function>getgrnam()</function>.
37675 </para>
37676 <para>
37677 <indexterm role="option">
37678 <primary><option>command_user</option></primary>
37679 </indexterm>
37680 </para>
37681 <informaltable frame="all">
37682 <tgroup cols="4" colsep="0" rowsep="0">
37683 <colspec colwidth="8*" align="left"/>
37684 <colspec colwidth="6*" align="center"/>
37685 <colspec colwidth="6*" align="center"/>
37686 <colspec colwidth="6*" align="right"/>
37687 <tbody>
37688 <row>
37689 <entry><option>command_user</option></entry>
37690 <entry>Use: <emphasis>queryprogram</emphasis></entry>
37691 <entry>Type: <emphasis>string</emphasis></entry>
37692 <entry>Default: <emphasis>unset</emphasis></entry>
37693 </row>
37694 </tbody>
37695 </tgroup>
37696 </informaltable>
37697 <para>
37698 <indexterm role="concept">
37699 <primary>uid (user id)</primary>
37700 <secondary>for <command>queryprogram</command></secondary>
37701 </indexterm>
37702 This option must be set. It specifies the uid which is set when running the
37703 command while routing an address for delivery. If the value begins with a digit,
37704 it is interpreted as the numerical value of the uid. Otherwise, it is looked up
37705 using <function>getpwnam()</function> to obtain a value for the uid and, if <option>command_group</option> is
37706 not set, a value for the gid also.
37707 </para>
37708 <para>
37709 <emphasis role="bold">Warning:</emphasis> Changing uid and gid is possible only when Exim is running as
37710 root, which it does during a normal delivery in a conventional configuration.
37711 However, when an address is being verified during message reception, Exim is
37712 usually running as the Exim user, not as root. If the <command>queryprogram</command> router
37713 is called from a non-root process, Exim cannot change uid or gid before running
37714 the command. In this circumstance the command runs under the current uid and
37715 gid.
37716 </para>
37717 <para>
37718 <indexterm role="option">
37719 <primary><option>current_directory</option></primary>
37720 </indexterm>
37721 </para>
37722 <informaltable frame="all">
37723 <tgroup cols="4" colsep="0" rowsep="0">
37724 <colspec colwidth="8*" align="left"/>
37725 <colspec colwidth="6*" align="center"/>
37726 <colspec colwidth="6*" align="center"/>
37727 <colspec colwidth="6*" align="right"/>
37728 <tbody>
37729 <row>
37730 <entry><option>current_directory</option></entry>
37731 <entry>Use: <emphasis>queryprogram</emphasis></entry>
37732 <entry>Type: <emphasis>string</emphasis></entry>
37733 <entry>Default: <emphasis>/</emphasis></entry>
37734 </row>
37735 </tbody>
37736 </tgroup>
37737 </informaltable>
37738 <para>
37739 This option specifies an absolute path which is made the current directory
37740 before running the command.
37741 </para>
37742 <para>
37743 <indexterm role="option">
37744 <primary><option>timeout</option></primary>
37745 </indexterm>
37746 </para>
37747 <informaltable frame="all">
37748 <tgroup cols="4" colsep="0" rowsep="0">
37749 <colspec colwidth="8*" align="left"/>
37750 <colspec colwidth="6*" align="center"/>
37751 <colspec colwidth="6*" align="center"/>
37752 <colspec colwidth="6*" align="right"/>
37753 <tbody>
37754 <row>
37755 <entry><option>timeout</option></entry>
37756 <entry>Use: <emphasis>queryprogram</emphasis></entry>
37757 <entry>Type: <emphasis>time</emphasis></entry>
37758 <entry>Default: <emphasis>1h</emphasis></entry>
37759 </row>
37760 </tbody>
37761 </tgroup>
37762 </informaltable>
37763 <para>
37764 If the command does not complete within the timeout period, its process group
37765 is killed and the message is frozen. A value of zero time specifies no
37766 timeout.
37767 </para>
37768 <para>
37769 The standard output of the command is connected to a pipe, which is read when
37770 the command terminates. It should consist of a single line of output,
37771 containing up to five fields, separated by white space. The maximum length of
37772 the line is 1023 characters. Longer lines are silently truncated. The first
37773 field is one of the following words (case-insensitive):
37774 </para>
37775 <itemizedlist>
37776 <listitem>
37777 <para>
37778 <emphasis>Accept</emphasis>: routing succeeded; the remaining fields specify what to do (see
37779 below).
37780 </para>
37781 </listitem>
37782 <listitem>
37783 <para>
37784 <emphasis>Decline</emphasis>: the router declines; pass the address to the next router, unless
37785 <option>no_more</option> is set.
37786 </para>
37787 </listitem>
37788 <listitem>
37789 <para>
37790 <emphasis>Fail</emphasis>: routing failed; do not pass the address to any more routers. Any
37791 subsequent text on the line is an error message. If the router is run as part
37792 of address verification during an incoming SMTP message, the message is
37793 included in the SMTP response.
37794 </para>
37795 </listitem>
37796 <listitem>
37797 <para>
37798 <emphasis>Defer</emphasis>: routing could not be completed at this time; try again later. Any
37799 subsequent text on the line is an error message which is logged. It is not
37800 included in any SMTP response.
37801 </para>
37802 </listitem>
37803 <listitem>
37804 <para>
37805 <emphasis>Freeze</emphasis>: the same as <emphasis>defer</emphasis>, except that the message is frozen.
37806 </para>
37807 </listitem>
37808 <listitem>
37809 <para>
37810 <emphasis>Pass</emphasis>: pass the address to the next router (or the router specified by
37811 <option>pass_router</option>), overriding <option>no_more</option>.
37812 </para>
37813 </listitem>
37814 <listitem>
37815 <para>
37816 <emphasis>Redirect</emphasis>: the message is redirected. The remainder of the line is a list of
37817 new addresses, which are routed independently, starting with the first router,
37818 or the router specified by <option>redirect_router</option>, if set.
37819 </para>
37820 </listitem>
37821 </itemizedlist>
37822 <para>
37823 When the first word is <emphasis>accept</emphasis>, the remainder of the line consists of a
37824 number of keyed data values, as follows (split into two lines here, to fit on
37825 the page):
37826 </para>
37827 <literallayout class="monospaced">
37828 ACCEPT TRANSPORT=&lt;transport&gt; HOSTS=&lt;list of hosts&gt;
37829 LOOKUP=byname|bydns DATA=&lt;text&gt;
37830 </literallayout>
37831 <para>
37832 The data items can be given in any order, and all are optional. If no transport
37833 is included, the transport specified by the generic <option>transport</option> option is
37834 used. The list of hosts and the lookup type are needed only if the transport is
37835 an <command>smtp</command> transport that does not itself supply a list of hosts.
37836 </para>
37837 <para>
37838 The format of the list of hosts is the same as for the <command>manualroute</command> router.
37839 As well as host names and IP addresses with optional port numbers, as described
37840 in section <xref linkend="SECTformatonehostitem"/>, it may contain names followed by
37841 <literal>/MX</literal> to specify sublists of hosts that are obtained by looking up MX records
37842 (see section <xref linkend="SECThostshowused"/>).
37843 </para>
37844 <para>
37845 If the lookup type is not specified, Exim behaves as follows when trying to
37846 find an IP address for each host: First, a DNS lookup is done. If this yields
37847 anything other than HOST_NOT_FOUND, that result is used. Otherwise, Exim
37848 goes on to try a call to <function>getipnodebyname()</function> or <function>gethostbyname()</function>, and the
37849 result of the lookup is the result of that call.
37850 </para>
37851 <para>
37852 <indexterm role="variable">
37853 <primary><varname>$address_data</varname></primary>
37854 </indexterm>
37855 If the DATA field is set, its value is placed in the <varname>$address_data</varname>
37856 variable. For example, this return line
37857 </para>
37858 <literallayout class="monospaced">
37859 accept hosts=x1.y.example:x2.y.example data="rule1"
37860 </literallayout>
37861 <para>
37862 routes the address to the default transport, passing a list of two hosts. When
37863 the transport runs, the string <quote>rule1</quote> is in <varname>$address_data</varname>.
37864 <indexterm role="concept" startref="IIDquerou1" class="endofrange"/>
37865 <indexterm role="concept" startref="IIDquerou2" class="endofrange"/>
37866 </para>
37867 </chapter>
37868
37869 <chapter id="CHAPredirect">
37870 <title>The redirect router</title>
37871 <para>
37872 <indexterm role="concept" id="IIDredrou1" class="startofrange">
37873 <primary><command>redirect</command> router</primary>
37874 </indexterm>
37875 <indexterm role="concept" id="IIDredrou2" class="startofrange">
37876 <primary>routers</primary>
37877 <secondary><command>redirect</command></secondary>
37878 </indexterm>
37879 <indexterm role="concept">
37880 <primary>alias file</primary>
37881 <secondary>in a <command>redirect</command> router</secondary>
37882 </indexterm>
37883 <indexterm role="concept">
37884 <primary>address redirection</primary>
37885 <secondary><command>redirect</command> router</secondary>
37886 </indexterm>
37887 The <command>redirect</command> router handles several kinds of address redirection. Its most
37888 common uses are for resolving local part aliases from a central alias file
37889 (usually called <filename>/etc/aliases</filename>) and for handling users&#x2019; personal <filename>.forward</filename>
37890 files, but it has many other potential uses. The incoming address can be
37891 redirected in several different ways:
37892 </para>
37893 <itemizedlist>
37894 <listitem>
37895 <para>
37896 It can be replaced by one or more new addresses which are themselves routed
37897 independently.
37898 </para>
37899 </listitem>
37900 <listitem>
37901 <para>
37902 It can be routed to be delivered to a given file or directory.
37903 </para>
37904 </listitem>
37905 <listitem>
37906 <para>
37907 It can be routed to be delivered to a specified pipe command.
37908 </para>
37909 </listitem>
37910 <listitem>
37911 <para>
37912 It can cause an automatic reply to be generated.
37913 </para>
37914 </listitem>
37915 <listitem>
37916 <para>
37917 It can be forced to fail, optionally with a custom error message.
37918 </para>
37919 </listitem>
37920 <listitem>
37921 <para>
37922 It can be temporarily deferred, optionally with a custom message.
37923 </para>
37924 </listitem>
37925 <listitem>
37926 <para>
37927 It can be discarded.
37928 </para>
37929 </listitem>
37930 </itemizedlist>
37931 <para>
37932 The generic <option>transport</option> option must not be set for <command>redirect</command> routers.
37933 However, there are some private options which define transports for delivery to
37934 files and pipes, and for generating autoreplies. See the <option>file_transport</option>,
37935 <option>pipe_transport</option> and <option>reply_transport</option> descriptions below.
37936 </para>
37937 <para>
37938 If success DSNs have been requested
37939 <indexterm role="concept">
37940 <primary>DSN</primary>
37941 <secondary>success</secondary>
37942 </indexterm>
37943 <indexterm role="concept">
37944 <primary>Delivery Status Notification</primary>
37945 <secondary>success</secondary>
37946 </indexterm>
37947 redirection triggers one and the DSN options are not passed any further.
37948 </para>
37949 <section id="SECID124">
37950 <title>Redirection data</title>
37951 <para>
37952 The router operates by interpreting a text string which it obtains either by
37953 expanding the contents of the <option>data</option> option, or by reading the entire
37954 contents of a file whose name is given in the <option>file</option> option. These two
37955 options are mutually exclusive. The first is commonly used for handling system
37956 aliases, in a configuration like this:
37957 </para>
37958 <literallayout class="monospaced">
37959 system_aliases:
37960   driver = redirect
37961   data = ${lookup{$local_part}lsearch{/etc/aliases}}
37962 </literallayout>
37963 <para>
37964 If the lookup fails, the expanded string in this example is empty. When the
37965 expansion of <option>data</option> results in an empty string, the router declines. A forced
37966 expansion failure also causes the router to decline; other expansion failures
37967 cause delivery to be deferred.
37968 </para>
37969 <para>
37970 A configuration using <option>file</option> is commonly used for handling users&#x2019;
37971 <filename>.forward</filename> files, like this:
37972 </para>
37973 <literallayout class="monospaced">
37974 userforward:
37975   driver = redirect
37976   check_local_user
37977   file = $home/.forward
37978   no_verify
37979 </literallayout>
37980 <para>
37981 If the file does not exist, or causes no action to be taken (for example, it is
37982 empty or consists only of comments), the router declines. <emphasis role="bold">Warning</emphasis>: This
37983 is not the case when the file contains syntactically valid items that happen to
37984 yield empty addresses, for example, items containing only RFC 2822 address
37985 comments.
37986 </para>
37987 </section>
37988 <section id="SECID125">
37989 <title>Forward files and address verification</title>
37990 <para>
37991 <indexterm role="concept">
37992 <primary>address redirection</primary>
37993 <secondary>while verifying</secondary>
37994 </indexterm>
37995 It is usual to set <option>no_verify</option> on <command>redirect</command> routers which handle users&#x2019;
37996 <filename>.forward</filename> files, as in the example above. There are two reasons for this:
37997 </para>
37998 <itemizedlist>
37999 <listitem>
38000 <para>
38001 When Exim is receiving an incoming SMTP message from a remote host, it is
38002 running under the Exim uid, not as root. Exim is unable to change uid to read
38003 the file as the user, and it may not be able to read it as the Exim user. So in
38004 practice the router may not be able to operate.
38005 </para>
38006 </listitem>
38007 <listitem>
38008 <para>
38009 However, even when the router can operate, the existence of a <filename>.forward</filename> file
38010 is unimportant when verifying an address. What should be checked is whether the
38011 local part is a valid user name or not. Cutting out the redirection processing
38012 saves some resources.
38013 </para>
38014 </listitem>
38015 </itemizedlist>
38016 </section>
38017 <section id="SECID126">
38018 <title>Interpreting redirection data</title>
38019 <para>
38020 <indexterm role="concept">
38021 <primary>Sieve filter</primary>
38022 <secondary>specifying in redirection data</secondary>
38023 </indexterm>
38024 <indexterm role="concept">
38025 <primary>filter</primary>
38026 <secondary>specifying in redirection data</secondary>
38027 </indexterm>
38028 The contents of the data string, whether obtained from <option>data</option> or <option>file</option>,
38029 can be interpreted in two different ways:
38030 </para>
38031 <itemizedlist>
38032 <listitem>
38033 <para>
38034 If the <option>allow_filter</option> option is set true, and the data begins with the text
38035 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote>, it is interpreted as a list of
38036 <emphasis>filtering</emphasis> instructions in the form of an Exim or Sieve filter file,
38037 respectively. Details of the syntax and semantics of filter files are described
38038 in a separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>; this
38039 document is intended for use by end users.
38040 </para>
38041 </listitem>
38042 <listitem>
38043 <para>
38044 Otherwise, the data must be a comma-separated list of redirection items, as
38045 described in the next section.
38046 </para>
38047 </listitem>
38048 </itemizedlist>
38049 <para>
38050 When a message is redirected to a file (a <quote>mail folder</quote>), the filename given
38051 in a non-filter redirection list must always be an absolute path. A filter may
38052 generate a relative path &ndash; how this is handled depends on the transport&#x2019;s
38053 configuration. See section <xref linkend="SECTfildiropt"/> for a discussion of this issue
38054 for the <command>appendfile</command> transport.
38055 </para>
38056 </section>
38057 <section id="SECTitenonfilred">
38058 <title>Items in a non-filter redirection list</title>
38059 <para>
38060 <indexterm role="concept">
38061 <primary>address redirection</primary>
38062 <secondary>non-filter list items</secondary>
38063 </indexterm>
38064 When the redirection data is not an Exim or Sieve filter, for example, if it
38065 comes from a conventional alias or forward file, it consists of a list of
38066 addresses, filenames, pipe commands, or certain special items (see section
38067 <xref linkend="SECTspecitredli"/> below). The special items can be individually enabled or
38068 disabled by means of options whose names begin with <option>allow_</option> or <option>forbid_</option>,
38069 depending on their default values. The items in the list are separated by
38070 commas or newlines.
38071 If a comma is required in an item, the entire item must be enclosed in double
38072 quotes.
38073 </para>
38074 <para>
38075 Lines starting with a # character are comments, and are ignored, and # may
38076 also appear following a comma, in which case everything between the # and the
38077 next newline character is ignored.
38078 </para>
38079 <para>
38080 If an item is entirely enclosed in double quotes, these are removed. Otherwise
38081 double quotes are retained because some forms of mail address require their use
38082 (but never to enclose the entire address). In the following description,
38083 <quote>item</quote> refers to what remains after any surrounding double quotes have been
38084 removed.
38085 </para>
38086 <para>
38087 <indexterm role="variable">
38088 <primary><varname>$local_part</varname></primary>
38089 </indexterm>
38090 <emphasis role="bold">Warning</emphasis>: If you use an Exim expansion to construct a redirection address,
38091 and the expansion contains a reference to <varname>$local_part</varname>, you should make use
38092 of the <option>quote_local_part</option> expansion operator, in case the local part contains
38093 special characters. For example, to redirect all mail for the domain
38094 <emphasis>obsolete.example</emphasis>, retaining the existing local part, you could use this
38095 setting:
38096 </para>
38097 <literallayout class="monospaced">
38098 data = ${quote_local_part:$local_part}@newdomain.example
38099 </literallayout>
38100 </section>
38101 <section id="SECTredlocmai">
38102 <title>Redirecting to a local mailbox</title>
38103 <para>
38104 <indexterm role="concept">
38105 <primary>routing</primary>
38106 <secondary>loops in</secondary>
38107 </indexterm>
38108 <indexterm role="concept">
38109 <primary>loop</primary>
38110 <secondary>while routing, avoidance of</secondary>
38111 </indexterm>
38112 <indexterm role="concept">
38113 <primary>address redirection</primary>
38114 <secondary>to local mailbox</secondary>
38115 </indexterm>
38116 A redirection item may safely be the same as the address currently under
38117 consideration. This does not cause a routing loop, because a router is
38118 automatically skipped if any ancestor of the address that is being processed
38119 is the same as the current address and was processed by the current router.
38120 Such an address is therefore passed to the following routers, so it is handled
38121 as if there were no redirection. When making this loop-avoidance test, the
38122 complete local part, including any prefix or suffix, is used.
38123 </para>
38124 <para>
38125 <indexterm role="concept">
38126 <primary>address redirection</primary>
38127 <secondary>local part without domain</secondary>
38128 </indexterm>
38129 Specifying the same local part without a domain is a common usage in personal
38130 filter files when the user wants to have messages delivered to the local
38131 mailbox and also forwarded elsewhere. For example, the user whose login is
38132 <emphasis>cleo</emphasis> might have a <filename>.forward</filename> file containing this:
38133 </para>
38134 <literallayout class="monospaced">
38135 cleo, cleopatra@egypt.example
38136 </literallayout>
38137 <para>
38138 <indexterm role="concept">
38139 <primary>backslash in alias file</primary>
38140 </indexterm>
38141 <indexterm role="concept">
38142 <primary>alias file</primary>
38143 <secondary>backslash in</secondary>
38144 </indexterm>
38145 For compatibility with other MTAs, such unqualified local parts may be
38146 preceded by <quote>\</quote>, but this is not a requirement for loop prevention. However,
38147 it does make a difference if more than one domain is being handled
38148 synonymously.
38149 </para>
38150 <para>
38151 If an item begins with <quote>\</quote> and the rest of the item parses as a valid RFC
38152 2822 address that does not include a domain, the item is qualified using the
38153 domain of the incoming address. In the absence of a leading <quote>\</quote>, unqualified
38154 addresses are qualified using the value in <option>qualify_recipient</option>, but you can
38155 force the incoming domain to be used by setting <option>qualify_preserve_domain</option>.
38156 </para>
38157 <para>
38158 Care must be taken if there are alias names for local users.
38159 Consider an MTA handling a single local domain where the system alias file
38160 contains:
38161 </para>
38162 <literallayout class="monospaced">
38163 Sam.Reman: spqr
38164 </literallayout>
38165 <para>
38166 Now suppose that Sam (whose login id is <emphasis>spqr</emphasis>) wants to save copies of
38167 messages in the local mailbox, and also forward copies elsewhere. He creates
38168 this forward file:
38169 </para>
38170 <literallayout class="monospaced">
38171 Sam.Reman, spqr@reme.elsewhere.example
38172 </literallayout>
38173 <para>
38174 With these settings, an incoming message addressed to <emphasis>Sam.Reman</emphasis> fails. The
38175 <command>redirect</command> router for system aliases does not process <emphasis>Sam.Reman</emphasis> the
38176 second time round, because it has previously routed it,
38177 and the following routers presumably cannot handle the alias. The forward file
38178 should really contain
38179 </para>
38180 <literallayout class="monospaced">
38181 spqr, spqr@reme.elsewhere.example
38182 </literallayout>
38183 <para>
38184 but because this is such a common error, the <option>check_ancestor</option> option (see
38185 below) exists to provide a way to get round it. This is normally set on a
38186 <command>redirect</command> router that is handling users&#x2019; <filename>.forward</filename> files.
38187 </para>
38188 </section>
38189 <section id="SECTspecitredli">
38190 <title>Special items in redirection lists</title>
38191 <para>
38192 In addition to addresses, the following types of item may appear in redirection
38193 lists (that is, in non-filter redirection data):
38194 </para>
38195 <itemizedlist>
38196 <listitem>
38197 <para>
38198 <indexterm role="concept">
38199 <primary>pipe</primary>
38200 <secondary>in redirection list</secondary>
38201 </indexterm>
38202 <indexterm role="concept">
38203 <primary>address redirection</primary>
38204 <secondary>to pipe</secondary>
38205 </indexterm>
38206 An item is treated as a pipe command if it begins with <quote>|</quote> and does not parse
38207 as a valid RFC 2822 address that includes a domain. A transport for running the
38208 command must be specified by the <option>pipe_transport</option> option.
38209 Normally, either the router or the transport specifies a user and a group under
38210 which to run the delivery. The default is to use the Exim user and group.
38211 </para>
38212 <para>
38213 Single or double quotes can be used for enclosing the individual arguments of
38214 the pipe command; no interpretation of escapes is done for single quotes. If
38215 the command contains a comma character, it is necessary to put the whole item
38216 in double quotes, for example:
38217 </para>
38218 <literallayout class="monospaced">
38219 "|/some/command ready,steady,go"
38220 </literallayout>
38221 <para>
38222 since items in redirection lists are terminated by commas. Do not, however,
38223 quote just the command. An item such as
38224 </para>
38225 <literallayout class="monospaced">
38226 |"/some/command ready,steady,go"
38227 </literallayout>
38228 <para>
38229 is interpreted as a pipe with a rather strange command name, and no arguments.
38230 </para>
38231 <para>
38232 Note that the above example assumes that the text comes from a lookup source
38233 of some sort, so that the quotes are part of the data.  If composing a
38234 redirect router with a <option>data</option> option directly specifying this command, the
38235 quotes will be used by the configuration parser to define the extent of one
38236 string, but will not be passed down into the redirect router itself.  There
38237 are two main approaches to get around this: escape quotes to be part of the
38238 data itself, or avoid using this mechanism and instead create a custom
38239 transport with the <option>command</option> option set and reference that transport from
38240 an <option>accept</option> router.
38241 </para>
38242 </listitem>
38243 <listitem>
38244 <para>
38245 <indexterm role="concept">
38246 <primary>file</primary>
38247 <secondary>in redirection list</secondary>
38248 </indexterm>
38249 <indexterm role="concept">
38250 <primary>address redirection</primary>
38251 <secondary>to file</secondary>
38252 </indexterm>
38253 An item is interpreted as a path name if it begins with <quote>/</quote> and does not
38254 parse as a valid RFC 2822 address that includes a domain. For example,
38255 </para>
38256 <literallayout class="monospaced">
38257 /home/world/minbari
38258 </literallayout>
38259 <para>
38260 is treated as a filename, but
38261 </para>
38262 <literallayout class="monospaced">
38263 /s=molari/o=babylon/@x400gate.way
38264 </literallayout>
38265 <para>
38266 is treated as an address. For a filename, a transport must be specified using
38267 the <option>file_transport</option> option. However, if the generated path name ends with a
38268 forward slash character, it is interpreted as a directory name rather than a
38269 filename, and <option>directory_transport</option> is used instead.
38270 </para>
38271 <para>
38272 Normally, either the router or the transport specifies a user and a group under
38273 which to run the delivery. The default is to use the Exim user and group.
38274 </para>
38275 <para>
38276 <indexterm role="concept">
38277 <primary><filename>/dev/null</filename></primary>
38278 </indexterm>
38279 However, if a redirection item is the path <filename>/dev/null</filename>, delivery to it is
38280 bypassed at a high level, and the log entry shows <quote>**bypassed**</quote>
38281 instead of a transport name. In this case the user and group are not used.
38282 </para>
38283 </listitem>
38284 <listitem>
38285 <para>
38286 <indexterm role="concept">
38287 <primary>included address list</primary>
38288 </indexterm>
38289 <indexterm role="concept">
38290 <primary>address redirection</primary>
38291 <secondary>included external list</secondary>
38292 </indexterm>
38293 If an item is of the form
38294 </para>
38295 <literallayout class="monospaced">
38296 :include:&lt;path name&gt;
38297 </literallayout>
38298 <para>
38299 a list of further items is taken from the given file and included at that
38300 point. <emphasis role="bold">Note</emphasis>: Such a file can not be a filter file; it is just an
38301 out-of-line addition to the list. The items in the included list are separated
38302 by commas or newlines and are not subject to expansion. If this is the first
38303 item in an alias list in an <command>lsearch</command> file, a colon must be used to terminate
38304 the alias name. This example is incorrect:
38305 </para>
38306 <literallayout class="monospaced">
38307 list1    :include:/opt/lists/list1
38308 </literallayout>
38309 <para>
38310 It must be given as
38311 </para>
38312 <literallayout class="monospaced">
38313 list1:   :include:/opt/lists/list1
38314 </literallayout>
38315 </listitem>
38316 <listitem>
38317 <para>
38318 <indexterm role="concept">
38319 <primary>address redirection</primary>
38320 <secondary>to black hole</secondary>
38321 </indexterm>
38322 <indexterm role="concept">
38323 <primary>delivery</primary>
38324 <secondary>discard</secondary>
38325 </indexterm>
38326 <indexterm role="concept">
38327 <primary>delivery</primary>
38328 <secondary>blackhole</secondary>
38329 </indexterm>
38330 <indexterm role="concept">
38331 <primary>black hole</primary>
38332 </indexterm>
38333 <indexterm role="concept">
38334 <primary>abandoning mail</primary>
38335 </indexterm>
38336 Sometimes you want to throw away mail to a particular local part.  Making the
38337 <option>data</option> option expand to an empty string does not work, because that causes
38338 the router to decline. Instead, the alias item
38339 </para>
38340 <literallayout class="monospaced">
38341 :blackhole:
38342 </literallayout>
38343 <para>
38344 can be used. It does what its name implies. No delivery is
38345 done, and no error message is generated. This has the same effect as specifying
38346 <filename>/dev/null</filename> as a destination, but it can be independently disabled.
38347 </para>
38348 <para>
38349 <emphasis role="bold">Warning</emphasis>: If <emphasis>:blackhole:</emphasis> appears anywhere in a redirection list, no
38350 delivery is done for the original local part, even if other redirection items
38351 are present. If you are generating a multi-item list (for example, by reading a
38352 database) and need the ability to provide a no-op item, you must use
38353 <filename>/dev/null</filename>.
38354 </para>
38355 </listitem>
38356 <listitem>
38357 <para>
38358 <indexterm role="concept">
38359 <primary>delivery</primary>
38360 <secondary>forcing failure</secondary>
38361 </indexterm>
38362 <indexterm role="concept">
38363 <primary>delivery</primary>
38364 <secondary>forcing deferral</secondary>
38365 </indexterm>
38366 <indexterm role="concept">
38367 <primary>failing delivery</primary>
38368 <secondary>forcing</secondary>
38369 </indexterm>
38370 <indexterm role="concept">
38371 <primary>deferred delivery, forcing</primary>
38372 </indexterm>
38373 <indexterm role="concept">
38374 <primary>customizing</primary>
38375 <secondary>failure message</secondary>
38376 </indexterm>
38377 An attempt to deliver a particular address can be deferred or forced to fail by
38378 redirection items of the form
38379 </para>
38380 <literallayout class="monospaced">
38381 :defer:
38382 :fail:
38383 </literallayout>
38384 <para>
38385 respectively. When a redirection list contains such an item, it applies
38386 to the entire redirection; any other items in the list are ignored. Any
38387 text following <emphasis>:fail:</emphasis> or <emphasis>:defer:</emphasis> is placed in the error text
38388 associated with the failure. For example, an alias file might contain:
38389 </para>
38390 <literallayout class="monospaced">
38391 X.Employee:  :fail: Gone away, no forwarding address
38392 </literallayout>
38393 <para>
38394 In the case of an address that is being verified from an ACL or as the subject
38395 of a
38396 <indexterm role="concept">
38397 <primary>VRFY</primary>
38398 <secondary>error text, display of</secondary>
38399 </indexterm>
38400 VRFY command, the text is included in the SMTP error response by
38401 default.
38402 <indexterm role="concept">
38403 <primary>EXPN</primary>
38404 <secondary>error text, display of</secondary>
38405 </indexterm>
38406 The text is not included in the response to an EXPN command. In non-SMTP cases
38407 the text is included in the error message that Exim generates.
38408 </para>
38409 <para>
38410 <indexterm role="concept">
38411 <primary>SMTP</primary>
38412 <secondary>error codes</secondary>
38413 </indexterm>
38414 By default, Exim sends a 451 SMTP code for a <emphasis>:defer:</emphasis>, and 550 for
38415 <emphasis>:fail:</emphasis>. However, if the message starts with three digits followed by a
38416 space, optionally followed by an extended code of the form <emphasis>n.n.n</emphasis>, also
38417 followed by a space, and the very first digit is the same as the default error
38418 code, the code from the message is used instead. If the very first digit is
38419 incorrect, a panic error is logged, and the default code is used. You can
38420 suppress the use of the supplied code in a redirect router by setting the
38421 <option>forbid_smtp_code</option> option true. In this case, any SMTP code is quietly
38422 ignored.
38423 </para>
38424 <para>
38425 <indexterm role="variable">
38426 <primary><varname>$acl_verify_message</varname></primary>
38427 </indexterm>
38428 In an ACL, an explicitly provided message overrides the default, but the
38429 default message is available in the variable <varname>$acl_verify_message</varname> and can
38430 therefore be included in a custom message if this is desired.
38431 </para>
38432 <para>
38433 Normally the error text is the rest of the redirection list &ndash; a comma does
38434 not terminate it &ndash; but a newline does act as a terminator. Newlines are not
38435 normally present in alias expansions. In <command>lsearch</command> lookups they are removed
38436 as part of the continuation process, but they may exist in other kinds of
38437 lookup and in <emphasis>:include:</emphasis> files.
38438 </para>
38439 <para>
38440 During routing for message delivery (as opposed to verification), a redirection
38441 containing <emphasis>:fail:</emphasis> causes an immediate failure of the incoming address,
38442 whereas <emphasis>:defer:</emphasis> causes the message to remain in the queue so that a
38443 subsequent delivery attempt can happen at a later time. If an address is
38444 deferred for too long, it will ultimately fail, because the normal retry
38445 rules still apply.
38446 </para>
38447 </listitem>
38448 <listitem>
38449 <para>
38450 <indexterm role="concept">
38451 <primary>alias file</primary>
38452 <secondary>exception to default</secondary>
38453 </indexterm>
38454 Sometimes it is useful to use a single-key search type with a default (see
38455 chapter <xref linkend="CHAPfdlookup"/>) to look up aliases. However, there may be a need
38456 for exceptions to the default. These can be handled by aliasing them to
38457 <emphasis>:unknown:</emphasis>. This differs from <emphasis>:fail:</emphasis> in that it causes the <command>redirect</command>
38458 router to decline, whereas <emphasis>:fail:</emphasis> forces routing to fail. A lookup which
38459 results in an empty redirection list has the same effect.
38460 </para>
38461 </listitem>
38462 </itemizedlist>
38463 </section>
38464 <section id="SECTdupaddr">
38465 <title>Duplicate addresses</title>
38466 <para>
38467 <indexterm role="concept">
38468 <primary>duplicate addresses</primary>
38469 </indexterm>
38470 <indexterm role="concept">
38471 <primary>address duplicate, discarding</primary>
38472 </indexterm>
38473 <indexterm role="concept">
38474 <primary>pipe</primary>
38475 <secondary>duplicated</secondary>
38476 </indexterm>
38477 Exim removes duplicate addresses from the list to which it is delivering, so as
38478 to deliver just one copy to each address. This does not apply to deliveries
38479 routed to pipes by different immediate parent addresses, but an indirect
38480 aliasing scheme of the type
38481 </para>
38482 <literallayout class="monospaced">
38483 pipe:       |/some/command $local_part
38484 localpart1: pipe
38485 localpart2: pipe
38486 </literallayout>
38487 <para>
38488 does not work with a message that is addressed to both local parts, because
38489 when the second is aliased to the intermediate local part <quote>pipe</quote> it gets
38490 discarded as being the same as a previously handled address. However, a scheme
38491 such as
38492 </para>
38493 <literallayout class="monospaced">
38494 localpart1: |/some/command $local_part
38495 localpart2: |/some/command $local_part
38496 </literallayout>
38497 <para>
38498 does result in two different pipe deliveries, because the immediate parents of
38499 the pipes are distinct.
38500 </para>
38501 </section>
38502 <section id="SECID128">
38503 <title>Repeated redirection expansion</title>
38504 <para>
38505 <indexterm role="concept">
38506 <primary>repeated redirection expansion</primary>
38507 </indexterm>
38508 <indexterm role="concept">
38509 <primary>address redirection</primary>
38510 <secondary>repeated for each delivery attempt</secondary>
38511 </indexterm>
38512 When a message cannot be delivered to all of its recipients immediately,
38513 leading to two or more delivery attempts, redirection expansion is carried out
38514 afresh each time for those addresses whose children were not all previously
38515 delivered. If redirection is being used as a mailing list, this can lead to new
38516 members of the list receiving copies of old messages. The <option>one_time</option> option
38517 can be used to avoid this.
38518 </para>
38519 </section>
38520 <section id="SECID129">
38521 <title>Errors in redirection lists</title>
38522 <para>
38523 <indexterm role="concept">
38524 <primary>address redirection</primary>
38525 <secondary>errors</secondary>
38526 </indexterm>
38527 If <option>skip_syntax_errors</option> is set, a malformed address that causes a parsing
38528 error is skipped, and an entry is written to the main log. This may be useful
38529 for mailing lists that are automatically managed. Otherwise, if an error is
38530 detected while generating the list of new addresses, the original address is
38531 deferred. See also <option>syntax_errors_to</option>.
38532 </para>
38533 </section>
38534 <section id="SECID130">
38535 <title>Private options for the redirect router</title>
38536 <para>
38537 <indexterm role="concept">
38538 <primary>options</primary>
38539 <secondary><command>redirect</command> router</secondary>
38540 </indexterm>
38541 The private options for the <command>redirect</command> router are as follows:
38542 </para>
38543 <para>
38544 <indexterm role="option">
38545 <primary><option>allow_defer</option></primary>
38546 </indexterm>
38547 </para>
38548 <informaltable frame="all">
38549 <tgroup cols="4" colsep="0" rowsep="0">
38550 <colspec colwidth="8*" align="left"/>
38551 <colspec colwidth="6*" align="center"/>
38552 <colspec colwidth="6*" align="center"/>
38553 <colspec colwidth="6*" align="right"/>
38554 <tbody>
38555 <row>
38556 <entry><option>allow_defer</option></entry>
38557 <entry>Use: <emphasis>redirect</emphasis></entry>
38558 <entry>Type: <emphasis>boolean</emphasis></entry>
38559 <entry>Default: <emphasis>false</emphasis></entry>
38560 </row>
38561 </tbody>
38562 </tgroup>
38563 </informaltable>
38564 <para>
38565 Setting this option allows the use of <emphasis>:defer:</emphasis> in non-filter redirection
38566 data, or the <option>defer</option> command in an Exim filter file.
38567 </para>
38568 <para>
38569 <indexterm role="option">
38570 <primary><option>allow_fail</option></primary>
38571 </indexterm>
38572 </para>
38573 <informaltable frame="all">
38574 <tgroup cols="4" colsep="0" rowsep="0">
38575 <colspec colwidth="8*" align="left"/>
38576 <colspec colwidth="6*" align="center"/>
38577 <colspec colwidth="6*" align="center"/>
38578 <colspec colwidth="6*" align="right"/>
38579 <tbody>
38580 <row>
38581 <entry><option>allow_fail</option></entry>
38582 <entry>Use: <emphasis>redirect</emphasis></entry>
38583 <entry>Type: <emphasis>boolean</emphasis></entry>
38584 <entry>Default: <emphasis>false</emphasis></entry>
38585 </row>
38586 </tbody>
38587 </tgroup>
38588 </informaltable>
38589 <para>
38590 <indexterm role="concept">
38591 <primary>failing delivery</primary>
38592 <secondary>from filter</secondary>
38593 </indexterm>
38594 If this option is true, the <emphasis>:fail:</emphasis> item can be used in a redirection list,
38595 and the <option>fail</option> command may be used in an Exim filter file.
38596 </para>
38597 <para>
38598 <indexterm role="option">
38599 <primary><option>allow_filter</option></primary>
38600 </indexterm>
38601 </para>
38602 <informaltable frame="all">
38603 <tgroup cols="4" colsep="0" rowsep="0">
38604 <colspec colwidth="8*" align="left"/>
38605 <colspec colwidth="6*" align="center"/>
38606 <colspec colwidth="6*" align="center"/>
38607 <colspec colwidth="6*" align="right"/>
38608 <tbody>
38609 <row>
38610 <entry><option>allow_filter</option></entry>
38611 <entry>Use: <emphasis>redirect</emphasis></entry>
38612 <entry>Type: <emphasis>boolean</emphasis></entry>
38613 <entry>Default: <emphasis>false</emphasis></entry>
38614 </row>
38615 </tbody>
38616 </tgroup>
38617 </informaltable>
38618 <para>
38619 <indexterm role="concept">
38620 <primary>filter</primary>
38621 <secondary>enabling use of</secondary>
38622 </indexterm>
38623 <indexterm role="concept">
38624 <primary>Sieve filter</primary>
38625 <secondary>enabling use of</secondary>
38626 </indexterm>
38627 Setting this option allows Exim to interpret redirection data that starts with
38628 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote> as a set of filtering instructions. There
38629 are some features of Exim filter files that some administrators may wish to
38630 lock out; see the <option>forbid_filter_</option><emphasis>xxx</emphasis> options below.
38631 </para>
38632 <para>
38633 It is also possible to lock out Exim filters or Sieve filters while allowing
38634 the other type; see <option>forbid_exim_filter</option> and <option>forbid_sieve_filter</option>.
38635 </para>
38636 <para>
38637 The filter is run using the uid and gid set by the generic <option>user</option> and
38638 <option>group</option> options. These take their defaults from the password data if
38639 <option>check_local_user</option> is set, so in the normal case of users&#x2019; personal filter
38640 files, the filter is run as the relevant user. When <option>allow_filter</option> is set
38641 true, Exim insists that either <option>check_local_user</option> or <option>user</option> is set.
38642 </para>
38643 <para>
38644 <indexterm role="option">
38645 <primary><option>allow_freeze</option></primary>
38646 </indexterm>
38647 </para>
38648 <informaltable frame="all">
38649 <tgroup cols="4" colsep="0" rowsep="0">
38650 <colspec colwidth="8*" align="left"/>
38651 <colspec colwidth="6*" align="center"/>
38652 <colspec colwidth="6*" align="center"/>
38653 <colspec colwidth="6*" align="right"/>
38654 <tbody>
38655 <row>
38656 <entry><option>allow_freeze</option></entry>
38657 <entry>Use: <emphasis>redirect</emphasis></entry>
38658 <entry>Type: <emphasis>boolean</emphasis></entry>
38659 <entry>Default: <emphasis>false</emphasis></entry>
38660 </row>
38661 </tbody>
38662 </tgroup>
38663 </informaltable>
38664 <para>
38665 <indexterm role="concept">
38666 <primary>freezing messages</primary>
38667 <secondary>allowing in filter</secondary>
38668 </indexterm>
38669 Setting this option allows the use of the <option>freeze</option> command in an Exim filter.
38670 This command is more normally encountered in system filters, and is disabled by
38671 default for redirection filters because it isn&#x2019;t something you usually want to
38672 let ordinary users do.
38673 </para>
38674 <para>
38675 <indexterm role="option">
38676 <primary><option>check_ancestor</option></primary>
38677 </indexterm>
38678 </para>
38679 <informaltable frame="all">
38680 <tgroup cols="4" colsep="0" rowsep="0">
38681 <colspec colwidth="8*" align="left"/>
38682 <colspec colwidth="6*" align="center"/>
38683 <colspec colwidth="6*" align="center"/>
38684 <colspec colwidth="6*" align="right"/>
38685 <tbody>
38686 <row>
38687 <entry><option>check_ancestor</option></entry>
38688 <entry>Use: <emphasis>redirect</emphasis></entry>
38689 <entry>Type: <emphasis>boolean</emphasis></entry>
38690 <entry>Default: <emphasis>false</emphasis></entry>
38691 </row>
38692 </tbody>
38693 </tgroup>
38694 </informaltable>
38695 <para>
38696 This option is concerned with handling generated addresses that are the same
38697 as some address in the list of redirection ancestors of the current address.
38698 Although it is turned off by default in the code, it is set in the default
38699 configuration file for handling users&#x2019; <filename>.forward</filename> files. It is recommended
38700 for this use of the <command>redirect</command> router.
38701 </para>
38702 <para>
38703 When <option>check_ancestor</option> is set, if a generated address (including the domain)
38704 is the same as any ancestor of the current address, it is replaced by a copy of
38705 the current address. This helps in the case where local part A is aliased to B,
38706 and B has a <filename>.forward</filename> file pointing back to A. For example, within a single
38707 domain, the local part <quote>Joe.Bloggs</quote> is aliased to <quote>jb</quote> and
38708 <filename>&nbsp;jb/.forward</filename> contains:
38709 </para>
38710 <literallayout class="monospaced">
38711 \Joe.Bloggs, &lt;other item(s)&gt;
38712 </literallayout>
38713 <para>
38714 Without the <option>check_ancestor</option> setting, either local part (<quote>jb</quote> or
38715 <quote>joe.bloggs</quote>) gets processed once by each router and so ends up as it was
38716 originally. If <quote>jb</quote> is the real mailbox name, mail to <quote>jb</quote> gets delivered
38717 (having been turned into <quote>joe.bloggs</quote> by the <filename>.forward</filename> file and back to
38718 <quote>jb</quote> by the alias), but mail to <quote>joe.bloggs</quote> fails. Setting
38719 <option>check_ancestor</option> on the <command>redirect</command> router that handles the <filename>.forward</filename>
38720 file prevents it from turning <quote>jb</quote> back into <quote>joe.bloggs</quote> when that was the
38721 original address. See also the <option>repeat_use</option> option below.
38722 </para>
38723 <para>
38724 <indexterm role="option">
38725 <primary><option>check_group</option></primary>
38726 </indexterm>
38727 </para>
38728 <informaltable frame="all">
38729 <tgroup cols="4" colsep="0" rowsep="0">
38730 <colspec colwidth="8*" align="left"/>
38731 <colspec colwidth="6*" align="center"/>
38732 <colspec colwidth="6*" align="center"/>
38733 <colspec colwidth="6*" align="right"/>
38734 <tbody>
38735 <row>
38736 <entry><option>check_group</option></entry>
38737 <entry>Use: <emphasis>redirect</emphasis></entry>
38738 <entry>Type: <emphasis>boolean</emphasis></entry>
38739 <entry>Default: <emphasis>see below</emphasis></entry>
38740 </row>
38741 </tbody>
38742 </tgroup>
38743 </informaltable>
38744 <para>
38745 When the <option>file</option> option is used, the group owner of the file is checked only
38746 when this option is set. The permitted groups are those listed in the
38747 <option>owngroups</option> option, together with the user&#x2019;s default group if
38748 <option>check_local_user</option> is set. If the file has the wrong group, routing is
38749 deferred. The default setting for this option is true if <option>check_local_user</option>
38750 is set and the <option>modemask</option> option permits the group write bit, or if the
38751 <option>owngroups</option> option is set. Otherwise it is false, and no group check occurs.
38752 </para>
38753 <para>
38754 <indexterm role="option">
38755 <primary><option>check_owner</option></primary>
38756 </indexterm>
38757 </para>
38758 <informaltable frame="all">
38759 <tgroup cols="4" colsep="0" rowsep="0">
38760 <colspec colwidth="8*" align="left"/>
38761 <colspec colwidth="6*" align="center"/>
38762 <colspec colwidth="6*" align="center"/>
38763 <colspec colwidth="6*" align="right"/>
38764 <tbody>
38765 <row>
38766 <entry><option>check_owner</option></entry>
38767 <entry>Use: <emphasis>redirect</emphasis></entry>
38768 <entry>Type: <emphasis>boolean</emphasis></entry>
38769 <entry>Default: <emphasis>see below</emphasis></entry>
38770 </row>
38771 </tbody>
38772 </tgroup>
38773 </informaltable>
38774 <para>
38775 When the <option>file</option> option is used, the owner of the file is checked only when
38776 this option is set. If <option>check_local_user</option> is set, the local user is
38777 permitted; otherwise the owner must be one of those listed in the <option>owners</option>
38778 option. The default value for this option is true if <option>check_local_user</option> or
38779 <option>owners</option> is set. Otherwise the default is false, and no owner check occurs.
38780 </para>
38781 <para>
38782 <indexterm role="option">
38783 <primary><option>data</option></primary>
38784 </indexterm>
38785 </para>
38786 <informaltable frame="all">
38787 <tgroup cols="4" colsep="0" rowsep="0">
38788 <colspec colwidth="8*" align="left"/>
38789 <colspec colwidth="6*" align="center"/>
38790 <colspec colwidth="6*" align="center"/>
38791 <colspec colwidth="6*" align="right"/>
38792 <tbody>
38793 <row>
38794 <entry><option>data</option></entry>
38795 <entry>Use: <emphasis>redirect</emphasis></entry>
38796 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38797 <entry>Default: <emphasis>unset</emphasis></entry>
38798 </row>
38799 </tbody>
38800 </tgroup>
38801 </informaltable>
38802 <para>
38803 This option is mutually exclusive with <option>file</option>. One or other of them must be
38804 set, but not both. The contents of <option>data</option> are expanded, and then used as the
38805 list of forwarding items, or as a set of filtering instructions. If the
38806 expansion is forced to fail, or the result is an empty string or a string that
38807 has no effect (consists entirely of comments), the router declines.
38808 </para>
38809 <para>
38810 When filtering instructions are used, the string must begin with <quote>#Exim
38811 filter</quote>, and all comments in the string, including this initial one, must be
38812 terminated with newline characters. For example:
38813 </para>
38814 <literallayout class="monospaced">
38815 data = #Exim filter\n\
38816        if $h_to: contains Exim then save $home/mail/exim endif
38817 </literallayout>
38818 <para>
38819 If you are reading the data from a database where newlines cannot be included,
38820 you can use the <varname>${sg}</varname> expansion item to turn the escape string of your
38821 choice into a newline.
38822 </para>
38823 <para>
38824 <indexterm role="option">
38825 <primary><option>directory_transport</option></primary>
38826 </indexterm>
38827 </para>
38828 <informaltable frame="all">
38829 <tgroup cols="4" colsep="0" rowsep="0">
38830 <colspec colwidth="8*" align="left"/>
38831 <colspec colwidth="6*" align="center"/>
38832 <colspec colwidth="6*" align="center"/>
38833 <colspec colwidth="6*" align="right"/>
38834 <tbody>
38835 <row>
38836 <entry><option>directory_transport</option></entry>
38837 <entry>Use: <emphasis>redirect</emphasis></entry>
38838 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38839 <entry>Default: <emphasis>unset</emphasis></entry>
38840 </row>
38841 </tbody>
38842 </tgroup>
38843 </informaltable>
38844 <para>
38845 A <command>redirect</command> router sets up a direct delivery to a directory when a path name
38846 ending with a slash is specified as a new <quote>address</quote>. The transport used is
38847 specified by this option, which, after expansion, must be the name of a
38848 configured transport. This should normally be an <command>appendfile</command> transport.
38849 </para>
38850 <para>
38851 <indexterm role="option">
38852 <primary><option>file</option></primary>
38853 </indexterm>
38854 </para>
38855 <informaltable frame="all">
38856 <tgroup cols="4" colsep="0" rowsep="0">
38857 <colspec colwidth="8*" align="left"/>
38858 <colspec colwidth="6*" align="center"/>
38859 <colspec colwidth="6*" align="center"/>
38860 <colspec colwidth="6*" align="right"/>
38861 <tbody>
38862 <row>
38863 <entry><option>file</option></entry>
38864 <entry>Use: <emphasis>redirect</emphasis></entry>
38865 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38866 <entry>Default: <emphasis>unset</emphasis></entry>
38867 </row>
38868 </tbody>
38869 </tgroup>
38870 </informaltable>
38871 <para>
38872 This option specifies the name of a file that contains the redirection data. It
38873 is mutually exclusive with the <option>data</option> option. The string is expanded before
38874 use; if the expansion is forced to fail, the router declines. Other expansion
38875 failures cause delivery to be deferred. The result of a successful expansion
38876 must be an absolute path. The entire file is read and used as the redirection
38877 data. If the data is an empty string or a string that has no effect (consists
38878 entirely of comments), the router declines.
38879 </para>
38880 <para>
38881 <indexterm role="concept">
38882 <primary>NFS</primary>
38883 <secondary>checking for file existence</secondary>
38884 </indexterm>
38885 If the attempt to open the file fails with a <quote>does not exist</quote> error, Exim
38886 runs a check on the containing directory,
38887 unless <option>ignore_enotdir</option> is true (see below).
38888 If the directory does not appear to exist, delivery is deferred. This can
38889 happen when users&#x2019; <filename>.forward</filename> files are in NFS-mounted directories, and there
38890 is a mount problem. If the containing directory does exist, but the file does
38891 not, the router declines.
38892 </para>
38893 <para>
38894 <indexterm role="option">
38895 <primary><option>file_transport</option></primary>
38896 </indexterm>
38897 </para>
38898 <informaltable frame="all">
38899 <tgroup cols="4" colsep="0" rowsep="0">
38900 <colspec colwidth="8*" align="left"/>
38901 <colspec colwidth="6*" align="center"/>
38902 <colspec colwidth="6*" align="center"/>
38903 <colspec colwidth="6*" align="right"/>
38904 <tbody>
38905 <row>
38906 <entry><option>file_transport</option></entry>
38907 <entry>Use: <emphasis>redirect</emphasis></entry>
38908 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38909 <entry>Default: <emphasis>unset</emphasis></entry>
38910 </row>
38911 </tbody>
38912 </tgroup>
38913 </informaltable>
38914 <para>
38915 <indexterm role="variable">
38916 <primary><varname>$address_file</varname></primary>
38917 </indexterm>
38918 A <command>redirect</command> router sets up a direct delivery to a file when a path name not
38919 ending in a slash is specified as a new <quote>address</quote>. The transport used is
38920 specified by this option, which, after expansion, must be the name of a
38921 configured transport. This should normally be an <command>appendfile</command> transport. When
38922 it is running, the filename is in <varname>$address_file</varname>.
38923 </para>
38924 <para>
38925 <indexterm role="option">
38926 <primary><option>filter_prepend_home</option></primary>
38927 </indexterm>
38928 </para>
38929 <informaltable frame="all">
38930 <tgroup cols="4" colsep="0" rowsep="0">
38931 <colspec colwidth="8*" align="left"/>
38932 <colspec colwidth="6*" align="center"/>
38933 <colspec colwidth="6*" align="center"/>
38934 <colspec colwidth="6*" align="right"/>
38935 <tbody>
38936 <row>
38937 <entry><option>filter_prepend_home</option></entry>
38938 <entry>Use: <emphasis>redirect</emphasis></entry>
38939 <entry>Type: <emphasis>boolean</emphasis></entry>
38940 <entry>Default: <emphasis>true</emphasis></entry>
38941 </row>
38942 </tbody>
38943 </tgroup>
38944 </informaltable>
38945 <para>
38946 When this option is true, if a <command>save</command> command in an Exim filter specifies a
38947 relative path, and <varname>$home</varname> is defined, it is automatically prepended to the
38948 relative path. If this option is set false, this action does not happen. The
38949 relative path is then passed to the transport unmodified.
38950 </para>
38951 <para>
38952 <indexterm role="option">
38953 <primary><option>forbid_blackhole</option></primary>
38954 </indexterm>
38955 </para>
38956 <informaltable frame="all">
38957 <tgroup cols="4" colsep="0" rowsep="0">
38958 <colspec colwidth="8*" align="left"/>
38959 <colspec colwidth="6*" align="center"/>
38960 <colspec colwidth="6*" align="center"/>
38961 <colspec colwidth="6*" align="right"/>
38962 <tbody>
38963 <row>
38964 <entry><option>forbid_blackhole</option></entry>
38965 <entry>Use: <emphasis>redirect</emphasis></entry>
38966 <entry>Type: <emphasis>boolean</emphasis></entry>
38967 <entry>Default: <emphasis>false</emphasis></entry>
38968 </row>
38969 </tbody>
38970 </tgroup>
38971 </informaltable>
38972 <para>
38973 <indexterm role="concept">
38974 <primary>restricting access to features</primary>
38975 </indexterm>
38976 <indexterm role="concept">
38977 <primary>filter</primary>
38978 <secondary>locking out certain features</secondary>
38979 </indexterm>
38980 If this option is true, the <emphasis>:blackhole:</emphasis> item may not appear in a
38981 redirection list.
38982 </para>
38983 <para>
38984 <indexterm role="option">
38985 <primary><option>forbid_exim_filter</option></primary>
38986 </indexterm>
38987 </para>
38988 <informaltable frame="all">
38989 <tgroup cols="4" colsep="0" rowsep="0">
38990 <colspec colwidth="8*" align="left"/>
38991 <colspec colwidth="6*" align="center"/>
38992 <colspec colwidth="6*" align="center"/>
38993 <colspec colwidth="6*" align="right"/>
38994 <tbody>
38995 <row>
38996 <entry><option>forbid_exim_filter</option></entry>
38997 <entry>Use: <emphasis>redirect</emphasis></entry>
38998 <entry>Type: <emphasis>boolean</emphasis></entry>
38999 <entry>Default: <emphasis>false</emphasis></entry>
39000 </row>
39001 </tbody>
39002 </tgroup>
39003 </informaltable>
39004 <para>
39005 <indexterm role="concept">
39006 <primary>restricting access to features</primary>
39007 </indexterm>
39008 <indexterm role="concept">
39009 <primary>filter</primary>
39010 <secondary>locking out certain features</secondary>
39011 </indexterm>
39012 If this option is set true, only Sieve filters are permitted when
39013 <option>allow_filter</option> is true.
39014 </para>
39015 <para>
39016 <indexterm role="option">
39017 <primary><option>forbid_file</option></primary>
39018 </indexterm>
39019 </para>
39020 <informaltable frame="all">
39021 <tgroup cols="4" colsep="0" rowsep="0">
39022 <colspec colwidth="8*" align="left"/>
39023 <colspec colwidth="6*" align="center"/>
39024 <colspec colwidth="6*" align="center"/>
39025 <colspec colwidth="6*" align="right"/>
39026 <tbody>
39027 <row>
39028 <entry><option>forbid_file</option></entry>
39029 <entry>Use: <emphasis>redirect</emphasis></entry>
39030 <entry>Type: <emphasis>boolean</emphasis></entry>
39031 <entry>Default: <emphasis>false</emphasis></entry>
39032 </row>
39033 </tbody>
39034 </tgroup>
39035 </informaltable>
39036 <para>
39037 <indexterm role="concept">
39038 <primary>restricting access to features</primary>
39039 </indexterm>
39040 <indexterm role="concept">
39041 <primary>delivery</primary>
39042 <secondary>to file; forbidding</secondary>
39043 </indexterm>
39044 <indexterm role="concept">
39045 <primary>filter</primary>
39046 <secondary>locking out certain features</secondary>
39047 </indexterm>
39048 <indexterm role="concept">
39049 <primary>Sieve filter</primary>
39050 <secondary>forbidding delivery to a file</secondary>
39051 </indexterm>
39052 <indexterm role="concept">
39053 <primary>Sieve filter</primary>
39054 <secondary><quote>keep</quote> facility; disabling</secondary>
39055 </indexterm>
39056 If this option is true, this router may not generate a new address that
39057 specifies delivery to a local file or directory, either from a filter or from a
39058 conventional forward file. This option is forced to be true if <option>one_time</option> is
39059 set. It applies to Sieve filters as well as to Exim filters, but if true, it
39060 locks out the Sieve&#x2019;s <quote>keep</quote> facility.
39061 </para>
39062 <para>
39063 <indexterm role="option">
39064 <primary><option>forbid_filter_dlfunc</option></primary>
39065 </indexterm>
39066 </para>
39067 <informaltable frame="all">
39068 <tgroup cols="4" colsep="0" rowsep="0">
39069 <colspec colwidth="8*" align="left"/>
39070 <colspec colwidth="6*" align="center"/>
39071 <colspec colwidth="6*" align="center"/>
39072 <colspec colwidth="6*" align="right"/>
39073 <tbody>
39074 <row>
39075 <entry><option>forbid_filter_dlfunc</option></entry>
39076 <entry>Use: <emphasis>redirect</emphasis></entry>
39077 <entry>Type: <emphasis>boolean</emphasis></entry>
39078 <entry>Default: <emphasis>false</emphasis></entry>
39079 </row>
39080 </tbody>
39081 </tgroup>
39082 </informaltable>
39083 <para>
39084 <indexterm role="concept">
39085 <primary>restricting access to features</primary>
39086 </indexterm>
39087 <indexterm role="concept">
39088 <primary>filter</primary>
39089 <secondary>locking out certain features</secondary>
39090 </indexterm>
39091 If this option is true, string expansions in Exim filters are not allowed to
39092 make use of the <option>dlfunc</option> expansion facility to run dynamically loaded
39093 functions.
39094 </para>
39095 <para>
39096 <indexterm role="option">
39097 <primary><option>forbid_filter_existstest</option></primary>
39098 </indexterm>
39099 </para>
39100 <informaltable frame="all">
39101 <tgroup cols="4" colsep="0" rowsep="0">
39102 <colspec colwidth="8*" align="left"/>
39103 <colspec colwidth="6*" align="center"/>
39104 <colspec colwidth="6*" align="center"/>
39105 <colspec colwidth="6*" align="right"/>
39106 <tbody>
39107 <row>
39108 <entry><option>forbid_filter_existstest</option></entry>
39109 <entry>Use: <emphasis>redirect</emphasis></entry>
39110 <entry>Type: <emphasis>boolean</emphasis></entry>
39111 <entry>Default: <emphasis>false</emphasis></entry>
39112 </row>
39113 </tbody>
39114 </tgroup>
39115 </informaltable>
39116 <para>
39117 <indexterm role="concept">
39118 <primary>restricting access to features</primary>
39119 </indexterm>
39120 <indexterm role="concept">
39121 <primary>filter</primary>
39122 <secondary>locking out certain features</secondary>
39123 </indexterm>
39124 <indexterm role="concept">
39125 <primary>expansion</primary>
39126 <secondary>statting a file</secondary>
39127 </indexterm>
39128 If this option is true, string expansions in Exim filters are not allowed to
39129 make use of the <option>exists</option> condition or the <option>stat</option> expansion item.
39130 </para>
39131 <para>
39132 <indexterm role="option">
39133 <primary><option>forbid_filter_logwrite</option></primary>
39134 </indexterm>
39135 </para>
39136 <informaltable frame="all">
39137 <tgroup cols="4" colsep="0" rowsep="0">
39138 <colspec colwidth="8*" align="left"/>
39139 <colspec colwidth="6*" align="center"/>
39140 <colspec colwidth="6*" align="center"/>
39141 <colspec colwidth="6*" align="right"/>
39142 <tbody>
39143 <row>
39144 <entry><option>forbid_filter_logwrite</option></entry>
39145 <entry>Use: <emphasis>redirect</emphasis></entry>
39146 <entry>Type: <emphasis>boolean</emphasis></entry>
39147 <entry>Default: <emphasis>false</emphasis></entry>
39148 </row>
39149 </tbody>
39150 </tgroup>
39151 </informaltable>
39152 <para>
39153 <indexterm role="concept">
39154 <primary>restricting access to features</primary>
39155 </indexterm>
39156 <indexterm role="concept">
39157 <primary>filter</primary>
39158 <secondary>locking out certain features</secondary>
39159 </indexterm>
39160 If this option is true, use of the logging facility in Exim filters is not
39161 permitted. Logging is in any case available only if the filter is being run
39162 under some unprivileged uid (which is normally the case for ordinary users&#x2019;
39163 <filename>.forward</filename> files).
39164 </para>
39165 <para>
39166 <indexterm role="option">
39167 <primary><option>forbid_filter_lookup</option></primary>
39168 </indexterm>
39169 </para>
39170 <informaltable frame="all">
39171 <tgroup cols="4" colsep="0" rowsep="0">
39172 <colspec colwidth="8*" align="left"/>
39173 <colspec colwidth="6*" align="center"/>
39174 <colspec colwidth="6*" align="center"/>
39175 <colspec colwidth="6*" align="right"/>
39176 <tbody>
39177 <row>
39178 <entry><option>forbid_filter_lookup</option></entry>
39179 <entry>Use: <emphasis>redirect</emphasis></entry>
39180 <entry>Type: <emphasis>boolean</emphasis></entry>
39181 <entry>Default: <emphasis>false</emphasis></entry>
39182 </row>
39183 </tbody>
39184 </tgroup>
39185 </informaltable>
39186 <para>
39187 <indexterm role="concept">
39188 <primary>restricting access to features</primary>
39189 </indexterm>
39190 <indexterm role="concept">
39191 <primary>filter</primary>
39192 <secondary>locking out certain features</secondary>
39193 </indexterm>
39194 If this option is true, string expansions in Exim filter files are not allowed
39195 to make use of <option>lookup</option> items.
39196 </para>
39197 <para>
39198 <indexterm role="option">
39199 <primary><option>forbid_filter_perl</option></primary>
39200 </indexterm>
39201 </para>
39202 <informaltable frame="all">
39203 <tgroup cols="4" colsep="0" rowsep="0">
39204 <colspec colwidth="8*" align="left"/>
39205 <colspec colwidth="6*" align="center"/>
39206 <colspec colwidth="6*" align="center"/>
39207 <colspec colwidth="6*" align="right"/>
39208 <tbody>
39209 <row>
39210 <entry><option>forbid_filter_perl</option></entry>
39211 <entry>Use: <emphasis>redirect</emphasis></entry>
39212 <entry>Type: <emphasis>boolean</emphasis></entry>
39213 <entry>Default: <emphasis>false</emphasis></entry>
39214 </row>
39215 </tbody>
39216 </tgroup>
39217 </informaltable>
39218 <para>
39219 <indexterm role="concept">
39220 <primary>restricting access to features</primary>
39221 </indexterm>
39222 <indexterm role="concept">
39223 <primary>filter</primary>
39224 <secondary>locking out certain features</secondary>
39225 </indexterm>
39226 This option has an effect only if Exim is built with embedded Perl support. If
39227 it is true, string expansions in Exim filter files are not allowed to make use
39228 of the embedded Perl support.
39229 </para>
39230 <para>
39231 <indexterm role="option">
39232 <primary><option>forbid_filter_readfile</option></primary>
39233 </indexterm>
39234 </para>
39235 <informaltable frame="all">
39236 <tgroup cols="4" colsep="0" rowsep="0">
39237 <colspec colwidth="8*" align="left"/>
39238 <colspec colwidth="6*" align="center"/>
39239 <colspec colwidth="6*" align="center"/>
39240 <colspec colwidth="6*" align="right"/>
39241 <tbody>
39242 <row>
39243 <entry><option>forbid_filter_readfile</option></entry>
39244 <entry>Use: <emphasis>redirect</emphasis></entry>
39245 <entry>Type: <emphasis>boolean</emphasis></entry>
39246 <entry>Default: <emphasis>false</emphasis></entry>
39247 </row>
39248 </tbody>
39249 </tgroup>
39250 </informaltable>
39251 <para>
39252 <indexterm role="concept">
39253 <primary>restricting access to features</primary>
39254 </indexterm>
39255 <indexterm role="concept">
39256 <primary>filter</primary>
39257 <secondary>locking out certain features</secondary>
39258 </indexterm>
39259 If this option is true, string expansions in Exim filter files are not allowed
39260 to make use of <option>readfile</option> items.
39261 </para>
39262 <para>
39263 <indexterm role="option">
39264 <primary><option>forbid_filter_readsocket</option></primary>
39265 </indexterm>
39266 </para>
39267 <informaltable frame="all">
39268 <tgroup cols="4" colsep="0" rowsep="0">
39269 <colspec colwidth="8*" align="left"/>
39270 <colspec colwidth="6*" align="center"/>
39271 <colspec colwidth="6*" align="center"/>
39272 <colspec colwidth="6*" align="right"/>
39273 <tbody>
39274 <row>
39275 <entry><option>forbid_filter_readsocket</option></entry>
39276 <entry>Use: <emphasis>redirect</emphasis></entry>
39277 <entry>Type: <emphasis>boolean</emphasis></entry>
39278 <entry>Default: <emphasis>false</emphasis></entry>
39279 </row>
39280 </tbody>
39281 </tgroup>
39282 </informaltable>
39283 <para>
39284 <indexterm role="concept">
39285 <primary>restricting access to features</primary>
39286 </indexterm>
39287 <indexterm role="concept">
39288 <primary>filter</primary>
39289 <secondary>locking out certain features</secondary>
39290 </indexterm>
39291 If this option is true, string expansions in Exim filter files are not allowed
39292 to make use of <option>readsocket</option> items.
39293 </para>
39294 <para>
39295 <indexterm role="option">
39296 <primary><option>forbid_filter_reply</option></primary>
39297 </indexterm>
39298 </para>
39299 <informaltable frame="all">
39300 <tgroup cols="4" colsep="0" rowsep="0">
39301 <colspec colwidth="8*" align="left"/>
39302 <colspec colwidth="6*" align="center"/>
39303 <colspec colwidth="6*" align="center"/>
39304 <colspec colwidth="6*" align="right"/>
39305 <tbody>
39306 <row>
39307 <entry><option>forbid_filter_reply</option></entry>
39308 <entry>Use: <emphasis>redirect</emphasis></entry>
39309 <entry>Type: <emphasis>boolean</emphasis></entry>
39310 <entry>Default: <emphasis>false</emphasis></entry>
39311 </row>
39312 </tbody>
39313 </tgroup>
39314 </informaltable>
39315 <para>
39316 <indexterm role="concept">
39317 <primary>restricting access to features</primary>
39318 </indexterm>
39319 <indexterm role="concept">
39320 <primary>filter</primary>
39321 <secondary>locking out certain features</secondary>
39322 </indexterm>
39323 If this option is true, this router may not generate an automatic reply
39324 message. Automatic replies can be generated only from Exim or Sieve filter
39325 files, not from traditional forward files. This option is forced to be true if
39326 <option>one_time</option> is set.
39327 </para>
39328 <para>
39329 <indexterm role="option">
39330 <primary><option>forbid_filter_run</option></primary>
39331 </indexterm>
39332 </para>
39333 <informaltable frame="all">
39334 <tgroup cols="4" colsep="0" rowsep="0">
39335 <colspec colwidth="8*" align="left"/>
39336 <colspec colwidth="6*" align="center"/>
39337 <colspec colwidth="6*" align="center"/>
39338 <colspec colwidth="6*" align="right"/>
39339 <tbody>
39340 <row>
39341 <entry><option>forbid_filter_run</option></entry>
39342 <entry>Use: <emphasis>redirect</emphasis></entry>
39343 <entry>Type: <emphasis>boolean</emphasis></entry>
39344 <entry>Default: <emphasis>false</emphasis></entry>
39345 </row>
39346 </tbody>
39347 </tgroup>
39348 </informaltable>
39349 <para>
39350 <indexterm role="concept">
39351 <primary>restricting access to features</primary>
39352 </indexterm>
39353 <indexterm role="concept">
39354 <primary>filter</primary>
39355 <secondary>locking out certain features</secondary>
39356 </indexterm>
39357 If this option is true, string expansions in Exim filter files are not allowed
39358 to make use of <option>run</option> items.
39359 </para>
39360 <para>
39361 <indexterm role="option">
39362 <primary><option>forbid_include</option></primary>
39363 </indexterm>
39364 </para>
39365 <informaltable frame="all">
39366 <tgroup cols="4" colsep="0" rowsep="0">
39367 <colspec colwidth="8*" align="left"/>
39368 <colspec colwidth="6*" align="center"/>
39369 <colspec colwidth="6*" align="center"/>
39370 <colspec colwidth="6*" align="right"/>
39371 <tbody>
39372 <row>
39373 <entry><option>forbid_include</option></entry>
39374 <entry>Use: <emphasis>redirect</emphasis></entry>
39375 <entry>Type: <emphasis>boolean</emphasis></entry>
39376 <entry>Default: <emphasis>false</emphasis></entry>
39377 </row>
39378 </tbody>
39379 </tgroup>
39380 </informaltable>
39381 <para>
39382 <indexterm role="concept">
39383 <primary>restricting access to features</primary>
39384 </indexterm>
39385 <indexterm role="concept">
39386 <primary>filter</primary>
39387 <secondary>locking out certain features</secondary>
39388 </indexterm>
39389 If this option is true, items of the form
39390 </para>
39391 <literallayout class="monospaced">
39392 :include:&lt;path name&gt;
39393 </literallayout>
39394 <para>
39395 are not permitted in non-filter redirection lists.
39396 </para>
39397 <para>
39398 <indexterm role="option">
39399 <primary><option>forbid_pipe</option></primary>
39400 </indexterm>
39401 </para>
39402 <informaltable frame="all">
39403 <tgroup cols="4" colsep="0" rowsep="0">
39404 <colspec colwidth="8*" align="left"/>
39405 <colspec colwidth="6*" align="center"/>
39406 <colspec colwidth="6*" align="center"/>
39407 <colspec colwidth="6*" align="right"/>
39408 <tbody>
39409 <row>
39410 <entry><option>forbid_pipe</option></entry>
39411 <entry>Use: <emphasis>redirect</emphasis></entry>
39412 <entry>Type: <emphasis>boolean</emphasis></entry>
39413 <entry>Default: <emphasis>false</emphasis></entry>
39414 </row>
39415 </tbody>
39416 </tgroup>
39417 </informaltable>
39418 <para>
39419 <indexterm role="concept">
39420 <primary>restricting access to features</primary>
39421 </indexterm>
39422 <indexterm role="concept">
39423 <primary>filter</primary>
39424 <secondary>locking out certain features</secondary>
39425 </indexterm>
39426 <indexterm role="concept">
39427 <primary>delivery</primary>
39428 <secondary>to pipe; forbidding</secondary>
39429 </indexterm>
39430 If this option is true, this router may not generate a new address which
39431 specifies delivery to a pipe, either from an Exim filter or from a conventional
39432 forward file. This option is forced to be true if <option>one_time</option> is set.
39433 </para>
39434 <para>
39435 <indexterm role="option">
39436 <primary><option>forbid_sieve_filter</option></primary>
39437 </indexterm>
39438 </para>
39439 <informaltable frame="all">
39440 <tgroup cols="4" colsep="0" rowsep="0">
39441 <colspec colwidth="8*" align="left"/>
39442 <colspec colwidth="6*" align="center"/>
39443 <colspec colwidth="6*" align="center"/>
39444 <colspec colwidth="6*" align="right"/>
39445 <tbody>
39446 <row>
39447 <entry><option>forbid_sieve_filter</option></entry>
39448 <entry>Use: <emphasis>redirect</emphasis></entry>
39449 <entry>Type: <emphasis>boolean</emphasis></entry>
39450 <entry>Default: <emphasis>false</emphasis></entry>
39451 </row>
39452 </tbody>
39453 </tgroup>
39454 </informaltable>
39455 <para>
39456 <indexterm role="concept">
39457 <primary>restricting access to features</primary>
39458 </indexterm>
39459 <indexterm role="concept">
39460 <primary>filter</primary>
39461 <secondary>locking out certain features</secondary>
39462 </indexterm>
39463 If this option is set true, only Exim filters are permitted when
39464 <option>allow_filter</option> is true.
39465 </para>
39466 <para>
39467 <indexterm role="concept">
39468 <primary>SMTP</primary>
39469 <secondary>error codes</secondary>
39470 </indexterm>
39471 <indexterm role="option">
39472 <primary><option>forbid_smtp_code</option></primary>
39473 </indexterm>
39474 </para>
39475 <informaltable frame="all">
39476 <tgroup cols="4" colsep="0" rowsep="0">
39477 <colspec colwidth="8*" align="left"/>
39478 <colspec colwidth="6*" align="center"/>
39479 <colspec colwidth="6*" align="center"/>
39480 <colspec colwidth="6*" align="right"/>
39481 <tbody>
39482 <row>
39483 <entry><option>forbid_smtp_code</option></entry>
39484 <entry>Use: <emphasis>redirect</emphasis></entry>
39485 <entry>Type: <emphasis>boolean</emphasis></entry>
39486 <entry>Default: <emphasis>false</emphasis></entry>
39487 </row>
39488 </tbody>
39489 </tgroup>
39490 </informaltable>
39491 <para>
39492 If this option is set true, any SMTP error codes that are present at the start
39493 of messages specified for <literal>:defer:</literal> or <literal>:fail:</literal> are quietly ignored, and
39494 the default codes (451 and 550, respectively) are always used.
39495 </para>
39496 <para>
39497 <indexterm role="option">
39498 <primary><option>hide_child_in_errmsg</option></primary>
39499 </indexterm>
39500 </para>
39501 <informaltable frame="all">
39502 <tgroup cols="4" colsep="0" rowsep="0">
39503 <colspec colwidth="8*" align="left"/>
39504 <colspec colwidth="6*" align="center"/>
39505 <colspec colwidth="6*" align="center"/>
39506 <colspec colwidth="6*" align="right"/>
39507 <tbody>
39508 <row>
39509 <entry><option>hide_child_in_errmsg</option></entry>
39510 <entry>Use: <emphasis>redirect</emphasis></entry>
39511 <entry>Type: <emphasis>boolean</emphasis></entry>
39512 <entry>Default: <emphasis>false</emphasis></entry>
39513 </row>
39514 </tbody>
39515 </tgroup>
39516 </informaltable>
39517 <para>
39518 <indexterm role="concept">
39519 <primary>bounce message</primary>
39520 <secondary>redirection details; suppressing</secondary>
39521 </indexterm>
39522 If this option is true, it prevents Exim from quoting a child address if it
39523 generates a bounce or delay message for it. Instead it says <quote>an address
39524 generated from &lt;<emphasis>the top level address</emphasis>&gt;</quote>. Of course, this applies only to
39525 bounces generated locally. If a message is forwarded to another host, <emphasis>its</emphasis>
39526 bounce may well quote the generated address.
39527 </para>
39528 <para>
39529 <indexterm role="option">
39530 <primary><option>ignore_eacces</option></primary>
39531 </indexterm>
39532 </para>
39533 <informaltable frame="all">
39534 <tgroup cols="4" colsep="0" rowsep="0">
39535 <colspec colwidth="8*" align="left"/>
39536 <colspec colwidth="6*" align="center"/>
39537 <colspec colwidth="6*" align="center"/>
39538 <colspec colwidth="6*" align="right"/>
39539 <tbody>
39540 <row>
39541 <entry><option>ignore_eacces</option></entry>
39542 <entry>Use: <emphasis>redirect</emphasis></entry>
39543 <entry>Type: <emphasis>boolean</emphasis></entry>
39544 <entry>Default: <emphasis>false</emphasis></entry>
39545 </row>
39546 </tbody>
39547 </tgroup>
39548 </informaltable>
39549 <para>
39550 <indexterm role="concept">
39551 <primary>EACCES</primary>
39552 </indexterm>
39553 If this option is set and an attempt to open a redirection file yields the
39554 EACCES error (permission denied), the <command>redirect</command> router behaves as if the
39555 file did not exist.
39556 </para>
39557 <para>
39558 <indexterm role="option">
39559 <primary><option>ignore_enotdir</option></primary>
39560 </indexterm>
39561 </para>
39562 <informaltable frame="all">
39563 <tgroup cols="4" colsep="0" rowsep="0">
39564 <colspec colwidth="8*" align="left"/>
39565 <colspec colwidth="6*" align="center"/>
39566 <colspec colwidth="6*" align="center"/>
39567 <colspec colwidth="6*" align="right"/>
39568 <tbody>
39569 <row>
39570 <entry><option>ignore_enotdir</option></entry>
39571 <entry>Use: <emphasis>redirect</emphasis></entry>
39572 <entry>Type: <emphasis>boolean</emphasis></entry>
39573 <entry>Default: <emphasis>false</emphasis></entry>
39574 </row>
39575 </tbody>
39576 </tgroup>
39577 </informaltable>
39578 <para>
39579 <indexterm role="concept">
39580 <primary>ENOTDIR</primary>
39581 </indexterm>
39582 If this option is set and an attempt to open a redirection file yields the
39583 ENOTDIR error (something on the path is not a directory), the <command>redirect</command>
39584 router behaves as if the file did not exist.
39585 </para>
39586 <para>
39587 Setting <option>ignore_enotdir</option> has another effect as well: When a <command>redirect</command>
39588 router that has the <option>file</option> option set discovers that the file does not exist
39589 (the ENOENT error), it tries to <function>stat()</function> the parent directory, as a check
39590 against unmounted NFS directories. If the parent can not be statted, delivery
39591 is deferred. However, it seems wrong to do this check when <option>ignore_enotdir</option>
39592 is set, because that option tells Exim to ignore <quote>something on the path is not
39593 a directory</quote> (the ENOTDIR error). This is a confusing area, because it seems
39594 that some operating systems give ENOENT where others give ENOTDIR.
39595 </para>
39596 <para>
39597 <indexterm role="option">
39598 <primary><option>include_directory</option></primary>
39599 </indexterm>
39600 </para>
39601 <informaltable frame="all">
39602 <tgroup cols="4" colsep="0" rowsep="0">
39603 <colspec colwidth="8*" align="left"/>
39604 <colspec colwidth="6*" align="center"/>
39605 <colspec colwidth="6*" align="center"/>
39606 <colspec colwidth="6*" align="right"/>
39607 <tbody>
39608 <row>
39609 <entry><option>include_directory</option></entry>
39610 <entry>Use: <emphasis>redirect</emphasis></entry>
39611 <entry>Type: <emphasis>string</emphasis></entry>
39612 <entry>Default: <emphasis>unset</emphasis></entry>
39613 </row>
39614 </tbody>
39615 </tgroup>
39616 </informaltable>
39617 <para>
39618 If this option is set, the path names of any <emphasis>:include:</emphasis> items in a
39619 redirection list must start with this directory.
39620 </para>
39621 <para>
39622 <indexterm role="option">
39623 <primary><option>modemask</option></primary>
39624 </indexterm>
39625 </para>
39626 <informaltable frame="all">
39627 <tgroup cols="4" colsep="0" rowsep="0">
39628 <colspec colwidth="8*" align="left"/>
39629 <colspec colwidth="6*" align="center"/>
39630 <colspec colwidth="6*" align="center"/>
39631 <colspec colwidth="6*" align="right"/>
39632 <tbody>
39633 <row>
39634 <entry><option>modemask</option></entry>
39635 <entry>Use: <emphasis>redirect</emphasis></entry>
39636 <entry>Type: <emphasis>octal integer</emphasis></entry>
39637 <entry>Default: <emphasis>022</emphasis></entry>
39638 </row>
39639 </tbody>
39640 </tgroup>
39641 </informaltable>
39642 <para>
39643 This specifies mode bits which must not be set for a file specified by the
39644 <option>file</option> option. If any of the forbidden bits are set, delivery is deferred.
39645 </para>
39646 <para>
39647 <indexterm role="option">
39648 <primary><option>one_time</option></primary>
39649 </indexterm>
39650 </para>
39651 <informaltable frame="all">
39652 <tgroup cols="4" colsep="0" rowsep="0">
39653 <colspec colwidth="8*" align="left"/>
39654 <colspec colwidth="6*" align="center"/>
39655 <colspec colwidth="6*" align="center"/>
39656 <colspec colwidth="6*" align="right"/>
39657 <tbody>
39658 <row>
39659 <entry><option>one_time</option></entry>
39660 <entry>Use: <emphasis>redirect</emphasis></entry>
39661 <entry>Type: <emphasis>boolean</emphasis></entry>
39662 <entry>Default: <emphasis>false</emphasis></entry>
39663 </row>
39664 </tbody>
39665 </tgroup>
39666 </informaltable>
39667 <para>
39668 <indexterm role="concept">
39669 <primary>one-time aliasing/forwarding expansion</primary>
39670 </indexterm>
39671 <indexterm role="concept">
39672 <primary>alias file</primary>
39673 <secondary>one-time expansion</secondary>
39674 </indexterm>
39675 <indexterm role="concept">
39676 <primary>forward file</primary>
39677 <secondary>one-time expansion</secondary>
39678 </indexterm>
39679 <indexterm role="concept">
39680 <primary>mailing lists</primary>
39681 <secondary>one-time expansion</secondary>
39682 </indexterm>
39683 <indexterm role="concept">
39684 <primary>address redirection</primary>
39685 <secondary>one-time expansion</secondary>
39686 </indexterm>
39687 Sometimes the fact that Exim re-evaluates aliases and reprocesses redirection
39688 files each time it tries to deliver a message causes a problem when one or more
39689 of the generated addresses fails be delivered at the first attempt. The problem
39690 is not one of duplicate delivery &ndash; Exim is clever enough to handle that &ndash;
39691 but of what happens when the redirection list changes during the time that the
39692 message is on Exim&#x2019;s queue. This is particularly true in the case of mailing
39693 lists, where new subscribers might receive copies of messages that were posted
39694 before they subscribed.
39695 </para>
39696 <para>
39697 If <option>one_time</option> is set and any addresses generated by the router fail to
39698 deliver at the first attempt, the failing addresses are added to the message as
39699 <quote>top level</quote> addresses, and the parent address that generated them is marked
39700 <quote>delivered</quote>. Thus, redirection does not happen again at the next delivery
39701 attempt.
39702 </para>
39703 <para>
39704 <emphasis role="bold">Warning 1</emphasis>: Any header line addition or removal that is specified by this
39705 router would be lost if delivery did not succeed at the first attempt. For this
39706 reason, the <option>headers_add</option> and <option>headers_remove</option> generic options are not
39707 permitted when <option>one_time</option> is set.
39708 </para>
39709 <para>
39710 <emphasis role="bold">Warning 2</emphasis>: To ensure that the router generates only addresses (as opposed
39711 to pipe or file deliveries or auto-replies) <option>forbid_file</option>, <option>forbid_pipe</option>,
39712 and <option>forbid_filter_reply</option> are forced to be true when <option>one_time</option> is set.
39713 </para>
39714 <para>
39715 <emphasis role="bold">Warning 3</emphasis>: The <option>unseen</option> generic router option may not be set with
39716 <option>one_time</option>.
39717 </para>
39718 <para>
39719 The original top-level address is remembered with each of the generated
39720 addresses, and is output in any log messages. However, any intermediate parent
39721 addresses are not recorded. This makes a difference to the log only if
39722 <option>all_parents</option> log selector is set. It is expected that <option>one_time</option> will
39723 typically be used for mailing lists, where there is normally just one level of
39724 expansion.
39725 </para>
39726 <para>
39727 <indexterm role="option">
39728 <primary><option>owners</option></primary>
39729 </indexterm>
39730 </para>
39731 <informaltable frame="all">
39732 <tgroup cols="4" colsep="0" rowsep="0">
39733 <colspec colwidth="8*" align="left"/>
39734 <colspec colwidth="6*" align="center"/>
39735 <colspec colwidth="6*" align="center"/>
39736 <colspec colwidth="6*" align="right"/>
39737 <tbody>
39738 <row>
39739 <entry><option>owners</option></entry>
39740 <entry>Use: <emphasis>redirect</emphasis></entry>
39741 <entry>Type: <emphasis>string list</emphasis></entry>
39742 <entry>Default: <emphasis>unset</emphasis></entry>
39743 </row>
39744 </tbody>
39745 </tgroup>
39746 </informaltable>
39747 <para>
39748 <indexterm role="concept">
39749 <primary>ownership</primary>
39750 <secondary>alias file</secondary>
39751 </indexterm>
39752 <indexterm role="concept">
39753 <primary>ownership</primary>
39754 <secondary>forward file</secondary>
39755 </indexterm>
39756 <indexterm role="concept">
39757 <primary>alias file</primary>
39758 <secondary>ownership</secondary>
39759 </indexterm>
39760 <indexterm role="concept">
39761 <primary>forward file</primary>
39762 <secondary>ownership</secondary>
39763 </indexterm>
39764 This specifies a list of permitted owners for the file specified by <option>file</option>.
39765 This list is in addition to the local user when <option>check_local_user</option> is set.
39766 See <option>check_owner</option> above.
39767 </para>
39768 <para>
39769 <indexterm role="option">
39770 <primary><option>owngroups</option></primary>
39771 </indexterm>
39772 </para>
39773 <informaltable frame="all">
39774 <tgroup cols="4" colsep="0" rowsep="0">
39775 <colspec colwidth="8*" align="left"/>
39776 <colspec colwidth="6*" align="center"/>
39777 <colspec colwidth="6*" align="center"/>
39778 <colspec colwidth="6*" align="right"/>
39779 <tbody>
39780 <row>
39781 <entry><option>owngroups</option></entry>
39782 <entry>Use: <emphasis>redirect</emphasis></entry>
39783 <entry>Type: <emphasis>string list</emphasis></entry>
39784 <entry>Default: <emphasis>unset</emphasis></entry>
39785 </row>
39786 </tbody>
39787 </tgroup>
39788 </informaltable>
39789 <para>
39790 This specifies a list of permitted groups for the file specified by <option>file</option>.
39791 The list is in addition to the local user&#x2019;s primary group when
39792 <option>check_local_user</option> is set. See <option>check_group</option> above.
39793 </para>
39794 <para>
39795 <indexterm role="option">
39796 <primary><option>pipe_transport</option></primary>
39797 </indexterm>
39798 </para>
39799 <informaltable frame="all">
39800 <tgroup cols="4" colsep="0" rowsep="0">
39801 <colspec colwidth="8*" align="left"/>
39802 <colspec colwidth="6*" align="center"/>
39803 <colspec colwidth="6*" align="center"/>
39804 <colspec colwidth="6*" align="right"/>
39805 <tbody>
39806 <row>
39807 <entry><option>pipe_transport</option></entry>
39808 <entry>Use: <emphasis>redirect</emphasis></entry>
39809 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39810 <entry>Default: <emphasis>unset</emphasis></entry>
39811 </row>
39812 </tbody>
39813 </tgroup>
39814 </informaltable>
39815 <para>
39816 <indexterm role="variable">
39817 <primary><varname>$address_pipe</varname></primary>
39818 </indexterm>
39819 A <command>redirect</command> router sets up a direct delivery to a pipe when a string
39820 starting with a vertical bar character is specified as a new <quote>address</quote>. The
39821 transport used is specified by this option, which, after expansion, must be the
39822 name of a configured transport. This should normally be a <command>pipe</command> transport.
39823 When the transport is run, the pipe command is in <varname>$address_pipe</varname>.
39824 </para>
39825 <para>
39826 <indexterm role="option">
39827 <primary><option>qualify_domain</option></primary>
39828 </indexterm>
39829 </para>
39830 <informaltable frame="all">
39831 <tgroup cols="4" colsep="0" rowsep="0">
39832 <colspec colwidth="8*" align="left"/>
39833 <colspec colwidth="6*" align="center"/>
39834 <colspec colwidth="6*" align="center"/>
39835 <colspec colwidth="6*" align="right"/>
39836 <tbody>
39837 <row>
39838 <entry><option>qualify_domain</option></entry>
39839 <entry>Use: <emphasis>redirect</emphasis></entry>
39840 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39841 <entry>Default: <emphasis>unset</emphasis></entry>
39842 </row>
39843 </tbody>
39844 </tgroup>
39845 </informaltable>
39846 <para>
39847 <indexterm role="variable">
39848 <primary><varname>$qualify_recipient</varname></primary>
39849 </indexterm>
39850 If this option is set, and an unqualified address (one without a domain) is
39851 generated, and that address would normally be qualified by the global setting
39852 in <option>qualify_recipient</option>, it is instead qualified with the domain specified by
39853 expanding this string. If the expansion fails, the router declines. If you want
39854 to revert to the default, you can have the expansion generate
39855 <varname>$qualify_recipient</varname>.
39856 </para>
39857 <para>
39858 This option applies to all unqualified addresses generated by Exim filters,
39859 but for traditional <filename>.forward</filename> files, it applies only to addresses that are
39860 not preceded by a backslash. Sieve filters cannot generate unqualified
39861 addresses.
39862 </para>
39863 <para>
39864 <indexterm role="option">
39865 <primary><option>qualify_preserve_domain</option></primary>
39866 </indexterm>
39867 </para>
39868 <informaltable frame="all">
39869 <tgroup cols="4" colsep="0" rowsep="0">
39870 <colspec colwidth="8*" align="left"/>
39871 <colspec colwidth="6*" align="center"/>
39872 <colspec colwidth="6*" align="center"/>
39873 <colspec colwidth="6*" align="right"/>
39874 <tbody>
39875 <row>
39876 <entry><option>qualify_preserve_domain</option></entry>
39877 <entry>Use: <emphasis>redirect</emphasis></entry>
39878 <entry>Type: <emphasis>boolean</emphasis></entry>
39879 <entry>Default: <emphasis>false</emphasis></entry>
39880 </row>
39881 </tbody>
39882 </tgroup>
39883 </informaltable>
39884 <para>
39885 <indexterm role="concept">
39886 <primary>domain</primary>
39887 <secondary>in redirection; preserving</secondary>
39888 </indexterm>
39889 <indexterm role="concept">
39890 <primary>preserving domain in redirection</primary>
39891 </indexterm>
39892 <indexterm role="concept">
39893 <primary>address redirection</primary>
39894 <secondary>domain; preserving</secondary>
39895 </indexterm>
39896 If this option is set, the router&#x2019;s local <option>qualify_domain</option> option must not be
39897 set (a configuration error occurs if it is). If an unqualified address (one
39898 without a domain) is generated, it is qualified with the domain of the parent
39899 address (the immediately preceding ancestor) instead of the global
39900 <option>qualify_recipient</option> value. In the case of a traditional <filename>.forward</filename> file,
39901 this applies whether or not the address is preceded by a backslash.
39902 </para>
39903 <para>
39904 <indexterm role="option">
39905 <primary><option>repeat_use</option></primary>
39906 </indexterm>
39907 </para>
39908 <informaltable frame="all">
39909 <tgroup cols="4" colsep="0" rowsep="0">
39910 <colspec colwidth="8*" align="left"/>
39911 <colspec colwidth="6*" align="center"/>
39912 <colspec colwidth="6*" align="center"/>
39913 <colspec colwidth="6*" align="right"/>
39914 <tbody>
39915 <row>
39916 <entry><option>repeat_use</option></entry>
39917 <entry>Use: <emphasis>redirect</emphasis></entry>
39918 <entry>Type: <emphasis>boolean</emphasis></entry>
39919 <entry>Default: <emphasis>true</emphasis></entry>
39920 </row>
39921 </tbody>
39922 </tgroup>
39923 </informaltable>
39924 <para>
39925 If this option is set false, the router is skipped for a child address that has
39926 any ancestor that was routed by this router. This test happens before any of
39927 the other preconditions are tested. Exim&#x2019;s default anti-looping rules skip
39928 only when the ancestor is the same as the current address. See also
39929 <option>check_ancestor</option> above and the generic <option>redirect_router</option> option.
39930 </para>
39931 <para>
39932 <indexterm role="option">
39933 <primary><option>reply_transport</option></primary>
39934 </indexterm>
39935 </para>
39936 <informaltable frame="all">
39937 <tgroup cols="4" colsep="0" rowsep="0">
39938 <colspec colwidth="8*" align="left"/>
39939 <colspec colwidth="6*" align="center"/>
39940 <colspec colwidth="6*" align="center"/>
39941 <colspec colwidth="6*" align="right"/>
39942 <tbody>
39943 <row>
39944 <entry><option>reply_transport</option></entry>
39945 <entry>Use: <emphasis>redirect</emphasis></entry>
39946 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39947 <entry>Default: <emphasis>unset</emphasis></entry>
39948 </row>
39949 </tbody>
39950 </tgroup>
39951 </informaltable>
39952 <para>
39953 A <command>redirect</command> router sets up an automatic reply when a <option>mail</option> or
39954 <option>vacation</option> command is used in a filter file. The transport used is specified
39955 by this option, which, after expansion, must be the name of a configured
39956 transport. This should normally be an <command>autoreply</command> transport. Other transports
39957 are unlikely to do anything sensible or useful.
39958 </para>
39959 <para>
39960 <indexterm role="option">
39961 <primary><option>rewrite</option></primary>
39962 </indexterm>
39963 </para>
39964 <informaltable frame="all">
39965 <tgroup cols="4" colsep="0" rowsep="0">
39966 <colspec colwidth="8*" align="left"/>
39967 <colspec colwidth="6*" align="center"/>
39968 <colspec colwidth="6*" align="center"/>
39969 <colspec colwidth="6*" align="right"/>
39970 <tbody>
39971 <row>
39972 <entry><option>rewrite</option></entry>
39973 <entry>Use: <emphasis>redirect</emphasis></entry>
39974 <entry>Type: <emphasis>boolean</emphasis></entry>
39975 <entry>Default: <emphasis>true</emphasis></entry>
39976 </row>
39977 </tbody>
39978 </tgroup>
39979 </informaltable>
39980 <para>
39981 <indexterm role="concept">
39982 <primary>address redirection</primary>
39983 <secondary>disabling rewriting</secondary>
39984 </indexterm>
39985 If this option is set false, addresses generated by the router are not
39986 subject to address rewriting. Otherwise, they are treated like new addresses
39987 and are rewritten according to the global rewriting rules.
39988 </para>
39989 <para>
39990 <indexterm role="option">
39991 <primary><option>sieve_subaddress</option></primary>
39992 </indexterm>
39993 </para>
39994 <informaltable frame="all">
39995 <tgroup cols="4" colsep="0" rowsep="0">
39996 <colspec colwidth="8*" align="left"/>
39997 <colspec colwidth="6*" align="center"/>
39998 <colspec colwidth="6*" align="center"/>
39999 <colspec colwidth="6*" align="right"/>
40000 <tbody>
40001 <row>
40002 <entry><option>sieve_subaddress</option></entry>
40003 <entry>Use: <emphasis>redirect</emphasis></entry>
40004 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40005 <entry>Default: <emphasis>unset</emphasis></entry>
40006 </row>
40007 </tbody>
40008 </tgroup>
40009 </informaltable>
40010 <para>
40011 The value of this option is passed to a Sieve filter to specify the
40012 :subaddress part of an address.
40013 </para>
40014 <para>
40015 <indexterm role="option">
40016 <primary><option>sieve_useraddress</option></primary>
40017 </indexterm>
40018 </para>
40019 <informaltable frame="all">
40020 <tgroup cols="4" colsep="0" rowsep="0">
40021 <colspec colwidth="8*" align="left"/>
40022 <colspec colwidth="6*" align="center"/>
40023 <colspec colwidth="6*" align="center"/>
40024 <colspec colwidth="6*" align="right"/>
40025 <tbody>
40026 <row>
40027 <entry><option>sieve_useraddress</option></entry>
40028 <entry>Use: <emphasis>redirect</emphasis></entry>
40029 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40030 <entry>Default: <emphasis>unset</emphasis></entry>
40031 </row>
40032 </tbody>
40033 </tgroup>
40034 </informaltable>
40035 <para>
40036 The value of this option is passed to a Sieve filter to specify the :user part
40037 of an address. However, if it is unset, the entire original local part
40038 (including any prefix or suffix) is used for :user.
40039 </para>
40040 <para>
40041 <indexterm role="option">
40042 <primary><option>sieve_vacation_directory</option></primary>
40043 </indexterm>
40044 </para>
40045 <informaltable frame="all">
40046 <tgroup cols="4" colsep="0" rowsep="0">
40047 <colspec colwidth="8*" align="left"/>
40048 <colspec colwidth="6*" align="center"/>
40049 <colspec colwidth="6*" align="center"/>
40050 <colspec colwidth="6*" align="right"/>
40051 <tbody>
40052 <row>
40053 <entry><option>sieve_vacation_directory</option></entry>
40054 <entry>Use: <emphasis>redirect</emphasis></entry>
40055 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40056 <entry>Default: <emphasis>unset</emphasis></entry>
40057 </row>
40058 </tbody>
40059 </tgroup>
40060 </informaltable>
40061 <para>
40062 <indexterm role="concept">
40063 <primary>Sieve filter</primary>
40064 <secondary>vacation directory</secondary>
40065 </indexterm>
40066 To enable the <quote>vacation</quote> extension for Sieve filters, you must set
40067 <option>sieve_vacation_directory</option> to the directory where vacation databases are held
40068 (do not put anything else in that directory), and ensure that the
40069 <option>reply_transport</option> option refers to an <command>autoreply</command> transport. Each user
40070 needs their own directory; Exim will create it if necessary.
40071 </para>
40072 <para>
40073 <indexterm role="option">
40074 <primary><option>skip_syntax_errors</option></primary>
40075 </indexterm>
40076 </para>
40077 <informaltable frame="all">
40078 <tgroup cols="4" colsep="0" rowsep="0">
40079 <colspec colwidth="8*" align="left"/>
40080 <colspec colwidth="6*" align="center"/>
40081 <colspec colwidth="6*" align="center"/>
40082 <colspec colwidth="6*" align="right"/>
40083 <tbody>
40084 <row>
40085 <entry><option>skip_syntax_errors</option></entry>
40086 <entry>Use: <emphasis>redirect</emphasis></entry>
40087 <entry>Type: <emphasis>boolean</emphasis></entry>
40088 <entry>Default: <emphasis>false</emphasis></entry>
40089 </row>
40090 </tbody>
40091 </tgroup>
40092 </informaltable>
40093 <para>
40094 <indexterm role="concept">
40095 <primary>forward file</primary>
40096 <secondary>broken</secondary>
40097 </indexterm>
40098 <indexterm role="concept">
40099 <primary>address redirection</primary>
40100 <secondary>broken files</secondary>
40101 </indexterm>
40102 <indexterm role="concept">
40103 <primary>alias file</primary>
40104 <secondary>broken</secondary>
40105 </indexterm>
40106 <indexterm role="concept">
40107 <primary>broken alias or forward files</primary>
40108 </indexterm>
40109 <indexterm role="concept">
40110 <primary>ignoring faulty addresses</primary>
40111 </indexterm>
40112 <indexterm role="concept">
40113 <primary>skipping faulty addresses</primary>
40114 </indexterm>
40115 <indexterm role="concept">
40116 <primary>error</primary>
40117 <secondary>skipping bad syntax</secondary>
40118 </indexterm>
40119 If <option>skip_syntax_errors</option> is set, syntactically malformed addresses in
40120 non-filter redirection data are skipped, and each failing address is logged. If
40121 <option>syntax_errors_to</option> is set, a message is sent to the address it defines,
40122 giving details of the failures. If <option>syntax_errors_text</option> is set, its contents
40123 are expanded and placed at the head of the error message generated by
40124 <option>syntax_errors_to</option>. Usually it is appropriate to set <option>syntax_errors_to</option> to
40125 be the same address as the generic <option>errors_to</option> option. The
40126 <option>skip_syntax_errors</option> option is often used when handling mailing lists.
40127 </para>
40128 <para>
40129 If all the addresses in a redirection list are skipped because of syntax
40130 errors, the router declines to handle the original address, and it is passed to
40131 the following routers.
40132 </para>
40133 <para>
40134 If <option>skip_syntax_errors</option> is set when an Exim filter is interpreted, any syntax
40135 error in the filter causes filtering to be abandoned without any action being
40136 taken. The incident is logged, and the router declines to handle the address,
40137 so it is passed to the following routers.
40138 </para>
40139 <para>
40140 <indexterm role="concept">
40141 <primary>Sieve filter</primary>
40142 <secondary>syntax errors in</secondary>
40143 </indexterm>
40144 Syntax errors in a Sieve filter file cause the <quote>keep</quote> action to occur. This
40145 action is specified by RFC 3028. The values of <option>skip_syntax_errors</option>,
40146 <option>syntax_errors_to</option>, and <option>syntax_errors_text</option> are not used.
40147 </para>
40148 <para>
40149 <option>skip_syntax_errors</option> can be used to specify that errors in users&#x2019; forward
40150 lists or filter files should not prevent delivery. The <option>syntax_errors_to</option>
40151 option, used with an address that does not get redirected, can be used to
40152 notify users of these errors, by means of a router like this:
40153 </para>
40154 <literallayout class="monospaced">
40155 userforward:
40156   driver = redirect
40157   allow_filter
40158   check_local_user
40159   file = $home/.forward
40160   file_transport = address_file
40161   pipe_transport = address_pipe
40162   reply_transport = address_reply
40163   no_verify
40164   skip_syntax_errors
40165   syntax_errors_to = real-$local_part@$domain
40166   syntax_errors_text = \
40167    This is an automatically generated message. An error has\n\
40168    been found in your .forward file. Details of the error are\n\
40169    reported below. While this error persists, you will receive\n\
40170    a copy of this message for every message that is addressed\n\
40171    to you. If your .forward file is a filter file, or if it is\n\
40172    a non-filter file containing no valid forwarding addresses,\n\
40173    a copy of each incoming message will be put in your normal\n\
40174    mailbox. If a non-filter file contains at least one valid\n\
40175    forwarding address, forwarding to the valid addresses will\n\
40176    happen, and those will be the only deliveries that occur.
40177 </literallayout>
40178 <para>
40179 You also need a router to ensure that local addresses that are prefixed by
40180 <literal>real-</literal> are recognized, but not forwarded or filtered. For example, you could
40181 put this immediately before the <command>userforward</command> router:
40182 </para>
40183 <literallayout class="monospaced">
40184 real_localuser:
40185   driver = accept
40186   check_local_user
40187   local_part_prefix = real-
40188   transport = local_delivery
40189 </literallayout>
40190 <para>
40191 For security, it would probably be a good idea to restrict the use of this
40192 router to locally-generated messages, using a condition such as this:
40193 </para>
40194 <literallayout class="monospaced">
40195   condition = ${if match {$sender_host_address}\
40196                          {\N^(|127\.0\.0\.1)$\N}}
40197 </literallayout>
40198 <para>
40199 <indexterm role="option">
40200 <primary><option>syntax_errors_text</option></primary>
40201 </indexterm>
40202 </para>
40203 <informaltable frame="all">
40204 <tgroup cols="4" colsep="0" rowsep="0">
40205 <colspec colwidth="8*" align="left"/>
40206 <colspec colwidth="6*" align="center"/>
40207 <colspec colwidth="6*" align="center"/>
40208 <colspec colwidth="6*" align="right"/>
40209 <tbody>
40210 <row>
40211 <entry><option>syntax_errors_text</option></entry>
40212 <entry>Use: <emphasis>redirect</emphasis></entry>
40213 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40214 <entry>Default: <emphasis>unset</emphasis></entry>
40215 </row>
40216 </tbody>
40217 </tgroup>
40218 </informaltable>
40219 <para>
40220 See <option>skip_syntax_errors</option> above.
40221 </para>
40222 <para>
40223 <indexterm role="option">
40224 <primary><option>syntax_errors_to</option></primary>
40225 </indexterm>
40226 </para>
40227 <informaltable frame="all">
40228 <tgroup cols="4" colsep="0" rowsep="0">
40229 <colspec colwidth="8*" align="left"/>
40230 <colspec colwidth="6*" align="center"/>
40231 <colspec colwidth="6*" align="center"/>
40232 <colspec colwidth="6*" align="right"/>
40233 <tbody>
40234 <row>
40235 <entry><option>syntax_errors_to</option></entry>
40236 <entry>Use: <emphasis>redirect</emphasis></entry>
40237 <entry>Type: <emphasis>string</emphasis></entry>
40238 <entry>Default: <emphasis>unset</emphasis></entry>
40239 </row>
40240 </tbody>
40241 </tgroup>
40242 </informaltable>
40243 <para>
40244 See <option>skip_syntax_errors</option> above.
40245 <indexterm role="concept" startref="IIDredrou1" class="endofrange"/>
40246 <indexterm role="concept" startref="IIDredrou2" class="endofrange"/>
40247 </para>
40248 </section>
40249 </chapter>
40250
40251 <chapter id="CHAPenvironment">
40252 <title>Environment for running local transports</title>
40253 <titleabbrev>Environment for local transports</titleabbrev>
40254 <para>
40255 <indexterm role="concept" id="IIDenvlotra1" class="startofrange">
40256 <primary>local transports</primary>
40257 <secondary>environment for</secondary>
40258 </indexterm>
40259 <indexterm role="concept" id="IIDenvlotra2" class="startofrange">
40260 <primary>environment</primary>
40261 <secondary>local transports</secondary>
40262 </indexterm>
40263 <indexterm role="concept" id="IIDenvlotra3" class="startofrange">
40264 <primary>transport</primary>
40265 <secondary>local; environment for</secondary>
40266 </indexterm>
40267 Local transports handle deliveries to files and pipes. (The <command>autoreply</command>
40268 transport can be thought of as similar to a pipe.) Exim always runs transports
40269 in subprocesses, under specified uids and gids. Typical deliveries to local
40270 mailboxes run under the uid and gid of the local user.
40271 </para>
40272 <para>
40273 Exim also sets a specific current directory while running the transport; for
40274 some transports a home directory setting is also relevant. The <command>pipe</command>
40275 transport is the only one that sets up environment variables; see section
40276 <xref linkend="SECTpipeenv"/> for details.
40277 </para>
40278 <para>
40279 The values used for the uid, gid, and the directories may come from several
40280 different places. In many cases, the router that handles the address associates
40281 settings with that address as a result of its <option>check_local_user</option>, <option>group</option>,
40282 or <option>user</option> options. However, values may also be given in the transport&#x2019;s own
40283 configuration, and these override anything that comes from the router.
40284 </para>
40285 <section id="SECID131">
40286 <title>Concurrent deliveries</title>
40287 <para>
40288 <indexterm role="concept">
40289 <primary>concurrent deliveries</primary>
40290 </indexterm>
40291 <indexterm role="concept">
40292 <primary>simultaneous deliveries</primary>
40293 </indexterm>
40294 If two different messages for the same local recipient arrive more or less
40295 simultaneously, the two delivery processes are likely to run concurrently. When
40296 the <command>appendfile</command> transport is used to write to a file, Exim applies locking
40297 rules to stop concurrent processes from writing to the same file at the same
40298 time.
40299 </para>
40300 <para>
40301 However, when you use a <command>pipe</command> transport, it is up to you to arrange any
40302 locking that is needed. Here is a silly example:
40303 </para>
40304 <literallayout class="monospaced">
40305 my_transport:
40306   driver = pipe
40307   command = /bin/sh -c 'cat &gt;&gt;/some/file'
40308 </literallayout>
40309 <para>
40310 This is supposed to write the message at the end of the file. However, if two
40311 messages arrive at the same time, the file will be scrambled. You can use the
40312 <option>exim_lock</option> utility program (see section <xref linkend="SECTmailboxmaint"/>) to lock a
40313 file using the same algorithm that Exim itself uses.
40314 </para>
40315 </section>
40316 <section id="SECTenvuidgid">
40317 <title>Uids and gids</title>
40318 <para>
40319 <indexterm role="concept">
40320 <primary>local transports</primary>
40321 <secondary>uid and gid</secondary>
40322 </indexterm>
40323 <indexterm role="concept">
40324 <primary>transport</primary>
40325 <secondary>local; uid and gid</secondary>
40326 </indexterm>
40327 All transports have the options <option>group</option> and <option>user</option>. If <option>group</option> is set, it
40328 overrides any group that the router set in the address, even if <option>user</option> is not
40329 set for the transport. This makes it possible, for example, to run local mail
40330 delivery under the uid of the recipient (set by the router), but in a special
40331 group (set by the transport). For example:
40332 </para>
40333 <literallayout class="monospaced">
40334 # Routers ...
40335 # User/group are set by check_local_user in this router
40336 local_users:
40337   driver = accept
40338   check_local_user
40339   transport = group_delivery
40340
40341 # Transports ...
40342 # This transport overrides the group
40343 group_delivery:
40344   driver = appendfile
40345   file = /var/spool/mail/$local_part
40346   group = mail
40347 </literallayout>
40348 <para>
40349 If <option>user</option> is set for a transport, its value overrides what is set in the
40350 address by the router. If <option>user</option> is non-numeric and <option>group</option> is not set, the
40351 gid associated with the user is used. If <option>user</option> is numeric, <option>group</option> must be
40352 set.
40353 </para>
40354 <para>
40355 <indexterm role="option">
40356 <primary><option>initgroups</option></primary>
40357 </indexterm>
40358 When the uid is taken from the transport&#x2019;s configuration, the <function>initgroups()</function>
40359 function is called for the groups associated with that uid if the
40360 <option>initgroups</option> option is set for the transport. When the uid is not specified
40361 by the transport, but is associated with the address by a router, the option
40362 for calling <function>initgroups()</function> is taken from the router configuration.
40363 </para>
40364 <para>
40365 <indexterm role="concept">
40366 <primary><command>pipe</command> transport</primary>
40367 <secondary>uid for</secondary>
40368 </indexterm>
40369 The <command>pipe</command> transport contains the special option <option>pipe_as_creator</option>. If this
40370 is set and <option>user</option> is not set, the uid of the process that called Exim to
40371 receive the message is used, and if <option>group</option> is not set, the corresponding
40372 original gid is also used.
40373 </para>
40374 <para>
40375 This is the detailed preference order for obtaining a gid; the first of the
40376 following that is set is used:
40377 </para>
40378 <itemizedlist>
40379 <listitem>
40380 <para>
40381 A <option>group</option> setting of the transport;
40382 </para>
40383 </listitem>
40384 <listitem>
40385 <para>
40386 A <option>group</option> setting of the router;
40387 </para>
40388 </listitem>
40389 <listitem>
40390 <para>
40391 A gid associated with a user setting of the router, either as a result of
40392 <option>check_local_user</option> or an explicit non-numeric <option>user</option> setting;
40393 </para>
40394 </listitem>
40395 <listitem>
40396 <para>
40397 The group associated with a non-numeric <option>user</option> setting of the transport;
40398 </para>
40399 </listitem>
40400 <listitem>
40401 <para>
40402 In a <command>pipe</command> transport, the creator&#x2019;s gid if <option>deliver_as_creator</option> is set and
40403 the uid is the creator&#x2019;s uid;
40404 </para>
40405 </listitem>
40406 <listitem>
40407 <para>
40408 The Exim gid if the Exim uid is being used as a default.
40409 </para>
40410 </listitem>
40411 </itemizedlist>
40412 <para>
40413 If, for example, the user is specified numerically on the router and there are
40414 no group settings, no gid is available. In this situation, an error occurs.
40415 This is different for the uid, for which there always is an ultimate default.
40416 The first of the following that is set is used:
40417 </para>
40418 <itemizedlist>
40419 <listitem>
40420 <para>
40421 A <option>user</option> setting of the transport;
40422 </para>
40423 </listitem>
40424 <listitem>
40425 <para>
40426 In a <command>pipe</command> transport, the creator&#x2019;s uid if <option>deliver_as_creator</option> is set;
40427 </para>
40428 </listitem>
40429 <listitem>
40430 <para>
40431 A <option>user</option> setting of the router;
40432 </para>
40433 </listitem>
40434 <listitem>
40435 <para>
40436 A <option>check_local_user</option> setting of the router;
40437 </para>
40438 </listitem>
40439 <listitem>
40440 <para>
40441 The Exim uid.
40442 </para>
40443 </listitem>
40444 </itemizedlist>
40445 <para>
40446 Of course, an error will still occur if the uid that is chosen is on the
40447 <option>never_users</option> list.
40448 </para>
40449 </section>
40450 <section id="SECID132">
40451 <title>Current and home directories</title>
40452 <para>
40453 <indexterm role="concept">
40454 <primary>current directory for local transport</primary>
40455 </indexterm>
40456 <indexterm role="concept">
40457 <primary>home directory</primary>
40458 <secondary>for local transport</secondary>
40459 </indexterm>
40460 <indexterm role="concept">
40461 <primary>transport</primary>
40462 <secondary>local; home directory for</secondary>
40463 </indexterm>
40464 <indexterm role="concept">
40465 <primary>transport</primary>
40466 <secondary>local; current directory for</secondary>
40467 </indexterm>
40468 Routers may set current and home directories for local transports by means of
40469 the <option>transport_current_directory</option> and <option>transport_home_directory</option> options.
40470 However, if the transport&#x2019;s <option>current_directory</option> or <option>home_directory</option> options
40471 are set, they override the router&#x2019;s values. In detail, the home directory
40472 for a local transport is taken from the first of these values that is set:
40473 </para>
40474 <itemizedlist>
40475 <listitem>
40476 <para>
40477 The <option>home_directory</option> option on the transport;
40478 </para>
40479 </listitem>
40480 <listitem>
40481 <para>
40482 The <option>transport_home_directory</option> option on the router;
40483 </para>
40484 </listitem>
40485 <listitem>
40486 <para>
40487 The password data if <option>check_local_user</option> is set on the router;
40488 </para>
40489 </listitem>
40490 <listitem>
40491 <para>
40492 The <option>router_home_directory</option> option on the router.
40493 </para>
40494 </listitem>
40495 </itemizedlist>
40496 <para>
40497 The current directory is taken from the first of these values that is set:
40498 </para>
40499 <itemizedlist>
40500 <listitem>
40501 <para>
40502 The <option>current_directory</option> option on the transport;
40503 </para>
40504 </listitem>
40505 <listitem>
40506 <para>
40507 The <option>transport_current_directory</option> option on the router.
40508 </para>
40509 </listitem>
40510 </itemizedlist>
40511 <para>
40512 If neither the router nor the transport sets a current directory, Exim uses the
40513 value of the home directory, if it is set. Otherwise it sets the current
40514 directory to <filename>/</filename> before running a local transport.
40515 </para>
40516 </section>
40517 <section id="SECID133">
40518 <title>Expansion variables derived from the address</title>
40519 <para>
40520 <indexterm role="variable">
40521 <primary><varname>$domain</varname></primary>
40522 </indexterm>
40523 <indexterm role="variable">
40524 <primary><varname>$local_part</varname></primary>
40525 </indexterm>
40526 <indexterm role="variable">
40527 <primary><varname>$original_domain</varname></primary>
40528 </indexterm>
40529 Normally a local delivery is handling a single address, and in that case the
40530 variables such as <varname>$domain</varname> and <varname>$local_part</varname> are set during local
40531 deliveries. However, in some circumstances more than one address may be handled
40532 at once (for example, while writing batch SMTP for onward transmission by some
40533 other means). In this case, the variables associated with the local part are
40534 never set, <varname>$domain</varname> is set only if all the addresses have the same domain,
40535 and <varname>$original_domain</varname> is never set.
40536 <indexterm role="concept" startref="IIDenvlotra1" class="endofrange"/>
40537 <indexterm role="concept" startref="IIDenvlotra2" class="endofrange"/>
40538 <indexterm role="concept" startref="IIDenvlotra3" class="endofrange"/>
40539 </para>
40540 </section>
40541 </chapter>
40542
40543 <chapter id="CHAPtransportgeneric">
40544 <title>Generic options for transports</title>
40545 <para>
40546 <indexterm role="concept" id="IIDgenoptra1" class="startofrange">
40547 <primary>generic options</primary>
40548 <secondary>transport</secondary>
40549 </indexterm>
40550 <indexterm role="concept" id="IIDgenoptra2" class="startofrange">
40551 <primary>options</primary>
40552 <secondary>generic; for transports</secondary>
40553 </indexterm>
40554 <indexterm role="concept" id="IIDgenoptra3" class="startofrange">
40555 <primary>transport</primary>
40556 <secondary>generic options for</secondary>
40557 </indexterm>
40558 The following generic options apply to all transports:
40559 </para>
40560 <para>
40561 <indexterm role="option">
40562 <primary><option>body_only</option></primary>
40563 </indexterm>
40564 </para>
40565 <informaltable frame="all">
40566 <tgroup cols="4" colsep="0" rowsep="0">
40567 <colspec colwidth="8*" align="left"/>
40568 <colspec colwidth="6*" align="center"/>
40569 <colspec colwidth="6*" align="center"/>
40570 <colspec colwidth="6*" align="right"/>
40571 <tbody>
40572 <row>
40573 <entry><option>body_only</option></entry>
40574 <entry>Use: <emphasis>transports</emphasis></entry>
40575 <entry>Type: <emphasis>boolean</emphasis></entry>
40576 <entry>Default: <emphasis>false</emphasis></entry>
40577 </row>
40578 </tbody>
40579 </tgroup>
40580 </informaltable>
40581 <para>
40582 <indexterm role="concept">
40583 <primary>transport</primary>
40584 <secondary>body only</secondary>
40585 </indexterm>
40586 <indexterm role="concept">
40587 <primary>message</primary>
40588 <secondary>transporting body only</secondary>
40589 </indexterm>
40590 <indexterm role="concept">
40591 <primary>body of message</primary>
40592 <secondary>transporting</secondary>
40593 </indexterm>
40594 If this option is set, the message&#x2019;s headers are not transported. It is
40595 mutually exclusive with <option>headers_only</option>. If it is used with the <command>appendfile</command>
40596 or <command>pipe</command> transports, the settings of <option>message_prefix</option> and
40597 <option>message_suffix</option> should be checked, because this option does not
40598 automatically suppress them.
40599 </para>
40600 <para>
40601 <indexterm role="option">
40602 <primary><option>current_directory</option></primary>
40603 </indexterm>
40604 </para>
40605 <informaltable frame="all">
40606 <tgroup cols="4" colsep="0" rowsep="0">
40607 <colspec colwidth="8*" align="left"/>
40608 <colspec colwidth="6*" align="center"/>
40609 <colspec colwidth="6*" align="center"/>
40610 <colspec colwidth="6*" align="right"/>
40611 <tbody>
40612 <row>
40613 <entry><option>current_directory</option></entry>
40614 <entry>Use: <emphasis>transports</emphasis></entry>
40615 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40616 <entry>Default: <emphasis>unset</emphasis></entry>
40617 </row>
40618 </tbody>
40619 </tgroup>
40620 </informaltable>
40621 <para>
40622 <indexterm role="concept">
40623 <primary>transport</primary>
40624 <secondary>current directory for</secondary>
40625 </indexterm>
40626 This specifies the current directory that is to be set while running the
40627 transport, overriding any value that may have been set by the router.
40628 If the expansion fails for any reason, including forced failure, an error is
40629 logged, and delivery is deferred.
40630 </para>
40631 <para>
40632 <indexterm role="option">
40633 <primary><option>disable_logging</option></primary>
40634 </indexterm>
40635 </para>
40636 <informaltable frame="all">
40637 <tgroup cols="4" colsep="0" rowsep="0">
40638 <colspec colwidth="8*" align="left"/>
40639 <colspec colwidth="6*" align="center"/>
40640 <colspec colwidth="6*" align="center"/>
40641 <colspec colwidth="6*" align="right"/>
40642 <tbody>
40643 <row>
40644 <entry><option>disable_logging</option></entry>
40645 <entry>Use: <emphasis>transports</emphasis></entry>
40646 <entry>Type: <emphasis>boolean</emphasis></entry>
40647 <entry>Default: <emphasis>false</emphasis></entry>
40648 </row>
40649 </tbody>
40650 </tgroup>
40651 </informaltable>
40652 <para>
40653 If this option is set true, nothing is logged for any
40654 deliveries by the transport or for any
40655 transport errors. You should not set this option unless you really, really know
40656 what you are doing.
40657 </para>
40658 <para>
40659 <indexterm role="option">
40660 <primary><option>debug_print</option></primary>
40661 </indexterm>
40662 </para>
40663 <informaltable frame="all">
40664 <tgroup cols="4" colsep="0" rowsep="0">
40665 <colspec colwidth="8*" align="left"/>
40666 <colspec colwidth="6*" align="center"/>
40667 <colspec colwidth="6*" align="center"/>
40668 <colspec colwidth="6*" align="right"/>
40669 <tbody>
40670 <row>
40671 <entry><option>debug_print</option></entry>
40672 <entry>Use: <emphasis>transports</emphasis></entry>
40673 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40674 <entry>Default: <emphasis>unset</emphasis></entry>
40675 </row>
40676 </tbody>
40677 </tgroup>
40678 </informaltable>
40679 <para>
40680 <indexterm role="concept">
40681 <primary>testing</primary>
40682 <secondary>variables in drivers</secondary>
40683 </indexterm>
40684 If this option is set and debugging is enabled (see the <option>-d</option> command line
40685 option), the string is expanded and included in the debugging output when the
40686 transport is run.
40687 If expansion of the string fails, the error message is written to the debugging
40688 output, and Exim carries on processing.
40689 This facility is provided to help with checking out the values of variables and
40690 so on when debugging driver configurations. For example, if a <option>headers_add</option>
40691 option is not working properly, <option>debug_print</option> could be used to output the
40692 variables it references. A newline is added to the text if it does not end with
40693 one.
40694 The variables <varname>$transport_name</varname> and <varname>$router_name</varname> contain the name of the
40695 transport and the router that called it.
40696 </para>
40697 <para>
40698 <indexterm role="option">
40699 <primary><option>delivery_date_add</option></primary>
40700 </indexterm>
40701 </para>
40702 <informaltable frame="all">
40703 <tgroup cols="4" colsep="0" rowsep="0">
40704 <colspec colwidth="8*" align="left"/>
40705 <colspec colwidth="6*" align="center"/>
40706 <colspec colwidth="6*" align="center"/>
40707 <colspec colwidth="6*" align="right"/>
40708 <tbody>
40709 <row>
40710 <entry><option>delivery_date_add</option></entry>
40711 <entry>Use: <emphasis>transports</emphasis></entry>
40712 <entry>Type: <emphasis>boolean</emphasis></entry>
40713 <entry>Default: <emphasis>false</emphasis></entry>
40714 </row>
40715 </tbody>
40716 </tgroup>
40717 </informaltable>
40718 <para>
40719 <indexterm role="concept">
40720 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
40721 </indexterm>
40722 If this option is true, a <emphasis>Delivery-date:</emphasis> header is added to the message.
40723 This gives the actual time the delivery was made. As this is not a standard
40724 header, Exim has a configuration option (<option>delivery_date_remove</option>) which
40725 requests its removal from incoming messages, so that delivered messages can
40726 safely be resent to other recipients.
40727 </para>
40728 <para>
40729 <indexterm role="option">
40730 <primary><option>driver</option></primary>
40731 </indexterm>
40732 </para>
40733 <informaltable frame="all">
40734 <tgroup cols="4" colsep="0" rowsep="0">
40735 <colspec colwidth="8*" align="left"/>
40736 <colspec colwidth="6*" align="center"/>
40737 <colspec colwidth="6*" align="center"/>
40738 <colspec colwidth="6*" align="right"/>
40739 <tbody>
40740 <row>
40741 <entry><option>driver</option></entry>
40742 <entry>Use: <emphasis>transports</emphasis></entry>
40743 <entry>Type: <emphasis>string</emphasis></entry>
40744 <entry>Default: <emphasis>unset</emphasis></entry>
40745 </row>
40746 </tbody>
40747 </tgroup>
40748 </informaltable>
40749 <para>
40750 This specifies which of the available transport drivers is to be used.
40751 There is no default, and this option must be set for every transport.
40752 </para>
40753 <para>
40754 <indexterm role="option">
40755 <primary><option>envelope_to_add</option></primary>
40756 </indexterm>
40757 </para>
40758 <informaltable frame="all">
40759 <tgroup cols="4" colsep="0" rowsep="0">
40760 <colspec colwidth="8*" align="left"/>
40761 <colspec colwidth="6*" align="center"/>
40762 <colspec colwidth="6*" align="center"/>
40763 <colspec colwidth="6*" align="right"/>
40764 <tbody>
40765 <row>
40766 <entry><option>envelope_to_add</option></entry>
40767 <entry>Use: <emphasis>transports</emphasis></entry>
40768 <entry>Type: <emphasis>boolean</emphasis></entry>
40769 <entry>Default: <emphasis>false</emphasis></entry>
40770 </row>
40771 </tbody>
40772 </tgroup>
40773 </informaltable>
40774 <para>
40775 <indexterm role="concept">
40776 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
40777 </indexterm>
40778 If this option is true, an <emphasis>Envelope-to:</emphasis> header is added to the message.
40779 This gives the original address(es) in the incoming envelope that caused this
40780 delivery to happen. More than one address may be present if the transport is
40781 configured to handle several addresses at once, or if more than one original
40782 address was redirected to the same final address. As this is not a standard
40783 header, Exim has a configuration option (<option>envelope_to_remove</option>) which requests
40784 its removal from incoming messages, so that delivered messages can safely be
40785 resent to other recipients.
40786 </para>
40787 <para>
40788 <indexterm role="option">
40789 <primary><option>event_action</option></primary>
40790 </indexterm>
40791 </para>
40792 <informaltable frame="all">
40793 <tgroup cols="4" colsep="0" rowsep="0">
40794 <colspec colwidth="8*" align="left"/>
40795 <colspec colwidth="6*" align="center"/>
40796 <colspec colwidth="6*" align="center"/>
40797 <colspec colwidth="6*" align="right"/>
40798 <tbody>
40799 <row>
40800 <entry><option>event_action</option></entry>
40801 <entry>Use: <emphasis>transports</emphasis></entry>
40802 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40803 <entry>Default: <emphasis>unset</emphasis></entry>
40804 </row>
40805 </tbody>
40806 </tgroup>
40807 </informaltable>
40808 <para>
40809 <indexterm role="concept">
40810 <primary>events</primary>
40811 </indexterm>
40812 This option declares a string to be expanded for Exim&#x2019;s events mechanism.
40813 For details see chapter <xref linkend="CHAPevents"/>.
40814 </para>
40815 <para>
40816 <indexterm role="option">
40817 <primary><option>group</option></primary>
40818 </indexterm>
40819 </para>
40820 <informaltable frame="all">
40821 <tgroup cols="4" colsep="0" rowsep="0">
40822 <colspec colwidth="8*" align="left"/>
40823 <colspec colwidth="6*" align="center"/>
40824 <colspec colwidth="6*" align="center"/>
40825 <colspec colwidth="6*" align="right"/>
40826 <tbody>
40827 <row>
40828 <entry><option>group</option></entry>
40829 <entry>Use: <emphasis>transports</emphasis></entry>
40830 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40831 <entry>Default: <emphasis>Exim group</emphasis></entry>
40832 </row>
40833 </tbody>
40834 </tgroup>
40835 </informaltable>
40836 <para>
40837 <indexterm role="concept">
40838 <primary>transport</primary>
40839 <secondary>group; specifying</secondary>
40840 </indexterm>
40841 This option specifies a gid for running the transport process, overriding any
40842 value that the router supplies, and also overriding any value associated with
40843 <option>user</option> (see below).
40844 </para>
40845 <para>
40846 <indexterm role="option">
40847 <primary><option>headers_add</option></primary>
40848 </indexterm>
40849 </para>
40850 <informaltable frame="all">
40851 <tgroup cols="4" colsep="0" rowsep="0">
40852 <colspec colwidth="8*" align="left"/>
40853 <colspec colwidth="6*" align="center"/>
40854 <colspec colwidth="6*" align="center"/>
40855 <colspec colwidth="6*" align="right"/>
40856 <tbody>
40857 <row>
40858 <entry><option>headers_add</option></entry>
40859 <entry>Use: <emphasis>transports</emphasis></entry>
40860 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
40861 <entry>Default: <emphasis>unset</emphasis></entry>
40862 </row>
40863 </tbody>
40864 </tgroup>
40865 </informaltable>
40866 <para>
40867 <indexterm role="concept">
40868 <primary>header lines</primary>
40869 <secondary>adding in transport</secondary>
40870 </indexterm>
40871 <indexterm role="concept">
40872 <primary>transport</primary>
40873 <secondary>header lines; adding</secondary>
40874 </indexterm>
40875 This option specifies a list of text headers,
40876 newline-separated (by default, changeable in the usual way <xref linkend="SECTlistsepchange"/>),
40877 which are (separately) expanded and added to the header
40878 portion of a message as it is transported, as described in section
40879 <xref linkend="SECTheadersaddrem"/>. Additional header lines can also be specified by
40880 routers. If the result of the expansion is an empty string, or if the expansion
40881 is forced to fail, no action is taken. Other expansion failures are treated as
40882 errors and cause the delivery to be deferred.
40883 </para>
40884 <para>
40885 Unlike most options, <option>headers_add</option> can be specified multiple times
40886 for a transport; all listed headers are added.
40887 </para>
40888 <para>
40889 <indexterm role="option">
40890 <primary><option>headers_only</option></primary>
40891 </indexterm>
40892 </para>
40893 <informaltable frame="all">
40894 <tgroup cols="4" colsep="0" rowsep="0">
40895 <colspec colwidth="8*" align="left"/>
40896 <colspec colwidth="6*" align="center"/>
40897 <colspec colwidth="6*" align="center"/>
40898 <colspec colwidth="6*" align="right"/>
40899 <tbody>
40900 <row>
40901 <entry><option>headers_only</option></entry>
40902 <entry>Use: <emphasis>transports</emphasis></entry>
40903 <entry>Type: <emphasis>boolean</emphasis></entry>
40904 <entry>Default: <emphasis>false</emphasis></entry>
40905 </row>
40906 </tbody>
40907 </tgroup>
40908 </informaltable>
40909 <para>
40910 <indexterm role="concept">
40911 <primary>transport</primary>
40912 <secondary>header lines only</secondary>
40913 </indexterm>
40914 <indexterm role="concept">
40915 <primary>message</primary>
40916 <secondary>transporting headers only</secondary>
40917 </indexterm>
40918 <indexterm role="concept">
40919 <primary>header lines</primary>
40920 <secondary>transporting</secondary>
40921 </indexterm>
40922 If this option is set, the message&#x2019;s body is not transported. It is mutually
40923 exclusive with <option>body_only</option>. If it is used with the <command>appendfile</command> or <command>pipe</command>
40924 transports, the settings of <option>message_prefix</option> and <option>message_suffix</option> should be
40925 checked, since this option does not automatically suppress them.
40926 </para>
40927 <para>
40928 <indexterm role="option">
40929 <primary><option>headers_remove</option></primary>
40930 </indexterm>
40931 </para>
40932 <informaltable frame="all">
40933 <tgroup cols="4" colsep="0" rowsep="0">
40934 <colspec colwidth="8*" align="left"/>
40935 <colspec colwidth="6*" align="center"/>
40936 <colspec colwidth="6*" align="center"/>
40937 <colspec colwidth="6*" align="right"/>
40938 <tbody>
40939 <row>
40940 <entry><option>headers_remove</option></entry>
40941 <entry>Use: <emphasis>transports</emphasis></entry>
40942 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
40943 <entry>Default: <emphasis>unset</emphasis></entry>
40944 </row>
40945 </tbody>
40946 </tgroup>
40947 </informaltable>
40948 <para>
40949 <indexterm role="concept">
40950 <primary>header lines</primary>
40951 <secondary>removing</secondary>
40952 </indexterm>
40953 <indexterm role="concept">
40954 <primary>transport</primary>
40955 <secondary>header lines; removing</secondary>
40956 </indexterm>
40957 This option specifies a list of header names,
40958 colon-separated (by default, changeable in the usual way <xref linkend="SECTlistsepchange"/>);
40959 these headers are omitted from the message as it is transported, as described
40960 in section <xref linkend="SECTheadersaddrem"/>. Header removal can also be specified by
40961 routers.
40962 Each list item is separately expanded.
40963 If the result of the expansion is an empty string, or if the expansion
40964 is forced to fail, no action is taken. Other expansion failures are treated as
40965 errors and cause the delivery to be deferred.
40966 </para>
40967 <para>
40968 Unlike most options, <option>headers_remove</option> can be specified multiple times
40969 for a transport; all listed headers are removed.
40970 </para>
40971 <para>
40972 <emphasis role="bold">Warning</emphasis>: Because of the separate expansion of the list items,
40973 items that contain a list separator must have it doubled.
40974 To avoid this, change the list separator (<xref linkend="SECTlistsepchange"/>).
40975 </para>
40976 <para>
40977 <indexterm role="option">
40978 <primary><option>headers_rewrite</option></primary>
40979 </indexterm>
40980 </para>
40981 <informaltable frame="all">
40982 <tgroup cols="4" colsep="0" rowsep="0">
40983 <colspec colwidth="8*" align="left"/>
40984 <colspec colwidth="6*" align="center"/>
40985 <colspec colwidth="6*" align="center"/>
40986 <colspec colwidth="6*" align="right"/>
40987 <tbody>
40988 <row>
40989 <entry><option>headers_rewrite</option></entry>
40990 <entry>Use: <emphasis>transports</emphasis></entry>
40991 <entry>Type: <emphasis>string</emphasis></entry>
40992 <entry>Default: <emphasis>unset</emphasis></entry>
40993 </row>
40994 </tbody>
40995 </tgroup>
40996 </informaltable>
40997 <para>
40998 <indexterm role="concept">
40999 <primary>transport</primary>
41000 <secondary>header lines; rewriting</secondary>
41001 </indexterm>
41002 <indexterm role="concept">
41003 <primary>rewriting</primary>
41004 <secondary>at transport time</secondary>
41005 </indexterm>
41006 This option allows addresses in header lines to be rewritten at transport time,
41007 that is, as the message is being copied to its destination. The contents of the
41008 option are a colon-separated list of rewriting rules. Each rule is in exactly
41009 the same form as one of the general rewriting rules that are applied when a
41010 message is received. These are described in chapter <xref linkend="CHAPrewrite"/>. For
41011 example,
41012 </para>
41013 <literallayout class="monospaced">
41014 headers_rewrite = a@b c@d f : \
41015                   x@y w@z
41016 </literallayout>
41017 <para>
41018 changes <emphasis>a@b</emphasis> into <emphasis>c@d</emphasis> in <emphasis>From:</emphasis> header lines, and <emphasis>x@y</emphasis> into
41019 <emphasis>w@z</emphasis> in all address-bearing header lines. The rules are applied to the
41020 header lines just before they are written out at transport time, so they affect
41021 only those copies of the message that pass through the transport. However, only
41022 the message&#x2019;s original header lines, and any that were added by a system
41023 filter, are rewritten. If a router or transport adds header lines, they are not
41024 affected by this option. These rewriting rules are <emphasis>not</emphasis> applied to the
41025 envelope. You can change the return path using <option>return_path</option>, but you cannot
41026 change envelope recipients at this time.
41027 </para>
41028 <para>
41029 <indexterm role="option">
41030 <primary><option>home_directory</option></primary>
41031 </indexterm>
41032 </para>
41033 <informaltable frame="all">
41034 <tgroup cols="4" colsep="0" rowsep="0">
41035 <colspec colwidth="8*" align="left"/>
41036 <colspec colwidth="6*" align="center"/>
41037 <colspec colwidth="6*" align="center"/>
41038 <colspec colwidth="6*" align="right"/>
41039 <tbody>
41040 <row>
41041 <entry><option>home_directory</option></entry>
41042 <entry>Use: <emphasis>transports</emphasis></entry>
41043 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41044 <entry>Default: <emphasis>unset</emphasis></entry>
41045 </row>
41046 </tbody>
41047 </tgroup>
41048 </informaltable>
41049 <para>
41050 <indexterm role="concept">
41051 <primary>transport</primary>
41052 <secondary>home directory for</secondary>
41053 </indexterm>
41054 <indexterm role="variable">
41055 <primary><varname>$home</varname></primary>
41056 </indexterm>
41057 This option specifies a home directory setting for a local transport,
41058 overriding any value that may be set by the router. The home directory is
41059 placed in <varname>$home</varname> while expanding the transport&#x2019;s private options. It is also
41060 used as the current directory if no current directory is set by the
41061 <option>current_directory</option> option on the transport or the
41062 <option>transport_current_directory</option> option on the router. If the expansion fails
41063 for any reason, including forced failure, an error is logged, and delivery is
41064 deferred.
41065 </para>
41066 <para>
41067 <indexterm role="option">
41068 <primary><option>initgroups</option></primary>
41069 </indexterm>
41070 </para>
41071 <informaltable frame="all">
41072 <tgroup cols="4" colsep="0" rowsep="0">
41073 <colspec colwidth="8*" align="left"/>
41074 <colspec colwidth="6*" align="center"/>
41075 <colspec colwidth="6*" align="center"/>
41076 <colspec colwidth="6*" align="right"/>
41077 <tbody>
41078 <row>
41079 <entry><option>initgroups</option></entry>
41080 <entry>Use: <emphasis>transports</emphasis></entry>
41081 <entry>Type: <emphasis>boolean</emphasis></entry>
41082 <entry>Default: <emphasis>false</emphasis></entry>
41083 </row>
41084 </tbody>
41085 </tgroup>
41086 </informaltable>
41087 <para>
41088 <indexterm role="concept">
41089 <primary>additional groups</primary>
41090 </indexterm>
41091 <indexterm role="concept">
41092 <primary>groups</primary>
41093 <secondary>additional</secondary>
41094 </indexterm>
41095 <indexterm role="concept">
41096 <primary>transport</primary>
41097 <secondary>group; additional</secondary>
41098 </indexterm>
41099 If this option is true and the uid for the delivery process is provided by the
41100 transport, the <function>initgroups()</function> function is called when running the transport
41101 to ensure that any additional groups associated with the uid are set up.
41102 </para>
41103 <para>
41104 <indexterm role="option">
41105 <primary><option>max_parallel</option></primary>
41106 </indexterm>
41107 </para>
41108 <informaltable frame="all">
41109 <tgroup cols="4" colsep="0" rowsep="0">
41110 <colspec colwidth="8*" align="left"/>
41111 <colspec colwidth="6*" align="center"/>
41112 <colspec colwidth="6*" align="center"/>
41113 <colspec colwidth="6*" align="right"/>
41114 <tbody>
41115 <row>
41116 <entry><option>max_parallel</option></entry>
41117 <entry>Use: <emphasis>transports</emphasis></entry>
41118 <entry>Type: <emphasis>integer</emphasis>&dagger;<emphasis></emphasis></entry>
41119 <entry>Default: <emphasis>unset</emphasis></entry>
41120 </row>
41121 </tbody>
41122 </tgroup>
41123 </informaltable>
41124 <para>
41125 <indexterm role="concept">
41126 <primary>limit</primary>
41127 <secondary>transport parallelism</secondary>
41128 </indexterm>
41129 <indexterm role="concept">
41130 <primary>transport</primary>
41131 <secondary>parallel processes</secondary>
41132 </indexterm>
41133 <indexterm role="concept">
41134 <primary>transport</primary>
41135 <secondary>concurrency limit</secondary>
41136 </indexterm>
41137 <indexterm role="concept">
41138 <primary>delivery</primary>
41139 <secondary>parallelism for transport</secondary>
41140 </indexterm>
41141 If this option is set and expands to an integer greater than zero
41142 it limits the number of concurrent runs of the transport.
41143 The control does not apply to shadow transports.
41144 </para>
41145 <para>
41146 <indexterm role="concept">
41147 <primary>hints database</primary>
41148 <secondary>transport concurrency control</secondary>
41149 </indexterm>
41150 Exim implements this control by means of a hints database in which a record is
41151 incremented whenever a transport process is being created. The record
41152 is decremented and possibly removed when the process terminates.
41153 Obviously there is scope for
41154 records to get left lying around if there is a system or program crash. To
41155 guard against this, Exim ignores any records that are more than six hours old.
41156 </para>
41157 <para>
41158 If you use this option, you should also arrange to delete the
41159 relevant hints database whenever your system reboots. The names of the files
41160 start with <filename>misc</filename> and they are kept in the <filename>spool/db</filename> directory. There
41161 may be one or two files, depending on the type of DBM in use. The same files
41162 are used for ETRN and smtp transport serialization.
41163 </para>
41164 <para>
41165 <indexterm role="option">
41166 <primary><option>message_size_limit</option></primary>
41167 </indexterm>
41168 </para>
41169 <informaltable frame="all">
41170 <tgroup cols="4" colsep="0" rowsep="0">
41171 <colspec colwidth="8*" align="left"/>
41172 <colspec colwidth="6*" align="center"/>
41173 <colspec colwidth="6*" align="center"/>
41174 <colspec colwidth="6*" align="right"/>
41175 <tbody>
41176 <row>
41177 <entry><option>message_size_limit</option></entry>
41178 <entry>Use: <emphasis>transports</emphasis></entry>
41179 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41180 <entry>Default: <emphasis>0</emphasis></entry>
41181 </row>
41182 </tbody>
41183 </tgroup>
41184 </informaltable>
41185 <para>
41186 <indexterm role="concept">
41187 <primary>limit</primary>
41188 <secondary>message size per transport</secondary>
41189 </indexterm>
41190 <indexterm role="concept">
41191 <primary>size</primary>
41192 <secondary>of message, limit</secondary>
41193 </indexterm>
41194 <indexterm role="concept">
41195 <primary>transport</primary>
41196 <secondary>message size; limiting</secondary>
41197 </indexterm>
41198 This option controls the size of messages passed through the transport. It is
41199 expanded before use; the result of the expansion must be a sequence of decimal
41200 digits, optionally followed by K or M. If the expansion fails for any reason,
41201 including forced failure, or if the result is not of the required form,
41202 delivery is deferred. If the value is greater than zero and the size of a
41203 message exceeds this limit, the address is failed. If there is any chance that
41204 the resulting bounce message could be routed to the same transport, you should
41205 ensure that <option>return_size_limit</option> is less than the transport&#x2019;s
41206 <option>message_size_limit</option>, as otherwise the bounce message will fail to get
41207 delivered.
41208 </para>
41209 <para>
41210 <indexterm role="option">
41211 <primary><option>rcpt_include_affixes</option></primary>
41212 </indexterm>
41213 </para>
41214 <informaltable frame="all">
41215 <tgroup cols="4" colsep="0" rowsep="0">
41216 <colspec colwidth="8*" align="left"/>
41217 <colspec colwidth="6*" align="center"/>
41218 <colspec colwidth="6*" align="center"/>
41219 <colspec colwidth="6*" align="right"/>
41220 <tbody>
41221 <row>
41222 <entry><option>rcpt_include_affixes</option></entry>
41223 <entry>Use: <emphasis>transports</emphasis></entry>
41224 <entry>Type: <emphasis>boolean</emphasis></entry>
41225 <entry>Default: <emphasis>false</emphasis></entry>
41226 </row>
41227 </tbody>
41228 </tgroup>
41229 </informaltable>
41230 <para>
41231 <indexterm role="concept">
41232 <primary>prefix</primary>
41233 <secondary>for local part, including in envelope</secondary>
41234 </indexterm>
41235 <indexterm role="concept">
41236 <primary>suffix for local part</primary>
41237 <secondary>including in envelope</secondary>
41238 </indexterm>
41239 <indexterm role="concept">
41240 <primary>local part</primary>
41241 <secondary>prefix</secondary>
41242 </indexterm>
41243 <indexterm role="concept">
41244 <primary>local part</primary>
41245 <secondary>suffix</secondary>
41246 </indexterm>
41247 When this option is false (the default), and an address that has had any
41248 affixes (prefixes or suffixes) removed from the local part is delivered by any
41249 form of SMTP or LMTP, the affixes are not included. For example, if a router
41250 that contains
41251 </para>
41252 <literallayout class="monospaced">
41253 local_part_prefix = *-
41254 </literallayout>
41255 <para>
41256 routes the address <emphasis>abc-xyz@some.domain</emphasis> to an SMTP transport, the envelope
41257 is delivered with
41258 </para>
41259 <literallayout class="monospaced">
41260 RCPT TO:&lt;xyz@some.domain&gt;
41261 </literallayout>
41262 <para>
41263 This is also the case when an ACL-time callout is being used to verify a
41264 recipient address. However, if <option>rcpt_include_affixes</option> is set true, the
41265 whole local part is included in the RCPT command. This option applies to BSMTP
41266 deliveries by the <command>appendfile</command> and <command>pipe</command> transports as well as to the
41267 <command>lmtp</command> and <command>smtp</command> transports.
41268 </para>
41269 <para>
41270 <indexterm role="option">
41271 <primary><option>retry_use_local_part</option></primary>
41272 </indexterm>
41273 </para>
41274 <informaltable frame="all">
41275 <tgroup cols="4" colsep="0" rowsep="0">
41276 <colspec colwidth="8*" align="left"/>
41277 <colspec colwidth="6*" align="center"/>
41278 <colspec colwidth="6*" align="center"/>
41279 <colspec colwidth="6*" align="right"/>
41280 <tbody>
41281 <row>
41282 <entry><option>retry_use_local_part</option></entry>
41283 <entry>Use: <emphasis>transports</emphasis></entry>
41284 <entry>Type: <emphasis>boolean</emphasis></entry>
41285 <entry>Default: <emphasis>see below</emphasis></entry>
41286 </row>
41287 </tbody>
41288 </tgroup>
41289 </informaltable>
41290 <para>
41291 <indexterm role="concept">
41292 <primary>hints database</primary>
41293 <secondary>retry keys</secondary>
41294 </indexterm>
41295 When a delivery suffers a temporary failure, a retry record is created
41296 in Exim&#x2019;s hints database. For remote deliveries, the key for the retry record
41297 is based on the name and/or IP address of the failing remote host. For local
41298 deliveries, the key is normally the entire address, including both the local
41299 part and the domain. This is suitable for most common cases of local delivery
41300 temporary failure &ndash; for example, exceeding a mailbox quota should delay only
41301 deliveries to that mailbox, not to the whole domain.
41302 </para>
41303 <para>
41304 However, in some special cases you may want to treat a temporary local delivery
41305 as a failure associated with the domain, and not with a particular local part.
41306 (For example, if you are storing all mail for some domain in files.) You can do
41307 this by setting <option>retry_use_local_part</option> false.
41308 </para>
41309 <para>
41310 For all the local transports, its default value is true. For remote transports,
41311 the default value is false for tidiness, but changing the value has no effect
41312 on a remote transport in the current implementation.
41313 </para>
41314 <para>
41315 <indexterm role="option">
41316 <primary><option>return_path</option></primary>
41317 </indexterm>
41318 </para>
41319 <informaltable frame="all">
41320 <tgroup cols="4" colsep="0" rowsep="0">
41321 <colspec colwidth="8*" align="left"/>
41322 <colspec colwidth="6*" align="center"/>
41323 <colspec colwidth="6*" align="center"/>
41324 <colspec colwidth="6*" align="right"/>
41325 <tbody>
41326 <row>
41327 <entry><option>return_path</option></entry>
41328 <entry>Use: <emphasis>transports</emphasis></entry>
41329 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41330 <entry>Default: <emphasis>unset</emphasis></entry>
41331 </row>
41332 </tbody>
41333 </tgroup>
41334 </informaltable>
41335 <para>
41336 <indexterm role="concept">
41337 <primary>envelope sender</primary>
41338 </indexterm>
41339 <indexterm role="concept">
41340 <primary>transport</primary>
41341 <secondary>return path; changing</secondary>
41342 </indexterm>
41343 <indexterm role="concept">
41344 <primary>return path</primary>
41345 <secondary>changing in transport</secondary>
41346 </indexterm>
41347 If this option is set, the string is expanded at transport time and replaces
41348 the existing return path (envelope sender) value in the copy of the message
41349 that is being delivered. An empty return path is permitted. This feature is
41350 designed for remote deliveries, where the value of this option is used in the
41351 SMTP MAIL command. If you set <option>return_path</option> for a local transport, the
41352 only effect is to change the address that is placed in the <emphasis>Return-path:</emphasis>
41353 header line, if one is added to the message (see the next option).
41354 </para>
41355 <para>
41356 <emphasis role="bold">Note:</emphasis> A changed return path is not logged unless you add
41357 <option>return_path_on_delivery</option> to the log selector.
41358 </para>
41359 <para>
41360 <indexterm role="variable">
41361 <primary><varname>$return_path</varname></primary>
41362 </indexterm>
41363 The expansion can refer to the existing value via <varname>$return_path</varname>. This is
41364 either the message&#x2019;s envelope sender, or an address set by the
41365 <option>errors_to</option> option on a router. If the expansion is forced to fail, no
41366 replacement occurs; if it fails for another reason, delivery is deferred. This
41367 option can be used to support VERP (Variable Envelope Return Paths) &ndash; see
41368 section <xref linkend="SECTverp"/>.
41369 </para>
41370 <para>
41371 <emphasis role="bold">Note</emphasis>: If a delivery error is detected locally, including the case when a
41372 remote server rejects a message at SMTP time, the bounce message is not sent to
41373 the value of this option. It is sent to the previously set errors address.
41374 This defaults to the incoming sender address, but can be changed by setting
41375 <option>errors_to</option> in a router.
41376 </para>
41377 <para>
41378 <indexterm role="option">
41379 <primary><option>return_path_add</option></primary>
41380 </indexterm>
41381 </para>
41382 <informaltable frame="all">
41383 <tgroup cols="4" colsep="0" rowsep="0">
41384 <colspec colwidth="8*" align="left"/>
41385 <colspec colwidth="6*" align="center"/>
41386 <colspec colwidth="6*" align="center"/>
41387 <colspec colwidth="6*" align="right"/>
41388 <tbody>
41389 <row>
41390 <entry><option>return_path_add</option></entry>
41391 <entry>Use: <emphasis>transports</emphasis></entry>
41392 <entry>Type: <emphasis>boolean</emphasis></entry>
41393 <entry>Default: <emphasis>false</emphasis></entry>
41394 </row>
41395 </tbody>
41396 </tgroup>
41397 </informaltable>
41398 <para>
41399 <indexterm role="concept">
41400 <primary><emphasis>Return-path:</emphasis> header line</primary>
41401 </indexterm>
41402 If this option is true, a <emphasis>Return-path:</emphasis> header is added to the message.
41403 Although the return path is normally available in the prefix line of BSD
41404 mailboxes, this is commonly not displayed by MUAs, and so the user does not
41405 have easy access to it.
41406 </para>
41407 <para>
41408 RFC 2821 states that the <emphasis>Return-path:</emphasis> header is added to a message <quote>when
41409 the delivery SMTP server makes the final delivery</quote>. This implies that this
41410 header should not be present in incoming messages. Exim has a configuration
41411 option, <option>return_path_remove</option>, which requests removal of this header from
41412 incoming messages, so that delivered messages can safely be resent to other
41413 recipients.
41414 </para>
41415 <para>
41416 <indexterm role="option">
41417 <primary><option>shadow_condition</option></primary>
41418 </indexterm>
41419 </para>
41420 <informaltable frame="all">
41421 <tgroup cols="4" colsep="0" rowsep="0">
41422 <colspec colwidth="8*" align="left"/>
41423 <colspec colwidth="6*" align="center"/>
41424 <colspec colwidth="6*" align="center"/>
41425 <colspec colwidth="6*" align="right"/>
41426 <tbody>
41427 <row>
41428 <entry><option>shadow_condition</option></entry>
41429 <entry>Use: <emphasis>transports</emphasis></entry>
41430 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41431 <entry>Default: <emphasis>unset</emphasis></entry>
41432 </row>
41433 </tbody>
41434 </tgroup>
41435 </informaltable>
41436 <para>
41437 See <option>shadow_transport</option> below.
41438 </para>
41439 <para>
41440 <indexterm role="option">
41441 <primary><option>shadow_transport</option></primary>
41442 </indexterm>
41443 </para>
41444 <informaltable frame="all">
41445 <tgroup cols="4" colsep="0" rowsep="0">
41446 <colspec colwidth="8*" align="left"/>
41447 <colspec colwidth="6*" align="center"/>
41448 <colspec colwidth="6*" align="center"/>
41449 <colspec colwidth="6*" align="right"/>
41450 <tbody>
41451 <row>
41452 <entry><option>shadow_transport</option></entry>
41453 <entry>Use: <emphasis>transports</emphasis></entry>
41454 <entry>Type: <emphasis>string</emphasis></entry>
41455 <entry>Default: <emphasis>unset</emphasis></entry>
41456 </row>
41457 </tbody>
41458 </tgroup>
41459 </informaltable>
41460 <para>
41461 <indexterm role="concept">
41462 <primary>shadow transport</primary>
41463 </indexterm>
41464 <indexterm role="concept">
41465 <primary>transport</primary>
41466 <secondary>shadow</secondary>
41467 </indexterm>
41468 A local transport may set the <option>shadow_transport</option> option to the name of
41469 another local transport. Shadow remote transports are not supported.
41470 </para>
41471 <para>
41472 Whenever a delivery to the main transport succeeds, and either
41473 <option>shadow_condition</option> is unset, or its expansion does not result in the empty
41474 string or one of the strings <quote>0</quote> or <quote>no</quote> or <quote>false</quote>, the message is also
41475 passed to the shadow transport, with the same delivery address or addresses. If
41476 expansion fails, no action is taken except that non-forced expansion failures
41477 cause a log line to be written.
41478 </para>
41479 <para>
41480 The result of the shadow transport is discarded and does not affect the
41481 subsequent processing of the message. Only a single level of shadowing is
41482 provided; the <option>shadow_transport</option> option is ignored on any transport when it
41483 is running as a shadow. Options concerned with output from pipes are also
41484 ignored. The log line for the successful delivery has an item added on the end,
41485 of the form
41486 </para>
41487 <literallayout class="monospaced">
41488 ST=&lt;shadow transport name&gt;
41489 </literallayout>
41490 <para>
41491 If the shadow transport did not succeed, the error message is put in
41492 parentheses afterwards. Shadow transports can be used for a number of different
41493 purposes, including keeping more detailed log information than Exim normally
41494 provides, and implementing automatic acknowledgment policies based on message
41495 headers that some sites insist on.
41496 </para>
41497 <para>
41498 <indexterm role="option">
41499 <primary><option>transport_filter</option></primary>
41500 </indexterm>
41501 </para>
41502 <informaltable frame="all">
41503 <tgroup cols="4" colsep="0" rowsep="0">
41504 <colspec colwidth="8*" align="left"/>
41505 <colspec colwidth="6*" align="center"/>
41506 <colspec colwidth="6*" align="center"/>
41507 <colspec colwidth="6*" align="right"/>
41508 <tbody>
41509 <row>
41510 <entry><option>transport_filter</option></entry>
41511 <entry>Use: <emphasis>transports</emphasis></entry>
41512 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41513 <entry>Default: <emphasis>unset</emphasis></entry>
41514 </row>
41515 </tbody>
41516 </tgroup>
41517 </informaltable>
41518 <para>
41519 <indexterm role="concept">
41520 <primary>transport</primary>
41521 <secondary>filter</secondary>
41522 </indexterm>
41523 <indexterm role="concept">
41524 <primary>filter</primary>
41525 <secondary>transport filter</secondary>
41526 </indexterm>
41527 This option sets up a filtering (in the Unix shell sense) process for messages
41528 at transport time. It should not be confused with mail filtering as set up by
41529 individual users or via a system filter.
41530 If unset, or expanding to an empty string, no filtering is done.
41531 </para>
41532 <para>
41533 When the message is about to be written out, the command specified by
41534 <option>transport_filter</option> is started up in a separate, parallel process, and
41535 the entire message, including the header lines, is passed to it on its standard
41536 input (this in fact is done from a third process, to avoid deadlock). The
41537 command must be specified as an absolute path.
41538 </para>
41539 <para>
41540 The lines of the message that are written to the transport filter are
41541 terminated by newline (<quote>\n</quote>). The message is passed to the filter before any
41542 SMTP-specific processing, such as turning <quote>\n</quote> into <quote>\r\n</quote> and escaping
41543 lines beginning with a dot, and also before any processing implied by the
41544 settings of <option>check_string</option> and <option>escape_string</option> in the <command>appendfile</command> or
41545 <command>pipe</command> transports.
41546 </para>
41547 <para>
41548 The standard error for the filter process is set to the same destination as its
41549 standard output; this is read and written to the message&#x2019;s ultimate
41550 destination. The process that writes the message to the filter, the
41551 filter itself, and the original process that reads the result and delivers it
41552 are all run in parallel, like a shell pipeline.
41553 </para>
41554 <para>
41555 The filter can perform any transformations it likes, but of course should take
41556 care not to break RFC 2822 syntax. Exim does not check the result, except to
41557 test for a final newline when SMTP is in use. All messages transmitted over
41558 SMTP must end with a newline, so Exim supplies one if it is missing.
41559 </para>
41560 <para>
41561 <indexterm role="concept">
41562 <primary>content scanning</primary>
41563 <secondary>per user</secondary>
41564 </indexterm>
41565 A transport filter can be used to provide content-scanning on a per-user basis
41566 at delivery time if the only required effect of the scan is to modify the
41567 message. For example, a content scan could insert a new header line containing
41568 a spam score. This could be interpreted by a filter in the user&#x2019;s MUA. It is
41569 not possible to discard a message at this stage.
41570 </para>
41571 <para>
41572 <indexterm role="concept">
41573 <primary>SMTP</primary>
41574 <secondary>SIZE</secondary>
41575 </indexterm>
41576 A problem might arise if the filter increases the size of a message that is
41577 being sent down an SMTP connection. If the receiving SMTP server has indicated
41578 support for the SIZE parameter, Exim will have sent the size of the message
41579 at the start of the SMTP session. If what is actually sent is substantially
41580 more, the server might reject the message. This can be worked round by setting
41581 the <option>size_addition</option> option on the <command>smtp</command> transport, either to allow for
41582 additions to the message, or to disable the use of SIZE altogether.
41583 </para>
41584 <para>
41585 <indexterm role="variable">
41586 <primary><varname>$pipe_addresses</varname></primary>
41587 </indexterm>
41588 The value of the <option>transport_filter</option> option is the command string for starting
41589 the filter, which is run directly from Exim, not under a shell. The string is
41590 parsed by Exim in the same way as a command string for the <command>pipe</command> transport:
41591 Exim breaks it up into arguments and then expands each argument separately (see
41592 section <xref linkend="SECThowcommandrun"/>). Any kind of expansion failure causes delivery
41593 to be deferred. The special argument <varname>$pipe_addresses</varname> is replaced by a number
41594 of arguments, one for each address that applies to this delivery. (This isn&#x2019;t
41595 an ideal name for this feature here, but as it was already implemented for the
41596 <command>pipe</command> transport, it seemed sensible not to change it.)
41597 </para>
41598 <para>
41599 <indexterm role="variable">
41600 <primary><varname>$host</varname></primary>
41601 </indexterm>
41602 <indexterm role="variable">
41603 <primary><varname>$host_address</varname></primary>
41604 </indexterm>
41605 The expansion variables <varname>$host</varname> and <varname>$host_address</varname> are available when the
41606 transport is a remote one. They contain the name and IP address of the host to
41607 which the message is being sent. For example:
41608 </para>
41609 <literallayout class="monospaced">
41610 transport_filter = /some/directory/transport-filter.pl \
41611   $host $host_address $sender_address $pipe_addresses
41612 </literallayout>
41613 <para>
41614 Two problems arise if you want to use more complicated expansion items to
41615 generate transport filter commands, both of which due to the fact that the
41616 command is split up <emphasis>before</emphasis> expansion.
41617 </para>
41618 <itemizedlist>
41619 <listitem>
41620 <para>
41621 If an expansion item contains white space, you must quote it, so that it is all
41622 part of the same command item. If the entire option setting is one such
41623 expansion item, you have to take care what kind of quoting you use. For
41624 example:
41625 </para>
41626 <literallayout class="monospaced">
41627 transport_filter = '/bin/cmd${if eq{$host}{a.b.c}{1}{2}}'
41628 </literallayout>
41629 <para>
41630 This runs the command <command>/bin/cmd1</command> if the host name is <emphasis>a.b.c</emphasis>, and
41631 <command>/bin/cmd2</command> otherwise. If double quotes had been used, they would have been
41632 stripped by Exim when it read the option&#x2019;s value. When the value is used, if
41633 the single quotes were missing, the line would be split into two items,
41634 <literal>/bin/cmd${if</literal> and <literal>eq{$host}{a.b.c}{1}{2}</literal>, and an error would occur when
41635 Exim tried to expand the first one.
41636 </para>
41637 </listitem>
41638 <listitem>
41639 <para>
41640 Except for the special case of <varname>$pipe_addresses</varname> that is mentioned above, an
41641 expansion cannot generate multiple arguments, or a command name followed by
41642 arguments. Consider this example:
41643 </para>
41644 <literallayout class="monospaced">
41645 transport_filter = ${lookup{$host}lsearch{/a/file}\
41646                     {$value}{/bin/cat}}
41647 </literallayout>
41648 <para>
41649 The result of the lookup is interpreted as the name of the command, even
41650 if it contains white space. The simplest way round this is to use a shell:
41651 </para>
41652 <literallayout class="monospaced">
41653 transport_filter = /bin/sh -c ${lookup{$host}lsearch{/a/file}\
41654                                {$value}{/bin/cat}}
41655 </literallayout>
41656 </listitem>
41657 </itemizedlist>
41658 <para>
41659 The filter process is run under the same uid and gid as the normal delivery.
41660 For remote deliveries this is the Exim uid/gid by default. The command should
41661 normally yield a zero return code. Transport filters are not supposed to fail.
41662 A non-zero code is taken to mean that the transport filter encountered some
41663 serious problem. Delivery of the message is deferred; the message remains on
41664 the queue and is tried again later. It is not possible to cause a message to be
41665 bounced from a transport filter.
41666 </para>
41667 <para>
41668 If a transport filter is set on an autoreply transport, the original message is
41669 passed through the filter as it is being copied into the newly generated
41670 message, which happens if the <option>return_message</option> option is set.
41671 </para>
41672 <para>
41673 <indexterm role="option">
41674 <primary><option>transport_filter_timeout</option></primary>
41675 </indexterm>
41676 </para>
41677 <informaltable frame="all">
41678 <tgroup cols="4" colsep="0" rowsep="0">
41679 <colspec colwidth="8*" align="left"/>
41680 <colspec colwidth="6*" align="center"/>
41681 <colspec colwidth="6*" align="center"/>
41682 <colspec colwidth="6*" align="right"/>
41683 <tbody>
41684 <row>
41685 <entry><option>transport_filter_timeout</option></entry>
41686 <entry>Use: <emphasis>transports</emphasis></entry>
41687 <entry>Type: <emphasis>time</emphasis></entry>
41688 <entry>Default: <emphasis>5m</emphasis></entry>
41689 </row>
41690 </tbody>
41691 </tgroup>
41692 </informaltable>
41693 <para>
41694 <indexterm role="concept">
41695 <primary>transport</primary>
41696 <secondary>filter, timeout</secondary>
41697 </indexterm>
41698 When Exim is reading the output of a transport filter, it applies a timeout
41699 that can be set by this option. Exceeding the timeout is normally treated as a
41700 temporary delivery failure. However, if a transport filter is used with a
41701 <command>pipe</command> transport, a timeout in the transport filter is treated in the same
41702 way as a timeout in the pipe command itself. By default, a timeout is a hard
41703 error, but if the <command>pipe</command> transport&#x2019;s <option>timeout_defer</option> option is set true, it
41704 becomes a temporary error.
41705 </para>
41706 <para>
41707 <indexterm role="option">
41708 <primary><option>user</option></primary>
41709 </indexterm>
41710 </para>
41711 <informaltable frame="all">
41712 <tgroup cols="4" colsep="0" rowsep="0">
41713 <colspec colwidth="8*" align="left"/>
41714 <colspec colwidth="6*" align="center"/>
41715 <colspec colwidth="6*" align="center"/>
41716 <colspec colwidth="6*" align="right"/>
41717 <tbody>
41718 <row>
41719 <entry><option>user</option></entry>
41720 <entry>Use: <emphasis>transports</emphasis></entry>
41721 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41722 <entry>Default: <emphasis>Exim user</emphasis></entry>
41723 </row>
41724 </tbody>
41725 </tgroup>
41726 </informaltable>
41727 <para>
41728 <indexterm role="concept">
41729 <primary>uid (user id)</primary>
41730 <secondary>local delivery</secondary>
41731 </indexterm>
41732 <indexterm role="concept">
41733 <primary>transport</primary>
41734 <secondary>user, specifying</secondary>
41735 </indexterm>
41736 This option specifies the user under whose uid the delivery process is to be
41737 run, overriding any uid that may have been set by the router. If the user is
41738 given as a name, the uid is looked up from the password data, and the
41739 associated group is taken as the value of the gid to be used if the <option>group</option>
41740 option is not set.
41741 </para>
41742 <para>
41743 For deliveries that use local transports, a user and group are normally
41744 specified explicitly or implicitly (for example, as a result of
41745 <option>check_local_user</option>) by the router or transport.
41746 </para>
41747 <para>
41748 <indexterm role="concept">
41749 <primary>hints database</primary>
41750 <secondary>access by remote transport</secondary>
41751 </indexterm>
41752 For remote transports, you should leave this option unset unless you really are
41753 sure you know what you are doing. When a remote transport is running, it needs
41754 to be able to access Exim&#x2019;s hints databases, because each host may have its own
41755 retry data.
41756 <indexterm role="concept" startref="IIDgenoptra1" class="endofrange"/>
41757 <indexterm role="concept" startref="IIDgenoptra2" class="endofrange"/>
41758 <indexterm role="concept" startref="IIDgenoptra3" class="endofrange"/>
41759 </para>
41760 </chapter>
41761
41762 <chapter id="CHAPbatching">
41763 <title>Address batching in local transports</title>
41764 <titleabbrev>Address batching</titleabbrev>
41765 <para>
41766 <indexterm role="concept">
41767 <primary>transport</primary>
41768 <secondary>local; address batching in</secondary>
41769 </indexterm>
41770 The only remote transport (<command>smtp</command>) is normally configured to handle more than
41771 one address at a time, so that when several addresses are routed to the same
41772 remote host, just one copy of the message is sent. Local transports, however,
41773 normally handle one address at a time. That is, a separate instance of the
41774 transport is run for each address that is routed to the transport. A separate
41775 copy of the message is delivered each time.
41776 </para>
41777 <para>
41778 <indexterm role="concept">
41779 <primary>batched local delivery</primary>
41780 </indexterm>
41781 <indexterm role="option">
41782 <primary><option>batch_max</option></primary>
41783 </indexterm>
41784 <indexterm role="option">
41785 <primary><option>batch_id</option></primary>
41786 </indexterm>
41787 In special cases, it may be desirable to handle several addresses at once in a
41788 local transport, for example:
41789 </para>
41790 <itemizedlist>
41791 <listitem>
41792 <para>
41793 In an <command>appendfile</command> transport, when storing messages in files for later
41794 delivery by some other means, a single copy of the message with multiple
41795 recipients saves space.
41796 </para>
41797 </listitem>
41798 <listitem>
41799 <para>
41800 In an <command>lmtp</command> transport, when delivering over <quote>local SMTP</quote> to some process,
41801 a single copy saves time, and is the normal way LMTP is expected to work.
41802 </para>
41803 </listitem>
41804 <listitem>
41805 <para>
41806 In a <command>pipe</command> transport, when passing the message
41807 to a scanner program or
41808 to some other delivery mechanism such as UUCP, multiple recipients may be
41809 acceptable.
41810 </para>
41811 </listitem>
41812 </itemizedlist>
41813 <para>
41814 These three local transports all have the same options for controlling multiple
41815 (<quote>batched</quote>) deliveries, namely <option>batch_max</option> and <option>batch_id</option>. To save
41816 repeating the information for each transport, these options are described here.
41817 </para>
41818 <para>
41819 The <option>batch_max</option> option specifies the maximum number of addresses that can be
41820 delivered together in a single run of the transport. Its default value is one
41821 (no batching). When more than one address is routed to a transport that has a
41822 <option>batch_max</option> value greater than one, the addresses are delivered in a batch
41823 (that is, in a single run of the transport with multiple recipients), subject
41824 to certain conditions:
41825 </para>
41826 <itemizedlist>
41827 <listitem>
41828 <para>
41829 <indexterm role="variable">
41830 <primary><varname>$local_part</varname></primary>
41831 </indexterm>
41832 If any of the transport&#x2019;s options contain a reference to <varname>$local_part</varname>, no
41833 batching is possible.
41834 </para>
41835 </listitem>
41836 <listitem>
41837 <para>
41838 <indexterm role="variable">
41839 <primary><varname>$domain</varname></primary>
41840 </indexterm>
41841 If any of the transport&#x2019;s options contain a reference to <varname>$domain</varname>, only
41842 addresses with the same domain are batched.
41843 </para>
41844 </listitem>
41845 <listitem>
41846 <para>
41847 <indexterm role="concept">
41848 <primary>customizing</primary>
41849 <secondary>batching condition</secondary>
41850 </indexterm>
41851 If <option>batch_id</option> is set, it is expanded for each address, and only those
41852 addresses with the same expanded value are batched. This allows you to specify
41853 customized batching conditions. Failure of the expansion for any reason,
41854 including forced failure, disables batching, but it does not stop the delivery
41855 from taking place.
41856 </para>
41857 </listitem>
41858 <listitem>
41859 <para>
41860 Batched addresses must also have the same errors address (where to send
41861 delivery errors), the same header additions and removals, the same user and
41862 group for the transport, and if a host list is present, the first host must
41863 be the same.
41864 </para>
41865 </listitem>
41866 </itemizedlist>
41867 <para>
41868 In the case of the <command>appendfile</command> and <command>pipe</command> transports, batching applies
41869 both when the file or pipe command is specified in the transport, and when it
41870 is specified by a <command>redirect</command> router, but all the batched addresses must of
41871 course be routed to the same file or pipe command. These two transports have an
41872 option called <option>use_bsmtp</option>, which causes them to deliver the message in
41873 <quote>batched SMTP</quote> format, with the envelope represented as SMTP commands. The
41874 <option>check_string</option> and <option>escape_string</option> options are forced to the values
41875 </para>
41876 <literallayout class="monospaced">
41877 check_string = "."
41878 escape_string = ".."
41879 </literallayout>
41880 <para>
41881 when batched SMTP is in use. A full description of the batch SMTP mechanism is
41882 given in section <xref linkend="SECTbatchSMTP"/>. The <command>lmtp</command> transport does not have a
41883 <option>use_bsmtp</option> option, because it always delivers using the SMTP protocol.
41884 </para>
41885 <para>
41886 <indexterm role="concept">
41887 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
41888 </indexterm>
41889 If the generic <option>envelope_to_add</option> option is set for a batching transport, the
41890 <emphasis>Envelope-to:</emphasis> header that is added to the message contains all the addresses
41891 that are being processed together. If you are using a batching <command>appendfile</command>
41892 transport without <option>use_bsmtp</option>, the only way to preserve the recipient
41893 addresses is to set the <option>envelope_to_add</option> option.
41894 </para>
41895 <para>
41896 <indexterm role="concept">
41897 <primary><command>pipe</command> transport</primary>
41898 <secondary>with multiple addresses</secondary>
41899 </indexterm>
41900 <indexterm role="variable">
41901 <primary><varname>$pipe_addresses</varname></primary>
41902 </indexterm>
41903 If you are using a <command>pipe</command> transport without BSMTP, and setting the
41904 transport&#x2019;s <option>command</option> option, you can include <varname>$pipe_addresses</varname> as part of
41905 the command. This is not a true variable; it is a bit of magic that causes each
41906 of the recipient addresses to be inserted into the command as a separate
41907 argument. This provides a way of accessing all the addresses that are being
41908 delivered in the batch. <emphasis role="bold">Note:</emphasis> This is not possible for pipe commands that
41909 are specified by a <command>redirect</command> router.
41910 </para>
41911 </chapter>
41912
41913 <chapter id="CHAPappendfile">
41914 <title>The appendfile transport</title>
41915 <para>
41916 <indexterm role="concept" id="IIDapptra1" class="startofrange">
41917 <primary><command>appendfile</command> transport</primary>
41918 </indexterm>
41919 <indexterm role="concept" id="IIDapptra2" class="startofrange">
41920 <primary>transports</primary>
41921 <secondary><command>appendfile</command></secondary>
41922 </indexterm>
41923 <indexterm role="concept">
41924 <primary>directory creation</primary>
41925 </indexterm>
41926 <indexterm role="concept">
41927 <primary>creating directories</primary>
41928 </indexterm>
41929 The <command>appendfile</command> transport delivers a message by appending it to an existing
41930 file, or by creating an entirely new file in a specified directory. Single
41931 files to which messages are appended can be in the traditional Unix mailbox
41932 format, or optionally in the MBX format supported by the Pine MUA and
41933 University of Washington IMAP daemon, <emphasis>inter alia</emphasis>. When each message is
41934 being delivered as a separate file, <quote>maildir</quote> format can optionally be used
41935 to give added protection against failures that happen part-way through the
41936 delivery. A third form of separate-file delivery known as <quote>mailstore</quote> is also
41937 supported. For all file formats, Exim attempts to create as many levels of
41938 directory as necessary, provided that <option>create_directory</option> is set.
41939 </para>
41940 <para>
41941 The code for the optional formats is not included in the Exim binary by
41942 default. It is necessary to set SUPPORT_MBX, SUPPORT_MAILDIR and/or
41943 SUPPORT_MAILSTORE in <filename>Local/Makefile</filename> to have the appropriate code
41944 included.
41945 </para>
41946 <para>
41947 <indexterm role="concept">
41948 <primary>quota</primary>
41949 <secondary>system</secondary>
41950 </indexterm>
41951 Exim recognizes system quota errors, and generates an appropriate message. Exim
41952 also supports its own quota control within the transport, for use when the
41953 system facility is unavailable or cannot be used for some reason.
41954 </para>
41955 <para>
41956 If there is an error while appending to a file (for example, quota exceeded or
41957 partition filled), Exim attempts to reset the file&#x2019;s length and last
41958 modification time back to what they were before. If there is an error while
41959 creating an entirely new file, the new file is removed.
41960 </para>
41961 <para>
41962 Before appending to a file, a number of security checks are made, and the
41963 file is locked. A detailed description is given below, after the list of
41964 private options.
41965 </para>
41966 <para>
41967 The <command>appendfile</command> transport is most commonly used for local deliveries to
41968 users&#x2019; mailboxes. However, it can also be used as a pseudo-remote transport for
41969 putting messages into files for remote delivery by some means other than Exim.
41970 <quote>Batch SMTP</quote> format is often used in this case (see the <option>use_bsmtp</option>
41971 option).
41972 </para>
41973 <section id="SECTfildiropt">
41974 <title>The file and directory options</title>
41975 <para>
41976 The <option>file</option> option specifies a single file, to which the message is appended;
41977 the <option>directory</option> option specifies a directory, in which a new file containing
41978 the message is created. Only one of these two options can be set, and for
41979 normal deliveries to mailboxes, one of them <emphasis>must</emphasis> be set.
41980 </para>
41981 <para>
41982 <indexterm role="variable">
41983 <primary><varname>$address_file</varname></primary>
41984 </indexterm>
41985 <indexterm role="variable">
41986 <primary><varname>$local_part</varname></primary>
41987 </indexterm>
41988 However, <command>appendfile</command> is also used for delivering messages to files or
41989 directories whose names (or parts of names) are obtained from alias,
41990 forwarding, or filtering operations (for example, a <option>save</option> command in a
41991 user&#x2019;s Exim filter). When such a transport is running, <varname>$local_part</varname> contains
41992 the local part that was aliased or forwarded, and <varname>$address_file</varname> contains the
41993 name (or partial name) of the file or directory generated by the redirection
41994 operation. There are two cases:
41995 </para>
41996 <itemizedlist>
41997 <listitem>
41998 <para>
41999 If neither <option>file</option> nor <option>directory</option> is set, the redirection operation
42000 must specify an absolute path (one that begins with <literal>/</literal>). This is the most
42001 common case when users with local accounts use filtering to sort mail into
42002 different folders. See for example, the <command>address_file</command> transport in the
42003 default configuration. If the path ends with a slash, it is assumed to be the
42004 name of a directory. A delivery to a directory can also be forced by setting
42005 <option>maildir_format</option> or <option>mailstore_format</option>.
42006 </para>
42007 </listitem>
42008 <listitem>
42009 <para>
42010 If <option>file</option> or <option>directory</option> is set for a delivery from a redirection, it is
42011 used to determine the file or directory name for the delivery. Normally, the
42012 contents of <varname>$address_file</varname> are used in some way in the string expansion.
42013 </para>
42014 </listitem>
42015 </itemizedlist>
42016 <para>
42017 <indexterm role="concept">
42018 <primary>Sieve filter</primary>
42019 <secondary>configuring <command>appendfile</command></secondary>
42020 </indexterm>
42021 <indexterm role="concept">
42022 <primary>Sieve filter</primary>
42023 <secondary>relative mailbox path handling</secondary>
42024 </indexterm>
42025 As an example of the second case, consider an environment where users do not
42026 have home directories. They may be permitted to use Exim filter commands of the
42027 form:
42028 </para>
42029 <literallayout class="monospaced">
42030 save folder23
42031 </literallayout>
42032 <para>
42033 or Sieve filter commands of the form:
42034 </para>
42035 <literallayout class="monospaced">
42036 require "fileinto";
42037 fileinto "folder23";
42038 </literallayout>
42039 <para>
42040 In this situation, the expansion of <option>file</option> or <option>directory</option> in the transport
42041 must transform the relative path into an appropriate absolute filename. In the
42042 case of Sieve filters, the name <emphasis>inbox</emphasis> must be handled. It is the name that
42043 is used as a result of a <quote>keep</quote> action in the filter. This example shows one
42044 way of handling this requirement:
42045 </para>
42046 <literallayout class="monospaced">
42047 file = ${if eq{$address_file}{inbox} \
42048             {/var/mail/$local_part} \
42049             {${if eq{${substr_0_1:$address_file}}{/} \
42050                   {$address_file} \
42051                   {$home/mail/$address_file} \
42052             }} \
42053        }
42054 </literallayout>
42055 <para>
42056 With this setting of <option>file</option>, <emphasis>inbox</emphasis> refers to the standard mailbox
42057 location, absolute paths are used without change, and other folders are in the
42058 <filename>mail</filename> directory within the home directory.
42059 </para>
42060 <para>
42061 <emphasis role="bold">Note 1</emphasis>: While processing an Exim filter, a relative path such as
42062 <filename>folder23</filename> is turned into an absolute path if a home directory is known to
42063 the router. In particular, this is the case if <option>check_local_user</option> is set. If
42064 you want to prevent this happening at routing time, you can set
42065 <option>router_home_directory</option> empty. This forces the router to pass the relative
42066 path to the transport.
42067 </para>
42068 <para>
42069 <emphasis role="bold">Note 2</emphasis>: An absolute path in <varname>$address_file</varname> is not treated specially;
42070 the <option>file</option> or <option>directory</option> option is still used if it is set.
42071 </para>
42072 </section>
42073 <section id="SECID134">
42074 <title>Private options for appendfile</title>
42075 <para>
42076 <indexterm role="concept">
42077 <primary>options</primary>
42078 <secondary><command>appendfile</command> transport</secondary>
42079 </indexterm>
42080 </para>
42081 <para>
42082 <indexterm role="option">
42083 <primary><option>allow_fifo</option></primary>
42084 </indexterm>
42085 </para>
42086 <informaltable frame="all">
42087 <tgroup cols="4" colsep="0" rowsep="0">
42088 <colspec colwidth="8*" align="left"/>
42089 <colspec colwidth="6*" align="center"/>
42090 <colspec colwidth="6*" align="center"/>
42091 <colspec colwidth="6*" align="right"/>
42092 <tbody>
42093 <row>
42094 <entry><option>allow_fifo</option></entry>
42095 <entry>Use: <emphasis>appendfile</emphasis></entry>
42096 <entry>Type: <emphasis>boolean</emphasis></entry>
42097 <entry>Default: <emphasis>false</emphasis></entry>
42098 </row>
42099 </tbody>
42100 </tgroup>
42101 </informaltable>
42102 <para>
42103 <indexterm role="concept">
42104 <primary>fifo (named pipe)</primary>
42105 </indexterm>
42106 <indexterm role="concept">
42107 <primary>named pipe (fifo)</primary>
42108 </indexterm>
42109 <indexterm role="concept">
42110 <primary>pipe</primary>
42111 <secondary>named (fifo)</secondary>
42112 </indexterm>
42113 Setting this option permits delivery to named pipes (FIFOs) as well as to
42114 regular files. If no process is reading the named pipe at delivery time, the
42115 delivery is deferred.
42116 </para>
42117 <para>
42118 <indexterm role="option">
42119 <primary><option>allow_symlink</option></primary>
42120 </indexterm>
42121 </para>
42122 <informaltable frame="all">
42123 <tgroup cols="4" colsep="0" rowsep="0">
42124 <colspec colwidth="8*" align="left"/>
42125 <colspec colwidth="6*" align="center"/>
42126 <colspec colwidth="6*" align="center"/>
42127 <colspec colwidth="6*" align="right"/>
42128 <tbody>
42129 <row>
42130 <entry><option>allow_symlink</option></entry>
42131 <entry>Use: <emphasis>appendfile</emphasis></entry>
42132 <entry>Type: <emphasis>boolean</emphasis></entry>
42133 <entry>Default: <emphasis>false</emphasis></entry>
42134 </row>
42135 </tbody>
42136 </tgroup>
42137 </informaltable>
42138 <para>
42139 <indexterm role="concept">
42140 <primary>symbolic link</primary>
42141 <secondary>to mailbox</secondary>
42142 </indexterm>
42143 <indexterm role="concept">
42144 <primary>mailbox</primary>
42145 <secondary>symbolic link</secondary>
42146 </indexterm>
42147 By default, <command>appendfile</command> will not deliver if the path name for the file is
42148 that of a symbolic link. Setting this option relaxes that constraint, but there
42149 are security issues involved in the use of symbolic links. Be sure you know
42150 what you are doing if you set this. Details of exactly what this option affects
42151 are included in the discussion which follows this list of options.
42152 </para>
42153 <para>
42154 <indexterm role="option">
42155 <primary><option>batch_id</option></primary>
42156 </indexterm>
42157 </para>
42158 <informaltable frame="all">
42159 <tgroup cols="4" colsep="0" rowsep="0">
42160 <colspec colwidth="8*" align="left"/>
42161 <colspec colwidth="6*" align="center"/>
42162 <colspec colwidth="6*" align="center"/>
42163 <colspec colwidth="6*" align="right"/>
42164 <tbody>
42165 <row>
42166 <entry><option>batch_id</option></entry>
42167 <entry>Use: <emphasis>appendfile</emphasis></entry>
42168 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42169 <entry>Default: <emphasis>unset</emphasis></entry>
42170 </row>
42171 </tbody>
42172 </tgroup>
42173 </informaltable>
42174 <para>
42175 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
42176 However, batching is automatically disabled for <command>appendfile</command> deliveries that
42177 happen as a result of forwarding or aliasing or other redirection directly to a
42178 file.
42179 </para>
42180 <para>
42181 <indexterm role="option">
42182 <primary><option>batch_max</option></primary>
42183 </indexterm>
42184 </para>
42185 <informaltable frame="all">
42186 <tgroup cols="4" colsep="0" rowsep="0">
42187 <colspec colwidth="8*" align="left"/>
42188 <colspec colwidth="6*" align="center"/>
42189 <colspec colwidth="6*" align="center"/>
42190 <colspec colwidth="6*" align="right"/>
42191 <tbody>
42192 <row>
42193 <entry><option>batch_max</option></entry>
42194 <entry>Use: <emphasis>appendfile</emphasis></entry>
42195 <entry>Type: <emphasis>integer</emphasis></entry>
42196 <entry>Default: <emphasis>1</emphasis></entry>
42197 </row>
42198 </tbody>
42199 </tgroup>
42200 </informaltable>
42201 <para>
42202 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
42203 </para>
42204 <para>
42205 <indexterm role="option">
42206 <primary><option>check_group</option></primary>
42207 </indexterm>
42208 </para>
42209 <informaltable frame="all">
42210 <tgroup cols="4" colsep="0" rowsep="0">
42211 <colspec colwidth="8*" align="left"/>
42212 <colspec colwidth="6*" align="center"/>
42213 <colspec colwidth="6*" align="center"/>
42214 <colspec colwidth="6*" align="right"/>
42215 <tbody>
42216 <row>
42217 <entry><option>check_group</option></entry>
42218 <entry>Use: <emphasis>appendfile</emphasis></entry>
42219 <entry>Type: <emphasis>boolean</emphasis></entry>
42220 <entry>Default: <emphasis>false</emphasis></entry>
42221 </row>
42222 </tbody>
42223 </tgroup>
42224 </informaltable>
42225 <para>
42226 When this option is set, the group owner of the file defined by the <option>file</option>
42227 option is checked to see that it is the same as the group under which the
42228 delivery process is running. The default setting is false because the default
42229 file mode is 0600, which means that the group is irrelevant.
42230 </para>
42231 <para>
42232 <indexterm role="option">
42233 <primary><option>check_owner</option></primary>
42234 </indexterm>
42235 </para>
42236 <informaltable frame="all">
42237 <tgroup cols="4" colsep="0" rowsep="0">
42238 <colspec colwidth="8*" align="left"/>
42239 <colspec colwidth="6*" align="center"/>
42240 <colspec colwidth="6*" align="center"/>
42241 <colspec colwidth="6*" align="right"/>
42242 <tbody>
42243 <row>
42244 <entry><option>check_owner</option></entry>
42245 <entry>Use: <emphasis>appendfile</emphasis></entry>
42246 <entry>Type: <emphasis>boolean</emphasis></entry>
42247 <entry>Default: <emphasis>true</emphasis></entry>
42248 </row>
42249 </tbody>
42250 </tgroup>
42251 </informaltable>
42252 <para>
42253 When this option is set, the owner of the file defined by the <option>file</option> option
42254 is checked to ensure that it is the same as the user under which the delivery
42255 process is running.
42256 </para>
42257 <para>
42258 <indexterm role="option">
42259 <primary><option>check_string</option></primary>
42260 </indexterm>
42261 </para>
42262 <informaltable frame="all">
42263 <tgroup cols="4" colsep="0" rowsep="0">
42264 <colspec colwidth="8*" align="left"/>
42265 <colspec colwidth="6*" align="center"/>
42266 <colspec colwidth="6*" align="center"/>
42267 <colspec colwidth="6*" align="right"/>
42268 <tbody>
42269 <row>
42270 <entry><option>check_string</option></entry>
42271 <entry>Use: <emphasis>appendfile</emphasis></entry>
42272 <entry>Type: <emphasis>string</emphasis></entry>
42273 <entry>Default: <emphasis>see below</emphasis></entry>
42274 </row>
42275 </tbody>
42276 </tgroup>
42277 </informaltable>
42278 <para>
42279 <indexterm role="concept">
42280 <primary><quote>From</quote> line</primary>
42281 </indexterm>
42282 As <command>appendfile</command> writes the message, the start of each line is tested for
42283 matching <option>check_string</option>, and if it does, the initial matching characters are
42284 replaced by the contents of <option>escape_string</option>. The value of <option>check_string</option> is
42285 a literal string, not a regular expression, and the case of any letters it
42286 contains is significant.
42287 </para>
42288 <para>
42289 If <option>use_bsmtp</option> is set the values of <option>check_string</option> and <option>escape_string</option>
42290 are forced to <quote>.</quote> and <quote>..</quote> respectively, and any settings in the
42291 configuration are ignored. Otherwise, they default to <quote>From&nbsp;</quote> and
42292 <quote>&gt;From&nbsp;</quote> when the <option>file</option> option is set, and unset when any of the
42293 <option>directory</option>, <option>maildir</option>, or <option>mailstore</option> options are set.
42294 </para>
42295 <para>
42296 The default settings, along with <option>message_prefix</option> and <option>message_suffix</option>, are
42297 suitable for traditional <quote>BSD</quote> mailboxes, where a line beginning with
42298 <quote>From&nbsp;</quote> indicates the start of a new message. All four options need changing
42299 if another format is used. For example, to deliver to mailboxes in MMDF format:
42300 <indexterm role="concept">
42301 <primary>MMDF format mailbox</primary>
42302 </indexterm>
42303 <indexterm role="concept">
42304 <primary>mailbox</primary>
42305 <secondary>MMDF format</secondary>
42306 </indexterm>
42307 </para>
42308 <literallayout class="monospaced">
42309 check_string = "\1\1\1\1\n"
42310 escape_string = "\1\1\1\1 \n"
42311 message_prefix = "\1\1\1\1\n"
42312 message_suffix = "\1\1\1\1\n"
42313 </literallayout>
42314 <para>
42315 <indexterm role="option">
42316 <primary><option>create_directory</option></primary>
42317 </indexterm>
42318 </para>
42319 <informaltable frame="all">
42320 <tgroup cols="4" colsep="0" rowsep="0">
42321 <colspec colwidth="8*" align="left"/>
42322 <colspec colwidth="6*" align="center"/>
42323 <colspec colwidth="6*" align="center"/>
42324 <colspec colwidth="6*" align="right"/>
42325 <tbody>
42326 <row>
42327 <entry><option>create_directory</option></entry>
42328 <entry>Use: <emphasis>appendfile</emphasis></entry>
42329 <entry>Type: <emphasis>boolean</emphasis></entry>
42330 <entry>Default: <emphasis>true</emphasis></entry>
42331 </row>
42332 </tbody>
42333 </tgroup>
42334 </informaltable>
42335 <para>
42336 <indexterm role="concept">
42337 <primary>directory creation</primary>
42338 </indexterm>
42339 When this option is true, Exim attempts to create any missing superior
42340 directories for the file that it is about to write. A created directory&#x2019;s mode
42341 is given by the <option>directory_mode</option> option.
42342 </para>
42343 <para>
42344 The group ownership of a newly created directory is highly dependent on the
42345 operating system (and possibly the file system) that is being used. For
42346 example, in Solaris, if the parent directory has the setgid bit set, its group
42347 is propagated to the child; if not, the currently set group is used. However,
42348 in FreeBSD, the parent&#x2019;s group is always used.
42349 </para>
42350 <para>
42351 <indexterm role="option">
42352 <primary><option>create_file</option></primary>
42353 </indexterm>
42354 </para>
42355 <informaltable frame="all">
42356 <tgroup cols="4" colsep="0" rowsep="0">
42357 <colspec colwidth="8*" align="left"/>
42358 <colspec colwidth="6*" align="center"/>
42359 <colspec colwidth="6*" align="center"/>
42360 <colspec colwidth="6*" align="right"/>
42361 <tbody>
42362 <row>
42363 <entry><option>create_file</option></entry>
42364 <entry>Use: <emphasis>appendfile</emphasis></entry>
42365 <entry>Type: <emphasis>string</emphasis></entry>
42366 <entry>Default: <emphasis>anywhere</emphasis></entry>
42367 </row>
42368 </tbody>
42369 </tgroup>
42370 </informaltable>
42371 <para>
42372 This option constrains the location of files and directories that are created
42373 by this transport. It applies to files defined by the <option>file</option> option and
42374 directories defined by the <option>directory</option> option. In the case of maildir
42375 delivery, it applies to the top level directory, not the maildir directories
42376 beneath.
42377 </para>
42378 <para>
42379 The option must be set to one of the words <quote>anywhere</quote>, <quote>inhome</quote>, or
42380 <quote>belowhome</quote>. In the second and third cases, a home directory must have been
42381 set for the transport. This option is not useful when an explicit filename is
42382 given for normal mailbox deliveries. It is intended for the case when filenames
42383 are generated from users&#x2019; <filename>.forward</filename> files. These are usually handled
42384 by an <command>appendfile</command> transport called <option>address_file</option>. See also
42385 <option>file_must_exist</option>.
42386 </para>
42387 <para>
42388 <indexterm role="option">
42389 <primary><option>directory</option></primary>
42390 </indexterm>
42391 </para>
42392 <informaltable frame="all">
42393 <tgroup cols="4" colsep="0" rowsep="0">
42394 <colspec colwidth="8*" align="left"/>
42395 <colspec colwidth="6*" align="center"/>
42396 <colspec colwidth="6*" align="center"/>
42397 <colspec colwidth="6*" align="right"/>
42398 <tbody>
42399 <row>
42400 <entry><option>directory</option></entry>
42401 <entry>Use: <emphasis>appendfile</emphasis></entry>
42402 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42403 <entry>Default: <emphasis>unset</emphasis></entry>
42404 </row>
42405 </tbody>
42406 </tgroup>
42407 </informaltable>
42408 <para>
42409 This option is mutually exclusive with the <option>file</option> option, but one of <option>file</option>
42410 or <option>directory</option> must be set, unless the delivery is the direct result of a
42411 redirection (see section <xref linkend="SECTfildiropt"/>).
42412 </para>
42413 <para>
42414 When <option>directory</option> is set, the string is expanded, and the message is delivered
42415 into a new file or files in or below the given directory, instead of being
42416 appended to a single mailbox file. A number of different formats are provided
42417 (see <option>maildir_format</option> and <option>mailstore_format</option>), and see section
42418 <xref linkend="SECTopdir"/> for further details of this form of delivery.
42419 </para>
42420 <para>
42421 <indexterm role="option">
42422 <primary><option>directory_file</option></primary>
42423 </indexterm>
42424 </para>
42425 <informaltable frame="all">
42426 <tgroup cols="4" colsep="0" rowsep="0">
42427 <colspec colwidth="8*" align="left"/>
42428 <colspec colwidth="6*" align="center"/>
42429 <colspec colwidth="6*" align="center"/>
42430 <colspec colwidth="6*" align="right"/>
42431 <tbody>
42432 <row>
42433 <entry><option>directory_file</option></entry>
42434 <entry>Use: <emphasis>appendfile</emphasis></entry>
42435 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42436 <entry>Default: <emphasis>see below</emphasis></entry>
42437 </row>
42438 </tbody>
42439 </tgroup>
42440 </informaltable>
42441 <para>
42442 <indexterm role="concept">
42443 <primary>base62</primary>
42444 </indexterm>
42445 <indexterm role="variable">
42446 <primary><varname>$inode</varname></primary>
42447 </indexterm>
42448 When <option>directory</option> is set, but neither <option>maildir_format</option> nor
42449 <option>mailstore_format</option> is set, <command>appendfile</command> delivers each message into a file
42450 whose name is obtained by expanding this string. The default value is:
42451 </para>
42452 <literallayout class="monospaced">
42453 q${base62:$tod_epoch}-$inode
42454 </literallayout>
42455 <para>
42456 This generates a unique name from the current time, in base 62 form, and the
42457 inode of the file. The variable <varname>$inode</varname> is available only when expanding this
42458 option.
42459 </para>
42460 <para>
42461 <indexterm role="option">
42462 <primary><option>directory_mode</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>directory_mode</option></entry>
42474 <entry>Use: <emphasis>appendfile</emphasis></entry>
42475 <entry>Type: <emphasis>octal integer</emphasis></entry>
42476 <entry>Default: <emphasis>0700</emphasis></entry>
42477 </row>
42478 </tbody>
42479 </tgroup>
42480 </informaltable>
42481 <para>
42482 If <command>appendfile</command> creates any directories as a result of the
42483 <option>create_directory</option> option, their mode is specified by this option.
42484 </para>
42485 <para>
42486 <indexterm role="option">
42487 <primary><option>escape_string</option></primary>
42488 </indexterm>
42489 </para>
42490 <informaltable frame="all">
42491 <tgroup cols="4" colsep="0" rowsep="0">
42492 <colspec colwidth="8*" align="left"/>
42493 <colspec colwidth="6*" align="center"/>
42494 <colspec colwidth="6*" align="center"/>
42495 <colspec colwidth="6*" align="right"/>
42496 <tbody>
42497 <row>
42498 <entry><option>escape_string</option></entry>
42499 <entry>Use: <emphasis>appendfile</emphasis></entry>
42500 <entry>Type: <emphasis>string</emphasis></entry>
42501 <entry>Default: <emphasis>see description</emphasis></entry>
42502 </row>
42503 </tbody>
42504 </tgroup>
42505 </informaltable>
42506 <para>
42507 See <option>check_string</option> above.
42508 </para>
42509 <para>
42510 <indexterm role="option">
42511 <primary><option>file</option></primary>
42512 </indexterm>
42513 </para>
42514 <informaltable frame="all">
42515 <tgroup cols="4" colsep="0" rowsep="0">
42516 <colspec colwidth="8*" align="left"/>
42517 <colspec colwidth="6*" align="center"/>
42518 <colspec colwidth="6*" align="center"/>
42519 <colspec colwidth="6*" align="right"/>
42520 <tbody>
42521 <row>
42522 <entry><option>file</option></entry>
42523 <entry>Use: <emphasis>appendfile</emphasis></entry>
42524 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42525 <entry>Default: <emphasis>unset</emphasis></entry>
42526 </row>
42527 </tbody>
42528 </tgroup>
42529 </informaltable>
42530 <para>
42531 This option is mutually exclusive with the <option>directory</option> option, but one of
42532 <option>file</option> or <option>directory</option> must be set, unless the delivery is the direct result
42533 of a redirection (see section <xref linkend="SECTfildiropt"/>). The <option>file</option> option
42534 specifies a single file, to which the message is appended. One or more of
42535 <option>use_fcntl_lock</option>, <option>use_flock_lock</option>, or <option>use_lockfile</option> must be set with
42536 <option>file</option>.
42537 </para>
42538 <para>
42539 <indexterm role="concept">
42540 <primary>NFS</primary>
42541 <secondary>lock file</secondary>
42542 </indexterm>
42543 <indexterm role="concept">
42544 <primary>locking files</primary>
42545 </indexterm>
42546 <indexterm role="concept">
42547 <primary>lock files</primary>
42548 </indexterm>
42549 If you are using more than one host to deliver over NFS into the same
42550 mailboxes, you should always use lock files.
42551 </para>
42552 <para>
42553 The string value is expanded for each delivery, and must yield an absolute
42554 path. The most common settings of this option are variations on one of these
42555 examples:
42556 </para>
42557 <literallayout class="monospaced">
42558 file = /var/spool/mail/$local_part
42559 file = /home/$local_part/inbox
42560 file = $home/inbox
42561 </literallayout>
42562 <para>
42563 <indexterm role="concept">
42564 <primary><quote>sticky</quote> bit</primary>
42565 </indexterm>
42566 In the first example, all deliveries are done into the same directory. If Exim
42567 is configured to use lock files (see <option>use_lockfile</option> below) it must be able to
42568 create a file in the directory, so the <quote>sticky</quote> bit must be turned on for
42569 deliveries to be possible, or alternatively the <option>group</option> option can be used to
42570 run the delivery under a group id which has write access to the directory.
42571 </para>
42572 <para>
42573 <indexterm role="option">
42574 <primary><option>file_format</option></primary>
42575 </indexterm>
42576 </para>
42577 <informaltable frame="all">
42578 <tgroup cols="4" colsep="0" rowsep="0">
42579 <colspec colwidth="8*" align="left"/>
42580 <colspec colwidth="6*" align="center"/>
42581 <colspec colwidth="6*" align="center"/>
42582 <colspec colwidth="6*" align="right"/>
42583 <tbody>
42584 <row>
42585 <entry><option>file_format</option></entry>
42586 <entry>Use: <emphasis>appendfile</emphasis></entry>
42587 <entry>Type: <emphasis>string</emphasis></entry>
42588 <entry>Default: <emphasis>unset</emphasis></entry>
42589 </row>
42590 </tbody>
42591 </tgroup>
42592 </informaltable>
42593 <para>
42594 <indexterm role="concept">
42595 <primary>file</primary>
42596 <secondary>mailbox; checking existing format</secondary>
42597 </indexterm>
42598 This option requests the transport to check the format of an existing file
42599 before adding to it. The check consists of matching a specific string at the
42600 start of the file. The value of the option consists of an even number of
42601 colon-separated strings. The first of each pair is the test string, and the
42602 second is the name of a transport. If the transport associated with a matched
42603 string is not the current transport, control is passed over to the other
42604 transport. For example, suppose the standard <command>local_delivery</command> transport has
42605 this added to it:
42606 </para>
42607 <literallayout class="monospaced">
42608 file_format = "From       : local_delivery :\
42609                \1\1\1\1\n : local_mmdf_delivery"
42610 </literallayout>
42611 <para>
42612 Mailboxes that begin with <quote>From</quote> are still handled by this transport, but if
42613 a mailbox begins with four binary ones followed by a newline, control is passed
42614 to a transport called <option>local_mmdf_delivery</option>, which presumably is configured
42615 to do the delivery in MMDF format. If a mailbox does not exist or is empty, it
42616 is assumed to match the current transport. If the start of a mailbox doesn&#x2019;t
42617 match any string, or if the transport named for a given string is not defined,
42618 delivery is deferred.
42619 </para>
42620 <para>
42621 <indexterm role="option">
42622 <primary><option>file_must_exist</option></primary>
42623 </indexterm>
42624 </para>
42625 <informaltable frame="all">
42626 <tgroup cols="4" colsep="0" rowsep="0">
42627 <colspec colwidth="8*" align="left"/>
42628 <colspec colwidth="6*" align="center"/>
42629 <colspec colwidth="6*" align="center"/>
42630 <colspec colwidth="6*" align="right"/>
42631 <tbody>
42632 <row>
42633 <entry><option>file_must_exist</option></entry>
42634 <entry>Use: <emphasis>appendfile</emphasis></entry>
42635 <entry>Type: <emphasis>boolean</emphasis></entry>
42636 <entry>Default: <emphasis>false</emphasis></entry>
42637 </row>
42638 </tbody>
42639 </tgroup>
42640 </informaltable>
42641 <para>
42642 If this option is true, the file specified by the <option>file</option> option must exist.
42643 A temporary error occurs if it does not, causing delivery to be deferred.
42644 If this option is false, the file is created if it does not exist.
42645 </para>
42646 <para>
42647 <indexterm role="option">
42648 <primary><option>lock_fcntl_timeout</option></primary>
42649 </indexterm>
42650 </para>
42651 <informaltable frame="all">
42652 <tgroup cols="4" colsep="0" rowsep="0">
42653 <colspec colwidth="8*" align="left"/>
42654 <colspec colwidth="6*" align="center"/>
42655 <colspec colwidth="6*" align="center"/>
42656 <colspec colwidth="6*" align="right"/>
42657 <tbody>
42658 <row>
42659 <entry><option>lock_fcntl_timeout</option></entry>
42660 <entry>Use: <emphasis>appendfile</emphasis></entry>
42661 <entry>Type: <emphasis>time</emphasis></entry>
42662 <entry>Default: <emphasis>0s</emphasis></entry>
42663 </row>
42664 </tbody>
42665 </tgroup>
42666 </informaltable>
42667 <para>
42668 <indexterm role="concept">
42669 <primary>timeout</primary>
42670 <secondary>mailbox locking</secondary>
42671 </indexterm>
42672 <indexterm role="concept">
42673 <primary>mailbox</primary>
42674 <secondary>locking, blocking and non-blocking</secondary>
42675 </indexterm>
42676 <indexterm role="concept">
42677 <primary>locking files</primary>
42678 </indexterm>
42679 By default, the <command>appendfile</command> transport uses non-blocking calls to <function>fcntl()</function>
42680 when locking an open mailbox file. If the call fails, the delivery process
42681 sleeps for <option>lock_interval</option> and tries again, up to <option>lock_retries</option> times.
42682 Non-blocking calls are used so that the file is not kept open during the wait
42683 for the lock; the reason for this is to make it as safe as possible for
42684 deliveries over NFS in the case when processes might be accessing an NFS
42685 mailbox without using a lock file. This should not be done, but
42686 misunderstandings and hence misconfigurations are not unknown.
42687 </para>
42688 <para>
42689 On a busy system, however, the performance of a non-blocking lock approach is
42690 not as good as using a blocking lock with a timeout. In this case, the waiting
42691 is done inside the system call, and Exim&#x2019;s delivery process acquires the lock
42692 and can proceed as soon as the previous lock holder releases it.
42693 </para>
42694 <para>
42695 If <option>lock_fcntl_timeout</option> is set to a non-zero time, blocking locks, with that
42696 timeout, are used. There may still be some retrying: the maximum number of
42697 retries is
42698 </para>
42699 <literallayout class="monospaced">
42700 (lock_retries * lock_interval) / lock_fcntl_timeout
42701 </literallayout>
42702 <para>
42703 rounded up to the next whole number. In other words, the total time during
42704 which <command>appendfile</command> is trying to get a lock is roughly the same, unless
42705 <option>lock_fcntl_timeout</option> is set very large.
42706 </para>
42707 <para>
42708 You should consider setting this option if you are getting a lot of delayed
42709 local deliveries because of errors of the form
42710 </para>
42711 <literallayout class="monospaced">
42712 failed to lock mailbox /some/file (fcntl)
42713 </literallayout>
42714 <para>
42715 <indexterm role="option">
42716 <primary><option>lock_flock_timeout</option></primary>
42717 </indexterm>
42718 </para>
42719 <informaltable frame="all">
42720 <tgroup cols="4" colsep="0" rowsep="0">
42721 <colspec colwidth="8*" align="left"/>
42722 <colspec colwidth="6*" align="center"/>
42723 <colspec colwidth="6*" align="center"/>
42724 <colspec colwidth="6*" align="right"/>
42725 <tbody>
42726 <row>
42727 <entry><option>lock_flock_timeout</option></entry>
42728 <entry>Use: <emphasis>appendfile</emphasis></entry>
42729 <entry>Type: <emphasis>time</emphasis></entry>
42730 <entry>Default: <emphasis>0s</emphasis></entry>
42731 </row>
42732 </tbody>
42733 </tgroup>
42734 </informaltable>
42735 <para>
42736 This timeout applies to file locking when using <function>flock()</function> (see
42737 <option>use_flock</option>); the timeout operates in a similar manner to
42738 <option>lock_fcntl_timeout</option>.
42739 </para>
42740 <para>
42741 <indexterm role="option">
42742 <primary><option>lock_interval</option></primary>
42743 </indexterm>
42744 </para>
42745 <informaltable frame="all">
42746 <tgroup cols="4" colsep="0" rowsep="0">
42747 <colspec colwidth="8*" align="left"/>
42748 <colspec colwidth="6*" align="center"/>
42749 <colspec colwidth="6*" align="center"/>
42750 <colspec colwidth="6*" align="right"/>
42751 <tbody>
42752 <row>
42753 <entry><option>lock_interval</option></entry>
42754 <entry>Use: <emphasis>appendfile</emphasis></entry>
42755 <entry>Type: <emphasis>time</emphasis></entry>
42756 <entry>Default: <emphasis>3s</emphasis></entry>
42757 </row>
42758 </tbody>
42759 </tgroup>
42760 </informaltable>
42761 <para>
42762 This specifies the time to wait between attempts to lock the file. See below
42763 for details of locking.
42764 </para>
42765 <para>
42766 <indexterm role="option">
42767 <primary><option>lock_retries</option></primary>
42768 </indexterm>
42769 </para>
42770 <informaltable frame="all">
42771 <tgroup cols="4" colsep="0" rowsep="0">
42772 <colspec colwidth="8*" align="left"/>
42773 <colspec colwidth="6*" align="center"/>
42774 <colspec colwidth="6*" align="center"/>
42775 <colspec colwidth="6*" align="right"/>
42776 <tbody>
42777 <row>
42778 <entry><option>lock_retries</option></entry>
42779 <entry>Use: <emphasis>appendfile</emphasis></entry>
42780 <entry>Type: <emphasis>integer</emphasis></entry>
42781 <entry>Default: <emphasis>10</emphasis></entry>
42782 </row>
42783 </tbody>
42784 </tgroup>
42785 </informaltable>
42786 <para>
42787 This specifies the maximum number of attempts to lock the file. A value of zero
42788 is treated as 1. See below for details of locking.
42789 </para>
42790 <para>
42791 <indexterm role="option">
42792 <primary><option>lockfile_mode</option></primary>
42793 </indexterm>
42794 </para>
42795 <informaltable frame="all">
42796 <tgroup cols="4" colsep="0" rowsep="0">
42797 <colspec colwidth="8*" align="left"/>
42798 <colspec colwidth="6*" align="center"/>
42799 <colspec colwidth="6*" align="center"/>
42800 <colspec colwidth="6*" align="right"/>
42801 <tbody>
42802 <row>
42803 <entry><option>lockfile_mode</option></entry>
42804 <entry>Use: <emphasis>appendfile</emphasis></entry>
42805 <entry>Type: <emphasis>octal integer</emphasis></entry>
42806 <entry>Default: <emphasis>0600</emphasis></entry>
42807 </row>
42808 </tbody>
42809 </tgroup>
42810 </informaltable>
42811 <para>
42812 This specifies the mode of the created lock file, when a lock file is being
42813 used (see <option>use_lockfile</option> and <option>use_mbx_lock</option>).
42814 </para>
42815 <para>
42816 <indexterm role="option">
42817 <primary><option>lockfile_timeout</option></primary>
42818 </indexterm>
42819 </para>
42820 <informaltable frame="all">
42821 <tgroup cols="4" colsep="0" rowsep="0">
42822 <colspec colwidth="8*" align="left"/>
42823 <colspec colwidth="6*" align="center"/>
42824 <colspec colwidth="6*" align="center"/>
42825 <colspec colwidth="6*" align="right"/>
42826 <tbody>
42827 <row>
42828 <entry><option>lockfile_timeout</option></entry>
42829 <entry>Use: <emphasis>appendfile</emphasis></entry>
42830 <entry>Type: <emphasis>time</emphasis></entry>
42831 <entry>Default: <emphasis>30m</emphasis></entry>
42832 </row>
42833 </tbody>
42834 </tgroup>
42835 </informaltable>
42836 <para>
42837 <indexterm role="concept">
42838 <primary>timeout</primary>
42839 <secondary>mailbox locking</secondary>
42840 </indexterm>
42841 When a lock file is being used (see <option>use_lockfile</option>), if a lock file already
42842 exists and is older than this value, it is assumed to have been left behind by
42843 accident, and Exim attempts to remove it.
42844 </para>
42845 <para>
42846 <indexterm role="option">
42847 <primary><option>mailbox_filecount</option></primary>
42848 </indexterm>
42849 </para>
42850 <informaltable frame="all">
42851 <tgroup cols="4" colsep="0" rowsep="0">
42852 <colspec colwidth="8*" align="left"/>
42853 <colspec colwidth="6*" align="center"/>
42854 <colspec colwidth="6*" align="center"/>
42855 <colspec colwidth="6*" align="right"/>
42856 <tbody>
42857 <row>
42858 <entry><option>mailbox_filecount</option></entry>
42859 <entry>Use: <emphasis>appendfile</emphasis></entry>
42860 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42861 <entry>Default: <emphasis>unset</emphasis></entry>
42862 </row>
42863 </tbody>
42864 </tgroup>
42865 </informaltable>
42866 <para>
42867 <indexterm role="concept">
42868 <primary>mailbox</primary>
42869 <secondary>specifying size of</secondary>
42870 </indexterm>
42871 <indexterm role="concept">
42872 <primary>size</primary>
42873 <secondary>of mailbox</secondary>
42874 </indexterm>
42875 If this option is set, it is expanded, and the result is taken as the current
42876 number of files in the mailbox. It must be a decimal number, optionally
42877 followed by K or M. This provides a way of obtaining this information from an
42878 external source that maintains the data.
42879 </para>
42880 <para>
42881 <indexterm role="option">
42882 <primary><option>mailbox_size</option></primary>
42883 </indexterm>
42884 </para>
42885 <informaltable frame="all">
42886 <tgroup cols="4" colsep="0" rowsep="0">
42887 <colspec colwidth="8*" align="left"/>
42888 <colspec colwidth="6*" align="center"/>
42889 <colspec colwidth="6*" align="center"/>
42890 <colspec colwidth="6*" align="right"/>
42891 <tbody>
42892 <row>
42893 <entry><option>mailbox_size</option></entry>
42894 <entry>Use: <emphasis>appendfile</emphasis></entry>
42895 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42896 <entry>Default: <emphasis>unset</emphasis></entry>
42897 </row>
42898 </tbody>
42899 </tgroup>
42900 </informaltable>
42901 <para>
42902 <indexterm role="concept">
42903 <primary>mailbox</primary>
42904 <secondary>specifying size of</secondary>
42905 </indexterm>
42906 <indexterm role="concept">
42907 <primary>size</primary>
42908 <secondary>of mailbox</secondary>
42909 </indexterm>
42910 If this option is set, it is expanded, and the result is taken as the current
42911 size the mailbox. It must be a decimal number, optionally followed by K or M.
42912 This provides a way of obtaining this information from an external source that
42913 maintains the data. This is likely to be helpful for maildir deliveries where
42914 it is computationally expensive to compute the size of a mailbox.
42915 </para>
42916 <para>
42917 <indexterm role="option">
42918 <primary><option>maildir_format</option></primary>
42919 </indexterm>
42920 </para>
42921 <informaltable frame="all">
42922 <tgroup cols="4" colsep="0" rowsep="0">
42923 <colspec colwidth="8*" align="left"/>
42924 <colspec colwidth="6*" align="center"/>
42925 <colspec colwidth="6*" align="center"/>
42926 <colspec colwidth="6*" align="right"/>
42927 <tbody>
42928 <row>
42929 <entry><option>maildir_format</option></entry>
42930 <entry>Use: <emphasis>appendfile</emphasis></entry>
42931 <entry>Type: <emphasis>boolean</emphasis></entry>
42932 <entry>Default: <emphasis>false</emphasis></entry>
42933 </row>
42934 </tbody>
42935 </tgroup>
42936 </informaltable>
42937 <para>
42938 <indexterm role="concept">
42939 <primary>maildir format</primary>
42940 <secondary>specifying</secondary>
42941 </indexterm>
42942 If this option is set with the <option>directory</option> option, the delivery is into a new
42943 file, in the <quote>maildir</quote> format that is used by other mail software. When the
42944 transport is activated directly from a <command>redirect</command> router (for example, the
42945 <command>address_file</command> transport in the default configuration), setting
42946 <option>maildir_format</option> causes the path received from the router to be treated as a
42947 directory, whether or not it ends with <literal>/</literal>. This option is available only if
42948 SUPPORT_MAILDIR is present in <filename>Local/Makefile</filename>. See section
42949 <xref linkend="SECTmaildirdelivery"/> below for further details.
42950 </para>
42951 <para>
42952 <indexterm role="option">
42953 <primary><option>maildir_quota_directory_regex</option></primary>
42954 </indexterm>
42955 </para>
42956 <informaltable frame="all">
42957 <tgroup cols="4" colsep="0" rowsep="0">
42958 <colspec colwidth="8*" align="left"/>
42959 <colspec colwidth="6*" align="center"/>
42960 <colspec colwidth="6*" align="center"/>
42961 <colspec colwidth="6*" align="right"/>
42962 <tbody>
42963 <row>
42964 <entry><option>maildir_quota_directory_regex</option></entry>
42965 <entry>Use: <emphasis>appendfile</emphasis></entry>
42966 <entry>Type: <emphasis>string</emphasis></entry>
42967 <entry>Default: <emphasis>See below</emphasis></entry>
42968 </row>
42969 </tbody>
42970 </tgroup>
42971 </informaltable>
42972 <para>
42973 <indexterm role="concept">
42974 <primary>maildir format</primary>
42975 <secondary>quota; directories included in</secondary>
42976 </indexterm>
42977 <indexterm role="concept">
42978 <primary>quota</primary>
42979 <secondary>maildir; directories included in</secondary>
42980 </indexterm>
42981 This option is relevant only when <option>maildir_use_size_file</option> is set. It defines
42982 a regular expression for specifying directories, relative to the quota
42983 directory (see <option>quota_directory</option>), that should be included in the quota
42984 calculation. The default value is:
42985 </para>
42986 <literallayout class="monospaced">
42987 maildir_quota_directory_regex = ^(?:cur|new|\..*)$
42988 </literallayout>
42989 <para>
42990 This includes the <filename>cur</filename> and <filename>new</filename> directories, and any maildir++ folders
42991 (directories whose names begin with a dot). If you want to exclude the
42992 <filename>Trash</filename>
42993 folder from the count (as some sites do), you need to change this setting to
42994 </para>
42995 <literallayout class="monospaced">
42996 maildir_quota_directory_regex = ^(?:cur|new|\.(?!Trash).*)$
42997 </literallayout>
42998 <para>
42999 This uses a negative lookahead in the regular expression to exclude the
43000 directory whose name is <filename>.Trash</filename>. When a directory is excluded from quota
43001 calculations, quota processing is bypassed for any messages that are delivered
43002 directly into that directory.
43003 </para>
43004 <para>
43005 <indexterm role="option">
43006 <primary><option>maildir_retries</option></primary>
43007 </indexterm>
43008 </para>
43009 <informaltable frame="all">
43010 <tgroup cols="4" colsep="0" rowsep="0">
43011 <colspec colwidth="8*" align="left"/>
43012 <colspec colwidth="6*" align="center"/>
43013 <colspec colwidth="6*" align="center"/>
43014 <colspec colwidth="6*" align="right"/>
43015 <tbody>
43016 <row>
43017 <entry><option>maildir_retries</option></entry>
43018 <entry>Use: <emphasis>appendfile</emphasis></entry>
43019 <entry>Type: <emphasis>integer</emphasis></entry>
43020 <entry>Default: <emphasis>10</emphasis></entry>
43021 </row>
43022 </tbody>
43023 </tgroup>
43024 </informaltable>
43025 <para>
43026 This option specifies the number of times to retry when writing a file in
43027 <quote>maildir</quote> format. See section <xref linkend="SECTmaildirdelivery"/> below.
43028 </para>
43029 <para>
43030 <indexterm role="option">
43031 <primary><option>maildir_tag</option></primary>
43032 </indexterm>
43033 </para>
43034 <informaltable frame="all">
43035 <tgroup cols="4" colsep="0" rowsep="0">
43036 <colspec colwidth="8*" align="left"/>
43037 <colspec colwidth="6*" align="center"/>
43038 <colspec colwidth="6*" align="center"/>
43039 <colspec colwidth="6*" align="right"/>
43040 <tbody>
43041 <row>
43042 <entry><option>maildir_tag</option></entry>
43043 <entry>Use: <emphasis>appendfile</emphasis></entry>
43044 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43045 <entry>Default: <emphasis>unset</emphasis></entry>
43046 </row>
43047 </tbody>
43048 </tgroup>
43049 </informaltable>
43050 <para>
43051 This option applies only to deliveries in maildir format, and is described in
43052 section <xref linkend="SECTmaildirdelivery"/> below.
43053 </para>
43054 <para>
43055 <indexterm role="option">
43056 <primary><option>maildir_use_size_file</option></primary>
43057 </indexterm>
43058 </para>
43059 <informaltable frame="all">
43060 <tgroup cols="4" colsep="0" rowsep="0">
43061 <colspec colwidth="8*" align="left"/>
43062 <colspec colwidth="6*" align="center"/>
43063 <colspec colwidth="6*" align="center"/>
43064 <colspec colwidth="6*" align="right"/>
43065 <tbody>
43066 <row>
43067 <entry><option>maildir_use_size_file</option></entry>
43068 <entry>Use: <emphasis>appendfile</emphasis>&dagger;<emphasis></emphasis></entry>
43069 <entry>Type: <emphasis>boolean</emphasis></entry>
43070 <entry>Default: <emphasis>false</emphasis></entry>
43071 </row>
43072 </tbody>
43073 </tgroup>
43074 </informaltable>
43075 <para>
43076 <indexterm role="concept">
43077 <primary>maildir format</primary>
43078 <secondary><filename>maildirsize</filename> file</secondary>
43079 </indexterm>
43080 The result of string expansion for this option must be a valid boolean value.
43081 If it is true, it enables support for <filename>maildirsize</filename> files. Exim
43082 creates a <filename>maildirsize</filename> file in a maildir if one does not exist, taking the
43083 quota from the <option>quota</option> option of the transport. If <option>quota</option> is unset, the
43084 value is zero. See <option>maildir_quota_directory_regex</option> above and section
43085 <xref linkend="SECTmaildirdelivery"/> below for further details.
43086 </para>
43087 <para>
43088 <indexterm role="option">
43089 <primary><option>maildirfolder_create_regex</option></primary>
43090 </indexterm>
43091 </para>
43092 <informaltable frame="all">
43093 <tgroup cols="4" colsep="0" rowsep="0">
43094 <colspec colwidth="8*" align="left"/>
43095 <colspec colwidth="6*" align="center"/>
43096 <colspec colwidth="6*" align="center"/>
43097 <colspec colwidth="6*" align="right"/>
43098 <tbody>
43099 <row>
43100 <entry><option>maildirfolder_create_regex</option></entry>
43101 <entry>Use: <emphasis>appendfile</emphasis></entry>
43102 <entry>Type: <emphasis>string</emphasis></entry>
43103 <entry>Default: <emphasis>unset</emphasis></entry>
43104 </row>
43105 </tbody>
43106 </tgroup>
43107 </informaltable>
43108 <para>
43109 <indexterm role="concept">
43110 <primary>maildir format</primary>
43111 <secondary><filename>maildirfolder</filename> file</secondary>
43112 </indexterm>
43113 <indexterm role="concept">
43114 <primary><filename>maildirfolder</filename>, creating</primary>
43115 </indexterm>
43116 The value of this option is a regular expression. If it is unset, it has no
43117 effect. Otherwise, before a maildir delivery takes place, the pattern is
43118 matched against the name of the maildir directory, that is, the directory
43119 containing the <filename>new</filename> and <filename>tmp</filename> subdirectories that will be used for the
43120 delivery. If there is a match, Exim checks for the existence of a file called
43121 <filename>maildirfolder</filename> in the directory, and creates it if it does not exist.
43122 See section <xref linkend="SECTmaildirdelivery"/> for more details.
43123 </para>
43124 <para>
43125 <indexterm role="option">
43126 <primary><option>mailstore_format</option></primary>
43127 </indexterm>
43128 </para>
43129 <informaltable frame="all">
43130 <tgroup cols="4" colsep="0" rowsep="0">
43131 <colspec colwidth="8*" align="left"/>
43132 <colspec colwidth="6*" align="center"/>
43133 <colspec colwidth="6*" align="center"/>
43134 <colspec colwidth="6*" align="right"/>
43135 <tbody>
43136 <row>
43137 <entry><option>mailstore_format</option></entry>
43138 <entry>Use: <emphasis>appendfile</emphasis></entry>
43139 <entry>Type: <emphasis>boolean</emphasis></entry>
43140 <entry>Default: <emphasis>false</emphasis></entry>
43141 </row>
43142 </tbody>
43143 </tgroup>
43144 </informaltable>
43145 <para>
43146 <indexterm role="concept">
43147 <primary>mailstore format</primary>
43148 <secondary>specifying</secondary>
43149 </indexterm>
43150 If this option is set with the <option>directory</option> option, the delivery is into two
43151 new files in  <quote>mailstore</quote> format. The option is available only if
43152 SUPPORT_MAILSTORE is present in <filename>Local/Makefile</filename>. See section <xref linkend="SECTopdir"/>
43153 below for further details.
43154 </para>
43155 <para>
43156 <indexterm role="option">
43157 <primary><option>mailstore_prefix</option></primary>
43158 </indexterm>
43159 </para>
43160 <informaltable frame="all">
43161 <tgroup cols="4" colsep="0" rowsep="0">
43162 <colspec colwidth="8*" align="left"/>
43163 <colspec colwidth="6*" align="center"/>
43164 <colspec colwidth="6*" align="center"/>
43165 <colspec colwidth="6*" align="right"/>
43166 <tbody>
43167 <row>
43168 <entry><option>mailstore_prefix</option></entry>
43169 <entry>Use: <emphasis>appendfile</emphasis></entry>
43170 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43171 <entry>Default: <emphasis>unset</emphasis></entry>
43172 </row>
43173 </tbody>
43174 </tgroup>
43175 </informaltable>
43176 <para>
43177 This option applies only to deliveries in mailstore format, and is described in
43178 section <xref linkend="SECTopdir"/> below.
43179 </para>
43180 <para>
43181 <indexterm role="option">
43182 <primary><option>mailstore_suffix</option></primary>
43183 </indexterm>
43184 </para>
43185 <informaltable frame="all">
43186 <tgroup cols="4" colsep="0" rowsep="0">
43187 <colspec colwidth="8*" align="left"/>
43188 <colspec colwidth="6*" align="center"/>
43189 <colspec colwidth="6*" align="center"/>
43190 <colspec colwidth="6*" align="right"/>
43191 <tbody>
43192 <row>
43193 <entry><option>mailstore_suffix</option></entry>
43194 <entry>Use: <emphasis>appendfile</emphasis></entry>
43195 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43196 <entry>Default: <emphasis>unset</emphasis></entry>
43197 </row>
43198 </tbody>
43199 </tgroup>
43200 </informaltable>
43201 <para>
43202 This option applies only to deliveries in mailstore format, and is described in
43203 section <xref linkend="SECTopdir"/> below.
43204 </para>
43205 <para>
43206 <indexterm role="option">
43207 <primary><option>mbx_format</option></primary>
43208 </indexterm>
43209 </para>
43210 <informaltable frame="all">
43211 <tgroup cols="4" colsep="0" rowsep="0">
43212 <colspec colwidth="8*" align="left"/>
43213 <colspec colwidth="6*" align="center"/>
43214 <colspec colwidth="6*" align="center"/>
43215 <colspec colwidth="6*" align="right"/>
43216 <tbody>
43217 <row>
43218 <entry><option>mbx_format</option></entry>
43219 <entry>Use: <emphasis>appendfile</emphasis></entry>
43220 <entry>Type: <emphasis>boolean</emphasis></entry>
43221 <entry>Default: <emphasis>false</emphasis></entry>
43222 </row>
43223 </tbody>
43224 </tgroup>
43225 </informaltable>
43226 <para>
43227 <indexterm role="concept">
43228 <primary>locking files</primary>
43229 </indexterm>
43230 <indexterm role="concept">
43231 <primary>file</primary>
43232 <secondary>locking</secondary>
43233 </indexterm>
43234 <indexterm role="concept">
43235 <primary>file</primary>
43236 <secondary>MBX format</secondary>
43237 </indexterm>
43238 <indexterm role="concept">
43239 <primary>MBX format, specifying</primary>
43240 </indexterm>
43241 This option is available only if Exim has been compiled with SUPPORT_MBX
43242 set in <filename>Local/Makefile</filename>. If <option>mbx_format</option> is set with the <option>file</option> option,
43243 the message is appended to the mailbox file in MBX format instead of
43244 traditional Unix format. This format is supported by Pine4 and its associated
43245 IMAP and POP daemons, by means of the <emphasis>c-client</emphasis> library that they all use.
43246 </para>
43247 <para>
43248 <emphasis role="bold">Note</emphasis>: The <option>message_prefix</option> and <option>message_suffix</option> options are not
43249 automatically changed by the use of <option>mbx_format</option>. They should normally be set
43250 empty when using MBX format, so this option almost always appears in this
43251 combination:
43252 </para>
43253 <literallayout class="monospaced">
43254 mbx_format = true
43255 message_prefix =
43256 message_suffix =
43257 </literallayout>
43258 <para>
43259 If none of the locking options are mentioned in the configuration,
43260 <option>use_mbx_lock</option> is assumed and the other locking options default to false. It
43261 is possible to specify the other kinds of locking with <option>mbx_format</option>, but
43262 <option>use_fcntl_lock</option> and <option>use_mbx_lock</option> are mutually exclusive. MBX locking
43263 interworks with <emphasis>c-client</emphasis>, providing for shared access to the mailbox. It
43264 should not be used if any program that does not use this form of locking is
43265 going to access the mailbox, nor should it be used if the mailbox file is NFS
43266 mounted, because it works only when the mailbox is accessed from a single host.
43267 </para>
43268 <para>
43269 If you set <option>use_fcntl_lock</option> with an MBX-format mailbox, you cannot use
43270 the standard version of <emphasis>c-client</emphasis>, because as long as it has a mailbox open
43271 (this means for the whole of a Pine or IMAP session), Exim will not be able to
43272 append messages to it.
43273 </para>
43274 <para>
43275 <indexterm role="option">
43276 <primary><option>message_prefix</option></primary>
43277 </indexterm>
43278 </para>
43279 <informaltable frame="all">
43280 <tgroup cols="4" colsep="0" rowsep="0">
43281 <colspec colwidth="8*" align="left"/>
43282 <colspec colwidth="6*" align="center"/>
43283 <colspec colwidth="6*" align="center"/>
43284 <colspec colwidth="6*" align="right"/>
43285 <tbody>
43286 <row>
43287 <entry><option>message_prefix</option></entry>
43288 <entry>Use: <emphasis>appendfile</emphasis></entry>
43289 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43290 <entry>Default: <emphasis>see below</emphasis></entry>
43291 </row>
43292 </tbody>
43293 </tgroup>
43294 </informaltable>
43295 <para>
43296 <indexterm role="concept">
43297 <primary><quote>From</quote> line</primary>
43298 </indexterm>
43299 The string specified here is expanded and output at the start of every message.
43300 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
43301 in which case it is:
43302 </para>
43303 <literallayout class="monospaced">
43304 message_prefix = "From ${if def:return_path{$return_path}\
43305   {MAILER-DAEMON}} $tod_bsdinbox\n"
43306 </literallayout>
43307 <para>
43308 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
43309 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_prefix</option>.
43310 </para>
43311 <para>
43312 <indexterm role="option">
43313 <primary><option>message_suffix</option></primary>
43314 </indexterm>
43315 </para>
43316 <informaltable frame="all">
43317 <tgroup cols="4" colsep="0" rowsep="0">
43318 <colspec colwidth="8*" align="left"/>
43319 <colspec colwidth="6*" align="center"/>
43320 <colspec colwidth="6*" align="center"/>
43321 <colspec colwidth="6*" align="right"/>
43322 <tbody>
43323 <row>
43324 <entry><option>message_suffix</option></entry>
43325 <entry>Use: <emphasis>appendfile</emphasis></entry>
43326 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43327 <entry>Default: <emphasis>see below</emphasis></entry>
43328 </row>
43329 </tbody>
43330 </tgroup>
43331 </informaltable>
43332 <para>
43333 The string specified here is expanded and output at the end of every message.
43334 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
43335 in which case it is a single newline character. The suffix can be suppressed by
43336 setting
43337 </para>
43338 <literallayout class="monospaced">
43339 message_suffix =
43340 </literallayout>
43341 <para>
43342 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
43343 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_suffix</option>.
43344 </para>
43345 <para>
43346 <indexterm role="option">
43347 <primary><option>mode</option></primary>
43348 </indexterm>
43349 </para>
43350 <informaltable frame="all">
43351 <tgroup cols="4" colsep="0" rowsep="0">
43352 <colspec colwidth="8*" align="left"/>
43353 <colspec colwidth="6*" align="center"/>
43354 <colspec colwidth="6*" align="center"/>
43355 <colspec colwidth="6*" align="right"/>
43356 <tbody>
43357 <row>
43358 <entry><option>mode</option></entry>
43359 <entry>Use: <emphasis>appendfile</emphasis></entry>
43360 <entry>Type: <emphasis>octal integer</emphasis></entry>
43361 <entry>Default: <emphasis>0600</emphasis></entry>
43362 </row>
43363 </tbody>
43364 </tgroup>
43365 </informaltable>
43366 <para>
43367 If the output file is created, it is given this mode. If it already exists and
43368 has wider permissions, they are reduced to this mode. If it has narrower
43369 permissions, an error occurs unless <option>mode_fail_narrower</option> is false. However,
43370 if the delivery is the result of a <option>save</option> command in a filter file specifying
43371 a particular mode, the mode of the output file is always forced to take that
43372 value, and this option is ignored.
43373 </para>
43374 <para>
43375 <indexterm role="option">
43376 <primary><option>mode_fail_narrower</option></primary>
43377 </indexterm>
43378 </para>
43379 <informaltable frame="all">
43380 <tgroup cols="4" colsep="0" rowsep="0">
43381 <colspec colwidth="8*" align="left"/>
43382 <colspec colwidth="6*" align="center"/>
43383 <colspec colwidth="6*" align="center"/>
43384 <colspec colwidth="6*" align="right"/>
43385 <tbody>
43386 <row>
43387 <entry><option>mode_fail_narrower</option></entry>
43388 <entry>Use: <emphasis>appendfile</emphasis></entry>
43389 <entry>Type: <emphasis>boolean</emphasis></entry>
43390 <entry>Default: <emphasis>true</emphasis></entry>
43391 </row>
43392 </tbody>
43393 </tgroup>
43394 </informaltable>
43395 <para>
43396 This option applies in the case when an existing mailbox file has a narrower
43397 mode than that specified by the <option>mode</option> option. If <option>mode_fail_narrower</option> is
43398 true, the delivery is deferred (<quote>mailbox has the wrong mode</quote>); otherwise Exim
43399 continues with the delivery attempt, using the existing mode of the file.
43400 </para>
43401 <para>
43402 <indexterm role="option">
43403 <primary><option>notify_comsat</option></primary>
43404 </indexterm>
43405 </para>
43406 <informaltable frame="all">
43407 <tgroup cols="4" colsep="0" rowsep="0">
43408 <colspec colwidth="8*" align="left"/>
43409 <colspec colwidth="6*" align="center"/>
43410 <colspec colwidth="6*" align="center"/>
43411 <colspec colwidth="6*" align="right"/>
43412 <tbody>
43413 <row>
43414 <entry><option>notify_comsat</option></entry>
43415 <entry>Use: <emphasis>appendfile</emphasis></entry>
43416 <entry>Type: <emphasis>boolean</emphasis></entry>
43417 <entry>Default: <emphasis>false</emphasis></entry>
43418 </row>
43419 </tbody>
43420 </tgroup>
43421 </informaltable>
43422 <para>
43423 If this option is true, the <emphasis>comsat</emphasis> daemon is notified after every
43424 successful delivery to a user mailbox. This is the daemon that notifies logged
43425 on users about incoming mail.
43426 </para>
43427 <para>
43428 <indexterm role="option">
43429 <primary><option>quota</option></primary>
43430 </indexterm>
43431 </para>
43432 <informaltable frame="all">
43433 <tgroup cols="4" colsep="0" rowsep="0">
43434 <colspec colwidth="8*" align="left"/>
43435 <colspec colwidth="6*" align="center"/>
43436 <colspec colwidth="6*" align="center"/>
43437 <colspec colwidth="6*" align="right"/>
43438 <tbody>
43439 <row>
43440 <entry><option>quota</option></entry>
43441 <entry>Use: <emphasis>appendfile</emphasis></entry>
43442 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43443 <entry>Default: <emphasis>unset</emphasis></entry>
43444 </row>
43445 </tbody>
43446 </tgroup>
43447 </informaltable>
43448 <para>
43449 <indexterm role="concept">
43450 <primary>quota</primary>
43451 <secondary>imposed by Exim</secondary>
43452 </indexterm>
43453 This option imposes a limit on the size of the file to which Exim is appending,
43454 or to the total space used in the directory tree when the <option>directory</option> option
43455 is set. In the latter case, computation of the space used is expensive, because
43456 all the files in the directory (and any sub-directories) have to be
43457 individually inspected and their sizes summed. (See <option>quota_size_regex</option> and
43458 <option>maildir_use_size_file</option> for ways to avoid this in environments where users
43459 have no shell access to their mailboxes).
43460 </para>
43461 <para>
43462 As there is no interlock against two simultaneous deliveries into a
43463 multi-file mailbox, it is possible for the quota to be overrun in this case.
43464 For single-file mailboxes, of course, an interlock is a necessity.
43465 </para>
43466 <para>
43467 A file&#x2019;s size is taken as its <emphasis>used</emphasis> value. Because of blocking effects, this
43468 may be a lot less than the actual amount of disk space allocated to the file.
43469 If the sizes of a number of files are being added up, the rounding effect can
43470 become quite noticeable, especially on systems that have large block sizes.
43471 Nevertheless, it seems best to stick to the <emphasis>used</emphasis> figure, because this is
43472 the obvious value which users understand most easily.
43473 </para>
43474 <para>
43475 The value of the option is expanded, and must then be a numerical value
43476 (decimal point allowed), optionally followed by one of the letters K, M, or G,
43477 for kilobytes, megabytes, or gigabytes, optionally followed by a slash
43478 and further option modifiers. If Exim is running on a system with
43479 large file support (Linux and FreeBSD have this), mailboxes larger than 2G can
43480 be handled.
43481 </para>
43482 <para>
43483 The option modifier <option>no_check</option> can be used to force delivery even if the over
43484 quota condition is met. The quota gets updated as usual.
43485 </para>
43486 <para>
43487 <emphasis role="bold">Note</emphasis>: A value of zero is interpreted as <quote>no quota</quote>.
43488 </para>
43489 <para>
43490 The expansion happens while Exim is running as root, before it changes uid for
43491 the delivery. This means that files that are inaccessible to the end user can
43492 be used to hold quota values that are looked up in the expansion. When delivery
43493 fails because this quota is exceeded, the handling of the error is as for
43494 system quota failures.
43495 </para>
43496 <para>
43497 By default, Exim&#x2019;s quota checking mimics system quotas, and restricts the
43498 mailbox to the specified maximum size, though the value is not accurate to the
43499 last byte, owing to separator lines and additional headers that may get added
43500 during message delivery. When a mailbox is nearly full, large messages may get
43501 refused even though small ones are accepted, because the size of the current
43502 message is added to the quota when the check is made. This behaviour can be
43503 changed by setting <option>quota_is_inclusive</option> false. When this is done, the check
43504 for exceeding the quota does not include the current message. Thus, deliveries
43505 continue until the quota has been exceeded; thereafter, no further messages are
43506 delivered. See also <option>quota_warn_threshold</option>.
43507 </para>
43508 <para>
43509 <indexterm role="option">
43510 <primary><option>quota_directory</option></primary>
43511 </indexterm>
43512 </para>
43513 <informaltable frame="all">
43514 <tgroup cols="4" colsep="0" rowsep="0">
43515 <colspec colwidth="8*" align="left"/>
43516 <colspec colwidth="6*" align="center"/>
43517 <colspec colwidth="6*" align="center"/>
43518 <colspec colwidth="6*" align="right"/>
43519 <tbody>
43520 <row>
43521 <entry><option>quota_directory</option></entry>
43522 <entry>Use: <emphasis>appendfile</emphasis></entry>
43523 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43524 <entry>Default: <emphasis>unset</emphasis></entry>
43525 </row>
43526 </tbody>
43527 </tgroup>
43528 </informaltable>
43529 <para>
43530 This option defines the directory to check for quota purposes when delivering
43531 into individual files. The default is the delivery directory, or, if a file
43532 called <filename>maildirfolder</filename> exists in a maildir directory, the parent of the
43533 delivery directory.
43534 </para>
43535 <para>
43536 <indexterm role="option">
43537 <primary><option>quota_filecount</option></primary>
43538 </indexterm>
43539 </para>
43540 <informaltable frame="all">
43541 <tgroup cols="4" colsep="0" rowsep="0">
43542 <colspec colwidth="8*" align="left"/>
43543 <colspec colwidth="6*" align="center"/>
43544 <colspec colwidth="6*" align="center"/>
43545 <colspec colwidth="6*" align="right"/>
43546 <tbody>
43547 <row>
43548 <entry><option>quota_filecount</option></entry>
43549 <entry>Use: <emphasis>appendfile</emphasis></entry>
43550 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43551 <entry>Default: <emphasis>0</emphasis></entry>
43552 </row>
43553 </tbody>
43554 </tgroup>
43555 </informaltable>
43556 <para>
43557 This option applies when the <option>directory</option> option is set. It limits the total
43558 number of files in the directory (compare the inode limit in system quotas). It
43559 can only be used if <option>quota</option> is also set. The value is expanded; an expansion
43560 failure causes delivery to be deferred. A value of zero is interpreted as
43561 <quote>no quota</quote>.
43562 </para>
43563 <para>
43564 The option modifier <option>no_check</option> can be used to force delivery even if the over
43565 quota condition is met. The quota gets updated as usual.
43566 </para>
43567 <para>
43568 <indexterm role="option">
43569 <primary><option>quota_is_inclusive</option></primary>
43570 </indexterm>
43571 </para>
43572 <informaltable frame="all">
43573 <tgroup cols="4" colsep="0" rowsep="0">
43574 <colspec colwidth="8*" align="left"/>
43575 <colspec colwidth="6*" align="center"/>
43576 <colspec colwidth="6*" align="center"/>
43577 <colspec colwidth="6*" align="right"/>
43578 <tbody>
43579 <row>
43580 <entry><option>quota_is_inclusive</option></entry>
43581 <entry>Use: <emphasis>appendfile</emphasis></entry>
43582 <entry>Type: <emphasis>boolean</emphasis></entry>
43583 <entry>Default: <emphasis>true</emphasis></entry>
43584 </row>
43585 </tbody>
43586 </tgroup>
43587 </informaltable>
43588 <para>
43589 See <option>quota</option> above.
43590 </para>
43591 <para>
43592 <indexterm role="option">
43593 <primary><option>quota_size_regex</option></primary>
43594 </indexterm>
43595 </para>
43596 <informaltable frame="all">
43597 <tgroup cols="4" colsep="0" rowsep="0">
43598 <colspec colwidth="8*" align="left"/>
43599 <colspec colwidth="6*" align="center"/>
43600 <colspec colwidth="6*" align="center"/>
43601 <colspec colwidth="6*" align="right"/>
43602 <tbody>
43603 <row>
43604 <entry><option>quota_size_regex</option></entry>
43605 <entry>Use: <emphasis>appendfile</emphasis></entry>
43606 <entry>Type: <emphasis>string</emphasis></entry>
43607 <entry>Default: <emphasis>unset</emphasis></entry>
43608 </row>
43609 </tbody>
43610 </tgroup>
43611 </informaltable>
43612 <para>
43613 This option applies when one of the delivery modes that writes a separate file
43614 for each message is being used. When Exim wants to find the size of one of
43615 these files in order to test the quota, it first checks <option>quota_size_regex</option>.
43616 If this is set to a regular expression that matches the filename, and it
43617 captures one string, that string is interpreted as a representation of the
43618 file&#x2019;s size. The value of <option>quota_size_regex</option> is not expanded.
43619 </para>
43620 <para>
43621 This feature is useful only when users have no shell access to their mailboxes
43622 &ndash; otherwise they could defeat the quota simply by renaming the files. This
43623 facility can be used with maildir deliveries, by setting <option>maildir_tag</option> to add
43624 the file length to the filename. For example:
43625 </para>
43626 <literallayout class="monospaced">
43627 maildir_tag = ,S=$message_size
43628 quota_size_regex = ,S=(\d+)
43629 </literallayout>
43630 <para>
43631 An alternative to <varname>$message_size</varname> is <varname>$message_linecount</varname>, which contains the
43632 number of lines in the message.
43633 </para>
43634 <para>
43635 The regular expression should not assume that the length is at the end of the
43636 filename (even though <option>maildir_tag</option> puts it there) because maildir MUAs
43637 sometimes add other information onto the ends of message filenames.
43638 </para>
43639 <para>
43640 Section <xref linkend="SECID136"/> contains further information.
43641 </para>
43642 <para>
43643 <indexterm role="option">
43644 <primary><option>quota_warn_message</option></primary>
43645 </indexterm>
43646 </para>
43647 <informaltable frame="all">
43648 <tgroup cols="4" colsep="0" rowsep="0">
43649 <colspec colwidth="8*" align="left"/>
43650 <colspec colwidth="6*" align="center"/>
43651 <colspec colwidth="6*" align="center"/>
43652 <colspec colwidth="6*" align="right"/>
43653 <tbody>
43654 <row>
43655 <entry><option>quota_warn_message</option></entry>
43656 <entry>Use: <emphasis>appendfile</emphasis></entry>
43657 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43658 <entry>Default: <emphasis>see below</emphasis></entry>
43659 </row>
43660 </tbody>
43661 </tgroup>
43662 </informaltable>
43663 <para>
43664 See below for the use of this option. If it is not set when
43665 <option>quota_warn_threshold</option> is set, it defaults to
43666 </para>
43667 <literallayout class="monospaced">
43668 quota_warn_message = "\
43669   To: $local_part@$domain\n\
43670   Subject: Your mailbox\n\n\
43671   This message is automatically created \
43672   by mail delivery software.\n\n\
43673   The size of your mailbox has exceeded \
43674   a warning threshold that is\n\
43675   set by the system administrator.\n"
43676 </literallayout>
43677 <para>
43678 <indexterm role="option">
43679 <primary><option>quota_warn_threshold</option></primary>
43680 </indexterm>
43681 </para>
43682 <informaltable frame="all">
43683 <tgroup cols="4" colsep="0" rowsep="0">
43684 <colspec colwidth="8*" align="left"/>
43685 <colspec colwidth="6*" align="center"/>
43686 <colspec colwidth="6*" align="center"/>
43687 <colspec colwidth="6*" align="right"/>
43688 <tbody>
43689 <row>
43690 <entry><option>quota_warn_threshold</option></entry>
43691 <entry>Use: <emphasis>appendfile</emphasis></entry>
43692 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43693 <entry>Default: <emphasis>0</emphasis></entry>
43694 </row>
43695 </tbody>
43696 </tgroup>
43697 </informaltable>
43698 <para>
43699 <indexterm role="concept">
43700 <primary>quota</primary>
43701 <secondary>warning threshold</secondary>
43702 </indexterm>
43703 <indexterm role="concept">
43704 <primary>mailbox</primary>
43705 <secondary>size warning</secondary>
43706 </indexterm>
43707 <indexterm role="concept">
43708 <primary>size</primary>
43709 <secondary>of mailbox</secondary>
43710 </indexterm>
43711 This option is expanded in the same way as <option>quota</option> (see above). If the
43712 resulting value is greater than zero, and delivery of the message causes the
43713 size of the file or total space in the directory tree to cross the given
43714 threshold, a warning message is sent. If <option>quota</option> is also set, the threshold
43715 may be specified as a percentage of it by following the value with a percent
43716 sign. For example:
43717 </para>
43718 <literallayout class="monospaced">
43719 quota = 10M
43720 quota_warn_threshold = 75%
43721 </literallayout>
43722 <para>
43723 If <option>quota</option> is not set, a setting of <option>quota_warn_threshold</option> that ends with a
43724 percent sign is ignored.
43725 </para>
43726 <para>
43727 The warning message itself is specified by the <option>quota_warn_message</option> option,
43728 and it must start with a <emphasis>To:</emphasis> header line containing the recipient(s) of the
43729 warning message. These do not necessarily have to include the recipient(s) of
43730 the original message. A <emphasis>Subject:</emphasis> line should also normally be supplied. You
43731 can include any other header lines that you want. If you do not include a
43732 <emphasis>From:</emphasis> line, the default is:
43733 </para>
43734 <literallayout class="monospaced">
43735 From: Mail Delivery System &lt;mailer-daemon@$qualify_domain_sender&gt;
43736 </literallayout>
43737 <para>
43738 <indexterm role="option">
43739 <primary><option>errors_reply_to</option></primary>
43740 </indexterm>
43741 If you supply a <emphasis>Reply-To:</emphasis> line, it overrides the global <option>errors_reply_to</option>
43742 option.
43743 </para>
43744 <para>
43745 The <option>quota</option> option does not have to be set in order to use this option; they
43746 are independent of one another except when the threshold is specified as a
43747 percentage.
43748 </para>
43749 <para>
43750 <indexterm role="option">
43751 <primary><option>use_bsmtp</option></primary>
43752 </indexterm>
43753 </para>
43754 <informaltable frame="all">
43755 <tgroup cols="4" colsep="0" rowsep="0">
43756 <colspec colwidth="8*" align="left"/>
43757 <colspec colwidth="6*" align="center"/>
43758 <colspec colwidth="6*" align="center"/>
43759 <colspec colwidth="6*" align="right"/>
43760 <tbody>
43761 <row>
43762 <entry><option>use_bsmtp</option></entry>
43763 <entry>Use: <emphasis>appendfile</emphasis></entry>
43764 <entry>Type: <emphasis>boolean</emphasis></entry>
43765 <entry>Default: <emphasis>false</emphasis></entry>
43766 </row>
43767 </tbody>
43768 </tgroup>
43769 </informaltable>
43770 <para>
43771 <indexterm role="concept">
43772 <primary>envelope sender</primary>
43773 </indexterm>
43774 If this option is set true, <command>appendfile</command> writes messages in <quote>batch SMTP</quote>
43775 format, with the envelope sender and recipient(s) included as SMTP commands. If
43776 you want to include a leading HELO command with such messages, you can do
43777 so by setting the <option>message_prefix</option> option. See section <xref linkend="SECTbatchSMTP"/>
43778 for details of batch SMTP.
43779 </para>
43780 <para>
43781 <indexterm role="option">
43782 <primary><option>use_crlf</option></primary>
43783 </indexterm>
43784 </para>
43785 <informaltable frame="all">
43786 <tgroup cols="4" colsep="0" rowsep="0">
43787 <colspec colwidth="8*" align="left"/>
43788 <colspec colwidth="6*" align="center"/>
43789 <colspec colwidth="6*" align="center"/>
43790 <colspec colwidth="6*" align="right"/>
43791 <tbody>
43792 <row>
43793 <entry><option>use_crlf</option></entry>
43794 <entry>Use: <emphasis>appendfile</emphasis></entry>
43795 <entry>Type: <emphasis>boolean</emphasis></entry>
43796 <entry>Default: <emphasis>false</emphasis></entry>
43797 </row>
43798 </tbody>
43799 </tgroup>
43800 </informaltable>
43801 <para>
43802 <indexterm role="concept">
43803 <primary>carriage return</primary>
43804 </indexterm>
43805 <indexterm role="concept">
43806 <primary>linefeed</primary>
43807 </indexterm>
43808 This option causes lines to be terminated with the two-character CRLF sequence
43809 (carriage return, linefeed) instead of just a linefeed character. In the case
43810 of batched SMTP, the byte sequence written to the file is then an exact image
43811 of what would be sent down a real SMTP connection.
43812 </para>
43813 <para>
43814 <emphasis role="bold">Note:</emphasis> The contents of the <option>message_prefix</option> and <option>message_suffix</option> options
43815 (which are used to supply the traditional <quote>From&nbsp;</quote> and blank line separators
43816 in Berkeley-style mailboxes) are written verbatim, so must contain their own
43817 carriage return characters if these are needed. In cases where these options
43818 have non-empty defaults, the values end with a single linefeed, so they must be
43819 changed to end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
43820 </para>
43821 <para>
43822 <indexterm role="option">
43823 <primary><option>use_fcntl_lock</option></primary>
43824 </indexterm>
43825 </para>
43826 <informaltable frame="all">
43827 <tgroup cols="4" colsep="0" rowsep="0">
43828 <colspec colwidth="8*" align="left"/>
43829 <colspec colwidth="6*" align="center"/>
43830 <colspec colwidth="6*" align="center"/>
43831 <colspec colwidth="6*" align="right"/>
43832 <tbody>
43833 <row>
43834 <entry><option>use_fcntl_lock</option></entry>
43835 <entry>Use: <emphasis>appendfile</emphasis></entry>
43836 <entry>Type: <emphasis>boolean</emphasis></entry>
43837 <entry>Default: <emphasis>see below</emphasis></entry>
43838 </row>
43839 </tbody>
43840 </tgroup>
43841 </informaltable>
43842 <para>
43843 This option controls the use of the <function>fcntl()</function> function to lock a file for
43844 exclusive use when a message is being appended. It is set by default unless
43845 <option>use_flock_lock</option> is set. Otherwise, it should be turned off only if you know
43846 that all your MUAs use lock file locking. When both <option>use_fcntl_lock</option> and
43847 <option>use_flock_lock</option> are unset, <option>use_lockfile</option> must be set.
43848 </para>
43849 <para>
43850 <indexterm role="option">
43851 <primary><option>use_flock_lock</option></primary>
43852 </indexterm>
43853 </para>
43854 <informaltable frame="all">
43855 <tgroup cols="4" colsep="0" rowsep="0">
43856 <colspec colwidth="8*" align="left"/>
43857 <colspec colwidth="6*" align="center"/>
43858 <colspec colwidth="6*" align="center"/>
43859 <colspec colwidth="6*" align="right"/>
43860 <tbody>
43861 <row>
43862 <entry><option>use_flock_lock</option></entry>
43863 <entry>Use: <emphasis>appendfile</emphasis></entry>
43864 <entry>Type: <emphasis>boolean</emphasis></entry>
43865 <entry>Default: <emphasis>false</emphasis></entry>
43866 </row>
43867 </tbody>
43868 </tgroup>
43869 </informaltable>
43870 <para>
43871 This option is provided to support the use of <function>flock()</function> for file locking, for
43872 the few situations where it is needed. Most modern operating systems support
43873 <function>fcntl()</function> and <function>lockf()</function> locking, and these two functions interwork with
43874 each other. Exim uses <function>fcntl()</function> locking by default.
43875 </para>
43876 <para>
43877 This option is required only if you are using an operating system where
43878 <function>flock()</function> is used by programs that access mailboxes (typically MUAs), and
43879 where <function>flock()</function> does not correctly interwork with <function>fcntl()</function>. You can use
43880 both <function>fcntl()</function> and <function>flock()</function> locking simultaneously if you want.
43881 </para>
43882 <para>
43883 <indexterm role="concept">
43884 <primary>Solaris</primary>
43885 <secondary><function>flock()</function> support</secondary>
43886 </indexterm>
43887 Not all operating systems provide <function>flock()</function>. Some versions of Solaris do not
43888 have it (and some, I think, provide a not quite right version built on top of
43889 <function>lockf()</function>). If the OS does not have <function>flock()</function>, Exim will be built without
43890 the ability to use it, and any attempt to do so will cause a configuration
43891 error.
43892 </para>
43893 <para>
43894 <emphasis role="bold">Warning</emphasis>: <function>flock()</function> locks do not work on NFS files (unless <function>flock()</function>
43895 is just being mapped onto <function>fcntl()</function> by the OS).
43896 </para>
43897 <para>
43898 <indexterm role="option">
43899 <primary><option>use_lockfile</option></primary>
43900 </indexterm>
43901 </para>
43902 <informaltable frame="all">
43903 <tgroup cols="4" colsep="0" rowsep="0">
43904 <colspec colwidth="8*" align="left"/>
43905 <colspec colwidth="6*" align="center"/>
43906 <colspec colwidth="6*" align="center"/>
43907 <colspec colwidth="6*" align="right"/>
43908 <tbody>
43909 <row>
43910 <entry><option>use_lockfile</option></entry>
43911 <entry>Use: <emphasis>appendfile</emphasis></entry>
43912 <entry>Type: <emphasis>boolean</emphasis></entry>
43913 <entry>Default: <emphasis>see below</emphasis></entry>
43914 </row>
43915 </tbody>
43916 </tgroup>
43917 </informaltable>
43918 <para>
43919 If this option is turned off, Exim does not attempt to create a lock file when
43920 appending to a mailbox file. In this situation, the only locking is by
43921 <function>fcntl()</function>. You should only turn <option>use_lockfile</option> off if you are absolutely
43922 sure that every MUA that is ever going to look at your users&#x2019; mailboxes uses
43923 <function>fcntl()</function> rather than a lock file, and even then only when you are not
43924 delivering over NFS from more than one host.
43925 </para>
43926 <para>
43927 <indexterm role="concept">
43928 <primary>NFS</primary>
43929 <secondary>lock file</secondary>
43930 </indexterm>
43931 In order to append to an NFS file safely from more than one host, it is
43932 necessary to take out a lock <emphasis>before</emphasis> opening the file, and the lock file
43933 achieves this. Otherwise, even with <function>fcntl()</function> locking, there is a risk of
43934 file corruption.
43935 </para>
43936 <para>
43937 The <option>use_lockfile</option> option is set by default unless <option>use_mbx_lock</option> is set.
43938 It is not possible to turn both <option>use_lockfile</option> and <option>use_fcntl_lock</option> off,
43939 except when <option>mbx_format</option> is set.
43940 </para>
43941 <para>
43942 <indexterm role="option">
43943 <primary><option>use_mbx_lock</option></primary>
43944 </indexterm>
43945 </para>
43946 <informaltable frame="all">
43947 <tgroup cols="4" colsep="0" rowsep="0">
43948 <colspec colwidth="8*" align="left"/>
43949 <colspec colwidth="6*" align="center"/>
43950 <colspec colwidth="6*" align="center"/>
43951 <colspec colwidth="6*" align="right"/>
43952 <tbody>
43953 <row>
43954 <entry><option>use_mbx_lock</option></entry>
43955 <entry>Use: <emphasis>appendfile</emphasis></entry>
43956 <entry>Type: <emphasis>boolean</emphasis></entry>
43957 <entry>Default: <emphasis>see below</emphasis></entry>
43958 </row>
43959 </tbody>
43960 </tgroup>
43961 </informaltable>
43962 <para>
43963 This option is available only if Exim has been compiled with SUPPORT_MBX
43964 set in <filename>Local/Makefile</filename>. Setting the option specifies that special MBX
43965 locking rules be used. It is set by default if <option>mbx_format</option> is set and none
43966 of the locking options are mentioned in the configuration. The locking rules
43967 are the same as are used by the <emphasis>c-client</emphasis> library that underlies Pine and
43968 the IMAP4 and POP daemons that come with it (see the discussion below). The
43969 rules allow for shared access to the mailbox. However, this kind of locking
43970 does not work when the mailbox is NFS mounted.
43971 </para>
43972 <para>
43973 You can set <option>use_mbx_lock</option> with either (or both) of <option>use_fcntl_lock</option> and
43974 <option>use_flock_lock</option> to control what kind of locking is used in implementing the
43975 MBX locking rules. The default is to use <function>fcntl()</function> if <option>use_mbx_lock</option> is set
43976 without <option>use_fcntl_lock</option> or <option>use_flock_lock</option>.
43977 </para>
43978 </section>
43979 <section id="SECTopappend">
43980 <title>Operational details for appending</title>
43981 <para>
43982 <indexterm role="concept">
43983 <primary>appending to a file</primary>
43984 </indexterm>
43985 <indexterm role="concept">
43986 <primary>file</primary>
43987 <secondary>appending</secondary>
43988 </indexterm>
43989 Before appending to a file, the following preparations are made:
43990 </para>
43991 <itemizedlist>
43992 <listitem>
43993 <para>
43994 If the name of the file is <filename>/dev/null</filename>, no action is taken, and a success
43995 return is given.
43996 </para>
43997 </listitem>
43998 <listitem>
43999 <para>
44000 <indexterm role="concept">
44001 <primary>directory creation</primary>
44002 </indexterm>
44003 If any directories on the file&#x2019;s path are missing, Exim creates them if the
44004 <option>create_directory</option> option is set. A created directory&#x2019;s mode is given by the
44005 <option>directory_mode</option> option.
44006 </para>
44007 </listitem>
44008 <listitem>
44009 <para>
44010 If <option>file_format</option> is set, the format of an existing file is checked. If this
44011 indicates that a different transport should be used, control is passed to that
44012 transport.
44013 </para>
44014 </listitem>
44015 <listitem>
44016 <para>
44017 <indexterm role="concept">
44018 <primary>file</primary>
44019 <secondary>locking</secondary>
44020 </indexterm>
44021 <indexterm role="concept">
44022 <primary>locking files</primary>
44023 </indexterm>
44024 <indexterm role="concept">
44025 <primary>NFS</primary>
44026 <secondary>lock file</secondary>
44027 </indexterm>
44028 If <option>use_lockfile</option> is set, a lock file is built in a way that will work
44029 reliably over NFS, as follows:
44030 </para>
44031 <orderedlist numeration="arabic">
44032 <listitem>
44033 <para>
44034 Create a <quote>hitching post</quote> file whose name is that of the lock file with the
44035 current time, primary host name, and process id added, by opening for writing
44036 as a new file. If this fails with an access error, delivery is deferred.
44037 </para>
44038 </listitem>
44039 <listitem>
44040 <para>
44041 Close the hitching post file, and hard link it to the lock filename.
44042 </para>
44043 </listitem>
44044 <listitem>
44045 <para>
44046 If the call to <function>link()</function> succeeds, creation of the lock file has succeeded.
44047 Unlink the hitching post name.
44048 </para>
44049 </listitem>
44050 <listitem>
44051 <para>
44052 Otherwise, use <function>stat()</function> to get information about the hitching post file, and
44053 then unlink hitching post name. If the number of links is exactly two, creation
44054 of the lock file succeeded but something (for example, an NFS server crash and
44055 restart) caused this fact not to be communicated to the <function>link()</function> call.
44056 </para>
44057 </listitem>
44058 <listitem>
44059 <para>
44060 If creation of the lock file failed, wait for <option>lock_interval</option> and try again,
44061 up to <option>lock_retries</option> times. However, since any program that writes to a
44062 mailbox should complete its task very quickly, it is reasonable to time out old
44063 lock files that are normally the result of user agent and system crashes. If an
44064 existing lock file is older than <option>lockfile_timeout</option> Exim attempts to unlink
44065 it before trying again.
44066 </para>
44067 </listitem>
44068 </orderedlist>
44069 </listitem>
44070 <listitem>
44071 <para>
44072 A call is made to <function>lstat()</function> to discover whether the main file exists, and if
44073 so, what its characteristics are. If <function>lstat()</function> fails for any reason other
44074 than non-existence, delivery is deferred.
44075 </para>
44076 </listitem>
44077 <listitem>
44078 <para>
44079 <indexterm role="concept">
44080 <primary>symbolic link</primary>
44081 <secondary>to mailbox</secondary>
44082 </indexterm>
44083 <indexterm role="concept">
44084 <primary>mailbox</primary>
44085 <secondary>symbolic link</secondary>
44086 </indexterm>
44087 If the file does exist and is a symbolic link, delivery is deferred, unless the
44088 <option>allow_symlink</option> option is set, in which case the ownership of the link is
44089 checked, and then <function>stat()</function> is called to find out about the real file, which
44090 is then subjected to the checks below. The check on the top-level link
44091 ownership prevents one user creating a link for another&#x2019;s mailbox in a sticky
44092 directory, though allowing symbolic links in this case is definitely not a good
44093 idea. If there is a chain of symbolic links, the intermediate ones are not
44094 checked.
44095 </para>
44096 </listitem>
44097 <listitem>
44098 <para>
44099 If the file already exists but is not a regular file, or if the file&#x2019;s owner
44100 and group (if the group is being checked &ndash; see <option>check_group</option> above) are
44101 different from the user and group under which the delivery is running,
44102 delivery is deferred.
44103 </para>
44104 </listitem>
44105 <listitem>
44106 <para>
44107 If the file&#x2019;s permissions are more generous than specified, they are reduced.
44108 If they are insufficient, delivery is deferred, unless <option>mode_fail_narrower</option>
44109 is set false, in which case the delivery is tried using the existing
44110 permissions.
44111 </para>
44112 </listitem>
44113 <listitem>
44114 <para>
44115 The file&#x2019;s inode number is saved, and the file is then opened for appending.
44116 If this fails because the file has vanished, <command>appendfile</command> behaves as if it
44117 hadn&#x2019;t existed (see below). For any other failures, delivery is deferred.
44118 </para>
44119 </listitem>
44120 <listitem>
44121 <para>
44122 If the file is opened successfully, check that the inode number hasn&#x2019;t
44123 changed, that it is still a regular file, and that the owner and permissions
44124 have not changed. If anything is wrong, defer delivery and freeze the message.
44125 </para>
44126 </listitem>
44127 <listitem>
44128 <para>
44129 If the file did not exist originally, defer delivery if the <option>file_must_exist</option>
44130 option is set. Otherwise, check that the file is being created in a permitted
44131 directory if the <option>create_file</option> option is set (deferring on failure), and then
44132 open for writing as a new file, with the O_EXCL and O_CREAT options,
44133 except when dealing with a symbolic link (the <option>allow_symlink</option> option must be
44134 set). In this case, which can happen if the link points to a non-existent file,
44135 the file is opened for writing using O_CREAT but not O_EXCL, because
44136 that prevents link following.
44137 </para>
44138 </listitem>
44139 <listitem>
44140 <para>
44141 <indexterm role="concept">
44142 <primary>loop</primary>
44143 <secondary>while file testing</secondary>
44144 </indexterm>
44145 If opening fails because the file exists, obey the tests given above for
44146 existing files. However, to avoid looping in a situation where the file is
44147 being continuously created and destroyed, the exists/not-exists loop is broken
44148 after 10 repetitions, and the message is then frozen.
44149 </para>
44150 </listitem>
44151 <listitem>
44152 <para>
44153 If opening fails with any other error, defer delivery.
44154 </para>
44155 </listitem>
44156 <listitem>
44157 <para>
44158 <indexterm role="concept">
44159 <primary>file</primary>
44160 <secondary>locking</secondary>
44161 </indexterm>
44162 <indexterm role="concept">
44163 <primary>locking files</primary>
44164 </indexterm>
44165 Once the file is open, unless both <option>use_fcntl_lock</option> and <option>use_flock_lock</option>
44166 are false, it is locked using <function>fcntl()</function> or <function>flock()</function> or both. If
44167 <option>use_mbx_lock</option> is false, an exclusive lock is requested in each case.
44168 However, if <option>use_mbx_lock</option> is true, Exim takes out a shared lock on the open
44169 file, and an exclusive lock on the file whose name is
44170 </para>
44171 <literallayout class="monospaced">
44172 /tmp/.&lt;device-number&gt;.&lt;inode-number&gt;
44173 </literallayout>
44174 <para>
44175 using the device and inode numbers of the open mailbox file, in accordance with
44176 the MBX locking rules. This file is created with a mode that is specified by
44177 the <option>lockfile_mode</option> option.
44178 </para>
44179 <para>
44180 If Exim fails to lock the file, there are two possible courses of action,
44181 depending on the value of the locking timeout. This is obtained from
44182 <option>lock_fcntl_timeout</option> or <option>lock_flock_timeout</option>, as appropriate.
44183 </para>
44184 <para>
44185 If the timeout value is zero, the file is closed, Exim waits for
44186 <option>lock_interval</option>, and then goes back and re-opens the file as above and tries
44187 to lock it again. This happens up to <option>lock_retries</option> times, after which the
44188 delivery is deferred.
44189 </para>
44190 <para>
44191 If the timeout has a value greater than zero, blocking calls to <function>fcntl()</function> or
44192 <function>flock()</function> are used (with the given timeout), so there has already been some
44193 waiting involved by the time locking fails. Nevertheless, Exim does not give up
44194 immediately. It retries up to
44195 </para>
44196 <literallayout class="monospaced">
44197 (lock_retries * lock_interval) / &lt;timeout&gt;
44198 </literallayout>
44199 <para>
44200 times (rounded up).
44201 </para>
44202 </listitem>
44203 </itemizedlist>
44204 <para>
44205 At the end of delivery, Exim closes the file (which releases the <function>fcntl()</function>
44206 and/or <function>flock()</function> locks) and then deletes the lock file if one was created.
44207 </para>
44208 </section>
44209 <section id="SECTopdir">
44210 <title>Operational details for delivery to a new file</title>
44211 <para>
44212 <indexterm role="concept">
44213 <primary>delivery</primary>
44214 <secondary>to single file</secondary>
44215 </indexterm>
44216 <indexterm role="concept">
44217 <primary><quote>From</quote> line</primary>
44218 </indexterm>
44219 When the <option>directory</option> option is set instead of <option>file</option>, each message is
44220 delivered into a newly-created file or set of files. When <command>appendfile</command> is
44221 activated directly from a <command>redirect</command> router, neither <option>file</option> nor
44222 <option>directory</option> is normally set, because the path for delivery is supplied by the
44223 router. (See for example, the <command>address_file</command> transport in the default
44224 configuration.) In this case, delivery is to a new file if either the path name
44225 ends in <literal>/</literal>, or the <option>maildir_format</option> or <option>mailstore_format</option> option is set.
44226 </para>
44227 <para>
44228 No locking is required while writing the message to a new file, so the various
44229 locking options of the transport are ignored. The <quote>From</quote> line that by default
44230 separates messages in a single file is not normally needed, nor is the escaping
44231 of message lines that start with <quote>From</quote>, and there is no need to ensure a
44232 newline at the end of each message. Consequently, the default values for
44233 <option>check_string</option>, <option>message_prefix</option>, and <option>message_suffix</option> are all unset when
44234 any of <option>directory</option>, <option>maildir_format</option>, or <option>mailstore_format</option> is set.
44235 </para>
44236 <para>
44237 If Exim is required to check a <option>quota</option> setting, it adds up the sizes of all
44238 the files in the delivery directory by default. However, you can specify a
44239 different directory by setting <option>quota_directory</option>. Also, for maildir
44240 deliveries (see below) the <filename>maildirfolder</filename> convention is honoured.
44241 </para>
44242 <para>
44243 <indexterm role="concept">
44244 <primary>maildir format</primary>
44245 </indexterm>
44246 <indexterm role="concept">
44247 <primary>mailstore format</primary>
44248 </indexterm>
44249 There are three different ways in which delivery to individual files can be
44250 done, controlled by the settings of the <option>maildir_format</option> and
44251 <option>mailstore_format</option> options. Note that code to support maildir or mailstore
44252 formats is not included in the binary unless SUPPORT_MAILDIR or
44253 SUPPORT_MAILSTORE, respectively, is set in <filename>Local/Makefile</filename>.
44254 </para>
44255 <para>
44256 <indexterm role="concept">
44257 <primary>directory creation</primary>
44258 </indexterm>
44259 In all three cases an attempt is made to create the directory and any necessary
44260 sub-directories if they do not exist, provided that the <option>create_directory</option>
44261 option is set (the default). The location of a created directory can be
44262 constrained by setting <option>create_file</option>. A created directory&#x2019;s mode is given by
44263 the <option>directory_mode</option> option. If creation fails, or if the
44264 <option>create_directory</option> option is not set when creation is required, delivery is
44265 deferred.
44266 </para>
44267 </section>
44268 <section id="SECTmaildirdelivery">
44269 <title>Maildir delivery</title>
44270 <para>
44271 <indexterm role="concept">
44272 <primary>maildir format</primary>
44273 <secondary>description of</secondary>
44274 </indexterm>
44275 If the <option>maildir_format</option> option is true, Exim delivers each message by writing
44276 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
44277 directory that is defined by the <option>directory</option> option (the <quote>delivery
44278 directory</quote>). If the delivery is successful, the file is renamed into the
44279 <filename>new</filename> subdirectory.
44280 </para>
44281 <para>
44282 In the filename, &lt;<emphasis>stime</emphasis>&gt; is the current time of day in seconds, and
44283 &lt;<emphasis>mtime</emphasis>&gt; is the microsecond fraction of the time. After a maildir delivery,
44284 Exim checks that the time-of-day clock has moved on by at least one microsecond
44285 before terminating the delivery process. This guarantees uniqueness for the
44286 filename. However, as a precaution, Exim calls <function>stat()</function> for the file before
44287 opening it. If any response other than ENOENT (does not exist) is given,
44288 Exim waits 2 seconds and tries again, up to <option>maildir_retries</option> times.
44289 </para>
44290 <para>
44291 Before Exim carries out a maildir delivery, it ensures that subdirectories
44292 called <filename>new</filename>, <filename>cur</filename>, and <filename>tmp</filename> exist in the delivery directory. If they
44293 do not exist, Exim tries to create them and any superior directories in their
44294 path, subject to the <option>create_directory</option> and <option>create_file</option> options. If the
44295 <option>maildirfolder_create_regex</option> option is set, and the regular expression it
44296 contains matches the delivery directory, Exim also ensures that a file called
44297 <filename>maildirfolder</filename> exists in the delivery directory. If a missing directory or
44298 <filename>maildirfolder</filename> file cannot be created, delivery is deferred.
44299 </para>
44300 <para>
44301 These features make it possible to use Exim to create all the necessary files
44302 and directories in a maildir mailbox, including subdirectories for maildir++
44303 folders. Consider this example:
44304 </para>
44305 <literallayout class="monospaced">
44306 maildir_format = true
44307 directory = /var/mail/$local_part\
44308            ${if eq{$local_part_suffix}{}{}\
44309            {/.${substr_1:$local_part_suffix}}}
44310 maildirfolder_create_regex = /\.[^/]+$
44311 </literallayout>
44312 <para>
44313 If <varname>$local_part_suffix</varname> is empty (there was no suffix for the local part),
44314 delivery is into a toplevel maildir with a name like <filename>/var/mail/pimbo</filename> (for
44315 the user called <emphasis>pimbo</emphasis>). The pattern in <option>maildirfolder_create_regex</option> does
44316 not match this name, so Exim will not look for or create the file
44317 <filename>/var/mail/pimbo/maildirfolder</filename>, though it will create
44318 <filename>/var/mail/pimbo/{cur,new,tmp}</filename> if necessary.
44319 </para>
44320 <para>
44321 However, if <varname>$local_part_suffix</varname> contains <literal>-eximusers</literal> (for example),
44322 delivery is into the maildir++ folder <filename>/var/mail/pimbo/.eximusers</filename>, which
44323 does match <option>maildirfolder_create_regex</option>. In this case, Exim will create
44324 <filename>/var/mail/pimbo/.eximusers/maildirfolder</filename> as well as the three maildir
44325 directories <filename>/var/mail/pimbo/.eximusers/{cur,new,tmp}</filename>.
44326 </para>
44327 <para>
44328 <emphasis role="bold">Warning:</emphasis> Take care when setting <option>maildirfolder_create_regex</option> that it does
44329 not inadvertently match the toplevel maildir directory, because a
44330 <filename>maildirfolder</filename> file at top level would completely break quota calculations.
44331 </para>
44332 <para>
44333 <indexterm role="concept">
44334 <primary>quota</primary>
44335 <secondary>in maildir delivery</secondary>
44336 </indexterm>
44337 <indexterm role="concept">
44338 <primary>maildir++</primary>
44339 </indexterm>
44340 If Exim is required to check a <option>quota</option> setting before a maildir delivery, and
44341 <option>quota_directory</option> is not set, it looks for a file called <filename>maildirfolder</filename> in
44342 the maildir directory (alongside <filename>new</filename>, <filename>cur</filename>, <filename>tmp</filename>). If this exists,
44343 Exim assumes the directory is a maildir++ folder directory, which is one level
44344 down from the user&#x2019;s top level mailbox directory. This causes it to start at
44345 the parent directory instead of the current directory when calculating the
44346 amount of space used.
44347 </para>
44348 <para>
44349 One problem with delivering into a multi-file mailbox is that it is
44350 computationally expensive to compute the size of the mailbox for quota
44351 checking. Various approaches have been taken to reduce the amount of work
44352 needed. The next two sections describe two of them. A third alternative is to
44353 use some external process for maintaining the size data, and use the expansion
44354 of the <option>mailbox_size</option> option as a way of importing it into Exim.
44355 </para>
44356 </section>
44357 <section id="SECID135">
44358 <title>Using tags to record message sizes</title>
44359 <para>
44360 If <option>maildir_tag</option> is set, the string is expanded for each delivery.
44361 When the maildir file is renamed into the <filename>new</filename> sub-directory, the
44362 tag is added to its name. However, if adding the tag takes the length of the
44363 name to the point where the test <function>stat()</function> call fails with ENAMETOOLONG,
44364 the tag is dropped and the maildir file is created with no tag.
44365 </para>
44366 <para>
44367 <indexterm role="variable">
44368 <primary><varname>$message_size</varname></primary>
44369 </indexterm>
44370 Tags can be used to encode the size of files in their names; see
44371 <option>quota_size_regex</option> above for an example. The expansion of <option>maildir_tag</option>
44372 happens after the message has been written. The value of the <varname>$message_size</varname>
44373 variable is set to the number of bytes actually written. If the expansion is
44374 forced to fail, the tag is ignored, but a non-forced failure causes delivery to
44375 be deferred. The expanded tag may contain any printing characters except <quote>/</quote>.
44376 Non-printing characters in the string are ignored; if the resulting string is
44377 empty, it is ignored. If it starts with an alphanumeric character, a leading
44378 colon is inserted; this default has not proven to be the path that popular
44379 maildir implementations have chosen (but changing it in Exim would break
44380 backwards compatibility).
44381 </para>
44382 <para>
44383 For one common implementation, you might set:
44384 </para>
44385 <literallayout class="monospaced">
44386 maildir_tag = ,S=${message_size}
44387 </literallayout>
44388 <para>
44389 but you should check the documentation of the other software to be sure.
44390 </para>
44391 <para>
44392 It is advisable to also set <option>quota_size_regex</option> when setting <option>maildir_tag</option>
44393 as this allows Exim to extract the size from your tag, instead of having to
44394 <function>stat()</function> each message file.
44395 </para>
44396 </section>
44397 <section id="SECID136">
44398 <title>Using a maildirsize file</title>
44399 <para>
44400 <indexterm role="concept">
44401 <primary>quota</primary>
44402 <secondary>in maildir delivery</secondary>
44403 </indexterm>
44404 <indexterm role="concept">
44405 <primary>maildir format</primary>
44406 <secondary><filename>maildirsize</filename> file</secondary>
44407 </indexterm>
44408 If <option>maildir_use_size_file</option> is true, Exim implements the maildir++ rules for
44409 storing quota and message size information in a file called <filename>maildirsize</filename>
44410 within the toplevel maildir directory. If this file does not exist, Exim
44411 creates it, setting the quota from the <option>quota</option> option of the transport. If
44412 the maildir directory itself does not exist, it is created before any attempt
44413 to write a <filename>maildirsize</filename> file.
44414 </para>
44415 <para>
44416 The <filename>maildirsize</filename> file is used to hold information about the sizes of
44417 messages in the maildir, thus speeding up quota calculations. The quota value
44418 in the file is just a cache; if the quota is changed in the transport, the new
44419 value overrides the cached value when the next message is delivered. The cache
44420 is maintained for the benefit of other programs that access the maildir and
44421 need to know the quota.
44422 </para>
44423 <para>
44424 If the <option>quota</option> option in the transport is unset or zero, the <filename>maildirsize</filename>
44425 file is maintained (with a zero quota setting), but no quota is imposed.
44426 </para>
44427 <para>
44428 A regular expression is available for controlling which directories in the
44429 maildir participate in quota calculations when a <filename>maildirsizefile</filename> is in use.
44430 See the description of the <option>maildir_quota_directory_regex</option> option above for
44431 details.
44432 </para>
44433 </section>
44434 <section id="SECID137">
44435 <title>Mailstore delivery</title>
44436 <para>
44437 <indexterm role="concept">
44438 <primary>mailstore format</primary>
44439 <secondary>description of</secondary>
44440 </indexterm>
44441 If the <option>mailstore_format</option> option is true, each message is written as two
44442 files in the given directory. A unique base name is constructed from the
44443 message id and the current delivery process, and the files that are written use
44444 this base name plus the suffixes <filename>.env</filename> and <filename>.msg</filename>. The <filename>.env</filename> file
44445 contains the message&#x2019;s envelope, and the <filename>.msg</filename> file contains the message
44446 itself. The base name is placed in the variable <varname>$mailstore_basename</varname>.
44447 </para>
44448 <para>
44449 During delivery, the envelope is first written to a file with the suffix
44450 <filename>.tmp</filename>. The <filename>.msg</filename> file is then written, and when it is complete, the
44451 <filename>.tmp</filename> file is renamed as the <filename>.env</filename> file. Programs that access messages in
44452 mailstore format should wait for the presence of both a <filename>.msg</filename> and a <filename>.env</filename>
44453 file before accessing either of them. An alternative approach is to wait for
44454 the absence of a <filename>.tmp</filename> file.
44455 </para>
44456 <para>
44457 The envelope file starts with any text defined by the <option>mailstore_prefix</option>
44458 option, expanded and terminated by a newline if there isn&#x2019;t one. Then follows
44459 the sender address on one line, then all the recipient addresses, one per line.
44460 There can be more than one recipient only if the <option>batch_max</option> option is set
44461 greater than one. Finally, <option>mailstore_suffix</option> is expanded and the result
44462 appended to the file, followed by a newline if it does not end with one.
44463 </para>
44464 <para>
44465 If expansion of <option>mailstore_prefix</option> or <option>mailstore_suffix</option> ends with a forced
44466 failure, it is ignored. Other expansion errors are treated as serious
44467 configuration errors, and delivery is deferred. The variable
44468 <varname>$mailstore_basename</varname> is available for use during these expansions.
44469 </para>
44470 </section>
44471 <section id="SECID138">
44472 <title>Non-special new file delivery</title>
44473 <para>
44474 If neither <option>maildir_format</option> nor <option>mailstore_format</option> is set, a single new
44475 file is created directly in the named directory. For example, when delivering
44476 messages into files in batched SMTP format for later delivery to some host (see
44477 section <xref linkend="SECTbatchSMTP"/>), a setting such as
44478 </para>
44479 <literallayout class="monospaced">
44480 directory = /var/bsmtp/$host
44481 </literallayout>
44482 <para>
44483 might be used. A message is written to a file with a temporary name, which is
44484 then renamed when the delivery is complete. The final name is obtained by
44485 expanding the contents of the <option>directory_file</option> option.
44486 <indexterm role="concept" startref="IIDapptra1" class="endofrange"/>
44487 <indexterm role="concept" startref="IIDapptra2" class="endofrange"/>
44488 </para>
44489 </section>
44490 </chapter>
44491
44492 <chapter id="CHID8">
44493 <title>The autoreply transport</title>
44494 <para>
44495 <indexterm role="concept" id="IIDauttra1" class="startofrange">
44496 <primary>transports</primary>
44497 <secondary><command>autoreply</command></secondary>
44498 </indexterm>
44499 <indexterm role="concept" id="IIDauttra2" class="startofrange">
44500 <primary><command>autoreply</command> transport</primary>
44501 </indexterm>
44502 The <command>autoreply</command> transport is not a true transport in that it does not cause
44503 the message to be transmitted. Instead, it generates a new mail message as an
44504 automatic reply to the incoming message. <emphasis>References:</emphasis> and
44505 <emphasis>Auto-Submitted:</emphasis> header lines are included. These are constructed according
44506 to the rules in RFCs 2822 and 3834, respectively.
44507 </para>
44508 <para>
44509 If the router that passes the message to this transport does not have the
44510 <option>unseen</option> option set, the original message (for the current recipient) is not
44511 delivered anywhere. However, when the <option>unseen</option> option is set on the router
44512 that passes the message to this transport, routing of the address continues, so
44513 another router can set up a normal message delivery.
44514 </para>
44515 <para>
44516 The <command>autoreply</command> transport is usually run as the result of mail filtering, a
44517 <quote>vacation</quote> message being the standard example. However, it can also be run
44518 directly from a router like any other transport. To reduce the possibility of
44519 message cascades, messages created by the <command>autoreply</command> transport always have
44520 empty envelope sender addresses, like bounce messages.
44521 </para>
44522 <para>
44523 The parameters of the message to be sent can be specified in the configuration
44524 by options described below. However, these are used only when the address
44525 passed to the transport does not contain its own reply information. When the
44526 transport is run as a consequence of a
44527 <option>mail</option>
44528 or <option>vacation</option> command in a filter file, the parameters of the message are
44529 supplied by the filter, and passed with the address. The transport&#x2019;s options
44530 that define the message are then ignored (so they are not usually set in this
44531 case). The message is specified entirely by the filter or by the transport; it
44532 is never built from a mixture of options. However, the <option>file_optional</option>,
44533 <option>mode</option>, and <option>return_message</option> options apply in all cases.
44534 </para>
44535 <para>
44536 <command>Autoreply</command> is implemented as a local transport. When used as a result of a
44537 command in a user&#x2019;s filter file, <command>autoreply</command> normally runs under the uid and
44538 gid of the user, and with appropriate current and home directories (see chapter
44539 <xref linkend="CHAPenvironment"/>).
44540 </para>
44541 <para>
44542 There is a subtle difference between routing a message to a <command>pipe</command> transport
44543 that generates some text to be returned to the sender, and routing it to an
44544 <command>autoreply</command> transport. This difference is noticeable only if more than one
44545 address from the same message is so handled. In the case of a pipe, the
44546 separate outputs from the different addresses are gathered up and returned to
44547 the sender in a single message, whereas if <command>autoreply</command> is used, a separate
44548 message is generated for each address that is passed to it.
44549 </para>
44550 <para>
44551 Non-printing characters are not permitted in the header lines generated for the
44552 message that <command>autoreply</command> creates, with the exception of newlines that are
44553 immediately followed by white space. If any non-printing characters are found,
44554 the transport defers.
44555 Whether characters with the top bit set count as printing characters or not is
44556 controlled by the <option>print_topbitchars</option> global option.
44557 </para>
44558 <para>
44559 If any of the generic options for manipulating headers (for example,
44560 <option>headers_add</option>) are set on an <command>autoreply</command> transport, they apply to the copy
44561 of the original message that is included in the generated message when
44562 <option>return_message</option> is set. They do not apply to the generated message itself.
44563 </para>
44564 <para>
44565 <indexterm role="variable">
44566 <primary><varname>$sender_address</varname></primary>
44567 </indexterm>
44568 If the <command>autoreply</command> transport receives return code 2 from Exim when it submits
44569 the message, indicating that there were no recipients, it does not treat this
44570 as an error. This means that autoreplies sent to <varname>$sender_address</varname> when this
44571 is empty (because the incoming message is a bounce message) do not cause
44572 problems. They are just discarded.
44573 </para>
44574 <section id="SECID139">
44575 <title>Private options for autoreply</title>
44576 <para>
44577 <indexterm role="concept">
44578 <primary>options</primary>
44579 <secondary><command>autoreply</command> transport</secondary>
44580 </indexterm>
44581 </para>
44582 <para>
44583 <indexterm role="option">
44584 <primary><option>bcc</option></primary>
44585 </indexterm>
44586 </para>
44587 <informaltable frame="all">
44588 <tgroup cols="4" colsep="0" rowsep="0">
44589 <colspec colwidth="8*" align="left"/>
44590 <colspec colwidth="6*" align="center"/>
44591 <colspec colwidth="6*" align="center"/>
44592 <colspec colwidth="6*" align="right"/>
44593 <tbody>
44594 <row>
44595 <entry><option>bcc</option></entry>
44596 <entry>Use: <emphasis>autoreply</emphasis></entry>
44597 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44598 <entry>Default: <emphasis>unset</emphasis></entry>
44599 </row>
44600 </tbody>
44601 </tgroup>
44602 </informaltable>
44603 <para>
44604 This specifies the addresses that are to receive <quote>blind carbon copies</quote> of the
44605 message when the message is specified by the transport.
44606 </para>
44607 <para>
44608 <indexterm role="option">
44609 <primary><option>cc</option></primary>
44610 </indexterm>
44611 </para>
44612 <informaltable frame="all">
44613 <tgroup cols="4" colsep="0" rowsep="0">
44614 <colspec colwidth="8*" align="left"/>
44615 <colspec colwidth="6*" align="center"/>
44616 <colspec colwidth="6*" align="center"/>
44617 <colspec colwidth="6*" align="right"/>
44618 <tbody>
44619 <row>
44620 <entry><option>cc</option></entry>
44621 <entry>Use: <emphasis>autoreply</emphasis></entry>
44622 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44623 <entry>Default: <emphasis>unset</emphasis></entry>
44624 </row>
44625 </tbody>
44626 </tgroup>
44627 </informaltable>
44628 <para>
44629 This specifies recipients of the message and the contents of the <emphasis>Cc:</emphasis> header
44630 when the message is specified by the transport.
44631 </para>
44632 <para>
44633 <indexterm role="option">
44634 <primary><option>file</option></primary>
44635 </indexterm>
44636 </para>
44637 <informaltable frame="all">
44638 <tgroup cols="4" colsep="0" rowsep="0">
44639 <colspec colwidth="8*" align="left"/>
44640 <colspec colwidth="6*" align="center"/>
44641 <colspec colwidth="6*" align="center"/>
44642 <colspec colwidth="6*" align="right"/>
44643 <tbody>
44644 <row>
44645 <entry><option>file</option></entry>
44646 <entry>Use: <emphasis>autoreply</emphasis></entry>
44647 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44648 <entry>Default: <emphasis>unset</emphasis></entry>
44649 </row>
44650 </tbody>
44651 </tgroup>
44652 </informaltable>
44653 <para>
44654 The contents of the file are sent as the body of the message when the message
44655 is specified by the transport. If both <option>file</option> and <option>text</option> are set, the text
44656 string comes first.
44657 </para>
44658 <para>
44659 <indexterm role="option">
44660 <primary><option>file_expand</option></primary>
44661 </indexterm>
44662 </para>
44663 <informaltable frame="all">
44664 <tgroup cols="4" colsep="0" rowsep="0">
44665 <colspec colwidth="8*" align="left"/>
44666 <colspec colwidth="6*" align="center"/>
44667 <colspec colwidth="6*" align="center"/>
44668 <colspec colwidth="6*" align="right"/>
44669 <tbody>
44670 <row>
44671 <entry><option>file_expand</option></entry>
44672 <entry>Use: <emphasis>autoreply</emphasis></entry>
44673 <entry>Type: <emphasis>boolean</emphasis></entry>
44674 <entry>Default: <emphasis>false</emphasis></entry>
44675 </row>
44676 </tbody>
44677 </tgroup>
44678 </informaltable>
44679 <para>
44680 If this is set, the contents of the file named by the <option>file</option> option are
44681 subjected to string expansion as they are added to the message.
44682 </para>
44683 <para>
44684 <indexterm role="option">
44685 <primary><option>file_optional</option></primary>
44686 </indexterm>
44687 </para>
44688 <informaltable frame="all">
44689 <tgroup cols="4" colsep="0" rowsep="0">
44690 <colspec colwidth="8*" align="left"/>
44691 <colspec colwidth="6*" align="center"/>
44692 <colspec colwidth="6*" align="center"/>
44693 <colspec colwidth="6*" align="right"/>
44694 <tbody>
44695 <row>
44696 <entry><option>file_optional</option></entry>
44697 <entry>Use: <emphasis>autoreply</emphasis></entry>
44698 <entry>Type: <emphasis>boolean</emphasis></entry>
44699 <entry>Default: <emphasis>false</emphasis></entry>
44700 </row>
44701 </tbody>
44702 </tgroup>
44703 </informaltable>
44704 <para>
44705 If this option is true, no error is generated if the file named by the <option>file</option>
44706 option or passed with the address does not exist or cannot be read.
44707 </para>
44708 <para>
44709 <indexterm role="option">
44710 <primary><option>from</option></primary>
44711 </indexterm>
44712 </para>
44713 <informaltable frame="all">
44714 <tgroup cols="4" colsep="0" rowsep="0">
44715 <colspec colwidth="8*" align="left"/>
44716 <colspec colwidth="6*" align="center"/>
44717 <colspec colwidth="6*" align="center"/>
44718 <colspec colwidth="6*" align="right"/>
44719 <tbody>
44720 <row>
44721 <entry><option>from</option></entry>
44722 <entry>Use: <emphasis>autoreply</emphasis></entry>
44723 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44724 <entry>Default: <emphasis>unset</emphasis></entry>
44725 </row>
44726 </tbody>
44727 </tgroup>
44728 </informaltable>
44729 <para>
44730 This specifies the contents of the <emphasis>From:</emphasis> header when the message is
44731 specified by the transport.
44732 </para>
44733 <para>
44734 <indexterm role="option">
44735 <primary><option>headers</option></primary>
44736 </indexterm>
44737 </para>
44738 <informaltable frame="all">
44739 <tgroup cols="4" colsep="0" rowsep="0">
44740 <colspec colwidth="8*" align="left"/>
44741 <colspec colwidth="6*" align="center"/>
44742 <colspec colwidth="6*" align="center"/>
44743 <colspec colwidth="6*" align="right"/>
44744 <tbody>
44745 <row>
44746 <entry><option>headers</option></entry>
44747 <entry>Use: <emphasis>autoreply</emphasis></entry>
44748 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44749 <entry>Default: <emphasis>unset</emphasis></entry>
44750 </row>
44751 </tbody>
44752 </tgroup>
44753 </informaltable>
44754 <para>
44755 This specifies additional RFC 2822 headers that are to be added to the message
44756 when the message is specified by the transport. Several can be given by using
44757 <quote>\n</quote> to separate them. There is no check on the format.
44758 </para>
44759 <para>
44760 <indexterm role="option">
44761 <primary><option>log</option></primary>
44762 </indexterm>
44763 </para>
44764 <informaltable frame="all">
44765 <tgroup cols="4" colsep="0" rowsep="0">
44766 <colspec colwidth="8*" align="left"/>
44767 <colspec colwidth="6*" align="center"/>
44768 <colspec colwidth="6*" align="center"/>
44769 <colspec colwidth="6*" align="right"/>
44770 <tbody>
44771 <row>
44772 <entry><option>log</option></entry>
44773 <entry>Use: <emphasis>autoreply</emphasis></entry>
44774 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44775 <entry>Default: <emphasis>unset</emphasis></entry>
44776 </row>
44777 </tbody>
44778 </tgroup>
44779 </informaltable>
44780 <para>
44781 This option names a file in which a record of every message sent is logged when
44782 the message is specified by the transport.
44783 </para>
44784 <para>
44785 <indexterm role="option">
44786 <primary><option>mode</option></primary>
44787 </indexterm>
44788 </para>
44789 <informaltable frame="all">
44790 <tgroup cols="4" colsep="0" rowsep="0">
44791 <colspec colwidth="8*" align="left"/>
44792 <colspec colwidth="6*" align="center"/>
44793 <colspec colwidth="6*" align="center"/>
44794 <colspec colwidth="6*" align="right"/>
44795 <tbody>
44796 <row>
44797 <entry><option>mode</option></entry>
44798 <entry>Use: <emphasis>autoreply</emphasis></entry>
44799 <entry>Type: <emphasis>octal integer</emphasis></entry>
44800 <entry>Default: <emphasis>0600</emphasis></entry>
44801 </row>
44802 </tbody>
44803 </tgroup>
44804 </informaltable>
44805 <para>
44806 If either the log file or the <quote>once</quote> file has to be created, this mode is
44807 used.
44808 </para>
44809 <para>
44810 <indexterm role="option">
44811 <primary><option>never_mail</option></primary>
44812 </indexterm>
44813 </para>
44814 <informaltable frame="all">
44815 <tgroup cols="4" colsep="0" rowsep="0">
44816 <colspec colwidth="8*" align="left"/>
44817 <colspec colwidth="6*" align="center"/>
44818 <colspec colwidth="6*" align="center"/>
44819 <colspec colwidth="6*" align="right"/>
44820 <tbody>
44821 <row>
44822 <entry><option>never_mail</option></entry>
44823 <entry>Use: <emphasis>autoreply</emphasis></entry>
44824 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
44825 <entry>Default: <emphasis>unset</emphasis></entry>
44826 </row>
44827 </tbody>
44828 </tgroup>
44829 </informaltable>
44830 <para>
44831 If any run of the transport creates a message with a recipient that matches any
44832 item in the list, that recipient is quietly discarded. If all recipients are
44833 discarded, no message is created. This applies both when the recipients are
44834 generated by a filter and when they are specified in the transport.
44835 </para>
44836 <para>
44837 <indexterm role="option">
44838 <primary><option>once</option></primary>
44839 </indexterm>
44840 </para>
44841 <informaltable frame="all">
44842 <tgroup cols="4" colsep="0" rowsep="0">
44843 <colspec colwidth="8*" align="left"/>
44844 <colspec colwidth="6*" align="center"/>
44845 <colspec colwidth="6*" align="center"/>
44846 <colspec colwidth="6*" align="right"/>
44847 <tbody>
44848 <row>
44849 <entry><option>once</option></entry>
44850 <entry>Use: <emphasis>autoreply</emphasis></entry>
44851 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44852 <entry>Default: <emphasis>unset</emphasis></entry>
44853 </row>
44854 </tbody>
44855 </tgroup>
44856 </informaltable>
44857 <para>
44858 This option names a file or DBM database in which a record of each <emphasis>To:</emphasis>
44859 recipient is kept when the message is specified by the transport. <emphasis role="bold">Note</emphasis>:
44860 This does not apply to <emphasis>Cc:</emphasis> or <emphasis>Bcc:</emphasis> recipients.
44861 </para>
44862 <para>
44863 If <option>once</option> is unset, or is set to an empty string, the message is always sent.
44864 By default, if <option>once</option> is set to a non-empty filename, the message
44865 is not sent if a potential recipient is already listed in the database.
44866 However, if the <option>once_repeat</option> option specifies a time greater than zero, the
44867 message is sent if that much time has elapsed since a message was last sent to
44868 this recipient. A setting of zero time for <option>once_repeat</option> (the default)
44869 prevents a message from being sent a second time &ndash; in this case, zero means
44870 infinity.
44871 </para>
44872 <para>
44873 If <option>once_file_size</option> is zero, a DBM database is used to remember recipients,
44874 and it is allowed to grow as large as necessary. If <option>once_file_size</option> is set
44875 greater than zero, it changes the way Exim implements the <option>once</option> option.
44876 Instead of using a DBM file to record every recipient it sends to, it uses a
44877 regular file, whose size will never get larger than the given value.
44878 </para>
44879 <para>
44880 In the file, Exim keeps a linear list of recipient addresses and the times at
44881 which they were sent messages. If the file is full when a new address needs to
44882 be added, the oldest address is dropped. If <option>once_repeat</option> is not set, this
44883 means that a given recipient may receive multiple messages, but at
44884 unpredictable intervals that depend on the rate of turnover of addresses in the
44885 file. If <option>once_repeat</option> is set, it specifies a maximum time between repeats.
44886 </para>
44887 <para>
44888 <indexterm role="option">
44889 <primary><option>once_file_size</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>once_file_size</option></entry>
44901 <entry>Use: <emphasis>autoreply</emphasis></entry>
44902 <entry>Type: <emphasis>integer</emphasis></entry>
44903 <entry>Default: <emphasis>0</emphasis></entry>
44904 </row>
44905 </tbody>
44906 </tgroup>
44907 </informaltable>
44908 <para>
44909 See <option>once</option> above.
44910 </para>
44911 <para>
44912 <indexterm role="option">
44913 <primary><option>once_repeat</option></primary>
44914 </indexterm>
44915 </para>
44916 <informaltable frame="all">
44917 <tgroup cols="4" colsep="0" rowsep="0">
44918 <colspec colwidth="8*" align="left"/>
44919 <colspec colwidth="6*" align="center"/>
44920 <colspec colwidth="6*" align="center"/>
44921 <colspec colwidth="6*" align="right"/>
44922 <tbody>
44923 <row>
44924 <entry><option>once_repeat</option></entry>
44925 <entry>Use: <emphasis>autoreply</emphasis></entry>
44926 <entry>Type: <emphasis>time</emphasis>&dagger;<emphasis></emphasis></entry>
44927 <entry>Default: <emphasis>0s</emphasis></entry>
44928 </row>
44929 </tbody>
44930 </tgroup>
44931 </informaltable>
44932 <para>
44933 See <option>once</option> above.
44934 After expansion, the value of this option must be a valid time value.
44935 </para>
44936 <para>
44937 <indexterm role="option">
44938 <primary><option>reply_to</option></primary>
44939 </indexterm>
44940 </para>
44941 <informaltable frame="all">
44942 <tgroup cols="4" colsep="0" rowsep="0">
44943 <colspec colwidth="8*" align="left"/>
44944 <colspec colwidth="6*" align="center"/>
44945 <colspec colwidth="6*" align="center"/>
44946 <colspec colwidth="6*" align="right"/>
44947 <tbody>
44948 <row>
44949 <entry><option>reply_to</option></entry>
44950 <entry>Use: <emphasis>autoreply</emphasis></entry>
44951 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44952 <entry>Default: <emphasis>unset</emphasis></entry>
44953 </row>
44954 </tbody>
44955 </tgroup>
44956 </informaltable>
44957 <para>
44958 This specifies the contents of the <emphasis>Reply-To:</emphasis> header when the message is
44959 specified by the transport.
44960 </para>
44961 <para>
44962 <indexterm role="option">
44963 <primary><option>return_message</option></primary>
44964 </indexterm>
44965 </para>
44966 <informaltable frame="all">
44967 <tgroup cols="4" colsep="0" rowsep="0">
44968 <colspec colwidth="8*" align="left"/>
44969 <colspec colwidth="6*" align="center"/>
44970 <colspec colwidth="6*" align="center"/>
44971 <colspec colwidth="6*" align="right"/>
44972 <tbody>
44973 <row>
44974 <entry><option>return_message</option></entry>
44975 <entry>Use: <emphasis>autoreply</emphasis></entry>
44976 <entry>Type: <emphasis>boolean</emphasis></entry>
44977 <entry>Default: <emphasis>false</emphasis></entry>
44978 </row>
44979 </tbody>
44980 </tgroup>
44981 </informaltable>
44982 <para>
44983 If this is set, a copy of the original message is returned with the new
44984 message, subject to the maximum size set in the <option>return_size_limit</option> global
44985 configuration option.
44986 </para>
44987 <para>
44988 <indexterm role="option">
44989 <primary><option>subject</option></primary>
44990 </indexterm>
44991 </para>
44992 <informaltable frame="all">
44993 <tgroup cols="4" colsep="0" rowsep="0">
44994 <colspec colwidth="8*" align="left"/>
44995 <colspec colwidth="6*" align="center"/>
44996 <colspec colwidth="6*" align="center"/>
44997 <colspec colwidth="6*" align="right"/>
44998 <tbody>
44999 <row>
45000 <entry><option>subject</option></entry>
45001 <entry>Use: <emphasis>autoreply</emphasis></entry>
45002 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45003 <entry>Default: <emphasis>unset</emphasis></entry>
45004 </row>
45005 </tbody>
45006 </tgroup>
45007 </informaltable>
45008 <para>
45009 This specifies the contents of the <emphasis>Subject:</emphasis> header when the message is
45010 specified by the transport. It is tempting to quote the original subject in
45011 automatic responses. For example:
45012 </para>
45013 <literallayout class="monospaced">
45014 subject = Re: $h_subject:
45015 </literallayout>
45016 <para>
45017 There is a danger in doing this, however. It may allow a third party to
45018 subscribe your users to an opt-in mailing list, provided that the list accepts
45019 bounce messages as subscription confirmations. Well-managed lists require a
45020 non-bounce message to confirm a subscription, so the danger is relatively
45021 small.
45022 </para>
45023 <para>
45024 <indexterm role="option">
45025 <primary><option>text</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>text</option></entry>
45037 <entry>Use: <emphasis>autoreply</emphasis></entry>
45038 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45039 <entry>Default: <emphasis>unset</emphasis></entry>
45040 </row>
45041 </tbody>
45042 </tgroup>
45043 </informaltable>
45044 <para>
45045 This specifies a single string to be used as the body of the message when the
45046 message is specified by the transport. If both <option>text</option> and <option>file</option> are set,
45047 the text comes first.
45048 </para>
45049 <para>
45050 <indexterm role="option">
45051 <primary><option>to</option></primary>
45052 </indexterm>
45053 </para>
45054 <informaltable frame="all">
45055 <tgroup cols="4" colsep="0" rowsep="0">
45056 <colspec colwidth="8*" align="left"/>
45057 <colspec colwidth="6*" align="center"/>
45058 <colspec colwidth="6*" align="center"/>
45059 <colspec colwidth="6*" align="right"/>
45060 <tbody>
45061 <row>
45062 <entry><option>to</option></entry>
45063 <entry>Use: <emphasis>autoreply</emphasis></entry>
45064 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45065 <entry>Default: <emphasis>unset</emphasis></entry>
45066 </row>
45067 </tbody>
45068 </tgroup>
45069 </informaltable>
45070 <para>
45071 This specifies recipients of the message and the contents of the <emphasis>To:</emphasis> header
45072 when the message is specified by the transport.
45073 <indexterm role="concept" startref="IIDauttra1" class="endofrange"/>
45074 <indexterm role="concept" startref="IIDauttra2" class="endofrange"/>
45075 </para>
45076 </section>
45077 </chapter>
45078
45079 <chapter id="CHAPLMTP">
45080 <title>The lmtp transport</title>
45081 <para>
45082 <indexterm role="concept">
45083 <primary>transports</primary>
45084 <secondary><command>lmtp</command></secondary>
45085 </indexterm>
45086 <indexterm role="concept">
45087 <primary><command>lmtp</command> transport</primary>
45088 </indexterm>
45089 <indexterm role="concept">
45090 <primary>LMTP</primary>
45091 <secondary>over a pipe</secondary>
45092 </indexterm>
45093 <indexterm role="concept">
45094 <primary>LMTP</primary>
45095 <secondary>over a socket</secondary>
45096 </indexterm>
45097 The <command>lmtp</command> transport runs the LMTP protocol (RFC 2033) over a pipe to a
45098 specified command
45099 or by interacting with a Unix domain socket.
45100 This transport is something of a cross between the <command>pipe</command> and <command>smtp</command>
45101 transports. Exim also has support for using LMTP over TCP/IP; this is
45102 implemented as an option for the <command>smtp</command> transport. Because LMTP is expected
45103 to be of minority interest, the default build-time configure in <filename>src/EDITME</filename>
45104 has it commented out. You need to ensure that
45105 </para>
45106 <literallayout class="monospaced">
45107 TRANSPORT_LMTP=yes
45108 </literallayout>
45109 <para>
45110 <indexterm role="concept">
45111 <primary>options</primary>
45112 <secondary><command>lmtp</command> transport</secondary>
45113 </indexterm>
45114 is present in your <filename>Local/Makefile</filename> in order to have the <command>lmtp</command> transport
45115 included in the Exim binary. The private options of the <command>lmtp</command> transport are
45116 as follows:
45117 </para>
45118 <para>
45119 <indexterm role="option">
45120 <primary><option>batch_id</option></primary>
45121 </indexterm>
45122 </para>
45123 <informaltable frame="all">
45124 <tgroup cols="4" colsep="0" rowsep="0">
45125 <colspec colwidth="8*" align="left"/>
45126 <colspec colwidth="6*" align="center"/>
45127 <colspec colwidth="6*" align="center"/>
45128 <colspec colwidth="6*" align="right"/>
45129 <tbody>
45130 <row>
45131 <entry><option>batch_id</option></entry>
45132 <entry>Use: <emphasis>lmtp</emphasis></entry>
45133 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45134 <entry>Default: <emphasis>unset</emphasis></entry>
45135 </row>
45136 </tbody>
45137 </tgroup>
45138 </informaltable>
45139 <para>
45140 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
45141 </para>
45142 <para>
45143 <indexterm role="option">
45144 <primary><option>batch_max</option></primary>
45145 </indexterm>
45146 </para>
45147 <informaltable frame="all">
45148 <tgroup cols="4" colsep="0" rowsep="0">
45149 <colspec colwidth="8*" align="left"/>
45150 <colspec colwidth="6*" align="center"/>
45151 <colspec colwidth="6*" align="center"/>
45152 <colspec colwidth="6*" align="right"/>
45153 <tbody>
45154 <row>
45155 <entry><option>batch_max</option></entry>
45156 <entry>Use: <emphasis>lmtp</emphasis></entry>
45157 <entry>Type: <emphasis>integer</emphasis></entry>
45158 <entry>Default: <emphasis>1</emphasis></entry>
45159 </row>
45160 </tbody>
45161 </tgroup>
45162 </informaltable>
45163 <para>
45164 This limits the number of addresses that can be handled in a single delivery.
45165 Most LMTP servers can handle several addresses at once, so it is normally a
45166 good idea to increase this value. See the description of local delivery
45167 batching in chapter <xref linkend="CHAPbatching"/>.
45168 </para>
45169 <para>
45170 <indexterm role="option">
45171 <primary><option>command</option></primary>
45172 </indexterm>
45173 </para>
45174 <informaltable frame="all">
45175 <tgroup cols="4" colsep="0" rowsep="0">
45176 <colspec colwidth="8*" align="left"/>
45177 <colspec colwidth="6*" align="center"/>
45178 <colspec colwidth="6*" align="center"/>
45179 <colspec colwidth="6*" align="right"/>
45180 <tbody>
45181 <row>
45182 <entry><option>command</option></entry>
45183 <entry>Use: <emphasis>lmtp</emphasis></entry>
45184 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45185 <entry>Default: <emphasis>unset</emphasis></entry>
45186 </row>
45187 </tbody>
45188 </tgroup>
45189 </informaltable>
45190 <para>
45191 This option must be set if <option>socket</option> is not set. The string is a command which
45192 is run in a separate process. It is split up into a command name and list of
45193 arguments, each of which is separately expanded (so expansion cannot change the
45194 number of arguments). The command is run directly, not via a shell. The message
45195 is passed to the new process using the standard input and output to operate the
45196 LMTP protocol.
45197 </para>
45198 <para>
45199 <indexterm role="option">
45200 <primary><option>ignore_quota</option></primary>
45201 </indexterm>
45202 </para>
45203 <informaltable frame="all">
45204 <tgroup cols="4" colsep="0" rowsep="0">
45205 <colspec colwidth="8*" align="left"/>
45206 <colspec colwidth="6*" align="center"/>
45207 <colspec colwidth="6*" align="center"/>
45208 <colspec colwidth="6*" align="right"/>
45209 <tbody>
45210 <row>
45211 <entry><option>ignore_quota</option></entry>
45212 <entry>Use: <emphasis>lmtp</emphasis></entry>
45213 <entry>Type: <emphasis>boolean</emphasis></entry>
45214 <entry>Default: <emphasis>false</emphasis></entry>
45215 </row>
45216 </tbody>
45217 </tgroup>
45218 </informaltable>
45219 <para>
45220 <indexterm role="concept">
45221 <primary>LMTP</primary>
45222 <secondary>ignoring quota errors</secondary>
45223 </indexterm>
45224 If this option is set true, the string <literal>IGNOREQUOTA</literal> is added to RCPT
45225 commands, provided that the LMTP server has advertised support for IGNOREQUOTA
45226 in its response to the LHLO command.
45227 </para>
45228 <para>
45229 <indexterm role="option">
45230 <primary><option>socket</option></primary>
45231 </indexterm>
45232 </para>
45233 <informaltable frame="all">
45234 <tgroup cols="4" colsep="0" rowsep="0">
45235 <colspec colwidth="8*" align="left"/>
45236 <colspec colwidth="6*" align="center"/>
45237 <colspec colwidth="6*" align="center"/>
45238 <colspec colwidth="6*" align="right"/>
45239 <tbody>
45240 <row>
45241 <entry><option>socket</option></entry>
45242 <entry>Use: <emphasis>lmtp</emphasis></entry>
45243 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45244 <entry>Default: <emphasis>unset</emphasis></entry>
45245 </row>
45246 </tbody>
45247 </tgroup>
45248 </informaltable>
45249 <para>
45250 This option must be set if <option>command</option> is not set. The result of expansion must
45251 be the name of a Unix domain socket. The transport connects to the socket and
45252 delivers the message to it using the LMTP protocol.
45253 </para>
45254 <para>
45255 <indexterm role="option">
45256 <primary><option>timeout</option></primary>
45257 </indexterm>
45258 </para>
45259 <informaltable frame="all">
45260 <tgroup cols="4" colsep="0" rowsep="0">
45261 <colspec colwidth="8*" align="left"/>
45262 <colspec colwidth="6*" align="center"/>
45263 <colspec colwidth="6*" align="center"/>
45264 <colspec colwidth="6*" align="right"/>
45265 <tbody>
45266 <row>
45267 <entry><option>timeout</option></entry>
45268 <entry>Use: <emphasis>lmtp</emphasis></entry>
45269 <entry>Type: <emphasis>time</emphasis></entry>
45270 <entry>Default: <emphasis>5m</emphasis></entry>
45271 </row>
45272 </tbody>
45273 </tgroup>
45274 </informaltable>
45275 <para>
45276 The transport is aborted if the created process or Unix domain socket does not
45277 respond to LMTP commands or message input within this timeout. Delivery
45278 is deferred, and will be tried again later. Here is an example of a typical
45279 LMTP transport:
45280 </para>
45281 <literallayout class="monospaced">
45282 lmtp:
45283   driver = lmtp
45284   command = /some/local/lmtp/delivery/program
45285   batch_max = 20
45286   user = exim
45287 </literallayout>
45288 <para>
45289 This delivers up to 20 addresses at a time, in a mixture of domains if
45290 necessary, running as the user <emphasis>exim</emphasis>.
45291 </para>
45292 </chapter>
45293
45294 <chapter id="CHAPpipetransport">
45295 <title>The pipe transport</title>
45296 <para>
45297 <indexterm role="concept" id="IIDpiptra1" class="startofrange">
45298 <primary>transports</primary>
45299 <secondary><command>pipe</command></secondary>
45300 </indexterm>
45301 <indexterm role="concept" id="IIDpiptra2" class="startofrange">
45302 <primary><command>pipe</command> transport</primary>
45303 </indexterm>
45304 The <command>pipe</command> transport is used to deliver messages via a pipe to a command
45305 running in another process. One example is the use of <command>pipe</command> as a
45306 pseudo-remote transport for passing messages to some other delivery mechanism
45307 (such as UUCP). Another is the use by individual users to automatically process
45308 their incoming messages. The <command>pipe</command> transport can be used in one of the
45309 following ways:
45310 </para>
45311 <itemizedlist>
45312 <listitem>
45313 <para>
45314 <indexterm role="variable">
45315 <primary><varname>$local_part</varname></primary>
45316 </indexterm>
45317 A router routes one address to a transport in the normal way, and the
45318 transport is configured as a <command>pipe</command> transport. In this case, <varname>$local_part</varname>
45319 contains the local part of the address (as usual), and the command that is run
45320 is specified by the <option>command</option> option on the transport.
45321 </para>
45322 </listitem>
45323 <listitem>
45324 <para>
45325 <indexterm role="variable">
45326 <primary><varname>$pipe_addresses</varname></primary>
45327 </indexterm>
45328 If the <option>batch_max</option> option is set greater than 1 (the default is 1), the
45329 transport can handle more than one address in a single run. In this case, when
45330 more than one address is routed to the transport, <varname>$local_part</varname> is not set
45331 (because it is not unique). However, the pseudo-variable <varname>$pipe_addresses</varname>
45332 (described in section <xref linkend="SECThowcommandrun"/> below) contains all the addresses
45333 that are routed to the transport.
45334 </para>
45335 </listitem>
45336 <listitem>
45337 <para>
45338 <indexterm role="variable">
45339 <primary><varname>$address_pipe</varname></primary>
45340 </indexterm>
45341 A router redirects an address directly to a pipe command (for example, from an
45342 alias or forward file). In this case, <varname>$address_pipe</varname> contains the text of the
45343 pipe command, and the <option>command</option> option on the transport is ignored unless
45344 <option>force_command</option> is set. If only one address is being transported
45345 (<option>batch_max</option> is not greater than one, or only one address was redirected to
45346 this pipe command), <varname>$local_part</varname> contains the local part that was redirected.
45347 </para>
45348 </listitem>
45349 </itemizedlist>
45350 <para>
45351 The <command>pipe</command> transport is a non-interactive delivery method. Exim can also
45352 deliver messages over pipes using the LMTP interactive protocol. This is
45353 implemented by the <command>lmtp</command> transport.
45354 </para>
45355 <para>
45356 In the case when <command>pipe</command> is run as a consequence of an entry in a local user&#x2019;s
45357 <filename>.forward</filename> file, the command runs under the uid and gid of that user. In
45358 other cases, the uid and gid have to be specified explicitly, either on the
45359 transport or on the router that handles the address. Current and <quote>home</quote>
45360 directories are also controllable. See chapter <xref linkend="CHAPenvironment"/> for
45361 details of the local delivery environment and chapter <xref linkend="CHAPbatching"/>
45362 for a discussion of local delivery batching.
45363 </para>
45364 <section id="SECID140">
45365 <title>Concurrent delivery</title>
45366 <para>
45367 If two messages arrive at almost the same time, and both are routed to a pipe
45368 delivery, the two pipe transports may be run concurrently. You must ensure that
45369 any pipe commands you set up are robust against this happening. If the commands
45370 write to a file, the <option>exim_lock</option> utility might be of use.
45371 Alternatively the <option>max_parallel</option> option could be used with a value
45372 of "1" to enforce serialization.
45373 </para>
45374 </section>
45375 <section id="SECID141">
45376 <title>Returned status and data</title>
45377 <para>
45378 <indexterm role="concept">
45379 <primary><command>pipe</command> transport</primary>
45380 <secondary>returned data</secondary>
45381 </indexterm>
45382 If the command exits with a non-zero return code, the delivery is deemed to
45383 have failed, unless either the <option>ignore_status</option> option is set (in which case
45384 the return code is treated as zero), or the return code is one of those listed
45385 in the <option>temp_errors</option> option, which are interpreted as meaning <quote>try again
45386 later</quote>. In this case, delivery is deferred. Details of a permanent failure are
45387 logged, but are not included in the bounce message, which merely contains
45388 <quote>local delivery failed</quote>.
45389 </para>
45390 <para>
45391 If the command exits on a signal and the <option>freeze_signal</option> option is set then
45392 the message will be frozen in the queue. If that option is not set, a bounce
45393 will be sent as normal.
45394 </para>
45395 <para>
45396 If the return code is greater than 128 and the command being run is a shell
45397 script, it normally means that the script was terminated by a signal whose
45398 value is the return code minus 128. The <option>freeze_signal</option> option does not
45399 apply in this case.
45400 </para>
45401 <para>
45402 If Exim is unable to run the command (that is, if <function>execve()</function> fails), the
45403 return code is set to 127. This is the value that a shell returns if it is
45404 asked to run a non-existent command. The wording for the log line suggests that
45405 a non-existent command may be the problem.
45406 </para>
45407 <para>
45408 The <option>return_output</option> option can affect the result of a pipe delivery. If it is
45409 set and the command produces any output on its standard output or standard
45410 error streams, the command is considered to have failed, even if it gave a zero
45411 return code or if <option>ignore_status</option> is set. The output from the command is
45412 included as part of the bounce message. The <option>return_fail_output</option> option is
45413 similar, except that output is returned only when the command exits with a
45414 failure return code, that is, a value other than zero or a code that matches
45415 <option>temp_errors</option>.
45416 </para>
45417 </section>
45418 <section id="SECThowcommandrun">
45419 <title>How the command is run</title>
45420 <para>
45421 <indexterm role="concept">
45422 <primary><command>pipe</command> transport</primary>
45423 <secondary>path for command</secondary>
45424 </indexterm>
45425 The command line is (by default) broken down into a command name and arguments
45426 by the <command>pipe</command> transport itself. The <option>allow_commands</option> and
45427 <option>restrict_to_path</option> options can be used to restrict the commands that may be
45428 run.
45429 </para>
45430 <para>
45431 <indexterm role="concept">
45432 <primary>quoting</primary>
45433 <secondary>in pipe command</secondary>
45434 </indexterm>
45435 Unquoted arguments are delimited by white space. If an argument appears in
45436 double quotes, backslash is interpreted as an escape character in the usual
45437 way. If an argument appears in single quotes, no escaping is done.
45438 </para>
45439 <para>
45440 String expansion is applied to the command line except when it comes from a
45441 traditional <filename>.forward</filename> file (commands from a filter file are expanded). The
45442 expansion is applied to each argument in turn rather than to the whole line.
45443 For this reason, any string expansion item that contains white space must be
45444 quoted so as to be contained within a single argument. A setting such as
45445 </para>
45446 <literallayout class="monospaced">
45447 command = /some/path ${if eq{$local_part}{postmaster}{xx}{yy}}
45448 </literallayout>
45449 <para>
45450 will not work, because the expansion item gets split between several
45451 arguments. You have to write
45452 </para>
45453 <literallayout class="monospaced">
45454 command = /some/path "${if eq{$local_part}{postmaster}{xx}{yy}}"
45455 </literallayout>
45456 <para>
45457 to ensure that it is all in one argument. The expansion is done in this way,
45458 argument by argument, so that the number of arguments cannot be changed as a
45459 result of expansion, and quotes or backslashes in inserted variables do not
45460 interact with external quoting. However, this leads to problems if you want to
45461 generate multiple arguments (or the command name plus arguments) from a single
45462 expansion. In this situation, the simplest solution is to use a shell. For
45463 example:
45464 </para>
45465 <literallayout class="monospaced">
45466 command = /bin/sh -c ${lookup{$local_part}lsearch{/some/file}}
45467 </literallayout>
45468 <para>
45469 <indexterm role="concept">
45470 <primary>transport</primary>
45471 <secondary>filter</secondary>
45472 </indexterm>
45473 <indexterm role="concept">
45474 <primary>filter</primary>
45475 <secondary>transport filter</secondary>
45476 </indexterm>
45477 <indexterm role="variable">
45478 <primary><varname>$pipe_addresses</varname></primary>
45479 </indexterm>
45480 Special handling takes place when an argument consists of precisely the text
45481 <literal>$pipe_addresses</literal> (no quotes).
45482 This is not a general expansion variable; the only
45483 place this string is recognized is when it appears as an argument for a pipe or
45484 transport filter command. It causes each address that is being handled to be
45485 inserted in the argument list at that point <emphasis>as a separate argument</emphasis>. This
45486 avoids any problems with spaces or shell metacharacters, and is of use when a
45487 <command>pipe</command> transport is handling groups of addresses in a batch.
45488 </para>
45489 <para>
45490 If <option>force_command</option> is enabled on the transport, Special handling takes place
45491 for an argument that consists of precisely the text <literal>$address_pipe</literal>.  It
45492 is handled similarly to <varname>$pipe_addresses</varname> above.  It is expanded and each
45493 argument is inserted in the argument list at that point
45494 <emphasis>as a separate argument</emphasis>.  The <literal>$address_pipe</literal> item does not need to be
45495 the only item in the argument; in fact, if it were then <option>force_command</option>
45496 should behave as a no-op.  Rather, it should be used to adjust the command
45497 run while preserving the argument vector separation.
45498 </para>
45499 <para>
45500 After splitting up into arguments and expansion, the resulting command is run
45501 in a subprocess directly from the transport, <emphasis>not</emphasis> under a shell. The
45502 message that is being delivered is supplied on the standard input, and the
45503 standard output and standard error are both connected to a single pipe that is
45504 read by Exim. The <option>max_output</option> option controls how much output the command
45505 may produce, and the <option>return_output</option> and <option>return_fail_output</option> options
45506 control what is done with it.
45507 </para>
45508 <para>
45509 Not running the command under a shell (by default) lessens the security risks
45510 in cases when a command from a user&#x2019;s filter file is built out of data that was
45511 taken from an incoming message. If a shell is required, it can of course be
45512 explicitly specified as the command to be run. However, there are circumstances
45513 where existing commands (for example, in <filename>.forward</filename> files) expect to be run
45514 under a shell and cannot easily be modified. To allow for these cases, there is
45515 an option called <option>use_shell</option>, which changes the way the <command>pipe</command> transport
45516 works. Instead of breaking up the command line as just described, it expands it
45517 as a single string and passes the result to <filename>/bin/sh</filename>. The
45518 <option>restrict_to_path</option> option and the <varname>$pipe_addresses</varname> facility cannot be used
45519 with <option>use_shell</option>, and the whole mechanism is inherently less secure.
45520 </para>
45521 </section>
45522 <section id="SECTpipeenv">
45523 <title>Environment variables</title>
45524 <para>
45525 <indexterm role="concept">
45526 <primary><command>pipe</command> transport</primary>
45527 <secondary>environment for command</secondary>
45528 </indexterm>
45529 <indexterm role="concept">
45530 <primary>environment</primary>
45531 <secondary><command>pipe</command> transport</secondary>
45532 </indexterm>
45533 The environment variables listed below are set up when the command is invoked.
45534 This list is a compromise for maximum compatibility with other MTAs. Note that
45535 the <option>environment</option> option can be used to add additional variables to this
45536 environment. The environment for the <command>pipe</command> transport is not subject
45537 to the <option>add_environment</option> and <option>keep_environment</option> main config options.
45538 </para>
45539 <literallayout>
45540 <literal>DOMAIN            </literal>   the domain of the address
45541 <literal>HOME              </literal>   the home directory, if set
45542 <literal>HOST              </literal>   the host name when called from a router (see below)
45543 <literal>LOCAL_PART        </literal>   see below
45544 <literal>LOCAL_PART_PREFIX </literal>   see below
45545 <literal>LOCAL_PART_SUFFIX </literal>   see below
45546 <literal>LOGNAME           </literal>   see below
45547 <literal>MESSAGE_ID        </literal>   Exim&#x2019;s local ID for the message
45548 <literal>PATH              </literal>   as specified by the <option>path</option> option below
45549 <literal>QUALIFY_DOMAIN    </literal>   the sender qualification domain
45550 <literal>RECIPIENT         </literal>   the complete recipient address
45551 <literal>SENDER            </literal>   the sender of the message (empty if a bounce)
45552 <literal>SHELL             </literal>   <literal>/bin/sh</literal>
45553 <literal>TZ                </literal>   the value of the <option>timezone</option> option, if set
45554 <literal>USER              </literal>   see below
45555 </literallayout>
45556 <para>
45557 When a <command>pipe</command> transport is called directly from (for example) an <command>accept</command>
45558 router, LOCAL_PART is set to the local part of the address. When it is
45559 called as a result of a forward or alias expansion, LOCAL_PART is set to
45560 the local part of the address that was expanded. In both cases, any affixes are
45561 removed from the local part, and made available in LOCAL_PART_PREFIX and
45562 LOCAL_PART_SUFFIX, respectively. LOGNAME and USER are set to the
45563 same value as LOCAL_PART for compatibility with other MTAs.
45564 </para>
45565 <para>
45566 <indexterm role="concept">
45567 <primary>HOST</primary>
45568 </indexterm>
45569 HOST is set only when a <command>pipe</command> transport is called from a router that
45570 associates hosts with an address, typically when using <command>pipe</command> as a
45571 pseudo-remote transport. HOST is set to the first host name specified by
45572 the router.
45573 </para>
45574 <para>
45575 <indexterm role="concept">
45576 <primary>HOME</primary>
45577 </indexterm>
45578 If the transport&#x2019;s generic <option>home_directory</option> option is set, its value is used
45579 for the HOME environment variable. Otherwise, a home directory may be set
45580 by the router&#x2019;s <option>transport_home_directory</option> option, which defaults to the
45581 user&#x2019;s home directory if <option>check_local_user</option> is set.
45582 </para>
45583 </section>
45584 <section id="SECID142">
45585 <title>Private options for pipe</title>
45586 <para>
45587 <indexterm role="concept">
45588 <primary>options</primary>
45589 <secondary><command>pipe</command> transport</secondary>
45590 </indexterm>
45591 </para>
45592 <para>
45593 <indexterm role="option">
45594 <primary><option>allow_commands</option></primary>
45595 </indexterm>
45596 </para>
45597 <informaltable frame="all">
45598 <tgroup cols="4" colsep="0" rowsep="0">
45599 <colspec colwidth="8*" align="left"/>
45600 <colspec colwidth="6*" align="center"/>
45601 <colspec colwidth="6*" align="center"/>
45602 <colspec colwidth="6*" align="right"/>
45603 <tbody>
45604 <row>
45605 <entry><option>allow_commands</option></entry>
45606 <entry>Use: <emphasis>pipe</emphasis></entry>
45607 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
45608 <entry>Default: <emphasis>unset</emphasis></entry>
45609 </row>
45610 </tbody>
45611 </tgroup>
45612 </informaltable>
45613 <para>
45614 <indexterm role="concept">
45615 <primary><command>pipe</command> transport</primary>
45616 <secondary>permitted commands</secondary>
45617 </indexterm>
45618 The string is expanded, and is then interpreted as a colon-separated list of
45619 permitted commands. If <option>restrict_to_path</option> is not set, the only commands
45620 permitted are those in the <option>allow_commands</option> list. They need not be absolute
45621 paths; the <option>path</option> option is still used for relative paths. If
45622 <option>restrict_to_path</option> is set with <option>allow_commands</option>, the command must either be
45623 in the <option>allow_commands</option> list, or a name without any slashes that is found on
45624 the path. In other words, if neither <option>allow_commands</option> nor
45625 <option>restrict_to_path</option> is set, there is no restriction on the command, but
45626 otherwise only commands that are permitted by one or the other are allowed. For
45627 example, if
45628 </para>
45629 <literallayout class="monospaced">
45630 allow_commands = /usr/bin/vacation
45631 </literallayout>
45632 <para>
45633 and <option>restrict_to_path</option> is not set, the only permitted command is
45634 <filename>/usr/bin/vacation</filename>. The <option>allow_commands</option> option may not be set if
45635 <option>use_shell</option> is set.
45636 </para>
45637 <para>
45638 <indexterm role="option">
45639 <primary><option>batch_id</option></primary>
45640 </indexterm>
45641 </para>
45642 <informaltable frame="all">
45643 <tgroup cols="4" colsep="0" rowsep="0">
45644 <colspec colwidth="8*" align="left"/>
45645 <colspec colwidth="6*" align="center"/>
45646 <colspec colwidth="6*" align="center"/>
45647 <colspec colwidth="6*" align="right"/>
45648 <tbody>
45649 <row>
45650 <entry><option>batch_id</option></entry>
45651 <entry>Use: <emphasis>pipe</emphasis></entry>
45652 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45653 <entry>Default: <emphasis>unset</emphasis></entry>
45654 </row>
45655 </tbody>
45656 </tgroup>
45657 </informaltable>
45658 <para>
45659 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
45660 </para>
45661 <para>
45662 <indexterm role="option">
45663 <primary><option>batch_max</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>batch_max</option></entry>
45675 <entry>Use: <emphasis>pipe</emphasis></entry>
45676 <entry>Type: <emphasis>integer</emphasis></entry>
45677 <entry>Default: <emphasis>1</emphasis></entry>
45678 </row>
45679 </tbody>
45680 </tgroup>
45681 </informaltable>
45682 <para>
45683 This limits the number of addresses that can be handled in a single delivery.
45684 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
45685 </para>
45686 <para>
45687 <indexterm role="option">
45688 <primary><option>check_string</option></primary>
45689 </indexterm>
45690 </para>
45691 <informaltable frame="all">
45692 <tgroup cols="4" colsep="0" rowsep="0">
45693 <colspec colwidth="8*" align="left"/>
45694 <colspec colwidth="6*" align="center"/>
45695 <colspec colwidth="6*" align="center"/>
45696 <colspec colwidth="6*" align="right"/>
45697 <tbody>
45698 <row>
45699 <entry><option>check_string</option></entry>
45700 <entry>Use: <emphasis>pipe</emphasis></entry>
45701 <entry>Type: <emphasis>string</emphasis></entry>
45702 <entry>Default: <emphasis>unset</emphasis></entry>
45703 </row>
45704 </tbody>
45705 </tgroup>
45706 </informaltable>
45707 <para>
45708 As <command>pipe</command> writes the message, the start of each line is tested for matching
45709 <option>check_string</option>, and if it does, the initial matching characters are replaced
45710 by the contents of <option>escape_string</option>, provided both are set. The value of
45711 <option>check_string</option> is a literal string, not a regular expression, and the case of
45712 any letters it contains is significant. When <option>use_bsmtp</option> is set, the contents
45713 of <option>check_string</option> and <option>escape_string</option> are forced to values that implement
45714 the SMTP escaping protocol. Any settings made in the configuration file are
45715 ignored.
45716 </para>
45717 <para>
45718 <indexterm role="option">
45719 <primary><option>command</option></primary>
45720 </indexterm>
45721 </para>
45722 <informaltable frame="all">
45723 <tgroup cols="4" colsep="0" rowsep="0">
45724 <colspec colwidth="8*" align="left"/>
45725 <colspec colwidth="6*" align="center"/>
45726 <colspec colwidth="6*" align="center"/>
45727 <colspec colwidth="6*" align="right"/>
45728 <tbody>
45729 <row>
45730 <entry><option>command</option></entry>
45731 <entry>Use: <emphasis>pipe</emphasis></entry>
45732 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45733 <entry>Default: <emphasis>unset</emphasis></entry>
45734 </row>
45735 </tbody>
45736 </tgroup>
45737 </informaltable>
45738 <para>
45739 This option need not be set when <command>pipe</command> is being used to deliver to pipes
45740 obtained directly from address redirections. In other cases, the option must be
45741 set, to provide a command to be run. It need not yield an absolute path (see
45742 the <option>path</option> option below). The command is split up into separate arguments by
45743 Exim, and each argument is separately expanded, as described in section
45744 <xref linkend="SECThowcommandrun"/> above.
45745 </para>
45746 <para>
45747 <indexterm role="option">
45748 <primary><option>environment</option></primary>
45749 </indexterm>
45750 </para>
45751 <informaltable frame="all">
45752 <tgroup cols="4" colsep="0" rowsep="0">
45753 <colspec colwidth="8*" align="left"/>
45754 <colspec colwidth="6*" align="center"/>
45755 <colspec colwidth="6*" align="center"/>
45756 <colspec colwidth="6*" align="right"/>
45757 <tbody>
45758 <row>
45759 <entry><option>environment</option></entry>
45760 <entry>Use: <emphasis>pipe</emphasis></entry>
45761 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45762 <entry>Default: <emphasis>unset</emphasis></entry>
45763 </row>
45764 </tbody>
45765 </tgroup>
45766 </informaltable>
45767 <para>
45768 <indexterm role="concept">
45769 <primary><command>pipe</command> transport</primary>
45770 <secondary>environment for command</secondary>
45771 </indexterm>
45772 <indexterm role="concept">
45773 <primary>environment</primary>
45774 <secondary><command>pipe</command> transport</secondary>
45775 </indexterm>
45776 This option is used to add additional variables to the environment in which the
45777 command runs (see section <xref linkend="SECTpipeenv"/> for the default list). Its value is
45778 a string which is expanded, and then interpreted as a colon-separated list of
45779 environment settings of the form &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt;.
45780 </para>
45781 <para>
45782 <indexterm role="option">
45783 <primary><option>escape_string</option></primary>
45784 </indexterm>
45785 </para>
45786 <informaltable frame="all">
45787 <tgroup cols="4" colsep="0" rowsep="0">
45788 <colspec colwidth="8*" align="left"/>
45789 <colspec colwidth="6*" align="center"/>
45790 <colspec colwidth="6*" align="center"/>
45791 <colspec colwidth="6*" align="right"/>
45792 <tbody>
45793 <row>
45794 <entry><option>escape_string</option></entry>
45795 <entry>Use: <emphasis>pipe</emphasis></entry>
45796 <entry>Type: <emphasis>string</emphasis></entry>
45797 <entry>Default: <emphasis>unset</emphasis></entry>
45798 </row>
45799 </tbody>
45800 </tgroup>
45801 </informaltable>
45802 <para>
45803 See <option>check_string</option> above.
45804 </para>
45805 <para>
45806 <indexterm role="option">
45807 <primary><option>freeze_exec_fail</option></primary>
45808 </indexterm>
45809 </para>
45810 <informaltable frame="all">
45811 <tgroup cols="4" colsep="0" rowsep="0">
45812 <colspec colwidth="8*" align="left"/>
45813 <colspec colwidth="6*" align="center"/>
45814 <colspec colwidth="6*" align="center"/>
45815 <colspec colwidth="6*" align="right"/>
45816 <tbody>
45817 <row>
45818 <entry><option>freeze_exec_fail</option></entry>
45819 <entry>Use: <emphasis>pipe</emphasis></entry>
45820 <entry>Type: <emphasis>boolean</emphasis></entry>
45821 <entry>Default: <emphasis>false</emphasis></entry>
45822 </row>
45823 </tbody>
45824 </tgroup>
45825 </informaltable>
45826 <para>
45827 <indexterm role="concept">
45828 <primary>exec failure</primary>
45829 </indexterm>
45830 <indexterm role="concept">
45831 <primary>failure of exec</primary>
45832 </indexterm>
45833 <indexterm role="concept">
45834 <primary><command>pipe</command> transport</primary>
45835 <secondary>failure of exec</secondary>
45836 </indexterm>
45837 Failure to exec the command in a pipe transport is by default treated like
45838 any other failure while running the command. However, if <option>freeze_exec_fail</option>
45839 is set, failure to exec is treated specially, and causes the message to be
45840 frozen, whatever the setting of <option>ignore_status</option>.
45841 </para>
45842 <para>
45843 <indexterm role="option">
45844 <primary><option>freeze_signal</option></primary>
45845 </indexterm>
45846 </para>
45847 <informaltable frame="all">
45848 <tgroup cols="4" colsep="0" rowsep="0">
45849 <colspec colwidth="8*" align="left"/>
45850 <colspec colwidth="6*" align="center"/>
45851 <colspec colwidth="6*" align="center"/>
45852 <colspec colwidth="6*" align="right"/>
45853 <tbody>
45854 <row>
45855 <entry><option>freeze_signal</option></entry>
45856 <entry>Use: <emphasis>pipe</emphasis></entry>
45857 <entry>Type: <emphasis>boolean</emphasis></entry>
45858 <entry>Default: <emphasis>false</emphasis></entry>
45859 </row>
45860 </tbody>
45861 </tgroup>
45862 </informaltable>
45863 <para>
45864 <indexterm role="concept">
45865 <primary>signal exit</primary>
45866 </indexterm>
45867 <indexterm role="concept">
45868 <primary><command>pipe</command> transport</primary>
45869 <secondary>,</secondary>
45870 </indexterm>
45871 Normally if the process run by a command in a pipe transport exits on a signal,
45872 a bounce message is sent. If <option>freeze_signal</option> is set, the message will be
45873 frozen in Exim&#x2019;s queue instead.
45874 </para>
45875 <para>
45876 <indexterm role="option">
45877 <primary><option>force_command</option></primary>
45878 </indexterm>
45879 </para>
45880 <informaltable frame="all">
45881 <tgroup cols="4" colsep="0" rowsep="0">
45882 <colspec colwidth="8*" align="left"/>
45883 <colspec colwidth="6*" align="center"/>
45884 <colspec colwidth="6*" align="center"/>
45885 <colspec colwidth="6*" align="right"/>
45886 <tbody>
45887 <row>
45888 <entry><option>force_command</option></entry>
45889 <entry>Use: <emphasis>pipe</emphasis></entry>
45890 <entry>Type: <emphasis>boolean</emphasis></entry>
45891 <entry>Default: <emphasis>false</emphasis></entry>
45892 </row>
45893 </tbody>
45894 </tgroup>
45895 </informaltable>
45896 <para>
45897 <indexterm role="concept">
45898 <primary>force command</primary>
45899 </indexterm>
45900 <indexterm role="concept">
45901 <primary><command>pipe</command> transport</primary>
45902 <secondary>,</secondary>
45903 </indexterm>
45904 Normally when a router redirects an address directly to a pipe command
45905 the <option>command</option> option on the transport is ignored.  If <option>force_command</option>
45906 is set, the <option>command</option> option will used. This is especially
45907 useful for forcing a wrapper or additional argument to be added to the
45908 command. For example:
45909 </para>
45910 <literallayout class="monospaced">
45911 command = /usr/bin/remote_exec myhost -- $address_pipe
45912 force_command
45913 </literallayout>
45914 <para>
45915 Note that <varname>$address_pipe</varname> is handled specially in <option>command</option> when
45916 <option>force_command</option> is set, expanding out to the original argument vector as
45917 separate items, similarly to a Unix shell <literal>"$@"</literal> construct.
45918 </para>
45919 <para>
45920 <indexterm role="option">
45921 <primary><option>ignore_status</option></primary>
45922 </indexterm>
45923 </para>
45924 <informaltable frame="all">
45925 <tgroup cols="4" colsep="0" rowsep="0">
45926 <colspec colwidth="8*" align="left"/>
45927 <colspec colwidth="6*" align="center"/>
45928 <colspec colwidth="6*" align="center"/>
45929 <colspec colwidth="6*" align="right"/>
45930 <tbody>
45931 <row>
45932 <entry><option>ignore_status</option></entry>
45933 <entry>Use: <emphasis>pipe</emphasis></entry>
45934 <entry>Type: <emphasis>boolean</emphasis></entry>
45935 <entry>Default: <emphasis>false</emphasis></entry>
45936 </row>
45937 </tbody>
45938 </tgroup>
45939 </informaltable>
45940 <para>
45941 If this option is true, the status returned by the subprocess that is set up to
45942 run the command is ignored, and Exim behaves as if zero had been returned.
45943 Otherwise, a non-zero status or termination by signal causes an error return
45944 from the transport unless the status value is one of those listed in
45945 <option>temp_errors</option>; these cause the delivery to be deferred and tried again later.
45946 </para>
45947 <para>
45948 <emphasis role="bold">Note</emphasis>: This option does not apply to timeouts, which do not return a status.
45949 See the <option>timeout_defer</option> option for how timeouts are handled.
45950 </para>
45951 <para>
45952 <indexterm role="option">
45953 <primary><option>log_defer_output</option></primary>
45954 </indexterm>
45955 </para>
45956 <informaltable frame="all">
45957 <tgroup cols="4" colsep="0" rowsep="0">
45958 <colspec colwidth="8*" align="left"/>
45959 <colspec colwidth="6*" align="center"/>
45960 <colspec colwidth="6*" align="center"/>
45961 <colspec colwidth="6*" align="right"/>
45962 <tbody>
45963 <row>
45964 <entry><option>log_defer_output</option></entry>
45965 <entry>Use: <emphasis>pipe</emphasis></entry>
45966 <entry>Type: <emphasis>boolean</emphasis></entry>
45967 <entry>Default: <emphasis>false</emphasis></entry>
45968 </row>
45969 </tbody>
45970 </tgroup>
45971 </informaltable>
45972 <para>
45973 <indexterm role="concept">
45974 <primary><command>pipe</command> transport</primary>
45975 <secondary>logging output</secondary>
45976 </indexterm>
45977 If this option is set, and the status returned by the command is
45978 one of the codes listed in <option>temp_errors</option> (that is, delivery was deferred),
45979 and any output was produced on stdout or stderr, the first line of it is
45980 written to the main log.
45981 </para>
45982 <para>
45983 <indexterm role="option">
45984 <primary><option>log_fail_output</option></primary>
45985 </indexterm>
45986 </para>
45987 <informaltable frame="all">
45988 <tgroup cols="4" colsep="0" rowsep="0">
45989 <colspec colwidth="8*" align="left"/>
45990 <colspec colwidth="6*" align="center"/>
45991 <colspec colwidth="6*" align="center"/>
45992 <colspec colwidth="6*" align="right"/>
45993 <tbody>
45994 <row>
45995 <entry><option>log_fail_output</option></entry>
45996 <entry>Use: <emphasis>pipe</emphasis></entry>
45997 <entry>Type: <emphasis>boolean</emphasis></entry>
45998 <entry>Default: <emphasis>false</emphasis></entry>
45999 </row>
46000 </tbody>
46001 </tgroup>
46002 </informaltable>
46003 <para>
46004 If this option is set, and the command returns any output on stdout or
46005 stderr, and also ends with a return code that is neither zero nor one of
46006 the return codes listed in <option>temp_errors</option> (that is, the delivery
46007 failed), the first line of output is written to the main log. This
46008 option and <option>log_output</option> are mutually exclusive.  Only one of them may
46009 be set.
46010 </para>
46011 <para>
46012 <indexterm role="option">
46013 <primary><option>log_output</option></primary>
46014 </indexterm>
46015 </para>
46016 <informaltable frame="all">
46017 <tgroup cols="4" colsep="0" rowsep="0">
46018 <colspec colwidth="8*" align="left"/>
46019 <colspec colwidth="6*" align="center"/>
46020 <colspec colwidth="6*" align="center"/>
46021 <colspec colwidth="6*" align="right"/>
46022 <tbody>
46023 <row>
46024 <entry><option>log_output</option></entry>
46025 <entry>Use: <emphasis>pipe</emphasis></entry>
46026 <entry>Type: <emphasis>boolean</emphasis></entry>
46027 <entry>Default: <emphasis>false</emphasis></entry>
46028 </row>
46029 </tbody>
46030 </tgroup>
46031 </informaltable>
46032 <para>
46033 If this option is set and the command returns any output on stdout or
46034 stderr, the first line of output is written to the main log, whatever
46035 the return code. This option and <option>log_fail_output</option> are mutually
46036 exclusive. Only one of them may be set.
46037 </para>
46038 <para>
46039 <indexterm role="option">
46040 <primary><option>max_output</option></primary>
46041 </indexterm>
46042 </para>
46043 <informaltable frame="all">
46044 <tgroup cols="4" colsep="0" rowsep="0">
46045 <colspec colwidth="8*" align="left"/>
46046 <colspec colwidth="6*" align="center"/>
46047 <colspec colwidth="6*" align="center"/>
46048 <colspec colwidth="6*" align="right"/>
46049 <tbody>
46050 <row>
46051 <entry><option>max_output</option></entry>
46052 <entry>Use: <emphasis>pipe</emphasis></entry>
46053 <entry>Type: <emphasis>integer</emphasis></entry>
46054 <entry>Default: <emphasis>20K</emphasis></entry>
46055 </row>
46056 </tbody>
46057 </tgroup>
46058 </informaltable>
46059 <para>
46060 This specifies the maximum amount of output that the command may produce on its
46061 standard output and standard error file combined. If the limit is exceeded, the
46062 process running the command is killed. This is intended as a safety measure to
46063 catch runaway processes. The limit is applied independently of the settings of
46064 the options that control what is done with such output (for example,
46065 <option>return_output</option>). Because of buffering effects, the amount of output may
46066 exceed the limit by a small amount before Exim notices.
46067 </para>
46068 <para>
46069 <indexterm role="option">
46070 <primary><option>message_prefix</option></primary>
46071 </indexterm>
46072 </para>
46073 <informaltable frame="all">
46074 <tgroup cols="4" colsep="0" rowsep="0">
46075 <colspec colwidth="8*" align="left"/>
46076 <colspec colwidth="6*" align="center"/>
46077 <colspec colwidth="6*" align="center"/>
46078 <colspec colwidth="6*" align="right"/>
46079 <tbody>
46080 <row>
46081 <entry><option>message_prefix</option></entry>
46082 <entry>Use: <emphasis>pipe</emphasis></entry>
46083 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46084 <entry>Default: <emphasis>see below</emphasis></entry>
46085 </row>
46086 </tbody>
46087 </tgroup>
46088 </informaltable>
46089 <para>
46090 The string specified here is expanded and output at the start of every message.
46091 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is
46092 </para>
46093 <literallayout class="monospaced">
46094 message_prefix = \
46095   From ${if def:return_path{$return_path}{MAILER-DAEMON}}\
46096   ${tod_bsdinbox}\n
46097 </literallayout>
46098 <para>
46099 <indexterm role="concept">
46100 <primary>Cyrus</primary>
46101 </indexterm>
46102 <indexterm role="concept">
46103 <primary><option>tmail</option></primary>
46104 </indexterm>
46105 <indexterm role="concept">
46106 <primary><quote>From</quote> line</primary>
46107 </indexterm>
46108 This is required by the commonly used <filename>/usr/bin/vacation</filename> program.
46109 However, it must <emphasis>not</emphasis> be present if delivery is to the Cyrus IMAP server,
46110 or to the <option>tmail</option> local delivery agent. The prefix can be suppressed by
46111 setting
46112 </para>
46113 <literallayout class="monospaced">
46114 message_prefix =
46115 </literallayout>
46116 <para>
46117 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
46118 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_prefix</option>.
46119 </para>
46120 <para>
46121 <indexterm role="option">
46122 <primary><option>message_suffix</option></primary>
46123 </indexterm>
46124 </para>
46125 <informaltable frame="all">
46126 <tgroup cols="4" colsep="0" rowsep="0">
46127 <colspec colwidth="8*" align="left"/>
46128 <colspec colwidth="6*" align="center"/>
46129 <colspec colwidth="6*" align="center"/>
46130 <colspec colwidth="6*" align="right"/>
46131 <tbody>
46132 <row>
46133 <entry><option>message_suffix</option></entry>
46134 <entry>Use: <emphasis>pipe</emphasis></entry>
46135 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46136 <entry>Default: <emphasis>see below</emphasis></entry>
46137 </row>
46138 </tbody>
46139 </tgroup>
46140 </informaltable>
46141 <para>
46142 The string specified here is expanded and output at the end of every message.
46143 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is a single newline.
46144 The suffix can be suppressed by setting
46145 </para>
46146 <literallayout class="monospaced">
46147 message_suffix =
46148 </literallayout>
46149 <para>
46150 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
46151 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_suffix</option>.
46152 </para>
46153 <para>
46154 <indexterm role="option">
46155 <primary><option>path</option></primary>
46156 </indexterm>
46157 </para>
46158 <informaltable frame="all">
46159 <tgroup cols="4" colsep="0" rowsep="0">
46160 <colspec colwidth="8*" align="left"/>
46161 <colspec colwidth="6*" align="center"/>
46162 <colspec colwidth="6*" align="center"/>
46163 <colspec colwidth="6*" align="right"/>
46164 <tbody>
46165 <row>
46166 <entry><option>path</option></entry>
46167 <entry>Use: <emphasis>pipe</emphasis></entry>
46168 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46169 <entry>Default: <emphasis>/bin:/usr/bin</emphasis></entry>
46170 </row>
46171 </tbody>
46172 </tgroup>
46173 </informaltable>
46174 <para>
46175 This option is expanded and
46176 specifies the string that is set up in the PATH environment
46177 variable of the subprocess.
46178 If the <option>command</option> option does not yield an absolute path name, the command is
46179 sought in the PATH directories, in the usual way. <emphasis role="bold">Warning</emphasis>: This does not
46180 apply to a command specified as a transport filter.
46181 </para>
46182 <para>
46183 <indexterm role="option">
46184 <primary><option>permit_coredump</option></primary>
46185 </indexterm>
46186 </para>
46187 <informaltable frame="all">
46188 <tgroup cols="4" colsep="0" rowsep="0">
46189 <colspec colwidth="8*" align="left"/>
46190 <colspec colwidth="6*" align="center"/>
46191 <colspec colwidth="6*" align="center"/>
46192 <colspec colwidth="6*" align="right"/>
46193 <tbody>
46194 <row>
46195 <entry><option>permit_coredump</option></entry>
46196 <entry>Use: <emphasis>pipe</emphasis></entry>
46197 <entry>Type: <emphasis>boolean</emphasis></entry>
46198 <entry>Default: <emphasis>false</emphasis></entry>
46199 </row>
46200 </tbody>
46201 </tgroup>
46202 </informaltable>
46203 <para>
46204 Normally Exim inhibits core-dumps during delivery.  If you have a need to get
46205 a core-dump of a pipe command, enable this command.  This enables core-dumps
46206 during delivery and affects both the Exim binary and the pipe command run.
46207 It is recommended that this option remain off unless and until you have a need
46208 for it and that this only be enabled when needed, as the risk of excessive
46209 resource consumption can be quite high.  Note also that Exim is typically
46210 installed as a setuid binary and most operating systems will inhibit coredumps
46211 of these by default, so further OS-specific action may be required.
46212 </para>
46213 <para>
46214 <indexterm role="option">
46215 <primary><option>pipe_as_creator</option></primary>
46216 </indexterm>
46217 </para>
46218 <informaltable frame="all">
46219 <tgroup cols="4" colsep="0" rowsep="0">
46220 <colspec colwidth="8*" align="left"/>
46221 <colspec colwidth="6*" align="center"/>
46222 <colspec colwidth="6*" align="center"/>
46223 <colspec colwidth="6*" align="right"/>
46224 <tbody>
46225 <row>
46226 <entry><option>pipe_as_creator</option></entry>
46227 <entry>Use: <emphasis>pipe</emphasis></entry>
46228 <entry>Type: <emphasis>boolean</emphasis></entry>
46229 <entry>Default: <emphasis>false</emphasis></entry>
46230 </row>
46231 </tbody>
46232 </tgroup>
46233 </informaltable>
46234 <para>
46235 <indexterm role="concept">
46236 <primary>uid (user id)</primary>
46237 <secondary>local delivery</secondary>
46238 </indexterm>
46239 If the generic <option>user</option> option is not set and this option is true, the delivery
46240 process is run under the uid that was in force when Exim was originally called
46241 to accept the message. If the group id is not otherwise set (via the generic
46242 <option>group</option> option), the gid that was in force when Exim was originally called to
46243 accept the message is used.
46244 </para>
46245 <para>
46246 <indexterm role="option">
46247 <primary><option>restrict_to_path</option></primary>
46248 </indexterm>
46249 </para>
46250 <informaltable frame="all">
46251 <tgroup cols="4" colsep="0" rowsep="0">
46252 <colspec colwidth="8*" align="left"/>
46253 <colspec colwidth="6*" align="center"/>
46254 <colspec colwidth="6*" align="center"/>
46255 <colspec colwidth="6*" align="right"/>
46256 <tbody>
46257 <row>
46258 <entry><option>restrict_to_path</option></entry>
46259 <entry>Use: <emphasis>pipe</emphasis></entry>
46260 <entry>Type: <emphasis>boolean</emphasis></entry>
46261 <entry>Default: <emphasis>false</emphasis></entry>
46262 </row>
46263 </tbody>
46264 </tgroup>
46265 </informaltable>
46266 <para>
46267 When this option is set, any command name not listed in <option>allow_commands</option> must
46268 contain no slashes. The command is searched for only in the directories listed
46269 in the <option>path</option> option. This option is intended for use in the case when a pipe
46270 command has been generated from a user&#x2019;s <filename>.forward</filename> file. This is usually
46271 handled by a <command>pipe</command> transport called <option>address_pipe</option>.
46272 </para>
46273 <para>
46274 <indexterm role="option">
46275 <primary><option>return_fail_output</option></primary>
46276 </indexterm>
46277 </para>
46278 <informaltable frame="all">
46279 <tgroup cols="4" colsep="0" rowsep="0">
46280 <colspec colwidth="8*" align="left"/>
46281 <colspec colwidth="6*" align="center"/>
46282 <colspec colwidth="6*" align="center"/>
46283 <colspec colwidth="6*" align="right"/>
46284 <tbody>
46285 <row>
46286 <entry><option>return_fail_output</option></entry>
46287 <entry>Use: <emphasis>pipe</emphasis></entry>
46288 <entry>Type: <emphasis>boolean</emphasis></entry>
46289 <entry>Default: <emphasis>false</emphasis></entry>
46290 </row>
46291 </tbody>
46292 </tgroup>
46293 </informaltable>
46294 <para>
46295 If this option is true, and the command produced any output and ended with a
46296 return code other than zero or one of the codes listed in <option>temp_errors</option> (that
46297 is, the delivery failed), the output is returned in the bounce message.
46298 However, if the message has a null sender (that is, it is itself a bounce
46299 message), output from the command is discarded. This option and
46300 <option>return_output</option> are mutually exclusive. Only one of them may be set.
46301 </para>
46302 <para>
46303 <indexterm role="option">
46304 <primary><option>return_output</option></primary>
46305 </indexterm>
46306 </para>
46307 <informaltable frame="all">
46308 <tgroup cols="4" colsep="0" rowsep="0">
46309 <colspec colwidth="8*" align="left"/>
46310 <colspec colwidth="6*" align="center"/>
46311 <colspec colwidth="6*" align="center"/>
46312 <colspec colwidth="6*" align="right"/>
46313 <tbody>
46314 <row>
46315 <entry><option>return_output</option></entry>
46316 <entry>Use: <emphasis>pipe</emphasis></entry>
46317 <entry>Type: <emphasis>boolean</emphasis></entry>
46318 <entry>Default: <emphasis>false</emphasis></entry>
46319 </row>
46320 </tbody>
46321 </tgroup>
46322 </informaltable>
46323 <para>
46324 If this option is true, and the command produced any output, the delivery is
46325 deemed to have failed whatever the return code from the command, and the output
46326 is returned in the bounce message. Otherwise, the output is just discarded.
46327 However, if the message has a null sender (that is, it is a bounce message),
46328 output from the command is always discarded, whatever the setting of this
46329 option. This option and <option>return_fail_output</option> are mutually exclusive. Only one
46330 of them may be set.
46331 </para>
46332 <para>
46333 <indexterm role="option">
46334 <primary><option>temp_errors</option></primary>
46335 </indexterm>
46336 </para>
46337 <informaltable frame="all">
46338 <tgroup cols="4" colsep="0" rowsep="0">
46339 <colspec colwidth="8*" align="left"/>
46340 <colspec colwidth="6*" align="center"/>
46341 <colspec colwidth="6*" align="center"/>
46342 <colspec colwidth="6*" align="right"/>
46343 <tbody>
46344 <row>
46345 <entry><option>temp_errors</option></entry>
46346 <entry>Use: <emphasis>pipe</emphasis></entry>
46347 <entry>Type: <emphasis>string list</emphasis></entry>
46348 <entry>Default: <emphasis>see below</emphasis></entry>
46349 </row>
46350 </tbody>
46351 </tgroup>
46352 </informaltable>
46353 <para>
46354 <indexterm role="concept">
46355 <primary><command>pipe</command> transport</primary>
46356 <secondary>temporary failure</secondary>
46357 </indexterm>
46358 This option contains either a colon-separated list of numbers, or a single
46359 asterisk. If <option>ignore_status</option> is false
46360 and <option>return_output</option> is not set,
46361 and the command exits with a non-zero return code, the failure is treated as
46362 temporary and the delivery is deferred if the return code matches one of the
46363 numbers, or if the setting is a single asterisk. Otherwise, non-zero return
46364 codes are treated as permanent errors. The default setting contains the codes
46365 defined by EX_TEMPFAIL and EX_CANTCREAT in <filename>sysexits.h</filename>. If Exim is
46366 compiled on a system that does not define these macros, it assumes values of 75
46367 and 73, respectively.
46368 </para>
46369 <para>
46370 <indexterm role="option">
46371 <primary><option>timeout</option></primary>
46372 </indexterm>
46373 </para>
46374 <informaltable frame="all">
46375 <tgroup cols="4" colsep="0" rowsep="0">
46376 <colspec colwidth="8*" align="left"/>
46377 <colspec colwidth="6*" align="center"/>
46378 <colspec colwidth="6*" align="center"/>
46379 <colspec colwidth="6*" align="right"/>
46380 <tbody>
46381 <row>
46382 <entry><option>timeout</option></entry>
46383 <entry>Use: <emphasis>pipe</emphasis></entry>
46384 <entry>Type: <emphasis>time</emphasis></entry>
46385 <entry>Default: <emphasis>1h</emphasis></entry>
46386 </row>
46387 </tbody>
46388 </tgroup>
46389 </informaltable>
46390 <para>
46391 If the command fails to complete within this time, it is killed. This normally
46392 causes the delivery to fail (but see <option>timeout_defer</option>). A zero time interval
46393 specifies no timeout. In order to ensure that any subprocesses created by the
46394 command are also killed, Exim makes the initial process a process group leader,
46395 and kills the whole process group on a timeout. However, this can be defeated
46396 if one of the processes starts a new process group.
46397 </para>
46398 <para>
46399 <indexterm role="option">
46400 <primary><option>timeout_defer</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>timeout_defer</option></entry>
46412 <entry>Use: <emphasis>pipe</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 A timeout in a <command>pipe</command> transport, either in the command that the transport
46421 runs, or in a transport filter that is associated with it, is by default
46422 treated as a hard error, and the delivery fails. However, if <option>timeout_defer</option>
46423 is set true, both kinds of timeout become temporary errors, causing the
46424 delivery to be deferred.
46425 </para>
46426 <para>
46427 <indexterm role="option">
46428 <primary><option>umask</option></primary>
46429 </indexterm>
46430 </para>
46431 <informaltable frame="all">
46432 <tgroup cols="4" colsep="0" rowsep="0">
46433 <colspec colwidth="8*" align="left"/>
46434 <colspec colwidth="6*" align="center"/>
46435 <colspec colwidth="6*" align="center"/>
46436 <colspec colwidth="6*" align="right"/>
46437 <tbody>
46438 <row>
46439 <entry><option>umask</option></entry>
46440 <entry>Use: <emphasis>pipe</emphasis></entry>
46441 <entry>Type: <emphasis>octal integer</emphasis></entry>
46442 <entry>Default: <emphasis>022</emphasis></entry>
46443 </row>
46444 </tbody>
46445 </tgroup>
46446 </informaltable>
46447 <para>
46448 This specifies the umask setting for the subprocess that runs the command.
46449 </para>
46450 <para>
46451 <indexterm role="option">
46452 <primary><option>use_bsmtp</option></primary>
46453 </indexterm>
46454 </para>
46455 <informaltable frame="all">
46456 <tgroup cols="4" colsep="0" rowsep="0">
46457 <colspec colwidth="8*" align="left"/>
46458 <colspec colwidth="6*" align="center"/>
46459 <colspec colwidth="6*" align="center"/>
46460 <colspec colwidth="6*" align="right"/>
46461 <tbody>
46462 <row>
46463 <entry><option>use_bsmtp</option></entry>
46464 <entry>Use: <emphasis>pipe</emphasis></entry>
46465 <entry>Type: <emphasis>boolean</emphasis></entry>
46466 <entry>Default: <emphasis>false</emphasis></entry>
46467 </row>
46468 </tbody>
46469 </tgroup>
46470 </informaltable>
46471 <para>
46472 <indexterm role="concept">
46473 <primary>envelope sender</primary>
46474 </indexterm>
46475 If this option is set true, the <command>pipe</command> transport writes messages in <quote>batch
46476 SMTP</quote> format, with the envelope sender and recipient(s) included as SMTP
46477 commands. If you want to include a leading HELO command with such messages,
46478 you can do so by setting the <option>message_prefix</option> option. See section
46479 <xref linkend="SECTbatchSMTP"/> for details of batch SMTP.
46480 </para>
46481 <para>
46482 <indexterm role="option">
46483 <primary><option>use_classresources</option></primary>
46484 </indexterm>
46485 </para>
46486 <informaltable frame="all">
46487 <tgroup cols="4" colsep="0" rowsep="0">
46488 <colspec colwidth="8*" align="left"/>
46489 <colspec colwidth="6*" align="center"/>
46490 <colspec colwidth="6*" align="center"/>
46491 <colspec colwidth="6*" align="right"/>
46492 <tbody>
46493 <row>
46494 <entry><option>use_classresources</option></entry>
46495 <entry>Use: <emphasis>pipe</emphasis></entry>
46496 <entry>Type: <emphasis>boolean</emphasis></entry>
46497 <entry>Default: <emphasis>false</emphasis></entry>
46498 </row>
46499 </tbody>
46500 </tgroup>
46501 </informaltable>
46502 <para>
46503 <indexterm role="concept">
46504 <primary>class resources (BSD)</primary>
46505 </indexterm>
46506 This option is available only when Exim is running on FreeBSD, NetBSD, or
46507 BSD/OS. If it is set true, the <function>setclassresources()</function> function is used to set
46508 resource limits when a <command>pipe</command> transport is run to perform a delivery. The
46509 limits for the uid under which the pipe is to run are obtained from the login
46510 class database.
46511 </para>
46512 <para>
46513 <indexterm role="option">
46514 <primary><option>use_crlf</option></primary>
46515 </indexterm>
46516 </para>
46517 <informaltable frame="all">
46518 <tgroup cols="4" colsep="0" rowsep="0">
46519 <colspec colwidth="8*" align="left"/>
46520 <colspec colwidth="6*" align="center"/>
46521 <colspec colwidth="6*" align="center"/>
46522 <colspec colwidth="6*" align="right"/>
46523 <tbody>
46524 <row>
46525 <entry><option>use_crlf</option></entry>
46526 <entry>Use: <emphasis>pipe</emphasis></entry>
46527 <entry>Type: <emphasis>boolean</emphasis></entry>
46528 <entry>Default: <emphasis>false</emphasis></entry>
46529 </row>
46530 </tbody>
46531 </tgroup>
46532 </informaltable>
46533 <para>
46534 <indexterm role="concept">
46535 <primary>carriage return</primary>
46536 </indexterm>
46537 <indexterm role="concept">
46538 <primary>linefeed</primary>
46539 </indexterm>
46540 This option causes lines to be terminated with the two-character CRLF sequence
46541 (carriage return, linefeed) instead of just a linefeed character. In the case
46542 of batched SMTP, the byte sequence written to the pipe is then an exact image
46543 of what would be sent down a real SMTP connection.
46544 </para>
46545 <para>
46546 The contents of the <option>message_prefix</option> and <option>message_suffix</option> options are
46547 written verbatim, so must contain their own carriage return characters if these
46548 are needed. When <option>use_bsmtp</option> is not set, the default values for both
46549 <option>message_prefix</option> and <option>message_suffix</option> end with a single linefeed, so their
46550 values must be changed to end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
46551 </para>
46552 <para>
46553 <indexterm role="option">
46554 <primary><option>use_shell</option></primary>
46555 </indexterm>
46556 </para>
46557 <informaltable frame="all">
46558 <tgroup cols="4" colsep="0" rowsep="0">
46559 <colspec colwidth="8*" align="left"/>
46560 <colspec colwidth="6*" align="center"/>
46561 <colspec colwidth="6*" align="center"/>
46562 <colspec colwidth="6*" align="right"/>
46563 <tbody>
46564 <row>
46565 <entry><option>use_shell</option></entry>
46566 <entry>Use: <emphasis>pipe</emphasis></entry>
46567 <entry>Type: <emphasis>boolean</emphasis></entry>
46568 <entry>Default: <emphasis>false</emphasis></entry>
46569 </row>
46570 </tbody>
46571 </tgroup>
46572 </informaltable>
46573 <para>
46574 <indexterm role="variable">
46575 <primary><varname>$pipe_addresses</varname></primary>
46576 </indexterm>
46577 If this option is set, it causes the command to be passed to <filename>/bin/sh</filename>
46578 instead of being run directly from the transport, as described in section
46579 <xref linkend="SECThowcommandrun"/>. This is less secure, but is needed in some situations
46580 where the command is expected to be run under a shell and cannot easily be
46581 modified. The <option>allow_commands</option> and <option>restrict_to_path</option> options, and the
46582 <literal>$pipe_addresses</literal> facility are incompatible with <option>use_shell</option>. The
46583 command is expanded as a single string, and handed to <filename>/bin/sh</filename> as data for
46584 its <option>-c</option> option.
46585 </para>
46586 </section>
46587 <section id="SECID143">
46588 <title>Using an external local delivery agent</title>
46589 <para>
46590 <indexterm role="concept">
46591 <primary>local delivery</primary>
46592 <secondary>using an external agent</secondary>
46593 </indexterm>
46594 <indexterm role="concept">
46595 <primary><emphasis>procmail</emphasis></primary>
46596 </indexterm>
46597 <indexterm role="concept">
46598 <primary>external local delivery</primary>
46599 </indexterm>
46600 <indexterm role="concept">
46601 <primary>delivery</primary>
46602 <secondary><emphasis>procmail</emphasis></secondary>
46603 </indexterm>
46604 <indexterm role="concept">
46605 <primary>delivery</primary>
46606 <secondary>by external agent</secondary>
46607 </indexterm>
46608 The <command>pipe</command> transport can be used to pass all messages that require local
46609 delivery to a separate local delivery agent such as <option>procmail</option>. When doing
46610 this, care must be taken to ensure that the pipe is run under an appropriate
46611 uid and gid. In some configurations one wants this to be a uid that is trusted
46612 by the delivery agent to supply the correct sender of the message. It may be
46613 necessary to recompile or reconfigure the delivery agent so that it trusts an
46614 appropriate user. The following is an example transport and router
46615 configuration for <option>procmail</option>:
46616 </para>
46617 <literallayout class="monospaced">
46618 # transport
46619 procmail_pipe:
46620   driver = pipe
46621   command = /usr/local/bin/procmail -d $local_part
46622   return_path_add
46623   delivery_date_add
46624   envelope_to_add
46625   check_string = "From "
46626   escape_string = "&gt;From "
46627   umask = 077
46628   user = $local_part
46629   group = mail
46630
46631 # router
46632 procmail:
46633   driver = accept
46634   check_local_user
46635   transport = procmail_pipe
46636 </literallayout>
46637 <para>
46638 In this example, the pipe is run as the local user, but with the group set to
46639 <emphasis>mail</emphasis>. An alternative is to run the pipe as a specific user such as <emphasis>mail</emphasis>
46640 or <emphasis>exim</emphasis>, but in this case you must arrange for <option>procmail</option> to trust that
46641 user to supply a correct sender address. If you do not specify either a
46642 <option>group</option> or a <option>user</option> option, the pipe command is run as the local user. The
46643 home directory is the user&#x2019;s home directory by default.
46644 </para>
46645 <para>
46646 <emphasis role="bold">Note</emphasis>: The command that the pipe transport runs does <emphasis>not</emphasis> begin with
46647 </para>
46648 <literallayout class="monospaced">
46649 IFS=" "
46650 </literallayout>
46651 <para>
46652 as shown in some <option>procmail</option> documentation, because Exim does not by default
46653 use a shell to run pipe commands.
46654 </para>
46655 <para>
46656 <indexterm role="concept">
46657 <primary>Cyrus</primary>
46658 </indexterm>
46659 The next example shows a transport and a router for a system where local
46660 deliveries are handled by the Cyrus IMAP server.
46661 </para>
46662 <literallayout class="monospaced">
46663 # transport
46664 local_delivery_cyrus:
46665   driver = pipe
46666   command = /usr/cyrus/bin/deliver \
46667             -m ${substr_1:$local_part_suffix} -- $local_part
46668   user = cyrus
46669   group = mail
46670   return_output
46671   log_output
46672   message_prefix =
46673   message_suffix =
46674
46675 # router
46676 local_user_cyrus:
46677   driver = accept
46678   check_local_user
46679   local_part_suffix = .*
46680   transport = local_delivery_cyrus
46681 </literallayout>
46682 <para>
46683 Note the unsetting of <option>message_prefix</option> and <option>message_suffix</option>, and the use of
46684 <option>return_output</option> to cause any text written by Cyrus to be returned to the
46685 sender.
46686 <indexterm role="concept" startref="IIDpiptra1" class="endofrange"/>
46687 <indexterm role="concept" startref="IIDpiptra2" class="endofrange"/>
46688 </para>
46689 </section>
46690 </chapter>
46691
46692 <chapter id="CHAPsmtptrans">
46693 <title>The smtp transport</title>
46694 <para>
46695 <indexterm role="concept" id="IIDsmttra1" class="startofrange">
46696 <primary>transports</primary>
46697 <secondary><command>smtp</command></secondary>
46698 </indexterm>
46699 <indexterm role="concept" id="IIDsmttra2" class="startofrange">
46700 <primary><command>smtp</command> transport</primary>
46701 </indexterm>
46702 The <command>smtp</command> transport delivers messages over TCP/IP connections using the SMTP
46703 or LMTP protocol. The list of hosts to try can either be taken from the address
46704 that is being processed (having been set up by the router), or specified
46705 explicitly for the transport. Timeout and retry processing (see chapter
46706 <xref linkend="CHAPretry"/>) is applied to each IP address independently.
46707 </para>
46708 <section id="SECID144">
46709 <title>Multiple messages on a single connection</title>
46710 <para>
46711 The sending of multiple messages over a single TCP/IP connection can arise in
46712 two ways:
46713 </para>
46714 <itemizedlist>
46715 <listitem>
46716 <para>
46717 If a message contains more than <option>max_rcpt</option> (see below) addresses that are
46718 routed to the same host, more than one copy of the message has to be sent to
46719 that host. In this situation, multiple copies may be sent in a single run of
46720 the <command>smtp</command> transport over a single TCP/IP connection. (What Exim actually
46721 does when it has too many addresses to send in one message also depends on the
46722 value of the global <option>remote_max_parallel</option> option. Details are given in
46723 section <xref linkend="SECToutSMTPTCP"/>.)
46724 </para>
46725 </listitem>
46726 <listitem>
46727 <para>
46728 <indexterm role="concept">
46729 <primary>hints database</primary>
46730 <secondary>remembering routing</secondary>
46731 </indexterm>
46732 When a message has been successfully delivered over a TCP/IP connection, Exim
46733 looks in its hints database to see if there are any other messages awaiting a
46734 connection to the same host. If there are, a new delivery process is started
46735 for one of them, and the current TCP/IP connection is passed on to it. The new
46736 process may in turn send multiple copies and possibly create yet another
46737 process.
46738 </para>
46739 </listitem>
46740 </itemizedlist>
46741 <para>
46742 For each copy sent over the same TCP/IP connection, a sequence counter is
46743 incremented, and if it ever gets to the value of <option>connection_max_messages</option>,
46744 no further messages are sent over that connection.
46745 </para>
46746 </section>
46747 <section id="SECID145">
46748 <title>Use of the $host and $host_address variables</title>
46749 <para>
46750 <indexterm role="variable">
46751 <primary><varname>$host</varname></primary>
46752 </indexterm>
46753 <indexterm role="variable">
46754 <primary><varname>$host_address</varname></primary>
46755 </indexterm>
46756 At the start of a run of the <command>smtp</command> transport, the values of <varname>$host</varname> and
46757 <varname>$host_address</varname> are the name and IP address of the first host on the host list
46758 passed by the router. However, when the transport is about to connect to a
46759 specific host, and while it is connected to that host, <varname>$host</varname> and
46760 <varname>$host_address</varname> are set to the values for that host. These are the values
46761 that are in force when the <option>helo_data</option>, <option>hosts_try_auth</option>, <option>interface</option>,
46762 <option>serialize_hosts</option>, and the various TLS options are expanded.
46763 </para>
46764 </section>
46765 <section id="usecippeer">
46766 <title>Use of $tls_cipher and $tls_peerdn</title>
46767 <para>
46768 <indexterm role="variable">
46769 <primary><varname>$tls_bits</varname></primary>
46770 </indexterm>
46771 <indexterm role="variable">
46772 <primary><varname>$tls_cipher</varname></primary>
46773 </indexterm>
46774 <indexterm role="variable">
46775 <primary><varname>$tls_peerdn</varname></primary>
46776 </indexterm>
46777 <indexterm role="variable">
46778 <primary><varname>$tls_sni</varname></primary>
46779 </indexterm>
46780 At the start of a run of the <command>smtp</command> transport, the values of <varname>$tls_bits</varname>,
46781 <varname>$tls_cipher</varname>, <varname>$tls_peerdn</varname> and <varname>$tls_sni</varname>
46782 are the values that were set when the message was received.
46783 These are the values that are used for options that are expanded before any
46784 SMTP connections are made. Just before each connection is made, these four
46785 variables are emptied. If TLS is subsequently started, they are set to the
46786 appropriate values for the outgoing connection, and these are the values that
46787 are in force when any authenticators are run and when the
46788 <option>authenticated_sender</option> option is expanded.
46789 </para>
46790 <para>
46791 These variables are deprecated in favour of <varname>$tls_in_cipher</varname> et. al.
46792 and will be removed in a future release.
46793 </para>
46794 </section>
46795 <section id="SECID146">
46796 <title>Private options for smtp</title>
46797 <para>
46798 <indexterm role="concept">
46799 <primary>options</primary>
46800 <secondary><command>smtp</command> transport</secondary>
46801 </indexterm>
46802 The private options of the <command>smtp</command> transport are as follows:
46803 </para>
46804 <para>
46805 <indexterm role="option">
46806 <primary><option>address_retry_include_sender</option></primary>
46807 </indexterm>
46808 </para>
46809 <informaltable frame="all">
46810 <tgroup cols="4" colsep="0" rowsep="0">
46811 <colspec colwidth="8*" align="left"/>
46812 <colspec colwidth="6*" align="center"/>
46813 <colspec colwidth="6*" align="center"/>
46814 <colspec colwidth="6*" align="right"/>
46815 <tbody>
46816 <row>
46817 <entry><option>address_retry_include_sender</option></entry>
46818 <entry>Use: <emphasis>smtp</emphasis></entry>
46819 <entry>Type: <emphasis>boolean</emphasis></entry>
46820 <entry>Default: <emphasis>true</emphasis></entry>
46821 </row>
46822 </tbody>
46823 </tgroup>
46824 </informaltable>
46825 <para>
46826 <indexterm role="concept">
46827 <primary>4<emphasis>xx</emphasis> responses</primary>
46828 <secondary>retrying after</secondary>
46829 </indexterm>
46830 When an address is delayed because of a 4<emphasis>xx</emphasis> response to a RCPT command, it
46831 is the combination of sender and recipient that is delayed in subsequent queue
46832 runs until the retry time is reached. You can delay the recipient without
46833 reference to the sender (which is what earlier versions of Exim did), by
46834 setting <option>address_retry_include_sender</option> false. However, this can lead to
46835 problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT commands.
46836 </para>
46837 <para>
46838 <indexterm role="option">
46839 <primary><option>allow_localhost</option></primary>
46840 </indexterm>
46841 </para>
46842 <informaltable frame="all">
46843 <tgroup cols="4" colsep="0" rowsep="0">
46844 <colspec colwidth="8*" align="left"/>
46845 <colspec colwidth="6*" align="center"/>
46846 <colspec colwidth="6*" align="center"/>
46847 <colspec colwidth="6*" align="right"/>
46848 <tbody>
46849 <row>
46850 <entry><option>allow_localhost</option></entry>
46851 <entry>Use: <emphasis>smtp</emphasis></entry>
46852 <entry>Type: <emphasis>boolean</emphasis></entry>
46853 <entry>Default: <emphasis>false</emphasis></entry>
46854 </row>
46855 </tbody>
46856 </tgroup>
46857 </informaltable>
46858 <para>
46859 <indexterm role="concept">
46860 <primary>local host</primary>
46861 <secondary>sending to</secondary>
46862 </indexterm>
46863 <indexterm role="concept">
46864 <primary>fallback</primary>
46865 <secondary>hosts specified on transport</secondary>
46866 </indexterm>
46867 When a host specified in <option>hosts</option> or <option>fallback_hosts</option> (see below) turns out
46868 to be the local host, or is listed in <option>hosts_treat_as_local</option>, delivery is
46869 deferred by default. However, if <option>allow_localhost</option> is set, Exim goes on to do
46870 the delivery anyway. This should be used only in special cases when the
46871 configuration ensures that no looping will result (for example, a differently
46872 configured Exim is listening on the port to which the message is sent).
46873 </para>
46874 <para>
46875 <indexterm role="option">
46876 <primary><option>authenticated_sender</option></primary>
46877 </indexterm>
46878 </para>
46879 <informaltable frame="all">
46880 <tgroup cols="4" colsep="0" rowsep="0">
46881 <colspec colwidth="8*" align="left"/>
46882 <colspec colwidth="6*" align="center"/>
46883 <colspec colwidth="6*" align="center"/>
46884 <colspec colwidth="6*" align="right"/>
46885 <tbody>
46886 <row>
46887 <entry><option>authenticated_sender</option></entry>
46888 <entry>Use: <emphasis>smtp</emphasis></entry>
46889 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46890 <entry>Default: <emphasis>unset</emphasis></entry>
46891 </row>
46892 </tbody>
46893 </tgroup>
46894 </informaltable>
46895 <para>
46896 <indexterm role="concept">
46897 <primary>Cyrus</primary>
46898 </indexterm>
46899 When Exim has authenticated as a client, or if <option>authenticated_sender_force</option>
46900 is true, this option sets a value for the AUTH= item on outgoing MAIL commands,
46901 overriding any existing authenticated sender value. If the string expansion is
46902 forced to fail, the option is ignored. Other expansion failures cause delivery
46903 to be deferred. If the result of expansion is an empty string, that is also
46904 ignored.
46905 </para>
46906 <para>
46907 The expansion happens after the outgoing connection has been made and TLS
46908 started, if required. This means that the <varname>$host</varname>, <varname>$host_address</varname>,
46909 <varname>$tls_out_cipher</varname>, and <varname>$tls_out_peerdn</varname> variables are set according to the
46910 particular connection.
46911 </para>
46912 <para>
46913 If the SMTP session is not authenticated, the expansion of
46914 <option>authenticated_sender</option> still happens (and can cause the delivery to be
46915 deferred if it fails), but no AUTH= item is added to MAIL commands
46916 unless <option>authenticated_sender_force</option> is true.
46917 </para>
46918 <para>
46919 This option allows you to use the <command>smtp</command> transport in LMTP mode to
46920 deliver mail to Cyrus IMAP and provide the proper local part as the
46921 <quote>authenticated sender</quote>, via a setting such as:
46922 </para>
46923 <literallayout class="monospaced">
46924 authenticated_sender = $local_part
46925 </literallayout>
46926 <para>
46927 This removes the need for IMAP subfolders to be assigned special ACLs to
46928 allow direct delivery to those subfolders.
46929 </para>
46930 <para>
46931 Because of expected uses such as that just described for Cyrus (when no
46932 domain is involved), there is no checking on the syntax of the provided
46933 value.
46934 </para>
46935 <para>
46936 <indexterm role="option">
46937 <primary><option>authenticated_sender_force</option></primary>
46938 </indexterm>
46939 </para>
46940 <informaltable frame="all">
46941 <tgroup cols="4" colsep="0" rowsep="0">
46942 <colspec colwidth="8*" align="left"/>
46943 <colspec colwidth="6*" align="center"/>
46944 <colspec colwidth="6*" align="center"/>
46945 <colspec colwidth="6*" align="right"/>
46946 <tbody>
46947 <row>
46948 <entry><option>authenticated_sender_force</option></entry>
46949 <entry>Use: <emphasis>smtp</emphasis></entry>
46950 <entry>Type: <emphasis>boolean</emphasis></entry>
46951 <entry>Default: <emphasis>false</emphasis></entry>
46952 </row>
46953 </tbody>
46954 </tgroup>
46955 </informaltable>
46956 <para>
46957 If this option is set true, the <option>authenticated_sender</option> option&#x2019;s value
46958 is used for the AUTH= item on outgoing MAIL commands, even if Exim has not
46959 authenticated as a client.
46960 </para>
46961 <para>
46962 <indexterm role="option">
46963 <primary><option>command_timeout</option></primary>
46964 </indexterm>
46965 </para>
46966 <informaltable frame="all">
46967 <tgroup cols="4" colsep="0" rowsep="0">
46968 <colspec colwidth="8*" align="left"/>
46969 <colspec colwidth="6*" align="center"/>
46970 <colspec colwidth="6*" align="center"/>
46971 <colspec colwidth="6*" align="right"/>
46972 <tbody>
46973 <row>
46974 <entry><option>command_timeout</option></entry>
46975 <entry>Use: <emphasis>smtp</emphasis></entry>
46976 <entry>Type: <emphasis>time</emphasis></entry>
46977 <entry>Default: <emphasis>5m</emphasis></entry>
46978 </row>
46979 </tbody>
46980 </tgroup>
46981 </informaltable>
46982 <para>
46983 This sets a timeout for receiving a response to an SMTP command that has been
46984 sent out. It is also used when waiting for the initial banner line from the
46985 remote host. Its value must not be zero.
46986 </para>
46987 <para>
46988 <indexterm role="option">
46989 <primary><option>connect_timeout</option></primary>
46990 </indexterm>
46991 </para>
46992 <informaltable frame="all">
46993 <tgroup cols="4" colsep="0" rowsep="0">
46994 <colspec colwidth="8*" align="left"/>
46995 <colspec colwidth="6*" align="center"/>
46996 <colspec colwidth="6*" align="center"/>
46997 <colspec colwidth="6*" align="right"/>
46998 <tbody>
46999 <row>
47000 <entry><option>connect_timeout</option></entry>
47001 <entry>Use: <emphasis>smtp</emphasis></entry>
47002 <entry>Type: <emphasis>time</emphasis></entry>
47003 <entry>Default: <emphasis>5m</emphasis></entry>
47004 </row>
47005 </tbody>
47006 </tgroup>
47007 </informaltable>
47008 <para>
47009 This sets a timeout for the <function>connect()</function> function, which sets up a TCP/IP call
47010 to a remote host. A setting of zero allows the system timeout (typically
47011 several minutes) to act. To have any effect, the value of this option must be
47012 less than the system timeout. However, it has been observed that on some
47013 systems there is no system timeout, which is why the default value for this
47014 option is 5 minutes, a value recommended by RFC 1123.
47015 </para>
47016 <para>
47017 <indexterm role="option">
47018 <primary><option>connection_max_messages</option></primary>
47019 </indexterm>
47020 </para>
47021 <informaltable frame="all">
47022 <tgroup cols="4" colsep="0" rowsep="0">
47023 <colspec colwidth="8*" align="left"/>
47024 <colspec colwidth="6*" align="center"/>
47025 <colspec colwidth="6*" align="center"/>
47026 <colspec colwidth="6*" align="right"/>
47027 <tbody>
47028 <row>
47029 <entry><option>connection_max_messages</option></entry>
47030 <entry>Use: <emphasis>smtp</emphasis></entry>
47031 <entry>Type: <emphasis>integer</emphasis></entry>
47032 <entry>Default: <emphasis>500</emphasis></entry>
47033 </row>
47034 </tbody>
47035 </tgroup>
47036 </informaltable>
47037 <para>
47038 <indexterm role="concept">
47039 <primary>SMTP</primary>
47040 <secondary>passed connection</secondary>
47041 </indexterm>
47042 <indexterm role="concept">
47043 <primary>SMTP</primary>
47044 <secondary>multiple deliveries</secondary>
47045 </indexterm>
47046 <indexterm role="concept">
47047 <primary>multiple SMTP deliveries</primary>
47048 </indexterm>
47049 This controls the maximum number of separate message deliveries that are sent
47050 over a single TCP/IP connection. If the value is zero, there is no limit.
47051 For testing purposes, this value can be overridden by the <option>-oB</option> command line
47052 option.
47053 </para>
47054 <para>
47055 <indexterm role="option">
47056 <primary><option>dane_require_tls_ciphers</option></primary>
47057 </indexterm>
47058 </para>
47059 <informaltable frame="all">
47060 <tgroup cols="4" colsep="0" rowsep="0">
47061 <colspec colwidth="8*" align="left"/>
47062 <colspec colwidth="6*" align="center"/>
47063 <colspec colwidth="6*" align="center"/>
47064 <colspec colwidth="6*" align="right"/>
47065 <tbody>
47066 <row>
47067 <entry><option>dane_require_tls_ciphers</option></entry>
47068 <entry>Use: <emphasis>smtp</emphasis></entry>
47069 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47070 <entry>Default: <emphasis>unset</emphasis></entry>
47071 </row>
47072 </tbody>
47073 </tgroup>
47074 </informaltable>
47075 <para>
47076 <indexterm role="concept">
47077 <primary>TLS</primary>
47078 <secondary>requiring specific ciphers for DANE</secondary>
47079 </indexterm>
47080 <indexterm role="concept">
47081 <primary>cipher</primary>
47082 <secondary>requiring specific</secondary>
47083 </indexterm>
47084 <indexterm role="concept">
47085 <primary>DANE</primary>
47086 <secondary>TLS ciphers</secondary>
47087 </indexterm>
47088 This option may be used to override <option>tls_require_ciphers</option> for connections
47089 where DANE has been determined to be in effect.
47090 If not set, then <option>tls_require_ciphers</option> will be used.
47091 Normal SMTP delivery is not able to make strong demands of TLS cipher
47092 configuration, because delivery will fall back to plaintext.  Once DANE has
47093 been determined to be in effect, there is no plaintext fallback and making the
47094 TLS cipherlist configuration stronger will increase security, rather than
47095 counter-intuitively decreasing it.
47096 If the option expands to be empty or is forced to fail, then it will
47097 be treated as unset and <option>tls_require_ciphers</option> will be used instead.
47098 </para>
47099 <para>
47100 <indexterm role="option">
47101 <primary><option>data_timeout</option></primary>
47102 </indexterm>
47103 </para>
47104 <informaltable frame="all">
47105 <tgroup cols="4" colsep="0" rowsep="0">
47106 <colspec colwidth="8*" align="left"/>
47107 <colspec colwidth="6*" align="center"/>
47108 <colspec colwidth="6*" align="center"/>
47109 <colspec colwidth="6*" align="right"/>
47110 <tbody>
47111 <row>
47112 <entry><option>data_timeout</option></entry>
47113 <entry>Use: <emphasis>smtp</emphasis></entry>
47114 <entry>Type: <emphasis>time</emphasis></entry>
47115 <entry>Default: <emphasis>5m</emphasis></entry>
47116 </row>
47117 </tbody>
47118 </tgroup>
47119 </informaltable>
47120 <para>
47121 This sets a timeout for the transmission of each block in the data portion of
47122 the message. As a result, the overall timeout for a message depends on the size
47123 of the message. Its value must not be zero. See also <option>final_timeout</option>.
47124 </para>
47125 <para>
47126 <indexterm role="option">
47127 <primary><option>dkim_canon</option></primary>
47128 </indexterm>
47129 </para>
47130 <informaltable frame="all">
47131 <tgroup cols="4" colsep="0" rowsep="0">
47132 <colspec colwidth="8*" align="left"/>
47133 <colspec colwidth="6*" align="center"/>
47134 <colspec colwidth="6*" align="center"/>
47135 <colspec colwidth="6*" align="right"/>
47136 <tbody>
47137 <row>
47138 <entry><option>dkim_canon</option></entry>
47139 <entry>Use: <emphasis>smtp</emphasis></entry>
47140 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47141 <entry>Default: <emphasis>unset</emphasis></entry>
47142 </row>
47143 </tbody>
47144 </tgroup>
47145 </informaltable>
47146 <para>
47147 <indexterm role="option">
47148 <primary><option>unset</option></primary>
47149 </indexterm>
47150 </para>
47151 <informaltable frame="all">
47152 <tgroup cols="4" colsep="0" rowsep="0">
47153 <colspec colwidth="8*" align="left"/>
47154 <colspec colwidth="6*" align="center"/>
47155 <colspec colwidth="6*" align="center"/>
47156 <colspec colwidth="6*" align="right"/>
47157 <tbody>
47158 <row>
47159 <entry><option>dkim_domain</option></entry>
47160 <entry>Use: <emphasis>smtp</emphasis></entry>
47161 <entry>Type: <emphasis>string</emphasis></entry>
47162 <entry>Default: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
47163 </row>
47164 </tbody>
47165 </tgroup>
47166 </informaltable>
47167 <para>
47168 <indexterm role="option">
47169 <primary><option>dkim_hash</option></primary>
47170 </indexterm>
47171 </para>
47172 <informaltable frame="all">
47173 <tgroup cols="4" colsep="0" rowsep="0">
47174 <colspec colwidth="8*" align="left"/>
47175 <colspec colwidth="6*" align="center"/>
47176 <colspec colwidth="6*" align="center"/>
47177 <colspec colwidth="6*" align="right"/>
47178 <tbody>
47179 <row>
47180 <entry><option>dkim_hash</option></entry>
47181 <entry>Use: <emphasis>smtp</emphasis></entry>
47182 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47183 <entry>Default: <emphasis>sha256</emphasis></entry>
47184 </row>
47185 </tbody>
47186 </tgroup>
47187 </informaltable>
47188 <para>
47189 <indexterm role="option">
47190 <primary><option>dkim_identity</option></primary>
47191 </indexterm>
47192 </para>
47193 <informaltable frame="all">
47194 <tgroup cols="4" colsep="0" rowsep="0">
47195 <colspec colwidth="8*" align="left"/>
47196 <colspec colwidth="6*" align="center"/>
47197 <colspec colwidth="6*" align="center"/>
47198 <colspec colwidth="6*" align="right"/>
47199 <tbody>
47200 <row>
47201 <entry><option>dkim_identity</option></entry>
47202 <entry>Use: <emphasis>smtp</emphasis></entry>
47203 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47204 <entry>Default: <emphasis>unset</emphasis></entry>
47205 </row>
47206 </tbody>
47207 </tgroup>
47208 </informaltable>
47209 <para>
47210 <indexterm role="option">
47211 <primary><option>dkim_private_key</option></primary>
47212 </indexterm>
47213 </para>
47214 <informaltable frame="all">
47215 <tgroup cols="4" colsep="0" rowsep="0">
47216 <colspec colwidth="8*" align="left"/>
47217 <colspec colwidth="6*" align="center"/>
47218 <colspec colwidth="6*" align="center"/>
47219 <colspec colwidth="6*" align="right"/>
47220 <tbody>
47221 <row>
47222 <entry><option>dkim_private_key</option></entry>
47223 <entry>Use: <emphasis>smtp</emphasis></entry>
47224 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47225 <entry>Default: <emphasis>unset</emphasis></entry>
47226 </row>
47227 </tbody>
47228 </tgroup>
47229 </informaltable>
47230 <para>
47231 <indexterm role="option">
47232 <primary><option>dkim_selector</option></primary>
47233 </indexterm>
47234 </para>
47235 <informaltable frame="all">
47236 <tgroup cols="4" colsep="0" rowsep="0">
47237 <colspec colwidth="8*" align="left"/>
47238 <colspec colwidth="6*" align="center"/>
47239 <colspec colwidth="6*" align="center"/>
47240 <colspec colwidth="6*" align="right"/>
47241 <tbody>
47242 <row>
47243 <entry><option>dkim_selector</option></entry>
47244 <entry>Use: <emphasis>smtp</emphasis></entry>
47245 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47246 <entry>Default: <emphasis>unset</emphasis></entry>
47247 </row>
47248 </tbody>
47249 </tgroup>
47250 </informaltable>
47251 <para>
47252 <indexterm role="option">
47253 <primary><option>dkim_strict</option></primary>
47254 </indexterm>
47255 </para>
47256 <informaltable frame="all">
47257 <tgroup cols="4" colsep="0" rowsep="0">
47258 <colspec colwidth="8*" align="left"/>
47259 <colspec colwidth="6*" align="center"/>
47260 <colspec colwidth="6*" align="center"/>
47261 <colspec colwidth="6*" align="right"/>
47262 <tbody>
47263 <row>
47264 <entry><option>dkim_strict</option></entry>
47265 <entry>Use: <emphasis>smtp</emphasis></entry>
47266 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47267 <entry>Default: <emphasis>unset</emphasis></entry>
47268 </row>
47269 </tbody>
47270 </tgroup>
47271 </informaltable>
47272 <para>
47273 <indexterm role="option">
47274 <primary><option>dkim_sign_headers</option></primary>
47275 </indexterm>
47276 </para>
47277 <informaltable frame="all">
47278 <tgroup cols="4" colsep="0" rowsep="0">
47279 <colspec colwidth="8*" align="left"/>
47280 <colspec colwidth="6*" align="center"/>
47281 <colspec colwidth="6*" align="center"/>
47282 <colspec colwidth="6*" align="right"/>
47283 <tbody>
47284 <row>
47285 <entry><option>dkim_sign_headers</option></entry>
47286 <entry>Use: <emphasis>smtp</emphasis></entry>
47287 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47288 <entry>Default: <emphasis>per RFC</emphasis></entry>
47289 </row>
47290 </tbody>
47291 </tgroup>
47292 </informaltable>
47293 <para>
47294 <indexterm role="option">
47295 <primary><option>dkim_timestamps</option></primary>
47296 </indexterm>
47297 </para>
47298 <informaltable frame="all">
47299 <tgroup cols="4" colsep="0" rowsep="0">
47300 <colspec colwidth="8*" align="left"/>
47301 <colspec colwidth="6*" align="center"/>
47302 <colspec colwidth="6*" align="center"/>
47303 <colspec colwidth="6*" align="right"/>
47304 <tbody>
47305 <row>
47306 <entry><option>dkim_timestamps</option></entry>
47307 <entry>Use: <emphasis>smtp</emphasis></entry>
47308 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47309 <entry>Default: <emphasis>unset</emphasis></entry>
47310 </row>
47311 </tbody>
47312 </tgroup>
47313 </informaltable>
47314 <para>
47315 DKIM signing options.  For details see section <xref linkend="SECDKIMSIGN"/>.
47316 </para>
47317 <para>
47318 <indexterm role="option">
47319 <primary><option>delay_after_cutoff</option></primary>
47320 </indexterm>
47321 </para>
47322 <informaltable frame="all">
47323 <tgroup cols="4" colsep="0" rowsep="0">
47324 <colspec colwidth="8*" align="left"/>
47325 <colspec colwidth="6*" align="center"/>
47326 <colspec colwidth="6*" align="center"/>
47327 <colspec colwidth="6*" align="right"/>
47328 <tbody>
47329 <row>
47330 <entry><option>delay_after_cutoff</option></entry>
47331 <entry>Use: <emphasis>smtp</emphasis></entry>
47332 <entry>Type: <emphasis>boolean</emphasis></entry>
47333 <entry>Default: <emphasis>true</emphasis></entry>
47334 </row>
47335 </tbody>
47336 </tgroup>
47337 </informaltable>
47338 <para>
47339 <indexterm role="concept">
47340 <primary>final cutoff</primary>
47341 <secondary>retries, controlling</secondary>
47342 </indexterm>
47343 <indexterm role="concept">
47344 <primary>retry</primary>
47345 <secondary>final cutoff</secondary>
47346 </indexterm>
47347 This option controls what happens when all remote IP addresses for a given
47348 domain have been inaccessible for so long that they have passed their retry
47349 cutoff times.
47350 </para>
47351 <para>
47352 In the default state, if the next retry time has not been reached for any of
47353 them, the address is bounced without trying any deliveries. In other words,
47354 Exim delays retrying an IP address after the final cutoff time until a new
47355 retry time is reached, and can therefore bounce an address without ever trying
47356 a delivery, when machines have been down for a long time. Some people are
47357 unhappy at this prospect, so...
47358 </para>
47359 <para>
47360 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
47361 addresses are past their final cutoff time, Exim tries to deliver to those
47362 IP addresses that have not been tried since the message arrived. If there are
47363 none, of if they all fail, the address is bounced. In other words, it does not
47364 delay when a new message arrives, but immediately tries those expired IP
47365 addresses that haven&#x2019;t been tried since the message arrived. If there is a
47366 continuous stream of messages for the dead hosts, unsetting
47367 <option>delay_after_cutoff</option> means that there will be many more attempts to deliver
47368 to them.
47369 </para>
47370 <para>
47371 <indexterm role="option">
47372 <primary><option>dns_qualify_single</option></primary>
47373 </indexterm>
47374 </para>
47375 <informaltable frame="all">
47376 <tgroup cols="4" colsep="0" rowsep="0">
47377 <colspec colwidth="8*" align="left"/>
47378 <colspec colwidth="6*" align="center"/>
47379 <colspec colwidth="6*" align="center"/>
47380 <colspec colwidth="6*" align="right"/>
47381 <tbody>
47382 <row>
47383 <entry><option>dns_qualify_single</option></entry>
47384 <entry>Use: <emphasis>smtp</emphasis></entry>
47385 <entry>Type: <emphasis>boolean</emphasis></entry>
47386 <entry>Default: <emphasis>true</emphasis></entry>
47387 </row>
47388 </tbody>
47389 </tgroup>
47390 </informaltable>
47391 <para>
47392 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used,
47393 and the <option>gethostbyname</option> option is false,
47394 the RES_DEFNAMES resolver option is set. See the <option>qualify_single</option> option
47395 in chapter <xref linkend="CHAPdnslookup"/> for more details.
47396 </para>
47397 <para>
47398 <indexterm role="option">
47399 <primary><option>dns_search_parents</option></primary>
47400 </indexterm>
47401 </para>
47402 <informaltable frame="all">
47403 <tgroup cols="4" colsep="0" rowsep="0">
47404 <colspec colwidth="8*" align="left"/>
47405 <colspec colwidth="6*" align="center"/>
47406 <colspec colwidth="6*" align="center"/>
47407 <colspec colwidth="6*" align="right"/>
47408 <tbody>
47409 <row>
47410 <entry><option>dns_search_parents</option></entry>
47411 <entry>Use: <emphasis>smtp</emphasis></entry>
47412 <entry>Type: <emphasis>boolean</emphasis></entry>
47413 <entry>Default: <emphasis>false</emphasis></entry>
47414 </row>
47415 </tbody>
47416 </tgroup>
47417 </informaltable>
47418 <para>
47419 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used, and the
47420 <option>gethostbyname</option> option is false, the RES_DNSRCH resolver option is set.
47421 See the <option>search_parents</option> option in chapter <xref linkend="CHAPdnslookup"/> for more
47422 details.
47423 </para>
47424 <para>
47425 <indexterm role="option">
47426 <primary><option>dnssec_request_domains</option></primary>
47427 </indexterm>
47428 </para>
47429 <informaltable frame="all">
47430 <tgroup cols="4" colsep="0" rowsep="0">
47431 <colspec colwidth="8*" align="left"/>
47432 <colspec colwidth="6*" align="center"/>
47433 <colspec colwidth="6*" align="center"/>
47434 <colspec colwidth="6*" align="right"/>
47435 <tbody>
47436 <row>
47437 <entry><option>dnssec_request_domains</option></entry>
47438 <entry>Use: <emphasis>smtp</emphasis></entry>
47439 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
47440 <entry>Default: <emphasis>unset</emphasis></entry>
47441 </row>
47442 </tbody>
47443 </tgroup>
47444 </informaltable>
47445 <para>
47446 <indexterm role="concept">
47447 <primary>MX record</primary>
47448 <secondary>security</secondary>
47449 </indexterm>
47450 <indexterm role="concept">
47451 <primary>DNSSEC</primary>
47452 <secondary>MX lookup</secondary>
47453 </indexterm>
47454 <indexterm role="concept">
47455 <primary>security</primary>
47456 <secondary>MX lookup</secondary>
47457 </indexterm>
47458 <indexterm role="concept">
47459 <primary>DNS</primary>
47460 <secondary>DNSSEC</secondary>
47461 </indexterm>
47462 DNS lookups for domains matching <option>dnssec_request_domains</option> will be done with
47463 the dnssec request bit set.
47464 This applies to all of the SRV, MX, AAAA, A lookup sequence.
47465 </para>
47466 <para>
47467 <indexterm role="option">
47468 <primary><option>dnssec_require_domains</option></primary>
47469 </indexterm>
47470 </para>
47471 <informaltable frame="all">
47472 <tgroup cols="4" colsep="0" rowsep="0">
47473 <colspec colwidth="8*" align="left"/>
47474 <colspec colwidth="6*" align="center"/>
47475 <colspec colwidth="6*" align="center"/>
47476 <colspec colwidth="6*" align="right"/>
47477 <tbody>
47478 <row>
47479 <entry><option>dnssec_require_domains</option></entry>
47480 <entry>Use: <emphasis>smtp</emphasis></entry>
47481 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
47482 <entry>Default: <emphasis>unset</emphasis></entry>
47483 </row>
47484 </tbody>
47485 </tgroup>
47486 </informaltable>
47487 <para>
47488 <indexterm role="concept">
47489 <primary>MX record</primary>
47490 <secondary>security</secondary>
47491 </indexterm>
47492 <indexterm role="concept">
47493 <primary>DNSSEC</primary>
47494 <secondary>MX lookup</secondary>
47495 </indexterm>
47496 <indexterm role="concept">
47497 <primary>security</primary>
47498 <secondary>MX lookup</secondary>
47499 </indexterm>
47500 <indexterm role="concept">
47501 <primary>DNS</primary>
47502 <secondary>DNSSEC</secondary>
47503 </indexterm>
47504 DNS lookups for domains matching <option>dnssec_require_domains</option> will be done with
47505 the dnssec request bit set.  Any returns not having the Authenticated Data bit
47506 (AD bit) set will be ignored and logged as a host-lookup failure.
47507 This applies to all of the SRV, MX, AAAA, A lookup sequence.
47508 </para>
47509 <para>
47510 <indexterm role="option">
47511 <primary><option>dscp</option></primary>
47512 </indexterm>
47513 </para>
47514 <informaltable frame="all">
47515 <tgroup cols="4" colsep="0" rowsep="0">
47516 <colspec colwidth="8*" align="left"/>
47517 <colspec colwidth="6*" align="center"/>
47518 <colspec colwidth="6*" align="center"/>
47519 <colspec colwidth="6*" align="right"/>
47520 <tbody>
47521 <row>
47522 <entry><option>dscp</option></entry>
47523 <entry>Use: <emphasis>smtp</emphasis></entry>
47524 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47525 <entry>Default: <emphasis>unset</emphasis></entry>
47526 </row>
47527 </tbody>
47528 </tgroup>
47529 </informaltable>
47530 <para>
47531 <indexterm role="concept">
47532 <primary>DCSP</primary>
47533 <secondary>outbound</secondary>
47534 </indexterm>
47535 This option causes the DSCP value associated with a socket to be set to one
47536 of a number of fixed strings or to numeric value.
47537 The <option>-bI:dscp</option> option may be used to ask Exim which names it knows of.
47538 Common values include <literal>throughput</literal>, <literal>mincost</literal>, and on newer systems
47539 <literal>ef</literal>, <literal>af41</literal>, etc.  Numeric values may be in the range 0 to 0x3F.
47540 </para>
47541 <para>
47542 The outbound packets from Exim will be marked with this value in the header
47543 (for IPv4, the TOS field; for IPv6, the TCLASS field); there is no guarantee
47544 that these values will have any effect, not be stripped by networking
47545 equipment, or do much of anything without cooperation with your Network
47546 Engineer and those of all network operators between the source and destination.
47547 </para>
47548 <para>
47549 <indexterm role="option">
47550 <primary><option>fallback_hosts</option></primary>
47551 </indexterm>
47552 </para>
47553 <informaltable frame="all">
47554 <tgroup cols="4" colsep="0" rowsep="0">
47555 <colspec colwidth="8*" align="left"/>
47556 <colspec colwidth="6*" align="center"/>
47557 <colspec colwidth="6*" align="center"/>
47558 <colspec colwidth="6*" align="right"/>
47559 <tbody>
47560 <row>
47561 <entry><option>fallback_hosts</option></entry>
47562 <entry>Use: <emphasis>smtp</emphasis></entry>
47563 <entry>Type: <emphasis>string list</emphasis></entry>
47564 <entry>Default: <emphasis>unset</emphasis></entry>
47565 </row>
47566 </tbody>
47567 </tgroup>
47568 </informaltable>
47569 <para>
47570 <indexterm role="concept">
47571 <primary>fallback</primary>
47572 <secondary>hosts specified on transport</secondary>
47573 </indexterm>
47574 String expansion is not applied to this option. The argument must be a
47575 colon-separated list of host names or IP addresses, optionally also including
47576 port numbers, though the separator can be changed, as described in section
47577 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
47578 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
47579 in section <xref linkend="SECTformatonehostitem"/>.
47580 </para>
47581 <para>
47582 Fallback hosts can also be specified on routers, which associate them with the
47583 addresses they process. As for the <option>hosts</option> option without <option>hosts_override</option>,
47584 <option>fallback_hosts</option> specified on the transport is used only if the address does
47585 not have its own associated fallback host list. Unlike <option>hosts</option>, a setting of
47586 <option>fallback_hosts</option> on an address is not overridden by <option>hosts_override</option>.
47587 However, <option>hosts_randomize</option> does apply to fallback host lists.
47588 </para>
47589 <para>
47590 If Exim is unable to deliver to any of the hosts for a particular address, and
47591 the errors are not permanent rejections, the address is put on a separate
47592 transport queue with its host list replaced by the fallback hosts, unless the
47593 address was routed via MX records and the current host was in the original MX
47594 list. In that situation, the fallback host list is not used.
47595 </para>
47596 <para>
47597 Once normal deliveries are complete, the fallback queue is delivered by
47598 re-running the same transports with the new host lists. If several failing
47599 addresses have the same fallback hosts (and <option>max_rcpt</option> permits it), a single
47600 copy of the message is sent.
47601 </para>
47602 <para>
47603 The resolution of the host names on the fallback list is controlled by the
47604 <option>gethostbyname</option> option, as for the <option>hosts</option> option. Fallback hosts apply
47605 both to cases when the host list comes with the address and when it is taken
47606 from <option>hosts</option>. This option provides a <quote>use a smart host only if delivery
47607 fails</quote> facility.
47608 </para>
47609 <para>
47610 <indexterm role="option">
47611 <primary><option>final_timeout</option></primary>
47612 </indexterm>
47613 </para>
47614 <informaltable frame="all">
47615 <tgroup cols="4" colsep="0" rowsep="0">
47616 <colspec colwidth="8*" align="left"/>
47617 <colspec colwidth="6*" align="center"/>
47618 <colspec colwidth="6*" align="center"/>
47619 <colspec colwidth="6*" align="right"/>
47620 <tbody>
47621 <row>
47622 <entry><option>final_timeout</option></entry>
47623 <entry>Use: <emphasis>smtp</emphasis></entry>
47624 <entry>Type: <emphasis>time</emphasis></entry>
47625 <entry>Default: <emphasis>10m</emphasis></entry>
47626 </row>
47627 </tbody>
47628 </tgroup>
47629 </informaltable>
47630 <para>
47631 This is the timeout that applies while waiting for the response to the final
47632 line containing just <quote>.</quote> that terminates a message. Its value must not be
47633 zero.
47634 </para>
47635 <para>
47636 <indexterm role="option">
47637 <primary><option>gethostbyname</option></primary>
47638 </indexterm>
47639 </para>
47640 <informaltable frame="all">
47641 <tgroup cols="4" colsep="0" rowsep="0">
47642 <colspec colwidth="8*" align="left"/>
47643 <colspec colwidth="6*" align="center"/>
47644 <colspec colwidth="6*" align="center"/>
47645 <colspec colwidth="6*" align="right"/>
47646 <tbody>
47647 <row>
47648 <entry><option>gethostbyname</option></entry>
47649 <entry>Use: <emphasis>smtp</emphasis></entry>
47650 <entry>Type: <emphasis>boolean</emphasis></entry>
47651 <entry>Default: <emphasis>false</emphasis></entry>
47652 </row>
47653 </tbody>
47654 </tgroup>
47655 </informaltable>
47656 <para>
47657 If this option is true when the <option>hosts</option> and/or <option>fallback_hosts</option> options are
47658 being used, names are looked up using <function>gethostbyname()</function>
47659 (or <function>getipnodebyname()</function> when available)
47660 instead of using the DNS. Of course, that function may in fact use the DNS, but
47661 it may also consult other sources of information such as <filename>/etc/hosts</filename>.
47662 </para>
47663 <para>
47664 <indexterm role="option">
47665 <primary><option>gnutls_compat_mode</option></primary>
47666 </indexterm>
47667 </para>
47668 <informaltable frame="all">
47669 <tgroup cols="4" colsep="0" rowsep="0">
47670 <colspec colwidth="8*" align="left"/>
47671 <colspec colwidth="6*" align="center"/>
47672 <colspec colwidth="6*" align="center"/>
47673 <colspec colwidth="6*" align="right"/>
47674 <tbody>
47675 <row>
47676 <entry><option>gnutls_compat_mode</option></entry>
47677 <entry>Use: <emphasis>smtp</emphasis></entry>
47678 <entry>Type: <emphasis>boolean</emphasis></entry>
47679 <entry>Default: <emphasis>unset</emphasis></entry>
47680 </row>
47681 </tbody>
47682 </tgroup>
47683 </informaltable>
47684 <para>
47685 This option controls whether GnuTLS is used in compatibility mode in an Exim
47686 server. This reduces security slightly, but improves interworking with older
47687 implementations of TLS.
47688 </para>
47689 <para>
47690 <indexterm role="option">
47691 <primary><option>helo_data</option></primary>
47692 </indexterm>
47693 </para>
47694 <informaltable frame="all">
47695 <tgroup cols="4" colsep="0" rowsep="0">
47696 <colspec colwidth="8*" align="left"/>
47697 <colspec colwidth="6*" align="center"/>
47698 <colspec colwidth="6*" align="center"/>
47699 <colspec colwidth="6*" align="right"/>
47700 <tbody>
47701 <row>
47702 <entry><option>helo_data</option></entry>
47703 <entry>Use: <emphasis>smtp</emphasis></entry>
47704 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47705 <entry>Default: <emphasis>see below</emphasis></entry>
47706 </row>
47707 </tbody>
47708 </tgroup>
47709 </informaltable>
47710 <para>
47711 <indexterm role="concept">
47712 <primary>HELO</primary>
47713 <secondary>argument, setting</secondary>
47714 </indexterm>
47715 <indexterm role="concept">
47716 <primary>EHLO</primary>
47717 <secondary>argument, setting</secondary>
47718 </indexterm>
47719 <indexterm role="concept">
47720 <primary>LHLO argument setting</primary>
47721 </indexterm>
47722 The value of this option is expanded after a connection to a another host has
47723 been set up. The result is used as the argument for the EHLO, HELO, or LHLO
47724 command that starts the outgoing SMTP or LMTP session. The default value of the
47725 option is:
47726 </para>
47727 <literallayout class="monospaced">
47728 $primary_hostname
47729 </literallayout>
47730 <para>
47731 During the expansion, the variables <varname>$host</varname> and <varname>$host_address</varname> are set to
47732 the identity of the remote host, and the variables <varname>$sending_ip_address</varname> and
47733 <varname>$sending_port</varname> are set to the local IP address and port number that are being
47734 used. These variables can be used to generate different values for different
47735 servers or different local IP addresses. For example, if you want the string
47736 that is used for <option>helo_data</option> to be obtained by a DNS lookup of the outgoing
47737 interface address, you could use this:
47738 </para>
47739 <literallayout class="monospaced">
47740 helo_data = ${lookup dnsdb{ptr=$sending_ip_address}{$value}\
47741   {$primary_hostname}}
47742 </literallayout>
47743 <para>
47744 The use of <option>helo_data</option> applies both to sending messages and when doing
47745 callouts.
47746 </para>
47747 <para>
47748 <indexterm role="option">
47749 <primary><option>hosts</option></primary>
47750 </indexterm>
47751 </para>
47752 <informaltable frame="all">
47753 <tgroup cols="4" colsep="0" rowsep="0">
47754 <colspec colwidth="8*" align="left"/>
47755 <colspec colwidth="6*" align="center"/>
47756 <colspec colwidth="6*" align="center"/>
47757 <colspec colwidth="6*" align="right"/>
47758 <tbody>
47759 <row>
47760 <entry><option>hosts</option></entry>
47761 <entry>Use: <emphasis>smtp</emphasis></entry>
47762 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
47763 <entry>Default: <emphasis>unset</emphasis></entry>
47764 </row>
47765 </tbody>
47766 </tgroup>
47767 </informaltable>
47768 <para>
47769 Hosts are associated with an address by a router such as <command>dnslookup</command>, which
47770 finds the hosts by looking up the address domain in the DNS, or by
47771 <command>manualroute</command>, which has lists of hosts in its configuration. However,
47772 email addresses can be passed to the <command>smtp</command> transport by any router, and not
47773 all of them can provide an associated list of hosts.
47774 </para>
47775 <para>
47776 The <option>hosts</option> option specifies a list of hosts to be used if the address being
47777 processed does not have any hosts associated with it. The hosts specified by
47778 <option>hosts</option> are also used, whether or not the address has its own hosts, if
47779 <option>hosts_override</option> is set.
47780 </para>
47781 <para>
47782 The string is first expanded, before being interpreted as a colon-separated
47783 list of host names or IP addresses, possibly including port numbers. The
47784 separator may be changed to something other than colon, as described in section
47785 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
47786 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
47787 in section <xref linkend="SECTformatonehostitem"/>. However, note that the <literal>/MX</literal> facility
47788 of the <command>manualroute</command> router is not available here.
47789 </para>
47790 <para>
47791 If the expansion fails, delivery is deferred. Unless the failure was caused by
47792 the inability to complete a lookup, the error is logged to the panic log as
47793 well as the main log. Host names are looked up either by searching directly for
47794 address records in the DNS or by calling <function>gethostbyname()</function> (or
47795 <function>getipnodebyname()</function> when available), depending on the setting of the
47796 <option>gethostbyname</option> option. When Exim is compiled with IPv6 support, if a host
47797 that is looked up in the DNS has both IPv4 and IPv6 addresses, both types of
47798 address are used.
47799 </para>
47800 <para>
47801 During delivery, the hosts are tried in order, subject to their retry status,
47802 unless <option>hosts_randomize</option> is set.
47803 </para>
47804 <para>
47805 <indexterm role="option">
47806 <primary><option>hosts_avoid_esmtp</option></primary>
47807 </indexterm>
47808 </para>
47809 <informaltable frame="all">
47810 <tgroup cols="4" colsep="0" rowsep="0">
47811 <colspec colwidth="8*" align="left"/>
47812 <colspec colwidth="6*" align="center"/>
47813 <colspec colwidth="6*" align="center"/>
47814 <colspec colwidth="6*" align="right"/>
47815 <tbody>
47816 <row>
47817 <entry><option>hosts_avoid_esmtp</option></entry>
47818 <entry>Use: <emphasis>smtp</emphasis></entry>
47819 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
47820 <entry>Default: <emphasis>unset</emphasis></entry>
47821 </row>
47822 </tbody>
47823 </tgroup>
47824 </informaltable>
47825 <para>
47826 <indexterm role="concept">
47827 <primary>ESMTP, avoiding use of</primary>
47828 </indexterm>
47829 <indexterm role="concept">
47830 <primary>HELO</primary>
47831 <secondary>forcing use of</secondary>
47832 </indexterm>
47833 <indexterm role="concept">
47834 <primary>EHLO</primary>
47835 <secondary>avoiding use of</secondary>
47836 </indexterm>
47837 <indexterm role="concept">
47838 <primary>PIPELINING</primary>
47839 <secondary>avoiding the use of</secondary>
47840 </indexterm>
47841 This option is for use with broken hosts that announce ESMTP facilities (for
47842 example, PIPELINING) and then fail to implement them properly. When a host
47843 matches <option>hosts_avoid_esmtp</option>, Exim sends HELO rather than EHLO at the
47844 start of the SMTP session. This means that it cannot use any of the ESMTP
47845 facilities such as AUTH, PIPELINING, SIZE, and STARTTLS.
47846 </para>
47847 <para>
47848 <indexterm role="option">
47849 <primary><option>hosts_avoid_pipelining</option></primary>
47850 </indexterm>
47851 </para>
47852 <informaltable frame="all">
47853 <tgroup cols="4" colsep="0" rowsep="0">
47854 <colspec colwidth="8*" align="left"/>
47855 <colspec colwidth="6*" align="center"/>
47856 <colspec colwidth="6*" align="center"/>
47857 <colspec colwidth="6*" align="right"/>
47858 <tbody>
47859 <row>
47860 <entry><option>hosts_avoid_pipelining</option></entry>
47861 <entry>Use: <emphasis>smtp</emphasis></entry>
47862 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
47863 <entry>Default: <emphasis>unset</emphasis></entry>
47864 </row>
47865 </tbody>
47866 </tgroup>
47867 </informaltable>
47868 <para>
47869 <indexterm role="concept">
47870 <primary>PIPELINING</primary>
47871 <secondary>avoiding the use of</secondary>
47872 </indexterm>
47873 Exim will not use the SMTP PIPELINING extension when delivering to any host
47874 that matches this list, even if the server host advertises PIPELINING support.
47875 </para>
47876 <para>
47877 <indexterm role="option">
47878 <primary><option>hosts_avoid_tls</option></primary>
47879 </indexterm>
47880 </para>
47881 <informaltable frame="all">
47882 <tgroup cols="4" colsep="0" rowsep="0">
47883 <colspec colwidth="8*" align="left"/>
47884 <colspec colwidth="6*" align="center"/>
47885 <colspec colwidth="6*" align="center"/>
47886 <colspec colwidth="6*" align="right"/>
47887 <tbody>
47888 <row>
47889 <entry><option>hosts_avoid_tls</option></entry>
47890 <entry>Use: <emphasis>smtp</emphasis></entry>
47891 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
47892 <entry>Default: <emphasis>unset</emphasis></entry>
47893 </row>
47894 </tbody>
47895 </tgroup>
47896 </informaltable>
47897 <para>
47898 <indexterm role="concept">
47899 <primary>TLS</primary>
47900 <secondary>avoiding for certain hosts</secondary>
47901 </indexterm>
47902 Exim will not try to start a TLS session when delivering to any host that
47903 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
47904 </para>
47905 <para>
47906 <indexterm role="option">
47907 <primary><option>hosts_verify_avoid_tls</option></primary>
47908 </indexterm>
47909 </para>
47910 <informaltable frame="all">
47911 <tgroup cols="4" colsep="0" rowsep="0">
47912 <colspec colwidth="8*" align="left"/>
47913 <colspec colwidth="6*" align="center"/>
47914 <colspec colwidth="6*" align="center"/>
47915 <colspec colwidth="6*" align="right"/>
47916 <tbody>
47917 <row>
47918 <entry><option>hosts_verify_avoid_tls</option></entry>
47919 <entry>Use: <emphasis>smtp</emphasis></entry>
47920 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
47921 <entry>Default: <emphasis>unset</emphasis></entry>
47922 </row>
47923 </tbody>
47924 </tgroup>
47925 </informaltable>
47926 <para>
47927 <indexterm role="concept">
47928 <primary>TLS</primary>
47929 <secondary>avoiding for certain hosts</secondary>
47930 </indexterm>
47931 Exim will not try to start a TLS session for a verify callout,
47932 or when delivering in cutthrough mode,
47933 to any host that matches this list.
47934 </para>
47935 <para>
47936 <indexterm role="option">
47937 <primary><option>hosts_max_try</option></primary>
47938 </indexterm>
47939 </para>
47940 <informaltable frame="all">
47941 <tgroup cols="4" colsep="0" rowsep="0">
47942 <colspec colwidth="8*" align="left"/>
47943 <colspec colwidth="6*" align="center"/>
47944 <colspec colwidth="6*" align="center"/>
47945 <colspec colwidth="6*" align="right"/>
47946 <tbody>
47947 <row>
47948 <entry><option>hosts_max_try</option></entry>
47949 <entry>Use: <emphasis>smtp</emphasis></entry>
47950 <entry>Type: <emphasis>integer</emphasis></entry>
47951 <entry>Default: <emphasis>5</emphasis></entry>
47952 </row>
47953 </tbody>
47954 </tgroup>
47955 </informaltable>
47956 <para>
47957 <indexterm role="concept">
47958 <primary>host</primary>
47959 <secondary>maximum number to try</secondary>
47960 </indexterm>
47961 <indexterm role="concept">
47962 <primary>limit</primary>
47963 <secondary>number of hosts tried</secondary>
47964 </indexterm>
47965 <indexterm role="concept">
47966 <primary>limit</primary>
47967 <secondary>number of MX tried</secondary>
47968 </indexterm>
47969 <indexterm role="concept">
47970 <primary>MX record</primary>
47971 <secondary>maximum tried</secondary>
47972 </indexterm>
47973 This option limits the number of IP addresses that are tried for any one
47974 delivery in cases where there are temporary delivery errors. Section
47975 <xref linkend="SECTvalhosmax"/> describes in detail how the value of this option is used.
47976 </para>
47977 <para>
47978 <indexterm role="option">
47979 <primary><option>hosts_max_try_hardlimit</option></primary>
47980 </indexterm>
47981 </para>
47982 <informaltable frame="all">
47983 <tgroup cols="4" colsep="0" rowsep="0">
47984 <colspec colwidth="8*" align="left"/>
47985 <colspec colwidth="6*" align="center"/>
47986 <colspec colwidth="6*" align="center"/>
47987 <colspec colwidth="6*" align="right"/>
47988 <tbody>
47989 <row>
47990 <entry><option>hosts_max_try_hardlimit</option></entry>
47991 <entry>Use: <emphasis>smtp</emphasis></entry>
47992 <entry>Type: <emphasis>integer</emphasis></entry>
47993 <entry>Default: <emphasis>50</emphasis></entry>
47994 </row>
47995 </tbody>
47996 </tgroup>
47997 </informaltable>
47998 <para>
47999 This is an additional check on the maximum number of IP addresses that Exim
48000 tries for any one delivery. Section <xref linkend="SECTvalhosmax"/> describes its use and
48001 why it exists.
48002 </para>
48003 <para>
48004 <indexterm role="option">
48005 <primary><option>hosts_nopass_tls</option></primary>
48006 </indexterm>
48007 </para>
48008 <informaltable frame="all">
48009 <tgroup cols="4" colsep="0" rowsep="0">
48010 <colspec colwidth="8*" align="left"/>
48011 <colspec colwidth="6*" align="center"/>
48012 <colspec colwidth="6*" align="center"/>
48013 <colspec colwidth="6*" align="right"/>
48014 <tbody>
48015 <row>
48016 <entry><option>hosts_nopass_tls</option></entry>
48017 <entry>Use: <emphasis>smtp</emphasis></entry>
48018 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
48019 <entry>Default: <emphasis>unset</emphasis></entry>
48020 </row>
48021 </tbody>
48022 </tgroup>
48023 </informaltable>
48024 <para>
48025 <indexterm role="concept">
48026 <primary>TLS</primary>
48027 <secondary>passing connection</secondary>
48028 </indexterm>
48029 <indexterm role="concept">
48030 <primary>multiple SMTP deliveries</primary>
48031 </indexterm>
48032 <indexterm role="concept">
48033 <primary>TLS</primary>
48034 <secondary>multiple message deliveries</secondary>
48035 </indexterm>
48036 For any host that matches this list, a connection on which a TLS session has
48037 been started will not be passed to a new delivery process for sending another
48038 message on the same connection. See section <xref linkend="SECTmulmessam"/> for an
48039 explanation of when this might be needed.
48040 </para>
48041 <para>
48042 <indexterm role="option">
48043 <primary><option>hosts_noproxy_tls</option></primary>
48044 </indexterm>
48045 </para>
48046 <informaltable frame="all">
48047 <tgroup cols="4" colsep="0" rowsep="0">
48048 <colspec colwidth="8*" align="left"/>
48049 <colspec colwidth="6*" align="center"/>
48050 <colspec colwidth="6*" align="center"/>
48051 <colspec colwidth="6*" align="right"/>
48052 <tbody>
48053 <row>
48054 <entry><option>hosts_noproxy_tls</option></entry>
48055 <entry>Use: <emphasis>smtp</emphasis></entry>
48056 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
48057 <entry>Default: <emphasis>*</emphasis></entry>
48058 </row>
48059 </tbody>
48060 </tgroup>
48061 </informaltable>
48062 <para>
48063 <indexterm role="concept">
48064 <primary>TLS</primary>
48065 <secondary>passing connection</secondary>
48066 </indexterm>
48067 <indexterm role="concept">
48068 <primary>multiple SMTP deliveries</primary>
48069 </indexterm>
48070 <indexterm role="concept">
48071 <primary>TLS</primary>
48072 <secondary>multiple message deliveries</secondary>
48073 </indexterm>
48074 For any host that matches this list, a TLS session which has
48075 been started will not be passed to a new delivery process for sending another
48076 message on the same session.
48077 </para>
48078 <para>
48079 The traditional implementation closes down TLS and re-starts it in the new
48080 process, on the same open TCP connection, for each successive message
48081 sent.  If permitted by this option a pipe to to the new process is set up
48082 instead, and the original process maintains the TLS connection and proxies
48083 the SMTP connection from and to the new process and any subsequents.
48084 The new process has no access to TLS information, so cannot include it in
48085 logging.
48086 </para>
48087 <para>
48088 <indexterm role="option">
48089 <primary><option>hosts_override</option></primary>
48090 </indexterm>
48091 </para>
48092 <informaltable frame="all">
48093 <tgroup cols="4" colsep="0" rowsep="0">
48094 <colspec colwidth="8*" align="left"/>
48095 <colspec colwidth="6*" align="center"/>
48096 <colspec colwidth="6*" align="center"/>
48097 <colspec colwidth="6*" align="right"/>
48098 <tbody>
48099 <row>
48100 <entry><option>hosts_override</option></entry>
48101 <entry>Use: <emphasis>smtp</emphasis></entry>
48102 <entry>Type: <emphasis>boolean</emphasis></entry>
48103 <entry>Default: <emphasis>false</emphasis></entry>
48104 </row>
48105 </tbody>
48106 </tgroup>
48107 </informaltable>
48108 <para>
48109 If this option is set and the <option>hosts</option> option is also set, any hosts that are
48110 attached to the address are ignored, and instead the hosts specified by the
48111 <option>hosts</option> option are always used. This option does not apply to
48112 <option>fallback_hosts</option>.
48113 </para>
48114 <para>
48115 <indexterm role="option">
48116 <primary><option>hosts_randomize</option></primary>
48117 </indexterm>
48118 </para>
48119 <informaltable frame="all">
48120 <tgroup cols="4" colsep="0" rowsep="0">
48121 <colspec colwidth="8*" align="left"/>
48122 <colspec colwidth="6*" align="center"/>
48123 <colspec colwidth="6*" align="center"/>
48124 <colspec colwidth="6*" align="right"/>
48125 <tbody>
48126 <row>
48127 <entry><option>hosts_randomize</option></entry>
48128 <entry>Use: <emphasis>smtp</emphasis></entry>
48129 <entry>Type: <emphasis>boolean</emphasis></entry>
48130 <entry>Default: <emphasis>false</emphasis></entry>
48131 </row>
48132 </tbody>
48133 </tgroup>
48134 </informaltable>
48135 <para>
48136 <indexterm role="concept">
48137 <primary>randomized host list</primary>
48138 </indexterm>
48139 <indexterm role="concept">
48140 <primary>host</primary>
48141 <secondary>list of; randomized</secondary>
48142 </indexterm>
48143 <indexterm role="concept">
48144 <primary>fallback</primary>
48145 <secondary>randomized hosts</secondary>
48146 </indexterm>
48147 If this option is set, and either the list of hosts is taken from the
48148 <option>hosts</option> or the <option>fallback_hosts</option> option, or the hosts supplied by the router
48149 were not obtained from MX records (this includes fallback hosts from the
48150 router), and were not randomized by the router, the order of trying the hosts
48151 is randomized each time the transport runs. Randomizing the order of a host
48152 list can be used to do crude load sharing.
48153 </para>
48154 <para>
48155 When <option>hosts_randomize</option> is true, a host list may be split into groups whose
48156 order is separately randomized. This makes it possible to set up MX-like
48157 behaviour. The boundaries between groups are indicated by an item that is just
48158 <literal>+</literal> in the host list. For example:
48159 </para>
48160 <literallayout class="monospaced">
48161 hosts = host1:host2:host3:+:host4:host5
48162 </literallayout>
48163 <para>
48164 The order of the first three hosts and the order of the last two hosts is
48165 randomized for each use, but the first three always end up before the last two.
48166 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored.
48167 </para>
48168 <para>
48169 <indexterm role="option">
48170 <primary><option>hosts_require_auth</option></primary>
48171 </indexterm>
48172 </para>
48173 <informaltable frame="all">
48174 <tgroup cols="4" colsep="0" rowsep="0">
48175 <colspec colwidth="8*" align="left"/>
48176 <colspec colwidth="6*" align="center"/>
48177 <colspec colwidth="6*" align="center"/>
48178 <colspec colwidth="6*" align="right"/>
48179 <tbody>
48180 <row>
48181 <entry><option>hosts_require_auth</option></entry>
48182 <entry>Use: <emphasis>smtp</emphasis></entry>
48183 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
48184 <entry>Default: <emphasis>unset</emphasis></entry>
48185 </row>
48186 </tbody>
48187 </tgroup>
48188 </informaltable>
48189 <para>
48190 <indexterm role="concept">
48191 <primary>authentication</primary>
48192 <secondary>required by client</secondary>
48193 </indexterm>
48194 This option provides a list of servers for which authentication must succeed
48195 before Exim will try to transfer a message. If authentication fails for
48196 servers which are not in this list, Exim tries to send unauthenticated. If
48197 authentication fails for one of these servers, delivery is deferred. This
48198 temporary error is detectable in the retry rules, so it can be turned into a
48199 hard failure if required. See also <option>hosts_try_auth</option>, and chapter
48200 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
48201 </para>
48202 <para>
48203 <indexterm role="option">
48204 <primary><option>hosts_request_ocsp</option></primary>
48205 </indexterm>
48206 </para>
48207 <informaltable frame="all">
48208 <tgroup cols="4" colsep="0" rowsep="0">
48209 <colspec colwidth="8*" align="left"/>
48210 <colspec colwidth="6*" align="center"/>
48211 <colspec colwidth="6*" align="center"/>
48212 <colspec colwidth="6*" align="right"/>
48213 <tbody>
48214 <row>
48215 <entry><option>hosts_request_ocsp</option></entry>
48216 <entry>Use: <emphasis>smtp</emphasis></entry>
48217 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
48218 <entry>Default: <emphasis>*</emphasis></entry>
48219 </row>
48220 </tbody>
48221 </tgroup>
48222 </informaltable>
48223 <para>
48224 <indexterm role="concept">
48225 <primary>TLS</primary>
48226 <secondary>requiring for certain servers</secondary>
48227 </indexterm>
48228 Exim will request a Certificate Status on a
48229 TLS session for any host that matches this list.
48230 <option>tls_verify_certificates</option> should also be set for the transport.
48231 </para>
48232 <para>
48233 <indexterm role="option">
48234 <primary><option>hosts_require_dane</option></primary>
48235 </indexterm>
48236 </para>
48237 <informaltable frame="all">
48238 <tgroup cols="4" colsep="0" rowsep="0">
48239 <colspec colwidth="8*" align="left"/>
48240 <colspec colwidth="6*" align="center"/>
48241 <colspec colwidth="6*" align="center"/>
48242 <colspec colwidth="6*" align="right"/>
48243 <tbody>
48244 <row>
48245 <entry><option>hosts_require_dane</option></entry>
48246 <entry>Use: <emphasis>smtp</emphasis></entry>
48247 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
48248 <entry>Default: <emphasis>unset</emphasis></entry>
48249 </row>
48250 </tbody>
48251 </tgroup>
48252 </informaltable>
48253 <para>
48254 <indexterm role="concept">
48255 <primary>DANE</primary>
48256 <secondary>transport options</secondary>
48257 </indexterm>
48258 <indexterm role="concept">
48259 <primary>DANE</primary>
48260 <secondary>requiring for certain servers</secondary>
48261 </indexterm>
48262 If built with DANE support, Exim  will require that a DNSSEC-validated
48263 TLSA record is present for any host matching the list,
48264 and that a DANE-verified TLS connection is made.
48265 There will be no fallback to in-clear communication.
48266 See section <xref linkend="SECDANE"/>.
48267 </para>
48268 <para>
48269 <indexterm role="option">
48270 <primary><option>hosts_require_ocsp</option></primary>
48271 </indexterm>
48272 </para>
48273 <informaltable frame="all">
48274 <tgroup cols="4" colsep="0" rowsep="0">
48275 <colspec colwidth="8*" align="left"/>
48276 <colspec colwidth="6*" align="center"/>
48277 <colspec colwidth="6*" align="center"/>
48278 <colspec colwidth="6*" align="right"/>
48279 <tbody>
48280 <row>
48281 <entry><option>hosts_require_ocsp</option></entry>
48282 <entry>Use: <emphasis>smtp</emphasis></entry>
48283 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
48284 <entry>Default: <emphasis>unset</emphasis></entry>
48285 </row>
48286 </tbody>
48287 </tgroup>
48288 </informaltable>
48289 <para>
48290 <indexterm role="concept">
48291 <primary>TLS</primary>
48292 <secondary>requiring for certain servers</secondary>
48293 </indexterm>
48294 Exim will request, and check for a valid Certificate Status being given, on a
48295 TLS session for any host that matches this list.
48296 <option>tls_verify_certificates</option> should also be set for the transport.
48297 </para>
48298 <para>
48299 <indexterm role="option">
48300 <primary><option>hosts_require_tls</option></primary>
48301 </indexterm>
48302 </para>
48303 <informaltable frame="all">
48304 <tgroup cols="4" colsep="0" rowsep="0">
48305 <colspec colwidth="8*" align="left"/>
48306 <colspec colwidth="6*" align="center"/>
48307 <colspec colwidth="6*" align="center"/>
48308 <colspec colwidth="6*" align="right"/>
48309 <tbody>
48310 <row>
48311 <entry><option>hosts_require_tls</option></entry>
48312 <entry>Use: <emphasis>smtp</emphasis></entry>
48313 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
48314 <entry>Default: <emphasis>unset</emphasis></entry>
48315 </row>
48316 </tbody>
48317 </tgroup>
48318 </informaltable>
48319 <para>
48320 <indexterm role="concept">
48321 <primary>TLS</primary>
48322 <secondary>requiring for certain servers</secondary>
48323 </indexterm>
48324 Exim will insist on using a TLS session when delivering to any host that
48325 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
48326 <emphasis role="bold">Note</emphasis>: This option affects outgoing mail only. To insist on TLS for
48327 incoming messages, use an appropriate ACL.
48328 </para>
48329 <para>
48330 <indexterm role="option">
48331 <primary><option>hosts_try_auth</option></primary>
48332 </indexterm>
48333 </para>
48334 <informaltable frame="all">
48335 <tgroup cols="4" colsep="0" rowsep="0">
48336 <colspec colwidth="8*" align="left"/>
48337 <colspec colwidth="6*" align="center"/>
48338 <colspec colwidth="6*" align="center"/>
48339 <colspec colwidth="6*" align="right"/>
48340 <tbody>
48341 <row>
48342 <entry><option>hosts_try_auth</option></entry>
48343 <entry>Use: <emphasis>smtp</emphasis></entry>
48344 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
48345 <entry>Default: <emphasis>unset</emphasis></entry>
48346 </row>
48347 </tbody>
48348 </tgroup>
48349 </informaltable>
48350 <para>
48351 <indexterm role="concept">
48352 <primary>authentication</primary>
48353 <secondary>optional in client</secondary>
48354 </indexterm>
48355 This option provides a list of servers to which, provided they announce
48356 authentication support, Exim will attempt to authenticate as a client when it
48357 connects. If authentication fails, Exim will try to transfer the message
48358 unauthenticated. See also <option>hosts_require_auth</option>, and chapter
48359 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
48360 </para>
48361 <para>
48362 <indexterm role="option">
48363 <primary><option>hosts_try_chunking</option></primary>
48364 </indexterm>
48365 </para>
48366 <informaltable frame="all">
48367 <tgroup cols="4" colsep="0" rowsep="0">
48368 <colspec colwidth="8*" align="left"/>
48369 <colspec colwidth="6*" align="center"/>
48370 <colspec colwidth="6*" align="center"/>
48371 <colspec colwidth="6*" align="right"/>
48372 <tbody>
48373 <row>
48374 <entry><option>hosts_try_chunking</option></entry>
48375 <entry>Use: <emphasis>smtp</emphasis></entry>
48376 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
48377 <entry>Default: <emphasis>*</emphasis></entry>
48378 </row>
48379 </tbody>
48380 </tgroup>
48381 </informaltable>
48382 <para>
48383 <indexterm role="concept">
48384 <primary>CHUNKING</primary>
48385 <secondary>enabling, in client</secondary>
48386 </indexterm>
48387 <indexterm role="concept">
48388 <primary>BDAT</primary>
48389 <secondary>SMTP command</secondary>
48390 </indexterm>
48391 <indexterm role="concept">
48392 <primary>RFC 3030</primary>
48393 <secondary>CHUNKING</secondary>
48394 </indexterm>
48395 This option provides a list of servers to which, provided they announce
48396 CHUNKING support, Exim will attempt to use BDAT commands rather than DATA.
48397 BDAT will not be used in conjunction with a transport filter.
48398 </para>
48399 <para>
48400 <indexterm role="option">
48401 <primary><option>hosts_try_dane</option></primary>
48402 </indexterm>
48403 </para>
48404 <informaltable frame="all">
48405 <tgroup cols="4" colsep="0" rowsep="0">
48406 <colspec colwidth="8*" align="left"/>
48407 <colspec colwidth="6*" align="center"/>
48408 <colspec colwidth="6*" align="center"/>
48409 <colspec colwidth="6*" align="right"/>
48410 <tbody>
48411 <row>
48412 <entry><option>hosts_try_dane</option></entry>
48413 <entry>Use: <emphasis>smtp</emphasis></entry>
48414 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
48415 <entry>Default: <emphasis>unset</emphasis></entry>
48416 </row>
48417 </tbody>
48418 </tgroup>
48419 </informaltable>
48420 <para>
48421 <indexterm role="concept">
48422 <primary>DANE</primary>
48423 <secondary>transport options</secondary>
48424 </indexterm>
48425 <indexterm role="concept">
48426 <primary>DANE</primary>
48427 <secondary>attempting for certain servers</secondary>
48428 </indexterm>
48429 If built with DANE support, Exim  will lookup a
48430 TLSA record for any host matching the list.
48431 If found and verified by DNSSEC,
48432 a DANE-verified TLS connection is made to that host;
48433 there will be no fallback to in-clear communication.
48434 See section <xref linkend="SECDANE"/>.
48435 </para>
48436 <para>
48437 <indexterm role="option">
48438 <primary><option>hosts_try_fastopen</option></primary>
48439 </indexterm>
48440 </para>
48441 <informaltable frame="all">
48442 <tgroup cols="4" colsep="0" rowsep="0">
48443 <colspec colwidth="8*" align="left"/>
48444 <colspec colwidth="6*" align="center"/>
48445 <colspec colwidth="6*" align="center"/>
48446 <colspec colwidth="6*" align="right"/>
48447 <tbody>
48448 <row>
48449 <entry><option>hosts_try_fastopen</option></entry>
48450 <entry>Use: <emphasis>smtp</emphasis></entry>
48451 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
48452 <entry>Default: <emphasis>unset</emphasis></entry>
48453 </row>
48454 </tbody>
48455 </tgroup>
48456 </informaltable>
48457 <para>
48458 <indexterm role="concept">
48459 <primary>fast open, TCP</primary>
48460 <secondary>enabling, in client</secondary>
48461 </indexterm>
48462 <indexterm role="concept">
48463 <primary>TCP Fast Open</primary>
48464 <secondary>enabling, in client</secondary>
48465 </indexterm>
48466 <indexterm role="concept">
48467 <primary>RFC 7413</primary>
48468 <secondary>TCP Fast Open</secondary>
48469 </indexterm>
48470 This option provides a list of servers to which, provided
48471 the facility is supported by this system, Exim will attempt to
48472 perform a TCP Fast Open.
48473 No data is sent on the SYN segment but, if the remote server also
48474 supports the facility, it can send its SMTP banner immediately after
48475 the SYN,ACK segment.  This can save up to one round-trip time.
48476 </para>
48477 <para>
48478 The facility is only active for previously-contacted servers,
48479 as the initiator must present a cookie in the SYN segment.
48480 </para>
48481 <para>
48482 On (at least some) current Linux distributions the facility must be enabled
48483 in the kernel by the sysadmin before the support is usable.
48484 There is no option for control of the server side; if the system supports
48485 it it is always enabled.  Note that lengthy operations in the connect ACL,
48486 such as DNSBL lookups, will still delay the emission of the SMTP banner.
48487 </para>
48488 <para>
48489 <indexterm role="option">
48490 <primary><option>hosts_try_prdr</option></primary>
48491 </indexterm>
48492 </para>
48493 <informaltable frame="all">
48494 <tgroup cols="4" colsep="0" rowsep="0">
48495 <colspec colwidth="8*" align="left"/>
48496 <colspec colwidth="6*" align="center"/>
48497 <colspec colwidth="6*" align="center"/>
48498 <colspec colwidth="6*" align="right"/>
48499 <tbody>
48500 <row>
48501 <entry><option>hosts_try_prdr</option></entry>
48502 <entry>Use: <emphasis>smtp</emphasis></entry>
48503 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
48504 <entry>Default: <emphasis>*</emphasis></entry>
48505 </row>
48506 </tbody>
48507 </tgroup>
48508 </informaltable>
48509 <para>
48510 <indexterm role="concept">
48511 <primary>PRDR</primary>
48512 <secondary>enabling, optional in client</secondary>
48513 </indexterm>
48514 This option provides a list of servers to which, provided they announce
48515 PRDR support, Exim will attempt to negotiate PRDR
48516 for multi-recipient messages.
48517 The option can usually be left as default.
48518 </para>
48519 <para>
48520 <indexterm role="option">
48521 <primary><option>interface</option></primary>
48522 </indexterm>
48523 </para>
48524 <informaltable frame="all">
48525 <tgroup cols="4" colsep="0" rowsep="0">
48526 <colspec colwidth="8*" align="left"/>
48527 <colspec colwidth="6*" align="center"/>
48528 <colspec colwidth="6*" align="center"/>
48529 <colspec colwidth="6*" align="right"/>
48530 <tbody>
48531 <row>
48532 <entry><option>interface</option></entry>
48533 <entry>Use: <emphasis>smtp</emphasis></entry>
48534 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
48535 <entry>Default: <emphasis>unset</emphasis></entry>
48536 </row>
48537 </tbody>
48538 </tgroup>
48539 </informaltable>
48540 <para>
48541 <indexterm role="concept">
48542 <primary>bind IP address</primary>
48543 </indexterm>
48544 <indexterm role="concept">
48545 <primary>IP address</primary>
48546 <secondary>binding</secondary>
48547 </indexterm>
48548 <indexterm role="variable">
48549 <primary><varname>$host</varname></primary>
48550 </indexterm>
48551 <indexterm role="variable">
48552 <primary><varname>$host_address</varname></primary>
48553 </indexterm>
48554 This option specifies which interface to bind to when making an outgoing SMTP
48555 call. The value is an IP address, not an interface name such as
48556 <literal>eth0</literal>. Do not confuse this with the interface address that was used when a
48557 message was received, which is in <varname>$received_ip_address</varname>, formerly known as
48558 <varname>$interface_address</varname>. The name was changed to minimize confusion with the
48559 outgoing interface address. There is no variable that contains an outgoing
48560 interface address because, unless it is set by this option, its value is
48561 unknown.
48562 </para>
48563 <para>
48564 During the expansion of the <option>interface</option> option the variables <varname>$host</varname> and
48565 <varname>$host_address</varname> refer to the host to which a connection is about to be made
48566 during the expansion of the string. Forced expansion failure, or an empty
48567 string result causes the option to be ignored. Otherwise, after expansion, the
48568 string must be a list of IP addresses, colon-separated by default, but the
48569 separator can be changed in the usual way (<xref linkend="SECTlistsepchange"/>).
48570 For example:
48571 </para>
48572 <literallayout class="monospaced">
48573 interface = &lt;; 192.168.123.123 ; 3ffe:ffff:836f::fe86:a061
48574 </literallayout>
48575 <para>
48576 The first interface of the correct type (IPv4 or IPv6) is used for the outgoing
48577 connection. If none of them are the correct type, the option is ignored. If
48578 <option>interface</option> is not set, or is ignored, the system&#x2019;s IP functions choose which
48579 interface to use if the host has more than one.
48580 </para>
48581 <para>
48582 <indexterm role="option">
48583 <primary><option>keepalive</option></primary>
48584 </indexterm>
48585 </para>
48586 <informaltable frame="all">
48587 <tgroup cols="4" colsep="0" rowsep="0">
48588 <colspec colwidth="8*" align="left"/>
48589 <colspec colwidth="6*" align="center"/>
48590 <colspec colwidth="6*" align="center"/>
48591 <colspec colwidth="6*" align="right"/>
48592 <tbody>
48593 <row>
48594 <entry><option>keepalive</option></entry>
48595 <entry>Use: <emphasis>smtp</emphasis></entry>
48596 <entry>Type: <emphasis>boolean</emphasis></entry>
48597 <entry>Default: <emphasis>true</emphasis></entry>
48598 </row>
48599 </tbody>
48600 </tgroup>
48601 </informaltable>
48602 <para>
48603 <indexterm role="concept">
48604 <primary>keepalive</primary>
48605 <secondary>on outgoing connection</secondary>
48606 </indexterm>
48607 This option controls the setting of SO_KEEPALIVE on outgoing TCP/IP socket
48608 connections. When set, it causes the kernel to probe idle connections
48609 periodically, by sending packets with <quote>old</quote> sequence numbers. The other end
48610 of the connection should send a acknowledgment if the connection is still okay
48611 or a reset if the connection has been aborted. The reason for doing this is
48612 that it has the beneficial effect of freeing up certain types of connection
48613 that can get stuck when the remote host is disconnected without tidying up the
48614 TCP/IP call properly. The keepalive mechanism takes several hours to detect
48615 unreachable hosts.
48616 </para>
48617 <para>
48618 <indexterm role="option">
48619 <primary><option>lmtp_ignore_quota</option></primary>
48620 </indexterm>
48621 </para>
48622 <informaltable frame="all">
48623 <tgroup cols="4" colsep="0" rowsep="0">
48624 <colspec colwidth="8*" align="left"/>
48625 <colspec colwidth="6*" align="center"/>
48626 <colspec colwidth="6*" align="center"/>
48627 <colspec colwidth="6*" align="right"/>
48628 <tbody>
48629 <row>
48630 <entry><option>lmtp_ignore_quota</option></entry>
48631 <entry>Use: <emphasis>smtp</emphasis></entry>
48632 <entry>Type: <emphasis>boolean</emphasis></entry>
48633 <entry>Default: <emphasis>false</emphasis></entry>
48634 </row>
48635 </tbody>
48636 </tgroup>
48637 </informaltable>
48638 <para>
48639 <indexterm role="concept">
48640 <primary>LMTP</primary>
48641 <secondary>ignoring quota errors</secondary>
48642 </indexterm>
48643 If this option is set true when the <option>protocol</option> option is set to <quote>lmtp</quote>, the
48644 string <literal>IGNOREQUOTA</literal> is added to RCPT commands, provided that the LMTP server
48645 has advertised support for IGNOREQUOTA in its response to the LHLO command.
48646 </para>
48647 <para>
48648 <indexterm role="option">
48649 <primary><option>max_rcpt</option></primary>
48650 </indexterm>
48651 </para>
48652 <informaltable frame="all">
48653 <tgroup cols="4" colsep="0" rowsep="0">
48654 <colspec colwidth="8*" align="left"/>
48655 <colspec colwidth="6*" align="center"/>
48656 <colspec colwidth="6*" align="center"/>
48657 <colspec colwidth="6*" align="right"/>
48658 <tbody>
48659 <row>
48660 <entry><option>max_rcpt</option></entry>
48661 <entry>Use: <emphasis>smtp</emphasis></entry>
48662 <entry>Type: <emphasis>integer</emphasis></entry>
48663 <entry>Default: <emphasis>100</emphasis></entry>
48664 </row>
48665 </tbody>
48666 </tgroup>
48667 </informaltable>
48668 <para>
48669 <indexterm role="concept">
48670 <primary>RCPT</primary>
48671 <secondary>maximum number of outgoing</secondary>
48672 </indexterm>
48673 This option limits the number of RCPT commands that are sent in a single
48674 SMTP message transaction. Each set of addresses is treated independently, and
48675 so can cause parallel connections to the same host if <option>remote_max_parallel</option>
48676 permits this.
48677 </para>
48678 <para>
48679 <indexterm role="option">
48680 <primary><option>multi_domain</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>multi_domain</option></entry>
48692 <entry>Use: <emphasis>smtp</emphasis></entry>
48693 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
48694 <entry>Default: <emphasis>true</emphasis></entry>
48695 </row>
48696 </tbody>
48697 </tgroup>
48698 </informaltable>
48699 <para>
48700 <indexterm role="variable">
48701 <primary><varname>$domain</varname></primary>
48702 </indexterm>
48703 When this option is set, the <command>smtp</command> transport can handle a number of
48704 addresses containing a mixture of different domains provided they all resolve
48705 to the same list of hosts. Turning the option off restricts the transport to
48706 handling only one domain at a time. This is useful if you want to use
48707 <varname>$domain</varname> in an expansion for the transport, because it is set only when there
48708 is a single domain involved in a remote delivery.
48709 </para>
48710 <para>
48711 It is expanded per-address and can depend on any of
48712 <varname>$address_data</varname>, <varname>$domain_data</varname>, <varname>$local_part_data</varname>,
48713 <varname>$host</varname>, <varname>$host_address</varname> and <varname>$host_port</varname>.
48714 </para>
48715 <para>
48716 <indexterm role="option">
48717 <primary><option>port</option></primary>
48718 </indexterm>
48719 </para>
48720 <informaltable frame="all">
48721 <tgroup cols="4" colsep="0" rowsep="0">
48722 <colspec colwidth="8*" align="left"/>
48723 <colspec colwidth="6*" align="center"/>
48724 <colspec colwidth="6*" align="center"/>
48725 <colspec colwidth="6*" align="right"/>
48726 <tbody>
48727 <row>
48728 <entry><option>port</option></entry>
48729 <entry>Use: <emphasis>smtp</emphasis></entry>
48730 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48731 <entry>Default: <emphasis>see below</emphasis></entry>
48732 </row>
48733 </tbody>
48734 </tgroup>
48735 </informaltable>
48736 <para>
48737 <indexterm role="concept">
48738 <primary>port</primary>
48739 <secondary>sending TCP/IP</secondary>
48740 </indexterm>
48741 <indexterm role="concept">
48742 <primary>TCP/IP</primary>
48743 <secondary>setting outgoing port</secondary>
48744 </indexterm>
48745 This option specifies the TCP/IP port on the server to which Exim connects.
48746 <emphasis role="bold">Note:</emphasis> Do not confuse this with the port that was used when a message was
48747 received, which is in <varname>$received_port</varname>, formerly known as <varname>$interface_port</varname>.
48748 The name was changed to minimize confusion with the outgoing port. There is no
48749 variable that contains an outgoing port.
48750 </para>
48751 <para>
48752 If the value of this option begins with a digit it is taken as a port number;
48753 otherwise it is looked up using <function>getservbyname()</function>. The default value is
48754 normally <quote>smtp</quote>,
48755 but if <option>protocol</option> is set to <quote>lmtp</quote> the default is <quote>lmtp</quote>
48756 and if <option>protocol</option> is set to <quote>smtps</quote> the default is <quote>smtps</quote>.
48757 If the expansion fails, or if a port number cannot be found, delivery
48758 is deferred.
48759 </para>
48760 <para revisionflag="changed">
48761 Note that at least one Linux distribution has been seen failing
48762 to put <quote>smtps</quote> in its <quote>/etc/services</quote> file, resulting is such deferrals.
48763 </para>
48764 <para>
48765 <indexterm role="option">
48766 <primary><option>protocol</option></primary>
48767 </indexterm>
48768 </para>
48769 <informaltable frame="all">
48770 <tgroup cols="4" colsep="0" rowsep="0">
48771 <colspec colwidth="8*" align="left"/>
48772 <colspec colwidth="6*" align="center"/>
48773 <colspec colwidth="6*" align="center"/>
48774 <colspec colwidth="6*" align="right"/>
48775 <tbody>
48776 <row>
48777 <entry><option>protocol</option></entry>
48778 <entry>Use: <emphasis>smtp</emphasis></entry>
48779 <entry>Type: <emphasis>string</emphasis></entry>
48780 <entry>Default: <emphasis>smtp</emphasis></entry>
48781 </row>
48782 </tbody>
48783 </tgroup>
48784 </informaltable>
48785 <para>
48786 <indexterm role="concept">
48787 <primary>LMTP</primary>
48788 <secondary>over TCP/IP</secondary>
48789 </indexterm>
48790 <indexterm role="concept">
48791 <primary>ssmtp protocol</primary>
48792 <secondary>outbound</secondary>
48793 </indexterm>
48794 <indexterm role="concept">
48795 <primary>TLS</primary>
48796 <secondary>SSL-on-connect outbound</secondary>
48797 </indexterm>
48798 <indexterm role="variable">
48799 <primary><varname>$port</varname></primary>
48800 </indexterm>
48801 If this option is set to <quote>lmtp</quote> instead of <quote>smtp</quote>, the default value for
48802 the <option>port</option> option changes to <quote>lmtp</quote>, and the transport operates the LMTP
48803 protocol (RFC 2033) instead of SMTP. This protocol is sometimes used for local
48804 deliveries into closed message stores. Exim also has support for running LMTP
48805 over a pipe to a local process &ndash; see chapter <xref linkend="CHAPLMTP"/>.
48806 </para>
48807 <para>
48808 If this option is set to <quote>smtps</quote>, the default value for the <option>port</option> option
48809 changes to <quote>smtps</quote>, and the transport initiates TLS immediately after
48810 connecting, as an outbound SSL-on-connect, instead of using STARTTLS to upgrade.
48811 </para>
48812 <para revisionflag="changed">
48813 The Internet standards bodies used to strongly discourage use of this mode,
48814 but as of RFC 8314 it is perferred over STARTTLS for message submission
48815 (as distinct from MTA-MTA communication).
48816 </para>
48817 <para>
48818 <indexterm role="option">
48819 <primary><option>retry_include_ip_address</option></primary>
48820 </indexterm>
48821 </para>
48822 <informaltable frame="all">
48823 <tgroup cols="4" colsep="0" rowsep="0">
48824 <colspec colwidth="8*" align="left"/>
48825 <colspec colwidth="6*" align="center"/>
48826 <colspec colwidth="6*" align="center"/>
48827 <colspec colwidth="6*" align="right"/>
48828 <tbody>
48829 <row>
48830 <entry><option>retry_include_ip_address</option></entry>
48831 <entry>Use: <emphasis>smtp</emphasis></entry>
48832 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
48833 <entry>Default: <emphasis>true</emphasis></entry>
48834 </row>
48835 </tbody>
48836 </tgroup>
48837 </informaltable>
48838 <para>
48839 Exim normally includes both the host name and the IP address in the key it
48840 constructs for indexing retry data after a temporary delivery failure. This
48841 means that when one of several IP addresses for a host is failing, it gets
48842 tried periodically (controlled by the retry rules), but use of the other IP
48843 addresses is not affected.
48844 </para>
48845 <para>
48846 However, in some dialup environments hosts are assigned a different IP address
48847 each time they connect. In this situation the use of the IP address as part of
48848 the retry key leads to undesirable behaviour. Setting this option false causes
48849 Exim to use only the host name.
48850 Since it is expanded it can be made to depend on the host or domain.
48851 </para>
48852 <para>
48853 <indexterm role="option">
48854 <primary><option>serialize_hosts</option></primary>
48855 </indexterm>
48856 </para>
48857 <informaltable frame="all">
48858 <tgroup cols="4" colsep="0" rowsep="0">
48859 <colspec colwidth="8*" align="left"/>
48860 <colspec colwidth="6*" align="center"/>
48861 <colspec colwidth="6*" align="center"/>
48862 <colspec colwidth="6*" align="right"/>
48863 <tbody>
48864 <row>
48865 <entry><option>serialize_hosts</option></entry>
48866 <entry>Use: <emphasis>smtp</emphasis></entry>
48867 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
48868 <entry>Default: <emphasis>unset</emphasis></entry>
48869 </row>
48870 </tbody>
48871 </tgroup>
48872 </informaltable>
48873 <para>
48874 <indexterm role="concept">
48875 <primary>serializing connections</primary>
48876 </indexterm>
48877 <indexterm role="concept">
48878 <primary>host</primary>
48879 <secondary>serializing connections</secondary>
48880 </indexterm>
48881 Because Exim operates in a distributed manner, if several messages for the same
48882 host arrive at around the same time, more than one simultaneous connection to
48883 the remote host can occur. This is not usually a problem except when there is a
48884 slow link between the hosts. In that situation it may be helpful to restrict
48885 Exim to one connection at a time. This can be done by setting
48886 <option>serialize_hosts</option> to match the relevant hosts.
48887 </para>
48888 <para>
48889 <indexterm role="concept">
48890 <primary>hints database</primary>
48891 <secondary>serializing deliveries to a host</secondary>
48892 </indexterm>
48893 Exim implements serialization by means of a hints database in which a record is
48894 written whenever a process connects to one of the restricted hosts. The record
48895 is deleted when the connection is completed. Obviously there is scope for
48896 records to get left lying around if there is a system or program crash. To
48897 guard against this, Exim ignores any records that are more than six hours old.
48898 </para>
48899 <para>
48900 If you set up this kind of serialization, you should also arrange to delete the
48901 relevant hints database whenever your system reboots. The names of the files
48902 start with <filename>misc</filename> and they are kept in the <filename>spool/db</filename> directory. There
48903 may be one or two files, depending on the type of DBM in use. The same files
48904 are used for ETRN serialization.
48905 </para>
48906 <para>
48907 See also the <option>max_parallel</option> generic transport option.
48908 </para>
48909 <para>
48910 <indexterm role="option">
48911 <primary><option>size_addition</option></primary>
48912 </indexterm>
48913 </para>
48914 <informaltable frame="all">
48915 <tgroup cols="4" colsep="0" rowsep="0">
48916 <colspec colwidth="8*" align="left"/>
48917 <colspec colwidth="6*" align="center"/>
48918 <colspec colwidth="6*" align="center"/>
48919 <colspec colwidth="6*" align="right"/>
48920 <tbody>
48921 <row>
48922 <entry><option>size_addition</option></entry>
48923 <entry>Use: <emphasis>smtp</emphasis></entry>
48924 <entry>Type: <emphasis>integer</emphasis></entry>
48925 <entry>Default: <emphasis>1024</emphasis></entry>
48926 </row>
48927 </tbody>
48928 </tgroup>
48929 </informaltable>
48930 <para>
48931 <indexterm role="concept">
48932 <primary>SMTP</primary>
48933 <secondary>SIZE</secondary>
48934 </indexterm>
48935 <indexterm role="concept">
48936 <primary>message</primary>
48937 <secondary>size issue for transport filter</secondary>
48938 </indexterm>
48939 <indexterm role="concept">
48940 <primary>size</primary>
48941 <secondary>of message</secondary>
48942 </indexterm>
48943 <indexterm role="concept">
48944 <primary>transport</primary>
48945 <secondary>filter</secondary>
48946 </indexterm>
48947 <indexterm role="concept">
48948 <primary>filter</primary>
48949 <secondary>transport filter</secondary>
48950 </indexterm>
48951 If a remote SMTP server indicates that it supports the SIZE option of the
48952 MAIL command, Exim uses this to pass over the message size at the start of
48953 an SMTP transaction. It adds the value of <option>size_addition</option> to the value it
48954 sends, to allow for headers and other text that may be added during delivery by
48955 configuration options or in a transport filter. It may be necessary to increase
48956 this if a lot of text is added to messages.
48957 </para>
48958 <para>
48959 Alternatively, if the value of <option>size_addition</option> is set negative, it disables
48960 the use of the SIZE option altogether.
48961 </para>
48962 <para>
48963 <indexterm role="option">
48964 <primary><option>socks_proxy</option></primary>
48965 </indexterm>
48966 </para>
48967 <informaltable frame="all">
48968 <tgroup cols="4" colsep="0" rowsep="0">
48969 <colspec colwidth="8*" align="left"/>
48970 <colspec colwidth="6*" align="center"/>
48971 <colspec colwidth="6*" align="center"/>
48972 <colspec colwidth="6*" align="right"/>
48973 <tbody>
48974 <row>
48975 <entry><option>socks_proxy</option></entry>
48976 <entry>Use: <emphasis>smtp</emphasis></entry>
48977 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48978 <entry>Default: <emphasis>unset</emphasis></entry>
48979 </row>
48980 </tbody>
48981 </tgroup>
48982 </informaltable>
48983 <para>
48984 <indexterm role="concept">
48985 <primary>proxy</primary>
48986 <secondary>SOCKS</secondary>
48987 </indexterm>
48988 This option enables use of SOCKS proxies for connections made by the
48989 transport.  For details see section <xref linkend="SECTproxySOCKS"/>.
48990 </para>
48991 <para>
48992 <indexterm role="option">
48993 <primary><option>tls_certificate</option></primary>
48994 </indexterm>
48995 </para>
48996 <informaltable frame="all">
48997 <tgroup cols="4" colsep="0" rowsep="0">
48998 <colspec colwidth="8*" align="left"/>
48999 <colspec colwidth="6*" align="center"/>
49000 <colspec colwidth="6*" align="center"/>
49001 <colspec colwidth="6*" align="right"/>
49002 <tbody>
49003 <row>
49004 <entry><option>tls_certificate</option></entry>
49005 <entry>Use: <emphasis>smtp</emphasis></entry>
49006 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49007 <entry>Default: <emphasis>unset</emphasis></entry>
49008 </row>
49009 </tbody>
49010 </tgroup>
49011 </informaltable>
49012 <para>
49013 <indexterm role="concept">
49014 <primary>TLS</primary>
49015 <secondary>client certificate, location of</secondary>
49016 </indexterm>
49017 <indexterm role="concept">
49018 <primary>certificate</primary>
49019 <secondary>client, location of</secondary>
49020 </indexterm>
49021 <indexterm role="variable">
49022 <primary><varname>$host</varname></primary>
49023 </indexterm>
49024 <indexterm role="variable">
49025 <primary><varname>$host_address</varname></primary>
49026 </indexterm>
49027 The value of this option must be the absolute path to a file which contains the
49028 client&#x2019;s certificate, for possible use when sending a message over an encrypted
49029 connection. The values of <varname>$host</varname> and <varname>$host_address</varname> are set to the name and
49030 address of the server during the expansion. See chapter <xref linkend="CHAPTLS"/> for
49031 details of TLS.
49032 </para>
49033 <para>
49034 <emphasis role="bold">Note</emphasis>: This option must be set if you want Exim to be able to use a TLS
49035 certificate when sending messages as a client. The global option of the same
49036 name specifies the certificate for Exim as a server; it is not automatically
49037 assumed that the same certificate should be used when Exim is operating as a
49038 client.
49039 </para>
49040 <para>
49041 <indexterm role="option">
49042 <primary><option>tls_crl</option></primary>
49043 </indexterm>
49044 </para>
49045 <informaltable frame="all">
49046 <tgroup cols="4" colsep="0" rowsep="0">
49047 <colspec colwidth="8*" align="left"/>
49048 <colspec colwidth="6*" align="center"/>
49049 <colspec colwidth="6*" align="center"/>
49050 <colspec colwidth="6*" align="right"/>
49051 <tbody>
49052 <row>
49053 <entry><option>tls_crl</option></entry>
49054 <entry>Use: <emphasis>smtp</emphasis></entry>
49055 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49056 <entry>Default: <emphasis>unset</emphasis></entry>
49057 </row>
49058 </tbody>
49059 </tgroup>
49060 </informaltable>
49061 <para>
49062 <indexterm role="concept">
49063 <primary>TLS</primary>
49064 <secondary>client certificate revocation list</secondary>
49065 </indexterm>
49066 <indexterm role="concept">
49067 <primary>certificate</primary>
49068 <secondary>revocation list for client</secondary>
49069 </indexterm>
49070 This option specifies a certificate revocation list. The expanded value must
49071 be the name of a file that contains a CRL in PEM format.
49072 </para>
49073 <para>
49074 <indexterm role="option">
49075 <primary><option>tls_dh_min_bits</option></primary>
49076 </indexterm>
49077 </para>
49078 <informaltable frame="all">
49079 <tgroup cols="4" colsep="0" rowsep="0">
49080 <colspec colwidth="8*" align="left"/>
49081 <colspec colwidth="6*" align="center"/>
49082 <colspec colwidth="6*" align="center"/>
49083 <colspec colwidth="6*" align="right"/>
49084 <tbody>
49085 <row>
49086 <entry><option>tls_dh_min_bits</option></entry>
49087 <entry>Use: <emphasis>smtp</emphasis></entry>
49088 <entry>Type: <emphasis>integer</emphasis></entry>
49089 <entry>Default: <emphasis>1024</emphasis></entry>
49090 </row>
49091 </tbody>
49092 </tgroup>
49093 </informaltable>
49094 <para>
49095 <indexterm role="concept">
49096 <primary>TLS</primary>
49097 <secondary>Diffie-Hellman minimum acceptable size</secondary>
49098 </indexterm>
49099 When establishing a TLS session, if a ciphersuite which uses Diffie-Hellman
49100 key agreement is negotiated, the server will provide a large prime number
49101 for use.  This option establishes the minimum acceptable size of that number.
49102 If the parameter offered by the server is too small, then the TLS handshake
49103 will fail.
49104 </para>
49105 <para>
49106 Only supported when using GnuTLS.
49107 </para>
49108 <para>
49109 <indexterm role="option">
49110 <primary><option>tls_privatekey</option></primary>
49111 </indexterm>
49112 </para>
49113 <informaltable frame="all">
49114 <tgroup cols="4" colsep="0" rowsep="0">
49115 <colspec colwidth="8*" align="left"/>
49116 <colspec colwidth="6*" align="center"/>
49117 <colspec colwidth="6*" align="center"/>
49118 <colspec colwidth="6*" align="right"/>
49119 <tbody>
49120 <row>
49121 <entry><option>tls_privatekey</option></entry>
49122 <entry>Use: <emphasis>smtp</emphasis></entry>
49123 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49124 <entry>Default: <emphasis>unset</emphasis></entry>
49125 </row>
49126 </tbody>
49127 </tgroup>
49128 </informaltable>
49129 <para>
49130 <indexterm role="concept">
49131 <primary>TLS</primary>
49132 <secondary>client private key, location of</secondary>
49133 </indexterm>
49134 <indexterm role="variable">
49135 <primary><varname>$host</varname></primary>
49136 </indexterm>
49137 <indexterm role="variable">
49138 <primary><varname>$host_address</varname></primary>
49139 </indexterm>
49140 The value of this option must be the absolute path to a file which contains the
49141 client&#x2019;s private key. This is used when sending a message over an encrypted
49142 connection using a client certificate. The values of <varname>$host</varname> and
49143 <varname>$host_address</varname> are set to the name and address of the server during the
49144 expansion. If this option is unset, or the expansion is forced to fail, or the
49145 result is an empty string, the private key is assumed to be in the same file as
49146 the certificate. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
49147 </para>
49148 <para>
49149 <indexterm role="option">
49150 <primary><option>tls_require_ciphers</option></primary>
49151 </indexterm>
49152 </para>
49153 <informaltable frame="all">
49154 <tgroup cols="4" colsep="0" rowsep="0">
49155 <colspec colwidth="8*" align="left"/>
49156 <colspec colwidth="6*" align="center"/>
49157 <colspec colwidth="6*" align="center"/>
49158 <colspec colwidth="6*" align="right"/>
49159 <tbody>
49160 <row>
49161 <entry><option>tls_require_ciphers</option></entry>
49162 <entry>Use: <emphasis>smtp</emphasis></entry>
49163 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49164 <entry>Default: <emphasis>unset</emphasis></entry>
49165 </row>
49166 </tbody>
49167 </tgroup>
49168 </informaltable>
49169 <para>
49170 <indexterm role="concept">
49171 <primary>TLS</primary>
49172 <secondary>requiring specific ciphers</secondary>
49173 </indexterm>
49174 <indexterm role="concept">
49175 <primary>cipher</primary>
49176 <secondary>requiring specific</secondary>
49177 </indexterm>
49178 <indexterm role="variable">
49179 <primary><varname>$host</varname></primary>
49180 </indexterm>
49181 <indexterm role="variable">
49182 <primary><varname>$host_address</varname></primary>
49183 </indexterm>
49184 The value of this option must be a list of permitted cipher suites, for use
49185 when setting up an outgoing encrypted connection. (There is a global option of
49186 the same name for controlling incoming connections.) The values of <varname>$host</varname> and
49187 <varname>$host_address</varname> are set to the name and address of the server during the
49188 expansion. See chapter <xref linkend="CHAPTLS"/> for details of TLS; note that this option
49189 is used in different ways by OpenSSL and GnuTLS (see sections
49190 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>). For GnuTLS, the order of the
49191 ciphers is a preference order.
49192 </para>
49193 <para>
49194 <indexterm role="option">
49195 <primary><option>tls_sni</option></primary>
49196 </indexterm>
49197 </para>
49198 <informaltable frame="all">
49199 <tgroup cols="4" colsep="0" rowsep="0">
49200 <colspec colwidth="8*" align="left"/>
49201 <colspec colwidth="6*" align="center"/>
49202 <colspec colwidth="6*" align="center"/>
49203 <colspec colwidth="6*" align="right"/>
49204 <tbody>
49205 <row>
49206 <entry><option>tls_sni</option></entry>
49207 <entry>Use: <emphasis>smtp</emphasis></entry>
49208 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49209 <entry>Default: <emphasis>unset</emphasis></entry>
49210 </row>
49211 </tbody>
49212 </tgroup>
49213 </informaltable>
49214 <para>
49215 <indexterm role="concept">
49216 <primary>TLS</primary>
49217 <secondary>Server Name Indication</secondary>
49218 </indexterm>
49219 <indexterm role="variable">
49220 <primary><varname>$tls_sni</varname></primary>
49221 </indexterm>
49222 If this option is set then it sets the $tls_out_sni variable and causes any
49223 TLS session to pass this value as the Server Name Indication extension to
49224 the remote side, which can be used by the remote side to select an appropriate
49225 certificate and private key for the session.
49226 </para>
49227 <para>
49228 See <xref linkend="SECTtlssni"/> for more information.
49229 </para>
49230 <para>
49231 Note that for OpenSSL, this feature requires a build of OpenSSL that supports
49232 TLS extensions.
49233 </para>
49234 <para>
49235 <indexterm role="option">
49236 <primary><option>tls_tempfail_tryclear</option></primary>
49237 </indexterm>
49238 </para>
49239 <informaltable frame="all">
49240 <tgroup cols="4" colsep="0" rowsep="0">
49241 <colspec colwidth="8*" align="left"/>
49242 <colspec colwidth="6*" align="center"/>
49243 <colspec colwidth="6*" align="center"/>
49244 <colspec colwidth="6*" align="right"/>
49245 <tbody>
49246 <row>
49247 <entry><option>tls_tempfail_tryclear</option></entry>
49248 <entry>Use: <emphasis>smtp</emphasis></entry>
49249 <entry>Type: <emphasis>boolean</emphasis></entry>
49250 <entry>Default: <emphasis>true</emphasis></entry>
49251 </row>
49252 </tbody>
49253 </tgroup>
49254 </informaltable>
49255 <para>
49256 <indexterm role="concept">
49257 <primary>4<emphasis>xx</emphasis> responses</primary>
49258 <secondary>to STARTTLS</secondary>
49259 </indexterm>
49260 When the server host is not in <option>hosts_require_tls</option>, and there is a problem in
49261 setting up a TLS session, this option determines whether or not Exim should try
49262 to deliver the message unencrypted. If it is set false, delivery to the
49263 current host is deferred; if there are other hosts, they are tried. If this
49264 option is set true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis>
49265 response to STARTTLS. Also, if STARTTLS is accepted, but the subsequent
49266 TLS negotiation fails, Exim closes the current connection (because it is in an
49267 unknown state), opens a new one to the same host, and then tries the delivery
49268 in clear.
49269 </para>
49270 <para>
49271 <indexterm role="option">
49272 <primary><option>tls_try_verify_hosts</option></primary>
49273 </indexterm>
49274 </para>
49275 <informaltable frame="all">
49276 <tgroup cols="4" colsep="0" rowsep="0">
49277 <colspec colwidth="8*" align="left"/>
49278 <colspec colwidth="6*" align="center"/>
49279 <colspec colwidth="6*" align="center"/>
49280 <colspec colwidth="6*" align="right"/>
49281 <tbody>
49282 <row>
49283 <entry><option>tls_try_verify_hosts</option></entry>
49284 <entry>Use: <emphasis>smtp</emphasis></entry>
49285 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
49286 <entry>Default: <emphasis>*</emphasis></entry>
49287 </row>
49288 </tbody>
49289 </tgroup>
49290 </informaltable>
49291 <para>
49292 <indexterm role="concept">
49293 <primary>TLS</primary>
49294 <secondary>server certificate verification</secondary>
49295 </indexterm>
49296 <indexterm role="concept">
49297 <primary>certificate</primary>
49298 <secondary>verification of server</secondary>
49299 </indexterm>
49300 This option gives a list of hosts for which, on encrypted connections,
49301 certificate verification will be tried but need not succeed.
49302 The <option>tls_verify_certificates</option> option must also be set.
49303 Note that unless the host is in this list
49304 TLS connections will be denied to hosts using self-signed certificates
49305 when <option>tls_verify_certificates</option> is matched.
49306 The <varname>$tls_out_certificate_verified</varname> variable is set when
49307 certificate verification succeeds.
49308 </para>
49309 <para>
49310 <indexterm role="option">
49311 <primary><option>tls_verify_cert_hostnames</option></primary>
49312 </indexterm>
49313 </para>
49314 <informaltable frame="all">
49315 <tgroup cols="4" colsep="0" rowsep="0">
49316 <colspec colwidth="8*" align="left"/>
49317 <colspec colwidth="6*" align="center"/>
49318 <colspec colwidth="6*" align="center"/>
49319 <colspec colwidth="6*" align="right"/>
49320 <tbody>
49321 <row>
49322 <entry><option>tls_verify_cert_hostnames</option></entry>
49323 <entry>Use: <emphasis>smtp</emphasis></entry>
49324 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
49325 <entry>Default: <emphasis>*</emphasis></entry>
49326 </row>
49327 </tbody>
49328 </tgroup>
49329 </informaltable>
49330 <para>
49331 <indexterm role="concept">
49332 <primary>TLS</primary>
49333 <secondary>server certificate hostname verification</secondary>
49334 </indexterm>
49335 <indexterm role="concept">
49336 <primary>certificate</primary>
49337 <secondary>verification of server</secondary>
49338 </indexterm>
49339 This option give a list of hosts for which,
49340 while verifying the server certificate,
49341 checks will be included on the host name
49342 (note that this will generally be the result of a DNS MX lookup)
49343 versus Subject and Subject-Alternate-Name fields.  Wildcard names are permitted
49344 limited to being the initial component of a 3-or-more component FQDN.
49345 </para>
49346 <para>
49347 There is no equivalent checking on client certificates.
49348 </para>
49349 <para>
49350 <indexterm role="option">
49351 <primary><option>tls_verify_certificates</option></primary>
49352 </indexterm>
49353 </para>
49354 <informaltable frame="all">
49355 <tgroup cols="4" colsep="0" rowsep="0">
49356 <colspec colwidth="8*" align="left"/>
49357 <colspec colwidth="6*" align="center"/>
49358 <colspec colwidth="6*" align="center"/>
49359 <colspec colwidth="6*" align="right"/>
49360 <tbody>
49361 <row>
49362 <entry><option>tls_verify_certificates</option></entry>
49363 <entry>Use: <emphasis>smtp</emphasis></entry>
49364 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49365 <entry>Default: <emphasis>system</emphasis></entry>
49366 </row>
49367 </tbody>
49368 </tgroup>
49369 </informaltable>
49370 <para>
49371 <indexterm role="concept">
49372 <primary>TLS</primary>
49373 <secondary>server certificate verification</secondary>
49374 </indexterm>
49375 <indexterm role="concept">
49376 <primary>certificate</primary>
49377 <secondary>verification of server</secondary>
49378 </indexterm>
49379 <indexterm role="variable">
49380 <primary><varname>$host</varname></primary>
49381 </indexterm>
49382 <indexterm role="variable">
49383 <primary><varname>$host_address</varname></primary>
49384 </indexterm>
49385 The value of this option must be either the
49386 word "system"
49387 or the absolute path to
49388 a file or directory containing permitted certificates for servers,
49389 for use when setting up an encrypted connection.
49390 </para>
49391 <para>
49392 The "system" value for the option will use a location compiled into the SSL library.
49393 This is not available for GnuTLS versions preceding 3.0.20; a value of "system"
49394 is taken as empty and an explicit location
49395 must be specified.
49396 </para>
49397 <para>
49398 The use of a directory for the option value is not available for GnuTLS versions
49399 preceding 3.3.6 and a single file must be used.
49400 </para>
49401 <para>
49402 With OpenSSL the certificates specified
49403 explicitly
49404 either by file or directory
49405 are added to those given by the system default location.
49406 </para>
49407 <para>
49408 The values of <varname>$host</varname> and
49409 <varname>$host_address</varname> are set to the name and address of the server during the
49410 expansion of this option. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
49411 </para>
49412 <para>
49413 For back-compatibility,
49414 if neither tls_verify_hosts nor tls_try_verify_hosts are set
49415 (a single-colon empty list counts as being set)
49416 and certificate verification fails the TLS connection is closed.
49417 </para>
49418 <para>
49419 <indexterm role="option">
49420 <primary><option>tls_verify_hosts</option></primary>
49421 </indexterm>
49422 </para>
49423 <informaltable frame="all">
49424 <tgroup cols="4" colsep="0" rowsep="0">
49425 <colspec colwidth="8*" align="left"/>
49426 <colspec colwidth="6*" align="center"/>
49427 <colspec colwidth="6*" align="center"/>
49428 <colspec colwidth="6*" align="right"/>
49429 <tbody>
49430 <row>
49431 <entry><option>tls_verify_hosts</option></entry>
49432 <entry>Use: <emphasis>smtp</emphasis></entry>
49433 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
49434 <entry>Default: <emphasis>unset</emphasis></entry>
49435 </row>
49436 </tbody>
49437 </tgroup>
49438 </informaltable>
49439 <para>
49440 <indexterm role="concept">
49441 <primary>TLS</primary>
49442 <secondary>server certificate verification</secondary>
49443 </indexterm>
49444 <indexterm role="concept">
49445 <primary>certificate</primary>
49446 <secondary>verification of server</secondary>
49447 </indexterm>
49448 This option gives a list of hosts for which, on encrypted connections,
49449 certificate verification must succeed.
49450 The <option>tls_verify_certificates</option> option must also be set.
49451 If both this option and <option>tls_try_verify_hosts</option> are unset
49452 operation is as if this option selected all hosts.
49453 </para>
49454 <para revisionflag="changed">
49455 <indexterm role="option">
49456 <primary><option>utf8_downconvert</option></primary>
49457 </indexterm>
49458 </para>
49459 <informaltable frame="all" revisionflag="changed">
49460 <tgroup cols="4" colsep="0" rowsep="0">
49461 <colspec colwidth="8*" align="left"/>
49462 <colspec colwidth="6*" align="center"/>
49463 <colspec colwidth="6*" align="center"/>
49464 <colspec colwidth="6*" align="right"/>
49465 <tbody>
49466 <row>
49467 <entry><option>utf8_downconvert</option></entry>
49468 <entry>Use: <emphasis>smtp</emphasis></entry>
49469 <entry>Type: <emphasis>integer!!</emphasis></entry>
49470 <entry>Default: <emphasis>unset</emphasis></entry>
49471 </row>
49472 </tbody>
49473 </tgroup>
49474 </informaltable>
49475 <para revisionflag="changed">
49476 <indexterm role="concept">
49477 <primary>utf8</primary>
49478 <secondary>address downconversion</secondary>
49479 </indexterm>
49480 <indexterm role="concept">
49481 <primary>i18n</primary>
49482 <secondary>utf8 address downconversion</secondary>
49483 </indexterm>
49484 If built with internationalization support,
49485 this option controls conversion of UTF-8 in message addresses
49486 to a-label form.
49487 For details see section <xref linkend="SECTi18nMTA"/>.
49488 </para>
49489 </section>
49490 <section id="SECTvalhosmax">
49491 <title>How the limits for the number of hosts to try are used</title>
49492 <para>
49493 <indexterm role="concept">
49494 <primary>host</primary>
49495 <secondary>maximum number to try</secondary>
49496 </indexterm>
49497 <indexterm role="concept">
49498 <primary>limit</primary>
49499 <secondary>hosts; maximum number tried</secondary>
49500 </indexterm>
49501 There are two options that are concerned with the number of hosts that are
49502 tried when an SMTP delivery takes place. They are <option>hosts_max_try</option> and
49503 <option>hosts_max_try_hardlimit</option>.
49504 </para>
49505 <para>
49506 The <option>hosts_max_try</option> option limits the number of hosts that are tried
49507 for a single delivery. However, despite the term <quote>host</quote> in its name, the
49508 option actually applies to each IP address independently. In other words, a
49509 multihomed host is treated as several independent hosts, just as it is for
49510 retrying.
49511 </para>
49512 <para>
49513 Many of the larger ISPs have multiple MX records which often point to
49514 multihomed hosts. As a result, a list of a dozen or more IP addresses may be
49515 created as a result of routing one of these domains.
49516 </para>
49517 <para>
49518 Trying every single IP address on such a long list does not seem sensible; if
49519 several at the top of the list fail, it is reasonable to assume there is some
49520 problem that is likely to affect all of them. Roughly speaking, the value of
49521 <option>hosts_max_try</option> is the maximum number that are tried before deferring the
49522 delivery. However, the logic cannot be quite that simple.
49523 </para>
49524 <para>
49525 Firstly, IP addresses that are skipped because their retry times have not
49526 arrived do not count, and in addition, addresses that are past their retry
49527 limits are also not counted, even when they are tried. This means that when
49528 some IP addresses are past their retry limits, more than the value of
49529 <option>hosts_max_retry</option> may be tried. The reason for this behaviour is to ensure
49530 that all IP addresses are considered before timing out an email address (but
49531 see below for an exception).
49532 </para>
49533 <para>
49534 Secondly, when the <option>hosts_max_try</option> limit is reached, Exim looks down the host
49535 list to see if there is a subsequent host with a different (higher valued) MX.
49536 If there is, that host is considered next, and the current IP address is used
49537 but not counted. This behaviour helps in the case of a domain with a retry rule
49538 that hardly ever delays any hosts, as is now explained:
49539 </para>
49540 <para>
49541 Consider the case of a long list of hosts with one MX value, and a few with a
49542 higher MX value. If <option>hosts_max_try</option> is small (the default is 5) only a few
49543 hosts at the top of the list are tried at first. With the default retry rule,
49544 which specifies increasing retry times, the higher MX hosts are eventually
49545 tried when those at the top of the list are skipped because they have not
49546 reached their retry times.
49547 </para>
49548 <para>
49549 However, it is common practice to put a fixed short retry time on domains for
49550 large ISPs, on the grounds that their servers are rarely down for very long.
49551 Unfortunately, these are exactly the domains that tend to resolve to long lists
49552 of hosts. The short retry time means that the lowest MX hosts are tried every
49553 time. The attempts may be in a different order because of random sorting, but
49554 without the special MX check, the higher MX hosts would never be tried until
49555 all the lower MX hosts had timed out (which might be several days), because
49556 there are always some lower MX hosts that have reached their retry times. With
49557 the special check, Exim considers at least one IP address from each MX value at
49558 every delivery attempt, even if the <option>hosts_max_try</option> limit has already been
49559 reached.
49560 </para>
49561 <para>
49562 The above logic means that <option>hosts_max_try</option> is not a hard limit, and in
49563 particular, Exim normally eventually tries all the IP addresses before timing
49564 out an email address. When <option>hosts_max_try</option> was implemented, this seemed a
49565 reasonable thing to do. Recently, however, some lunatic DNS configurations have
49566 been set up with hundreds of IP addresses for some domains. It can
49567 take a very long time indeed for an address to time out in these cases.
49568 </para>
49569 <para>
49570 The <option>hosts_max_try_hardlimit</option> option was added to help with this problem.
49571 Exim never tries more than this number of IP addresses; if it hits this limit
49572 and they are all timed out, the email address is bounced, even though not all
49573 possible IP addresses have been tried.
49574 <indexterm role="concept" startref="IIDsmttra1" class="endofrange"/>
49575 <indexterm role="concept" startref="IIDsmttra2" class="endofrange"/>
49576 </para>
49577 </section>
49578 </chapter>
49579
49580 <chapter id="CHAPrewrite">
49581 <title>Address rewriting</title>
49582 <para>
49583 <indexterm role="concept" id="IIDaddrew" class="startofrange">
49584 <primary>rewriting</primary>
49585 <secondary>addresses</secondary>
49586 </indexterm>
49587 There are some circumstances in which Exim automatically rewrites domains in
49588 addresses. The two most common are when an address is given without a domain
49589 (referred to as an <quote>unqualified address</quote>) or when an address contains an
49590 abbreviated domain that is expanded by DNS lookup.
49591 </para>
49592 <para>
49593 Unqualified envelope addresses are accepted only for locally submitted
49594 messages, or for messages that are received from hosts matching
49595 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
49596 appropriate. Unqualified addresses in header lines are qualified if they are in
49597 locally submitted messages, or messages from hosts that are permitted to send
49598 unqualified envelope addresses. Otherwise, unqualified addresses in header
49599 lines are neither qualified nor rewritten.
49600 </para>
49601 <para>
49602 One situation in which Exim does <emphasis>not</emphasis> automatically rewrite a domain is
49603 when it is the name of a CNAME record in the DNS. The older RFCs suggest that
49604 such a domain should be rewritten using the <quote>canonical</quote> name, and some MTAs
49605 do this. The new RFCs do not contain this suggestion.
49606 </para>
49607 <section id="SECID147">
49608 <title>Explicitly configured address rewriting</title>
49609 <para>
49610 This chapter describes the rewriting rules that can be used in the
49611 main rewrite section of the configuration file, and also in the generic
49612 <option>headers_rewrite</option> option that can be set on any transport.
49613 </para>
49614 <para>
49615 Some people believe that configured address rewriting is a Mortal Sin.
49616 Others believe that life is not possible without it. Exim provides the
49617 facility; you do not have to use it.
49618 </para>
49619 <para>
49620 The main rewriting rules that appear in the <quote>rewrite</quote> section of the
49621 configuration file are applied to addresses in incoming messages, both envelope
49622 addresses and addresses in header lines. Each rule specifies the types of
49623 address to which it applies.
49624 </para>
49625 <para>
49626 Whether or not addresses in header lines are rewritten depends on the origin of
49627 the headers and the type of rewriting. Global rewriting, that is, rewriting
49628 rules from the rewrite section of the configuration file, is applied only to
49629 those headers that were received with the message. Header lines that are added
49630 by ACLs or by a system filter or by individual routers or transports (which
49631 are specific to individual recipient addresses) are not rewritten by the global
49632 rules.
49633 </para>
49634 <para>
49635 Rewriting at transport time, by means of the <option>headers_rewrite</option> option,
49636 applies all headers except those added by routers and transports. That is, as
49637 well as the headers that were received with the message, it also applies to
49638 headers that were added by an ACL or a system filter.
49639 </para>
49640 <para>
49641 In general, rewriting addresses from your own system or domain has some
49642 legitimacy. Rewriting other addresses should be done only with great care and
49643 in special circumstances. The author of Exim believes that rewriting should be
49644 used sparingly, and mainly for <quote>regularizing</quote> addresses in your own domains.
49645 Although it can sometimes be used as a routing tool, this is very strongly
49646 discouraged.
49647 </para>
49648 <para>
49649 There are two commonly encountered circumstances where rewriting is used, as
49650 illustrated by these examples:
49651 </para>
49652 <itemizedlist>
49653 <listitem>
49654 <para>
49655 The company whose domain is <emphasis>hitch.fict.example</emphasis> has a number of hosts that
49656 exchange mail with each other behind a firewall, but there is only a single
49657 gateway to the outer world. The gateway rewrites <emphasis>*.hitch.fict.example</emphasis> as
49658 <emphasis>hitch.fict.example</emphasis> when sending mail off-site.
49659 </para>
49660 </listitem>
49661 <listitem>
49662 <para>
49663 A host rewrites the local parts of its own users so that, for example,
49664 <emphasis>fp42@hitch.fict.example</emphasis> becomes <emphasis>Ford.Prefect@hitch.fict.example</emphasis>.
49665 </para>
49666 </listitem>
49667 </itemizedlist>
49668 </section>
49669 <section id="SECID148">
49670 <title>When does rewriting happen?</title>
49671 <para>
49672 <indexterm role="concept">
49673 <primary>rewriting</primary>
49674 <secondary>timing of</secondary>
49675 </indexterm>
49676 <indexterm role="concept">
49677 <primary>access control lists (ACLs)</primary>
49678 <secondary>rewriting addresses in</secondary>
49679 </indexterm>
49680 Configured address rewriting can take place at several different stages of a
49681 message&#x2019;s processing.
49682 </para>
49683 <para>
49684 <indexterm role="variable">
49685 <primary><varname>$sender_address</varname></primary>
49686 </indexterm>
49687 At the start of an ACL for MAIL, the sender address may have been rewritten
49688 by a special SMTP-time rewrite rule (see section <xref linkend="SECTrewriteS"/>), but no
49689 ordinary rewrite rules have yet been applied. If, however, the sender address
49690 is verified in the ACL, it is rewritten before verification, and remains
49691 rewritten thereafter. The subsequent value of <varname>$sender_address</varname> is the
49692 rewritten address. This also applies if sender verification happens in a
49693 RCPT ACL. Otherwise, when the sender address is not verified, it is
49694 rewritten as soon as a message&#x2019;s header lines have been received.
49695 </para>
49696 <para>
49697 <indexterm role="variable">
49698 <primary><varname>$domain</varname></primary>
49699 </indexterm>
49700 <indexterm role="variable">
49701 <primary><varname>$local_part</varname></primary>
49702 </indexterm>
49703 Similarly, at the start of an ACL for RCPT, the current recipient&#x2019;s address
49704 may have been rewritten by a special SMTP-time rewrite rule, but no ordinary
49705 rewrite rules have yet been applied to it. However, the behaviour is different
49706 from the sender address when a recipient is verified. The address is rewritten
49707 for the verification, but the rewriting is not remembered at this stage. The
49708 value of <varname>$local_part</varname> and <varname>$domain</varname> after verification are always the same
49709 as they were before (that is, they contain the unrewritten &ndash; except for
49710 SMTP-time rewriting &ndash; address).
49711 </para>
49712 <para>
49713 As soon as a message&#x2019;s header lines have been received, all the envelope
49714 recipient addresses are permanently rewritten, and rewriting is also applied to
49715 the addresses in the header lines (if configured). This happens before adding
49716 any header lines that were specified in MAIL or RCPT ACLs, and
49717 <indexterm role="concept">
49718 <primary><function>local_scan()</function> function</primary>
49719 <secondary>address rewriting; timing of</secondary>
49720 </indexterm>
49721 before the DATA ACL and <function>local_scan()</function> functions are run.
49722 </para>
49723 <para>
49724 When an address is being routed, either for delivery or for verification,
49725 rewriting is applied immediately to child addresses that are generated by
49726 redirection, unless <option>no_rewrite</option> is set on the router.
49727 </para>
49728 <para>
49729 <indexterm role="concept">
49730 <primary>envelope sender</primary>
49731 <secondary>rewriting at transport time</secondary>
49732 </indexterm>
49733 <indexterm role="concept">
49734 <primary>rewriting</primary>
49735 <secondary>at transport time</secondary>
49736 </indexterm>
49737 <indexterm role="concept">
49738 <primary>header lines</primary>
49739 <secondary>rewriting at transport time</secondary>
49740 </indexterm>
49741 At transport time, additional rewriting of addresses in header lines can be
49742 specified by setting the generic <option>headers_rewrite</option> option on a transport.
49743 This option contains rules that are identical in form to those in the rewrite
49744 section of the configuration file. They are applied to the original message
49745 header lines and any that were added by ACLs or a system filter. They are not
49746 applied to header lines that are added by routers or the transport.
49747 </para>
49748 <para>
49749 The outgoing envelope sender can be rewritten by means of the <option>return_path</option>
49750 transport option. However, it is not possible to rewrite envelope recipients at
49751 transport time.
49752 </para>
49753 </section>
49754 <section id="SECID149">
49755 <title>Testing the rewriting rules that apply on input</title>
49756 <para>
49757 <indexterm role="concept">
49758 <primary>rewriting</primary>
49759 <secondary>testing</secondary>
49760 </indexterm>
49761 <indexterm role="concept">
49762 <primary>testing</primary>
49763 <secondary>rewriting</secondary>
49764 </indexterm>
49765 Exim&#x2019;s input rewriting configuration appears in a part of the runtime
49766 configuration file headed by <quote>begin rewrite</quote>. It can be tested by the
49767 <option>-brw</option> command line option. This takes an address (which can be a full RFC
49768 2822 address) as its argument. The output is a list of how the address would be
49769 transformed by the rewriting rules for each of the different places it might
49770 appear in an incoming message, that is, for each different header and for the
49771 envelope sender and recipient fields. For example,
49772 </para>
49773 <literallayout class="monospaced">
49774 exim -brw ph10@exim.workshop.example
49775 </literallayout>
49776 <para>
49777 might produce the output
49778 </para>
49779 <literallayout class="monospaced">
49780 sender: Philip.Hazel@exim.workshop.example
49781 from: Philip.Hazel@exim.workshop.example
49782 to: ph10@exim.workshop.example
49783 cc: ph10@exim.workshop.example
49784 bcc: ph10@exim.workshop.example
49785 reply-to: Philip.Hazel@exim.workshop.example
49786 env-from: Philip.Hazel@exim.workshop.example
49787 env-to: ph10@exim.workshop.example
49788 </literallayout>
49789 <para>
49790 which shows that rewriting has been set up for that address when used in any of
49791 the source fields, but not when it appears as a recipient address. At the
49792 present time, there is no equivalent way of testing rewriting rules that are
49793 set for a particular transport.
49794 </para>
49795 </section>
49796 <section id="SECID150">
49797 <title>Rewriting rules</title>
49798 <para>
49799 <indexterm role="concept">
49800 <primary>rewriting</primary>
49801 <secondary>rules</secondary>
49802 </indexterm>
49803 The rewrite section of the configuration file consists of lines of rewriting
49804 rules in the form
49805 </para>
49806 <literallayout>
49807 &lt;<emphasis>source pattern</emphasis>&gt;  &lt;<emphasis>replacement</emphasis>&gt;  &lt;<emphasis>flags</emphasis>&gt;
49808 </literallayout>
49809 <para>
49810 Rewriting rules that are specified for the <option>headers_rewrite</option> generic
49811 transport option are given as a colon-separated list. Each item in the list
49812 takes the same form as a line in the main rewriting configuration (except that
49813 any colons must be doubled, of course).
49814 </para>
49815 <para>
49816 The formats of source patterns and replacement strings are described below.
49817 Each is terminated by white space, unless enclosed in double quotes, in which
49818 case normal quoting conventions apply inside the quotes. The flags are single
49819 characters which may appear in any order. Spaces and tabs between them are
49820 ignored.
49821 </para>
49822 <para>
49823 For each address that could potentially be rewritten, the rules are scanned in
49824 order, and replacements for the address from earlier rules can themselves be
49825 replaced by later rules (but see the <quote>q</quote> and <quote>R</quote> flags).
49826 </para>
49827 <para>
49828 The order in which addresses are rewritten is undefined, may change between
49829 releases, and must not be relied on, with one exception: when a message is
49830 received, the envelope sender is always rewritten first, before any header
49831 lines are rewritten. For example, the replacement string for a rewrite of an
49832 address in <emphasis>To:</emphasis> must not assume that the message&#x2019;s address in <emphasis>From:</emphasis> has
49833 (or has not) already been rewritten. However, a rewrite of <emphasis>From:</emphasis> may assume
49834 that the envelope sender has already been rewritten.
49835 </para>
49836 <para>
49837 <indexterm role="variable">
49838 <primary><varname>$domain</varname></primary>
49839 </indexterm>
49840 <indexterm role="variable">
49841 <primary><varname>$local_part</varname></primary>
49842 </indexterm>
49843 The variables <varname>$local_part</varname> and <varname>$domain</varname> can be used in the replacement
49844 string to refer to the address that is being rewritten. Note that lookup-driven
49845 rewriting can be done by a rule of the form
49846 </para>
49847 <literallayout class="monospaced">
49848 *@*   ${lookup ...
49849 </literallayout>
49850 <para>
49851 where the lookup key uses <varname>$1</varname> and <varname>$2</varname> or <varname>$local_part</varname> and <varname>$domain</varname> to
49852 refer to the address that is being rewritten.
49853 </para>
49854 </section>
49855 <section id="SECID151">
49856 <title>Rewriting patterns</title>
49857 <para>
49858 <indexterm role="concept">
49859 <primary>rewriting</primary>
49860 <secondary>patterns</secondary>
49861 </indexterm>
49862 <indexterm role="concept">
49863 <primary>address list</primary>
49864 <secondary>in a rewriting pattern</secondary>
49865 </indexterm>
49866 The source pattern in a rewriting rule is any item which may appear in an
49867 address list (see section <xref linkend="SECTaddresslist"/>). It is in fact processed as a
49868 single-item address list, which means that it is expanded before being tested
49869 against the address. As always, if you use a regular expression as a pattern,
49870 you must take care to escape dollar and backslash characters, or use the <literal>\N</literal>
49871 facility to suppress string expansion within the regular expression.
49872 </para>
49873 <para>
49874 Domains in patterns should be given in lower case. Local parts in patterns are
49875 case-sensitive. If you want to do case-insensitive matching of local parts, you
49876 can use a regular expression that starts with <literal>^(?i)</literal>.
49877 </para>
49878 <para>
49879 <indexterm role="concept">
49880 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
49881 <secondary>in rewriting rules</secondary>
49882 </indexterm>
49883 After matching, the numerical variables <varname>$1</varname>, <varname>$2</varname>, etc. may be set,
49884 depending on the type of match which occurred. These can be used in the
49885 replacement string to insert portions of the incoming address. <varname>$0</varname> always
49886 refers to the complete incoming address. When a regular expression is used, the
49887 numerical variables are set from its capturing subexpressions. For other types
49888 of pattern they are set as follows:
49889 </para>
49890 <itemizedlist>
49891 <listitem>
49892 <para>
49893 If a local part or domain starts with an asterisk, the numerical variables
49894 refer to the character strings matched by asterisks, with <varname>$1</varname> associated with
49895 the first asterisk, and <varname>$2</varname> with the second, if present. For example, if the
49896 pattern
49897 </para>
49898 <literallayout class="monospaced">
49899 *queen@*.fict.example
49900 </literallayout>
49901 <para>
49902 is matched against the address <emphasis>hearts-queen@wonderland.fict.example</emphasis> then
49903 </para>
49904 <literallayout class="monospaced">
49905 $0 = hearts-queen@wonderland.fict.example
49906 $1 = hearts-
49907 $2 = wonderland
49908 </literallayout>
49909 <para>
49910 Note that if the local part does not start with an asterisk, but the domain
49911 does, it is <varname>$1</varname> that contains the wild part of the domain.
49912 </para>
49913 </listitem>
49914 <listitem>
49915 <para>
49916 If the domain part of the pattern is a partial lookup, the wild and fixed parts
49917 of the domain are placed in the next available numerical variables. Suppose,
49918 for example, that the address <emphasis>foo@bar.baz.example</emphasis> is processed by a
49919 rewriting rule of the form
49920 </para>
49921 <literallayout>
49922 <literal>*@partial-dbm;/some/dbm/file</literal>    &lt;<emphasis>replacement string</emphasis>&gt;
49923 </literallayout>
49924 <para>
49925 and the key in the file that matches the domain is <literal>*.baz.example</literal>. Then
49926 </para>
49927 <literallayout class="monospaced">
49928 $1 = foo
49929 $2 = bar
49930 $3 = baz.example
49931 </literallayout>
49932 <para>
49933 If the address <emphasis>foo@baz.example</emphasis> is looked up, this matches the same
49934 wildcard file entry, and in this case <varname>$2</varname> is set to the empty string, but
49935 <varname>$3</varname> is still set to <emphasis>baz.example</emphasis>. If a non-wild key is matched in a
49936 partial lookup, <varname>$2</varname> is again set to the empty string and <varname>$3</varname> is set to the
49937 whole domain. For non-partial domain lookups, no numerical variables are set.
49938 </para>
49939 </listitem>
49940 </itemizedlist>
49941 </section>
49942 <section id="SECID152">
49943 <title>Rewriting replacements</title>
49944 <para>
49945 <indexterm role="concept">
49946 <primary>rewriting</primary>
49947 <secondary>replacements</secondary>
49948 </indexterm>
49949 If the replacement string for a rule is a single asterisk, addresses that
49950 match the pattern and the flags are <emphasis>not</emphasis> rewritten, and no subsequent
49951 rewriting rules are scanned. For example,
49952 </para>
49953 <literallayout class="monospaced">
49954 hatta@lookingglass.fict.example  *  f
49955 </literallayout>
49956 <para>
49957 specifies that <emphasis>hatta@lookingglass.fict.example</emphasis> is never to be rewritten in
49958 <emphasis>From:</emphasis> headers.
49959 </para>
49960 <para>
49961 <indexterm role="variable">
49962 <primary><varname>$domain</varname></primary>
49963 </indexterm>
49964 <indexterm role="variable">
49965 <primary><varname>$local_part</varname></primary>
49966 </indexterm>
49967 If the replacement string is not a single asterisk, it is expanded, and must
49968 yield a fully qualified address. Within the expansion, the variables
49969 <varname>$local_part</varname> and <varname>$domain</varname> refer to the address that is being rewritten.
49970 Any letters they contain retain their original case &ndash; they are not lower
49971 cased. The numerical variables are set up according to the type of pattern that
49972 matched the address, as described above. If the expansion is forced to fail by
49973 the presence of <quote>fail</quote> in a conditional or lookup item, rewriting by the
49974 current rule is abandoned, but subsequent rules may take effect. Any other
49975 expansion failure causes the entire rewriting operation to be abandoned, and an
49976 entry written to the panic log.
49977 </para>
49978 </section>
49979 <section id="SECID153">
49980 <title>Rewriting flags</title>
49981 <para>
49982 There are three different kinds of flag that may appear on rewriting rules:
49983 </para>
49984 <itemizedlist>
49985 <listitem>
49986 <para>
49987 Flags that specify which headers and envelope addresses to rewrite: E, F, T, b,
49988 c, f, h, r, s, t.
49989 </para>
49990 </listitem>
49991 <listitem>
49992 <para>
49993 A flag that specifies rewriting at SMTP time: S.
49994 </para>
49995 </listitem>
49996 <listitem>
49997 <para>
49998 Flags that control the rewriting process: Q, q, R, w.
49999 </para>
50000 </listitem>
50001 </itemizedlist>
50002 <para>
50003 For rules that are part of the <option>headers_rewrite</option> generic transport option,
50004 E, F, T, and S are not permitted.
50005 </para>
50006 </section>
50007 <section id="SECID154">
50008 <title>Flags specifying which headers and envelope addresses to rewrite</title>
50009 <para>
50010 <indexterm role="concept">
50011 <primary>rewriting</primary>
50012 <secondary>flags</secondary>
50013 </indexterm>
50014 If none of the following flag letters, nor the <quote>S</quote> flag (see section
50015 <xref linkend="SECTrewriteS"/>) are present, a main rewriting rule applies to all headers
50016 and to both the sender and recipient fields of the envelope, whereas a
50017 transport-time rewriting rule just applies to all headers. Otherwise, the
50018 rewriting rule is skipped unless the relevant addresses are being processed.
50019 </para>
50020 <literallayout>
50021 <literal>E</literal>       rewrite all envelope fields
50022 <literal>F</literal>       rewrite the envelope From field
50023 <literal>T</literal>       rewrite the envelope To field
50024 <literal>b</literal>       rewrite the <emphasis>Bcc:</emphasis> header
50025 <literal>c</literal>       rewrite the <emphasis>Cc:</emphasis> header
50026 <literal>f</literal>       rewrite the <emphasis>From:</emphasis> header
50027 <literal>h</literal>       rewrite all headers
50028 <literal>r</literal>       rewrite the <emphasis>Reply-To:</emphasis> header
50029 <literal>s</literal>       rewrite the <emphasis>Sender:</emphasis> header
50030 <literal>t</literal>       rewrite the <emphasis>To:</emphasis> header
50031 </literallayout>
50032 <para>
50033 "All headers" means all of the headers listed above that can be selected
50034 individually, plus their <emphasis>Resent-</emphasis> versions. It does not include
50035 other headers such as <emphasis>Subject:</emphasis> etc.
50036 </para>
50037 <para>
50038 You should be particularly careful about rewriting <emphasis>Sender:</emphasis> headers, and
50039 restrict this to special known cases in your own domains.
50040 </para>
50041 </section>
50042 <section id="SECTrewriteS">
50043 <title>The SMTP-time rewriting flag</title>
50044 <para>
50045 <indexterm role="concept">
50046 <primary>SMTP</primary>
50047 <secondary>rewriting malformed addresses</secondary>
50048 </indexterm>
50049 <indexterm role="concept">
50050 <primary>RCPT</primary>
50051 <secondary>rewriting argument of</secondary>
50052 </indexterm>
50053 <indexterm role="concept">
50054 <primary>MAIL</primary>
50055 <secondary>rewriting argument of</secondary>
50056 </indexterm>
50057 The rewrite flag <quote>S</quote> specifies a rewrite of incoming envelope addresses at
50058 SMTP time, as soon as an address is received in a MAIL or RCPT command, and
50059 before any other processing; even before syntax checking. The pattern is
50060 required to be a regular expression, and it is matched against the whole of the
50061 data for the command, including any surrounding angle brackets.
50062 </para>
50063 <para>
50064 <indexterm role="variable">
50065 <primary><varname>$domain</varname></primary>
50066 </indexterm>
50067 <indexterm role="variable">
50068 <primary><varname>$local_part</varname></primary>
50069 </indexterm>
50070 This form of rewrite rule allows for the handling of addresses that are not
50071 compliant with RFCs 2821 and 2822 (for example, <quote>bang paths</quote> in batched SMTP
50072 input). Because the input is not required to be a syntactically valid address,
50073 the variables <varname>$local_part</varname> and <varname>$domain</varname> are not available during the
50074 expansion of the replacement string. The result of rewriting replaces the
50075 original address in the MAIL or RCPT command.
50076 </para>
50077 </section>
50078 <section id="SECID155">
50079 <title>Flags controlling the rewriting process</title>
50080 <para>
50081 There are four flags which control the way the rewriting process works. These
50082 take effect only when a rule is invoked, that is, when the address is of the
50083 correct type (matches the flags) and matches the pattern:
50084 </para>
50085 <itemizedlist>
50086 <listitem>
50087 <para>
50088 If the <quote>Q</quote> flag is set on a rule, the rewritten address is permitted to be an
50089 unqualified local part. It is qualified with <option>qualify_recipient</option>. In the
50090 absence of <quote>Q</quote> the rewritten address must always include a domain.
50091 </para>
50092 </listitem>
50093 <listitem>
50094 <para>
50095 If the <quote>q</quote> flag is set on a rule, no further rewriting rules are considered,
50096 even if no rewriting actually takes place because of a <quote>fail</quote> in the
50097 expansion. The <quote>q</quote> flag is not effective if the address is of the wrong type
50098 (does not match the flags) or does not match the pattern.
50099 </para>
50100 </listitem>
50101 <listitem>
50102 <para>
50103 The <quote>R</quote> flag causes a successful rewriting rule to be re-applied to the new
50104 address, up to ten times. It can be combined with the <quote>q</quote> flag, to stop
50105 rewriting once it fails to match (after at least one successful rewrite).
50106 </para>
50107 </listitem>
50108 <listitem>
50109 <para>
50110 <indexterm role="concept">
50111 <primary>rewriting</primary>
50112 <secondary>whole addresses</secondary>
50113 </indexterm>
50114 When an address in a header is rewritten, the rewriting normally applies only
50115 to the working part of the address, with any comments and RFC 2822 <quote>phrase</quote>
50116 left unchanged. For example, rewriting might change
50117 </para>
50118 <literallayout class="monospaced">
50119 From: Ford Prefect &lt;fp42@restaurant.hitch.fict.example&gt;
50120 </literallayout>
50121 <para>
50122 into
50123 </para>
50124 <literallayout class="monospaced">
50125 From: Ford Prefect &lt;prefectf@hitch.fict.example&gt;
50126 </literallayout>
50127 <para>
50128 <indexterm role="concept">
50129 <primary>RFC 2047</primary>
50130 </indexterm>
50131 Sometimes there is a need to replace the whole address item, and this can be
50132 done by adding the flag letter <quote>w</quote> to a rule. If this is set on a rule that
50133 causes an address in a header line to be rewritten, the entire address is
50134 replaced, not just the working part. The replacement must be a complete RFC
50135 2822 address, including the angle brackets if necessary. If text outside angle
50136 brackets contains a character whose value is greater than 126 or less than 32
50137 (except for tab), the text is encoded according to RFC 2047. The character set
50138 is taken from <option>headers_charset</option>, which gets its default at build time.
50139 </para>
50140 <para>
50141 When the <quote>w</quote> flag is set on a rule that causes an envelope address to be
50142 rewritten, all but the working part of the replacement address is discarded.
50143 </para>
50144 </listitem>
50145 </itemizedlist>
50146 </section>
50147 <section id="SECID156">
50148 <title>Rewriting examples</title>
50149 <para>
50150 Here is an example of the two common rewriting paradigms:
50151 </para>
50152 <literallayout class="monospaced">
50153 *@*.hitch.fict.example  $1@hitch.fict.example
50154 *@hitch.fict.example    ${lookup{$1}dbm{/etc/realnames}\
50155                      {$value}fail}@hitch.fict.example bctfrF
50156 </literallayout>
50157 <para>
50158 Note the use of <quote>fail</quote> in the lookup expansion in the second rule, forcing
50159 the string expansion to fail if the lookup does not succeed. In this context it
50160 has the effect of leaving the original address unchanged, but Exim goes on to
50161 consider subsequent rewriting rules, if any, because the <quote>q</quote> flag is not
50162 present in that rule. An alternative to <quote>fail</quote> would be to supply <varname>$1</varname>
50163 explicitly, which would cause the rewritten address to be the same as before,
50164 at the cost of a small bit of processing. Not supplying either of these is an
50165 error, since the rewritten address would then contain no local part.
50166 </para>
50167 <para>
50168 The first example above replaces the domain with a superior, more general
50169 domain. This may not be desirable for certain local parts. If the rule
50170 </para>
50171 <literallayout class="monospaced">
50172 root@*.hitch.fict.example  *
50173 </literallayout>
50174 <para>
50175 were inserted before the first rule, rewriting would be suppressed for the
50176 local part <emphasis>root</emphasis> at any domain ending in <emphasis>hitch.fict.example</emphasis>.
50177 </para>
50178 <para>
50179 Rewriting can be made conditional on a number of tests, by making use of
50180 <varname>${if</varname> in the expansion item. For example, to apply a rewriting rule only to
50181 messages that originate outside the local host:
50182 </para>
50183 <literallayout class="monospaced">
50184 *@*.hitch.fict.example  "${if !eq {$sender_host_address}{}\
50185                          {$1@hitch.fict.example}fail}"
50186 </literallayout>
50187 <para>
50188 The replacement string is quoted in this example because it contains white
50189 space.
50190 </para>
50191 <para>
50192 <indexterm role="concept">
50193 <primary>rewriting</primary>
50194 <secondary>bang paths</secondary>
50195 </indexterm>
50196 <indexterm role="concept">
50197 <primary>bang paths</primary>
50198 <secondary>rewriting</secondary>
50199 </indexterm>
50200 Exim does not handle addresses in the form of <quote>bang paths</quote>. If it sees such
50201 an address it treats it as an unqualified local part which it qualifies with
50202 the local qualification domain (if the source of the message is local or if the
50203 remote host is permitted to send unqualified addresses). Rewriting can
50204 sometimes be used to handle simple bang paths with a fixed number of
50205 components. For example, the rule
50206 </para>
50207 <literallayout class="monospaced">
50208 \N^([^!]+)!(.*)@your.domain.example$\N   $2@$1
50209 </literallayout>
50210 <para>
50211 rewrites a two-component bang path <emphasis>host.name!user</emphasis> as the domain address
50212 <emphasis>user@host.name</emphasis>. However, there is a security implication in using this as
50213 a global rewriting rule for envelope addresses. It can provide a backdoor
50214 method for using your system as a relay, because the incoming addresses appear
50215 to be local. If the bang path addresses are received via SMTP, it is safer to
50216 use the <quote>S</quote> flag to rewrite them as they are received, so that relay checking
50217 can be done on the rewritten addresses.
50218 <indexterm role="concept" startref="IIDaddrew" class="endofrange"/>
50219 </para>
50220 </section>
50221 </chapter>
50222
50223 <chapter id="CHAPretry">
50224 <title>Retry configuration</title>
50225 <para>
50226 <indexterm role="concept" id="IIDretconf1" class="startofrange">
50227 <primary>retry</primary>
50228 <secondary>configuration, description of</secondary>
50229 </indexterm>
50230 <indexterm role="concept" id="IIDregconf2" class="startofrange">
50231 <primary>configuration file</primary>
50232 <secondary>retry section</secondary>
50233 </indexterm>
50234 The <quote>retry</quote> section of the runtime configuration file contains a list of
50235 retry rules that control how often Exim tries to deliver messages that cannot
50236 be delivered at the first attempt. If there are no retry rules (the section is
50237 empty or not present), there are no retries. In this situation, temporary
50238 errors are treated as permanent. The default configuration contains a single,
50239 general-purpose retry rule (see section <xref linkend="SECID57"/>). The <option>-brt</option> command
50240 line option can be used to test which retry rule will be used for a given
50241 address, domain and error.
50242 </para>
50243 <para>
50244 The most common cause of retries is temporary failure to deliver to a remote
50245 host because the host is down, or inaccessible because of a network problem.
50246 Exim&#x2019;s retry processing in this case is applied on a per-host (strictly, per IP
50247 address) basis, not on a per-message basis. Thus, if one message has recently
50248 been delayed, delivery of a new message to the same host is not immediately
50249 tried, but waits for the host&#x2019;s retry time to arrive. If the <option>retry_defer</option>
50250 log selector is set, the message
50251 <indexterm role="concept">
50252 <primary>retry</primary>
50253 <secondary>time not reached</secondary>
50254 </indexterm>
50255 <quote>retry time not reached</quote> is written to the main log whenever a delivery is
50256 skipped for this reason. Section <xref linkend="SECToutSMTPerr"/> contains more details of
50257 the handling of errors during remote deliveries.
50258 </para>
50259 <para>
50260 Retry processing applies to routing as well as to delivering, except as covered
50261 in the next paragraph. The retry rules do not distinguish between these
50262 actions. It is not possible, for example, to specify different behaviour for
50263 failures to route the domain <emphasis>snark.fict.example</emphasis> and failures to deliver to
50264 the host <emphasis>snark.fict.example</emphasis>. I didn&#x2019;t think anyone would ever need this
50265 added complication, so did not implement it. However, although they share the
50266 same retry rule, the actual retry times for routing and transporting a given
50267 domain are maintained independently.
50268 </para>
50269 <para>
50270 When a delivery is not part of a queue run (typically an immediate delivery on
50271 receipt of a message), the routers are always run, and local deliveries are
50272 always attempted, even if retry times are set for them. This makes for better
50273 behaviour if one particular message is causing problems (for example, causing
50274 quota overflow, or provoking an error in a filter file). If such a delivery
50275 suffers a temporary failure, the retry data is updated as normal, and
50276 subsequent delivery attempts from queue runs occur only when the retry time for
50277 the local address is reached.
50278 </para>
50279 <section id="SECID157">
50280 <title>Changing retry rules</title>
50281 <para>
50282 If you change the retry rules in your configuration, you should consider
50283 whether or not to delete the retry data that is stored in Exim&#x2019;s spool area in
50284 files with names like <filename>db/retry</filename>. Deleting any of Exim&#x2019;s hints files is
50285 always safe; that is why they are called <quote>hints</quote>.
50286 </para>
50287 <para>
50288 The hints retry data contains suggested retry times based on the previous
50289 rules. In the case of a long-running problem with a remote host, it might
50290 record the fact that the host has timed out. If your new rules increase the
50291 timeout time for such a host, you should definitely remove the old retry data
50292 and let Exim recreate it, based on the new rules. Otherwise Exim might bounce
50293 messages that it should now be retaining.
50294 </para>
50295 </section>
50296 <section id="SECID158">
50297 <title>Format of retry rules</title>
50298 <para>
50299 <indexterm role="concept">
50300 <primary>retry</primary>
50301 <secondary>rules</secondary>
50302 </indexterm>
50303 Each retry rule occupies one line and consists of three or four parts,
50304 separated by white space: a pattern, an error name, an optional list of sender
50305 addresses, and a list of retry parameters. The pattern and sender lists must be
50306 enclosed in double quotes if they contain white space. The rules are searched
50307 in order until one is found where the pattern, error name, and sender list (if
50308 present) match the failing host or address, the error that occurred, and the
50309 message&#x2019;s sender, respectively.
50310 </para>
50311 <para>
50312 The pattern is any single item that may appear in an address list (see section
50313 <xref linkend="SECTaddresslist"/>). It is in fact processed as a one-item address list,
50314 which means that it is expanded before being tested against the address that
50315 has been delayed. A negated address list item is permitted. Address
50316 list processing treats a plain domain name as if it were preceded by <quote>*@</quote>,
50317 which makes it possible for many retry rules to start with just a domain. For
50318 example,
50319 </para>
50320 <literallayout class="monospaced">
50321 lookingglass.fict.example        *  F,24h,30m;
50322 </literallayout>
50323 <para>
50324 provides a rule for any address in the <emphasis>lookingglass.fict.example</emphasis> domain,
50325 whereas
50326 </para>
50327 <literallayout class="monospaced">
50328 alice@lookingglass.fict.example  *  F,24h,30m;
50329 </literallayout>
50330 <para>
50331 applies only to temporary failures involving the local part <option>alice</option>.
50332 In practice, almost all rules start with a domain name pattern without a local
50333 part.
50334 </para>
50335 <para>
50336 <indexterm role="concept">
50337 <primary>regular expressions</primary>
50338 <secondary>in retry rules</secondary>
50339 </indexterm>
50340 <emphasis role="bold">Warning</emphasis>: If you use a regular expression in a retry rule pattern, it
50341 must match a complete address, not just a domain, because that is how regular
50342 expressions work in address lists.
50343 </para>
50344 <literallayout>
50345 <literal>^\Nxyz\d+\.abc\.example$\N        *  G,1h,10m,2</literal>     <option>Wrong</option>
50346 <literal>^\N[^@]+@xyz\d+\.abc\.example$\N  *  G,1h,10m,2</literal>     <option>Right</option>
50347 </literallayout>
50348 </section>
50349 <section id="SECID159">
50350 <title>Choosing which retry rule to use for address errors</title>
50351 <para>
50352 When Exim is looking for a retry rule after a routing attempt has failed (for
50353 example, after a DNS timeout), each line in the retry configuration is tested
50354 against the complete address only if <option>retry_use_local_part</option> is set for the
50355 router. Otherwise, only the domain is used, except when matching against a
50356 regular expression, when the local part of the address is replaced with <quote>*</quote>.
50357 A domain on its own can match a domain pattern, or a pattern that starts with
50358 <quote>*@</quote>. By default, <option>retry_use_local_part</option> is true for routers where
50359 <option>check_local_user</option> is true, and false for other routers.
50360 </para>
50361 <para>
50362 Similarly, when Exim is looking for a retry rule after a local delivery has
50363 failed (for example, after a mailbox full error), each line in the retry
50364 configuration is tested against the complete address only if
50365 <option>retry_use_local_part</option> is set for the transport (it defaults true for all
50366 local transports).
50367 </para>
50368 <para>
50369 <indexterm role="concept">
50370 <primary>4<emphasis>xx</emphasis> responses</primary>
50371 <secondary>retry rules for</secondary>
50372 </indexterm>
50373 However, when Exim is looking for a retry rule after a remote delivery attempt
50374 suffers an address error (a 4<emphasis>xx</emphasis> SMTP response for a recipient address), the
50375 whole address is always used as the key when searching the retry rules. The
50376 rule that is found is used to create a retry time for the combination of the
50377 failing address and the message&#x2019;s sender. It is the combination of sender and
50378 recipient that is delayed in subsequent queue runs until its retry time is
50379 reached. You can delay the recipient without regard to the sender by setting
50380 <option>address_retry_include_sender</option> false in the <command>smtp</command> transport but this can
50381 lead to problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT
50382 commands.
50383 </para>
50384 </section>
50385 <section id="SECID160">
50386 <title>Choosing which retry rule to use for host and message errors</title>
50387 <para>
50388 For a temporary error that is not related to an individual address (for
50389 example, a connection timeout), each line in the retry configuration is checked
50390 twice. First, the name of the remote host is used as a domain name (preceded by
50391 <quote>*@</quote> when matching a regular expression). If this does not match the line,
50392 the domain from the email address is tried in a similar fashion. For example,
50393 suppose the MX records for <emphasis>a.b.c.example</emphasis> are
50394 </para>
50395 <literallayout class="monospaced">
50396 a.b.c.example  MX  5  x.y.z.example
50397                MX  6  p.q.r.example
50398                MX  7  m.n.o.example
50399 </literallayout>
50400 <para>
50401 and the retry rules are
50402 </para>
50403 <literallayout class="monospaced">
50404 p.q.r.example    *      F,24h,30m;
50405 a.b.c.example    *      F,4d,45m;
50406 </literallayout>
50407 <para>
50408 and a delivery to the host <emphasis>x.y.z.example</emphasis> suffers a connection failure. The
50409 first rule matches neither the host nor the domain, so Exim looks at the second
50410 rule. This does not match the host, but it does match the domain, so it is used
50411 to calculate the retry time for the host <emphasis>x.y.z.example</emphasis>. Meanwhile, Exim
50412 tries to deliver to <emphasis>p.q.r.example</emphasis>. If this also suffers a host error, the
50413 first retry rule is used, because it matches the host.
50414 </para>
50415 <para>
50416 In other words, temporary failures to deliver to host <emphasis>p.q.r.example</emphasis> use the
50417 first rule to determine retry times, but for all the other hosts for the domain
50418 <emphasis>a.b.c.example</emphasis>, the second rule is used. The second rule is also used if
50419 routing to <emphasis>a.b.c.example</emphasis> suffers a temporary failure.
50420 </para>
50421 <para>
50422 <emphasis role="bold">Note</emphasis>: The host name is used when matching the patterns, not its IP address.
50423 However, if a message is routed directly to an IP address without the use of a
50424 host name, for example, if a <command>manualroute</command> router contains a setting such as:
50425 </para>
50426 <literallayout class="monospaced">
50427 route_list = *.a.example  192.168.34.23
50428 </literallayout>
50429 <para>
50430 then the <quote>host name</quote> that is used when searching for a retry rule is the
50431 textual form of the IP address.
50432 </para>
50433 </section>
50434 <section id="SECID161">
50435 <title>Retry rules for specific errors</title>
50436 <para>
50437 <indexterm role="concept">
50438 <primary>retry</primary>
50439 <secondary>specific errors; specifying</secondary>
50440 </indexterm>
50441 The second field in a retry rule is the name of a particular error, or an
50442 asterisk, which matches any error. The errors that can be tested for are:
50443 </para>
50444 <variablelist>
50445 <varlistentry>
50446 <term><option>auth_failed</option></term>
50447 <listitem>
50448 <para>
50449 Authentication failed when trying to send to a host in the
50450 <option>hosts_require_auth</option> list in an <command>smtp</command> transport.
50451 </para>
50452 </listitem></varlistentry>
50453 <varlistentry>
50454 <term><option>data_4xx</option></term>
50455 <listitem>
50456 <para>
50457 A 4<emphasis>xx</emphasis> error was received for an outgoing DATA command, either immediately
50458 after the command, or after sending the message&#x2019;s data.
50459 </para>
50460 </listitem></varlistentry>
50461 <varlistentry>
50462 <term><option>mail_4xx</option></term>
50463 <listitem>
50464 <para>
50465 A 4<emphasis>xx</emphasis> error was received for an outgoing MAIL command.
50466 </para>
50467 </listitem></varlistentry>
50468 <varlistentry>
50469 <term><option>rcpt_4xx</option></term>
50470 <listitem>
50471 <para>
50472 A 4<emphasis>xx</emphasis> error was received for an outgoing RCPT command.
50473 </para>
50474 </listitem></varlistentry>
50475 </variablelist>
50476 <para>
50477 For the three 4<emphasis>xx</emphasis> errors, either the first or both of the x&#x2019;s can be given
50478 as specific digits, for example: <literal>mail_45x</literal> or <literal>rcpt_436</literal>. For example, to
50479 recognize 452 errors given to RCPT commands for addresses in a certain domain,
50480 and have retries every ten minutes with a one-hour timeout, you could set up a
50481 retry rule of this form:
50482 </para>
50483 <literallayout class="monospaced">
50484 the.domain.name  rcpt_452   F,1h,10m
50485 </literallayout>
50486 <para>
50487 These errors apply to both outgoing SMTP (the <command>smtp</command> transport) and outgoing
50488 LMTP (either the <command>lmtp</command> transport, or the <command>smtp</command> transport in LMTP mode).
50489 </para>
50490 <variablelist>
50491 <varlistentry>
50492 <term><option>lost_connection</option></term>
50493 <listitem>
50494 <para>
50495 A server unexpectedly closed the SMTP connection. There may, of course,
50496 legitimate reasons for this (host died, network died), but if it repeats a lot
50497 for the same host, it indicates something odd.
50498 </para>
50499 </listitem></varlistentry>
50500 <varlistentry>
50501 <term><option>lookup</option></term>
50502 <listitem>
50503 <para>
50504 A DNS lookup for a host failed.
50505 Note that a <option>dnslookup</option> router will need to have matched
50506 its <option>fail_defer_domains</option> option for this retry type to be usable.
50507 Also note that a <option>manualroute</option> router will probably need
50508 its <option>host_find_failed</option> option set to <option>defer</option>.
50509 </para>
50510 </listitem></varlistentry>
50511 <varlistentry>
50512 <term><option>refused_MX</option></term>
50513 <listitem>
50514 <para>
50515 A connection to a host obtained from an MX record was refused.
50516 </para>
50517 </listitem></varlistentry>
50518 <varlistentry>
50519 <term><option>refused_A</option></term>
50520 <listitem>
50521 <para>
50522 A connection to a host not obtained from an MX record was refused.
50523 </para>
50524 </listitem></varlistentry>
50525 <varlistentry>
50526 <term><option>refused</option></term>
50527 <listitem>
50528 <para>
50529 A connection was refused.
50530 </para>
50531 </listitem></varlistentry>
50532 <varlistentry>
50533 <term><option>timeout_connect_MX</option></term>
50534 <listitem>
50535 <para>
50536 A connection attempt to a host obtained from an MX record timed out.
50537 </para>
50538 </listitem></varlistentry>
50539 <varlistentry>
50540 <term><option>timeout_connect_A</option></term>
50541 <listitem>
50542 <para>
50543 A connection attempt to a host not obtained from an MX record timed out.
50544 </para>
50545 </listitem></varlistentry>
50546 <varlistentry>
50547 <term><option>timeout_connect</option></term>
50548 <listitem>
50549 <para>
50550 A connection attempt timed out.
50551 </para>
50552 </listitem></varlistentry>
50553 <varlistentry>
50554 <term><option>timeout_MX</option></term>
50555 <listitem>
50556 <para>
50557 There was a timeout while connecting or during an SMTP session with a host
50558 obtained from an MX record.
50559 </para>
50560 </listitem></varlistentry>
50561 <varlistentry>
50562 <term><option>timeout_A</option></term>
50563 <listitem>
50564 <para>
50565 There was a timeout while connecting or during an SMTP session with a host not
50566 obtained from an MX record.
50567 </para>
50568 </listitem></varlistentry>
50569 <varlistentry>
50570 <term><option>timeout</option></term>
50571 <listitem>
50572 <para>
50573 There was a timeout while connecting or during an SMTP session.
50574 </para>
50575 </listitem></varlistentry>
50576 <varlistentry>
50577 <term><option>tls_required</option></term>
50578 <listitem>
50579 <para>
50580 The server was required to use TLS (it matched <option>hosts_require_tls</option> in the
50581 <command>smtp</command> transport), but either did not offer TLS, or it responded with 4<emphasis>xx</emphasis>
50582 to STARTTLS, or there was a problem setting up the TLS connection.
50583 </para>
50584 </listitem></varlistentry>
50585 <varlistentry>
50586 <term><option>quota</option></term>
50587 <listitem>
50588 <para>
50589 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
50590 transport.
50591 </para>
50592 </listitem></varlistentry>
50593 <varlistentry>
50594 <term><option>quota_</option>&lt;<emphasis>time</emphasis>&gt;</term>
50595 <listitem>
50596 <para>
50597 <indexterm role="concept">
50598 <primary>quota</primary>
50599 <secondary>error testing in retry rule</secondary>
50600 </indexterm>
50601 <indexterm role="concept">
50602 <primary>retry</primary>
50603 <secondary>quota error testing</secondary>
50604 </indexterm>
50605 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
50606 transport, and the mailbox has not been accessed for &lt;<emphasis>time</emphasis>&gt;. For example,
50607 <emphasis>quota_4d</emphasis> applies to a quota error when the mailbox has not been accessed
50608 for four days.
50609 </para>
50610 </listitem></varlistentry>
50611 </variablelist>
50612 <para>
50613 <indexterm role="concept">
50614 <primary>mailbox</primary>
50615 <secondary>time of last read</secondary>
50616 </indexterm>
50617 The idea of <option>quota_</option>&lt;<emphasis>time</emphasis>&gt; is to make it possible to have shorter
50618 timeouts when the mailbox is full and is not being read by its owner. Ideally,
50619 it should be based on the last time that the user accessed the mailbox.
50620 However, it is not always possible to determine this. Exim uses the following
50621 heuristic rules:
50622 </para>
50623 <itemizedlist>
50624 <listitem>
50625 <para>
50626 If the mailbox is a single file, the time of last access (the <quote>atime</quote>) is
50627 used. As no new messages are being delivered (because the mailbox is over
50628 quota), Exim does not access the file, so this is the time of last user access.
50629 </para>
50630 </listitem>
50631 <listitem>
50632 <para>
50633 <indexterm role="concept">
50634 <primary>maildir format</primary>
50635 <secondary>time of last read</secondary>
50636 </indexterm>
50637 For a maildir delivery, the time of last modification of the <filename>new</filename>
50638 subdirectory is used. As the mailbox is over quota, no new files are created in
50639 the <filename>new</filename> subdirectory, because no new messages are being delivered. Any
50640 change to the <filename>new</filename> subdirectory is therefore assumed to be the result of an
50641 MUA moving a new message to the <filename>cur</filename> directory when it is first read. The
50642 time that is used is therefore the last time that the user read a new message.
50643 </para>
50644 </listitem>
50645 <listitem>
50646 <para>
50647 For other kinds of multi-file mailbox, the time of last access cannot be
50648 obtained, so a retry rule that uses this type of error field is never matched.
50649 </para>
50650 </listitem>
50651 </itemizedlist>
50652 <para>
50653 The quota errors apply both to system-enforced quotas and to Exim&#x2019;s own quota
50654 mechanism in the <command>appendfile</command> transport. The <emphasis>quota</emphasis> error also applies
50655 when a local delivery is deferred because a partition is full (the ENOSPC
50656 error).
50657 </para>
50658 </section>
50659 <section id="SECID162">
50660 <title>Retry rules for specified senders</title>
50661 <para>
50662 <indexterm role="concept">
50663 <primary>retry</primary>
50664 <secondary>rules; sender-specific</secondary>
50665 </indexterm>
50666 You can specify retry rules that apply only when the failing message has a
50667 specific sender. In particular, this can be used to define retry rules that
50668 apply only to bounce messages. The third item in a retry rule can be of this
50669 form:
50670 </para>
50671 <literallayout>
50672 <literal>senders=</literal>&lt;<emphasis>address list</emphasis>&gt;
50673 </literallayout>
50674 <para>
50675 The retry timings themselves are then the fourth item. For example:
50676 </para>
50677 <literallayout class="monospaced">
50678 *   rcpt_4xx   senders=:   F,1h,30m
50679 </literallayout>
50680 <para>
50681 matches recipient 4<emphasis>xx</emphasis> errors for bounce messages sent to any address at any
50682 host. If the address list contains white space, it must be enclosed in quotes.
50683 For example:
50684 </para>
50685 <literallayout class="monospaced">
50686 a.domain  rcpt_452  senders="xb.dom : yc.dom"  G,8h,10m,1.5
50687 </literallayout>
50688 <para>
50689 <emphasis role="bold">Warning</emphasis>: This facility can be unhelpful if it is used for host errors
50690 (which do not depend on the recipient). The reason is that the sender is used
50691 only to match the retry rule. Once the rule has been found for a host error,
50692 its contents are used to set a retry time for the host, and this will apply to
50693 all messages, not just those with specific senders.
50694 </para>
50695 <para>
50696 When testing retry rules using <option>-brt</option>, you can supply a sender using the
50697 <option>-f</option> command line option, like this:
50698 </para>
50699 <literallayout class="monospaced">
50700 exim -f "" -brt user@dom.ain
50701 </literallayout>
50702 <para>
50703 If you do not set <option>-f</option> with <option>-brt</option>, a retry rule that contains a senders
50704 list is never matched.
50705 </para>
50706 </section>
50707 <section id="SECID163">
50708 <title>Retry parameters</title>
50709 <para>
50710 <indexterm role="concept">
50711 <primary>retry</primary>
50712 <secondary>parameters in rules</secondary>
50713 </indexterm>
50714 The third (or fourth, if a senders list is present) field in a retry rule is a
50715 sequence of retry parameter sets, separated by semicolons. Each set consists of
50716 </para>
50717 <literallayout>
50718 &lt;<emphasis>letter</emphasis>&gt;,&lt;<emphasis>cutoff time</emphasis>&gt;,&lt;<emphasis>arguments</emphasis>&gt;
50719 </literallayout>
50720 <para>
50721 The letter identifies the algorithm for computing a new retry time; the cutoff
50722 time is the time beyond which this algorithm no longer applies, and the
50723 arguments vary the algorithm&#x2019;s action. The cutoff time is measured from the
50724 time that the first failure for the domain (combined with the local part if
50725 relevant) was detected, not from the time the message was received.
50726 </para>
50727 <para>
50728 <indexterm role="concept">
50729 <primary>retry</primary>
50730 <secondary>algorithms</secondary>
50731 </indexterm>
50732 <indexterm role="concept">
50733 <primary>retry</primary>
50734 <secondary>fixed intervals</secondary>
50735 </indexterm>
50736 <indexterm role="concept">
50737 <primary>retry</primary>
50738 <secondary>increasing intervals</secondary>
50739 </indexterm>
50740 <indexterm role="concept">
50741 <primary>retry</primary>
50742 <secondary>random intervals</secondary>
50743 </indexterm>
50744 The available algorithms are:
50745 </para>
50746 <itemizedlist>
50747 <listitem>
50748 <para>
50749 <emphasis>F</emphasis>: retry at fixed intervals. There is a single time parameter specifying
50750 the interval.
50751 </para>
50752 </listitem>
50753 <listitem>
50754 <para>
50755 <emphasis>G</emphasis>: retry at geometrically increasing intervals. The first argument
50756 specifies a starting value for the interval, and the second a multiplier, which
50757 is used to increase the size of the interval at each retry.
50758 </para>
50759 </listitem>
50760 <listitem>
50761 <para>
50762 <emphasis>H</emphasis>: retry at randomized intervals. The arguments are as for <emphasis>G</emphasis>. For each
50763 retry, the previous interval is multiplied by the factor in order to get a
50764 maximum for the next interval. The minimum interval is the first argument of
50765 the parameter, and an actual interval is chosen randomly between them. Such a
50766 rule has been found to be helpful in cluster configurations when all the
50767 members of the cluster restart at once, and may therefore synchronize their
50768 queue processing times.
50769 </para>
50770 </listitem>
50771 </itemizedlist>
50772 <para>
50773 When computing the next retry time, the algorithm definitions are scanned in
50774 order until one whose cutoff time has not yet passed is reached. This is then
50775 used to compute a new retry time that is later than the current time. In the
50776 case of fixed interval retries, this simply means adding the interval to the
50777 current time. For geometrically increasing intervals, retry intervals are
50778 computed from the rule&#x2019;s parameters until one that is greater than the previous
50779 interval is found. The main configuration variable
50780 <indexterm role="concept">
50781 <primary>limit</primary>
50782 <secondary>retry interval</secondary>
50783 </indexterm>
50784 <indexterm role="concept">
50785 <primary>retry</primary>
50786 <secondary>interval, maximum</secondary>
50787 </indexterm>
50788 <indexterm role="option">
50789 <primary><option>retry_interval_max</option></primary>
50790 </indexterm>
50791 <option>retry_interval_max</option> limits the maximum interval between retries. It
50792 cannot be set greater than <literal>24h</literal>, which is its default value.
50793 </para>
50794 <para>
50795 A single remote domain may have a number of hosts associated with it, and each
50796 host may have more than one IP address. Retry algorithms are selected on the
50797 basis of the domain name, but are applied to each IP address independently. If,
50798 for example, a host has two IP addresses and one is unusable, Exim will
50799 generate retry times for it and will not try to use it until its next retry
50800 time comes. Thus the good IP address is likely to be tried first most of the
50801 time.
50802 </para>
50803 <para>
50804 <indexterm role="concept">
50805 <primary>hints database</primary>
50806 <secondary>use for retrying</secondary>
50807 </indexterm>
50808 Retry times are hints rather than promises. Exim does not make any attempt to
50809 run deliveries exactly at the computed times. Instead, a queue runner process
50810 starts delivery processes for delayed messages periodically, and these attempt
50811 new deliveries only for those addresses that have passed their next retry time.
50812 If a new message arrives for a deferred address, an immediate delivery attempt
50813 occurs only if the address has passed its retry time. In the absence of new
50814 messages, the minimum time between retries is the interval between queue runner
50815 processes. There is not much point in setting retry times of five minutes if
50816 your queue runners happen only once an hour, unless there are a significant
50817 number of incoming messages (which might be the case on a system that is
50818 sending everything to a smart host, for example).
50819 </para>
50820 <para>
50821 The data in the retry hints database can be inspected by using the
50822 <emphasis>exim_dumpdb</emphasis> or <emphasis>exim_fixdb</emphasis> utility programs (see chapter
50823 <xref linkend="CHAPutils"/>). The latter utility can also be used to change the data. The
50824 <emphasis>exinext</emphasis> utility script can be used to find out what the next retry times
50825 are for the hosts associated with a particular mail domain, and also for local
50826 deliveries that have been deferred.
50827 </para>
50828 </section>
50829 <section id="SECID164">
50830 <title>Retry rule examples</title>
50831 <para>
50832 Here are some example retry rules:
50833 </para>
50834 <literallayout class="monospaced">
50835 alice@wonderland.fict.example quota_5d  F,7d,3h
50836 wonderland.fict.example       quota_5d
50837 wonderland.fict.example       *         F,1h,15m; G,2d,1h,2;
50838 lookingglass.fict.example     *         F,24h,30m;
50839 *                 refused_A   F,2h,20m;
50840 *                 *           F,2h,15m; G,16h,1h,1.5; F,5d,8h
50841 </literallayout>
50842 <para>
50843 The first rule sets up special handling for mail to
50844 <emphasis>alice@wonderland.fict.example</emphasis> when there is an over-quota error and the
50845 mailbox has not been read for at least 5 days. Retries continue every three
50846 hours for 7 days. The second rule handles over-quota errors for all other local
50847 parts at <emphasis>wonderland.fict.example</emphasis>; the absence of a local part has the same
50848 effect as supplying <quote>*@</quote>. As no retry algorithms are supplied, messages that
50849 fail are bounced immediately if the mailbox has not been read for at least 5
50850 days.
50851 </para>
50852 <para>
50853 The third rule handles all other errors at <emphasis>wonderland.fict.example</emphasis>; retries
50854 happen every 15 minutes for an hour, then with geometrically increasing
50855 intervals until two days have passed since a delivery first failed. After the
50856 first hour there is a delay of one hour, then two hours, then four hours, and
50857 so on (this is a rather extreme example).
50858 </para>
50859 <para>
50860 The fourth rule controls retries for the domain <emphasis>lookingglass.fict.example</emphasis>.
50861 They happen every 30 minutes for 24 hours only. The remaining two rules handle
50862 all other domains, with special action for connection refusal from hosts that
50863 were not obtained from an MX record.
50864 </para>
50865 <para>
50866 The final rule in a retry configuration should always have asterisks in the
50867 first two fields so as to provide a general catch-all for any addresses that do
50868 not have their own special handling. This example tries every 15 minutes for 2
50869 hours, then with intervals starting at one hour and increasing by a factor of
50870 1.5 up to 16 hours, then every 8 hours up to 5 days.
50871 </para>
50872 </section>
50873 <section id="SECID165">
50874 <title>Timeout of retry data</title>
50875 <para>
50876 <indexterm role="concept">
50877 <primary>timeout</primary>
50878 <secondary>of retry data</secondary>
50879 </indexterm>
50880 <indexterm role="option">
50881 <primary><option>retry_data_expire</option></primary>
50882 </indexterm>
50883 <indexterm role="concept">
50884 <primary>hints database</primary>
50885 <secondary>data expiry</secondary>
50886 </indexterm>
50887 <indexterm role="concept">
50888 <primary>retry</primary>
50889 <secondary>timeout of data</secondary>
50890 </indexterm>
50891 Exim timestamps the data that it writes to its retry hints database. When it
50892 consults the data during a delivery it ignores any that is older than the value
50893 set in <option>retry_data_expire</option> (default 7 days). If, for example, a host hasn&#x2019;t
50894 been tried for 7 days, Exim will try to deliver to it immediately a message
50895 arrives, and if that fails, it will calculate a retry time as if it were
50896 failing for the first time.
50897 </para>
50898 <para>
50899 This improves the behaviour for messages routed to rarely-used hosts such as MX
50900 backups. If such a host was down at one time, and happens to be down again when
50901 Exim tries a month later, using the old retry data would imply that it had been
50902 down all the time, which is not a justified assumption.
50903 </para>
50904 <para>
50905 If a host really is permanently dead, this behaviour causes a burst of retries
50906 every now and again, but only if messages routed to it are rare. If there is a
50907 message at least once every 7 days the retry data never expires.
50908 </para>
50909 </section>
50910 <section id="SECID166">
50911 <title>Long-term failures</title>
50912 <para>
50913 <indexterm role="concept">
50914 <primary>delivery failure, long-term</primary>
50915 </indexterm>
50916 <indexterm role="concept">
50917 <primary>retry</primary>
50918 <secondary>after long-term failure</secondary>
50919 </indexterm>
50920 Special processing happens when an email address has been failing for so long
50921 that the cutoff time for the last algorithm is reached. For example, using the
50922 default retry rule:
50923 </para>
50924 <literallayout class="monospaced">
50925 * * F,2h,15m; G,16h,1h,1.5; F,4d,6h
50926 </literallayout>
50927 <para>
50928 the cutoff time is four days. Reaching the retry cutoff is independent of how
50929 long any specific message has been failing; it is the length of continuous
50930 failure for the recipient address that counts.
50931 </para>
50932 <para>
50933 When the cutoff time is reached for a local delivery, or for all the IP
50934 addresses associated with a remote delivery, a subsequent delivery failure
50935 causes Exim to give up on the address, and a bounce message is generated.
50936 In order to cater for new messages that use the failing address, a next retry
50937 time is still computed from the final algorithm, and is used as follows:
50938 </para>
50939 <para>
50940 For local deliveries, one delivery attempt is always made for any subsequent
50941 messages. If this delivery fails, the address fails immediately. The
50942 post-cutoff retry time is not used.
50943 </para>
50944 <para>
50945 <indexterm role="concept">
50946 <primary>final cutoff</primary>
50947 <secondary>retries, controlling</secondary>
50948 </indexterm>
50949 <indexterm role="concept">
50950 <primary>retry</primary>
50951 <secondary>final cutoff</secondary>
50952 </indexterm>
50953 If the delivery is remote, there are two possibilities, controlled by the
50954 <indexterm role="option">
50955 <primary><option>delay_after_cutoff</option></primary>
50956 </indexterm>
50957 <option>delay_after_cutoff</option> option of the <command>smtp</command> transport. The option is true by
50958 default. Until the post-cutoff retry time for one of the IP addresses,
50959 as set by the <option>retry_data_expire</option> option, is
50960 reached, the failing email address is bounced immediately, without a delivery
50961 attempt taking place. After that time, one new delivery attempt is made to
50962 those IP addresses that are past their retry times, and if that still fails,
50963 the address is bounced and new retry times are computed.
50964 </para>
50965 <para>
50966 In other words, when all the hosts for a given email address have been failing
50967 for a long time, Exim bounces rather then defers until one of the hosts&#x2019; retry
50968 times is reached. Then it tries once, and bounces if that attempt fails. This
50969 behaviour ensures that few resources are wasted in repeatedly trying to deliver
50970 to a broken destination, but if the host does recover, Exim will eventually
50971 notice.
50972 </para>
50973 <para>
50974 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
50975 addresses are past their final cutoff time, Exim tries to deliver to those IP
50976 addresses that have not been tried since the message arrived. If there are
50977 no suitable IP addresses, or if they all fail, the address is bounced. In other
50978 words, it does not delay when a new message arrives, but tries the expired
50979 addresses immediately, unless they have been tried since the message arrived.
50980 If there is a continuous stream of messages for the failing domains, setting
50981 <option>delay_after_cutoff</option> false means that there will be many more attempts to
50982 deliver to permanently failing IP addresses than when <option>delay_after_cutoff</option> is
50983 true.
50984 </para>
50985 </section>
50986 <section id="SECID167">
50987 <title>Deliveries that work intermittently</title>
50988 <para>
50989 <indexterm role="concept">
50990 <primary>retry</primary>
50991 <secondary>intermittently working deliveries</secondary>
50992 </indexterm>
50993 Some additional logic is needed to cope with cases where a host is
50994 intermittently available, or when a message has some attribute that prevents
50995 its delivery when others to the same address get through. In this situation,
50996 because some messages are successfully delivered, the <quote>retry clock</quote> for the
50997 host or address keeps getting reset by the successful deliveries, and so
50998 failing messages remain in the queue for ever because the cutoff time is never
50999 reached.
51000 </para>
51001 <para>
51002 Two exceptional actions are applied to prevent this happening. The first
51003 applies to errors that are related to a message rather than a remote host.
51004 Section <xref linkend="SECToutSMTPerr"/> has a discussion of the different kinds of error;
51005 examples of message-related errors are 4<emphasis>xx</emphasis> responses to MAIL or DATA
51006 commands, and quota failures. For this type of error, if a message&#x2019;s arrival
51007 time is earlier than the <quote>first failed</quote> time for the error, the earlier time
51008 is used when scanning the retry rules to decide when to try next and when to
51009 time out the address.
51010 </para>
51011 <para>
51012 The exceptional second action applies in all cases. If a message has been on
51013 the queue for longer than the cutoff time of any applicable retry rule for a
51014 given address, a delivery is attempted for that address, even if it is not yet
51015 time, and if this delivery fails, the address is timed out. A new retry time is
51016 not computed in this case, so that other messages for the same address are
51017 considered immediately.
51018 <indexterm role="concept" startref="IIDretconf1" class="endofrange"/>
51019 <indexterm role="concept" startref="IIDregconf2" class="endofrange"/>
51020 </para>
51021 </section>
51022 </chapter>
51023
51024 <chapter id="CHAPSMTPAUTH">
51025 <title>SMTP authentication</title>
51026 <para>
51027 <indexterm role="concept" id="IIDauthconf1" class="startofrange">
51028 <primary>SMTP</primary>
51029 <secondary>authentication configuration</secondary>
51030 </indexterm>
51031 <indexterm role="concept" id="IIDauthconf2" class="startofrange">
51032 <primary>authentication</primary>
51033 </indexterm>
51034 The <quote>authenticators</quote> section of Exim&#x2019;s runtime configuration is concerned
51035 with SMTP authentication. This facility is an extension to the SMTP protocol,
51036 described in RFC 2554, which allows a client SMTP host to authenticate itself
51037 to a server. This is a common way for a server to recognize clients that are
51038 permitted to use it as a relay. SMTP authentication is not of relevance to the
51039 transfer of mail between servers that have no managerial connection with each
51040 other.
51041 </para>
51042 <para>
51043 <indexterm role="concept">
51044 <primary>AUTH</primary>
51045 <secondary>description of</secondary>
51046 </indexterm>
51047 Very briefly, the way SMTP authentication works is as follows:
51048 </para>
51049 <itemizedlist>
51050 <listitem>
51051 <para>
51052 The server advertises a number of authentication <emphasis>mechanisms</emphasis> in response to
51053 the client&#x2019;s EHLO command.
51054 </para>
51055 </listitem>
51056 <listitem>
51057 <para>
51058 The client issues an AUTH command, naming a specific mechanism. The command
51059 may, optionally, contain some authentication data.
51060 </para>
51061 </listitem>
51062 <listitem>
51063 <para>
51064 The server may issue one or more <emphasis>challenges</emphasis>, to which the client must send
51065 appropriate responses. In simple authentication mechanisms, the challenges are
51066 just prompts for user names and passwords. The server does not have to issue
51067 any challenges &ndash; in some mechanisms the relevant data may all be transmitted
51068 with the AUTH command.
51069 </para>
51070 </listitem>
51071 <listitem>
51072 <para>
51073 The server either accepts or denies authentication.
51074 </para>
51075 </listitem>
51076 <listitem>
51077 <para>
51078 If authentication succeeds, the client may optionally make use of the AUTH
51079 option on the MAIL command to pass an authenticated sender in subsequent
51080 mail transactions. Authentication lasts for the remainder of the SMTP
51081 connection.
51082 </para>
51083 </listitem>
51084 <listitem>
51085 <para>
51086 If authentication fails, the client may give up, or it may try a different
51087 authentication mechanism, or it may try transferring mail over the
51088 unauthenticated connection.
51089 </para>
51090 </listitem>
51091 </itemizedlist>
51092 <para>
51093 If you are setting up a client, and want to know which authentication
51094 mechanisms the server supports, you can use Telnet to connect to port 25 (the
51095 SMTP port) on the server, and issue an EHLO command. The response to this
51096 includes the list of supported mechanisms. For example:
51097 </para>
51098 <literallayout>
51099 <literal>$ </literal><emphasis role="bold"><literal>telnet server.example 25</literal></emphasis>
51100 <literal>Trying 192.168.34.25...</literal>
51101 <literal>Connected to server.example.</literal>
51102 <literal>Escape character is &#x0027;^]&#x0027;.</literal>
51103 <literal>220 server.example ESMTP Exim 4.20 ...</literal>
51104 <emphasis role="bold"><literal>ehlo client.example</literal></emphasis>
51105 <literal>250-server.example Hello client.example [10.8.4.5]</literal>
51106 <literal>250-SIZE 52428800</literal>
51107 <literal>250-PIPELINING</literal>
51108 <literal>250-AUTH PLAIN</literal>
51109 <literal>250 HELP</literal>
51110 </literallayout>
51111 <para>
51112 The second-last line of this example output shows that the server supports
51113 authentication using the PLAIN mechanism. In Exim, the different authentication
51114 mechanisms are configured by specifying <emphasis>authenticator</emphasis> drivers. Like the
51115 routers and transports, which authenticators are included in the binary is
51116 controlled by build-time definitions. The following are currently available,
51117 included by setting
51118 </para>
51119 <literallayout class="monospaced">
51120 AUTH_CRAM_MD5=yes
51121 AUTH_CYRUS_SASL=yes
51122 AUTH_DOVECOT=yes
51123 AUTH_GSASL=yes
51124 AUTH_HEIMDAL_GSSAPI=yes
51125 AUTH_PLAINTEXT=yes
51126 AUTH_SPA=yes
51127 AUTH_TLS=yes
51128 </literallayout>
51129 <para>
51130 in <filename>Local/Makefile</filename>, respectively. The first of these supports the CRAM-MD5
51131 authentication mechanism (RFC 2195), and the second provides an interface to
51132 the Cyrus SASL authentication library.
51133 The third is an interface to Dovecot&#x2019;s authentication system, delegating the
51134 work via a socket interface.
51135 The fourth provides an interface to the GNU SASL authentication library, which
51136 provides mechanisms but typically not data sources.
51137 The fifth provides direct access to Heimdal GSSAPI, geared for Kerberos, but
51138 supporting setting a server keytab.
51139 The sixth can be configured to support
51140 the PLAIN authentication mechanism (RFC 2595) or the LOGIN mechanism, which is
51141 not formally documented, but used by several MUAs. The seventh authenticator
51142 supports Microsoft&#x2019;s <emphasis>Secure Password Authentication</emphasis> mechanism.
51143 The eighth is an Exim authenticator but not an SMTP one;
51144 instead it can use information from a TLS negotiation.
51145 </para>
51146 <para>
51147 The authenticators are configured using the same syntax as other drivers (see
51148 section <xref linkend="SECTfordricon"/>). If no authenticators are required, no
51149 authentication section need be present in the configuration file. Each
51150 authenticator can in principle have both server and client functions. When Exim
51151 is receiving SMTP mail, it is acting as a server; when it is sending out
51152 messages over SMTP, it is acting as a client. Authenticator configuration
51153 options are provided for use in both these circumstances.
51154 </para>
51155 <para>
51156 To make it clear which options apply to which situation, the prefixes
51157 <option>server_</option> and <option>client_</option> are used on option names that are specific to
51158 either the server or the client function, respectively. Server and client
51159 functions are disabled if none of their options are set. If an authenticator is
51160 to be used for both server and client functions, a single definition, using
51161 both sets of options, is required. For example:
51162 </para>
51163 <literallayout class="monospaced">
51164 cram:
51165   driver = cram_md5
51166   public_name = CRAM-MD5
51167   server_secret = ${if eq{$auth1}{ph10}{secret1}fail}
51168   client_name = ph10
51169   client_secret = secret2
51170 </literallayout>
51171 <para>
51172 The <option>server_</option> option is used when Exim is acting as a server, and the
51173 <option>client_</option> options when it is acting as a client.
51174 </para>
51175 <para>
51176 Descriptions of the individual authenticators are given in subsequent chapters.
51177 The remainder of this chapter covers the generic options for the
51178 authenticators, followed by general discussion of the way authentication works
51179 in Exim.
51180 </para>
51181 <para>
51182 <emphasis role="bold">Beware:</emphasis> the meaning of <varname>$auth1</varname>, <varname>$auth2</varname>, ... varies on a per-driver and
51183 per-mechanism basis.  Please read carefully to determine which variables hold
51184 account labels such as usercodes and which hold passwords or other
51185 authenticating data.
51186 </para>
51187 <para>
51188 Note that some mechanisms support two different identifiers for accounts: the
51189 <emphasis>authentication id</emphasis> and the <emphasis>authorization id</emphasis>.  The contractions <emphasis>authn</emphasis>
51190 and <emphasis>authz</emphasis> are commonly encountered.  The American spelling is standard here.
51191 Conceptually, authentication data such as passwords are tied to the identifier
51192 used to authenticate; servers may have rules to permit one user to act as a
51193 second user, so that after login the session is treated as though that second
51194 user had logged in.  That second user is the <emphasis>authorization id</emphasis>.  A robust
51195 configuration might confirm that the <emphasis>authz</emphasis> field is empty or matches the
51196 <emphasis>authn</emphasis> field.  Often this is just ignored.  The <emphasis>authn</emphasis> can be considered
51197 as verified data, the <emphasis>authz</emphasis> as an unverified request which the server might
51198 choose to honour.
51199 </para>
51200 <para>
51201 A <emphasis>realm</emphasis> is a text string, typically a domain name, presented by a server
51202 to a client to help it select an account and credentials to use.  In some
51203 mechanisms, the client and server provably agree on the realm, but clients
51204 typically can not treat the realm as secure data to be blindly trusted.
51205 </para>
51206 <section id="SECID168">
51207 <title>Generic options for authenticators</title>
51208 <para>
51209 <indexterm role="concept">
51210 <primary>authentication</primary>
51211 <secondary>generic options</secondary>
51212 </indexterm>
51213 <indexterm role="concept">
51214 <primary>options</primary>
51215 <secondary>generic; for authenticators</secondary>
51216 </indexterm>
51217 </para>
51218 <para>
51219 <indexterm role="option">
51220 <primary><option>client_condition</option></primary>
51221 </indexterm>
51222 </para>
51223 <informaltable frame="all">
51224 <tgroup cols="4" colsep="0" rowsep="0">
51225 <colspec colwidth="8*" align="left"/>
51226 <colspec colwidth="6*" align="center"/>
51227 <colspec colwidth="6*" align="center"/>
51228 <colspec colwidth="6*" align="right"/>
51229 <tbody>
51230 <row>
51231 <entry><option>client_condition</option></entry>
51232 <entry>Use: <emphasis>authenticators</emphasis></entry>
51233 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51234 <entry>Default: <emphasis>unset</emphasis></entry>
51235 </row>
51236 </tbody>
51237 </tgroup>
51238 </informaltable>
51239 <para>
51240 When Exim is authenticating as a client, it skips any authenticator whose
51241 <option>client_condition</option> expansion yields <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>. This can be
51242 used, for example, to skip plain text authenticators when the connection is not
51243 encrypted by a setting such as:
51244 </para>
51245 <literallayout class="monospaced">
51246 client_condition = ${if !eq{$tls_out_cipher}{}}
51247 </literallayout>
51248 <para>
51249 <indexterm role="option">
51250 <primary><option>client_set_id</option></primary>
51251 </indexterm>
51252 </para>
51253 <informaltable frame="all">
51254 <tgroup cols="4" colsep="0" rowsep="0">
51255 <colspec colwidth="8*" align="left"/>
51256 <colspec colwidth="6*" align="center"/>
51257 <colspec colwidth="6*" align="center"/>
51258 <colspec colwidth="6*" align="right"/>
51259 <tbody>
51260 <row>
51261 <entry><option>client_set_id</option></entry>
51262 <entry>Use: <emphasis>authenticators</emphasis></entry>
51263 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51264 <entry>Default: <emphasis>unset</emphasis></entry>
51265 </row>
51266 </tbody>
51267 </tgroup>
51268 </informaltable>
51269 <para>
51270 When client authentication succeeds, this condition is expanded; the
51271 result is used in the log lines for outbound messages.
51272 Typically it will be the user name used for authentication.
51273 </para>
51274 <para>
51275 <indexterm role="option">
51276 <primary><option>driver</option></primary>
51277 </indexterm>
51278 </para>
51279 <informaltable frame="all">
51280 <tgroup cols="4" colsep="0" rowsep="0">
51281 <colspec colwidth="8*" align="left"/>
51282 <colspec colwidth="6*" align="center"/>
51283 <colspec colwidth="6*" align="center"/>
51284 <colspec colwidth="6*" align="right"/>
51285 <tbody>
51286 <row>
51287 <entry><option>driver</option></entry>
51288 <entry>Use: <emphasis>authenticators</emphasis></entry>
51289 <entry>Type: <emphasis>string</emphasis></entry>
51290 <entry>Default: <emphasis>unset</emphasis></entry>
51291 </row>
51292 </tbody>
51293 </tgroup>
51294 </informaltable>
51295 <para>
51296 This option must always be set. It specifies which of the available
51297 authenticators is to be used.
51298 </para>
51299 <para>
51300 <indexterm role="option">
51301 <primary><option>public_name</option></primary>
51302 </indexterm>
51303 </para>
51304 <informaltable frame="all">
51305 <tgroup cols="4" colsep="0" rowsep="0">
51306 <colspec colwidth="8*" align="left"/>
51307 <colspec colwidth="6*" align="center"/>
51308 <colspec colwidth="6*" align="center"/>
51309 <colspec colwidth="6*" align="right"/>
51310 <tbody>
51311 <row>
51312 <entry><option>public_name</option></entry>
51313 <entry>Use: <emphasis>authenticators</emphasis></entry>
51314 <entry>Type: <emphasis>string</emphasis></entry>
51315 <entry>Default: <emphasis>unset</emphasis></entry>
51316 </row>
51317 </tbody>
51318 </tgroup>
51319 </informaltable>
51320 <para>
51321 This option specifies the name of the authentication mechanism that the driver
51322 implements, and by which it is known to the outside world. These names should
51323 contain only upper case letters, digits, underscores, and hyphens (RFC 2222),
51324 but Exim in fact matches them caselessly. If <option>public_name</option> is not set, it
51325 defaults to the driver&#x2019;s instance name.
51326 </para>
51327 <para>
51328 <indexterm role="option">
51329 <primary><option>server_advertise_condition</option></primary>
51330 </indexterm>
51331 </para>
51332 <informaltable frame="all">
51333 <tgroup cols="4" colsep="0" rowsep="0">
51334 <colspec colwidth="8*" align="left"/>
51335 <colspec colwidth="6*" align="center"/>
51336 <colspec colwidth="6*" align="center"/>
51337 <colspec colwidth="6*" align="right"/>
51338 <tbody>
51339 <row>
51340 <entry><option>server_advertise_condition</option></entry>
51341 <entry>Use: <emphasis>authenticators</emphasis></entry>
51342 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51343 <entry>Default: <emphasis>unset</emphasis></entry>
51344 </row>
51345 </tbody>
51346 </tgroup>
51347 </informaltable>
51348 <para>
51349 When a server is about to advertise an authentication mechanism, the condition
51350 is expanded. If it yields the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the
51351 mechanism is not advertised.
51352 If the expansion fails, the mechanism is not advertised. If the failure was not
51353 forced, and was not caused by a lookup defer, the incident is logged.
51354 See section <xref linkend="SECTauthexiser"/> below for further discussion.
51355 </para>
51356 <para>
51357 <indexterm role="option">
51358 <primary><option>server_condition</option></primary>
51359 </indexterm>
51360 </para>
51361 <informaltable frame="all">
51362 <tgroup cols="4" colsep="0" rowsep="0">
51363 <colspec colwidth="8*" align="left"/>
51364 <colspec colwidth="6*" align="center"/>
51365 <colspec colwidth="6*" align="center"/>
51366 <colspec colwidth="6*" align="right"/>
51367 <tbody>
51368 <row>
51369 <entry><option>server_condition</option></entry>
51370 <entry>Use: <emphasis>authenticators</emphasis></entry>
51371 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51372 <entry>Default: <emphasis>unset</emphasis></entry>
51373 </row>
51374 </tbody>
51375 </tgroup>
51376 </informaltable>
51377 <para>
51378 This option must be set for a <option>plaintext</option> server authenticator, where it
51379 is used directly to control authentication. See section <xref linkend="SECTplainserver"/>
51380 for details.
51381 </para>
51382 <para>
51383 For the <command>gsasl</command> authenticator, this option is required for various
51384 mechanisms; see chapter <xref linkend="CHAPgsasl"/> for details.
51385 </para>
51386 <para>
51387 For the other authenticators, <option>server_condition</option> can be used as an additional
51388 authentication or authorization mechanism that is applied after the other
51389 authenticator conditions succeed. If it is set, it is expanded when the
51390 authenticator would otherwise return a success code. If the expansion is forced
51391 to fail, authentication fails. Any other expansion failure causes a temporary
51392 error code to be returned. If the result of a successful expansion is an empty
51393 string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
51394 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds. For any
51395 other result, a temporary error code is returned, with the expanded string as
51396 the error text.
51397 </para>
51398 <para>
51399 <indexterm role="option">
51400 <primary><option>server_debug_print</option></primary>
51401 </indexterm>
51402 </para>
51403 <informaltable frame="all">
51404 <tgroup cols="4" colsep="0" rowsep="0">
51405 <colspec colwidth="8*" align="left"/>
51406 <colspec colwidth="6*" align="center"/>
51407 <colspec colwidth="6*" align="center"/>
51408 <colspec colwidth="6*" align="right"/>
51409 <tbody>
51410 <row>
51411 <entry><option>server_debug_print</option></entry>
51412 <entry>Use: <emphasis>authenticators</emphasis></entry>
51413 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51414 <entry>Default: <emphasis>unset</emphasis></entry>
51415 </row>
51416 </tbody>
51417 </tgroup>
51418 </informaltable>
51419 <para>
51420 If this option is set and authentication debugging is enabled (see the <option>-d</option>
51421 command line option), the string is expanded and included in the debugging
51422 output when the authenticator is run as a server. This can help with checking
51423 out the values of variables.
51424 If expansion of the string fails, the error message is written to the debugging
51425 output, and Exim carries on processing.
51426 </para>
51427 <para>
51428 <indexterm role="option">
51429 <primary><option>server_set_id</option></primary>
51430 </indexterm>
51431 </para>
51432 <informaltable frame="all">
51433 <tgroup cols="4" colsep="0" rowsep="0">
51434 <colspec colwidth="8*" align="left"/>
51435 <colspec colwidth="6*" align="center"/>
51436 <colspec colwidth="6*" align="center"/>
51437 <colspec colwidth="6*" align="right"/>
51438 <tbody>
51439 <row>
51440 <entry><option>server_set_id</option></entry>
51441 <entry>Use: <emphasis>authenticators</emphasis></entry>
51442 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51443 <entry>Default: <emphasis>unset</emphasis></entry>
51444 </row>
51445 </tbody>
51446 </tgroup>
51447 </informaltable>
51448 <para>
51449 <indexterm role="variable">
51450 <primary><varname>$authenticated_id</varname></primary>
51451 </indexterm>
51452 <indexterm role="variable">
51453 <primary><varname>$authenticated_fail_id</varname></primary>
51454 </indexterm>
51455 When an Exim server successfully authenticates a client, this string is
51456 expanded using data from the authentication, and preserved for any incoming
51457 messages in the variable <varname>$authenticated_id</varname>. It is also included in the log
51458 lines for incoming messages. For example, a user/password authenticator
51459 configuration might preserve the user name that was used to authenticate, and
51460 refer to it subsequently during delivery of the message.
51461 On a failing authentication the expansion result is instead saved in
51462 the <varname>$authenticated_fail_id</varname> variable.
51463 If expansion fails, the option is ignored.
51464 </para>
51465 <para>
51466 <indexterm role="option">
51467 <primary><option>server_mail_auth_condition</option></primary>
51468 </indexterm>
51469 </para>
51470 <informaltable frame="all">
51471 <tgroup cols="4" colsep="0" rowsep="0">
51472 <colspec colwidth="8*" align="left"/>
51473 <colspec colwidth="6*" align="center"/>
51474 <colspec colwidth="6*" align="center"/>
51475 <colspec colwidth="6*" align="right"/>
51476 <tbody>
51477 <row>
51478 <entry><option>server_mail_auth_condition</option></entry>
51479 <entry>Use: <emphasis>authenticators</emphasis></entry>
51480 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51481 <entry>Default: <emphasis>unset</emphasis></entry>
51482 </row>
51483 </tbody>
51484 </tgroup>
51485 </informaltable>
51486 <para>
51487 This option allows a server to discard authenticated sender addresses supplied
51488 as part of MAIL commands in SMTP connections that are authenticated by the
51489 driver on which <option>server_mail_auth_condition</option> is set. The option is not used
51490 as part of the authentication process; instead its (unexpanded) value is
51491 remembered for later use.
51492 How it is used is described in the following section.
51493 </para>
51494 </section>
51495 <section id="SECTauthparamail">
51496 <title>The AUTH parameter on MAIL commands</title>
51497 <para>
51498 <indexterm role="concept">
51499 <primary>authentication</primary>
51500 <secondary>sender; authenticated</secondary>
51501 </indexterm>
51502 <indexterm role="concept">
51503 <primary>AUTH</primary>
51504 <secondary>on MAIL command</secondary>
51505 </indexterm>
51506 When a client supplied an AUTH= item on a MAIL command, Exim applies
51507 the following checks before accepting it as the authenticated sender of the
51508 message:
51509 </para>
51510 <itemizedlist>
51511 <listitem>
51512 <para>
51513 If the connection is not using extended SMTP (that is, HELO was used rather
51514 than EHLO), the use of AUTH= is a syntax error.
51515 </para>
51516 </listitem>
51517 <listitem>
51518 <para>
51519 If the value of the AUTH= parameter is <quote>&lt;&gt;</quote>, it is ignored.
51520 </para>
51521 </listitem>
51522 <listitem>
51523 <para>
51524 <indexterm role="variable">
51525 <primary><varname>$authenticated_sender</varname></primary>
51526 </indexterm>
51527 If <option>acl_smtp_mailauth</option> is defined, the ACL it specifies is run. While it is
51528 running, the value of <varname>$authenticated_sender</varname> is set to the value obtained
51529 from the AUTH= parameter. If the ACL does not yield <quote>accept</quote>, the value of
51530 <varname>$authenticated_sender</varname> is deleted. The <option>acl_smtp_mailauth</option> ACL may not
51531 return <quote>drop</quote> or <quote>discard</quote>. If it defers, a temporary error code (451) is
51532 given for the MAIL command.
51533 </para>
51534 </listitem>
51535 <listitem>
51536 <para>
51537 If <option>acl_smtp_mailauth</option> is not defined, the value of the AUTH= parameter
51538 is accepted and placed in <varname>$authenticated_sender</varname> only if the client has
51539 authenticated.
51540 </para>
51541 </listitem>
51542 <listitem>
51543 <para>
51544 If the AUTH= value was accepted by either of the two previous rules, and
51545 the client has authenticated, and the authenticator has a setting for the
51546 <option>server_mail_auth_condition</option>, the condition is checked at this point. The
51547 valued that was saved from the authenticator is expanded. If the expansion
51548 fails, or yields an empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the value of
51549 <varname>$authenticated_sender</varname> is deleted. If the expansion yields any other value,
51550 the value of <varname>$authenticated_sender</varname> is retained and passed on with the
51551 message.
51552 </para>
51553 </listitem>
51554 </itemizedlist>
51555 <para>
51556 When <varname>$authenticated_sender</varname> is set for a message, it is passed on to other
51557 hosts to which Exim authenticates as a client. Do not confuse this value with
51558 <varname>$authenticated_id</varname>, which is a string obtained from the authentication
51559 process, and which is not usually a complete email address.
51560 </para>
51561 <para>
51562 <indexterm role="variable">
51563 <primary><varname>$sender_address</varname></primary>
51564 </indexterm>
51565 Whenever an AUTH= value is ignored, the incident is logged. The ACL for
51566 MAIL, if defined, is run after AUTH= is accepted or ignored. It can
51567 therefore make use of <varname>$authenticated_sender</varname>. The converse is not true: the
51568 value of <varname>$sender_address</varname> is not yet set up when the <option>acl_smtp_mailauth</option>
51569 ACL is run.
51570 </para>
51571 </section>
51572 <section id="SECTauthexiser">
51573 <title>Authentication on an Exim server</title>
51574 <para>
51575 <indexterm role="concept">
51576 <primary>authentication</primary>
51577 <secondary>on an Exim server</secondary>
51578 </indexterm>
51579 When Exim receives an EHLO command, it advertises the public names of those
51580 authenticators that are configured as servers, subject to the following
51581 conditions:
51582 </para>
51583 <itemizedlist>
51584 <listitem>
51585 <para>
51586 The client host must match <option>auth_advertise_hosts</option> (default *).
51587 </para>
51588 </listitem>
51589 <listitem>
51590 <para>
51591 It the <option>server_advertise_condition</option> option is set, its expansion must not
51592 yield the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>.
51593 </para>
51594 </listitem>
51595 </itemizedlist>
51596 <para>
51597 The order in which the authenticators are defined controls the order in which
51598 the mechanisms are advertised.
51599 </para>
51600 <para>
51601 Some mail clients (for example, some versions of Netscape) require the user to
51602 provide a name and password for authentication whenever AUTH is advertised,
51603 even though authentication may not in fact be needed (for example, Exim may be
51604 set up to allow unconditional relaying from the client by an IP address check).
51605 You can make such clients more friendly by not advertising AUTH to them.
51606 For example, if clients on the 10.9.8.0/24 network are permitted (by the ACL
51607 that runs for RCPT) to relay without authentication, you should set
51608 </para>
51609 <literallayout class="monospaced">
51610 auth_advertise_hosts = ! 10.9.8.0/24
51611 </literallayout>
51612 <para>
51613 so that no authentication mechanisms are advertised to them.
51614 </para>
51615 <para>
51616 The <option>server_advertise_condition</option> controls the advertisement of individual
51617 authentication mechanisms. For example, it can be used to restrict the
51618 advertisement of a particular mechanism to encrypted connections, by a setting
51619 such as:
51620 </para>
51621 <literallayout class="monospaced">
51622 server_advertise_condition = ${if eq{$tls_in_cipher}{}{no}{yes}}
51623 </literallayout>
51624 <para>
51625 <indexterm role="variable">
51626 <primary><varname>$tls_in_cipher</varname></primary>
51627 </indexterm>
51628 If the session is encrypted, <varname>$tls_in_cipher</varname> is not empty, and so the expansion
51629 yields <quote>yes</quote>, which allows the advertisement to happen.
51630 </para>
51631 <para>
51632 When an Exim server receives an AUTH command from a client, it rejects it
51633 immediately if AUTH was not advertised in response to an earlier EHLO
51634 command. This is the case if
51635 </para>
51636 <itemizedlist>
51637 <listitem>
51638 <para>
51639 The client host does not match <option>auth_advertise_hosts</option>; or
51640 </para>
51641 </listitem>
51642 <listitem>
51643 <para>
51644 No authenticators are configured with server options; or
51645 </para>
51646 </listitem>
51647 <listitem>
51648 <para>
51649 Expansion of <option>server_advertise_condition</option> blocked the advertising of all the
51650 server authenticators.
51651 </para>
51652 </listitem>
51653 </itemizedlist>
51654 <para>
51655 Otherwise, Exim runs the ACL specified by <option>acl_smtp_auth</option> in order
51656 to decide whether to accept the command. If <option>acl_smtp_auth</option> is not set,
51657 AUTH is accepted from any client host.
51658 </para>
51659 <para>
51660 If AUTH is not rejected by the ACL, Exim searches its configuration for a
51661 server authentication mechanism that was advertised in response to EHLO and
51662 that matches the one named in the AUTH command. If it finds one, it runs
51663 the appropriate authentication protocol, and authentication either succeeds or
51664 fails. If there is no matching advertised mechanism, the AUTH command is
51665 rejected with a 504 error.
51666 </para>
51667 <para>
51668 <indexterm role="variable">
51669 <primary><varname>$received_protocol</varname></primary>
51670 </indexterm>
51671 <indexterm role="variable">
51672 <primary><varname>$sender_host_authenticated</varname></primary>
51673 </indexterm>
51674 When a message is received from an authenticated host, the value of
51675 <varname>$received_protocol</varname> is set to <quote>esmtpa</quote> or <quote>esmtpsa</quote> instead of <quote>esmtp</quote>
51676 or <quote>esmtps</quote>, and <varname>$sender_host_authenticated</varname> contains the name (not the
51677 public name) of the authenticator driver that successfully authenticated the
51678 client from which the message was received. This variable is empty if there was
51679 no successful authentication.
51680 </para>
51681 <para>
51682 <indexterm role="concept">
51683 <primary>authentication</primary>
51684 <secondary>expansion item</secondary>
51685 </indexterm>
51686 Successful authentication sets up information used by the
51687 <varname>$authresults</varname> expansion item.
51688 </para>
51689 </section>
51690 <section id="SECID169">
51691 <title>Testing server authentication</title>
51692 <para>
51693 <indexterm role="concept">
51694 <primary>authentication</primary>
51695 <secondary>testing a server</secondary>
51696 </indexterm>
51697 <indexterm role="concept">
51698 <primary>AUTH</primary>
51699 <secondary>testing a server</secondary>
51700 </indexterm>
51701 <indexterm role="concept">
51702 <primary>base64 encoding</primary>
51703 <secondary>creating authentication test data</secondary>
51704 </indexterm>
51705 Exim&#x2019;s <option>-bh</option> option can be useful for testing server authentication
51706 configurations. The data for the AUTH command has to be sent using base64
51707 encoding. A quick way to produce such data for testing is the following Perl
51708 script:
51709 </para>
51710 <literallayout class="monospaced">
51711 use MIME::Base64;
51712 printf ("%s", encode_base64(eval "\"$ARGV[0]\""));
51713 </literallayout>
51714 <para>
51715 <indexterm role="concept">
51716 <primary>binary zero</primary>
51717 <secondary>in authentication data</secondary>
51718 </indexterm>
51719 This interprets its argument as a Perl string, and then encodes it. The
51720 interpretation as a Perl string allows binary zeros, which are required for
51721 some kinds of authentication, to be included in the data. For example, a
51722 command line to run this script on such data might be
51723 </para>
51724 <literallayout class="monospaced">
51725 encode '\0user\0password'
51726 </literallayout>
51727 <para>
51728 Note the use of single quotes to prevent the shell interpreting the
51729 backslashes, so that they can be interpreted by Perl to specify characters
51730 whose code value is zero.
51731 </para>
51732 <para>
51733 <emphasis role="bold">Warning 1</emphasis>: If either of the user or password strings starts with an octal
51734 digit, you must use three zeros instead of one after the leading backslash. If
51735 you do not, the octal digit that starts your string will be incorrectly
51736 interpreted as part of the code for the first character.
51737 </para>
51738 <para>
51739 <emphasis role="bold">Warning 2</emphasis>: If there are characters in the strings that Perl interprets
51740 specially, you must use a Perl escape to prevent them being misinterpreted. For
51741 example, a command such as
51742 </para>
51743 <literallayout class="monospaced">
51744 encode '\0user@domain.com\0pas$$word'
51745 </literallayout>
51746 <para>
51747 gives an incorrect answer because of the unescaped <quote>@</quote> and <quote>$</quote> characters.
51748 </para>
51749 <para>
51750 If you have the <option>mimencode</option> command installed, another way to do produce
51751 base64-encoded strings is to run the command
51752 </para>
51753 <literallayout class="monospaced">
51754 echo -e -n `\0user\0password' | mimencode
51755 </literallayout>
51756 <para>
51757 The <option>-e</option> option of <option>echo</option> enables the interpretation of backslash escapes
51758 in the argument, and the <option>-n</option> option specifies no newline at the end of its
51759 output. However, not all versions of <option>echo</option> recognize these options, so you
51760 should check your version before relying on this suggestion.
51761 </para>
51762 </section>
51763 <section id="SECID170">
51764 <title>Authentication by an Exim client</title>
51765 <para>
51766 <indexterm role="concept">
51767 <primary>authentication</primary>
51768 <secondary>on an Exim client</secondary>
51769 </indexterm>
51770 The <command>smtp</command> transport has two options called <option>hosts_require_auth</option> and
51771 <option>hosts_try_auth</option>. When the <command>smtp</command> transport connects to a server that
51772 announces support for authentication, and the host matches an entry in either
51773 of these options, Exim (as a client) tries to authenticate as follows:
51774 </para>
51775 <itemizedlist>
51776 <listitem>
51777 <para>
51778 For each authenticator that is configured as a client, in the order in which
51779 they are defined in the configuration, it searches the authentication
51780 mechanisms announced by the server for one whose name matches the public name
51781 of the authenticator.
51782 </para>
51783 </listitem>
51784 <listitem>
51785 <para>
51786 <indexterm role="variable">
51787 <primary><varname>$host</varname></primary>
51788 </indexterm>
51789 <indexterm role="variable">
51790 <primary><varname>$host_address</varname></primary>
51791 </indexterm>
51792 When it finds one that matches, it runs the authenticator&#x2019;s client code. The
51793 variables <varname>$host</varname> and <varname>$host_address</varname> are available for any string expansions
51794 that the client might do. They are set to the server&#x2019;s name and IP address. If
51795 any expansion is forced to fail, the authentication attempt is abandoned, and
51796 Exim moves on to the next authenticator. Otherwise an expansion failure causes
51797 delivery to be deferred.
51798 </para>
51799 </listitem>
51800 <listitem>
51801 <para>
51802 If the result of the authentication attempt is a temporary error or a timeout,
51803 Exim abandons trying to send the message to the host for the moment. It will
51804 try again later. If there are any backup hosts available, they are tried in the
51805 usual way.
51806 </para>
51807 </listitem>
51808 <listitem>
51809 <para>
51810 If the response to authentication is a permanent error (5<emphasis>xx</emphasis> code), Exim
51811 carries on searching the list of authenticators and tries another one if
51812 possible. If all authentication attempts give permanent errors, or if there are
51813 no attempts because no mechanisms match (or option expansions force failure),
51814 what happens depends on whether the host matches <option>hosts_require_auth</option> or
51815 <option>hosts_try_auth</option>. In the first case, a temporary error is generated, and
51816 delivery is deferred. The error can be detected in the retry rules, and thereby
51817 turned into a permanent error if you wish. In the second case, Exim tries to
51818 deliver the message unauthenticated.
51819 </para>
51820 </listitem>
51821 </itemizedlist>
51822 <para>
51823 Note that the hostlist test for whether to do authentication can be
51824 confused if name-IP lookups change between the time the peer is decided
51825 upon and the time that the transport runs.  For example, with a manualroute
51826 router given a host name, and with DNS "round-robin" used by that name: if
51827 the local resolver cache times out between the router and the transport
51828 running, the transport may get an IP for the name for its authentication
51829 check which does not match the connection peer IP.
51830 No authentication will then be done, despite the names being identical.
51831 </para>
51832 <para>
51833 For such cases use a separate transport which always authenticates.
51834 </para>
51835 <para>
51836 <indexterm role="concept">
51837 <primary>AUTH</primary>
51838 <secondary>on MAIL command</secondary>
51839 </indexterm>
51840 When Exim has authenticated itself to a remote server, it adds the AUTH
51841 parameter to the MAIL commands it sends, if it has an authenticated sender for
51842 the message. If the message came from a remote host, the authenticated sender
51843 is the one that was receiving on an incoming MAIL command, provided that the
51844 incoming connection was authenticated and the <option>server_mail_auth</option> condition
51845 allowed the authenticated sender to be retained. If a local process calls Exim
51846 to send a message, the sender address that is built from the login name and
51847 <option>qualify_domain</option> is treated as authenticated. However, if the
51848 <option>authenticated_sender</option> option is set on the <command>smtp</command> transport, it overrides
51849 the authenticated sender that was received with the message.
51850 <indexterm role="concept" startref="IIDauthconf1" class="endofrange"/>
51851 <indexterm role="concept" startref="IIDauthconf2" class="endofrange"/>
51852 </para>
51853 </section>
51854 </chapter>
51855
51856 <chapter id="CHAPplaintext">
51857 <title>The plaintext authenticator</title>
51858 <para>
51859 <indexterm role="concept" id="IIDplaiauth1" class="startofrange">
51860 <primary><command>plaintext</command> authenticator</primary>
51861 </indexterm>
51862 <indexterm role="concept" id="IIDplaiauth2" class="startofrange">
51863 <primary>authenticators</primary>
51864 <secondary><command>plaintext</command></secondary>
51865 </indexterm>
51866 The <command>plaintext</command> authenticator can be configured to support the PLAIN and
51867 LOGIN authentication mechanisms, both of which transfer authentication data as
51868 plain (unencrypted) text (though base64 encoded). The use of plain text is a
51869 security risk; you are strongly advised to insist on the use of SMTP encryption
51870 (see chapter <xref linkend="CHAPTLS"/>) if you use the PLAIN or LOGIN mechanisms. If you do
51871 use unencrypted plain text, you should not use the same passwords for SMTP
51872 connections as you do for login accounts.
51873 </para>
51874 <section id="SECID171">
51875 <title>Plaintext options</title>
51876 <para>
51877 <indexterm role="concept">
51878 <primary>options</primary>
51879 <secondary><command>plaintext</command> authenticator (server)</secondary>
51880 </indexterm>
51881 When configured as a server, <command>plaintext</command> uses the following options:
51882 </para>
51883 <para>
51884 <indexterm role="option">
51885 <primary><option>server_condition</option></primary>
51886 </indexterm>
51887 </para>
51888 <informaltable frame="all">
51889 <tgroup cols="4" colsep="0" rowsep="0">
51890 <colspec colwidth="8*" align="left"/>
51891 <colspec colwidth="6*" align="center"/>
51892 <colspec colwidth="6*" align="center"/>
51893 <colspec colwidth="6*" align="right"/>
51894 <tbody>
51895 <row>
51896 <entry><option>server_condition</option></entry>
51897 <entry>Use: <emphasis>authenticators</emphasis></entry>
51898 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51899 <entry>Default: <emphasis>unset</emphasis></entry>
51900 </row>
51901 </tbody>
51902 </tgroup>
51903 </informaltable>
51904 <para>
51905 This is actually a global authentication option, but it must be set in order to
51906 configure the <command>plaintext</command> driver as a server. Its use is described below.
51907 </para>
51908 <para>
51909 <indexterm role="option">
51910 <primary><option>server_prompts</option></primary>
51911 </indexterm>
51912 </para>
51913 <informaltable frame="all">
51914 <tgroup cols="4" colsep="0" rowsep="0">
51915 <colspec colwidth="8*" align="left"/>
51916 <colspec colwidth="6*" align="center"/>
51917 <colspec colwidth="6*" align="center"/>
51918 <colspec colwidth="6*" align="right"/>
51919 <tbody>
51920 <row>
51921 <entry><option>server_prompts</option></entry>
51922 <entry>Use: <emphasis>plaintext</emphasis></entry>
51923 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51924 <entry>Default: <emphasis>unset</emphasis></entry>
51925 </row>
51926 </tbody>
51927 </tgroup>
51928 </informaltable>
51929 <para>
51930 The contents of this option, after expansion, must be a colon-separated list of
51931 prompt strings. If expansion fails, a temporary authentication rejection is
51932 given.
51933 </para>
51934 </section>
51935 <section id="SECTplainserver">
51936 <title>Using plaintext in a server</title>
51937 <para>
51938 <indexterm role="concept">
51939 <primary>AUTH</primary>
51940 <secondary>in <command>plaintext</command> authenticator</secondary>
51941 </indexterm>
51942 <indexterm role="concept">
51943 <primary>binary zero</primary>
51944 <secondary>in <command>plaintext</command> authenticator</secondary>
51945 </indexterm>
51946 <indexterm role="concept">
51947 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
51948 <secondary>in <command>plaintext</command> authenticator</secondary>
51949 </indexterm>
51950 <indexterm role="variable">
51951 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
51952 </indexterm>
51953 <indexterm role="concept">
51954 <primary>base64 encoding</primary>
51955 <secondary>in <command>plaintext</command> authenticator</secondary>
51956 </indexterm>
51957 </para>
51958 <para>
51959 When running as a server, <command>plaintext</command> performs the authentication test by
51960 expanding a string. The data sent by the client with the AUTH command, or in
51961 response to subsequent prompts, is base64 encoded, and so may contain any byte
51962 values when decoded. If any data is supplied with the command, it is treated as
51963 a list of strings, separated by NULs (binary zeros), the first three of which
51964 are placed in the expansion variables <varname>$auth1</varname>, <varname>$auth2</varname>, and <varname>$auth3</varname>
51965 (neither LOGIN nor PLAIN uses more than three strings).
51966 </para>
51967 <para>
51968 For compatibility with previous releases of Exim, the values are also placed in
51969 the expansion variables <varname>$1</varname>, <varname>$2</varname>, and <varname>$3</varname>. However, the use of these
51970 variables for this purpose is now deprecated, as it can lead to confusion in
51971 string expansions that also use them for other things.
51972 </para>
51973 <para>
51974 If there are more strings in <option>server_prompts</option> than the number of strings
51975 supplied with the AUTH command, the remaining prompts are used to obtain more
51976 data. Each response from the client may be a list of NUL-separated strings.
51977 </para>
51978 <para>
51979 <indexterm role="variable">
51980 <primary><varname>$authenticated_id</varname></primary>
51981 </indexterm>
51982 Once a sufficient number of data strings have been received,
51983 <option>server_condition</option> is expanded. If the expansion is forced to fail,
51984 authentication fails. Any other expansion failure causes a temporary error code
51985 to be returned. If the result of a successful expansion is an empty string,
51986 <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
51987 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds and the
51988 generic <option>server_set_id</option> option is expanded and saved in <varname>$authenticated_id</varname>.
51989 For any other result, a temporary error code is returned, with the expanded
51990 string as the error text.
51991 </para>
51992 <para>
51993 <emphasis role="bold">Warning</emphasis>: If you use a lookup in the expansion to find the user&#x2019;s
51994 password, be sure to make the authentication fail if the user is unknown.
51995 There are good and bad examples at the end of the next section.
51996 </para>
51997 </section>
51998 <section id="SECID172">
51999 <title>The PLAIN authentication mechanism</title>
52000 <para>
52001 <indexterm role="concept">
52002 <primary>PLAIN authentication mechanism</primary>
52003 </indexterm>
52004 <indexterm role="concept">
52005 <primary>authentication</primary>
52006 <secondary>PLAIN mechanism</secondary>
52007 </indexterm>
52008 <indexterm role="concept">
52009 <primary>binary zero</primary>
52010 <secondary>in <command>plaintext</command> authenticator</secondary>
52011 </indexterm>
52012 The PLAIN authentication mechanism (RFC 2595) specifies that three strings be
52013 sent as one item of data (that is, one combined string containing two NUL
52014 separators). The data is sent either as part of the AUTH command, or
52015 subsequently in response to an empty prompt from the server.
52016 </para>
52017 <para>
52018 The second and third strings are a user name and a corresponding password.
52019 Using a single fixed user name and password as an example, this could be
52020 configured as follows:
52021 </para>
52022 <literallayout class="monospaced">
52023 fixed_plain:
52024   driver = plaintext
52025   public_name = PLAIN
52026   server_prompts = :
52027   server_condition = \
52028     ${if and {{eq{$auth2}{username}}{eq{$auth3}{mysecret}}}}
52029   server_set_id = $auth2
52030 </literallayout>
52031 <para>
52032 Note that the default result strings from <option>if</option> (<quote>true</quote> or an empty string)
52033 are exactly what we want here, so they need not be specified. Obviously, if the
52034 password contains expansion-significant characters such as dollar, backslash,
52035 or closing brace, they have to be escaped.
52036 </para>
52037 <para>
52038 The <option>server_prompts</option> setting specifies a single, empty prompt (empty items at
52039 the end of a string list are ignored). If all the data comes as part of the
52040 AUTH command, as is commonly the case, the prompt is not used. This
52041 authenticator is advertised in the response to EHLO as
52042 </para>
52043 <literallayout class="monospaced">
52044 250-AUTH PLAIN
52045 </literallayout>
52046 <para>
52047 and a client host can authenticate itself by sending the command
52048 </para>
52049 <literallayout class="monospaced">
52050 AUTH PLAIN AHVzZXJuYW1lAG15c2VjcmV0
52051 </literallayout>
52052 <para>
52053 As this contains three strings (more than the number of prompts), no further
52054 data is required from the client. Alternatively, the client may just send
52055 </para>
52056 <literallayout class="monospaced">
52057 AUTH PLAIN
52058 </literallayout>
52059 <para>
52060 to initiate authentication, in which case the server replies with an empty
52061 prompt. The client must respond with the combined data string.
52062 </para>
52063 <para>
52064 The data string is base64 encoded, as required by the RFC. This example,
52065 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;
52066 represents a zero byte. This is split up into three strings, the first of which
52067 is empty. The <option>server_condition</option> option in the authenticator checks that the
52068 second two are <literal>username</literal> and <literal>mysecret</literal> respectively.
52069 </para>
52070 <para>
52071 Having just one fixed user name and password, as in this example, is not very
52072 realistic, though for a small organization with only a handful of
52073 authenticating clients it could make sense.
52074 </para>
52075 <para>
52076 A more sophisticated instance of this authenticator could use the user name in
52077 <varname>$auth2</varname> to look up a password in a file or database, and maybe do an encrypted
52078 comparison (see <option>crypteq</option> in chapter <xref linkend="CHAPexpand"/>). Here is a example of
52079 this approach, where the passwords are looked up in a DBM file. <emphasis role="bold">Warning</emphasis>:
52080 This is an incorrect example:
52081 </para>
52082 <literallayout class="monospaced">
52083 server_condition = \
52084   ${if eq{$auth3}{${lookup{$auth2}dbm{/etc/authpwd}}}}
52085 </literallayout>
52086 <para>
52087 The expansion uses the user name (<varname>$auth2</varname>) as the key to look up a password,
52088 which it then compares to the supplied password (<varname>$auth3</varname>). Why is this example
52089 incorrect? It works fine for existing users, but consider what happens if a
52090 non-existent user name is given. The lookup fails, but as no success/failure
52091 strings are given for the lookup, it yields an empty string. Thus, to defeat
52092 the authentication, all a client has to do is to supply a non-existent user
52093 name and an empty password. The correct way of writing this test is:
52094 </para>
52095 <literallayout class="monospaced">
52096 server_condition = ${lookup{$auth2}dbm{/etc/authpwd}\
52097   {${if eq{$value}{$auth3}}} {false}}
52098 </literallayout>
52099 <para>
52100 In this case, if the lookup succeeds, the result is checked; if the lookup
52101 fails, <quote>false</quote> is returned and authentication fails. If <option>crypteq</option> is being
52102 used instead of <option>eq</option>, the first example is in fact safe, because <option>crypteq</option>
52103 always fails if its second argument is empty. However, the second way of
52104 writing the test makes the logic clearer.
52105 </para>
52106 </section>
52107 <section id="SECID173">
52108 <title>The LOGIN authentication mechanism</title>
52109 <para>
52110 <indexterm role="concept">
52111 <primary>LOGIN authentication mechanism</primary>
52112 </indexterm>
52113 <indexterm role="concept">
52114 <primary>authentication</primary>
52115 <secondary>LOGIN mechanism</secondary>
52116 </indexterm>
52117 The LOGIN authentication mechanism is not documented in any RFC, but is in use
52118 in a number of programs. No data is sent with the AUTH command. Instead, a
52119 user name and password are supplied separately, in response to prompts. The
52120 plaintext authenticator can be configured to support this as in this example:
52121 </para>
52122 <literallayout class="monospaced">
52123 fixed_login:
52124   driver = plaintext
52125   public_name = LOGIN
52126   server_prompts = User Name : Password
52127   server_condition = \
52128     ${if and {{eq{$auth1}{username}}{eq{$auth2}{mysecret}}}}
52129   server_set_id = $auth1
52130 </literallayout>
52131 <para>
52132 Because of the way plaintext operates, this authenticator accepts data supplied
52133 with the AUTH command (in contravention of the specification of LOGIN), but
52134 if the client does not supply it (as is the case for LOGIN clients), the prompt
52135 strings are used to obtain two data items.
52136 </para>
52137 <para>
52138 Some clients are very particular about the precise text of the prompts. For
52139 example, Outlook Express is reported to recognize only <quote>Username:</quote> and
52140 <quote>Password:</quote>. Here is an example of a LOGIN authenticator that uses those
52141 strings. It uses the <option>ldapauth</option> expansion condition to check the user
52142 name and password by binding to an LDAP server:
52143 </para>
52144 <literallayout class="monospaced">
52145 login:
52146   driver = plaintext
52147   public_name = LOGIN
52148   server_prompts = Username:: : Password::
52149   server_condition = ${if and{{ \
52150     !eq{}{$auth1} }{ \
52151     ldapauth{\
52152       user="uid=${quote_ldap_dn:$auth1},ou=people,o=example.org" \
52153       pass=${quote:$auth2} \
52154       ldap://ldap.example.org/} }} }
52155   server_set_id = uid=$auth1,ou=people,o=example.org
52156 </literallayout>
52157 <para>
52158 We have to check that the username is not empty before using it, because LDAP
52159 does not permit empty DN components. We must also use the <option>quote_ldap_dn</option>
52160 operator to correctly quote the DN for authentication. However, the basic
52161 <option>quote</option> operator, rather than any of the LDAP quoting operators, is the
52162 correct one to use for the password, because quoting is needed only to make
52163 the password conform to the Exim syntax. At the LDAP level, the password is an
52164 uninterpreted string.
52165 </para>
52166 </section>
52167 <section id="SECID174">
52168 <title>Support for different kinds of authentication</title>
52169 <para>
52170 A number of string expansion features are provided for the purpose of
52171 interfacing to different ways of user authentication. These include checking
52172 traditionally encrypted passwords from <filename>/etc/passwd</filename> (or equivalent), PAM,
52173 Radius, <option>ldapauth</option>, <emphasis>pwcheck</emphasis>, and <emphasis>saslauthd</emphasis>. For details see section
52174 <xref linkend="SECTexpcond"/>.
52175 </para>
52176 </section>
52177 <section id="SECID175">
52178 <title>Using plaintext in a client</title>
52179 <para>
52180 <indexterm role="concept">
52181 <primary>options</primary>
52182 <secondary><command>plaintext</command> authenticator (client)</secondary>
52183 </indexterm>
52184 The <command>plaintext</command> authenticator has two client options:
52185 </para>
52186 <para>
52187 <indexterm role="option">
52188 <primary><option>client_ignore_invalid_base64</option></primary>
52189 </indexterm>
52190 </para>
52191 <informaltable frame="all">
52192 <tgroup cols="4" colsep="0" rowsep="0">
52193 <colspec colwidth="8*" align="left"/>
52194 <colspec colwidth="6*" align="center"/>
52195 <colspec colwidth="6*" align="center"/>
52196 <colspec colwidth="6*" align="right"/>
52197 <tbody>
52198 <row>
52199 <entry><option>client_ignore_invalid_base64</option></entry>
52200 <entry>Use: <emphasis>plaintext</emphasis></entry>
52201 <entry>Type: <emphasis>boolean</emphasis></entry>
52202 <entry>Default: <emphasis>false</emphasis></entry>
52203 </row>
52204 </tbody>
52205 </tgroup>
52206 </informaltable>
52207 <para>
52208 If the client receives a server prompt that is not a valid base64 string,
52209 authentication is abandoned by default. However, if this option is set true,
52210 the error in the challenge is ignored and the client sends the response as
52211 usual.
52212 </para>
52213 <para>
52214 <indexterm role="option">
52215 <primary><option>client_send</option></primary>
52216 </indexterm>
52217 </para>
52218 <informaltable frame="all">
52219 <tgroup cols="4" colsep="0" rowsep="0">
52220 <colspec colwidth="8*" align="left"/>
52221 <colspec colwidth="6*" align="center"/>
52222 <colspec colwidth="6*" align="center"/>
52223 <colspec colwidth="6*" align="right"/>
52224 <tbody>
52225 <row>
52226 <entry><option>client_send</option></entry>
52227 <entry>Use: <emphasis>plaintext</emphasis></entry>
52228 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52229 <entry>Default: <emphasis>unset</emphasis></entry>
52230 </row>
52231 </tbody>
52232 </tgroup>
52233 </informaltable>
52234 <para>
52235 The string is a colon-separated list of authentication data strings. Each
52236 string is independently expanded before being sent to the server. The first
52237 string is sent with the AUTH command; any more strings are sent in response
52238 to prompts from the server. Before each string is expanded, the value of the
52239 most recent prompt is placed in the next <varname>$auth</varname>&lt;<emphasis>n</emphasis>&gt; variable, starting
52240 with <varname>$auth1</varname> for the first prompt. Up to three prompts are stored in this
52241 way. Thus, the prompt that is received in response to sending the first string
52242 (with the AUTH command) can be used in the expansion of the second string, and
52243 so on. If an invalid base64 string is received when
52244 <option>client_ignore_invalid_base64</option> is set, an empty string is put in the
52245 <varname>$auth</varname>&lt;<emphasis>n</emphasis>&gt; variable.
52246 </para>
52247 <para>
52248 <emphasis role="bold">Note</emphasis>: You cannot use expansion to create multiple strings, because
52249 splitting takes priority and happens first.
52250 </para>
52251 <para>
52252 Because the PLAIN authentication mechanism requires NUL (binary zero) bytes in
52253 the data, further processing is applied to each string before it is sent. If
52254 there are any single circumflex characters in the string, they are converted to
52255 NULs. Should an actual circumflex be required as data, it must be doubled in
52256 the string.
52257 </para>
52258 <para>
52259 This is an example of a client configuration that implements the PLAIN
52260 authentication mechanism with a fixed user name and password:
52261 </para>
52262 <literallayout class="monospaced">
52263 fixed_plain:
52264   driver = plaintext
52265   public_name = PLAIN
52266   client_send = ^username^mysecret
52267 </literallayout>
52268 <para>
52269 The lack of colons means that the entire text is sent with the AUTH
52270 command, with the circumflex characters converted to NULs. A similar example
52271 that uses the LOGIN mechanism is:
52272 </para>
52273 <literallayout class="monospaced">
52274 fixed_login:
52275   driver = plaintext
52276   public_name = LOGIN
52277   client_send = : username : mysecret
52278 </literallayout>
52279 <para>
52280 The initial colon means that the first string is empty, so no data is sent with
52281 the AUTH command itself. The remaining strings are sent in response to
52282 prompts.
52283 <indexterm role="concept" startref="IIDplaiauth1" class="endofrange"/>
52284 <indexterm role="concept" startref="IIDplaiauth2" class="endofrange"/>
52285 </para>
52286 </section>
52287 </chapter>
52288
52289 <chapter id="CHID9">
52290 <title>The cram_md5 authenticator</title>
52291 <para>
52292 <indexterm role="concept" id="IIDcramauth1" class="startofrange">
52293 <primary><command>cram_md5</command> authenticator</primary>
52294 </indexterm>
52295 <indexterm role="concept" id="IIDcramauth2" class="startofrange">
52296 <primary>authenticators</primary>
52297 <secondary><command>cram_md5</command></secondary>
52298 </indexterm>
52299 <indexterm role="concept">
52300 <primary>CRAM-MD5 authentication mechanism</primary>
52301 </indexterm>
52302 <indexterm role="concept">
52303 <primary>authentication</primary>
52304 <secondary>CRAM-MD5 mechanism</secondary>
52305 </indexterm>
52306 The CRAM-MD5 authentication mechanism is described in RFC 2195. The server
52307 sends a challenge string to the client, and the response consists of a user
52308 name and the CRAM-MD5 digest of the challenge string combined with a secret
52309 string (password) which is known to both server and client. Thus, the secret
52310 is not sent over the network as plain text, which makes this authenticator more
52311 secure than <command>plaintext</command>. However, the downside is that the secret has to be
52312 available in plain text at either end.
52313 </para>
52314 <section id="SECID176">
52315 <title>Using cram_md5 as a server</title>
52316 <para>
52317 <indexterm role="concept">
52318 <primary>options</primary>
52319 <secondary><command>cram_md5</command> authenticator (server)</secondary>
52320 </indexterm>
52321 This authenticator has one server option, which must be set to configure the
52322 authenticator as a server:
52323 </para>
52324 <para>
52325 <indexterm role="option">
52326 <primary><option>server_secret</option></primary>
52327 </indexterm>
52328 </para>
52329 <informaltable frame="all">
52330 <tgroup cols="4" colsep="0" rowsep="0">
52331 <colspec colwidth="8*" align="left"/>
52332 <colspec colwidth="6*" align="center"/>
52333 <colspec colwidth="6*" align="center"/>
52334 <colspec colwidth="6*" align="right"/>
52335 <tbody>
52336 <row>
52337 <entry><option>server_secret</option></entry>
52338 <entry>Use: <emphasis>cram_md5</emphasis></entry>
52339 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52340 <entry>Default: <emphasis>unset</emphasis></entry>
52341 </row>
52342 </tbody>
52343 </tgroup>
52344 </informaltable>
52345 <para>
52346 <indexterm role="concept">
52347 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
52348 <secondary>in <command>cram_md5</command> authenticator</secondary>
52349 </indexterm>
52350 When the server receives the client&#x2019;s response, the user name is placed in
52351 the expansion variable <varname>$auth1</varname>, and <option>server_secret</option> is expanded to
52352 obtain the password for that user. The server then computes the CRAM-MD5 digest
52353 that the client should have sent, and checks that it received the correct
52354 string. If the expansion of <option>server_secret</option> is forced to fail, authentication
52355 fails. If the expansion fails for some other reason, a temporary error code is
52356 returned to the client.
52357 </para>
52358 <para>
52359 For compatibility with previous releases of Exim, the user name is also placed
52360 in <varname>$1</varname>. However, the use of this variables for this purpose is now
52361 deprecated, as it can lead to confusion in string expansions that also use
52362 numeric variables for other things.
52363 </para>
52364 <para>
52365 For example, the following authenticator checks that the user name given by the
52366 client is <quote>ph10</quote>, and if so, uses <quote>secret</quote> as the password. For any other
52367 user name, authentication fails.
52368 </para>
52369 <literallayout class="monospaced">
52370 fixed_cram:
52371   driver = cram_md5
52372   public_name = CRAM-MD5
52373   server_secret = ${if eq{$auth1}{ph10}{secret}fail}
52374   server_set_id = $auth1
52375 </literallayout>
52376 <para>
52377 <indexterm role="variable">
52378 <primary><varname>$authenticated_id</varname></primary>
52379 </indexterm>
52380 If authentication succeeds, the setting of <option>server_set_id</option> preserves the user
52381 name in <varname>$authenticated_id</varname>. A more typical configuration might look up the
52382 secret string in a file, using the user name as the key. For example:
52383 </para>
52384 <literallayout class="monospaced">
52385 lookup_cram:
52386   driver = cram_md5
52387   public_name = CRAM-MD5
52388   server_secret = ${lookup{$auth1}lsearch{/etc/authpwd}\
52389                   {$value}fail}
52390   server_set_id = $auth1
52391 </literallayout>
52392 <para>
52393 Note that this expansion explicitly forces failure if the lookup fails
52394 because <varname>$auth1</varname> contains an unknown user name.
52395 </para>
52396 <para>
52397 As another example, if you wish to re-use a Cyrus SASL sasldb2 file without
52398 using the relevant libraries, you need to know the realm to specify in the
52399 lookup and then ask for the <quote>userPassword</quote> attribute for that user in that
52400 realm, with:
52401 </para>
52402 <literallayout class="monospaced">
52403 cyrusless_crammd5:
52404   driver = cram_md5
52405   public_name = CRAM-MD5
52406   server_secret = ${lookup{$auth1:mail.example.org:userPassword}\
52407                   dbmjz{/etc/sasldb2}{$value}fail}
52408   server_set_id = $auth1
52409 </literallayout>
52410 </section>
52411 <section id="SECID177">
52412 <title>Using cram_md5 as a client</title>
52413 <para>
52414 <indexterm role="concept">
52415 <primary>options</primary>
52416 <secondary><command>cram_md5</command> authenticator (client)</secondary>
52417 </indexterm>
52418 When used as a client, the <command>cram_md5</command> authenticator has two options:
52419 </para>
52420 <para>
52421 <indexterm role="option">
52422 <primary><option>client_name</option></primary>
52423 </indexterm>
52424 </para>
52425 <informaltable frame="all">
52426 <tgroup cols="4" colsep="0" rowsep="0">
52427 <colspec colwidth="8*" align="left"/>
52428 <colspec colwidth="6*" align="center"/>
52429 <colspec colwidth="6*" align="center"/>
52430 <colspec colwidth="6*" align="right"/>
52431 <tbody>
52432 <row>
52433 <entry><option>client_name</option></entry>
52434 <entry>Use: <emphasis>cram_md5</emphasis></entry>
52435 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52436 <entry>Default: <emphasis>the primary host name</emphasis></entry>
52437 </row>
52438 </tbody>
52439 </tgroup>
52440 </informaltable>
52441 <para>
52442 This string is expanded, and the result used as the user name data when
52443 computing the response to the server&#x2019;s challenge.
52444 </para>
52445 <para>
52446 <indexterm role="option">
52447 <primary><option>client_secret</option></primary>
52448 </indexterm>
52449 </para>
52450 <informaltable frame="all">
52451 <tgroup cols="4" colsep="0" rowsep="0">
52452 <colspec colwidth="8*" align="left"/>
52453 <colspec colwidth="6*" align="center"/>
52454 <colspec colwidth="6*" align="center"/>
52455 <colspec colwidth="6*" align="right"/>
52456 <tbody>
52457 <row>
52458 <entry><option>client_secret</option></entry>
52459 <entry>Use: <emphasis>cram_md5</emphasis></entry>
52460 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52461 <entry>Default: <emphasis>unset</emphasis></entry>
52462 </row>
52463 </tbody>
52464 </tgroup>
52465 </informaltable>
52466 <para>
52467 This option must be set for the authenticator to work as a client. Its value is
52468 expanded and the result used as the secret string when computing the response.
52469 </para>
52470 <para>
52471 <indexterm role="variable">
52472 <primary><varname>$host</varname></primary>
52473 </indexterm>
52474 <indexterm role="variable">
52475 <primary><varname>$host_address</varname></primary>
52476 </indexterm>
52477 Different user names and secrets can be used for different servers by referring
52478 to <varname>$host</varname> or <varname>$host_address</varname> in the options. Forced failure of either
52479 expansion string is treated as an indication that this authenticator is not
52480 prepared to handle this case. Exim moves on to the next configured client
52481 authenticator. Any other expansion failure causes Exim to give up trying to
52482 send the message to the current server.
52483 </para>
52484 <para>
52485 A simple example configuration of a <command>cram_md5</command> authenticator, using fixed
52486 strings, is:
52487 </para>
52488 <literallayout class="monospaced">
52489 fixed_cram:
52490   driver = cram_md5
52491   public_name = CRAM-MD5
52492   client_name = ph10
52493   client_secret = secret
52494 </literallayout>
52495 <para>
52496 <indexterm role="concept" startref="IIDcramauth1" class="endofrange"/>
52497 <indexterm role="concept" startref="IIDcramauth2" class="endofrange"/>
52498 </para>
52499 </section>
52500 </chapter>
52501
52502 <chapter id="CHID10">
52503 <title>The cyrus_sasl authenticator</title>
52504 <para>
52505 <indexterm role="concept" id="IIDcyrauth1" class="startofrange">
52506 <primary><command>cyrus_sasl</command> authenticator</primary>
52507 </indexterm>
52508 <indexterm role="concept" id="IIDcyrauth2" class="startofrange">
52509 <primary>authenticators</primary>
52510 <secondary><command>cyrus_sasl</command></secondary>
52511 </indexterm>
52512 <indexterm role="concept">
52513 <primary>Cyrus</primary>
52514 <secondary>SASL library</secondary>
52515 </indexterm>
52516 <indexterm role="concept">
52517 <primary>Kerberos</primary>
52518 </indexterm>
52519 The code for this authenticator was provided by Matthew Byng-Maddick while
52520 at A L Digital Ltd.
52521 </para>
52522 <para>
52523 The <command>cyrus_sasl</command> authenticator provides server support for the Cyrus SASL
52524 library implementation of the RFC 2222 (<quote>Simple Authentication and Security
52525 Layer</quote>). This library supports a number of authentication mechanisms,
52526 including PLAIN and LOGIN, but also several others that Exim does not support
52527 directly. In particular, there is support for Kerberos authentication.
52528 </para>
52529 <para>
52530 The <command>cyrus_sasl</command> authenticator provides a gatewaying mechanism directly to
52531 the Cyrus interface, so if your Cyrus library can do, for example, CRAM-MD5,
52532 then so can the <command>cyrus_sasl</command> authenticator. By default it uses the public
52533 name of the driver to determine which mechanism to support.
52534 </para>
52535 <para>
52536 Where access to some kind of secret file is required, for example, in GSSAPI
52537 or CRAM-MD5, it is worth noting that the authenticator runs as the Exim
52538 user, and that the Cyrus SASL library has no way of escalating privileges
52539 by default. You may also find you need to set environment variables,
52540 depending on the driver you are using.
52541 </para>
52542 <para>
52543 The application name provided by Exim is <quote>exim</quote>, so various SASL options may
52544 be set in <filename>exim.conf</filename> in your SASL directory. If you are using GSSAPI for
52545 Kerberos, note that because of limitations in the GSSAPI interface,
52546 changing the server keytab might need to be communicated down to the Kerberos
52547 layer independently. The mechanism for doing so is dependent upon the Kerberos
52548 implementation.
52549 </para>
52550 <para>
52551 For example, for older releases of Heimdal, the environment variable KRB5_KTNAME
52552 may be set to point to an alternative keytab file. Exim will pass this
52553 variable through from its own inherited environment when started as root or the
52554 Exim user. The keytab file needs to be readable by the Exim user.
52555 With newer releases of Heimdal, a setuid Exim may cause Heimdal to discard the
52556 environment variable.  In practice, for those releases, the Cyrus authenticator
52557 is not a suitable interface for GSSAPI (Kerberos) support.  Instead, consider
52558 the <command>heimdal_gssapi</command> authenticator, described in chapter <xref linkend="CHAPheimdalgss"/>
52559 </para>
52560 <section id="SECID178">
52561 <title>Using cyrus_sasl as a server</title>
52562 <para>
52563 The <command>cyrus_sasl</command> authenticator has four private options. It puts the username
52564 (on a successful authentication) into <varname>$auth1</varname>. For compatibility with
52565 previous releases of Exim, the username is also placed in <varname>$1</varname>. However, the
52566 use of this variable for this purpose is now deprecated, as it can lead to
52567 confusion in string expansions that also use numeric variables for other
52568 things.
52569 </para>
52570 <para>
52571 <indexterm role="option">
52572 <primary><option>server_hostname</option></primary>
52573 </indexterm>
52574 </para>
52575 <informaltable frame="all">
52576 <tgroup cols="4" colsep="0" rowsep="0">
52577 <colspec colwidth="8*" align="left"/>
52578 <colspec colwidth="6*" align="center"/>
52579 <colspec colwidth="6*" align="center"/>
52580 <colspec colwidth="6*" align="right"/>
52581 <tbody>
52582 <row>
52583 <entry><option>server_hostname</option></entry>
52584 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
52585 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52586 <entry>Default: <emphasis>see below</emphasis></entry>
52587 </row>
52588 </tbody>
52589 </tgroup>
52590 </informaltable>
52591 <para>
52592 This option selects the hostname that is used when communicating with the
52593 library. The default value is <literal>$primary_hostname</literal>. It is up to the underlying
52594 SASL plug-in what it does with this data.
52595 </para>
52596 <para>
52597 <indexterm role="option">
52598 <primary><option>server_mech</option></primary>
52599 </indexterm>
52600 </para>
52601 <informaltable frame="all">
52602 <tgroup cols="4" colsep="0" rowsep="0">
52603 <colspec colwidth="8*" align="left"/>
52604 <colspec colwidth="6*" align="center"/>
52605 <colspec colwidth="6*" align="center"/>
52606 <colspec colwidth="6*" align="right"/>
52607 <tbody>
52608 <row>
52609 <entry><option>server_mech</option></entry>
52610 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
52611 <entry>Type: <emphasis>string</emphasis></entry>
52612 <entry>Default: <emphasis>see below</emphasis></entry>
52613 </row>
52614 </tbody>
52615 </tgroup>
52616 </informaltable>
52617 <para>
52618 This option selects the authentication mechanism this driver should use. The
52619 default is the value of the generic <option>public_name</option> option. This option allows
52620 you to use a different underlying mechanism from the advertised name. For
52621 example:
52622 </para>
52623 <literallayout class="monospaced">
52624 sasl:
52625   driver = cyrus_sasl
52626   public_name = X-ANYTHING
52627   server_mech = CRAM-MD5
52628   server_set_id = $auth1
52629 </literallayout>
52630 <para>
52631 <indexterm role="option">
52632 <primary><option>server_realm</option></primary>
52633 </indexterm>
52634 </para>
52635 <informaltable frame="all">
52636 <tgroup cols="4" colsep="0" rowsep="0">
52637 <colspec colwidth="8*" align="left"/>
52638 <colspec colwidth="6*" align="center"/>
52639 <colspec colwidth="6*" align="center"/>
52640 <colspec colwidth="6*" align="right"/>
52641 <tbody>
52642 <row>
52643 <entry><option>server_realm</option></entry>
52644 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
52645 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52646 <entry>Default: <emphasis>unset</emphasis></entry>
52647 </row>
52648 </tbody>
52649 </tgroup>
52650 </informaltable>
52651 <para>
52652 This specifies the SASL realm that the server claims to be in.
52653 </para>
52654 <para>
52655 <indexterm role="option">
52656 <primary><option>server_service</option></primary>
52657 </indexterm>
52658 </para>
52659 <informaltable frame="all">
52660 <tgroup cols="4" colsep="0" rowsep="0">
52661 <colspec colwidth="8*" align="left"/>
52662 <colspec colwidth="6*" align="center"/>
52663 <colspec colwidth="6*" align="center"/>
52664 <colspec colwidth="6*" align="right"/>
52665 <tbody>
52666 <row>
52667 <entry><option>server_service</option></entry>
52668 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
52669 <entry>Type: <emphasis>string</emphasis></entry>
52670 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
52671 </row>
52672 </tbody>
52673 </tgroup>
52674 </informaltable>
52675 <para>
52676 This is the SASL service that the server claims to implement.
52677 </para>
52678 <para>
52679 For straightforward cases, you do not need to set any of the authenticator&#x2019;s
52680 private options. All you need to do is to specify an appropriate mechanism as
52681 the public name. Thus, if you have a SASL library that supports CRAM-MD5 and
52682 PLAIN, you could have two authenticators as follows:
52683 </para>
52684 <literallayout class="monospaced">
52685 sasl_cram_md5:
52686   driver = cyrus_sasl
52687   public_name = CRAM-MD5
52688   server_set_id = $auth1
52689
52690 sasl_plain:
52691   driver = cyrus_sasl
52692   public_name = PLAIN
52693   server_set_id = $auth2
52694 </literallayout>
52695 <para>
52696 Cyrus SASL does implement the LOGIN authentication method, even though it is
52697 not a standard method. It is disabled by default in the source distribution,
52698 but it is present in many binary distributions.
52699 <indexterm role="concept" startref="IIDcyrauth1" class="endofrange"/>
52700 <indexterm role="concept" startref="IIDcyrauth2" class="endofrange"/>
52701 </para>
52702 </section>
52703 </chapter>
52704
52705 <chapter id="CHAPdovecot">
52706 <title>The dovecot authenticator</title>
52707 <para>
52708 <indexterm role="concept" id="IIDdcotauth1" class="startofrange">
52709 <primary><command>dovecot</command> authenticator</primary>
52710 </indexterm>
52711 <indexterm role="concept" id="IIDdcotauth2" class="startofrange">
52712 <primary>authenticators</primary>
52713 <secondary><command>dovecot</command></secondary>
52714 </indexterm>
52715 This authenticator is an interface to the authentication facility of the
52716 Dovecot POP/IMAP server, which can support a number of authentication methods.
52717 Note that Dovecot must be configured to use auth-client not auth-userdb.
52718 If you are using Dovecot to authenticate POP/IMAP clients, it might be helpful
52719 to use the same mechanisms for SMTP authentication. This is a server
52720 authenticator only. There is only one option:
52721 </para>
52722 <para>
52723 <indexterm role="option">
52724 <primary><option>server_socket</option></primary>
52725 </indexterm>
52726 </para>
52727 <informaltable frame="all">
52728 <tgroup cols="4" colsep="0" rowsep="0">
52729 <colspec colwidth="8*" align="left"/>
52730 <colspec colwidth="6*" align="center"/>
52731 <colspec colwidth="6*" align="center"/>
52732 <colspec colwidth="6*" align="right"/>
52733 <tbody>
52734 <row>
52735 <entry><option>server_socket</option></entry>
52736 <entry>Use: <emphasis>dovecot</emphasis></entry>
52737 <entry>Type: <emphasis>string</emphasis></entry>
52738 <entry>Default: <emphasis>unset</emphasis></entry>
52739 </row>
52740 </tbody>
52741 </tgroup>
52742 </informaltable>
52743 <para>
52744 This option must specify the UNIX socket that is the interface to Dovecot
52745 authentication. The <option>public_name</option> option must specify an authentication
52746 mechanism that Dovecot is configured to support. You can have several
52747 authenticators for different mechanisms. For example:
52748 </para>
52749 <literallayout class="monospaced">
52750 dovecot_plain:
52751   driver = dovecot
52752   public_name = PLAIN
52753   server_socket = /var/run/dovecot/auth-client
52754   server_set_id = $auth1
52755
52756 dovecot_ntlm:
52757   driver = dovecot
52758   public_name = NTLM
52759   server_socket = /var/run/dovecot/auth-client
52760   server_set_id = $auth1
52761 </literallayout>
52762 <para>
52763 If the SMTP connection is encrypted, or if <varname>$sender_host_address</varname> is equal to
52764 <varname>$received_ip_address</varname> (that is, the connection is local), the <quote>secured</quote>
52765 option is passed in the Dovecot authentication command. If, for a TLS
52766 connection, a client certificate has been verified, the <quote>valid-client-cert</quote>
52767 option is passed. When authentication succeeds, the identity of the user
52768 who authenticated is placed in <varname>$auth1</varname>.
52769 <indexterm role="concept" startref="IIDdcotauth1" class="endofrange"/>
52770 <indexterm role="concept" startref="IIDdcotauth2" class="endofrange"/>
52771 </para>
52772 </chapter>
52773
52774 <chapter id="CHAPgsasl">
52775 <title>The gsasl authenticator</title>
52776 <para>
52777 <indexterm role="concept" id="IIDgsaslauth1" class="startofrange">
52778 <primary><command>gsasl</command> authenticator</primary>
52779 </indexterm>
52780 <indexterm role="concept" id="IIDgsaslauth2" class="startofrange">
52781 <primary>authenticators</primary>
52782 <secondary><command>gsasl</command></secondary>
52783 </indexterm>
52784 <indexterm role="concept">
52785 <primary>authentication</primary>
52786 <secondary>GNU SASL</secondary>
52787 </indexterm>
52788 <indexterm role="concept">
52789 <primary>authentication</primary>
52790 <secondary>SASL</secondary>
52791 </indexterm>
52792 <indexterm role="concept">
52793 <primary>authentication</primary>
52794 <secondary>EXTERNAL</secondary>
52795 </indexterm>
52796 <indexterm role="concept">
52797 <primary>authentication</primary>
52798 <secondary>ANONYMOUS</secondary>
52799 </indexterm>
52800 <indexterm role="concept">
52801 <primary>authentication</primary>
52802 <secondary>PLAIN</secondary>
52803 </indexterm>
52804 <indexterm role="concept">
52805 <primary>authentication</primary>
52806 <secondary>LOGIN</secondary>
52807 </indexterm>
52808 <indexterm role="concept">
52809 <primary>authentication</primary>
52810 <secondary>DIGEST-MD5</secondary>
52811 </indexterm>
52812 <indexterm role="concept">
52813 <primary>authentication</primary>
52814 <secondary>CRAM-MD5</secondary>
52815 </indexterm>
52816 <indexterm role="concept">
52817 <primary>authentication</primary>
52818 <secondary>SCRAM-SHA-1</secondary>
52819 </indexterm>
52820 The <command>gsasl</command> authenticator provides server integration for the GNU SASL
52821 library and the mechanisms it provides.  This is new as of the 4.80 release
52822 and there are a few areas where the library does not let Exim smoothly
52823 scale to handle future authentication mechanisms, so no guarantee can be
52824 made that any particular new authentication mechanism will be supported
52825 without code changes in Exim.
52826 </para>
52827 <para>
52828 Exim&#x2019;s <command>gsasl</command> authenticator does not have client-side support at this
52829 time; only the server-side support is implemented.  Patches welcome.
52830 </para>
52831 <para>
52832 <indexterm role="option">
52833 <primary><option>server_channelbinding</option></primary>
52834 </indexterm>
52835 </para>
52836 <informaltable frame="all">
52837 <tgroup cols="4" colsep="0" rowsep="0">
52838 <colspec colwidth="8*" align="left"/>
52839 <colspec colwidth="6*" align="center"/>
52840 <colspec colwidth="6*" align="center"/>
52841 <colspec colwidth="6*" align="right"/>
52842 <tbody>
52843 <row>
52844 <entry><option>server_channelbinding</option></entry>
52845 <entry>Use: <emphasis>gsasl</emphasis></entry>
52846 <entry>Type: <emphasis>boolean</emphasis></entry>
52847 <entry>Default: <emphasis>false</emphasis></entry>
52848 </row>
52849 </tbody>
52850 </tgroup>
52851 </informaltable>
52852 <para>
52853 Do not set this true without consulting a cryptographic engineer.
52854 </para>
52855 <para>
52856 Some authentication mechanisms are able to use external context at both ends
52857 of the session to bind the authentication to that context, and fail the
52858 authentication process if that context differs.  Specifically, some TLS
52859 ciphersuites can provide identifying information about the cryptographic
52860 context.
52861 </para>
52862 <para>
52863 This should have meant that certificate identity and verification becomes a
52864 non-issue, as a man-in-the-middle attack will cause the correct client and
52865 server to see different identifiers and authentication will fail.
52866 </para>
52867 <para>
52868 This is currently only supported when using the GnuTLS library.  This is
52869 only usable by mechanisms which support "channel binding"; at time of
52870 writing, that&#x2019;s the SCRAM family.
52871 </para>
52872 <para>
52873 This defaults off to ensure smooth upgrade across Exim releases, in case
52874 this option causes some clients to start failing.  Some future release
52875 of Exim might have switched the default to be true.
52876 </para>
52877 <para>
52878 However, Channel Binding in TLS has proven to be broken in current versions.
52879 Do not plan to rely upon this feature for security, ever, without consulting
52880 with a subject matter expert (a cryptographic engineer).
52881 </para>
52882 <para>
52883 <indexterm role="option">
52884 <primary><option>server_hostname</option></primary>
52885 </indexterm>
52886 </para>
52887 <informaltable frame="all">
52888 <tgroup cols="4" colsep="0" rowsep="0">
52889 <colspec colwidth="8*" align="left"/>
52890 <colspec colwidth="6*" align="center"/>
52891 <colspec colwidth="6*" align="center"/>
52892 <colspec colwidth="6*" align="right"/>
52893 <tbody>
52894 <row>
52895 <entry><option>server_hostname</option></entry>
52896 <entry>Use: <emphasis>gsasl</emphasis></entry>
52897 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52898 <entry>Default: <emphasis>see below</emphasis></entry>
52899 </row>
52900 </tbody>
52901 </tgroup>
52902 </informaltable>
52903 <para>
52904 This option selects the hostname that is used when communicating with the
52905 library. The default value is <literal>$primary_hostname</literal>.
52906 Some mechanisms will use this data.
52907 </para>
52908 <para>
52909 <indexterm role="option">
52910 <primary><option>server_mech</option></primary>
52911 </indexterm>
52912 </para>
52913 <informaltable frame="all">
52914 <tgroup cols="4" colsep="0" rowsep="0">
52915 <colspec colwidth="8*" align="left"/>
52916 <colspec colwidth="6*" align="center"/>
52917 <colspec colwidth="6*" align="center"/>
52918 <colspec colwidth="6*" align="right"/>
52919 <tbody>
52920 <row>
52921 <entry><option>server_mech</option></entry>
52922 <entry>Use: <emphasis>gsasl</emphasis></entry>
52923 <entry>Type: <emphasis>string</emphasis></entry>
52924 <entry>Default: <emphasis>see below</emphasis></entry>
52925 </row>
52926 </tbody>
52927 </tgroup>
52928 </informaltable>
52929 <para>
52930 This option selects the authentication mechanism this driver should use. The
52931 default is the value of the generic <option>public_name</option> option. This option allows
52932 you to use a different underlying mechanism from the advertised name. For
52933 example:
52934 </para>
52935 <literallayout class="monospaced">
52936 sasl:
52937   driver = gsasl
52938   public_name = X-ANYTHING
52939   server_mech = CRAM-MD5
52940   server_set_id = $auth1
52941 </literallayout>
52942 <para>
52943 <indexterm role="option">
52944 <primary><option>server_password</option></primary>
52945 </indexterm>
52946 </para>
52947 <informaltable frame="all">
52948 <tgroup cols="4" colsep="0" rowsep="0">
52949 <colspec colwidth="8*" align="left"/>
52950 <colspec colwidth="6*" align="center"/>
52951 <colspec colwidth="6*" align="center"/>
52952 <colspec colwidth="6*" align="right"/>
52953 <tbody>
52954 <row>
52955 <entry><option>server_password</option></entry>
52956 <entry>Use: <emphasis>gsasl</emphasis></entry>
52957 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52958 <entry>Default: <emphasis>unset</emphasis></entry>
52959 </row>
52960 </tbody>
52961 </tgroup>
52962 </informaltable>
52963 <para>
52964 Various mechanisms need access to the cleartext password on the server, so
52965 that proof-of-possession can be demonstrated on the wire, without sending
52966 the password itself.
52967 </para>
52968 <para>
52969 The data available for lookup varies per mechanism.
52970 In all cases, <varname>$auth1</varname> is set to the <emphasis>authentication id</emphasis>.
52971 The <varname>$auth2</varname> variable will always be the <emphasis>authorization id</emphasis> (<emphasis>authz</emphasis>)
52972 if available, else the empty string.
52973 The <varname>$auth3</varname> variable will always be the <emphasis>realm</emphasis> if available,
52974 else the empty string.
52975 </para>
52976 <para>
52977 A forced failure will cause authentication to defer.
52978 </para>
52979 <para>
52980 If using this option, it may make sense to set the <option>server_condition</option>
52981 option to be simply "true".
52982 </para>
52983 <para>
52984 <indexterm role="option">
52985 <primary><option>server_realm</option></primary>
52986 </indexterm>
52987 </para>
52988 <informaltable frame="all">
52989 <tgroup cols="4" colsep="0" rowsep="0">
52990 <colspec colwidth="8*" align="left"/>
52991 <colspec colwidth="6*" align="center"/>
52992 <colspec colwidth="6*" align="center"/>
52993 <colspec colwidth="6*" align="right"/>
52994 <tbody>
52995 <row>
52996 <entry><option>server_realm</option></entry>
52997 <entry>Use: <emphasis>gsasl</emphasis></entry>
52998 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52999 <entry>Default: <emphasis>unset</emphasis></entry>
53000 </row>
53001 </tbody>
53002 </tgroup>
53003 </informaltable>
53004 <para>
53005 This specifies the SASL realm that the server claims to be in.
53006 Some mechanisms will use this data.
53007 </para>
53008 <para>
53009 <indexterm role="option">
53010 <primary><option>server_scram_iter</option></primary>
53011 </indexterm>
53012 </para>
53013 <informaltable frame="all">
53014 <tgroup cols="4" colsep="0" rowsep="0">
53015 <colspec colwidth="8*" align="left"/>
53016 <colspec colwidth="6*" align="center"/>
53017 <colspec colwidth="6*" align="center"/>
53018 <colspec colwidth="6*" align="right"/>
53019 <tbody>
53020 <row>
53021 <entry><option>server_scram_iter</option></entry>
53022 <entry>Use: <emphasis>gsasl</emphasis></entry>
53023 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
53024 <entry>Default: <emphasis>unset</emphasis></entry>
53025 </row>
53026 </tbody>
53027 </tgroup>
53028 </informaltable>
53029 <para>
53030 This option provides data for the SCRAM family of mechanisms.
53031 <varname>$auth1</varname> is not available at evaluation time.
53032 (This may change, as we receive feedback on use)
53033 </para>
53034 <para>
53035 <indexterm role="option">
53036 <primary><option>server_scram_salt</option></primary>
53037 </indexterm>
53038 </para>
53039 <informaltable frame="all">
53040 <tgroup cols="4" colsep="0" rowsep="0">
53041 <colspec colwidth="8*" align="left"/>
53042 <colspec colwidth="6*" align="center"/>
53043 <colspec colwidth="6*" align="center"/>
53044 <colspec colwidth="6*" align="right"/>
53045 <tbody>
53046 <row>
53047 <entry><option>server_scram_salt</option></entry>
53048 <entry>Use: <emphasis>gsasl</emphasis></entry>
53049 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
53050 <entry>Default: <emphasis>unset</emphasis></entry>
53051 </row>
53052 </tbody>
53053 </tgroup>
53054 </informaltable>
53055 <para>
53056 This option provides data for the SCRAM family of mechanisms.
53057 <varname>$auth1</varname> is not available at evaluation time.
53058 (This may change, as we receive feedback on use)
53059 </para>
53060 <para>
53061 <indexterm role="option">
53062 <primary><option>server_service</option></primary>
53063 </indexterm>
53064 </para>
53065 <informaltable frame="all">
53066 <tgroup cols="4" colsep="0" rowsep="0">
53067 <colspec colwidth="8*" align="left"/>
53068 <colspec colwidth="6*" align="center"/>
53069 <colspec colwidth="6*" align="center"/>
53070 <colspec colwidth="6*" align="right"/>
53071 <tbody>
53072 <row>
53073 <entry><option>server_service</option></entry>
53074 <entry>Use: <emphasis>gsasl</emphasis></entry>
53075 <entry>Type: <emphasis>string</emphasis></entry>
53076 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
53077 </row>
53078 </tbody>
53079 </tgroup>
53080 </informaltable>
53081 <para>
53082 This is the SASL service that the server claims to implement.
53083 Some mechanisms will use this data.
53084 </para>
53085 <section id="SECTgsaslauthvar">
53086 <title><command>gsasl</command> auth variables</title>
53087 <para>
53088 <indexterm role="variable">
53089 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
53090 </indexterm>
53091 These may be set when evaluating specific options, as detailed above.
53092 They will also be set when evaluating <option>server_condition</option>.
53093 </para>
53094 <para>
53095 Unless otherwise stated below, the <command>gsasl</command> integration will use the following
53096 meanings for these variables:
53097 </para>
53098 <itemizedlist>
53099 <listitem>
53100 <para>
53101 <indexterm role="variable">
53102 <primary><varname>$auth1</varname></primary>
53103 </indexterm>
53104 <varname>$auth1</varname>: the <emphasis>authentication id</emphasis>
53105 </para>
53106 </listitem>
53107 <listitem>
53108 <para>
53109 <indexterm role="variable">
53110 <primary><varname>$auth2</varname></primary>
53111 </indexterm>
53112 <varname>$auth2</varname>: the <emphasis>authorization id</emphasis>
53113 </para>
53114 </listitem>
53115 <listitem>
53116 <para>
53117 <indexterm role="variable">
53118 <primary><varname>$auth3</varname></primary>
53119 </indexterm>
53120 <varname>$auth3</varname>: the <emphasis>realm</emphasis>
53121 </para>
53122 </listitem>
53123 </itemizedlist>
53124 <para>
53125 On a per-mechanism basis:
53126 </para>
53127 <itemizedlist>
53128 <listitem>
53129 <para>
53130 <indexterm role="concept">
53131 <primary>authentication</primary>
53132 <secondary>EXTERNAL</secondary>
53133 </indexterm>
53134 EXTERNAL: only <varname>$auth1</varname> is set, to the possibly empty <emphasis>authorization id</emphasis>;
53135 the <option>server_condition</option> option must be present.
53136 </para>
53137 </listitem>
53138 <listitem>
53139 <para>
53140 <indexterm role="concept">
53141 <primary>authentication</primary>
53142 <secondary>ANONYMOUS</secondary>
53143 </indexterm>
53144 ANONYMOUS: only <varname>$auth1</varname> is set, to the possibly empty <emphasis>anonymous token</emphasis>;
53145 the <option>server_condition</option> option must be present.
53146 </para>
53147 </listitem>
53148 <listitem>
53149 <para>
53150 <indexterm role="concept">
53151 <primary>authentication</primary>
53152 <secondary>GSSAPI</secondary>
53153 </indexterm>
53154 GSSAPI: <varname>$auth1</varname> will be set to the <emphasis>GSSAPI Display Name</emphasis>;
53155 <varname>$auth2</varname> will be set to the <emphasis>authorization id</emphasis>,
53156 the <option>server_condition</option> option must be present.
53157 </para>
53158 </listitem>
53159 </itemizedlist>
53160 <para>
53161 An <emphasis>anonymous token</emphasis> is something passed along as an unauthenticated
53162 identifier; this is analogous to FTP anonymous authentication passing an
53163 email address, or software-identifier@, as the "password".
53164 </para>
53165 <para>
53166 An example showing the password having the realm specified in the callback
53167 and demonstrating a Cyrus SASL to GSASL migration approach is:
53168 </para>
53169 <literallayout class="monospaced">
53170 gsasl_cyrusless_crammd5:
53171   driver = gsasl
53172   public_name = CRAM-MD5
53173   server_realm = imap.example.org
53174   server_password = ${lookup{$auth1:$auth3:userPassword}\
53175                     dbmjz{/etc/sasldb2}{$value}fail}
53176   server_set_id = ${quote:$auth1}
53177   server_condition = yes
53178 </literallayout>
53179 </section>
53180 </chapter>
53181
53182 <chapter id="CHAPheimdalgss">
53183 <title>The heimdal_gssapi authenticator</title>
53184 <para>
53185 <indexterm role="concept" id="IIDheimdalgssauth1" class="startofrange">
53186 <primary><command>heimdal_gssapi</command> authenticator</primary>
53187 </indexterm>
53188 <indexterm role="concept" id="IIDheimdalgssauth2" class="startofrange">
53189 <primary>authenticators</primary>
53190 <secondary><command>heimdal_gssapi</command></secondary>
53191 </indexterm>
53192 <indexterm role="concept">
53193 <primary>authentication</primary>
53194 <secondary>GSSAPI</secondary>
53195 </indexterm>
53196 <indexterm role="concept">
53197 <primary>authentication</primary>
53198 <secondary>Kerberos</secondary>
53199 </indexterm>
53200 The <command>heimdal_gssapi</command> authenticator provides server integration for the
53201 Heimdal GSSAPI/Kerberos library, permitting Exim to set a keytab pathname
53202 reliably.
53203 </para>
53204 <para>
53205 <indexterm role="option">
53206 <primary><option>server_hostname</option></primary>
53207 </indexterm>
53208 </para>
53209 <informaltable frame="all">
53210 <tgroup cols="4" colsep="0" rowsep="0">
53211 <colspec colwidth="8*" align="left"/>
53212 <colspec colwidth="6*" align="center"/>
53213 <colspec colwidth="6*" align="center"/>
53214 <colspec colwidth="6*" align="right"/>
53215 <tbody>
53216 <row>
53217 <entry><option>server_hostname</option></entry>
53218 <entry>Use: <emphasis>heimdal_gssapi</emphasis></entry>
53219 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
53220 <entry>Default: <emphasis>see below</emphasis></entry>
53221 </row>
53222 </tbody>
53223 </tgroup>
53224 </informaltable>
53225 <para>
53226 This option selects the hostname that is used, with <option>server_service</option>,
53227 for constructing the GSS server name, as a <emphasis>GSS_C_NT_HOSTBASED_SERVICE</emphasis>
53228 identifier.  The default value is <literal>$primary_hostname</literal>.
53229 </para>
53230 <para>
53231 <indexterm role="option">
53232 <primary><option>server_keytab</option></primary>
53233 </indexterm>
53234 </para>
53235 <informaltable frame="all">
53236 <tgroup cols="4" colsep="0" rowsep="0">
53237 <colspec colwidth="8*" align="left"/>
53238 <colspec colwidth="6*" align="center"/>
53239 <colspec colwidth="6*" align="center"/>
53240 <colspec colwidth="6*" align="right"/>
53241 <tbody>
53242 <row>
53243 <entry><option>server_keytab</option></entry>
53244 <entry>Use: <emphasis>heimdal_gssapi</emphasis></entry>
53245 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
53246 <entry>Default: <emphasis>unset</emphasis></entry>
53247 </row>
53248 </tbody>
53249 </tgroup>
53250 </informaltable>
53251 <para>
53252 If set, then Heimdal will not use the system default keytab (typically
53253 <filename>/etc/krb5.keytab</filename>) but instead the pathname given in this option.
53254 The value should be a pathname, with no <quote>file:</quote> prefix.
53255 </para>
53256 <para>
53257 <indexterm role="option">
53258 <primary><option>server_service</option></primary>
53259 </indexterm>
53260 </para>
53261 <informaltable frame="all">
53262 <tgroup cols="4" colsep="0" rowsep="0">
53263 <colspec colwidth="8*" align="left"/>
53264 <colspec colwidth="6*" align="center"/>
53265 <colspec colwidth="6*" align="center"/>
53266 <colspec colwidth="6*" align="right"/>
53267 <tbody>
53268 <row>
53269 <entry><option>server_service</option></entry>
53270 <entry>Use: <emphasis>heimdal_gssapi</emphasis></entry>
53271 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
53272 <entry>Default: <emphasis>smtp</emphasis></entry>
53273 </row>
53274 </tbody>
53275 </tgroup>
53276 </informaltable>
53277 <para>
53278 This option specifies the service identifier used, in conjunction with
53279 <option>server_hostname</option>, for building the identifier for finding credentials
53280 from the keytab.
53281 </para>
53282 <section id="SECTheimdalgssauthvar">
53283 <title><command>heimdal_gssapi</command> auth variables</title>
53284 <para>
53285 Beware that these variables will typically include a realm, thus will appear
53286 to be roughly like an email address already.  The <emphasis>authzid</emphasis> in <varname>$auth2</varname> is
53287 not verified, so a malicious client can set it to anything.
53288 </para>
53289 <para>
53290 The <varname>$auth1</varname> field should be safely trustable as a value from the Key
53291 Distribution Center.  Note that these are not quite email addresses.
53292 Each identifier is for a role, and so the left-hand-side may include a
53293 role suffix.  For instance, <quote>joe/admin@EXAMPLE.ORG</quote>.
53294 </para>
53295 <para>
53296 <indexterm role="variable">
53297 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
53298 </indexterm>
53299 </para>
53300 <itemizedlist>
53301 <listitem>
53302 <para>
53303 <indexterm role="variable">
53304 <primary><varname>$auth1</varname></primary>
53305 </indexterm>
53306 <varname>$auth1</varname>: the <emphasis>authentication id</emphasis>, set to the GSS Display Name.
53307 </para>
53308 </listitem>
53309 <listitem>
53310 <para>
53311 <indexterm role="variable">
53312 <primary><varname>$auth2</varname></primary>
53313 </indexterm>
53314 <varname>$auth2</varname>: the <emphasis>authorization id</emphasis>, sent within SASL encapsulation after
53315 authentication.  If that was empty, this will also be set to the
53316 GSS Display Name.
53317 </para>
53318 </listitem>
53319 </itemizedlist>
53320 </section>
53321 </chapter>
53322
53323 <chapter id="CHAPspa">
53324 <title>The spa authenticator</title>
53325 <para>
53326 <indexterm role="concept" id="IIDspaauth1" class="startofrange">
53327 <primary><command>spa</command> authenticator</primary>
53328 </indexterm>
53329 <indexterm role="concept" id="IIDspaauth2" class="startofrange">
53330 <primary>authenticators</primary>
53331 <secondary><command>spa</command></secondary>
53332 </indexterm>
53333 <indexterm role="concept">
53334 <primary>authentication</primary>
53335 <secondary>Microsoft Secure Password</secondary>
53336 </indexterm>
53337 <indexterm role="concept">
53338 <primary>authentication</primary>
53339 <secondary>NTLM</secondary>
53340 </indexterm>
53341 <indexterm role="concept">
53342 <primary>Microsoft Secure Password Authentication</primary>
53343 </indexterm>
53344 <indexterm role="concept">
53345 <primary>NTLM authentication</primary>
53346 </indexterm>
53347 The <command>spa</command> authenticator provides client support for Microsoft&#x2019;s <emphasis>Secure
53348 Password Authentication</emphasis> mechanism,
53349 which is also sometimes known as NTLM (NT LanMan). The code for client side of
53350 this authenticator was contributed by Marc Prud&#x2019;hommeaux, and much of it is
53351 taken from the Samba project (<emphasis role="bold"><ulink url="https://www.samba.org/">https://www.samba.org/</ulink></emphasis>). The code for the
53352 server side was subsequently contributed by Tom Kistner. The mechanism works as
53353 follows:
53354 </para>
53355 <itemizedlist>
53356 <listitem>
53357 <para>
53358 After the AUTH command has been accepted, the client sends an SPA
53359 authentication request based on the user name and optional domain.
53360 </para>
53361 </listitem>
53362 <listitem>
53363 <para>
53364 The server sends back a challenge.
53365 </para>
53366 </listitem>
53367 <listitem>
53368 <para>
53369 The client builds a challenge response which makes use of the user&#x2019;s password
53370 and sends it to the server, which then accepts or rejects it.
53371 </para>
53372 </listitem>
53373 </itemizedlist>
53374 <para>
53375 Encryption is used to protect the password in transit.
53376 </para>
53377 <section id="SECID179">
53378 <title>Using spa as a server</title>
53379 <para>
53380 <indexterm role="concept">
53381 <primary>options</primary>
53382 <secondary><command>spa</command> authenticator (server)</secondary>
53383 </indexterm>
53384 The <command>spa</command> authenticator has just one server option:
53385 </para>
53386 <para>
53387 <indexterm role="option">
53388 <primary><option>server_password</option></primary>
53389 </indexterm>
53390 </para>
53391 <informaltable frame="all">
53392 <tgroup cols="4" colsep="0" rowsep="0">
53393 <colspec colwidth="8*" align="left"/>
53394 <colspec colwidth="6*" align="center"/>
53395 <colspec colwidth="6*" align="center"/>
53396 <colspec colwidth="6*" align="right"/>
53397 <tbody>
53398 <row>
53399 <entry><option>server_password</option></entry>
53400 <entry>Use: <emphasis>spa</emphasis></entry>
53401 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
53402 <entry>Default: <emphasis>unset</emphasis></entry>
53403 </row>
53404 </tbody>
53405 </tgroup>
53406 </informaltable>
53407 <para>
53408 <indexterm role="concept">
53409 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
53410 <secondary>in <command>spa</command> authenticator</secondary>
53411 </indexterm>
53412 This option is expanded, and the result must be the cleartext password for the
53413 authenticating user, whose name is at this point in <varname>$auth1</varname>. For
53414 compatibility with previous releases of Exim, the user name is also placed in
53415 <varname>$1</varname>. However, the use of this variable for this purpose is now deprecated, as
53416 it can lead to confusion in string expansions that also use numeric variables
53417 for other things. For example:
53418 </para>
53419 <literallayout class="monospaced">
53420 spa:
53421   driver = spa
53422   public_name = NTLM
53423   server_password = \
53424     ${lookup{$auth1}lsearch{/etc/exim/spa_clearpass}{$value}fail}
53425 </literallayout>
53426 <para>
53427 If the expansion is forced to fail, authentication fails. Any other expansion
53428 failure causes a temporary error code to be returned.
53429 </para>
53430 </section>
53431 <section id="SECID180">
53432 <title>Using spa as a client</title>
53433 <para>
53434 <indexterm role="concept">
53435 <primary>options</primary>
53436 <secondary><command>spa</command> authenticator (client)</secondary>
53437 </indexterm>
53438 The <command>spa</command> authenticator has the following client options:
53439 </para>
53440 <para>
53441 <indexterm role="option">
53442 <primary><option>client_domain</option></primary>
53443 </indexterm>
53444 </para>
53445 <informaltable frame="all">
53446 <tgroup cols="4" colsep="0" rowsep="0">
53447 <colspec colwidth="8*" align="left"/>
53448 <colspec colwidth="6*" align="center"/>
53449 <colspec colwidth="6*" align="center"/>
53450 <colspec colwidth="6*" align="right"/>
53451 <tbody>
53452 <row>
53453 <entry><option>client_domain</option></entry>
53454 <entry>Use: <emphasis>spa</emphasis></entry>
53455 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
53456 <entry>Default: <emphasis>unset</emphasis></entry>
53457 </row>
53458 </tbody>
53459 </tgroup>
53460 </informaltable>
53461 <para>
53462 This option specifies an optional domain for the authentication.
53463 </para>
53464 <para>
53465 <indexterm role="option">
53466 <primary><option>client_password</option></primary>
53467 </indexterm>
53468 </para>
53469 <informaltable frame="all">
53470 <tgroup cols="4" colsep="0" rowsep="0">
53471 <colspec colwidth="8*" align="left"/>
53472 <colspec colwidth="6*" align="center"/>
53473 <colspec colwidth="6*" align="center"/>
53474 <colspec colwidth="6*" align="right"/>
53475 <tbody>
53476 <row>
53477 <entry><option>client_password</option></entry>
53478 <entry>Use: <emphasis>spa</emphasis></entry>
53479 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
53480 <entry>Default: <emphasis>unset</emphasis></entry>
53481 </row>
53482 </tbody>
53483 </tgroup>
53484 </informaltable>
53485 <para>
53486 This option specifies the user&#x2019;s password, and must be set.
53487 </para>
53488 <para>
53489 <indexterm role="option">
53490 <primary><option>client_username</option></primary>
53491 </indexterm>
53492 </para>
53493 <informaltable frame="all">
53494 <tgroup cols="4" colsep="0" rowsep="0">
53495 <colspec colwidth="8*" align="left"/>
53496 <colspec colwidth="6*" align="center"/>
53497 <colspec colwidth="6*" align="center"/>
53498 <colspec colwidth="6*" align="right"/>
53499 <tbody>
53500 <row>
53501 <entry><option>client_username</option></entry>
53502 <entry>Use: <emphasis>spa</emphasis></entry>
53503 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
53504 <entry>Default: <emphasis>unset</emphasis></entry>
53505 </row>
53506 </tbody>
53507 </tgroup>
53508 </informaltable>
53509 <para>
53510 This option specifies the user name, and must be set. Here is an example of a
53511 configuration of this authenticator for use with the mail servers at
53512 <emphasis>msn.com</emphasis>:
53513 </para>
53514 <literallayout class="monospaced">
53515 msn:
53516   driver = spa
53517   public_name = MSN
53518   client_username = msn/msn_username
53519   client_password = msn_plaintext_password
53520   client_domain = DOMAIN_OR_UNSET
53521 </literallayout>
53522 <para>
53523 <indexterm role="concept" startref="IIDspaauth1" class="endofrange"/>
53524 <indexterm role="concept" startref="IIDspaauth2" class="endofrange"/>
53525 </para>
53526 </section>
53527 </chapter>
53528
53529 <chapter id="CHAPtlsauth">
53530 <title>The tls authenticator</title>
53531 <para>
53532 <indexterm role="concept" id="IIDtlsauth1" class="startofrange">
53533 <primary><command>tls</command> authenticator</primary>
53534 </indexterm>
53535 <indexterm role="concept" id="IIDtlsauth2" class="startofrange">
53536 <primary>authenticators</primary>
53537 <secondary><command>tls</command></secondary>
53538 </indexterm>
53539 <indexterm role="concept">
53540 <primary>authentication</primary>
53541 <secondary>Client Certificate</secondary>
53542 </indexterm>
53543 <indexterm role="concept">
53544 <primary>authentication</primary>
53545 <secondary>X509</secondary>
53546 </indexterm>
53547 <indexterm role="concept">
53548 <primary>Certificate-based authentication</primary>
53549 </indexterm>
53550 The <command>tls</command> authenticator provides server support for
53551 authentication based on client certificates.
53552 </para>
53553 <para>
53554 It is not an SMTP authentication mechanism and is not
53555 advertised by the server as part of the SMTP EHLO response.
53556 It is an Exim authenticator in the sense that it affects
53557 the protocol element of the log line, can be tested for
53558 by the <option>authenticated</option> ACL condition, and can set
53559 the <varname>$authenticated_id</varname> variable.
53560 </para>
53561 <para>
53562 The client must present a verifiable certificate,
53563 for which it must have been requested via the
53564 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> main options
53565 (see <xref linkend="CHAPTLS"/>).
53566 </para>
53567 <para>
53568 If an authenticator of this type is configured it is
53569 run before any SMTP-level communication is done,
53570 and can authenticate the connection.
53571 If it does, SMTP authentication is not offered.
53572 </para>
53573 <para>
53574 A maximum of one authenticator of this type may be present.
53575 </para>
53576 <para>
53577 <indexterm role="concept">
53578 <primary>options</primary>
53579 <secondary><command>tls</command> authenticator (server)</secondary>
53580 </indexterm>
53581 The <command>tls</command> authenticator has three server options:
53582 </para>
53583 <para>
53584 <indexterm role="option">
53585 <primary><option>server_param1</option></primary>
53586 </indexterm>
53587 </para>
53588 <informaltable frame="all">
53589 <tgroup cols="4" colsep="0" rowsep="0">
53590 <colspec colwidth="8*" align="left"/>
53591 <colspec colwidth="6*" align="center"/>
53592 <colspec colwidth="6*" align="center"/>
53593 <colspec colwidth="6*" align="right"/>
53594 <tbody>
53595 <row>
53596 <entry><option>server_param1</option></entry>
53597 <entry>Use: <emphasis>tls</emphasis></entry>
53598 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
53599 <entry>Default: <emphasis>unset</emphasis></entry>
53600 </row>
53601 </tbody>
53602 </tgroup>
53603 </informaltable>
53604 <para>
53605 <indexterm role="concept">
53606 <primary>variables (<varname>$auth1</varname> <varname>$auth2</varname> etc)</primary>
53607 <secondary>in <command>tls</command> authenticator</secondary>
53608 </indexterm>
53609 This option is expanded after the TLS negotiation and
53610 the result is placed in <varname>$auth1</varname>.
53611 If the expansion is forced to fail, authentication fails. Any other expansion
53612 failure causes a temporary error code to be returned.
53613 </para>
53614 <para>
53615 <indexterm role="option">
53616 <primary><option>server_param2</option></primary>
53617 </indexterm>
53618 </para>
53619 <informaltable frame="all">
53620 <tgroup cols="4" colsep="0" rowsep="0">
53621 <colspec colwidth="8*" align="left"/>
53622 <colspec colwidth="6*" align="center"/>
53623 <colspec colwidth="6*" align="center"/>
53624 <colspec colwidth="6*" align="right"/>
53625 <tbody>
53626 <row>
53627 <entry><option>server_param2</option></entry>
53628 <entry>Use: <emphasis>tls</emphasis></entry>
53629 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
53630 <entry>Default: <emphasis>unset</emphasis></entry>
53631 </row>
53632 </tbody>
53633 </tgroup>
53634 </informaltable>
53635 <para>
53636 <indexterm role="option">
53637 <primary><option>server_param3</option></primary>
53638 </indexterm>
53639 </para>
53640 <informaltable frame="all">
53641 <tgroup cols="4" colsep="0" rowsep="0">
53642 <colspec colwidth="8*" align="left"/>
53643 <colspec colwidth="6*" align="center"/>
53644 <colspec colwidth="6*" align="center"/>
53645 <colspec colwidth="6*" align="right"/>
53646 <tbody>
53647 <row>
53648 <entry><option>server_param3</option></entry>
53649 <entry>Use: <emphasis>tls</emphasis></entry>
53650 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
53651 <entry>Default: <emphasis>unset</emphasis></entry>
53652 </row>
53653 </tbody>
53654 </tgroup>
53655 </informaltable>
53656 <para>
53657 As above, for <varname>$auth2</varname> and <varname>$auth3</varname>.
53658 </para>
53659 <para>
53660 <option>server_param1</option> may also be spelled <option>server_param</option>.
53661 </para>
53662 <para>
53663 Example:
53664 </para>
53665 <literallayout class="monospaced">
53666 tls:
53667   driver = tls
53668   server_param1 =     ${certextract {subj_altname,mail,&gt;:} \
53669                                     {$tls_in_peercert}}
53670   server_condition =  ${if and { {eq{$tls_in_certificate_verified}{1}} \
53671                                  {forany {$auth1} \
53672                             {!= {0} \
53673                                 {${lookup ldap{ldap:///\
53674                          mailname=${quote_ldap_dn:${lc:$item}},\
53675                          ou=users,LDAP_DC?mailid} {$value}{0} \
53676                        }    }  } }}}
53677   server_set_id =     ${if = {1}{${listcount:$auth1}} {$auth1}{}}
53678 </literallayout>
53679 <para>
53680 This accepts a client certificate that is verifiable against any
53681 of your configured trust-anchors
53682 (which usually means the full set of public CAs)
53683 and which has a SAN with a good account name.
53684 </para>
53685 <para>
53686 Note that, up to TLS1.2, the client cert is on the wire in-clear, including the SAN,
53687 The account name is therefore guessable by an opponent.
53688 TLS 1.3 protects both server and client certificates, and is not vulnerable
53689 in this way.
53690 Likewise, a traditional plaintext SMTP AUTH done inside TLS is not.
53691 </para>
53692 <para>
53693 <indexterm role="concept" startref="IIDtlsauth1" class="endofrange"/>
53694 <indexterm role="concept" startref="IIDtlsauth2" class="endofrange"/>
53695 </para>
53696 <para>
53697 Note that because authentication is traditionally an SMTP operation,
53698 the <option>authenticated</option> ACL condition cannot be used in
53699 a connect- or helo-ACL.
53700 </para>
53701 </chapter>
53702
53703 <chapter id="CHAPTLS">
53704 <title>Encrypted SMTP connections using TLS/SSL</title>
53705 <titleabbrev>Encrypted SMTP connections</titleabbrev>
53706 <para>
53707 <indexterm role="concept" id="IIDencsmtp1" class="startofrange">
53708 <primary>encryption</primary>
53709 <secondary>on SMTP connection</secondary>
53710 </indexterm>
53711 <indexterm role="concept" id="IIDencsmtp2" class="startofrange">
53712 <primary>SMTP</primary>
53713 <secondary>encryption</secondary>
53714 </indexterm>
53715 <indexterm role="concept">
53716 <primary>TLS</primary>
53717 <secondary>on SMTP connection</secondary>
53718 </indexterm>
53719 <indexterm role="concept">
53720 <primary>OpenSSL</primary>
53721 </indexterm>
53722 <indexterm role="concept">
53723 <primary>GnuTLS</primary>
53724 </indexterm>
53725 Support for TLS (Transport Layer Security), formerly known as SSL (Secure
53726 Sockets Layer), is implemented by making use of the OpenSSL library or the
53727 GnuTLS library (Exim requires GnuTLS release 1.0 or later). There is no
53728 cryptographic code in the Exim distribution itself for implementing TLS. In
53729 order to use this feature you must install OpenSSL or GnuTLS, and then build a
53730 version of Exim that includes TLS support (see section <xref linkend="SECTinctlsssl"/>).
53731 You also need to understand the basic concepts of encryption at a managerial
53732 level, and in particular, the way that public keys, private keys, and
53733 certificates are used.
53734 </para>
53735 <para>
53736 RFC 3207 defines how SMTP connections can make use of encryption. Once a
53737 connection is established, the client issues a STARTTLS command. If the
53738 server accepts this, the client and the server negotiate an encryption
53739 mechanism. If the negotiation succeeds, the data that subsequently passes
53740 between them is encrypted.
53741 </para>
53742 <para>
53743 Exim&#x2019;s ACLs can detect whether the current SMTP session is encrypted or not,
53744 and if so, what cipher suite is in use, whether the client supplied a
53745 certificate, and whether or not that certificate was verified. This makes it
53746 possible for an Exim server to deny or accept certain commands based on the
53747 encryption state.
53748 </para>
53749 <para>
53750 <emphasis role="bold">Warning</emphasis>: Certain types of firewall and certain anti-virus products can
53751 disrupt TLS connections. You need to turn off SMTP scanning for these products
53752 in order to get TLS to work.
53753 </para>
53754 <section id="SECID284">
53755 <title>Support for the <quote>submissions</quote> (aka <quote>ssmtp</quote> and <quote>smtps</quote>) protocol</title>
53756 <para>
53757 <indexterm role="concept">
53758 <primary>submissions protocol</primary>
53759 </indexterm>
53760 <indexterm role="concept">
53761 <primary>ssmtp protocol</primary>
53762 </indexterm>
53763 <indexterm role="concept">
53764 <primary>smtps protocol</primary>
53765 </indexterm>
53766 <indexterm role="concept">
53767 <primary>SMTP</primary>
53768 <secondary>submissions protocol</secondary>
53769 </indexterm>
53770 <indexterm role="concept">
53771 <primary>SMTP</primary>
53772 <secondary>ssmtp protocol</secondary>
53773 </indexterm>
53774 <indexterm role="concept">
53775 <primary>SMTP</primary>
53776 <secondary>smtps protocol</secondary>
53777 </indexterm>
53778 The history of port numbers for TLS in SMTP is a little messy and has been
53779 contentious.  As of RFC 8314, the common practice of using the historically
53780 allocated port 465 for "email submission but with TLS immediately upon connect
53781 instead of using STARTTLS" is officially blessed by the IETF, and recommended
53782 by them in preference to STARTTLS.
53783 </para>
53784 <para>
53785 The name originally assigned to the port was <quote>ssmtp</quote> or <quote>smtps</quote>, but as
53786 clarity emerged over the dual roles of SMTP, for MX delivery and Email
53787 Submission, nomenclature has shifted.  The modern name is now <quote>submissions</quote>.
53788 </para>
53789 <para>
53790 This approach was, for a while, officially abandoned when encrypted SMTP was
53791 standardized, but many clients kept using it, even as the TCP port number was
53792 reassigned for other use.
53793 Thus you may encounter guidance claiming that you shouldn&#x2019;t enable use of
53794 this port.
53795 In practice, a number of mail-clients have only ever supported submissions,
53796 not submission with STARTTLS upgrade.
53797 Ideally, offer both submission (587) and submissions (465) service.
53798 </para>
53799 <para>
53800 Exim supports TLS-on-connect by means of the <option>tls_on_connect_ports</option>
53801 global option. Its value must be a list of port numbers;
53802 the most common use is expected to be:
53803 </para>
53804 <literallayout class="monospaced">
53805 tls_on_connect_ports = 465
53806 </literallayout>
53807 <para>
53808 The port numbers specified by this option apply to all SMTP connections, both
53809 via the daemon and via <emphasis>inetd</emphasis>. You still need to specify all the ports that
53810 the daemon uses (by setting <option>daemon_smtp_ports</option> or <option>local_interfaces</option> or
53811 the <option>-oX</option> command line option) because <option>tls_on_connect_ports</option> does not add
53812 an extra port &ndash; rather, it specifies different behaviour on a port that is
53813 defined elsewhere.
53814 </para>
53815 <para>
53816 There is also a <option>-tls-on-connect</option> command line option. This overrides
53817 <option>tls_on_connect_ports</option>; it forces the TLS-only behaviour for all ports.
53818 </para>
53819 </section>
53820 <section id="SECTopenvsgnu">
53821 <title>OpenSSL vs GnuTLS</title>
53822 <para>
53823 <indexterm role="concept">
53824 <primary>TLS</primary>
53825 <secondary>OpenSSL <emphasis>vs</emphasis> GnuTLS</secondary>
53826 </indexterm>
53827 The first TLS support in Exim was implemented using OpenSSL. Support for GnuTLS
53828 followed later, when the first versions of GnuTLS were released. To build Exim
53829 to use GnuTLS, you need to set
53830 </para>
53831 <literallayout class="monospaced">
53832 USE_GNUTLS=yes
53833 </literallayout>
53834 <para>
53835 in Local/Makefile, in addition to
53836 </para>
53837 <literallayout class="monospaced">
53838 SUPPORT_TLS=yes
53839 </literallayout>
53840 <para>
53841 You must also set TLS_LIBS and TLS_INCLUDE appropriately, so that the
53842 include files and libraries for GnuTLS can be found.
53843 </para>
53844 <para>
53845 There are some differences in usage when using GnuTLS instead of OpenSSL:
53846 </para>
53847 <itemizedlist>
53848 <listitem>
53849 <para>
53850 The <option>tls_verify_certificates</option> option
53851 cannot be the path of a directory
53852 for GnuTLS versions before 3.3.6
53853 (for later versions, or OpenSSL, it can be either).
53854 </para>
53855 </listitem>
53856 <listitem>
53857 <para>
53858 The default value for <option>tls_dhparam</option> differs for historical reasons.
53859 </para>
53860 </listitem>
53861 <listitem>
53862 <para>
53863 <indexterm role="variable">
53864 <primary><varname>$tls_in_peerdn</varname></primary>
53865 </indexterm>
53866 <indexterm role="variable">
53867 <primary><varname>$tls_out_peerdn</varname></primary>
53868 </indexterm>
53869 Distinguished Name (DN) strings reported by the OpenSSL library use a slash for
53870 separating fields; GnuTLS uses commas, in accordance with RFC 2253. This
53871 affects the value of the <varname>$tls_in_peerdn</varname> and <varname>$tls_out_peerdn</varname> variables.
53872 </para>
53873 </listitem>
53874 <listitem>
53875 <para>
53876 OpenSSL identifies cipher suites using hyphens as separators, for example:
53877 DES-CBC3-SHA. GnuTLS historically used underscores, for example:
53878 RSA_ARCFOUR_SHA. What is more, OpenSSL complains if underscores are present
53879 in a cipher list. To make life simpler, Exim changes underscores to hyphens
53880 for OpenSSL and passes the string unchanged to GnuTLS (expecting the library
53881 to handle its own older variants) when processing lists of cipher suites in the
53882 <option>tls_require_ciphers</option> options (the global option and the <command>smtp</command> transport
53883 option).
53884 </para>
53885 </listitem>
53886 <listitem>
53887 <para>
53888 The <option>tls_require_ciphers</option> options operate differently, as described in the
53889 sections <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
53890 </para>
53891 </listitem>
53892 <listitem>
53893 <para>
53894 The <option>tls_dh_min_bits</option> SMTP transport option is only honoured by GnuTLS.
53895 When using OpenSSL, this option is ignored.
53896 (If an API is found to let OpenSSL be configured in this way,
53897 let the Exim Maintainers know and we&#x2019;ll likely use it).
53898 </para>
53899 </listitem>
53900 <listitem>
53901 <para>
53902 With GnuTLS, if an explicit list is used for the <option>tls_privatekey</option> main option
53903 main option, it must be ordered to match the <option>tls_certificate</option> list.
53904 </para>
53905 </listitem>
53906 <listitem>
53907 <para>
53908 Some other recently added features may only be available in one or the other.
53909 This should be documented with the feature.  If the documentation does not
53910 explicitly state that the feature is infeasible in the other TLS
53911 implementation, then patches are welcome.
53912 </para>
53913 </listitem>
53914 </itemizedlist>
53915 </section>
53916 <section id="SECTgnutlsparam">
53917 <title>GnuTLS parameter computation</title>
53918 <para>
53919 This section only applies if <option>tls_dhparam</option> is set to <literal>historic</literal> or to
53920 an explicit path; if the latter, then the text about generation still applies,
53921 but not the chosen filename.
53922 By default, as of Exim 4.80 a hard-coded D-H prime is used.
53923 See the documentation of <option>tls_dhparam</option> for more information.
53924 </para>
53925 <para>
53926 GnuTLS uses D-H parameters that may take a substantial amount of time
53927 to compute. It is unreasonable to re-compute them for every TLS session.
53928 Therefore, Exim keeps this data in a file in its spool directory, called
53929 <filename>gnutls-params-NNNN</filename> for some value of NNNN, corresponding to the number
53930 of bits requested.
53931 The file is owned by the Exim user and is readable only by
53932 its owner. Every Exim process that start up GnuTLS reads the D-H
53933 parameters from this file. If the file does not exist, the first Exim process
53934 that needs it computes the data and writes it to a temporary file which is
53935 renamed once it is complete. It does not matter if several Exim processes do
53936 this simultaneously (apart from wasting a few resources). Once a file is in
53937 place, new Exim processes immediately start using it.
53938 </para>
53939 <para>
53940 For maximum security, the parameters that are stored in this file should be
53941 recalculated periodically, the frequency depending on your paranoia level.
53942 If you are avoiding using the fixed D-H primes published in RFCs, then you
53943 are concerned about some advanced attacks and will wish to do this; if you do
53944 not regenerate then you might as well stick to the standard primes.
53945 </para>
53946 <para>
53947 Arranging this is easy in principle; just delete the file when you want new
53948 values to be computed. However, there may be a problem. The calculation of new
53949 parameters needs random numbers, and these are obtained from <filename>/dev/random</filename>.
53950 If the system is not very active, <filename>/dev/random</filename> may delay returning data
53951 until enough randomness (entropy) is available. This may cause Exim to hang for
53952 a substantial amount of time, causing timeouts on incoming connections.
53953 </para>
53954 <para>
53955 The solution is to generate the parameters externally to Exim. They are stored
53956 in <filename>gnutls-params-N</filename> in PEM format, which means that they can be
53957 generated externally using the <command>certtool</command> command that is part of GnuTLS.
53958 </para>
53959 <para>
53960 To replace the parameters with new ones, instead of deleting the file
53961 and letting Exim re-create it, you can generate new parameters using
53962 <command>certtool</command> and, when this has been done, replace Exim&#x2019;s cache file by
53963 renaming. The relevant commands are something like this:
53964 </para>
53965 <literallayout class="monospaced">
53966 # ls
53967 [ look for file; assume gnutls-params-2236 is the most recent ]
53968 # rm -f new-params
53969 # touch new-params
53970 # chown exim:exim new-params
53971 # chmod 0600 new-params
53972 # certtool --generate-dh-params --bits 2236 &gt;&gt;new-params
53973 # openssl dhparam -noout -text -in new-params | head
53974 [ check the first line, make sure it's not more than 2236;
53975   if it is, then go back to the start ("rm") and repeat
53976   until the size generated is at most the size requested ]
53977 # chmod 0400 new-params
53978 # mv new-params gnutls-params-2236
53979 </literallayout>
53980 <para>
53981 If Exim never has to generate the parameters itself, the possibility of
53982 stalling is removed.
53983 </para>
53984 <para>
53985 The filename changed in Exim 4.80, to gain the -bits suffix.  The value which
53986 Exim will choose depends upon the version of GnuTLS in use.  For older GnuTLS,
53987 the value remains hard-coded in Exim as 1024.  As of GnuTLS 2.12.x, there is
53988 a way for Exim to ask for the "normal" number of bits for D-H public-key usage,
53989 and Exim does so.  This attempt to remove Exim from TLS policy decisions
53990 failed, as GnuTLS 2.12 returns a value higher than the current hard-coded limit
53991 of the NSS library.  Thus Exim gains the <option>tls_dh_max_bits</option> global option,
53992 which applies to all D-H usage, client or server.  If the value returned by
53993 GnuTLS is greater than <option>tls_dh_max_bits</option> then the value will be clamped down
53994 to <option>tls_dh_max_bits</option>.  The default value has been set at the current NSS
53995 limit, which is still much higher than Exim historically used.
53996 </para>
53997 <para>
53998 The filename and bits used will change as the GnuTLS maintainers change the
53999 value for their parameter <literal>GNUTLS_SEC_PARAM_NORMAL</literal>, as clamped by
54000 <option>tls_dh_max_bits</option>.  At the time of writing (mid 2012), GnuTLS 2.12 recommends
54001 2432 bits, while NSS is limited to 2236 bits.
54002 </para>
54003 <para>
54004 In fact, the requested value will be *lower* than <option>tls_dh_max_bits</option>, to
54005 increase the chance of the generated prime actually being within acceptable
54006 bounds, as GnuTLS has been observed to overshoot.  Note the check step in the
54007 procedure above.  There is no sane procedure available to Exim to double-check
54008 the size of the generated prime, so it might still be too large.
54009 </para>
54010 </section>
54011 <section id="SECTreqciphssl">
54012 <title>Requiring specific ciphers in OpenSSL</title>
54013 <para>
54014 <indexterm role="concept">
54015 <primary>TLS</primary>
54016 <secondary>requiring specific ciphers (OpenSSL)</secondary>
54017 </indexterm>
54018 <indexterm role="option">
54019 <primary><option>tls_require_ciphers</option></primary>
54020 <secondary>OpenSSL</secondary>
54021 </indexterm>
54022 There is a function in the OpenSSL library that can be passed a list of cipher
54023 suites before the cipher negotiation takes place. This specifies which ciphers
54024 </para>
54025 <para revisionflag="changed">
54026 are acceptable for TLS versions prior to 1.3.
54027 </para>
54028 <para>
54029 The list is colon separated and may contain names like
54030 DES-CBC3-SHA. Exim passes the expanded value of <option>tls_require_ciphers</option>
54031 directly to this function call.
54032 Many systems will install the OpenSSL manual-pages, so you may have
54033 <emphasis>ciphers(1)</emphasis> available to you.
54034 The following quotation from the OpenSSL
54035 documentation specifies what forms of item are allowed in the cipher string:
54036 </para>
54037 <itemizedlist>
54038 <listitem>
54039 <para>
54040 It can consist of a single cipher suite such as RC4-SHA.
54041 </para>
54042 </listitem>
54043 <listitem>
54044 <para>
54045 It can represent a list of cipher suites containing a certain algorithm,
54046 or cipher suites of a certain type. For example SHA1 represents all
54047 ciphers suites using the digest algorithm SHA1 and SSLv3 represents all
54048 SSL v3 algorithms.
54049 </para>
54050 </listitem>
54051 <listitem>
54052 <para>
54053 Lists of cipher suites can be combined in a single cipher string using
54054 the + character. This is used as a logical and operation. For example
54055 SHA1+DES represents all cipher suites containing the SHA1 and the DES
54056 algorithms.
54057 </para>
54058 </listitem>
54059 </itemizedlist>
54060 <para>
54061 Each cipher string can be optionally preceded by one of the characters <literal>!</literal>,
54062 <literal>-</literal> or <literal>+</literal>.
54063 </para>
54064 <itemizedlist>
54065 <listitem>
54066 <para>
54067 If <literal>!</literal> is used, the ciphers are permanently deleted from the list. The
54068 ciphers deleted can never reappear in the list even if they are explicitly
54069 stated.
54070 </para>
54071 </listitem>
54072 <listitem>
54073 <para>
54074 If <literal>-</literal> is used, the ciphers are deleted from the list, but some or all
54075 of the ciphers can be added again by later options.
54076 </para>
54077 </listitem>
54078 <listitem>
54079 <para>
54080 If <literal>+</literal> is used, the ciphers are moved to the end of the list. This
54081 option does not add any new ciphers; it just moves matching existing ones.
54082 </para>
54083 </listitem>
54084 </itemizedlist>
54085 <para>
54086 If none of these characters is present, the string is interpreted as
54087 a list of ciphers to be appended to the current preference list. If the list
54088 includes any ciphers already present they will be ignored: that is, they will
54089 not be moved to the end of the list.
54090 </para>
54091 <para>
54092 The OpenSSL <emphasis>ciphers(1)</emphasis> command may be used to test the results of a given
54093 string:
54094 </para>
54095 <literallayout class="monospaced">
54096 # note single-quotes to get ! past any shell history expansion
54097 $ openssl ciphers 'HIGH:!MD5:!SHA1'
54098 </literallayout>
54099 <para>
54100 This example will let the library defaults be permitted on the MX port, where
54101 there&#x2019;s probably no identity verification anyway, but ups the ante on the
54102 submission ports where the administrator might have some influence on the
54103 choice of clients used:
54104 </para>
54105 <literallayout class="monospaced">
54106 # OpenSSL variant; see man ciphers(1)
54107 tls_require_ciphers = ${if =={$received_port}{25}\
54108                            {DEFAULT}\
54109                            {HIGH:!MD5:!SHA1}}
54110 </literallayout>
54111 <para>
54112 This example will prefer ECDSA-authenticated ciphers over RSA ones:
54113 </para>
54114 <literallayout class="monospaced">
54115 tls_require_ciphers = ECDSA:RSA:!COMPLEMENTOFDEFAULT
54116 </literallayout>
54117 <para revisionflag="changed">
54118 For TLS version 1.3 the control available is less fine-grained
54119 and Exim does not provide access to it at present.
54120 The value of the <option>tls_require_ciphers</option> option is ignored when
54121 TLS version 1.3 is negotiated.
54122 </para>
54123 <para revisionflag="changed">
54124 As of writing the library default cipher suite list for TLSv1.3 is
54125 </para>
54126 <literallayout class="monospaced" revisionflag="changed">
54127 TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256
54128 </literallayout>
54129 </section>
54130 <section id="SECTreqciphgnu">
54131 <title>Requiring specific ciphers or other parameters in GnuTLS</title>
54132 <para>
54133 <indexterm role="concept">
54134 <primary>GnuTLS</primary>
54135 <secondary>specifying parameters for</secondary>
54136 </indexterm>
54137 <indexterm role="concept">
54138 <primary>TLS</primary>
54139 <secondary>specifying ciphers (GnuTLS)</secondary>
54140 </indexterm>
54141 <indexterm role="concept">
54142 <primary>TLS</primary>
54143 <secondary>specifying key exchange methods (GnuTLS)</secondary>
54144 </indexterm>
54145 <indexterm role="concept">
54146 <primary>TLS</primary>
54147 <secondary>specifying MAC algorithms (GnuTLS)</secondary>
54148 </indexterm>
54149 <indexterm role="concept">
54150 <primary>TLS</primary>
54151 <secondary>specifying protocols (GnuTLS)</secondary>
54152 </indexterm>
54153 <indexterm role="concept">
54154 <primary>TLS</primary>
54155 <secondary>specifying priority string (GnuTLS)</secondary>
54156 </indexterm>
54157 <indexterm role="option">
54158 <primary><option>tls_require_ciphers</option></primary>
54159 <secondary>GnuTLS</secondary>
54160 </indexterm>
54161 The GnuTLS library allows the caller to provide a "priority string", documented
54162 as part of the <function>gnutls_priority_init</function> function.  This is very similar to the
54163 ciphersuite specification in OpenSSL.
54164 </para>
54165 <para>
54166 The <option>tls_require_ciphers</option> option is treated as the GnuTLS priority string
54167 and controls both protocols and ciphers.
54168 </para>
54169 <para>
54170 The <option>tls_require_ciphers</option> option is available both as an global option,
54171 controlling how Exim behaves as a server, and also as an option of the
54172 <command>smtp</command> transport, controlling how Exim behaves as a client.  In both cases
54173 the value is string expanded.  The resulting string is not an Exim list and
54174 the string is given to the GnuTLS library, so that Exim does not need to be
54175 aware of future feature enhancements of GnuTLS.
54176 </para>
54177 <para>
54178 Documentation of the strings accepted may be found in the GnuTLS manual, under
54179 "Priority strings".  This is online as
54180 <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>,
54181 but beware that this relates to GnuTLS 3, which may be newer than the version
54182 installed on your system.  If you are using GnuTLS 3,
54183 then the example code
54184 <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>
54185 on that site can be used to test a given string.
54186 </para>
54187 <para>
54188 For example:
54189 </para>
54190 <literallayout class="monospaced">
54191 # Disable older versions of protocols
54192 tls_require_ciphers = NORMAL:%LATEST_RECORD_VERSION:-VERS-SSL3.0
54193 </literallayout>
54194 <para>
54195 Prior to Exim 4.80, an older API of GnuTLS was used, and Exim supported three
54196 additional options, "<option>gnutls_require_kx</option>", "<option>gnutls_require_mac</option>" and
54197 "<option>gnutls_require_protocols</option>".  <option>tls_require_ciphers</option> was an Exim list.
54198 </para>
54199 <para>
54200 This example will let the library defaults be permitted on the MX port, where
54201 there&#x2019;s probably no identity verification anyway, and lowers security further
54202 by increasing compatibility; but this ups the ante on the submission ports
54203 where the administrator might have some influence on the choice of clients
54204 used:
54205 </para>
54206 <literallayout class="monospaced">
54207 # GnuTLS variant
54208 tls_require_ciphers = ${if =={$received_port}{25}\
54209                            {NORMAL:%COMPAT}\
54210                            {SECURE128}}
54211 </literallayout>
54212 </section>
54213 <section id="SECID182">
54214 <title>Configuring an Exim server to use TLS</title>
54215 <para>
54216 <indexterm role="concept">
54217 <primary>TLS</primary>
54218 <secondary>configuring an Exim server</secondary>
54219 </indexterm>
54220 When Exim has been built with TLS support, it advertises the availability of
54221 the STARTTLS command to client hosts that match <option>tls_advertise_hosts</option>,
54222 but not to any others. The default value of this option is *, which means
54223 that STARTTLS is always advertised.  Set it to blank to never advertise;
54224 this is reasonable for systems that want to use TLS only as a client.
54225 </para>
54226 <para>
54227 If STARTTLS is to be used you
54228 need to set some other options in order to make TLS available.
54229 </para>
54230 <para>
54231 If a client issues a STARTTLS command and there is some configuration
54232 problem in the server, the command is rejected with a 454 error. If the client
54233 persists in trying to issue SMTP commands, all except QUIT are rejected
54234 with the error
54235 </para>
54236 <literallayout class="monospaced">
54237 554 Security failure
54238 </literallayout>
54239 <para>
54240 If a STARTTLS command is issued within an existing TLS session, it is
54241 rejected with a 554 error code.
54242 </para>
54243 <para>
54244 To enable TLS operations on a server, the <option>tls_advertise_hosts</option> option
54245 must be set to match some hosts. The default is * which matches all hosts.
54246 </para>
54247 <para>
54248 If this is all you do, TLS encryption will be enabled but not authentication -
54249 meaning that the peer has no assurance it is actually you he is talking to.
54250 You gain protection from a passive sniffer listening on the wire but not
54251 from someone able to intercept the communication.
54252 </para>
54253 <para>
54254 Further protection requires some further configuration at the server end.
54255 </para>
54256 <para>
54257 To make TLS work you need to set, in the server,
54258 </para>
54259 <literallayout class="monospaced">
54260 tls_certificate = /some/file/name
54261 tls_privatekey = /some/file/name
54262 </literallayout>
54263 <para>
54264 These options are, in fact, expanded strings, so you can make them depend on
54265 the identity of the client that is connected if you wish. The first file
54266 contains the server&#x2019;s X509 certificate, and the second contains the private key
54267 that goes with it. These files need to be
54268 PEM format and readable by the Exim user, and must
54269 always be given as full path names.
54270 The key must not be password-protected.
54271 They can be the same file if both the
54272 certificate and the key are contained within it. If <option>tls_privatekey</option> is not
54273 set, or if its expansion is forced to fail or results in an empty string, this
54274 is assumed to be the case. The certificate file may also contain intermediate
54275 certificates that need to be sent to the client to enable it to authenticate
54276 the server&#x2019;s certificate.
54277 </para>
54278 <para>
54279 For dual-stack (eg. RSA and ECDSA) configurations, these options can be
54280 colon-separated lists of file paths.  Ciphers using given authentication
54281 algorithms require the presence of a suitable certificate to supply the
54282 public-key.  The server selects among the certificates to present to the
54283 client depending on the selected cipher, hence the priority ordering for
54284 ciphers will affect which certificate is used.
54285 </para>
54286 <para>
54287 If you do not understand about certificates and keys, please try to find a
54288 source of this background information, which is not Exim-specific. (There are a
54289 few comments below in section <xref linkend="SECTcerandall"/>.)
54290 </para>
54291 <para>
54292 <emphasis role="bold">Note</emphasis>: These options do not apply when Exim is operating as a client &ndash;
54293 they apply only in the case of a server. If you need to use a certificate in an
54294 Exim client, you must set the options of the same names in an <command>smtp</command>
54295 transport.
54296 </para>
54297 <para>
54298 With just these options, an Exim server will be able to use TLS. It does not
54299 require the client to have a certificate (but see below for how to insist on
54300 this). There is one other option that may be needed in other situations. If
54301 </para>
54302 <literallayout class="monospaced">
54303 tls_dhparam = /some/file/name
54304 </literallayout>
54305 <para>
54306 is set, the SSL library is initialized for the use of Diffie-Hellman ciphers
54307 with the parameters contained in the file.
54308 Set this to <literal>none</literal> to disable use of DH entirely, by making no prime
54309 available:
54310 </para>
54311 <literallayout class="monospaced">
54312 tls_dhparam = none
54313 </literallayout>
54314 <para>
54315 This may also be set to a string identifying a standard prime to be used for
54316 DH; if it is set to <literal>default</literal> or, for OpenSSL, is unset, then the prime
54317 used is <literal>ike23</literal>.  There are a few standard primes available, see the
54318 documentation for <option>tls_dhparam</option> for the complete list.
54319 </para>
54320 <para>
54321 See the command
54322 </para>
54323 <literallayout class="monospaced">
54324 openssl dhparam
54325 </literallayout>
54326 <para>
54327 for a way of generating file data.
54328 </para>
54329 <para>
54330 The strings supplied for these three options are expanded every time a client
54331 host connects. It is therefore possible to use different certificates and keys
54332 for different hosts, if you so wish, by making use of the client&#x2019;s IP address
54333 in <varname>$sender_host_address</varname> to control the expansion. If a string expansion is
54334 forced to fail, Exim behaves as if the option is not set.
54335 </para>
54336 <para>
54337 <indexterm role="concept">
54338 <primary>cipher</primary>
54339 <secondary>logging</secondary>
54340 </indexterm>
54341 <indexterm role="concept">
54342 <primary>log</primary>
54343 <secondary>TLS cipher</secondary>
54344 </indexterm>
54345 <indexterm role="variable">
54346 <primary><varname>$tls_in_cipher</varname></primary>
54347 </indexterm>
54348 The variable <varname>$tls_in_cipher</varname> is set to the cipher suite that was negotiated for
54349 an incoming TLS connection. It is included in the <emphasis>Received:</emphasis> header of an
54350 incoming message (by default &ndash; you can, of course, change this), and it is
54351 also included in the log line that records a message&#x2019;s arrival, keyed by
54352 <quote>X=</quote>, unless the <option>tls_cipher</option> log selector is turned off. The <option>encrypted</option>
54353 condition can be used to test for specific cipher suites in ACLs.
54354 </para>
54355 <para>
54356 Once TLS has been established, the ACLs that run for subsequent SMTP commands
54357 can check the name of the cipher suite and vary their actions accordingly. The
54358 cipher suite names vary, depending on which TLS library is being used. For
54359 example, OpenSSL uses the name DES-CBC3-SHA for the cipher suite which in other
54360 contexts is known as TLS_RSA_WITH_3DES_EDE_CBC_SHA. Check the OpenSSL or GnuTLS
54361 documentation for more details.
54362 </para>
54363 <para>
54364 For outgoing SMTP deliveries, <varname>$tls_out_cipher</varname> is used and logged
54365 (again depending on the <option>tls_cipher</option> log selector).
54366 </para>
54367 </section>
54368 <section id="SECID183">
54369 <title>Requesting and verifying client certificates</title>
54370 <para>
54371 <indexterm role="concept">
54372 <primary>certificate</primary>
54373 <secondary>verification of client</secondary>
54374 </indexterm>
54375 <indexterm role="concept">
54376 <primary>TLS</primary>
54377 <secondary>client certificate verification</secondary>
54378 </indexterm>
54379 If you want an Exim server to request a certificate when negotiating a TLS
54380 session with a client, you must set either <option>tls_verify_hosts</option> or
54381 <option>tls_try_verify_hosts</option>. You can, of course, set either of them to * to
54382 apply to all TLS connections. For any host that matches one of these options,
54383 Exim requests a certificate as part of the setup of the TLS session. The
54384 contents of the certificate are verified by comparing it with a list of
54385 expected trust-anchors or certificates.
54386 These may be the system default set (depending on library version),
54387 an explicit file or,
54388 depending on library version, a directory, identified by
54389 <option>tls_verify_certificates</option>.
54390 </para>
54391 <para>
54392 A file can contain multiple certificates, concatenated end to end. If a
54393 directory is used
54394 (OpenSSL only),
54395 each certificate must be in a separate file, with a name (or a symbolic link)
54396 of the form &lt;<emphasis>hash</emphasis>&gt;.0, where &lt;<emphasis>hash</emphasis>&gt; is a hash value constructed from the
54397 certificate. You can compute the relevant hash by running the command
54398 </para>
54399 <literallayout class="monospaced">
54400 openssl x509 -hash -noout -in /cert/file
54401 </literallayout>
54402 <para>
54403 where <filename>/cert/file</filename> contains a single certificate.
54404 </para>
54405 <para>
54406 There is no checking of names of the client against the certificate
54407 Subject Name or Subject Alternate Names.
54408 </para>
54409 <para>
54410 The difference between <option>tls_verify_hosts</option> and <option>tls_try_verify_hosts</option> is
54411 what happens if the client does not supply a certificate, or if the certificate
54412 does not match any of the certificates in the collection named by
54413 <option>tls_verify_certificates</option>. If the client matches <option>tls_verify_hosts</option>, the
54414 attempt to set up a TLS session is aborted, and the incoming connection is
54415 dropped. If the client matches <option>tls_try_verify_hosts</option>, the (encrypted) SMTP
54416 session continues. ACLs that run for subsequent SMTP commands can detect the
54417 fact that no certificate was verified, and vary their actions accordingly. For
54418 example, you can insist on a certificate before accepting a message for
54419 relaying, but not when the message is destined for local delivery.
54420 </para>
54421 <para>
54422 <indexterm role="variable">
54423 <primary><varname>$tls_in_peerdn</varname></primary>
54424 </indexterm>
54425 When a client supplies a certificate (whether it verifies or not), the value of
54426 the Distinguished Name of the certificate is made available in the variable
54427 <varname>$tls_in_peerdn</varname> during subsequent processing of the message.
54428 </para>
54429 <para>
54430 <indexterm role="concept">
54431 <primary>log</primary>
54432 <secondary>distinguished name</secondary>
54433 </indexterm>
54434 Because it is often a long text string, it is not included in the log line or
54435 <emphasis>Received:</emphasis> header by default. You can arrange for it to be logged, keyed by
54436 <quote>DN=</quote>, by setting the <option>tls_peerdn</option> log selector, and you can use
54437 <option>received_header_text</option> to change the <emphasis>Received:</emphasis> header. When no
54438 certificate is supplied, <varname>$tls_in_peerdn</varname> is empty.
54439 </para>
54440 </section>
54441 <section id="SECID184">
54442 <title>Revoked certificates</title>
54443 <para>
54444 <indexterm role="concept">
54445 <primary>TLS</primary>
54446 <secondary>revoked certificates</secondary>
54447 </indexterm>
54448 <indexterm role="concept">
54449 <primary>revocation list</primary>
54450 </indexterm>
54451 <indexterm role="concept">
54452 <primary>certificate</primary>
54453 <secondary>revocation list</secondary>
54454 </indexterm>
54455 <indexterm role="concept">
54456 <primary>OCSP</primary>
54457 <secondary>stapling</secondary>
54458 </indexterm>
54459 Certificate issuing authorities issue Certificate Revocation Lists (CRLs) when
54460 certificates are revoked. If you have such a list, you can pass it to an Exim
54461 server using the global option called <option>tls_crl</option> and to an Exim client using
54462 an identically named option for the <command>smtp</command> transport. In each case, the value
54463 of the option is expanded and must then be the name of a file that contains a
54464 CRL in PEM format.
54465 The downside is that clients have to periodically re-download a potentially huge
54466 file from every certificate authority they know of.
54467 </para>
54468 <para>
54469 The way with most moving parts at query time is Online Certificate
54470 Status Protocol (OCSP), where the client verifies the certificate
54471 against an OCSP server run by the CA.  This lets the CA track all
54472 usage of the certs.  It requires running software with access to the
54473 private key of the CA, to sign the responses to the OCSP queries.  OCSP
54474 is based on HTTP and can be proxied accordingly.
54475 </para>
54476 <para>
54477 The only widespread OCSP server implementation (known to this writer)
54478 comes as part of OpenSSL and aborts on an invalid request, such as
54479 connecting to the port and then disconnecting.  This requires
54480 re-entering the passphrase each time some random client does this.
54481 </para>
54482 <para>
54483 The third way is OCSP Stapling; in this, the server using a certificate
54484 issued by the CA periodically requests an OCSP proof of validity from
54485 the OCSP server, then serves it up inline as part of the TLS
54486 negotiation.   This approach adds no extra round trips, does not let the
54487 CA track users, scales well with number of certs issued by the CA and is
54488 resilient to temporary OCSP server failures, as long as the server
54489 starts retrying to fetch an OCSP proof some time before its current
54490 proof expires.  The downside is that it requires server support.
54491 </para>
54492 <para>
54493 Unless Exim is built with the support disabled,
54494 or with GnuTLS earlier than version 3.3.16 / 3.4.8
54495 support for OCSP stapling is included.
54496 </para>
54497 <para>
54498 There is a global option called <option>tls_ocsp_file</option>.
54499 The file specified therein is expected to be in DER format, and contain
54500 an OCSP proof.  Exim will serve it as part of the TLS handshake.  This
54501 option will be re-expanded for SNI, if the <option>tls_certificate</option> option
54502 contains <literal>tls_in_sni</literal>, as per other TLS options.
54503 </para>
54504 <para>
54505 Exim does not at this time implement any support for fetching a new OCSP
54506 proof.  The burden is on the administrator to handle this, outside of
54507 Exim.  The file specified should be replaced atomically, so that the
54508 contents are always valid.  Exim will expand the <option>tls_ocsp_file</option> option
54509 on each connection, so a new file will be handled transparently on the
54510 next connection.
54511 </para>
54512 <para>
54513 When built with OpenSSL Exim will check for a valid next update timestamp
54514 in the OCSP proof; if not present, or if the proof has expired, it will be
54515 ignored.
54516 </para>
54517 <para>
54518 For the client to be able to verify the stapled OCSP the server must
54519 also supply, in its stapled information, any intermediate
54520 certificates for the chain leading to the OCSP proof from the signer
54521 of the server certificate.  There may be zero or one such. These
54522 intermediate certificates should be added to the server OCSP stapling
54523 file named by <option>tls_ocsp_file</option>.
54524 </para>
54525 <para>
54526 Note that the proof only covers the terminal server certificate,
54527 not any of the chain from CA to it.
54528 </para>
54529 <para>
54530 There is no current way to staple a proof for a client certificate.
54531 </para>
54532 <literallayout class="monospaced">
54533   A helper script "ocsp_fetch.pl" for fetching a proof from a CA
54534   OCSP server is supplied.  The server URL may be included in the
54535   server certificate, if the CA is helpful.
54536
54537   One failure mode seen was the OCSP Signer cert expiring before the end
54538   of validity of the OCSP proof. The checking done by Exim/OpenSSL
54539   noted this as invalid overall, but the re-fetch script did not.
54540 </literallayout>
54541 </section>
54542 <section id="SECID185">
54543 <title>Configuring an Exim client to use TLS</title>
54544 <para>
54545 <indexterm role="concept">
54546 <primary>cipher</primary>
54547 <secondary>logging</secondary>
54548 </indexterm>
54549 <indexterm role="concept">
54550 <primary>log</primary>
54551 <secondary>TLS cipher</secondary>
54552 </indexterm>
54553 <indexterm role="concept">
54554 <primary>log</primary>
54555 <secondary>distinguished name</secondary>
54556 </indexterm>
54557 <indexterm role="concept">
54558 <primary>TLS</primary>
54559 <secondary>configuring an Exim client</secondary>
54560 </indexterm>
54561 The <option>tls_cipher</option> and <option>tls_peerdn</option> log selectors apply to outgoing SMTP
54562 deliveries as well as to incoming, the latter one causing logging of the
54563 server certificate&#x2019;s DN. The remaining client configuration for TLS is all
54564 within the <command>smtp</command> transport.
54565 </para>
54566 <para>
54567 It is not necessary to set any options to have TLS work in the <command>smtp</command>
54568 transport. If Exim is built with TLS support, and TLS is advertised by a
54569 server, the <command>smtp</command> transport always tries to start a TLS session. However,
54570 this can be prevented by setting <option>hosts_avoid_tls</option> (an option of the
54571 transport) to a list of server hosts for which TLS should not be used.
54572 </para>
54573 <para>
54574 If you do not want Exim to attempt to send messages unencrypted when an attempt
54575 to set up an encrypted connection fails in any way, you can set
54576 <option>hosts_require_tls</option> to a list of hosts for which encryption is mandatory. For
54577 those hosts, delivery is always deferred if an encrypted connection cannot be
54578 set up. If there are any other hosts for the address, they are tried in the
54579 usual way.
54580 </para>
54581 <para>
54582 When the server host is not in <option>hosts_require_tls</option>, Exim may try to deliver
54583 the message unencrypted. It always does this if the response to STARTTLS is
54584 a 5<emphasis>xx</emphasis> code. For a temporary error code, or for a failure to negotiate a TLS
54585 session after a success response code, what happens is controlled by the
54586 <option>tls_tempfail_tryclear</option> option of the <command>smtp</command> transport. If it is false,
54587 delivery to this host is deferred, and other hosts (if available) are tried. If
54588 it is true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis> response to
54589 STARTTLS, and if STARTTLS is accepted, but the subsequent TLS
54590 negotiation fails, Exim closes the current connection (because it is in an
54591 unknown state), opens a new one to the same host, and then tries the delivery
54592 unencrypted.
54593 </para>
54594 <para>
54595 The <option>tls_certificate</option> and <option>tls_privatekey</option> options of the <command>smtp</command>
54596 transport provide the client with a certificate, which is passed to the server
54597 if it requests it. If the server is Exim, it will request a certificate only if
54598 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> matches the client.
54599 </para>
54600 <para>
54601 If the <option>tls_verify_certificates</option> option is set on the <command>smtp</command> transport, it
54602 specifies a collection of expected server certificates.
54603 These may be
54604 the system default set (depending on library version),
54605 a file,
54606 or (depending on library version) a directory.
54607 The client verifies the server&#x2019;s certificate
54608 against this collection, taking into account any revoked certificates that are
54609 in the list defined by <option>tls_crl</option>.
54610 Failure to verify fails the TLS connection unless either of the
54611 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> options are set.
54612 </para>
54613 <para>
54614 The <option>tls_verify_hosts</option> and <option>tls_try_verify_hosts</option> options restrict
54615 certificate verification to the listed servers.  Verification either must
54616 or need not succeed respectively.
54617 </para>
54618 <para>
54619 The <option>tls_verify_cert_hostnames</option> option lists hosts for which additional
54620 checks are made: that the host name (the one in the DNS A record)
54621 is valid for the certificate.
54622 The option defaults to always checking.
54623 </para>
54624 <para>
54625 The <command>smtp</command> transport has two OCSP-related options:
54626 <option>hosts_require_ocsp</option>; a host-list for which a Certificate Status
54627 is requested and required for the connection to proceed.  The default
54628 value is empty.
54629 <option>hosts_request_ocsp</option>; a host-list for which (additionally)
54630 a Certificate Status is requested (but not necessarily verified).  The default
54631 value is "*" meaning that requests are made unless configured
54632 otherwise.
54633 </para>
54634 <para>
54635 The host(s) should also be in <option>hosts_require_tls</option>, and
54636 <option>tls_verify_certificates</option> configured for the transport,
54637 for OCSP to be relevant.
54638 </para>
54639 <para>
54640 If
54641 <option>tls_require_ciphers</option> is set on the <command>smtp</command> transport, it must contain a
54642 list of permitted cipher suites. If either of these checks fails, delivery to
54643 the current host is abandoned, and the <command>smtp</command> transport tries to deliver to
54644 alternative hosts, if any.
54645 </para>
54646 <para>
54647  <emphasis role="bold">Note</emphasis>:
54648 These options must be set in the <command>smtp</command> transport for Exim to use TLS when it
54649 is operating as a client. Exim does not assume that a server certificate (set
54650 by the global options of the same name) should also be used when operating as a
54651 client.
54652 </para>
54653 <para>
54654 <indexterm role="variable">
54655 <primary><varname>$host</varname></primary>
54656 </indexterm>
54657 <indexterm role="variable">
54658 <primary><varname>$host_address</varname></primary>
54659 </indexterm>
54660 All the TLS options in the <command>smtp</command> transport are expanded before use, with
54661 <varname>$host</varname> and <varname>$host_address</varname> containing the name and address of the server to
54662 which the client is connected. Forced failure of an expansion causes Exim to
54663 behave as if the relevant option were unset.
54664 </para>
54665 <para>
54666 <indexterm role="variable">
54667 <primary><varname>$tls_out_bits</varname></primary>
54668 </indexterm>
54669 <indexterm role="variable">
54670 <primary><varname>$tls_out_cipher</varname></primary>
54671 </indexterm>
54672 <indexterm role="variable">
54673 <primary><varname>$tls_out_peerdn</varname></primary>
54674 </indexterm>
54675 <indexterm role="variable">
54676 <primary><varname>$tls_out_sni</varname></primary>
54677 </indexterm>
54678 Before an SMTP connection is established, the
54679 <varname>$tls_out_bits</varname>, <varname>$tls_out_cipher</varname>, <varname>$tls_out_peerdn</varname> and <varname>$tls_out_sni</varname>
54680 variables are emptied. (Until the first connection, they contain the values
54681 that were set when the message was received.) If STARTTLS is subsequently
54682 successfully obeyed, these variables are set to the relevant values for the
54683 outgoing connection.
54684 </para>
54685 </section>
54686 <section id="SECTtlssni">
54687 <title>Use of TLS Server Name Indication</title>
54688 <para>
54689 <indexterm role="concept">
54690 <primary>TLS</primary>
54691 <secondary>Server Name Indication</secondary>
54692 </indexterm>
54693 <indexterm role="variable">
54694 <primary><varname>$tls_in_sni</varname></primary>
54695 </indexterm>
54696 <indexterm role="option">
54697 <primary><option>tls_in_sni</option></primary>
54698 </indexterm>
54699 With TLS1.0 or above, there is an extension mechanism by which extra
54700 information can be included at various points in the protocol.  One of these
54701 extensions, documented in RFC 6066 (and before that RFC 4366) is
54702 <quote>Server Name Indication</quote>, commonly <quote>SNI</quote>.  This extension is sent by the
54703 client in the initial handshake, so that the server can examine the servername
54704 within and possibly choose to use different certificates and keys (and more)
54705 for this session.
54706 </para>
54707 <para>
54708 This is analogous to HTTP&#x2019;s <quote>Host:</quote> header, and is the main mechanism by
54709 which HTTPS-enabled web-sites can be virtual-hosted, many sites to one IP
54710 address.
54711 </para>
54712 <para>
54713 With SMTP to MX, there are the same problems here as in choosing the identity
54714 against which to validate a certificate: you can&#x2019;t rely on insecure DNS to
54715 provide the identity which you then cryptographically verify.  So this will
54716 be of limited use in that environment.
54717 </para>
54718 <para>
54719 With SMTP to Submission, there is a well-defined hostname which clients are
54720 connecting to and can validate certificates against.  Thus clients <emphasis role="bold">can</emphasis>
54721 choose to include this information in the TLS negotiation.  If this becomes
54722 wide-spread, then hosters can choose to present different certificates to
54723 different clients.  Or even negotiate different cipher suites.
54724 </para>
54725 <para>
54726 The <option>tls_sni</option> option on an SMTP transport is an expanded string; the result,
54727 if not empty, will be sent on a TLS session as part of the handshake.  There&#x2019;s
54728 nothing more to it.  Choosing a sensible value not derived insecurely is the
54729 only point of caution.  The <varname>$tls_out_sni</varname> variable will be set to this string
54730 for the lifetime of the client connection (including during authentication).
54731 </para>
54732 <para>
54733 Except during SMTP client sessions, if <varname>$tls_in_sni</varname> is set then it is a string
54734 received from a client.
54735 It can be logged with the <option>log_selector</option> item <literal>+tls_sni</literal>.
54736 </para>
54737 <para>
54738 If the string <literal>tls_in_sni</literal> appears in the main section&#x2019;s <option>tls_certificate</option>
54739 option (prior to expansion) then the following options will be re-expanded
54740 during TLS session handshake, to permit alternative values to be chosen:
54741 </para>
54742 <itemizedlist>
54743 <listitem>
54744 <para>
54745 <option>tls_certificate</option>
54746 </para>
54747 </listitem>
54748 <listitem>
54749 <para>
54750 <option>tls_crl</option>
54751 </para>
54752 </listitem>
54753 <listitem>
54754 <para>
54755 <option>tls_privatekey</option>
54756 </para>
54757 </listitem>
54758 <listitem>
54759 <para>
54760 <option>tls_verify_certificates</option>
54761 </para>
54762 </listitem>
54763 <listitem>
54764 <para>
54765 <option>tls_ocsp_file</option>
54766 </para>
54767 </listitem>
54768 </itemizedlist>
54769 <para>
54770 Great care should be taken to deal with matters of case, various injection
54771 attacks in the string (<literal>../</literal> or SQL), and ensuring that a valid filename
54772 can always be referenced; it is important to remember that <varname>$tls_in_sni</varname> is
54773 arbitrary unverified data provided prior to authentication.
54774 Further, the initial certificate is loaded before SNI is arrived, so
54775 an expansion for <option>tls_certificate</option> must have a default which is used
54776 when <varname>$tls_in_sni</varname> is empty.
54777 </para>
54778 <para>
54779 The Exim developers are proceeding cautiously and so far no other TLS options
54780 are re-expanded.
54781 </para>
54782 <para>
54783 When Exim is built against OpenSSL, OpenSSL must have been built with support
54784 for TLS Extensions.  This holds true for OpenSSL 1.0.0+ and 0.9.8+ with
54785 enable-tlsext in EXTRACONFIGURE.  If you invoke <command>openssl s_client -h</command> and
54786 see <literal>-servername</literal> in the output, then OpenSSL has support.
54787 </para>
54788 <para>
54789 When Exim is built against GnuTLS, SNI support is available as of GnuTLS
54790 0.5.10.  (Its presence predates the current API which Exim uses, so if Exim
54791 built, then you have SNI support).
54792 </para>
54793 </section>
54794 <section id="SECTmulmessam">
54795 <title>Multiple messages on the same encrypted TCP/IP connection</title>
54796 <para>
54797 <indexterm role="concept">
54798 <primary>multiple SMTP deliveries with TLS</primary>
54799 </indexterm>
54800 <indexterm role="concept">
54801 <primary>TLS</primary>
54802 <secondary>multiple message deliveries</secondary>
54803 </indexterm>
54804 Exim sends multiple messages down the same TCP/IP connection by starting up
54805 an entirely new delivery process for each message, passing the socket from
54806 one process to the next. This implementation does not fit well with the use
54807 of TLS, because there is quite a lot of state information associated with a TLS
54808 connection, not just a socket identification. Passing all the state information
54809 to a new process is not feasible. Consequently, for sending using TLS Exim
54810 starts an additional proxy process for handling the encryption, piping the
54811 unencrypted data stream from and to the delivery processes.
54812 </para>
54813 <para>
54814 An older mode of operation can be enabled on a per-host basis by the
54815 <option>hosts_noproxy_tls</option> option on the <command>smtp</command> transport.  If the host matches
54816 this list the proxy process described above is not used; instead Exim
54817 shuts down an existing TLS session being run by the delivery process
54818 before passing the socket to a new process. The new process may then
54819 try to start a new TLS session, and if successful, may try to re-authenticate
54820 if AUTH is in use, before sending the next message.
54821 </para>
54822 <para>
54823 The RFC is not clear as to whether or not an SMTP session continues in clear
54824 after TLS has been shut down, or whether TLS may be restarted again later, as
54825 just described. However, if the server is Exim, this shutdown and
54826 reinitialization works. It is not known which (if any) other servers operate
54827 successfully if the client closes a TLS session and continues with unencrypted
54828 SMTP, but there are certainly some that do not work. For such servers, Exim
54829 should not pass the socket to another process, because the failure of the
54830 subsequent attempt to use it would cause Exim to record a temporary host error,
54831 and delay other deliveries to that host.
54832 </para>
54833 <para>
54834 To test for this case, Exim sends an EHLO command to the server after
54835 closing down the TLS session. If this fails in any way, the connection is
54836 closed instead of being passed to a new delivery process, but no retry
54837 information is recorded.
54838 </para>
54839 <para>
54840 There is also a manual override; you can set <option>hosts_nopass_tls</option> on the
54841 <command>smtp</command> transport to match those hosts for which Exim should not pass
54842 connections to new processes if TLS has been used.
54843 </para>
54844 </section>
54845 <section id="SECTcerandall">
54846 <title>Certificates and all that</title>
54847 <para>
54848 <indexterm role="concept">
54849 <primary>certificate</primary>
54850 <secondary>references to discussion</secondary>
54851 </indexterm>
54852 In order to understand fully how TLS works, you need to know about
54853 certificates, certificate signing, and certificate authorities.
54854 This is a large topic and an introductory guide is unsuitable for the Exim
54855 reference manual, so instead we provide pointers to existing documentation.
54856 </para>
54857 <para>
54858 The Apache web-server was for a long time the canonical guide, so their
54859 documentation is a good place to start; their SSL module&#x2019;s Introduction
54860 document is currently at
54861 </para>
54862 <literallayout>
54863 <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>
54864 </literallayout>
54865 <para>
54866 and their FAQ is at
54867 </para>
54868 <literallayout>
54869 <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>
54870 </literallayout>
54871 <para>
54872 Eric Rescorla&#x2019;s book, <emphasis>SSL and TLS</emphasis>, published by Addison-Wesley (ISBN
54873 0-201-61598-3) in 2001, contains both introductory and more in-depth
54874 descriptions.
54875 More recently Ivan Ristić&#x2019;s book <emphasis>Bulletproof SSL and TLS</emphasis>,
54876 published by Feisty Duck (ISBN 978-1907117046) in 2013 is good.
54877 Ivan is the author of the popular TLS testing tools at
54878 <emphasis role="bold"><ulink url="https://www.ssllabs.com/">https://www.ssllabs.com/</ulink></emphasis>.
54879 </para>
54880 </section>
54881 <section id="SECID186">
54882 <title>Certificate chains</title>
54883 <para>
54884 The file named by <option>tls_certificate</option> may contain more than one
54885 certificate. This is useful in the case where the certificate that is being
54886 sent is validated by an intermediate certificate which the other end does
54887 not have. Multiple certificates must be in the correct order in the file.
54888 First the host&#x2019;s certificate itself, then the first intermediate
54889 certificate to validate the issuer of the host certificate, then the next
54890 intermediate certificate to validate the issuer of the first intermediate
54891 certificate, and so on, until finally (optionally) the root certificate.
54892 The root certificate must already be trusted by the recipient for
54893 validation to succeed, of course, but if it&#x2019;s not preinstalled, sending the
54894 root certificate along with the rest makes it available for the user to
54895 install if the receiving end is a client MUA that can interact with a user.
54896 </para>
54897 <para>
54898 Note that certificates using MD5 are unlikely to work on today&#x2019;s Internet;
54899 even if your libraries allow loading them for use in Exim when acting as a
54900 server, increasingly clients will not accept such certificates.  The error
54901 diagnostics in such a case can be frustratingly vague.
54902 </para>
54903 </section>
54904 <section id="SECID187">
54905 <title>Self-signed certificates</title>
54906 <para>
54907 <indexterm role="concept">
54908 <primary>certificate</primary>
54909 <secondary>self-signed</secondary>
54910 </indexterm>
54911 You can create a self-signed certificate using the <emphasis>req</emphasis> command provided
54912 with OpenSSL, like this:
54913 </para>
54914 <literallayout class="monospaced">
54915 openssl req -x509 -newkey rsa:1024 -keyout file1 -out file2 \
54916             -days 9999 -nodes
54917 </literallayout>
54918 <para>
54919 <filename>file1</filename> and <filename>file2</filename> can be the same file; the key and the certificate are
54920 delimited and so can be identified independently. The <option>-days</option> option
54921 specifies a period for which the certificate is valid. The <option>-nodes</option> option is
54922 important: if you do not set it, the key is encrypted with a passphrase
54923 that you are prompted for, and any use that is made of the key causes more
54924 prompting for the passphrase. This is not helpful if you are going to use
54925 this certificate and key in an MTA, where prompting is not possible.
54926 </para>
54927 <para>
54928 NB: we are now past the point where 9999 days takes us past the 32-bit Unix
54929 epoch.  If your system uses unsigned time_t (most do) and is 32-bit, then
54930 the above command might produce a date in the past.  Think carefully about
54931 the lifetime of the systems you&#x2019;re deploying, and either reduce the duration
54932 of the certificate or reconsider your platform deployment.  (At time of
54933 writing, reducing the duration is the most likely choice, but the inexorable
54934 progression of time takes us steadily towards an era where this will not
54935 be a sensible resolution).
54936 </para>
54937 <para>
54938 A self-signed certificate made in this way is sufficient for testing, and
54939 may be adequate for all your requirements if you are mainly interested in
54940 encrypting transfers, and not in secure identification.
54941 </para>
54942 <para>
54943 However, many clients require that the certificate presented by the server be a
54944 user (also called <quote>leaf</quote> or <quote>site</quote>) certificate, and not a self-signed
54945 certificate. In this situation, the self-signed certificate described above
54946 must be installed on the client host as a trusted root <emphasis>certification
54947 authority</emphasis> (CA), and the certificate used by Exim must be a user certificate
54948 signed with that self-signed certificate.
54949 </para>
54950 <para>
54951 For information on creating self-signed CA certificates and using them to sign
54952 user certificates, see the <emphasis>General implementation overview</emphasis> chapter of the
54953 Open-source PKI book, available online at
54954 <emphasis role="bold"><ulink url="https://sourceforge.net/projects/ospkibook/">https://sourceforge.net/projects/ospkibook/</ulink></emphasis>.
54955 <indexterm role="concept" startref="IIDencsmtp1" class="endofrange"/>
54956 <indexterm role="concept" startref="IIDencsmtp2" class="endofrange"/>
54957 </para>
54958 </section>
54959 <section id="SECDANE">
54960 <title>DANE</title>
54961 <para>
54962 <indexterm role="concept">
54963 <primary>DANE</primary>
54964 </indexterm>
54965 DNS-based Authentication of Named Entities, as applied to SMTP over TLS, provides assurance to a client that
54966 it is actually talking to the server it wants to rather than some attacker operating a Man In The Middle (MITM)
54967 operation.  The latter can terminate the TLS connection you make, and make another one to the server (so both
54968 you and the server still think you have an encrypted connection) and, if one of the "well known" set of
54969 Certificate Authorities has been suborned - something which *has* been seen already (2014), a verifiable
54970 certificate (if you&#x2019;re using normal root CAs, eg. the Mozilla set, as your trust anchors).
54971 </para>
54972 <para>
54973 What DANE does is replace the CAs with the DNS as the trust anchor.  The assurance is limited to a) the possibility
54974 that the DNS has been suborned, b) mistakes made by the admins of the target server.   The attack surface presented
54975 by (a) is thought to be smaller than that of the set of root CAs.
54976 </para>
54977 <para>
54978 It also allows the server to declare (implicitly) that connections to it should use TLS.  An MITM could simply
54979 fail to pass on a server&#x2019;s STARTTLS.
54980 </para>
54981 <para>
54982 DANE scales better than having to maintain (and side-channel communicate) copies of server certificates
54983 for every possible target server.  It also scales (slightly) better than having to maintain on an SMTP
54984 client a copy of the standard CAs bundle.  It also means not having to pay a CA for certificates.
54985 </para>
54986 <para>
54987 DANE requires a server operator to do three things: 1) run DNSSEC.  This provides assurance to clients
54988 that DNS lookups they do for the server have not been tampered with.  The domain MX record applying
54989 to this server, its A record, its TLSA record and any associated CNAME records must all be covered by
54990 DNSSEC.
54991 2) add TLSA DNS records.  These say what the server certificate for a TLS connection should be.
54992 3) offer a server certificate, or certificate chain, in TLS connections which is is anchored by one of the TLSA records.
54993 </para>
54994 <para>
54995 There are no changes to Exim specific to server-side operation of DANE.
54996 Support for client-side operation of DANE can be included at compile time by defining SUPPORT_DANE=yes
54997 in <filename>Local/Makefile</filename>.
54998 If it has been included, the macro "_HAVE_DANE" will be defined.
54999 </para>
55000 <para>
55001 The TLSA record for the server may have "certificate usage" of DANE-TA(2) or DANE-EE(3).
55002 These are the "Trust Anchor" and "End Entity" variants.
55003 The latter specifies the End Entity directly, i.e. the certificate involved is that of the server
55004 (and if only DANE-EE is used then it should be the sole one transmitted during the TLS handshake);
55005 this is appropriate for a single system, using a self-signed certificate.
55006 DANE-TA usage is effectively declaring a specific CA to be used; this might be a private CA or a public,
55007 well-known one.
55008 A private CA at simplest is just a self-signed certificate (with certain
55009 attributes) which is used to sign server certificates, but running one securely
55010 does require careful arrangement.
55011 With DANE-TA, as implemented in Exim and commonly in other MTAs,
55012 the server TLS handshake must transmit the entire certificate chain from CA to server-certificate.
55013 DANE-TA is commonly used for several services and/or servers, each having a TLSA query-domain CNAME record,
55014 all of which point to a single TLSA record.
55015 DANE-TA and DANE-EE can both be used together.
55016 </para>
55017 <para revisionflag="changed">
55018 Our recommendation is to use DANE with a certificate from a public CA,
55019 because this enables a variety of strategies for remote clients to verify
55020 your certificate.
55021 You can then publish information both via DANE and another technology,
55022 "MTA-STS", described below.
55023 </para>
55024 <para revisionflag="changed">
55025 When you use DANE-TA to publish trust anchor information, you ask entities
55026 outside your administrative control to trust the Certificate Authority for
55027 connections to you.
55028 If using a private CA then you should expect others to still apply the
55029 technical criteria they&#x2019;d use for a public CA to your certificates.
55030 In particular, you should probably try to follow current best practices for CA
55031 operation around hash algorithms and key sizes.
55032 Do not expect other organizations to lower their security expectations just
55033 because a particular profile might be reasonable for your own internal use.
55034 </para>
55035 <para revisionflag="changed">
55036 When this text was last updated, this in practice means to avoid use of SHA-1
55037 and MD5; if using RSA to use key sizes of at least 2048 bits (and no larger
55038 than 4096, for interoperability); to use keyUsage fields correctly; to use
55039 random serial numbers.
55040 The list of requirements is subject to change as best practices evolve.
55041 If you&#x2019;re not already using a private CA, or it doesn&#x2019;t meet these
55042 requirements, then we encourage you to avoid all these issues and use a public
55043 CA such as <emphasis role="bold"><ulink url="https://letsencrypt.org/">Let&#x2019;s Encrypt</ulink></emphasis> instead.
55044 </para>
55045 <para>
55046 The TLSA record should have a Selector field of SPKI(1) and a Matching Type field of SHA2-512(2).
55047 </para>
55048 <para>
55049 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>
55050 is useful for quickly generating TLSA records; and commands like
55051 </para>
55052 <literallayout class="monospaced">
55053   openssl x509 -in -pubkey -noout &lt;certificate.pem \
55054   | openssl rsa -outform der -pubin 2&gt;/dev/null \
55055   | openssl sha512 \
55056   | awk '{print $2}'
55057 </literallayout>
55058 <para>
55059 are workable for 4th-field hashes.
55060 </para>
55061 <para>
55062 For use with the DANE-TA model, server certificates must have a correct name (SubjectName or SubjectAltName).
55063 </para>
55064 <para revisionflag="changed">
55065 The Certificate issued by the CA published in the DANE-TA model should be
55066 issued using a strong hash algorithm.
55067 Exim, and importantly various other MTAs sending to you, will not
55068 re-enable hash algorithms which have been disabled by default in TLS
55069 libraries.
55070 This means no MD5 and no SHA-1.  SHA2-256 is the minimum for reliable
55071 interoperability (and probably the maximum too, in 2018).
55072 </para>
55073 <para>
55074 The use of OCSP-stapling should be considered, allowing for fast revocation of certificates (which would otherwise
55075 be limited by the DNS TTL on the TLSA records).  However, this is likely to only be usable with DANE-TA.  NOTE: the
55076 default of requesting OCSP for all hosts is modified iff DANE is in use, to:
55077 </para>
55078 <literallayout class="monospaced">
55079   hosts_request_ocsp = ${if or { {= {0}{$tls_out_tlsa_usage}} \
55080                                  {= {4}{$tls_out_tlsa_usage}} } \
55081                          {*}{}}
55082 </literallayout>
55083 <para>
55084 The (new) variable <varname>$tls_out_tlsa_usage</varname> is a bitfield with numbered bits set for TLSA record usage codes.
55085 The zero above means DANE was not in use, the four means that only DANE-TA usage TLSA records were
55086 found. If the definition of <option>hosts_request_ocsp</option> includes the
55087 string "tls_out_tlsa_usage", they are re-expanded in time to
55088 control the OCSP request.
55089 </para>
55090 <para>
55091 This modification of hosts_request_ocsp is only done if it has the default value of "*".  Admins who change it, and
55092 those who use <option>hosts_require_ocsp</option>, should consider the interaction with DANE in their OCSP settings.
55093 </para>
55094 <para>
55095 For client-side DANE there are three new smtp transport options, <option>hosts_try_dane</option>, <option>hosts_require_dane</option>
55096 and <option>dane_require_tls_ciphers</option>.
55097 The require variant will result in failure if the target host is not DNSSEC-secured.
55098 </para>
55099 <para>
55100 DANE will only be usable if the target host has DNSSEC-secured MX, A and TLSA records.
55101 </para>
55102 <para>
55103 A TLSA lookup will be done if either of the above options match and the host-lookup succeeded using dnssec.
55104 If a TLSA lookup is done and succeeds, a DANE-verified TLS connection
55105 will be required for the host.  If it does not, the host will not
55106 be used; there is no fallback to non-DANE or non-TLS.
55107 </para>
55108 <para>
55109 If DANE is requested and usable, then the TLS cipher list configuration
55110 prefers to use the option <option>dane_require_tls_ciphers</option> and falls
55111 back to <option>tls_require_ciphers</option> only if that is unset.
55112 This lets you configure "decent crypto" for DANE and "better than nothing
55113 crypto" as the default.  Note though that while GnuTLS lets the string control
55114 which versions of TLS/SSL will be negotiated, OpenSSL does not and you&#x2019;re
55115 limited to ciphersuite constraints.
55116 </para>
55117 <para>
55118 If DANE is requested and useable (see above) the following transport options are ignored:
55119 </para>
55120 <literallayout class="monospaced">
55121   hosts_require_tls
55122   tls_verify_hosts
55123   tls_try_verify_hosts
55124   tls_verify_certificates
55125   tls_crl
55126   tls_verify_cert_hostnames
55127 </literallayout>
55128 <para>
55129 If DANE is not usable, whether requested or not, and CA-anchored
55130 verification evaluation is wanted, the above variables should be set appropriately.
55131 </para>
55132 <para>
55133 Currently the <option>dnssec_request_domains</option> must be active and <option>dnssec_require_domains</option> is ignored.
55134 </para>
55135 <para>
55136 If verification was successful using DANE then the "CV" item in the delivery log line will show as "CV=dane".
55137 </para>
55138 <para>
55139 There is a new variable <varname>$tls_out_dane</varname> which will have "yes" if
55140 verification succeeded using DANE and "no" otherwise (only useful
55141 in combination with events; see <xref linkend="CHAPevents"/>),
55142 and a new variable <varname>$tls_out_tlsa_usage</varname> (detailed above).
55143 </para>
55144 <para>
55145 <indexterm role="concept">
55146 <primary>DANE</primary>
55147 <secondary>reporting</secondary>
55148 </indexterm>
55149 An event (see <xref linkend="CHAPevents"/>) of type "dane:fail" will be raised on failures
55150 to achieve DANE-verified connection, if one was either requested and offered, or
55151 required.  This is intended to support TLS-reporting as defined in
55152 <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>.
55153 The <varname>$event_data</varname> will be one of the Result Types defined in
55154 Section 4.3 of that document.
55155 </para>
55156 <para>
55157 Under GnuTLS, DANE is only supported from version 3.0.0 onwards.
55158 </para>
55159 <para>
55160 DANE is specified in published RFCs and decouples certificate authority trust
55161 selection from a "race to the bottom" of "you must trust everything for mail
55162 to get through".  There is an alternative technology called MTA-STS, which
55163 instead publishes MX trust anchor information on an HTTPS website.  At the
55164 time this text was last updated, MTA-STS was still a draft, not yet an RFC.
55165 Exim has no support for MTA-STS as a client, but Exim mail server operators
55166 can choose to publish information describing their TLS configuration using
55167 MTA-STS to let those clients who do use that protocol derive trust
55168 information.
55169 </para>
55170 <para>
55171 The MTA-STS design requires a certificate from a public Certificate Authority
55172 which is recognized by clients sending to you.
55173 That selection of which CAs are trusted by others is outside your control.
55174 </para>
55175 <para>
55176 The most interoperable course of action is probably to use
55177 <emphasis role="bold"><ulink url="https://letsencrypt.org/">Let&#x2019;s Encrypt</ulink></emphasis>, with automated certificate
55178 renewal; to publish the anchor information in DNSSEC-secured DNS via TLSA
55179 records for DANE clients (such as Exim and Postfix) and to publish anchor
55180 information for MTA-STS as well.  This is what is done for the <emphasis>exim.org</emphasis>
55181 domain itself (with caveats around occasionally broken MTA-STS because of
55182 incompatible specification changes prior to reaching RFC status).
55183 </para>
55184 </section>
55185 </chapter>
55186
55187 <chapter id="CHAPACL">
55188 <title>Access control lists</title>
55189 <para>
55190 <indexterm role="concept" id="IIDacl" class="startofrange">
55191 <primary>access control lists (ACLs)</primary>
55192 <secondary>description</secondary>
55193 </indexterm>
55194 <indexterm role="concept">
55195 <primary>control of incoming mail</primary>
55196 </indexterm>
55197 <indexterm role="concept">
55198 <primary>message</primary>
55199 <secondary>controlling incoming</secondary>
55200 </indexterm>
55201 <indexterm role="concept">
55202 <primary>policy control</primary>
55203 <secondary>access control lists</secondary>
55204 </indexterm>
55205 Access Control Lists (ACLs) are defined in a separate section of the runtime
55206 configuration file, headed by <quote>begin acl</quote>. Each ACL definition starts with a
55207 name, terminated by a colon. Here is a complete ACL section that contains just
55208 one very small ACL:
55209 </para>
55210 <literallayout class="monospaced">
55211 begin acl
55212 small_acl:
55213   accept   hosts = one.host.only
55214 </literallayout>
55215 <para>
55216 You can have as many lists as you like in the ACL section, and the order in
55217 which they appear does not matter. The lists are self-terminating.
55218 </para>
55219 <para>
55220 The majority of ACLs are used to control Exim&#x2019;s behaviour when it receives
55221 certain SMTP commands. This applies both to incoming TCP/IP connections, and
55222 when a local process submits a message using SMTP by specifying the <option>-bs</option>
55223 option. The most common use is for controlling which recipients are accepted
55224 in incoming messages. In addition, you can define an ACL that is used to check
55225 local non-SMTP messages. The default configuration file contains an example of
55226 a realistic ACL for checking RCPT commands. This is discussed in chapter
55227 <xref linkend="CHAPdefconfil"/>.
55228 </para>
55229 <section id="SECID188">
55230 <title>Testing ACLs</title>
55231 <para>
55232 The <option>-bh</option> command line option provides a way of testing your ACL
55233 configuration locally by running a fake SMTP session with which you interact.
55234 </para>
55235 </section>
55236 <section id="SECID189">
55237 <title>Specifying when ACLs are used</title>
55238 <para>
55239 <indexterm role="concept">
55240 <primary>access control lists (ACLs)</primary>
55241 <secondary>options for specifying</secondary>
55242 </indexterm>
55243 In order to cause an ACL to be used, you have to name it in one of the relevant
55244 options in the main part of the configuration. These options are:
55245 <indexterm role="concept">
55246 <primary>AUTH</primary>
55247 <secondary>ACL for</secondary>
55248 </indexterm>
55249 <indexterm role="concept">
55250 <primary>DATA</primary>
55251 <secondary>ACLs for</secondary>
55252 </indexterm>
55253 <indexterm role="concept">
55254 <primary>ETRN</primary>
55255 <secondary>ACL for</secondary>
55256 </indexterm>
55257 <indexterm role="concept">
55258 <primary>EXPN</primary>
55259 <secondary>ACL for</secondary>
55260 </indexterm>
55261 <indexterm role="concept">
55262 <primary>HELO</primary>
55263 <secondary>ACL for</secondary>
55264 </indexterm>
55265 <indexterm role="concept">
55266 <primary>EHLO</primary>
55267 <secondary>ACL for</secondary>
55268 </indexterm>
55269 <indexterm role="concept">
55270 <primary>DKIM</primary>
55271 <secondary>ACL for</secondary>
55272 </indexterm>
55273 <indexterm role="concept">
55274 <primary>MAIL</primary>
55275 <secondary>ACL for</secondary>
55276 </indexterm>
55277 <indexterm role="concept">
55278 <primary>QUIT, ACL for</primary>
55279 </indexterm>
55280 <indexterm role="concept">
55281 <primary>RCPT</primary>
55282 <secondary>ACL for</secondary>
55283 </indexterm>
55284 <indexterm role="concept">
55285 <primary>STARTTLS, ACL for</primary>
55286 </indexterm>
55287 <indexterm role="concept">
55288 <primary>VRFY</primary>
55289 <secondary>ACL for</secondary>
55290 </indexterm>
55291 <indexterm role="concept">
55292 <primary>SMTP</primary>
55293 <secondary>connection, ACL for</secondary>
55294 </indexterm>
55295 <indexterm role="concept">
55296 <primary>non-SMTP messages</primary>
55297 <secondary>ACLs for</secondary>
55298 </indexterm>
55299 <indexterm role="concept">
55300 <primary>MIME content scanning</primary>
55301 <secondary>ACL for</secondary>
55302 </indexterm>
55303 <indexterm role="concept">
55304 <primary>PRDR</primary>
55305 <secondary>ACL for</secondary>
55306 </indexterm>
55307 </para>
55308 <informaltable frame="none">
55309 <tgroup cols="2" colsep="0" rowsep="0">
55310 <colspec colwidth="140pt" align="left"/>
55311 <colspec colwidth="254pt" align="left"/>
55312 <tbody>
55313 <row>
55314 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp</option></entry>
55315 <entry>ACL for non-SMTP messages</entry>
55316 </row>
55317 <row>
55318 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp_mime</option></entry>
55319 <entry>ACL for non-SMTP MIME parts</entry>
55320 </row>
55321 <row>
55322 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp_start</option></entry>
55323 <entry>ACL at start of non-SMTP message</entry>
55324 </row>
55325 <row>
55326 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_auth</option></entry>
55327 <entry>ACL for AUTH</entry>
55328 </row>
55329 <row>
55330 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_connect</option></entry>
55331 <entry>ACL for start of SMTP connection</entry>
55332 </row>
55333 <row>
55334 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_data</option></entry>
55335 <entry>ACL after DATA is complete</entry>
55336 </row>
55337 <row>
55338 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_data_prdr</option></entry>
55339 <entry>ACL for each recipient, after DATA is complete</entry>
55340 </row>
55341 <row>
55342 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_dkim</option></entry>
55343 <entry>ACL for each DKIM signer</entry>
55344 </row>
55345 <row>
55346 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_etrn</option></entry>
55347 <entry>ACL for ETRN</entry>
55348 </row>
55349 <row>
55350 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_expn</option></entry>
55351 <entry>ACL for EXPN</entry>
55352 </row>
55353 <row>
55354 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_helo</option></entry>
55355 <entry>ACL for HELO or EHLO</entry>
55356 </row>
55357 <row>
55358 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mail</option></entry>
55359 <entry>ACL for MAIL</entry>
55360 </row>
55361 <row>
55362 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mailauth</option></entry>
55363 <entry>ACL for the AUTH parameter of MAIL</entry>
55364 </row>
55365 <row>
55366 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mime</option></entry>
55367 <entry>ACL for content-scanning MIME parts</entry>
55368 </row>
55369 <row>
55370 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_notquit</option></entry>
55371 <entry>ACL for non-QUIT terminations</entry>
55372 </row>
55373 <row>
55374 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_predata</option></entry>
55375 <entry>ACL at start of DATA command</entry>
55376 </row>
55377 <row>
55378 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_quit</option></entry>
55379 <entry>ACL for QUIT</entry>
55380 </row>
55381 <row>
55382 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_rcpt</option></entry>
55383 <entry>ACL for RCPT</entry>
55384 </row>
55385 <row>
55386 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_starttls</option></entry>
55387 <entry>ACL for STARTTLS</entry>
55388 </row>
55389 <row>
55390 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_vrfy</option></entry>
55391 <entry>ACL for VRFY</entry>
55392 </row>
55393 </tbody>
55394 </tgroup>
55395 </informaltable>
55396 <para>
55397 For example, if you set
55398 </para>
55399 <literallayout class="monospaced">
55400 acl_smtp_rcpt = small_acl
55401 </literallayout>
55402 <para>
55403 the little ACL defined above is used whenever Exim receives a RCPT command
55404 in an SMTP dialogue. The majority of policy tests on incoming messages can be
55405 done when RCPT commands arrive. A rejection of RCPT should cause the
55406 sending MTA to give up on the recipient address contained in the RCPT
55407 command, whereas rejection at other times may cause the client MTA to keep on
55408 trying to deliver the message. It is therefore recommended that you do as much
55409 testing as possible at RCPT time.
55410 </para>
55411 </section>
55412 <section id="SECID190">
55413 <title>The non-SMTP ACLs</title>
55414 <para>
55415 <indexterm role="concept">
55416 <primary>non-SMTP messages</primary>
55417 <secondary>ACLs for</secondary>
55418 </indexterm>
55419 The non-SMTP ACLs apply to all non-interactive incoming messages, that is, they
55420 apply to batched SMTP as well as to non-SMTP messages. (Batched SMTP is not
55421 really SMTP.) Many of the ACL conditions (for example, host tests, and tests on
55422 the state of the SMTP connection such as encryption and authentication) are not
55423 relevant and are forbidden in these ACLs. However, the sender and recipients
55424 are known, so the <option>senders</option> and <option>sender_domains</option> conditions and the
55425 <varname>$sender_address</varname> and <varname>$recipients</varname> variables can be used. Variables such as
55426 <varname>$authenticated_sender</varname> are also available. You can specify added header lines
55427 in any of these ACLs.
55428 </para>
55429 <para>
55430 The <option>acl_not_smtp_start</option> ACL is run right at the start of receiving a
55431 non-SMTP message, before any of the message has been read. (This is the
55432 analogue of the <option>acl_smtp_predata</option> ACL for SMTP input.) In the case of
55433 batched SMTP input, it runs after the DATA command has been reached. The
55434 result of this ACL is ignored; it cannot be used to reject a message. If you
55435 really need to, you could set a value in an ACL variable here and reject based
55436 on that in the <option>acl_not_smtp</option> ACL. However, this ACL can be used to set
55437 controls, and in particular, it can be used to set
55438 </para>
55439 <literallayout class="monospaced">
55440 control = suppress_local_fixups
55441 </literallayout>
55442 <para>
55443 This cannot be used in the other non-SMTP ACLs because by the time they are
55444 run, it is too late.
55445 </para>
55446 <para>
55447 The <option>acl_not_smtp_mime</option> ACL is available only when Exim is compiled with the
55448 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
55449 </para>
55450 <para>
55451 The <option>acl_not_smtp</option> ACL is run just before the <function>local_scan()</function> function. Any
55452 kind of rejection is treated as permanent, because there is no way of sending a
55453 temporary error for these kinds of message.
55454 </para>
55455 </section>
55456 <section id="SECID191">
55457 <title>The SMTP connect ACL</title>
55458 <para>
55459 <indexterm role="concept">
55460 <primary>SMTP</primary>
55461 <secondary>connection, ACL for</secondary>
55462 </indexterm>
55463 <indexterm role="option">
55464 <primary><option>smtp_banner</option></primary>
55465 </indexterm>
55466 The ACL test specified by <option>acl_smtp_connect</option> happens at the start of an SMTP
55467 session, after the test specified by <option>host_reject_connection</option> (which is now
55468 an anomaly) and any TCP Wrappers testing (if configured). If the connection is
55469 accepted by an <option>accept</option> verb that has a <option>message</option> modifier, the contents of
55470 the message override the banner message that is otherwise specified by the
55471 <option>smtp_banner</option> option.
55472 </para>
55473 </section>
55474 <section id="SECID192">
55475 <title>The EHLO/HELO ACL</title>
55476 <para>
55477 <indexterm role="concept">
55478 <primary>EHLO</primary>
55479 <secondary>ACL for</secondary>
55480 </indexterm>
55481 <indexterm role="concept">
55482 <primary>HELO</primary>
55483 <secondary>ACL for</secondary>
55484 </indexterm>
55485 The ACL test specified by <option>acl_smtp_helo</option> happens when the client issues an
55486 EHLO or HELO command, after the tests specified by <option>helo_accept_junk_hosts</option>,
55487 <option>helo_allow_chars</option>, <option>helo_verify_hosts</option>, and <option>helo_try_verify_hosts</option>.
55488 Note that a client may issue more than one EHLO or HELO command in an SMTP
55489 session, and indeed is required to issue a new EHLO or HELO after successfully
55490 setting up encryption following a STARTTLS command.
55491 </para>
55492 <para>
55493 Note also that a deny neither forces the client to go away nor means that
55494 mail will be refused on the connection.  Consider checking for
55495 <varname>$sender_helo_name</varname> being defined in a MAIL or RCPT ACL to do that.
55496 </para>
55497 <para>
55498 If the command is accepted by an <option>accept</option> verb that has a <option>message</option>
55499 modifier, the message may not contain more than one line (it will be truncated
55500 at the first newline and a panic logged if it does). Such a message cannot
55501 affect the EHLO options that are listed on the second and subsequent lines of
55502 an EHLO response.
55503 </para>
55504 </section>
55505 <section id="SECID193">
55506 <title>The DATA ACLs</title>
55507 <para>
55508 <indexterm role="concept">
55509 <primary>DATA</primary>
55510 <secondary>ACLs for</secondary>
55511 </indexterm>
55512 Two ACLs are associated with the DATA command, because it is two-stage
55513 command, with two responses being sent to the client.
55514 When the DATA command is received, the ACL defined by <option>acl_smtp_predata</option>
55515 is obeyed. This gives you control after all the RCPT commands, but before
55516 the message itself is received. It offers the opportunity to give a negative
55517 response to the DATA command before the data is transmitted. Header lines
55518 added by MAIL or RCPT ACLs are not visible at this time, but any that
55519 are defined here are visible when the <option>acl_smtp_data</option> ACL is run.
55520 </para>
55521 <para>
55522 You cannot test the contents of the message, for example, to verify addresses
55523 in the headers, at RCPT time or when the DATA command is received. Such
55524 tests have to appear in the ACL that is run after the message itself has been
55525 received, before the final response to the DATA command is sent. This is
55526 the ACL specified by <option>acl_smtp_data</option>, which is the second ACL that is
55527 associated with the DATA command.
55528 </para>
55529 <para>
55530 <indexterm role="concept">
55531 <primary>CHUNKING</primary>
55532 <secondary>BDAT command</secondary>
55533 </indexterm>
55534 <indexterm role="concept">
55535 <primary>BDAT</primary>
55536 <secondary>SMTP command</secondary>
55537 </indexterm>
55538 <indexterm role="concept">
55539 <primary>RFC 3030</primary>
55540 <secondary>CHUNKING</secondary>
55541 </indexterm>
55542 If CHUNKING was advertised and a BDAT command sequence is received,
55543 the <option>acl_smtp_predata</option> ACL is not run.
55544 The <option>acl_smtp_data</option> is run after the last BDAT command and all of
55545 the data specified is received.
55546 </para>
55547 <para>
55548 For both of these ACLs, it is not possible to reject individual recipients. An
55549 error response rejects the entire message. Unfortunately, it is known that some
55550 MTAs do not treat hard (5<emphasis>xx</emphasis>) responses to the DATA command (either
55551 before or after the data) correctly &ndash; they keep the message on their queues
55552 and try again later, but that is their problem, though it does waste some of
55553 your resources.
55554 </para>
55555 <para>
55556 The <option>acl_smtp_data</option> ACL is run after
55557 the <option>acl_smtp_data_prdr</option>,
55558 the <option>acl_smtp_dkim</option>
55559 and the <option>acl_smtp_mime</option> ACLs.
55560 </para>
55561 </section>
55562 <section id="SECTDKIMACL">
55563 <title>The SMTP DKIM ACL</title>
55564 <para>
55565 The <option>acl_smtp_dkim</option> ACL is available only when Exim is compiled with DKIM support
55566 enabled (which is the default).
55567 </para>
55568 <para>
55569 The ACL test specified by <option>acl_smtp_dkim</option> happens after a message has been
55570 received, and is executed for each DKIM signature found in a message.  If not
55571 otherwise specified, the default action is to accept.
55572 </para>
55573 <para>
55574 This ACL is evaluated before <option>acl_smtp_mime</option> and <option>acl_smtp_data</option>.
55575 </para>
55576 <para>
55577 For details on the operation of DKIM, see section <xref linkend="SECDKIM"/>.
55578 </para>
55579 </section>
55580 <section id="SECID194">
55581 <title>The SMTP MIME ACL</title>
55582 <para>
55583 The <option>acl_smtp_mime</option> option is available only when Exim is compiled with the
55584 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
55585 </para>
55586 <para>
55587 This ACL is evaluated after <option>acl_smtp_dkim</option> but before <option>acl_smtp_data</option>.
55588 </para>
55589 </section>
55590 <section id="SECTPRDRACL">
55591 <title>The SMTP PRDR ACL</title>
55592 <para>
55593 <indexterm role="concept">
55594 <primary>PRDR</primary>
55595 <secondary>ACL for</secondary>
55596 </indexterm>
55597 <indexterm role="option">
55598 <primary><option>prdr_enable</option></primary>
55599 </indexterm>
55600 The <option>acl_smtp_data_prdr</option> ACL is available only when Exim is compiled
55601 with PRDR support enabled (which is the default).
55602 It becomes active only when the PRDR feature is negotiated between
55603 client and server for a message, and more than one recipient
55604 has been accepted.
55605 </para>
55606 <para>
55607 The ACL test specified by <option>acl_smtp_data_prdr</option> happens after a message
55608 has been received, and is executed once for each recipient of the message
55609 with <varname>$local_part</varname> and <varname>$domain</varname> valid.
55610 The test may accept, defer or deny for individual recipients.
55611 The <option>acl_smtp_data</option> will still be called after this ACL and
55612 can reject the message overall, even if this ACL has accepted it
55613 for some or all recipients.
55614 </para>
55615 <para>
55616 PRDR may be used to support per-user content filtering.  Without it
55617 one must defer any recipient after the first that has a different
55618 content-filter configuration.  With PRDR, the RCPT-time check
55619 <indexterm role="concept">
55620 <primary>PRDR</primary>
55621 <secondary>variable for</secondary>
55622 </indexterm>
55623 for this can be disabled when the variable <varname>$prdr_requested</varname>
55624 is <quote>yes</quote>.
55625 Any required difference in behaviour of the main DATA-time
55626 ACL should however depend on the PRDR-time ACL having run, as Exim
55627 will avoid doing so in some situations (e.g. single-recipient mails).
55628 </para>
55629 <para>
55630 See also the <option>prdr_enable</option> global option
55631 and the <option>hosts_try_prdr</option> smtp transport option.
55632 </para>
55633 <para>
55634 This ACL is evaluated after <option>acl_smtp_dkim</option> but before <option>acl_smtp_data</option>.
55635 If the ACL is not defined, processing completes as if
55636 the feature was not requested by the client.
55637 </para>
55638 </section>
55639 <section id="SECTQUITACL">
55640 <title>The QUIT ACL</title>
55641 <para>
55642 <indexterm role="concept">
55643 <primary>QUIT, ACL for</primary>
55644 </indexterm>
55645 The ACL for the SMTP QUIT command is anomalous, in that the outcome of the ACL
55646 does not affect the response code to QUIT, which is always 221. Thus, the ACL
55647 does not in fact control any access.
55648 For this reason, it may only accept
55649 or warn as its final result.
55650 </para>
55651 <para>
55652 This ACL can be used for tasks such as custom logging at the end of an SMTP
55653 session. For example, you can use ACL variables in other ACLs to count
55654 messages, recipients, etc., and log the totals at QUIT time using one or
55655 more <option>logwrite</option> modifiers on a <option>warn</option> verb.
55656 </para>
55657 <para>
55658 <emphasis role="bold">Warning</emphasis>: Only the <varname>$acl_c</varname><emphasis>x</emphasis> variables can be used for this, because
55659 the <varname>$acl_m</varname><emphasis>x</emphasis> variables are reset at the end of each incoming message.
55660 </para>
55661 <para>
55662 You do not need to have a final <option>accept</option>, but if you do, you can use a
55663 <option>message</option> modifier to specify custom text that is sent as part of the 221
55664 response to QUIT.
55665 </para>
55666 <para>
55667 This ACL is run only for a <quote>normal</quote> QUIT. For certain kinds of disastrous
55668 failure (for example, failure to open a log file, or when Exim is bombing out
55669 because it has detected an unrecoverable error), all SMTP commands from the
55670 client are given temporary error responses until QUIT is received or the
55671 connection is closed. In these special cases, the QUIT ACL does not run.
55672 </para>
55673 </section>
55674 <section id="SECTNOTQUITACL">
55675 <title>The not-QUIT ACL</title>
55676 <para>
55677 <indexterm role="variable">
55678 <primary><varname>$acl_smtp_notquit</varname></primary>
55679 </indexterm>
55680 The not-QUIT ACL, specified by <option>acl_smtp_notquit</option>, is run in most cases when
55681 an SMTP session ends without sending QUIT. However, when Exim itself is in bad
55682 trouble, such as being unable to write to its log files, this ACL is not run,
55683 because it might try to do things (such as write to log files) that make the
55684 situation even worse.
55685 </para>
55686 <para>
55687 Like the QUIT ACL, this ACL is provided to make it possible to do customized
55688 logging or to gather statistics, and its outcome is ignored. The <option>delay</option>
55689 modifier is forbidden in this ACL, and the only permitted verbs are <option>accept</option>
55690 and <option>warn</option>.
55691 </para>
55692 <para>
55693 <indexterm role="variable">
55694 <primary><varname>$smtp_notquit_reason</varname></primary>
55695 </indexterm>
55696 When the not-QUIT ACL is running, the variable <varname>$smtp_notquit_reason</varname> is set
55697 to a string that indicates the reason for the termination of the SMTP
55698 connection. The possible values are:
55699 </para>
55700 <informaltable frame="none">
55701 <tgroup cols="2" colsep="0" rowsep="0">
55702 <colspec colwidth="196pt" align="left"/>
55703 <colspec colwidth="254pt" align="left"/>
55704 <tbody>
55705 <row>
55706 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>acl-drop</literal></entry>
55707 <entry>Another ACL issued a <option>drop</option> command</entry>
55708 </row>
55709 <row>
55710 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>bad-commands</literal></entry>
55711 <entry>Too many unknown or non-mail commands</entry>
55712 </row>
55713 <row>
55714 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>command-timeout</literal></entry>
55715 <entry>Timeout while reading SMTP commands</entry>
55716 </row>
55717 <row>
55718 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>connection-lost</literal></entry>
55719 <entry>The SMTP connection has been lost</entry>
55720 </row>
55721 <row>
55722 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>data-timeout</literal></entry>
55723 <entry>Timeout while reading message data</entry>
55724 </row>
55725 <row>
55726 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>local-scan-error</literal></entry>
55727 <entry>The <function>local_scan()</function> function crashed</entry>
55728 </row>
55729 <row>
55730 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>local-scan-timeout</literal></entry>
55731 <entry>The <function>local_scan()</function> function timed out</entry>
55732 </row>
55733 <row>
55734 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>signal-exit</literal></entry>
55735 <entry>SIGTERM or SIGINT</entry>
55736 </row>
55737 <row>
55738 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>synchronization-error</literal></entry>
55739 <entry>SMTP synchronization error</entry>
55740 </row>
55741 <row>
55742 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>tls-failed</literal></entry>
55743 <entry>TLS failed to start</entry>
55744 </row>
55745 </tbody>
55746 </tgroup>
55747 </informaltable>
55748 <para>
55749 In most cases when an SMTP connection is closed without having received QUIT,
55750 Exim sends an SMTP response message before actually closing the connection.
55751 With the exception of the <literal>acl-drop</literal> case, the default message can be
55752 overridden by the <option>message</option> modifier in the not-QUIT ACL. In the case of a
55753 <option>drop</option> verb in another ACL, it is the message from the other ACL that is
55754 used.
55755 </para>
55756 </section>
55757 <section id="SECID195">
55758 <title>Finding an ACL to use</title>
55759 <para>
55760 <indexterm role="concept">
55761 <primary>access control lists (ACLs)</primary>
55762 <secondary>finding which to use</secondary>
55763 </indexterm>
55764 The value of an <option>acl_smtp_</option><emphasis>xxx</emphasis> option is expanded before use, so
55765 you can use different ACLs in different circumstances. For example,
55766 </para>
55767 <literallayout class="monospaced">
55768 acl_smtp_rcpt = ${if ={25}{$interface_port} \
55769                      {acl_check_rcpt} {acl_check_rcpt_submit} }
55770 </literallayout>
55771 <para>
55772 In the default configuration file there are some example settings for
55773 providing an RFC 4409 message <quote>submission</quote> service on port 587 and
55774 an RFC 8314 <quote>submissions</quote> service on port 465. You can use a string
55775 expansion like this to choose an ACL for MUAs on these ports which is
55776 more appropriate for this purpose than the default ACL on port 25.
55777 </para>
55778 <para>
55779 The expanded string does not have to be the name of an ACL in the
55780 configuration file; there are other possibilities. Having expanded the
55781 string, Exim searches for an ACL as follows:
55782 </para>
55783 <itemizedlist>
55784 <listitem>
55785 <para>
55786 If the string begins with a slash, Exim uses it as a filename, and reads its
55787 contents as an ACL. The lines are processed in the same way as lines in the
55788 Exim configuration file. In particular, continuation lines are supported, blank
55789 lines are ignored, as are lines whose first non-whitespace character is <quote>#</quote>.
55790 If the file does not exist or cannot be read, an error occurs (typically
55791 causing a temporary failure of whatever caused the ACL to be run). For example:
55792 </para>
55793 <literallayout class="monospaced">
55794 acl_smtp_data = /etc/acls/\
55795   ${lookup{$sender_host_address}lsearch\
55796   {/etc/acllist}{$value}{default}}
55797 </literallayout>
55798 <para>
55799 This looks up an ACL file to use on the basis of the host&#x2019;s IP address, falling
55800 back to a default if the lookup fails. If an ACL is successfully read from a
55801 file, it is retained in memory for the duration of the Exim process, so that it
55802 can be re-used without having to re-read the file.
55803 </para>
55804 </listitem>
55805 <listitem>
55806 <para>
55807 If the string does not start with a slash, and does not contain any spaces,
55808 Exim searches the ACL section of the configuration for an ACL whose name
55809 matches the string.
55810 </para>
55811 </listitem>
55812 <listitem>
55813 <para>
55814 If no named ACL is found, or if the string contains spaces, Exim parses
55815 the string as an inline ACL. This can save typing in cases where you just
55816 want to have something like
55817 </para>
55818 <literallayout class="monospaced">
55819 acl_smtp_vrfy = accept
55820 </literallayout>
55821 <para>
55822 in order to allow free use of the VRFY command. Such a string may contain
55823 newlines; it is processed in the same way as an ACL that is read from a file.
55824 </para>
55825 </listitem>
55826 </itemizedlist>
55827 </section>
55828 <section id="SECID196">
55829 <title>ACL return codes</title>
55830 <para>
55831 <indexterm role="concept">
55832 <primary>access control lists (ACLs)</primary>
55833 <secondary>return codes</secondary>
55834 </indexterm>
55835 Except for the QUIT ACL, which does not affect the SMTP return code (see
55836 section <xref linkend="SECTQUITACL"/> above), the result of running an ACL is either
55837 <quote>accept</quote> or <quote>deny</quote>, or, if some test cannot be completed (for example, if a
55838 database is down), <quote>defer</quote>. These results cause 2<emphasis>xx</emphasis>, 5<emphasis>xx</emphasis>, and 4<emphasis>xx</emphasis>
55839 return codes, respectively, to be used in the SMTP dialogue. A fourth return,
55840 <quote>error</quote>, occurs when there is an error such as invalid syntax in the ACL.
55841 This also causes a 4<emphasis>xx</emphasis> return code.
55842 </para>
55843 <para>
55844 For the non-SMTP ACL, <quote>defer</quote> and <quote>error</quote> are treated in the same way as
55845 <quote>deny</quote>, because there is no mechanism for passing temporary errors to the
55846 submitters of non-SMTP messages.
55847 </para>
55848 <para>
55849 ACLs that are relevant to message reception may also return <quote>discard</quote>. This
55850 has the effect of <quote>accept</quote>, but causes either the entire message or an
55851 individual recipient address to be discarded. In other words, it is a
55852 blackholing facility. Use it with care.
55853 </para>
55854 <para>
55855 If the ACL for MAIL returns <quote>discard</quote>, all recipients are discarded, and no
55856 ACL is run for subsequent RCPT commands. The effect of <quote>discard</quote> in a
55857 RCPT ACL is to discard just the one recipient address. If there are no
55858 recipients left when the message&#x2019;s data is received, the DATA ACL is not
55859 run. A <quote>discard</quote> return from the DATA or the non-SMTP ACL discards all the
55860 remaining recipients. The <quote>discard</quote> return is not permitted for the
55861 <option>acl_smtp_predata</option> ACL.
55862 </para>
55863 <para>
55864 If the ACL for VRFY returns <quote>accept</quote>, a recipient verify (without callout)
55865 is done on the address and the result determines the SMTP response.
55866 </para>
55867 <para>
55868 <indexterm role="concept">
55869 <primary><function>local_scan()</function> function</primary>
55870 <secondary>when all recipients discarded</secondary>
55871 </indexterm>
55872 The <function>local_scan()</function> function is always run, even if there are no remaining
55873 recipients; it may create new recipients.
55874 </para>
55875 </section>
55876 <section id="SECID197">
55877 <title>Unset ACL options</title>
55878 <para>
55879 <indexterm role="concept">
55880 <primary>access control lists (ACLs)</primary>
55881 <secondary>unset options</secondary>
55882 </indexterm>
55883 The default actions when any of the <option>acl_</option><emphasis>xxx</emphasis> options are unset are not
55884 all the same. <emphasis role="bold">Note</emphasis>: These defaults apply only when the relevant ACL is
55885 not defined at all. For any defined ACL, the default action when control
55886 reaches the end of the ACL statements is <quote>deny</quote>.
55887 </para>
55888 <para>
55889 For <option>acl_smtp_quit</option> and <option>acl_not_smtp_start</option> there is no default because
55890 these two are ACLs that are used only for their side effects. They cannot be
55891 used to accept or reject anything.
55892 </para>
55893 <para>
55894 For <option>acl_not_smtp</option>, <option>acl_smtp_auth</option>, <option>acl_smtp_connect</option>,
55895 <option>acl_smtp_data</option>, <option>acl_smtp_helo</option>, <option>acl_smtp_mail</option>, <option>acl_smtp_mailauth</option>,
55896 <option>acl_smtp_mime</option>, <option>acl_smtp_predata</option>, and <option>acl_smtp_starttls</option>, the action
55897 when the ACL is not defined is <quote>accept</quote>.
55898 </para>
55899 <para>
55900 For the others (<option>acl_smtp_etrn</option>, <option>acl_smtp_expn</option>, <option>acl_smtp_rcpt</option>, and
55901 <option>acl_smtp_vrfy</option>), the action when the ACL is not defined is <quote>deny</quote>.
55902 This means that <option>acl_smtp_rcpt</option> must be defined in order to receive any
55903 messages over an SMTP connection. For an example, see the ACL in the default
55904 configuration file.
55905 </para>
55906 </section>
55907 <section id="SECID198">
55908 <title>Data for message ACLs</title>
55909 <para>
55910 <indexterm role="concept">
55911 <primary>access control lists (ACLs)</primary>
55912 <secondary>data for message ACL</secondary>
55913 </indexterm>
55914 <indexterm role="variable">
55915 <primary><varname>$domain</varname></primary>
55916 </indexterm>
55917 <indexterm role="variable">
55918 <primary><varname>$local_part</varname></primary>
55919 </indexterm>
55920 <indexterm role="variable">
55921 <primary><varname>$sender_address</varname></primary>
55922 </indexterm>
55923 <indexterm role="variable">
55924 <primary><varname>$sender_host_address</varname></primary>
55925 </indexterm>
55926 <indexterm role="variable">
55927 <primary><varname>$smtp_command</varname></primary>
55928 </indexterm>
55929 When a MAIL or RCPT ACL, or either of the DATA ACLs, is running, the variables
55930 that contain information about the host and the message&#x2019;s sender (for example,
55931 <varname>$sender_host_address</varname> and <varname>$sender_address</varname>) are set, and can be used in ACL
55932 statements. In the case of RCPT (but not MAIL or DATA), <varname>$domain</varname> and
55933 <varname>$local_part</varname> are set from the argument address. The entire SMTP command
55934 is available in <varname>$smtp_command</varname>.
55935 </para>
55936 <para>
55937 When an ACL for the AUTH parameter of MAIL is running, the variables that
55938 contain information about the host are set, but <varname>$sender_address</varname> is not yet
55939 set. Section <xref linkend="SECTauthparamail"/> contains a discussion of this parameter and
55940 how it is used.
55941 </para>
55942 <para>
55943 <indexterm role="variable">
55944 <primary><varname>$message_size</varname></primary>
55945 </indexterm>
55946 The <varname>$message_size</varname> variable is set to the value of the SIZE parameter on
55947 the MAIL command at MAIL, RCPT and pre-data time, or to -1 if
55948 that parameter is not given. The value is updated to the true message size by
55949 the time the final DATA ACL is run (after the message data has been
55950 received).
55951 </para>
55952 <para>
55953 <indexterm role="variable">
55954 <primary><varname>$rcpt_count</varname></primary>
55955 </indexterm>
55956 <indexterm role="variable">
55957 <primary><varname>$recipients_count</varname></primary>
55958 </indexterm>
55959 The <varname>$rcpt_count</varname> variable increases by one for each RCPT command received.
55960 The <varname>$recipients_count</varname> variable increases by one each time a RCPT command is
55961 accepted, so while an ACL for RCPT is being processed, it contains the number
55962 of previously accepted recipients. At DATA time (for both the DATA ACLs),
55963 <varname>$rcpt_count</varname> contains the total number of RCPT commands, and
55964 <varname>$recipients_count</varname> contains the total number of accepted recipients.
55965 </para>
55966 </section>
55967 <section id="SECTdatfornon">
55968 <title>Data for non-message ACLs</title>
55969 <para>
55970 <indexterm role="concept">
55971 <primary>access control lists (ACLs)</primary>
55972 <secondary>data for non-message ACL</secondary>
55973 </indexterm>
55974 <indexterm role="variable">
55975 <primary><varname>$smtp_command_argument</varname></primary>
55976 </indexterm>
55977 <indexterm role="variable">
55978 <primary><varname>$smtp_command</varname></primary>
55979 </indexterm>
55980 When an ACL is being run for AUTH, EHLO, ETRN, EXPN, HELO, STARTTLS, or VRFY,
55981 the remainder of the SMTP command line is placed in <varname>$smtp_command_argument</varname>,
55982 and the entire SMTP command is available in <varname>$smtp_command</varname>.
55983 These variables can be tested using a <option>condition</option> condition. For example,
55984 here is an ACL for use with AUTH, which insists that either the session is
55985 encrypted, or the CRAM-MD5 authentication method is used. In other words, it
55986 does not permit authentication methods that use cleartext passwords on
55987 unencrypted connections.
55988 </para>
55989 <literallayout class="monospaced">
55990 acl_check_auth:
55991   accept encrypted = *
55992   accept condition = ${if eq{${uc:$smtp_command_argument}}\
55993                      {CRAM-MD5}}
55994   deny   message   = TLS encryption or CRAM-MD5 required
55995 </literallayout>
55996 <para>
55997 (Another way of applying this restriction is to arrange for the authenticators
55998 that use cleartext passwords not to be advertised when the connection is not
55999 encrypted. You can use the generic <option>server_advertise_condition</option> authenticator
56000 option to do this.)
56001 </para>
56002 </section>
56003 <section id="SECID199">
56004 <title>Format of an ACL</title>
56005 <para>
56006 <indexterm role="concept">
56007 <primary>access control lists (ACLs)</primary>
56008 <secondary>format of</secondary>
56009 </indexterm>
56010 <indexterm role="concept">
56011 <primary>access control lists (ACLs)</primary>
56012 <secondary>verbs, definition of</secondary>
56013 </indexterm>
56014 An individual ACL consists of a number of statements. Each statement starts
56015 with a verb, optionally followed by a number of conditions and <quote>modifiers</quote>.
56016 Modifiers can change the way the verb operates, define error and log messages,
56017 set variables, insert delays, and vary the processing of accepted messages.
56018 </para>
56019 <para>
56020 If all the conditions are met, the verb is obeyed. The same condition may be
56021 used (with different arguments) more than once in the same statement. This
56022 provides a means of specifying an <quote>and</quote> conjunction between conditions. For
56023 example:
56024 </para>
56025 <literallayout class="monospaced">
56026 deny  dnslists = list1.example
56027       dnslists = list2.example
56028 </literallayout>
56029 <para>
56030 If there are no conditions, the verb is always obeyed. Exim stops evaluating
56031 the conditions and modifiers when it reaches a condition that fails. What
56032 happens then depends on the verb (and in one case, on a special modifier). Not
56033 all the conditions make sense at every testing point. For example, you cannot
56034 test a sender address in the ACL that is run for a VRFY command.
56035 </para>
56036 </section>
56037 <section id="SECID200">
56038 <title>ACL verbs</title>
56039 <para>
56040 The ACL verbs are as follows:
56041 </para>
56042 <itemizedlist>
56043 <listitem>
56044 <para>
56045 <indexterm role="concept">
56046 <primary><option>accept</option> ACL verb</primary>
56047 </indexterm>
56048 <option>accept</option>: If all the conditions are met, the ACL returns <quote>accept</quote>. If any
56049 of the conditions are not met, what happens depends on whether <option>endpass</option>
56050 appears among the conditions (for syntax see below). If the failing condition
56051 is before <option>endpass</option>, control is passed to the next ACL statement; if it is
56052 after <option>endpass</option>, the ACL returns <quote>deny</quote>. Consider this statement, used to
56053 check a RCPT command:
56054 </para>
56055 <literallayout class="monospaced">
56056 accept domains = +local_domains
56057        endpass
56058        verify = recipient
56059 </literallayout>
56060 <para>
56061 If the recipient domain does not match the <option>domains</option> condition, control
56062 passes to the next statement. If it does match, the recipient is verified, and
56063 the command is accepted if verification succeeds. However, if verification
56064 fails, the ACL yields <quote>deny</quote>, because the failing condition is after
56065 <option>endpass</option>.
56066 </para>
56067 <para>
56068 The <option>endpass</option> feature has turned out to be confusing to many people, so its
56069 use is not recommended nowadays. It is always possible to rewrite an ACL so
56070 that <option>endpass</option> is not needed, and it is no longer used in the default
56071 configuration.
56072 </para>
56073 <para>
56074 <indexterm role="concept">
56075 <primary><option>message</option> ACL modifier</primary>
56076 <secondary>with <option>accept</option></secondary>
56077 </indexterm>
56078 If a <option>message</option> modifier appears on an <option>accept</option> statement, its action
56079 depends on whether or not <option>endpass</option> is present. In the absence of <option>endpass</option>
56080 (when an <option>accept</option> verb either accepts or passes control to the next
56081 statement), <option>message</option> can be used to vary the message that is sent when an
56082 SMTP command is accepted. For example, in a RCPT ACL you could have:
56083 </para>
56084 <literallayout>
56085 <literal>accept  </literal>&lt;<emphasis>some conditions</emphasis>&gt;
56086 <literal>        message = OK, I will allow you through today</literal>
56087 </literallayout>
56088 <para>
56089 You can specify an SMTP response code, optionally followed by an <quote>extended
56090 response code</quote> at the start of the message, but the first digit must be the
56091 same as would be sent by default, which is 2 for an <option>accept</option> verb.
56092 </para>
56093 <para>
56094 If <option>endpass</option> is present in an <option>accept</option> statement, <option>message</option> specifies
56095 an error message that is used when access is denied. This behaviour is retained
56096 for backward compatibility, but current <quote>best practice</quote> is to avoid the use
56097 of <option>endpass</option>.
56098 </para>
56099 </listitem>
56100 <listitem>
56101 <para>
56102 <indexterm role="concept">
56103 <primary><option>defer</option> ACL verb</primary>
56104 </indexterm>
56105 <option>defer</option>: If all the conditions are true, the ACL returns <quote>defer</quote> which, in
56106 an SMTP session, causes a 4<emphasis>xx</emphasis> response to be given. For a non-SMTP ACL,
56107 <option>defer</option> is the same as <option>deny</option>, because there is no way of sending a
56108 temporary error. For a RCPT command, <option>defer</option> is much the same as using a
56109 <command>redirect</command> router and <literal>:defer:</literal> while verifying, but the <option>defer</option> verb can
56110 be used in any ACL, and even for a recipient it might be a simpler approach.
56111 </para>
56112 </listitem>
56113 <listitem>
56114 <para>
56115 <indexterm role="concept">
56116 <primary><option>deny</option> ACL verb</primary>
56117 </indexterm>
56118 <option>deny</option>: If all the conditions are met, the ACL returns <quote>deny</quote>. If any of
56119 the conditions are not met, control is passed to the next ACL statement. For
56120 example,
56121 </para>
56122 <literallayout class="monospaced">
56123 deny dnslists = blackholes.mail-abuse.org
56124 </literallayout>
56125 <para>
56126 rejects commands from hosts that are on a DNS black list.
56127 </para>
56128 </listitem>
56129 <listitem>
56130 <para>
56131 <indexterm role="concept">
56132 <primary><option>discard</option> ACL verb</primary>
56133 </indexterm>
56134 <option>discard</option>: This verb behaves like <option>accept</option>, except that it returns
56135 <quote>discard</quote> from the ACL instead of <quote>accept</quote>. It is permitted only on ACLs
56136 that are concerned with receiving messages. When all the conditions are true,
56137 the sending entity receives a <quote>success</quote> response. However, <option>discard</option> causes
56138 recipients to be discarded. If it is used in an ACL for RCPT, just the one
56139 recipient is discarded; if used for MAIL, DATA or in the non-SMTP ACL, all the
56140 message&#x2019;s recipients are discarded. Recipients that are discarded before DATA
56141 do not appear in the log line when the <option>received_recipients</option> log selector is set.
56142 </para>
56143 <para>
56144 If the <option>log_message</option> modifier is set when <option>discard</option> operates,
56145 its contents are added to the line that is automatically written to the log.
56146 The <option>message</option> modifier operates exactly as it does for <option>accept</option>.
56147 </para>
56148 </listitem>
56149 <listitem>
56150 <para>
56151 <indexterm role="concept">
56152 <primary><option>drop</option> ACL verb</primary>
56153 </indexterm>
56154 <option>drop</option>: This verb behaves like <option>deny</option>, except that an SMTP connection is
56155 forcibly closed after the 5<emphasis>xx</emphasis> error message has been sent. For example:
56156 </para>
56157 <literallayout class="monospaced">
56158 drop   message   = I don't take more than 20 RCPTs
56159        condition = ${if &gt; {$rcpt_count}{20}}
56160 </literallayout>
56161 <para>
56162 There is no difference between <option>deny</option> and <option>drop</option> for the connect-time ACL.
56163 The connection is always dropped after sending a 550 response.
56164 </para>
56165 </listitem>
56166 <listitem>
56167 <para>
56168 <indexterm role="concept">
56169 <primary><option>require</option> ACL verb</primary>
56170 </indexterm>
56171 <option>require</option>: If all the conditions are met, control is passed to the next ACL
56172 statement. If any of the conditions are not met, the ACL returns <quote>deny</quote>. For
56173 example, when checking a RCPT command,
56174 </para>
56175 <literallayout class="monospaced">
56176 require message = Sender did not verify
56177         verify  = sender
56178 </literallayout>
56179 <para>
56180 passes control to subsequent statements only if the message&#x2019;s sender can be
56181 verified. Otherwise, it rejects the command. Note the positioning of the
56182 <option>message</option> modifier, before the <option>verify</option> condition. The reason for this is
56183 discussed in section <xref linkend="SECTcondmodproc"/>.
56184 </para>
56185 </listitem>
56186 <listitem>
56187 <para>
56188 <indexterm role="concept">
56189 <primary><option>warn</option> ACL verb</primary>
56190 </indexterm>
56191 <option>warn</option>: If all the conditions are true, a line specified by the
56192 <option>log_message</option> modifier is written to Exim&#x2019;s main log. Control always passes
56193 to the next ACL statement. If any condition is false, the log line is not
56194 written. If an identical log line is requested several times in the same
56195 message, only one copy is actually written to the log. If you want to force
56196 duplicates to be written, use the <option>logwrite</option> modifier instead.
56197 </para>
56198 <para>
56199 If <option>log_message</option> is not present, a <option>warn</option> verb just checks its conditions
56200 and obeys any <quote>immediate</quote> modifiers (such as <option>control</option>, <option>set</option>,
56201 <option>logwrite</option>, <option>add_header</option>, and <option>remove_header</option>) that appear before the
56202 first failing condition. There is more about adding header lines in section
56203 <xref linkend="SECTaddheadacl"/>.
56204 </para>
56205 <para>
56206 If any condition on a <option>warn</option> statement cannot be completed (that is, there is
56207 some sort of defer), the log line specified by <option>log_message</option> is not written.
56208 This does not include the case of a forced failure from a lookup, which
56209 is considered to be a successful completion. After a defer, no further
56210 conditions or modifiers in the <option>warn</option> statement are processed. The incident
56211 is logged, and the ACL continues to be processed, from the next statement
56212 onwards.
56213 </para>
56214 <para>
56215 <indexterm role="variable">
56216 <primary><varname>$acl_verify_message</varname></primary>
56217 </indexterm>
56218 When one of the <option>warn</option> conditions is an address verification that fails, the
56219 text of the verification failure message is in <varname>$acl_verify_message</varname>. If you
56220 want this logged, you must set it up explicitly. For example:
56221 </para>
56222 <literallayout class="monospaced">
56223 warn   !verify = sender
56224        log_message = sender verify failed: $acl_verify_message
56225 </literallayout>
56226 </listitem>
56227 </itemizedlist>
56228 <para>
56229 At the end of each ACL there is an implicit unconditional <option>deny</option>.
56230 </para>
56231 <para>
56232 As you can see from the examples above, the conditions and modifiers are
56233 written one to a line, with the first one on the same line as the verb, and
56234 subsequent ones on following lines. If you have a very long condition, you can
56235 continue it onto several physical lines by the usual backslash continuation
56236 mechanism. It is conventional to align the conditions vertically.
56237 </para>
56238 </section>
56239 <section id="SECTaclvariables">
56240 <title>ACL variables</title>
56241 <para>
56242 <indexterm role="concept">
56243 <primary>access control lists (ACLs)</primary>
56244 <secondary>variables</secondary>
56245 </indexterm>
56246 There are some special variables that can be set during ACL processing. They
56247 can be used to pass information between different ACLs, different invocations
56248 of the same ACL in the same SMTP connection, and between ACLs and the routers,
56249 transports, and filters that are used to deliver a message. The names of these
56250 variables must begin with <varname>$acl_c</varname> or <varname>$acl_m</varname>, followed either by a digit or
56251 an underscore, but the remainder of the name can be any sequence of
56252 alphanumeric characters and underscores that you choose. There is no limit on
56253 the number of ACL variables. The two sets act as follows:
56254 </para>
56255 <itemizedlist>
56256 <listitem>
56257 <para>
56258 The values of those variables whose names begin with <varname>$acl_c</varname> persist
56259 throughout an SMTP connection. They are never reset. Thus, a value that is set
56260 while receiving one message is still available when receiving the next message
56261 on the same SMTP connection.
56262 </para>
56263 </listitem>
56264 <listitem>
56265 <para>
56266 The values of those variables whose names begin with <varname>$acl_m</varname> persist only
56267 while a message is being received. They are reset afterwards. They are also
56268 reset by MAIL, RSET, EHLO, HELO, and after starting up a TLS session.
56269 </para>
56270 </listitem>
56271 </itemizedlist>
56272 <para>
56273 When a message is accepted, the current values of all the ACL variables are
56274 preserved with the message and are subsequently made available at delivery
56275 time. The ACL variables are set by a modifier called <option>set</option>. For example:
56276 </para>
56277 <literallayout class="monospaced">
56278 accept hosts = whatever
56279        set acl_m4 = some value
56280 accept authenticated = *
56281        set acl_c_auth = yes
56282 </literallayout>
56283 <para>
56284 <emphasis role="bold">Note</emphasis>: A leading dollar sign is not used when naming a variable that is to
56285 be set. If you want to set a variable without taking any action, you can use a
56286 <option>warn</option> verb without any other modifiers or conditions.
56287 </para>
56288 <para>
56289 <indexterm role="option">
56290 <primary><option>strict_acl_vars</option></primary>
56291 </indexterm>
56292 What happens if a syntactically valid but undefined ACL variable is
56293 referenced depends on the setting of the <option>strict_acl_vars</option> option. If it is
56294 false (the default), an empty string is substituted; if it is true, an
56295 error is generated.
56296 </para>
56297 <para>
56298 Versions of Exim before 4.64 have a limited set of numbered variables, but
56299 their names are compatible, so there is no problem with upgrading.
56300 </para>
56301 </section>
56302 <section id="SECTcondmodproc">
56303 <title>Condition and modifier processing</title>
56304 <para>
56305 <indexterm role="concept">
56306 <primary>access control lists (ACLs)</primary>
56307 <secondary>conditions; processing</secondary>
56308 </indexterm>
56309 <indexterm role="concept">
56310 <primary>access control lists (ACLs)</primary>
56311 <secondary>modifiers; processing</secondary>
56312 </indexterm>
56313 An exclamation mark preceding a condition negates its result. For example:
56314 </para>
56315 <literallayout class="monospaced">
56316 deny   domains = *.dom.example
56317       !verify  = recipient
56318 </literallayout>
56319 <para>
56320 causes the ACL to return <quote>deny</quote> if the recipient domain ends in
56321 <emphasis>dom.example</emphasis> and the recipient address cannot be verified. Sometimes
56322 negation can be used on the right-hand side of a condition. For example, these
56323 two statements are equivalent:
56324 </para>
56325 <literallayout class="monospaced">
56326 deny  hosts = !192.168.3.4
56327 deny !hosts =  192.168.3.4
56328 </literallayout>
56329 <para>
56330 However, for many conditions (<option>verify</option> being a good example), only left-hand
56331 side negation of the whole condition is possible.
56332 </para>
56333 <para>
56334 The arguments of conditions and modifiers are expanded. A forced failure
56335 of an expansion causes a condition to be ignored, that is, it behaves as if the
56336 condition is true. Consider these two statements:
56337 </para>
56338 <literallayout class="monospaced">
56339 accept  senders = ${lookup{$host_name}lsearch\
56340                   {/some/file}{$value}fail}
56341 accept  senders = ${lookup{$host_name}lsearch\
56342                   {/some/file}{$value}{}}
56343 </literallayout>
56344 <para>
56345 Each attempts to look up a list of acceptable senders. If the lookup succeeds,
56346 the returned list is searched, but if the lookup fails the behaviour is
56347 different in the two cases. The <option>fail</option> in the first statement causes the
56348 condition to be ignored, leaving no further conditions. The <option>accept</option> verb
56349 therefore succeeds. The second statement, however, generates an empty list when
56350 the lookup fails. No sender can match an empty list, so the condition fails,
56351 and therefore the <option>accept</option> also fails.
56352 </para>
56353 <para>
56354 ACL modifiers appear mixed in with conditions in ACL statements. Some of them
56355 specify actions that are taken as the conditions for a statement are checked;
56356 others specify text for messages that are used when access is denied or a
56357 warning is generated. The <option>control</option> modifier affects the way an incoming
56358 message is handled.
56359 </para>
56360 <para>
56361 The positioning of the modifiers in an ACL statement is important, because the
56362 processing of a verb ceases as soon as its outcome is known. Only those
56363 modifiers that have already been encountered will take effect. For example,
56364 consider this use of the <option>message</option> modifier:
56365 </para>
56366 <literallayout class="monospaced">
56367 require message = Can't verify sender
56368         verify  = sender
56369         message = Can't verify recipient
56370         verify  = recipient
56371         message = This message cannot be used
56372 </literallayout>
56373 <para>
56374 If sender verification fails, Exim knows that the result of the statement is
56375 <quote>deny</quote>, so it goes no further. The first <option>message</option> modifier has been seen,
56376 so its text is used as the error message. If sender verification succeeds, but
56377 recipient verification fails, the second message is used. If recipient
56378 verification succeeds, the third message becomes <quote>current</quote>, but is never used
56379 because there are no more conditions to cause failure.
56380 </para>
56381 <para>
56382 For the <option>deny</option> verb, on the other hand, it is always the last <option>message</option>
56383 modifier that is used, because all the conditions must be true for rejection to
56384 happen. Specifying more than one <option>message</option> modifier does not make sense, and
56385 the message can even be specified after all the conditions. For example:
56386 </para>
56387 <literallayout class="monospaced">
56388 deny   hosts = ...
56389       !senders = *@my.domain.example
56390        message = Invalid sender from client host
56391 </literallayout>
56392 <para>
56393 The <quote>deny</quote> result does not happen until the end of the statement is reached,
56394 by which time Exim has set up the message.
56395 </para>
56396 </section>
56397 <section id="SECTACLmodi">
56398 <title>ACL modifiers</title>
56399 <para>
56400 <indexterm role="concept">
56401 <primary>access control lists (ACLs)</primary>
56402 <secondary>modifiers; list of</secondary>
56403 </indexterm>
56404 The ACL modifiers are as follows:
56405 </para>
56406 <variablelist>
56407 <varlistentry>
56408 <term><emphasis role="bold">add_header</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
56409 <listitem>
56410 <para>
56411 This modifier specifies one or more header lines that are to be added to an
56412 incoming message, assuming, of course, that the message is ultimately
56413 accepted. For details, see section <xref linkend="SECTaddheadacl"/>.
56414 </para>
56415 </listitem></varlistentry>
56416 <varlistentry>
56417 <term><emphasis role="bold">continue</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
56418 <listitem>
56419 <para>
56420 <indexterm role="concept">
56421 <primary><option>continue</option> ACL modifier</primary>
56422 </indexterm>
56423 <indexterm role="concept">
56424 <primary>database</primary>
56425 <secondary>updating in ACL</secondary>
56426 </indexterm>
56427 This modifier does nothing of itself, and processing of the ACL always
56428 continues with the next condition or modifier. The value of <option>continue</option> is in
56429 the side effects of expanding its argument. Typically this could be used to
56430 update a database. It is really just a syntactic tidiness, to avoid having to
56431 write rather ugly lines like this:
56432 </para>
56433 <literallayout>
56434 <literal>condition = ${if eq{0}{</literal>&lt;<emphasis>some expansion</emphasis>&gt;<literal>}{true}{true}}</literal>
56435 </literallayout>
56436 <para>
56437 Instead, all you need is
56438 </para>
56439 <literallayout>
56440 <literal>continue = </literal>&lt;<emphasis>some expansion</emphasis>&gt;
56441 </literallayout>
56442 </listitem></varlistentry>
56443 <varlistentry>
56444 <term><emphasis role="bold">control</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
56445 <listitem>
56446 <para>
56447 <indexterm role="concept">
56448 <primary><option>control</option> ACL modifier</primary>
56449 </indexterm>
56450 This modifier affects the subsequent processing of the SMTP connection or of an
56451 incoming message that is accepted. The effect of the first type of control
56452 lasts for the duration of the connection, whereas the effect of the second type
56453 lasts only until the current message has been received. The message-specific
56454 controls always apply to the whole message, not to individual recipients,
56455 even if the <option>control</option> modifier appears in a RCPT ACL.
56456 </para>
56457 <para>
56458 As there are now quite a few controls that can be applied, they are described
56459 separately in section <xref linkend="SECTcontrols"/>. The <option>control</option> modifier can be used
56460 in several different ways. For example:
56461 </para>
56462 <itemizedlist>
56463 <listitem>
56464 <para>
56465 It can be at the end of an <option>accept</option> statement:
56466 </para>
56467 <literallayout class="monospaced">
56468     accept  ...some conditions
56469             control = queue_only
56470 </literallayout>
56471 <para>
56472 In this case, the control is applied when this statement yields <quote>accept</quote>, in
56473 other words, when the conditions are all true.
56474 </para>
56475 </listitem>
56476 <listitem>
56477 <para>
56478 It can be in the middle of an <option>accept</option> statement:
56479 </para>
56480 <literallayout class="monospaced">
56481     accept  ...some conditions...
56482             control = queue_only
56483             ...some more conditions...
56484 </literallayout>
56485 <para>
56486 If the first set of conditions are true, the control is applied, even if the
56487 statement does not accept because one of the second set of conditions is false.
56488 In this case, some subsequent statement must yield <quote>accept</quote> for the control
56489 to be relevant.
56490 </para>
56491 </listitem>
56492 <listitem>
56493 <para>
56494 It can be used with <option>warn</option> to apply the control, leaving the
56495 decision about accepting or denying to a subsequent verb. For
56496 example:
56497 </para>
56498 <literallayout class="monospaced">
56499     warn    ...some conditions...
56500             control = freeze
56501     accept  ...
56502 </literallayout>
56503 <para>
56504 This example of <option>warn</option> does not contain <option>message</option>, <option>log_message</option>, or
56505 <option>logwrite</option>, so it does not add anything to the message and does not write a
56506 log entry.
56507 </para>
56508 </listitem>
56509 <listitem>
56510 <para>
56511 If you want to apply a control unconditionally, you can use it with a
56512 <option>require</option> verb. For example:
56513 </para>
56514 <literallayout class="monospaced">
56515     require  control = no_multiline_responses
56516 </literallayout>
56517 </listitem>
56518 </itemizedlist>
56519 </listitem></varlistentry>
56520 <varlistentry>
56521 <term><emphasis role="bold">delay</emphasis>&nbsp;=&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
56522 <listitem>
56523 <para>
56524 <indexterm role="concept">
56525 <primary><option>delay</option> ACL modifier</primary>
56526 </indexterm>
56527 <indexterm role="option">
56528 <primary><option>-bh</option></primary>
56529 </indexterm>
56530 This modifier may appear in any ACL except notquit. It causes Exim to wait for
56531 the time interval before proceeding. However, when testing Exim using the
56532 <option>-bh</option> option, the delay is not actually imposed (an appropriate message is
56533 output instead). The time is given in the usual Exim notation, and the delay
56534 happens as soon as the modifier is processed. In an SMTP session, pending
56535 output is flushed before the delay is imposed.
56536 </para>
56537 <para>
56538 Like <option>control</option>, <option>delay</option> can be used with <option>accept</option> or <option>deny</option>, for
56539 example:
56540 </para>
56541 <literallayout class="monospaced">
56542 deny    ...some conditions...
56543         delay = 30s
56544 </literallayout>
56545 <para>
56546 The delay happens if all the conditions are true, before the statement returns
56547 <quote>deny</quote>. Compare this with:
56548 </para>
56549 <literallayout class="monospaced">
56550 deny    delay = 30s
56551         ...some conditions...
56552 </literallayout>
56553 <para>
56554 which waits for 30s before processing the conditions. The <option>delay</option> modifier
56555 can also be used with <option>warn</option> and together with <option>control</option>:
56556 </para>
56557 <literallayout class="monospaced">
56558 warn    ...some conditions...
56559         delay = 2m
56560         control = freeze
56561 accept  ...
56562 </literallayout>
56563 <para>
56564 If <option>delay</option> is encountered when the SMTP PIPELINING extension is in use,
56565 responses to several commands are no longer buffered and sent in one packet (as
56566 they would normally be) because all output is flushed before imposing the
56567 delay. This optimization is disabled so that a number of small delays do not
56568 appear to the client as one large aggregated delay that might provoke an
56569 unwanted timeout. You can, however, disable output flushing for <option>delay</option> by
56570 using a <option>control</option> modifier to set <option>no_delay_flush</option>.
56571 </para>
56572 </listitem></varlistentry>
56573 <varlistentry>
56574 <term><emphasis role="bold">endpass</emphasis></term>
56575 <listitem>
56576 <para>
56577 <indexterm role="concept">
56578 <primary><option>endpass</option> ACL modifier</primary>
56579 </indexterm>
56580 This modifier, which has no argument, is recognized only in <option>accept</option> and
56581 <option>discard</option> statements. It marks the boundary between the conditions whose
56582 failure causes control to pass to the next statement, and the conditions whose
56583 failure causes the ACL to return <quote>deny</quote>. This concept has proved to be
56584 confusing to some people, so the use of <option>endpass</option> is no longer recommended as
56585 <quote>best practice</quote>. See the description of <option>accept</option> above for more details.
56586 </para>
56587 </listitem></varlistentry>
56588 <varlistentry>
56589 <term><emphasis role="bold">log_message</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
56590 <listitem>
56591 <para>
56592 <indexterm role="concept">
56593 <primary><option>log_message</option> ACL modifier</primary>
56594 </indexterm>
56595 This modifier sets up a message that is used as part of the log message if the
56596 ACL denies access or a <option>warn</option> statement&#x2019;s conditions are true. For example:
56597 </para>
56598 <literallayout class="monospaced">
56599 require log_message = wrong cipher suite $tls_in_cipher
56600         encrypted   = DES-CBC3-SHA
56601 </literallayout>
56602 <para>
56603 <option>log_message</option> is also used when recipients are discarded by <option>discard</option>. For
56604 example:
56605 </para>
56606 <literallayout>
56607 <literal>discard </literal>&lt;<emphasis>some conditions</emphasis>&gt;
56608 <literal>        log_message = Discarded $local_part@$domain because...</literal>
56609 </literallayout>
56610 <para>
56611 When access is denied, <option>log_message</option> adds to any underlying error message
56612 that may exist because of a condition failure. For example, while verifying a
56613 recipient address, a <emphasis>:fail:</emphasis> redirection might have already set up a
56614 message.
56615 </para>
56616 <para>
56617 The message may be defined before the conditions to which it applies, because
56618 the string expansion does not happen until Exim decides that access is to be
56619 denied. This means that any variables that are set by the condition are
56620 available for inclusion in the message. For example, the <varname>$dnslist_</varname>&lt;<emphasis>xxx</emphasis>&gt;
56621 variables are set after a DNS black list lookup succeeds. If the expansion of
56622 <option>log_message</option> fails, or if the result is an empty string, the modifier is
56623 ignored.
56624 </para>
56625 <para>
56626 <indexterm role="variable">
56627 <primary><varname>$acl_verify_message</varname></primary>
56628 </indexterm>
56629 If you want to use a <option>warn</option> statement to log the result of an address
56630 verification, you can use <varname>$acl_verify_message</varname> to include the verification
56631 error message.
56632 </para>
56633 <para>
56634 If <option>log_message</option> is used with a <option>warn</option> statement, <quote>Warning:</quote> is added to
56635 the start of the logged message. If the same warning log message is requested
56636 more than once while receiving  a single email message, only one copy is
56637 actually logged. If you want to log multiple copies, use <option>logwrite</option> instead
56638 of <option>log_message</option>. In the absence of <option>log_message</option> and <option>logwrite</option>, nothing
56639 is logged for a successful <option>warn</option> statement.
56640 </para>
56641 <para>
56642 If <option>log_message</option> is not present and there is no underlying error message (for
56643 example, from the failure of address verification), but <option>message</option> is present,
56644 the <option>message</option> text is used for logging rejections. However, if any text for
56645 logging contains newlines, only the first line is logged. In the absence of
56646 both <option>log_message</option> and <option>message</option>, a default built-in message is used for
56647 logging rejections.
56648 </para>
56649 </listitem></varlistentry>
56650 <varlistentry>
56651 <term><emphasis role="bold">log_reject_target</emphasis>&nbsp;=&nbsp;&lt;<emphasis>log name list</emphasis>&gt;</term>
56652 <listitem>
56653 <para>
56654 <indexterm role="concept">
56655 <primary><option>log_reject_target</option> ACL modifier</primary>
56656 </indexterm>
56657 <indexterm role="concept">
56658 <primary>logging in ACL</primary>
56659 <secondary>specifying which log</secondary>
56660 </indexterm>
56661 This modifier makes it possible to specify which logs are used for messages
56662 about ACL rejections. Its argument is a colon-separated list of words that can
56663 be <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote>. The default is <literal>main:reject</literal>. The list
56664 may be empty, in which case a rejection is not logged at all. For example, this
56665 ACL fragment writes no logging information when access is denied:
56666 </para>
56667 <literallayout>
56668 <literal>deny </literal>&lt;<emphasis>some conditions</emphasis>&gt;
56669 <literal>     log_reject_target =</literal>
56670 </literallayout>
56671 <para>
56672 This modifier can be used in SMTP and non-SMTP ACLs. It applies to both
56673 permanent and temporary rejections. Its effect lasts for the rest of the
56674 current ACL.
56675 </para>
56676 </listitem></varlistentry>
56677 <varlistentry>
56678 <term><emphasis role="bold">logwrite</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
56679 <listitem>
56680 <para>
56681 <indexterm role="concept">
56682 <primary><option>logwrite</option> ACL modifier</primary>
56683 </indexterm>
56684 <indexterm role="concept">
56685 <primary>logging in ACL</primary>
56686 <secondary>immediate</secondary>
56687 </indexterm>
56688 This modifier writes a message to a log file as soon as it is encountered when
56689 processing an ACL. (Compare <option>log_message</option>, which, except in the case of
56690 <option>warn</option> and <option>discard</option>, is used only if the ACL statement denies
56691 access.) The <option>logwrite</option> modifier can be used to log special incidents in
56692 ACLs. For example:
56693 </para>
56694 <literallayout>
56695 <literal>accept </literal>&lt;<emphasis>some special conditions</emphasis>&gt;
56696 <literal>       control  = freeze</literal>
56697 <literal>       logwrite = froze message because ...</literal>
56698 </literallayout>
56699 <para>
56700 By default, the message is written to the main log. However, it may begin
56701 with a colon, followed by a comma-separated list of log names, and then
56702 another colon, to specify exactly which logs are to be written. For
56703 example:
56704 </para>
56705 <literallayout class="monospaced">
56706 logwrite = :main,reject: text for main and reject logs
56707 logwrite = :panic: text for panic log only
56708 </literallayout>
56709 </listitem></varlistentry>
56710 <varlistentry>
56711 <term><emphasis role="bold">message</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
56712 <listitem>
56713 <para>
56714 <indexterm role="concept">
56715 <primary><option>message</option> ACL modifier</primary>
56716 </indexterm>
56717 This modifier sets up a text string that is expanded and used as a response
56718 message when an ACL statement terminates the ACL with an <quote>accept</quote>, <quote>deny</quote>,
56719 or <quote>defer</quote> response. (In the case of the <option>accept</option> and <option>discard</option> verbs,
56720 there is some complication if <option>endpass</option> is involved; see the description of
56721 <option>accept</option> for details.)
56722 </para>
56723 <para>
56724 The expansion of the message happens at the time Exim decides that the ACL is
56725 to end, not at the time it processes <option>message</option>. If the expansion fails, or
56726 generates an empty string, the modifier is ignored. Here is an example where
56727 <option>message</option> must be specified first, because the ACL ends with a rejection if
56728 the <option>hosts</option> condition fails:
56729 </para>
56730 <literallayout class="monospaced">
56731 require  message = Host not recognized
56732          hosts = 10.0.0.0/8
56733 </literallayout>
56734 <para>
56735 (Once a condition has failed, no further conditions or modifiers are
56736 processed.)
56737 </para>
56738 <para>
56739 <indexterm role="concept">
56740 <primary>SMTP</primary>
56741 <secondary>error codes</secondary>
56742 </indexterm>
56743 <indexterm role="option">
56744 <primary><option>smtp_banner</option></primary>
56745 </indexterm>
56746 For ACLs that are triggered by SMTP commands, the message is returned as part
56747 of the SMTP response. The use of <option>message</option> with <option>accept</option> (or <option>discard</option>)
56748 is meaningful only for SMTP, as no message is returned when a non-SMTP message
56749 is accepted. In the case of the connect ACL, accepting with a message modifier
56750 overrides the value of <option>smtp_banner</option>. For the EHLO/HELO ACL, a customized
56751 accept message may not contain more than one line (otherwise it will be
56752 truncated at the first newline and a panic logged), and it cannot affect the
56753 EHLO options.
56754 </para>
56755 <para>
56756 When SMTP is involved, the message may begin with an overriding response code,
56757 consisting of three digits optionally followed by an <quote>extended response code</quote>
56758 of the form <emphasis>n.n.n</emphasis>, each code being followed by a space. For example:
56759 </para>
56760 <literallayout class="monospaced">
56761 deny  message = 599 1.2.3 Host not welcome
56762       hosts = 192.168.34.0/24
56763 </literallayout>
56764 <para>
56765 The first digit of the supplied response code must be the same as would be sent
56766 by default. A panic occurs if it is not. Exim uses a 550 code when it denies
56767 access, but for the predata ACL, note that the default success code is 354, not
56768 2<emphasis>xx</emphasis>.
56769 </para>
56770 <para>
56771 Notwithstanding the previous paragraph, for the QUIT ACL, unlike the others,
56772 the message modifier cannot override the 221 response code.
56773 </para>
56774 <para>
56775 The text in a <option>message</option> modifier is literal; any quotes are taken as
56776 literals, but because the string is expanded, backslash escapes are processed
56777 anyway. If the message contains newlines, this gives rise to a multi-line SMTP
56778 response.
56779 </para>
56780 <para>
56781 <indexterm role="variable">
56782 <primary><varname>$acl_verify_message</varname></primary>
56783 </indexterm>
56784 For ACLs that are called by an <option>acl =</option> ACL condition, the message is
56785 stored in <varname>$acl_verify_message</varname>, from which the calling ACL may use it.
56786 </para>
56787 <para>
56788 If <option>message</option> is used on a statement that verifies an address, the message
56789 specified overrides any message that is generated by the verification process.
56790 However, the original message is available in the variable
56791 <varname>$acl_verify_message</varname>, so you can incorporate it into your message if you
56792 wish. In particular, if you want the text from <option>:fail:</option> items in <command>redirect</command>
56793 routers to be passed back as part of the SMTP response, you should either not
56794 use a <option>message</option> modifier, or make use of <varname>$acl_verify_message</varname>.
56795 </para>
56796 <para>
56797 For compatibility with previous releases of Exim, a <option>message</option> modifier that
56798 is used with a <option>warn</option> verb behaves in a similar way to the <option>add_header</option>
56799 modifier, but this usage is now deprecated. However, <option>message</option> acts only when
56800 all the conditions are true, wherever it appears in an ACL command, whereas
56801 <option>add_header</option> acts as soon as it is encountered. If <option>message</option> is used with
56802 <option>warn</option> in an ACL that is not concerned with receiving a message, it has no
56803 effect.
56804 </para>
56805 </listitem></varlistentry>
56806 <varlistentry>
56807 <term><emphasis role="bold">queue</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
56808 <listitem>
56809 <para>
56810 <indexterm role="concept">
56811 <primary><option>queue</option> ACL modifier</primary>
56812 </indexterm>
56813 <indexterm role="concept">
56814 <primary>named queues</primary>
56815 <secondary>selecting in ACL</secondary>
56816 </indexterm>
56817 This modifier specifies the use of a named queue for spool files
56818 for the message.
56819 It can only be used before the message is received (i.e. not in
56820 the DATA ACL).
56821 This could be used, for example, for known high-volume burst sources
56822 of traffic, or for quarantine of messages.
56823 Separate queue-runner processes will be needed for named queues.
56824 If the text after expansion is empty, the default queue is used.
56825 </para>
56826 </listitem></varlistentry>
56827 <varlistentry>
56828 <term><emphasis role="bold">remove_header</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
56829 <listitem>
56830 <para>
56831 This modifier specifies one or more header names in a colon-separated list
56832  that are to be removed from an incoming message, assuming, of course, that
56833 the message is ultimately accepted. For details, see section <xref linkend="SECTremoveheadacl"/>.
56834 </para>
56835 </listitem></varlistentry>
56836 <varlistentry>
56837 <term><emphasis role="bold">set</emphasis>&nbsp;&lt;<emphasis>acl_name</emphasis>&gt;&nbsp;=&nbsp;&lt;<emphasis>value</emphasis>&gt;</term>
56838 <listitem>
56839 <para>
56840 <indexterm role="concept">
56841 <primary><option>set</option> ACL modifier</primary>
56842 </indexterm>
56843 This modifier puts a value into one of the ACL variables (see section
56844 <xref linkend="SECTaclvariables"/>).
56845 </para>
56846 </listitem></varlistentry>
56847 <varlistentry>
56848 <term><emphasis role="bold">udpsend</emphasis>&nbsp;=&nbsp;&lt;<emphasis>parameters</emphasis>&gt;</term>
56849 <listitem>
56850 <para>
56851 <indexterm role="concept">
56852 <primary>UDP communications</primary>
56853 </indexterm>
56854 This modifier sends a UDP packet, for purposes such as statistics
56855 collection or behaviour monitoring. The parameters are expanded, and
56856 the result of the expansion must be a colon-separated list consisting
56857 of a destination server, port number, and the packet contents. The
56858 server can be specified as a host name or IPv4 or IPv6 address. The
56859 separator can be changed with the usual angle bracket syntax. For
56860 example, you might want to collect information on which hosts connect
56861 when:
56862 </para>
56863 <literallayout class="monospaced">
56864 udpsend = &lt;; 2001:dB8::dead:beef ; 1234 ;\
56865              $tod_zulu $sender_host_address
56866 </literallayout>
56867 </listitem></varlistentry>
56868 </variablelist>
56869 </section>
56870 <section id="SECTcontrols">
56871 <title>Use of the control modifier</title>
56872 <para>
56873 <indexterm role="concept">
56874 <primary><option>control</option> ACL modifier</primary>
56875 </indexterm>
56876 The <option>control</option> modifier supports the following settings:
56877 </para>
56878 <variablelist>
56879 <varlistentry>
56880 <term><emphasis role="bold">control&nbsp;=&nbsp;allow_auth_unadvertised</emphasis></term>
56881 <listitem>
56882 <para>
56883 This modifier allows a client host to use the SMTP AUTH command even when it
56884 has not been advertised in response to EHLO. Furthermore, because there are
56885 apparently some really broken clients that do this, Exim will accept AUTH after
56886 HELO (rather than EHLO) when this control is set. It should be used only if you
56887 really need it, and you should limit its use to those broken clients that do
56888 not work without it. For example:
56889 </para>
56890 <literallayout class="monospaced">
56891 warn hosts   = 192.168.34.25
56892      control = allow_auth_unadvertised
56893 </literallayout>
56894 <para>
56895 Normally, when an Exim server receives an AUTH command, it checks the name of
56896 the authentication mechanism that is given in the command to ensure that it
56897 matches an advertised mechanism. When this control is set, the check that a
56898 mechanism has been advertised is bypassed. Any configured mechanism can be used
56899 by the client. This control is permitted only in the connection and HELO ACLs.
56900 </para>
56901 </listitem></varlistentry>
56902 <varlistentry>
56903 <term><emphasis role="bold">control&nbsp;=&nbsp;caseful_local_part</emphasis></term>
56904 <term><emphasis role="bold">control&nbsp;=&nbsp;caselower_local_part</emphasis></term>
56905 <listitem>
56906 <para>
56907 <indexterm role="concept">
56908 <primary>access control lists (ACLs)</primary>
56909 <secondary>case of local part in</secondary>
56910 </indexterm>
56911 <indexterm role="concept">
56912 <primary>case of local parts</primary>
56913 </indexterm>
56914 <indexterm role="variable">
56915 <primary><varname>$local_part</varname></primary>
56916 </indexterm>
56917 These two controls are permitted only in the ACL specified by <option>acl_smtp_rcpt</option>
56918 (that is, during RCPT processing). By default, the contents of <varname>$local_part</varname>
56919 are lower cased before ACL processing. If <quote>caseful_local_part</quote> is specified,
56920 any uppercase letters in the original local part are restored in <varname>$local_part</varname>
56921 for the rest of the ACL, or until a control that sets <quote>caselower_local_part</quote>
56922 is encountered.
56923 </para>
56924 <para>
56925 These controls affect only the current recipient. Moreover, they apply only to
56926 local part handling that takes place directly in the ACL (for example, as a key
56927 in lookups). If a test to verify the recipient is obeyed, the case-related
56928 handling of the local part during the verification is controlled by the router
56929 configuration (see the <option>caseful_local_part</option> generic router option).
56930 </para>
56931 <para>
56932 This facility could be used, for example, to add a spam score to local parts
56933 containing upper case letters. For example, using <varname>$acl_m4</varname> to accumulate the
56934 spam score:
56935 </para>
56936 <literallayout class="monospaced">
56937 warn  control = caseful_local_part
56938       set acl_m4 = ${eval:\
56939                      $acl_m4 + \
56940                      ${if match{$local_part}{[A-Z]}{1}{0}}\
56941                     }
56942       control = caselower_local_part
56943 </literallayout>
56944 <para>
56945 Notice that we put back the lower cased version afterwards, assuming that
56946 is what is wanted for subsequent tests.
56947 </para>
56948 </listitem></varlistentry>
56949 <varlistentry>
56950 <term><emphasis role="bold">control&nbsp;=&nbsp;cutthrough_delivery/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
56951 <listitem>
56952 <para>
56953 <indexterm role="concept">
56954 <primary>access control lists (ACLs)</primary>
56955 <secondary>cutthrough routing</secondary>
56956 </indexterm>
56957 <indexterm role="concept">
56958 <primary>cutthrough</primary>
56959 <secondary>requesting</secondary>
56960 </indexterm>
56961 This option requests delivery be attempted while the item is being received.
56962 </para>
56963 <para>
56964 The option is usable in the RCPT ACL.
56965 If enabled for a message received via smtp and routed to an smtp transport,
56966 and only one transport, interface, destination host and port combination
56967 is used for all recipients of the message,
56968 then the delivery connection is made while the receiving connection is open
56969 and data is copied from one to the other.
56970 </para>
56971 <para>
56972 An attempt to set this option for any recipient but the first
56973 for a mail will be quietly ignored.
56974 If a recipient-verify callout
56975 (with use_sender)
56976 connection is subsequently
56977 requested in the same ACL it is held open and used for
56978 any subsequent recipients and the data,
56979 otherwise one is made after the initial RCPT ACL completes.
56980 </para>
56981 <para>
56982 Note that routers are used in verify mode,
56983 and cannot depend on content of received headers.
56984 Note also that headers cannot be
56985 modified by any of the post-data ACLs (DATA, MIME and DKIM).
56986 Headers may be modified by routers (subject to the above) and transports.
56987 The <emphasis>Received-By:</emphasis> header is generated as soon as the body reception starts,
56988 rather than the traditional time after the full message is received;
56989 this will affect the timestamp.
56990 </para>
56991 <para>
56992 All the usual ACLs are called; if one results in the message being
56993 rejected, all effort spent in delivery (including the costs on
56994 the ultimate destination) will be wasted.
56995 Note that in the case of data-time ACLs this includes the entire
56996 message body.
56997 </para>
56998 <para>
56999 Cutthrough delivery is not supported via transport-filters or when DKIM signing
57000 of outgoing messages is done, because it sends data to the ultimate destination
57001 before the entire message has been received from the source.
57002 It is not supported for messages received with the SMTP PRDR
57003 or CHUNKING
57004 options in use.
57005 </para>
57006 <para>
57007 Should the ultimate destination system positively accept or reject the mail,
57008 a corresponding indication is given to the source system and nothing is queued.
57009 If the item is successfully delivered in cutthrough mode
57010 the delivery log lines are tagged with "&gt;&gt;" rather than "=&gt;" and appear
57011 before the acceptance "&lt;=" line.
57012 </para>
57013 <para>
57014 If there is a temporary error the item is queued for later delivery in the
57015 usual fashion.
57016 This behaviour can be adjusted by appending the option <emphasis role="bold">defer=</emphasis>&lt;<emphasis>value</emphasis>&gt;
57017 to the control; the default value is <quote>spool</quote> and the alternate value
57018 <quote>pass</quote> copies an SMTP defer response from the target back to the initiator
57019 and does not queue the message.
57020 Note that this is independent of any recipient verify conditions in the ACL.
57021 </para>
57022 <para>
57023 Delivery in this mode avoids the generation of a bounce mail to a
57024 (possibly faked)
57025 sender when the destination system is doing content-scan based rejection.
57026 </para>
57027 </listitem></varlistentry>
57028 <varlistentry>
57029 <term><emphasis role="bold">control&nbsp;=&nbsp;debug/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
57030 <listitem>
57031 <para>
57032 <indexterm role="concept">
57033 <primary>access control lists (ACLs)</primary>
57034 <secondary>enabling debug logging</secondary>
57035 </indexterm>
57036 <indexterm role="concept">
57037 <primary>debugging</primary>
57038 <secondary>enabling from an ACL</secondary>
57039 </indexterm>
57040 This control turns on debug logging, almost as though Exim had been invoked
57041 with <literal>-d</literal>, with the output going to a new logfile in the usual logs directory,
57042 by default called <emphasis>debuglog</emphasis>.
57043 The filename can be adjusted with the <emphasis>tag</emphasis> option, which
57044 may access any variables already defined.  The logging may be adjusted with
57045 the <emphasis>opts</emphasis> option, which takes the same values as the <literal>-d</literal> command-line
57046 option.
57047 Logging started this way may be stopped, and the file removed,
57048 with the <emphasis>kill</emphasis> option.
57049 Some examples (which depend on variables that don&#x2019;t exist in all
57050 contexts):
57051 </para>
57052 <literallayout class="monospaced">
57053       control = debug
57054       control = debug/tag=.$sender_host_address
57055       control = debug/opts=+expand+acl
57056       control = debug/tag=.$message_exim_id/opts=+expand
57057       control = debug/kill
57058 </literallayout>
57059 </listitem></varlistentry>
57060 <varlistentry>
57061 <term><emphasis role="bold">control&nbsp;=&nbsp;dkim_disable_verify</emphasis></term>
57062 <listitem>
57063 <para>
57064 <indexterm role="concept">
57065 <primary>disable DKIM verify</primary>
57066 </indexterm>
57067 <indexterm role="concept">
57068 <primary>DKIM</primary>
57069 <secondary>disable verify</secondary>
57070 </indexterm>
57071 This control turns off DKIM verification processing entirely.  For details on
57072 the operation and configuration of DKIM, see section <xref linkend="SECDKIM"/>.
57073 </para>
57074 </listitem></varlistentry>
57075 <varlistentry>
57076 <term><emphasis role="bold">control&nbsp;=&nbsp;dscp/</emphasis>&lt;<emphasis>value</emphasis>&gt;</term>
57077 <listitem>
57078 <para>
57079 <indexterm role="concept">
57080 <primary>access control lists (ACLs)</primary>
57081 <secondary>setting DSCP value</secondary>
57082 </indexterm>
57083 <indexterm role="concept">
57084 <primary>DSCP</primary>
57085 <secondary>inbound</secondary>
57086 </indexterm>
57087 This option causes the DSCP value associated with the socket for the inbound
57088 connection to be adjusted to a given value, given as one of a number of fixed
57089 strings or to numeric value.
57090 The <option>-bI:dscp</option> option may be used to ask Exim which names it knows of.
57091 Common values include <literal>throughput</literal>, <literal>mincost</literal>, and on newer systems
57092 <literal>ef</literal>, <literal>af41</literal>, etc.  Numeric values may be in the range 0 to 0x3F.
57093 </para>
57094 <para>
57095 The outbound packets from Exim will be marked with this value in the header
57096 (for IPv4, the TOS field; for IPv6, the TCLASS field); there is no guarantee
57097 that these values will have any effect, not be stripped by networking
57098 equipment, or do much of anything without cooperation with your Network
57099 Engineer and those of all network operators between the source and destination.
57100 </para>
57101 </listitem></varlistentry>
57102 <varlistentry>
57103 <term><emphasis role="bold">control&nbsp;=&nbsp;enforce_sync</emphasis></term>
57104 <term><emphasis role="bold">control&nbsp;=&nbsp;no_enforce_sync</emphasis></term>
57105 <listitem>
57106 <para>
57107 <indexterm role="concept">
57108 <primary>SMTP</primary>
57109 <secondary>synchronization checking</secondary>
57110 </indexterm>
57111 <indexterm role="concept">
57112 <primary>synchronization checking in SMTP</primary>
57113 </indexterm>
57114 These controls make it possible to be selective about when SMTP synchronization
57115 is enforced. The global option <option>smtp_enforce_sync</option> specifies the initial
57116 state of the switch (it is true by default). See the description of this option
57117 in chapter <xref linkend="CHAPmainconfig"/> for details of SMTP synchronization checking.
57118 </para>
57119 <para>
57120 The effect of these two controls lasts for the remainder of the SMTP
57121 connection. They can appear in any ACL except the one for the non-SMTP
57122 messages. The most straightforward place to put them is in the ACL defined by
57123 <option>acl_smtp_connect</option>, which is run at the start of an incoming SMTP connection,
57124 before the first synchronization check. The expected use is to turn off the
57125 synchronization checks for badly-behaved hosts that you nevertheless need to
57126 work with.
57127 </para>
57128 </listitem></varlistentry>
57129 <varlistentry>
57130 <term><emphasis role="bold">control&nbsp;=&nbsp;fakedefer/</emphasis>&lt;<emphasis>message</emphasis>&gt;</term>
57131 <listitem>
57132 <para>
57133 <indexterm role="concept">
57134 <primary>fake defer</primary>
57135 </indexterm>
57136 <indexterm role="concept">
57137 <primary>defer, fake</primary>
57138 </indexterm>
57139 This control works in exactly the same way as <option>fakereject</option> (described below)
57140 except that it causes an SMTP 450 response after the message data instead of a
57141 550 response. You must take care when using <option>fakedefer</option> because it causes the
57142 messages to be duplicated when the sender retries. Therefore, you should not
57143 use <option>fakedefer</option> if the message is to be delivered normally.
57144 </para>
57145 </listitem></varlistentry>
57146 <varlistentry>
57147 <term><emphasis role="bold">control&nbsp;=&nbsp;fakereject/</emphasis>&lt;<emphasis>message</emphasis>&gt;</term>
57148 <listitem>
57149 <para>
57150 <indexterm role="concept">
57151 <primary>fake rejection</primary>
57152 </indexterm>
57153 <indexterm role="concept">
57154 <primary>rejection, fake</primary>
57155 </indexterm>
57156 This control is permitted only for the MAIL, RCPT, and DATA ACLs, in other
57157 words, only when an SMTP message is being received. If Exim accepts the
57158 message, instead the final 250 response, a 550 rejection message is sent.
57159 However, Exim proceeds to deliver the message as normal. The control applies
57160 only to the current message, not to any subsequent ones that may be received in
57161 the same SMTP connection.
57162 </para>
57163 <para>
57164 The text for the 550 response is taken from the <option>control</option> modifier. If no
57165 message is supplied, the following is used:
57166 </para>
57167 <literallayout class="monospaced">
57168 550-Your message has been rejected but is being
57169 550-kept for evaluation.
57170 550-If it was a legitimate message, it may still be
57171 550 delivered to the target recipient(s).
57172 </literallayout>
57173 <para>
57174 This facility should be used with extreme caution.
57175 </para>
57176 </listitem></varlistentry>
57177 <varlistentry>
57178 <term><emphasis role="bold">control&nbsp;=&nbsp;freeze</emphasis></term>
57179 <listitem>
57180 <para>
57181 <indexterm role="concept">
57182 <primary>frozen messages</primary>
57183 <secondary>forcing in ACL</secondary>
57184 </indexterm>
57185 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
57186 other words, only when a message is being received. If the message is accepted,
57187 it is placed on Exim&#x2019;s queue and frozen. The control applies only to the
57188 current message, not to any subsequent ones that may be received in the same
57189 SMTP connection.
57190 </para>
57191 <para>
57192 This modifier can optionally be followed by <literal>/no_tell</literal>. If the global option
57193 <option>freeze_tell</option> is set, it is ignored for the current message (that is, nobody
57194 is told about the freezing), provided all the <emphasis role="bold">control=freeze</emphasis> modifiers that
57195 are obeyed for the current message have the <literal>/no_tell</literal> option.
57196 </para>
57197 </listitem></varlistentry>
57198 <varlistentry>
57199 <term><emphasis role="bold">control&nbsp;=&nbsp;no_delay_flush</emphasis></term>
57200 <listitem>
57201 <para>
57202 <indexterm role="concept">
57203 <primary>SMTP</primary>
57204 <secondary>output flushing, disabling for delay</secondary>
57205 </indexterm>
57206 Exim normally flushes SMTP output before implementing a delay in an ACL, to
57207 avoid unexpected timeouts in clients when the SMTP PIPELINING extension is in
57208 use. This control, as long as it is encountered before the <option>delay</option> modifier,
57209 disables such output flushing.
57210 </para>
57211 </listitem></varlistentry>
57212 <varlistentry>
57213 <term><emphasis role="bold">control&nbsp;=&nbsp;no_callout_flush</emphasis></term>
57214 <listitem>
57215 <para>
57216 <indexterm role="concept">
57217 <primary>SMTP</primary>
57218 <secondary>output flushing, disabling for callout</secondary>
57219 </indexterm>
57220 Exim normally flushes SMTP output before performing a callout in an ACL, to
57221 avoid unexpected timeouts in clients when the SMTP PIPELINING extension is in
57222 use. This control, as long as it is encountered before the <option>verify</option> condition
57223 that causes the callout, disables such output flushing.
57224 </para>
57225 </listitem></varlistentry>
57226 <varlistentry>
57227 <term><emphasis role="bold">control&nbsp;=&nbsp;no_mbox_unspool</emphasis></term>
57228 <listitem>
57229 <para>
57230 This control is available when Exim is compiled with the content scanning
57231 extension. Content scanning may require a copy of the current message, or parts
57232 of it, to be written in <quote>mbox format</quote> to a spool file, for passing to a virus
57233 or spam scanner. Normally, such copies are deleted when they are no longer
57234 needed. If this control is set, the copies are not deleted. The control applies
57235 only to the current message, not to any subsequent ones that may be received in
57236 the same SMTP connection. It is provided for debugging purposes and is unlikely
57237 to be useful in production.
57238 </para>
57239 </listitem></varlistentry>
57240 <varlistentry>
57241 <term><emphasis role="bold">control&nbsp;=&nbsp;no_multiline_responses</emphasis></term>
57242 <listitem>
57243 <para>
57244 <indexterm role="concept">
57245 <primary>multiline responses, suppressing</primary>
57246 </indexterm>
57247 This control is permitted for any ACL except the one for non-SMTP messages.
57248 It seems that there are broken clients in use that cannot handle multiline
57249 SMTP responses, despite the fact that RFC 821 defined them over 20 years ago.
57250 </para>
57251 <para>
57252 If this control is set, multiline SMTP responses from ACL rejections are
57253 suppressed. One way of doing this would have been to put out these responses as
57254 one long line. However, RFC 2821 specifies a maximum of 512 bytes per response
57255 (<quote>use multiline responses for more</quote> it says &ndash; ha!), and some of the
57256 responses might get close to that. So this facility, which is after all only a
57257 sop to broken clients, is implemented by doing two very easy things:
57258 </para>
57259 <itemizedlist>
57260 <listitem>
57261 <para>
57262 Extra information that is normally output as part of a rejection caused by
57263 sender verification failure is omitted. Only the final line (typically <quote>sender
57264 verification failed</quote>) is sent.
57265 </para>
57266 </listitem>
57267 <listitem>
57268 <para>
57269 If a <option>message</option> modifier supplies a multiline response, only the first
57270 line is output.
57271 </para>
57272 </listitem>
57273 </itemizedlist>
57274 <para>
57275 The setting of the switch can, of course, be made conditional on the
57276 calling host. Its effect lasts until the end of the SMTP connection.
57277 </para>
57278 </listitem></varlistentry>
57279 <varlistentry>
57280 <term><emphasis role="bold">control&nbsp;=&nbsp;no_pipelining</emphasis></term>
57281 <listitem>
57282 <para>
57283 <indexterm role="concept">
57284 <primary>PIPELINING</primary>
57285 <secondary>suppressing advertising</secondary>
57286 </indexterm>
57287 This control turns off the advertising of the PIPELINING extension to SMTP in
57288 the current session. To be useful, it must be obeyed before Exim sends its
57289 response to an EHLO command. Therefore, it should normally appear in an ACL
57290 controlled by <option>acl_smtp_connect</option> or <option>acl_smtp_helo</option>. See also
57291 <option>pipelining_advertise_hosts</option>.
57292 </para>
57293 </listitem></varlistentry>
57294 <varlistentry>
57295 <term><emphasis role="bold">control&nbsp;=&nbsp;queue_only</emphasis></term>
57296 <listitem>
57297 <para>
57298 <indexterm role="option">
57299 <primary><option>queue_only</option></primary>
57300 </indexterm>
57301 <indexterm role="concept">
57302 <primary>queueing incoming messages</primary>
57303 </indexterm>
57304 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
57305 other words, only when a message is being received. If the message is accepted,
57306 it is placed on Exim&#x2019;s queue and left there for delivery by a subsequent queue
57307 runner. No immediate delivery process is started. In other words, it has the
57308 effect as the <option>queue_only</option> global option. However, the control applies only
57309 to the current message, not to any subsequent ones that may be received in the
57310 same SMTP connection.
57311 </para>
57312 </listitem></varlistentry>
57313 <varlistentry>
57314 <term><emphasis role="bold">control&nbsp;=&nbsp;submission/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
57315 <listitem>
57316 <para>
57317 <indexterm role="concept">
57318 <primary>message</primary>
57319 <secondary>submission</secondary>
57320 </indexterm>
57321 <indexterm role="concept">
57322 <primary>submission mode</primary>
57323 </indexterm>
57324 This control is permitted only for the MAIL, RCPT, and start of data ACLs (the
57325 latter is the one defined by <option>acl_smtp_predata</option>). Setting it tells Exim that
57326 the current message is a submission from a local MUA. In this case, Exim
57327 operates in <quote>submission mode</quote>, and applies certain fixups to the message if
57328 necessary. For example, it adds a <emphasis>Date:</emphasis> header line if one is not present.
57329 This control is not permitted in the <option>acl_smtp_data</option> ACL, because that is too
57330 late (the message has already been created).
57331 </para>
57332 <para>
57333 Chapter <xref linkend="CHAPmsgproc"/> describes the processing that Exim applies to
57334 messages. Section <xref linkend="SECTsubmodnon"/> covers the processing that happens in
57335 submission mode; the available options for this control are described there.
57336 The control applies only to the current message, not to any subsequent ones
57337 that may be received in the same SMTP connection.
57338 </para>
57339 </listitem></varlistentry>
57340 <varlistentry>
57341 <term><emphasis role="bold">control&nbsp;=&nbsp;suppress_local_fixups</emphasis></term>
57342 <listitem>
57343 <para>
57344 <indexterm role="concept">
57345 <primary>submission fixups, suppressing</primary>
57346 </indexterm>
57347 This control applies to locally submitted (non TCP/IP) messages, and is the
57348 complement of <literal>control = submission</literal>. It disables the fixups that are
57349 normally applied to locally-submitted messages. Specifically:
57350 </para>
57351 <itemizedlist>
57352 <listitem>
57353 <para>
57354 Any <emphasis>Sender:</emphasis> header line is left alone (in this respect, it is a
57355 dynamic version of <option>local_sender_retain</option>).
57356 </para>
57357 </listitem>
57358 <listitem>
57359 <para>
57360 No <emphasis>Message-ID:</emphasis>, <emphasis>From:</emphasis>, or <emphasis>Date:</emphasis> header lines are added.
57361 </para>
57362 </listitem>
57363 <listitem>
57364 <para>
57365 There is no check that <emphasis>From:</emphasis> corresponds to the actual sender.
57366 </para>
57367 </listitem>
57368 </itemizedlist>
57369 <para>
57370 This control may be useful when a remotely-originated message is accepted,
57371 passed to some scanning program, and then re-submitted for delivery. It can be
57372 used only in the <option>acl_smtp_mail</option>, <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>,
57373 and <option>acl_not_smtp_start</option> ACLs, because it has to be set before the message&#x2019;s
57374 data is read.
57375 </para>
57376 <para>
57377 <emphasis role="bold">Note:</emphasis> This control applies only to the current message, not to any others
57378 that are being submitted at the same time using <option>-bs</option> or <option>-bS</option>.
57379 </para>
57380 </listitem></varlistentry>
57381 <varlistentry>
57382 <term><emphasis role="bold">control&nbsp;=&nbsp;utf8_downconvert</emphasis></term>
57383 <listitem>
57384 <para>
57385 This control enables conversion of UTF-8 in message addresses
57386 to a-label form.
57387 For details see section <xref linkend="SECTi18nMTA"/>.
57388 </para>
57389 </listitem></varlistentry>
57390 </variablelist>
57391 </section>
57392 <section id="SECTsummesfix">
57393 <title>Summary of message fixup control</title>
57394 <para>
57395 All four possibilities for message fixups can be specified:
57396 </para>
57397 <itemizedlist>
57398 <listitem>
57399 <para>
57400 Locally submitted, fixups applied: the default.
57401 </para>
57402 </listitem>
57403 <listitem>
57404 <para>
57405 Locally submitted, no fixups applied: use
57406 <literal>control = suppress_local_fixups</literal>.
57407 </para>
57408 </listitem>
57409 <listitem>
57410 <para>
57411 Remotely submitted, no fixups applied: the default.
57412 </para>
57413 </listitem>
57414 <listitem>
57415 <para>
57416 Remotely submitted, fixups applied: use <literal>control = submission</literal>.
57417 </para>
57418 </listitem>
57419 </itemizedlist>
57420 </section>
57421 <section id="SECTaddheadacl">
57422 <title>Adding header lines in ACLs</title>
57423 <para>
57424 <indexterm role="concept">
57425 <primary>header lines</primary>
57426 <secondary>adding in an ACL</secondary>
57427 </indexterm>
57428 <indexterm role="concept">
57429 <primary>header lines</primary>
57430 <secondary>position of added lines</secondary>
57431 </indexterm>
57432 <indexterm role="concept">
57433 <primary><option>add_header</option> ACL modifier</primary>
57434 </indexterm>
57435 The <option>add_header</option> modifier can be used to add one or more extra header lines
57436 to an incoming message, as in this example:
57437 </para>
57438 <literallayout class="monospaced">
57439 warn dnslists = sbl.spamhaus.org : \
57440                 dialup.mail-abuse.org
57441      add_header = X-blacklisted-at: $dnslist_domain
57442 </literallayout>
57443 <para>
57444 The <option>add_header</option> modifier is permitted in the MAIL, RCPT, PREDATA, DATA,
57445 MIME, DKIM, and non-SMTP ACLs (in other words, those that are concerned with
57446 receiving a message). The message must ultimately be accepted for
57447 <option>add_header</option> to have any significant effect. You can use <option>add_header</option> with
57448 any ACL verb, including <option>deny</option> (though this is potentially useful only in a
57449 RCPT ACL).
57450 </para>
57451 <para>
57452 Headers will not be added to the message if the modifier is used in
57453 DATA, MIME or DKIM ACLs for a message delivered by cutthrough routing.
57454 </para>
57455 <para>
57456 Leading and trailing newlines are removed from
57457 the data for the <option>add_header</option> modifier; if it then
57458 contains one or more newlines that
57459 are not followed by a space or a tab, it is assumed to contain multiple header
57460 lines. Each one is checked for valid syntax; <literal>X-ACL-Warn:</literal> is added to the
57461 front of any line that is not a valid header line.
57462 </para>
57463 <para>
57464 Added header lines are accumulated during the MAIL, RCPT, and predata ACLs.
57465 They are added to the message before processing the DATA and MIME ACLs.
57466 However, if an identical header line is requested more than once, only one copy
57467 is actually added to the message. Further header lines may be accumulated
57468 during the DATA and MIME ACLs, after which they are added to the message, again
57469 with duplicates suppressed. Thus, it is possible to add two identical header
57470 lines to an SMTP message, but only if one is added before DATA and one after.
57471 In the case of non-SMTP messages, new headers are accumulated during the
57472 non-SMTP ACLs, and are added to the message after all the ACLs have run. If a
57473 message is rejected after DATA or by the non-SMTP ACL, all added header lines
57474 are included in the entry that is written to the reject log.
57475 </para>
57476 <para>
57477 <indexterm role="concept">
57478 <primary>header lines</primary>
57479 <secondary>added; visibility of</secondary>
57480 </indexterm>
57481 Header lines are not visible in string expansions
57482 of message headers
57483 until they are added to the
57484 message. It follows that header lines defined in the MAIL, RCPT, and predata
57485 ACLs are not visible until the DATA ACL and MIME ACLs are run. Similarly,
57486 header lines that are added by the DATA or MIME ACLs are not visible in those
57487 ACLs. Because of this restriction, you cannot use header lines as a way of
57488 passing data between (for example) the MAIL and RCPT ACLs. If you want to do
57489 this, you can use ACL variables, as described in section
57490 <xref linkend="SECTaclvariables"/>.
57491 </para>
57492 <para>
57493 The list of headers yet to be added is given by the <option>$headers_added</option> variable.
57494 </para>
57495 <para>
57496 The <option>add_header</option> modifier acts immediately as it is encountered during the
57497 processing of an ACL. Notice the difference between these two cases:
57498 </para>
57499 <literallayout>
57500 <literal>accept add_header = ADDED: some text</literal>
57501 <literal>       </literal>&lt;<emphasis>some condition</emphasis>&gt;
57502
57503 <literal>accept </literal>&lt;<emphasis>some condition</emphasis>&gt;
57504 <literal>       add_header = ADDED: some text</literal>
57505 </literallayout>
57506 <para>
57507 In the first case, the header line is always added, whether or not the
57508 condition is true. In the second case, the header line is added only if the
57509 condition is true. Multiple occurrences of <option>add_header</option> may occur in the same
57510 ACL statement. All those that are encountered before a condition fails are
57511 honoured.
57512 </para>
57513 <para>
57514 <indexterm role="concept">
57515 <primary><option>warn</option> ACL verb</primary>
57516 </indexterm>
57517 For compatibility with previous versions of Exim, a <option>message</option> modifier for a
57518 <option>warn</option> verb acts in the same way as <option>add_header</option>, except that it takes
57519 effect only if all the conditions are true, even if it appears before some of
57520 them. Furthermore, only the last occurrence of <option>message</option> is honoured. This
57521 usage of <option>message</option> is now deprecated. If both <option>add_header</option> and <option>message</option>
57522 are present on a <option>warn</option> verb, both are processed according to their
57523 specifications.
57524 </para>
57525 <para>
57526 By default, new header lines are added to a message at the end of the existing
57527 header lines. However, you can specify that any particular header line should
57528 be added right at the start (before all the <emphasis>Received:</emphasis> lines), immediately
57529 after the first block of <emphasis>Received:</emphasis> lines, or immediately before any line
57530 that is not a <emphasis>Received:</emphasis> or <emphasis>Resent-something:</emphasis> header.
57531 </para>
57532 <para>
57533 This is done by specifying <quote>:at_start:</quote>, <quote>:after_received:</quote>, or
57534 <quote>:at_start_rfc:</quote> (or, for completeness, <quote>:at_end:</quote>) before the text of the
57535 header line, respectively. (Header text cannot start with a colon, as there has
57536 to be a header name first.) For example:
57537 </para>
57538 <literallayout class="monospaced">
57539 warn add_header = \
57540        :after_received:X-My-Header: something or other...
57541 </literallayout>
57542 <para>
57543 If more than one header line is supplied in a single <option>add_header</option> modifier,
57544 each one is treated independently and can therefore be placed differently. If
57545 you add more than one line at the start, or after the Received: block, they end
57546 up in reverse order.
57547 </para>
57548 <para>
57549 <emphasis role="bold">Warning</emphasis>: This facility currently applies only to header lines that are
57550 added in an ACL. It does NOT work for header lines that are added in a
57551 system filter or in a router or transport.
57552 </para>
57553 </section>
57554 <section id="SECTremoveheadacl">
57555 <title>Removing header lines in ACLs</title>
57556 <para>
57557 <indexterm role="concept">
57558 <primary>header lines</primary>
57559 <secondary>removing in an ACL</secondary>
57560 </indexterm>
57561 <indexterm role="concept">
57562 <primary>header lines</primary>
57563 <secondary>position of removed lines</secondary>
57564 </indexterm>
57565 <indexterm role="concept">
57566 <primary><option>remove_header</option> ACL modifier</primary>
57567 </indexterm>
57568 The <option>remove_header</option> modifier can be used to remove one or more header lines
57569 from an incoming message, as in this example:
57570 </para>
57571 <literallayout class="monospaced">
57572 warn   message        = Remove internal headers
57573        remove_header  = x-route-mail1 : x-route-mail2
57574 </literallayout>
57575 <para>
57576 The <option>remove_header</option> modifier is permitted in the MAIL, RCPT, PREDATA, DATA,
57577 MIME, DKIM, and non-SMTP ACLs (in other words, those that are concerned with
57578 receiving a message). The message must ultimately be accepted for
57579 <option>remove_header</option> to have any significant effect. You can use <option>remove_header</option>
57580 with any ACL verb, including <option>deny</option>, though this is really not useful for
57581 any verb that doesn&#x2019;t result in a delivered message.
57582 </para>
57583 <para>
57584 Headers will not be removed from the message if the modifier is used in
57585 DATA, MIME or DKIM ACLs for a message delivered by cutthrough routing.
57586 </para>
57587 <para>
57588 More than one header can be removed at the same time by using a colon separated
57589 list of header names. The header matching is case insensitive. Wildcards are
57590 not permitted, nor is list expansion performed, so you cannot use hostlists to
57591 create a list of headers, however both connection and message variable expansion
57592 are performed (<option>$acl_c_*</option> and <option>$acl_m_*</option>), illustrated in this example:
57593 </para>
57594 <literallayout class="monospaced">
57595 warn   hosts           = +internal_hosts
57596        set acl_c_ihdrs = x-route-mail1 : x-route-mail2
57597 warn   message         = Remove internal headers
57598        remove_header   = $acl_c_ihdrs
57599 </literallayout>
57600 <para>
57601 Header names for removal are accumulated during the MAIL, RCPT, and predata ACLs.
57602 Matching header lines are removed from the message before processing the DATA and MIME ACLs.
57603 If multiple header lines match, all are removed.
57604 There is no harm in attempting to remove the same header twice nor in removing
57605 a non-existent header. Further header lines to be removed may be accumulated
57606 during the DATA and MIME ACLs, after which they are removed from the message,
57607 if present. In the case of non-SMTP messages, headers to be removed are
57608 accumulated during the non-SMTP ACLs, and are removed from the message after
57609 all the ACLs have run. If a message is rejected after DATA or by the non-SMTP
57610 ACL, there really is no effect because there is no logging of what headers
57611 would have been removed.
57612 </para>
57613 <para>
57614 <indexterm role="concept">
57615 <primary>header lines</primary>
57616 <secondary>removed; visibility of</secondary>
57617 </indexterm>
57618 Header lines are not visible in string expansions until the DATA phase when it
57619 is received. Any header lines removed in the MAIL, RCPT, and predata ACLs are
57620 not visible in the DATA ACL and MIME ACLs. Similarly, header lines that are
57621 removed by the DATA or MIME ACLs are still visible in those ACLs. Because of
57622 this restriction, you cannot use header lines as a way of controlling data
57623 passed between (for example) the MAIL and RCPT ACLs. If you want to do this,
57624 you should instead use ACL variables, as described in section
57625 <xref linkend="SECTaclvariables"/>.
57626 </para>
57627 <para>
57628 The <option>remove_header</option> modifier acts immediately as it is encountered during the
57629 processing of an ACL. Notice the difference between these two cases:
57630 </para>
57631 <literallayout>
57632 <literal>accept remove_header = X-Internal</literal>
57633 <literal>       </literal>&lt;<emphasis>some condition</emphasis>&gt;
57634
57635 <literal>accept </literal>&lt;<emphasis>some condition</emphasis>&gt;
57636 <literal>       remove_header = X-Internal</literal>
57637 </literallayout>
57638 <para>
57639 In the first case, the header line is always removed, whether or not the
57640 condition is true. In the second case, the header line is removed only if the
57641 condition is true. Multiple occurrences of <option>remove_header</option> may occur in the
57642 same ACL statement. All those that are encountered before a condition fails
57643 are honoured.
57644 </para>
57645 <para>
57646 <emphasis role="bold">Warning</emphasis>: This facility currently applies only to header lines that are
57647 present during ACL processing. It does NOT remove header lines that are added
57648 in a system filter or in a router or transport.
57649 </para>
57650 </section>
57651 <section id="SECTaclconditions">
57652 <title>ACL conditions</title>
57653 <para>
57654 <indexterm role="concept">
57655 <primary>access control lists (ACLs)</primary>
57656 <secondary>conditions; list of</secondary>
57657 </indexterm>
57658 Some of the conditions listed in this section are available only when Exim is
57659 compiled with the content-scanning extension. They are included here briefly
57660 for completeness. More detailed descriptions can be found in the discussion on
57661 content scanning in chapter <xref linkend="CHAPexiscan"/>.
57662 </para>
57663 <para>
57664 Not all conditions are relevant in all circumstances. For example, testing
57665 senders and recipients does not make sense in an ACL that is being run as the
57666 result of the arrival of an ETRN command, and checks on message headers can be
57667 done only in the ACLs specified by <option>acl_smtp_data</option> and <option>acl_not_smtp</option>. You
57668 can use the same condition (with different parameters) more than once in the
57669 same ACL statement. This provides a way of specifying an <quote>and</quote> conjunction.
57670 The conditions are as follows:
57671 </para>
57672 <variablelist>
57673 <varlistentry>
57674 <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>
57675 <listitem>
57676 <para>
57677 <indexterm role="concept">
57678 <primary>access control lists (ACLs)</primary>
57679 <secondary>nested</secondary>
57680 </indexterm>
57681 <indexterm role="concept">
57682 <primary>access control lists (ACLs)</primary>
57683 <secondary>indirect</secondary>
57684 </indexterm>
57685 <indexterm role="concept">
57686 <primary>access control lists (ACLs)</primary>
57687 <secondary>arguments</secondary>
57688 </indexterm>
57689 <indexterm role="concept">
57690 <primary><option>acl</option> ACL condition</primary>
57691 </indexterm>
57692 The possible values of the argument are the same as for the
57693 <option>acl_smtp_</option><emphasis>xxx</emphasis> options. The named or inline ACL is run. If it returns
57694 <quote>accept</quote> the condition is true; if it returns <quote>deny</quote> the condition is
57695 false. If it returns <quote>defer</quote>, the current ACL returns <quote>defer</quote> unless the
57696 condition is on a <option>warn</option> verb. In that case, a <quote>defer</quote> return makes the
57697 condition false. This means that further processing of the <option>warn</option> verb
57698 ceases, but processing of the ACL continues.
57699 </para>
57700 <para>
57701 If the argument is a named ACL, up to nine space-separated optional values
57702 can be appended; they appear within the called ACL in $acl_arg1 to $acl_arg9,
57703 and $acl_narg is set to the count of values.
57704 Previous values of these variables are restored after the call returns.
57705 The name and values are expanded separately.
57706 Note that spaces in complex expansions which are used as arguments
57707 will act as argument separators.
57708 </para>
57709 <para>
57710 If the nested <option>acl</option> returns <quote>drop</quote> and the outer condition denies access,
57711 the connection is dropped. If it returns <quote>discard</quote>, the verb must be
57712 <option>accept</option> or <option>discard</option>, and the action is taken immediately &ndash; no further
57713 conditions are tested.
57714 </para>
57715 <para>
57716 ACLs may be nested up to 20 deep; the limit exists purely to catch runaway
57717 loops. This condition allows you to use different ACLs in different
57718 circumstances. For example, different ACLs can be used to handle RCPT commands
57719 for different local users or different local domains.
57720 </para>
57721 </listitem></varlistentry>
57722 <varlistentry>
57723 <term><emphasis role="bold">authenticated&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string&nbsp;list</emphasis>&gt;</term>
57724 <listitem>
57725 <para>
57726 <indexterm role="concept">
57727 <primary><option>authenticated</option> ACL condition</primary>
57728 </indexterm>
57729 <indexterm role="concept">
57730 <primary>authentication</primary>
57731 <secondary>ACL checking</secondary>
57732 </indexterm>
57733 <indexterm role="concept">
57734 <primary>access control lists (ACLs)</primary>
57735 <secondary>testing for authentication</secondary>
57736 </indexterm>
57737 If the SMTP connection is not authenticated, the condition is false. Otherwise,
57738 the name of the authenticator is tested against the list. To test for
57739 authentication by any authenticator, you can set
57740 </para>
57741 <literallayout class="monospaced">
57742 authenticated = *
57743 </literallayout>
57744 </listitem></varlistentry>
57745 <varlistentry>
57746 <term><emphasis role="bold">condition&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string</emphasis>&gt;</term>
57747 <listitem>
57748 <para>
57749 <indexterm role="concept">
57750 <primary><option>condition</option> ACL condition</primary>
57751 </indexterm>
57752 <indexterm role="concept">
57753 <primary>customizing</primary>
57754 <secondary>ACL condition</secondary>
57755 </indexterm>
57756 <indexterm role="concept">
57757 <primary>access control lists (ACLs)</primary>
57758 <secondary>customized test</secondary>
57759 </indexterm>
57760 <indexterm role="concept">
57761 <primary>access control lists (ACLs)</primary>
57762 <secondary>testing, customized</secondary>
57763 </indexterm>
57764 This feature allows you to make up custom conditions. If the result of
57765 expanding the string is an empty string, the number zero, or one of the strings
57766 <quote>no</quote> or <quote>false</quote>, the condition is false. If the result is any non-zero
57767 number, or one of the strings <quote>yes</quote> or <quote>true</quote>, the condition is true. For
57768 any other value, some error is assumed to have occurred, and the ACL returns
57769 <quote>defer</quote>. However, if the expansion is forced to fail, the condition is
57770 ignored. The effect is to treat it as true, whether it is positive or
57771 negative.
57772 </para>
57773 </listitem></varlistentry>
57774 <varlistentry>
57775 <term><emphasis role="bold">decode&nbsp;=&nbsp;</emphasis>&lt;<emphasis>location</emphasis>&gt;</term>
57776 <listitem>
57777 <para>
57778 <indexterm role="concept">
57779 <primary><option>decode</option> ACL condition</primary>
57780 </indexterm>
57781 This condition is available only when Exim is compiled with the
57782 content-scanning extension, and it is allowed only in the ACL defined by
57783 <option>acl_smtp_mime</option>. It causes the current MIME part to be decoded into a file.
57784 If all goes well, the condition is true. It is false only if there are
57785 problems such as a syntax error or a memory shortage. For more details, see
57786 chapter <xref linkend="CHAPexiscan"/>.
57787 </para>
57788 </listitem></varlistentry>
57789 <varlistentry>
57790 <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>
57791 <listitem>
57792 <para>
57793 <indexterm role="concept">
57794 <primary><option>dnslists</option> ACL condition</primary>
57795 </indexterm>
57796 <indexterm role="concept">
57797 <primary>DNS list</primary>
57798 <secondary>in ACL</secondary>
57799 </indexterm>
57800 <indexterm role="concept">
57801 <primary>black list (DNS)</primary>
57802 </indexterm>
57803 <indexterm role="concept">
57804 <primary>access control lists (ACLs)</primary>
57805 <secondary>testing a DNS list</secondary>
57806 </indexterm>
57807 This condition checks for entries in DNS black lists. These are also known as
57808 <quote>RBL lists</quote>, after the original Realtime Blackhole List, but note that the
57809 use of the lists at <emphasis>mail-abuse.org</emphasis> now carries a charge. There are too many
57810 different variants of this condition to describe briefly here. See sections
57811 <xref linkend="SECTmorednslists"/>&ndash;<xref linkend="SECTmorednslistslast"/> for details.
57812 </para>
57813 </listitem></varlistentry>
57814 <varlistentry>
57815 <term><emphasis role="bold">domains&nbsp;=&nbsp;</emphasis>&lt;<emphasis>domain&nbsp;list</emphasis>&gt;</term>
57816 <listitem>
57817 <para>
57818 <indexterm role="concept">
57819 <primary><option>domains</option> ACL condition</primary>
57820 </indexterm>
57821 <indexterm role="concept">
57822 <primary>domain</primary>
57823 <secondary>ACL checking</secondary>
57824 </indexterm>
57825 <indexterm role="concept">
57826 <primary>access control lists (ACLs)</primary>
57827 <secondary>testing a recipient domain</secondary>
57828 </indexterm>
57829 <indexterm role="variable">
57830 <primary><varname>$domain_data</varname></primary>
57831 </indexterm>
57832 This condition is relevant only after a RCPT command. It checks that the domain
57833 of the recipient address is in the domain list. If percent-hack processing is
57834 enabled, it is done before this test is done. If the check succeeds with a
57835 lookup, the result of the lookup is placed in <varname>$domain_data</varname> until the next
57836 <option>domains</option> test.
57837 </para>
57838 <para>
57839 <emphasis role="bold">Note carefully</emphasis> (because many people seem to fall foul of this): you cannot
57840 use <option>domains</option> in a DATA ACL.
57841 </para>
57842 </listitem></varlistentry>
57843 <varlistentry>
57844 <term><emphasis role="bold">encrypted&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string&nbsp;list</emphasis>&gt;</term>
57845 <listitem>
57846 <para>
57847 <indexterm role="concept">
57848 <primary><option>encrypted</option> ACL condition</primary>
57849 </indexterm>
57850 <indexterm role="concept">
57851 <primary>encryption</primary>
57852 <secondary>checking in an ACL</secondary>
57853 </indexterm>
57854 <indexterm role="concept">
57855 <primary>access control lists (ACLs)</primary>
57856 <secondary>testing for encryption</secondary>
57857 </indexterm>
57858 If the SMTP connection is not encrypted, the condition is false. Otherwise, the
57859 name of the cipher suite in use is tested against the list. To test for
57860 encryption without testing for any specific cipher suite(s), set
57861 </para>
57862 <literallayout class="monospaced">
57863 encrypted = *
57864 </literallayout>
57865 </listitem></varlistentry>
57866 <varlistentry>
57867 <term><emphasis role="bold">hosts&nbsp;=&nbsp;</emphasis>&lt;<emphasis>host&nbsp;list</emphasis>&gt;</term>
57868 <listitem>
57869 <para>
57870 <indexterm role="concept">
57871 <primary><option>hosts</option> ACL condition</primary>
57872 </indexterm>
57873 <indexterm role="concept">
57874 <primary>host</primary>
57875 <secondary>ACL checking</secondary>
57876 </indexterm>
57877 <indexterm role="concept">
57878 <primary>access control lists (ACLs)</primary>
57879 <secondary>testing the client host</secondary>
57880 </indexterm>
57881 This condition tests that the calling host matches the host list. If you have
57882 name lookups or wildcarded host names and IP addresses in the same host list,
57883 you should normally put the IP addresses first. For example, you could have:
57884 </para>
57885 <literallayout class="monospaced">
57886 accept hosts = 10.9.8.7 : dbm;/etc/friendly/hosts
57887 </literallayout>
57888 <para>
57889 The lookup in this example uses the host name for its key. This is implied by
57890 the lookup type <quote>dbm</quote>. (For a host address lookup you would use <quote>net-dbm</quote>
57891 and it wouldn&#x2019;t matter which way round you had these two items.)
57892 </para>
57893 <para>
57894 The reason for the problem with host names lies in the left-to-right way that
57895 Exim processes lists. It can test IP addresses without doing any DNS lookups,
57896 but when it reaches an item that requires a host name, it fails if it cannot
57897 find a host name to compare with the pattern. If the above list is given in the
57898 opposite order, the <option>accept</option> statement fails for a host whose name cannot be
57899 found, even if its IP address is 10.9.8.7.
57900 </para>
57901 <para>
57902 If you really do want to do the name check first, and still recognize the IP
57903 address even if the name lookup fails, you can rewrite the ACL like this:
57904 </para>
57905 <literallayout class="monospaced">
57906 accept hosts = dbm;/etc/friendly/hosts
57907 accept hosts = 10.9.8.7
57908 </literallayout>
57909 <para>
57910 The default action on failing to find the host name is to assume that the host
57911 is not in the list, so the first <option>accept</option> statement fails. The second
57912 statement can then check the IP address.
57913 </para>
57914 <para>
57915 <indexterm role="variable">
57916 <primary><varname>$host_data</varname></primary>
57917 </indexterm>
57918 If a <option>hosts</option> condition is satisfied by means of a lookup, the result
57919 of the lookup is made available in the <varname>$host_data</varname> variable. This
57920 allows you, for example, to set up a statement like this:
57921 </para>
57922 <literallayout class="monospaced">
57923 deny  hosts = net-lsearch;/some/file
57924 message = $host_data
57925 </literallayout>
57926 <para>
57927 which gives a custom error message for each denied host.
57928 </para>
57929 </listitem></varlistentry>
57930 <varlistentry>
57931 <term><emphasis role="bold">local_parts&nbsp;=&nbsp;</emphasis>&lt;<emphasis>local&nbsp;part&nbsp;list</emphasis>&gt;</term>
57932 <listitem>
57933 <para>
57934 <indexterm role="concept">
57935 <primary><option>local_parts</option> ACL condition</primary>
57936 </indexterm>
57937 <indexterm role="concept">
57938 <primary>local part</primary>
57939 <secondary>ACL checking</secondary>
57940 </indexterm>
57941 <indexterm role="concept">
57942 <primary>access control lists (ACLs)</primary>
57943 <secondary>testing a local part</secondary>
57944 </indexterm>
57945 <indexterm role="variable">
57946 <primary><varname>$local_part_data</varname></primary>
57947 </indexterm>
57948 This condition is relevant only after a RCPT command. It checks that the local
57949 part of the recipient address is in the list. If percent-hack processing is
57950 enabled, it is done before this test. If the check succeeds with a lookup, the
57951 result of the lookup is placed in <varname>$local_part_data</varname>, which remains set until
57952 the next <option>local_parts</option> test.
57953 </para>
57954 </listitem></varlistentry>
57955 <varlistentry>
57956 <term><emphasis role="bold">malware&nbsp;=&nbsp;</emphasis>&lt;<emphasis>option</emphasis>&gt;</term>
57957 <listitem>
57958 <para>
57959 <indexterm role="concept">
57960 <primary><option>malware</option> ACL condition</primary>
57961 </indexterm>
57962 <indexterm role="concept">
57963 <primary>access control lists (ACLs)</primary>
57964 <secondary>virus scanning</secondary>
57965 </indexterm>
57966 <indexterm role="concept">
57967 <primary>access control lists (ACLs)</primary>
57968 <secondary>scanning for viruses</secondary>
57969 </indexterm>
57970 This condition is available only when Exim is compiled with the
57971 content-scanning extension. It causes the incoming message to be scanned for
57972 viruses. For details, see chapter <xref linkend="CHAPexiscan"/>.
57973 </para>
57974 </listitem></varlistentry>
57975 <varlistentry>
57976 <term><emphasis role="bold">mime_regex&nbsp;=&nbsp;</emphasis>&lt;<emphasis>list&nbsp;of&nbsp;regular&nbsp;expressions</emphasis>&gt;</term>
57977 <listitem>
57978 <para>
57979 <indexterm role="concept">
57980 <primary><option>mime_regex</option> ACL condition</primary>
57981 </indexterm>
57982 <indexterm role="concept">
57983 <primary>access control lists (ACLs)</primary>
57984 <secondary>testing by regex matching</secondary>
57985 </indexterm>
57986 This condition is available only when Exim is compiled with the
57987 content-scanning extension, and it is allowed only in the ACL defined by
57988 <option>acl_smtp_mime</option>. It causes the current MIME part to be scanned for a match
57989 with any of the regular expressions. For details, see chapter
57990 <xref linkend="CHAPexiscan"/>.
57991 </para>
57992 </listitem></varlistentry>
57993 <varlistentry>
57994 <term><emphasis role="bold">ratelimit&nbsp;=&nbsp;</emphasis>&lt;<emphasis>parameters</emphasis>&gt;</term>
57995 <listitem>
57996 <para>
57997 <indexterm role="concept">
57998 <primary>rate limiting</primary>
57999 </indexterm>
58000 This condition can be used to limit the rate at which a user or host submits
58001 messages. Details are given in section <xref linkend="SECTratelimiting"/>.
58002 </para>
58003 </listitem></varlistentry>
58004 <varlistentry>
58005 <term><emphasis role="bold">recipients&nbsp;=&nbsp;</emphasis>&lt;<emphasis>address&nbsp;list</emphasis>&gt;</term>
58006 <listitem>
58007 <para>
58008 <indexterm role="concept">
58009 <primary><option>recipients</option> ACL condition</primary>
58010 </indexterm>
58011 <indexterm role="concept">
58012 <primary>recipient</primary>
58013 <secondary>ACL checking</secondary>
58014 </indexterm>
58015 <indexterm role="concept">
58016 <primary>access control lists (ACLs)</primary>
58017 <secondary>testing a recipient</secondary>
58018 </indexterm>
58019 This condition is relevant only after a RCPT command. It checks the entire
58020 recipient address against a list of recipients.
58021 </para>
58022 </listitem></varlistentry>
58023 <varlistentry>
58024 <term><emphasis role="bold">regex&nbsp;=&nbsp;</emphasis>&lt;<emphasis>list&nbsp;of&nbsp;regular&nbsp;expressions</emphasis>&gt;</term>
58025 <listitem>
58026 <para>
58027 <indexterm role="concept">
58028 <primary><option>regex</option> ACL condition</primary>
58029 </indexterm>
58030 <indexterm role="concept">
58031 <primary>access control lists (ACLs)</primary>
58032 <secondary>testing by regex matching</secondary>
58033 </indexterm>
58034 This condition is available only when Exim is compiled with the
58035 content-scanning extension, and is available only in the DATA, MIME, and
58036 non-SMTP ACLs. It causes the incoming message to be scanned for a match with
58037 any of the regular expressions. For details, see chapter <xref linkend="CHAPexiscan"/>.
58038 </para>
58039 </listitem></varlistentry>
58040 <varlistentry>
58041 <term><emphasis role="bold">sender_domains&nbsp;=&nbsp;</emphasis>&lt;<emphasis>domain&nbsp;list</emphasis>&gt;</term>
58042 <listitem>
58043 <para>
58044 <indexterm role="concept">
58045 <primary><option>sender_domains</option> ACL condition</primary>
58046 </indexterm>
58047 <indexterm role="concept">
58048 <primary>sender</primary>
58049 <secondary>ACL checking</secondary>
58050 </indexterm>
58051 <indexterm role="concept">
58052 <primary>access control lists (ACLs)</primary>
58053 <secondary>testing a sender domain</secondary>
58054 </indexterm>
58055 <indexterm role="variable">
58056 <primary><varname>$domain</varname></primary>
58057 </indexterm>
58058 <indexterm role="variable">
58059 <primary><varname>$sender_address_domain</varname></primary>
58060 </indexterm>
58061 This condition tests the domain of the sender of the message against the given
58062 domain list. <emphasis role="bold">Note</emphasis>: The domain of the sender address is in
58063 <varname>$sender_address_domain</varname>. It is <emphasis>not</emphasis> put in <varname>$domain</varname> during the testing
58064 of this condition. This is an exception to the general rule for testing domain
58065 lists. It is done this way so that, if this condition is used in an ACL for a
58066 RCPT command, the recipient&#x2019;s domain (which is in <varname>$domain</varname>) can be used to
58067 influence the sender checking.
58068 </para>
58069 <para>
58070 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
58071 relaying, because sender addresses are easily, and commonly, forged.
58072 </para>
58073 </listitem></varlistentry>
58074 <varlistentry>
58075 <term><emphasis role="bold">senders&nbsp;=&nbsp;</emphasis>&lt;<emphasis>address&nbsp;list</emphasis>&gt;</term>
58076 <listitem>
58077 <para>
58078 <indexterm role="concept">
58079 <primary><option>senders</option> ACL condition</primary>
58080 </indexterm>
58081 <indexterm role="concept">
58082 <primary>sender</primary>
58083 <secondary>ACL checking</secondary>
58084 </indexterm>
58085 <indexterm role="concept">
58086 <primary>access control lists (ACLs)</primary>
58087 <secondary>testing a sender</secondary>
58088 </indexterm>
58089 This condition tests the sender of the message against the given list. To test
58090 for a bounce message, which has an empty sender, set
58091 </para>
58092 <literallayout class="monospaced">
58093 senders = :
58094 </literallayout>
58095 <para>
58096 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
58097 relaying, because sender addresses are easily, and commonly, forged.
58098 </para>
58099 </listitem></varlistentry>
58100 <varlistentry>
58101 <term><emphasis role="bold">spam&nbsp;=&nbsp;</emphasis>&lt;<emphasis>username</emphasis>&gt;</term>
58102 <listitem>
58103 <para>
58104 <indexterm role="concept">
58105 <primary><option>spam</option> ACL condition</primary>
58106 </indexterm>
58107 <indexterm role="concept">
58108 <primary>access control lists (ACLs)</primary>
58109 <secondary>scanning for spam</secondary>
58110 </indexterm>
58111 This condition is available only when Exim is compiled with the
58112 content-scanning extension. It causes the incoming message to be scanned by
58113 SpamAssassin. For details, see chapter <xref linkend="CHAPexiscan"/>.
58114 </para>
58115 </listitem></varlistentry>
58116 <varlistentry>
58117 <term><emphasis role="bold">verify&nbsp;=&nbsp;certificate</emphasis></term>
58118 <listitem>
58119 <para>
58120 <indexterm role="concept">
58121 <primary><option>verify</option> ACL condition</primary>
58122 </indexterm>
58123 <indexterm role="concept">
58124 <primary>TLS</primary>
58125 <secondary>client certificate verification</secondary>
58126 </indexterm>
58127 <indexterm role="concept">
58128 <primary>certificate</primary>
58129 <secondary>verification of client</secondary>
58130 </indexterm>
58131 <indexterm role="concept">
58132 <primary>access control lists (ACLs)</primary>
58133 <secondary>certificate verification</secondary>
58134 </indexterm>
58135 <indexterm role="concept">
58136 <primary>access control lists (ACLs)</primary>
58137 <secondary>testing a TLS certificate</secondary>
58138 </indexterm>
58139 This condition is true in an SMTP session if the session is encrypted, and a
58140 certificate was received from the client, and the certificate was verified. The
58141 server requests a certificate only if the client matches <option>tls_verify_hosts</option>
58142 or <option>tls_try_verify_hosts</option> (see chapter <xref linkend="CHAPTLS"/>).
58143 </para>
58144 </listitem></varlistentry>
58145 <varlistentry>
58146 <term><emphasis role="bold">verify&nbsp;=&nbsp;csa</emphasis></term>
58147 <listitem>
58148 <para>
58149 <indexterm role="concept">
58150 <primary>CSA verification</primary>
58151 </indexterm>
58152 This condition checks whether the sending host (the client) is authorized to
58153 send email. Details of how this works are given in section
58154 <xref linkend="SECTverifyCSA"/>.
58155 </para>
58156 </listitem></varlistentry>
58157 <varlistentry>
58158 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_names_ascii</emphasis></term>
58159 <listitem>
58160 <para>
58161 <indexterm role="concept">
58162 <primary><option>verify</option> ACL condition</primary>
58163 </indexterm>
58164 <indexterm role="concept">
58165 <primary>access control lists (ACLs)</primary>
58166 <secondary>verifying header names only ASCII</secondary>
58167 </indexterm>
58168 <indexterm role="concept">
58169 <primary>header lines</primary>
58170 <secondary>verifying header names only ASCII</secondary>
58171 </indexterm>
58172 <indexterm role="concept">
58173 <primary>verifying</primary>
58174 <secondary>header names only ASCII</secondary>
58175 </indexterm>
58176 This condition is relevant only in an ACL that is run after a message has been
58177 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
58178 <option>acl_not_smtp</option>.  It checks all header names (not the content) to make sure
58179 there are no non-ASCII characters, also excluding control characters.  The
58180 allowable characters are decimal ASCII values 33 through 126.
58181 </para>
58182 <para>
58183 Exim itself will handle headers with non-ASCII characters, but it can cause
58184 problems for downstream applications, so this option will allow their
58185 detection and rejection in the DATA ACL&#x2019;s.
58186 </para>
58187 </listitem></varlistentry>
58188 <varlistentry>
58189 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_sender/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
58190 <listitem>
58191 <para>
58192 <indexterm role="concept">
58193 <primary><option>verify</option> ACL condition</primary>
58194 </indexterm>
58195 <indexterm role="concept">
58196 <primary>access control lists (ACLs)</primary>
58197 <secondary>verifying sender in the header</secondary>
58198 </indexterm>
58199 <indexterm role="concept">
58200 <primary>header lines</primary>
58201 <secondary>verifying the sender in</secondary>
58202 </indexterm>
58203 <indexterm role="concept">
58204 <primary>sender</primary>
58205 <secondary>verifying in header</secondary>
58206 </indexterm>
58207 <indexterm role="concept">
58208 <primary>verifying</primary>
58209 <secondary>sender in header</secondary>
58210 </indexterm>
58211 This condition is relevant only in an ACL that is run after a message has been
58212 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
58213 <option>acl_not_smtp</option>. It checks that there is a verifiable address in at least one
58214 of the <emphasis>Sender:</emphasis>, <emphasis>Reply-To:</emphasis>, or <emphasis>From:</emphasis> header lines. Such an address
58215 is loosely thought of as a <quote>sender</quote> address (hence the name of the test).
58216 However, an address that appears in one of these headers need not be an address
58217 that accepts bounce messages; only sender addresses in envelopes are required
58218 to accept bounces. Therefore, if you use the callout option on this check, you
58219 might want to arrange for a non-empty address in the MAIL command.
58220 </para>
58221 <para>
58222 Details of address verification and the options are given later, starting at
58223 section <xref linkend="SECTaddressverification"/> (callouts are described in section
58224 <xref linkend="SECTcallver"/>). You can combine this condition with the <option>senders</option>
58225 condition to restrict it to bounce messages only:
58226 </para>
58227 <literallayout class="monospaced">
58228 deny    senders = :
58229         message = A valid sender header is required for bounces
58230        !verify  = header_sender
58231 </literallayout>
58232 </listitem></varlistentry>
58233 <varlistentry>
58234 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_syntax</emphasis></term>
58235 <listitem>
58236 <para>
58237 <indexterm role="concept">
58238 <primary><option>verify</option> ACL condition</primary>
58239 </indexterm>
58240 <indexterm role="concept">
58241 <primary>access control lists (ACLs)</primary>
58242 <secondary>verifying header syntax</secondary>
58243 </indexterm>
58244 <indexterm role="concept">
58245 <primary>header lines</primary>
58246 <secondary>verifying syntax</secondary>
58247 </indexterm>
58248 <indexterm role="concept">
58249 <primary>verifying</primary>
58250 <secondary>header syntax</secondary>
58251 </indexterm>
58252 This condition is relevant only in an ACL that is run after a message has been
58253 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
58254 <option>acl_not_smtp</option>. It checks the syntax of all header lines that can contain
58255 lists of addresses (<emphasis>Sender:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>,
58256 and <emphasis>Bcc:</emphasis>), returning true if there are no problems.
58257 Unqualified addresses (local parts without domains) are
58258 permitted only in locally generated messages and from hosts that match
58259 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
58260 appropriate.
58261 </para>
58262 <para>
58263 Note that this condition is a syntax check only. However, a common spamming
58264 ploy used to be to send syntactically invalid headers such as
58265 </para>
58266 <literallayout class="monospaced">
58267 To: @
58268 </literallayout>
58269 <para>
58270 and this condition can be used to reject such messages, though they are not as
58271 common as they used to be.
58272 </para>
58273 </listitem></varlistentry>
58274 <varlistentry>
58275 <term><emphasis role="bold">verify&nbsp;=&nbsp;helo</emphasis></term>
58276 <listitem>
58277 <para>
58278 <indexterm role="concept">
58279 <primary><option>verify</option> ACL condition</primary>
58280 </indexterm>
58281 <indexterm role="concept">
58282 <primary>access control lists (ACLs)</primary>
58283 <secondary>verifying HELO/EHLO</secondary>
58284 </indexterm>
58285 <indexterm role="concept">
58286 <primary>HELO</primary>
58287 <secondary>verifying</secondary>
58288 </indexterm>
58289 <indexterm role="concept">
58290 <primary>EHLO</primary>
58291 <secondary>verifying</secondary>
58292 </indexterm>
58293 <indexterm role="concept">
58294 <primary>verifying</primary>
58295 <secondary>EHLO</secondary>
58296 </indexterm>
58297 <indexterm role="concept">
58298 <primary>verifying</primary>
58299 <secondary>HELO</secondary>
58300 </indexterm>
58301 This condition is true if a HELO or EHLO command has been received from the
58302 client host, and its contents have been verified. If there has been no previous
58303 attempt to verify the HELO/EHLO contents, it is carried out when this
58304 condition is encountered. See the description of the <option>helo_verify_hosts</option> and
58305 <option>helo_try_verify_hosts</option> options for details of how to request verification
58306 independently of this condition.
58307 </para>
58308 <para>
58309 For SMTP input that does not come over TCP/IP (the <option>-bs</option> command line
58310 option), this condition is always true.
58311 </para>
58312 </listitem></varlistentry>
58313 <varlistentry>
58314 <term><emphasis role="bold">verify&nbsp;=&nbsp;not_blind</emphasis></term>
58315 <listitem>
58316 <para>
58317 <indexterm role="concept">
58318 <primary>verifying</primary>
58319 <secondary>not blind</secondary>
58320 </indexterm>
58321 <indexterm role="concept">
58322 <primary>bcc recipients, verifying none</primary>
58323 </indexterm>
58324 This condition checks that there are no blind (bcc) recipients in the message.
58325 Every envelope recipient must appear either in a <emphasis>To:</emphasis> header line or in a
58326 <emphasis>Cc:</emphasis> header line for this condition to be true. Local parts are checked
58327 case-sensitively; domains are checked case-insensitively. If <emphasis>Resent-To:</emphasis> or
58328 <emphasis>Resent-Cc:</emphasis> header lines exist, they are also checked. This condition can be
58329 used only in a DATA or non-SMTP ACL.
58330 </para>
58331 <para>
58332 There are, of course, many legitimate messages that make use of blind (bcc)
58333 recipients. This check should not be used on its own for blocking messages.
58334 </para>
58335 </listitem></varlistentry>
58336 <varlistentry>
58337 <term><emphasis role="bold">verify&nbsp;=&nbsp;recipient/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
58338 <listitem>
58339 <para>
58340 <indexterm role="concept">
58341 <primary><option>verify</option> ACL condition</primary>
58342 </indexterm>
58343 <indexterm role="concept">
58344 <primary>access control lists (ACLs)</primary>
58345 <secondary>verifying recipient</secondary>
58346 </indexterm>
58347 <indexterm role="concept">
58348 <primary>recipient</primary>
58349 <secondary>verifying</secondary>
58350 </indexterm>
58351 <indexterm role="concept">
58352 <primary>verifying</primary>
58353 <secondary>recipient</secondary>
58354 </indexterm>
58355 <indexterm role="variable">
58356 <primary><varname>$address_data</varname></primary>
58357 </indexterm>
58358 This condition is relevant only after a RCPT command. It verifies the current
58359 recipient. Details of address verification are given later, starting at section
58360 <xref linkend="SECTaddressverification"/>. After a recipient has been verified, the value
58361 of <varname>$address_data</varname> is the last value that was set while routing the address.
58362 This applies even if the verification fails. When an address that is being
58363 verified is redirected to a single address, verification continues with the new
58364 address, and in that case, the subsequent value of <varname>$address_data</varname> is the
58365 value for the child address.
58366 </para>
58367 </listitem></varlistentry>
58368 <varlistentry>
58369 <term><emphasis role="bold">verify&nbsp;=&nbsp;reverse_host_lookup/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
58370 <listitem>
58371 <para>
58372 <indexterm role="concept">
58373 <primary><option>verify</option> ACL condition</primary>
58374 </indexterm>
58375 <indexterm role="concept">
58376 <primary>access control lists (ACLs)</primary>
58377 <secondary>verifying host reverse lookup</secondary>
58378 </indexterm>
58379 <indexterm role="concept">
58380 <primary>host</primary>
58381 <secondary>verifying reverse lookup</secondary>
58382 </indexterm>
58383 This condition ensures that a verified host name has been looked up from the IP
58384 address of the client host. (This may have happened already if the host name
58385 was needed for checking a host list, or if the host matched <option>host_lookup</option>.)
58386 Verification ensures that the host name obtained from a reverse DNS lookup, or
58387 one of its aliases, does, when it is itself looked up in the DNS, yield the
58388 original IP address.
58389 </para>
58390 <para>
58391 There is one possible option, <literal>defer_ok</literal>.  If this is present and a
58392 DNS operation returns a temporary error, the verify condition succeeds.
58393 </para>
58394 <para>
58395 If this condition is used for a locally generated message (that is, when there
58396 is no client host involved), it always succeeds.
58397 </para>
58398 </listitem></varlistentry>
58399 <varlistentry>
58400 <term><emphasis role="bold">verify&nbsp;=&nbsp;sender/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
58401 <listitem>
58402 <para>
58403 <indexterm role="concept">
58404 <primary><option>verify</option> ACL condition</primary>
58405 </indexterm>
58406 <indexterm role="concept">
58407 <primary>access control lists (ACLs)</primary>
58408 <secondary>verifying sender</secondary>
58409 </indexterm>
58410 <indexterm role="concept">
58411 <primary>sender</primary>
58412 <secondary>verifying</secondary>
58413 </indexterm>
58414 <indexterm role="concept">
58415 <primary>verifying</primary>
58416 <secondary>sender</secondary>
58417 </indexterm>
58418 This condition is relevant only after a MAIL or RCPT command, or after a
58419 message has been received (the <option>acl_smtp_data</option> or <option>acl_not_smtp</option> ACLs). If
58420 the message&#x2019;s sender is empty (that is, this is a bounce message), the
58421 condition is true. Otherwise, the sender address is verified.
58422 </para>
58423 <para>
58424 <indexterm role="variable">
58425 <primary><varname>$address_data</varname></primary>
58426 </indexterm>
58427 <indexterm role="variable">
58428 <primary><varname>$sender_address_data</varname></primary>
58429 </indexterm>
58430 If there is data in the <varname>$address_data</varname> variable at the end of routing, its
58431 value is placed in <varname>$sender_address_data</varname> at the end of verification. This
58432 value can be used in subsequent conditions and modifiers in the same ACL
58433 statement. It does not persist after the end of the current statement. If you
58434 want to preserve the value for longer, you can save it in an ACL variable.
58435 </para>
58436 <para>
58437 Details of verification are given later, starting at section
58438 <xref linkend="SECTaddressverification"/>. Exim caches the result of sender verification,
58439 to avoid doing it more than once per message.
58440 </para>
58441 </listitem></varlistentry>
58442 <varlistentry>
58443 <term><emphasis role="bold">verify&nbsp;=&nbsp;sender=</emphasis>&lt;<emphasis>address</emphasis>&gt;<emphasis role="bold">/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
58444 <listitem>
58445 <para>
58446 <indexterm role="concept">
58447 <primary><option>verify</option> ACL condition</primary>
58448 </indexterm>
58449 This is a variation of the previous option, in which a modified address is
58450 verified as a sender.
58451 </para>
58452 <para>
58453 Note that &#x2019;/&#x2019; is legal in local-parts; if the address may have such
58454 (eg. is generated from the received message)
58455 they must be protected from the options parsing by doubling:
58456 </para>
58457 <literallayout class="monospaced">
58458 verify = sender=${sg{${address:$h_sender:}}{/}{//}}
58459 </literallayout>
58460 </listitem></varlistentry>
58461 </variablelist>
58462 </section>
58463 <section id="SECTmorednslists">
58464 <title>Using DNS lists</title>
58465 <para>
58466 <indexterm role="concept">
58467 <primary>DNS list</primary>
58468 <secondary>in ACL</secondary>
58469 </indexterm>
58470 <indexterm role="concept">
58471 <primary>black list (DNS)</primary>
58472 </indexterm>
58473 <indexterm role="concept">
58474 <primary>access control lists (ACLs)</primary>
58475 <secondary>testing a DNS list</secondary>
58476 </indexterm>
58477 In its simplest form, the <option>dnslists</option> condition tests whether the calling host
58478 is on at least one of a number of DNS lists by looking up the inverted IP
58479 address in one or more DNS domains. (Note that DNS list domains are not mail
58480 domains, so the <literal>+</literal> syntax for named lists doesn&#x2019;t work - it is used for
58481 special options instead.) For example, if the calling host&#x2019;s IP
58482 address is 192.168.62.43, and the ACL statement is
58483 </para>
58484 <literallayout class="monospaced">
58485 deny dnslists = blackholes.mail-abuse.org : \
58486                 dialups.mail-abuse.org
58487 </literallayout>
58488 <para>
58489 the following records are looked up:
58490 </para>
58491 <literallayout class="monospaced">
58492 43.62.168.192.blackholes.mail-abuse.org
58493 43.62.168.192.dialups.mail-abuse.org
58494 </literallayout>
58495 <para>
58496 As soon as Exim finds an existing DNS record, processing of the list stops.
58497 Thus, multiple entries on the list provide an <quote>or</quote> conjunction. If you want
58498 to test that a host is on more than one list (an <quote>and</quote> conjunction), you can
58499 use two separate conditions:
58500 </para>
58501 <literallayout class="monospaced">
58502 deny dnslists = blackholes.mail-abuse.org
58503      dnslists = dialups.mail-abuse.org
58504 </literallayout>
58505 <para>
58506 If a DNS lookup times out or otherwise fails to give a decisive answer, Exim
58507 behaves as if the host does not match the list item, that is, as if the DNS
58508 record does not exist. If there are further items in the DNS list, they are
58509 processed.
58510 </para>
58511 <para>
58512 This is usually the required action when <option>dnslists</option> is used with <option>deny</option>
58513 (which is the most common usage), because it prevents a DNS failure from
58514 blocking mail. However, you can change this behaviour by putting one of the
58515 following special items in the list:
58516 </para>
58517 <literallayout>
58518 <literal>+include_unknown </literal>   behave as if the item is on the list
58519 <literal>+exclude_unknown </literal>   behave as if the item is not on the list (default)
58520 <literal>+defer_unknown   </literal>   give a temporary error
58521 </literallayout>
58522 <para>
58523 <indexterm role="concept">
58524 <primary><literal>+include_unknown</literal></primary>
58525 </indexterm>
58526 <indexterm role="concept">
58527 <primary><literal>+exclude_unknown</literal></primary>
58528 </indexterm>
58529 <indexterm role="concept">
58530 <primary><literal>+defer_unknown</literal></primary>
58531 </indexterm>
58532 Each of these applies to any subsequent items on the list. For example:
58533 </para>
58534 <literallayout class="monospaced">
58535 deny dnslists = +defer_unknown : foo.bar.example
58536 </literallayout>
58537 <para>
58538 Testing the list of domains stops as soon as a match is found. If you want to
58539 warn for one list and block for another, you can use two different statements:
58540 </para>
58541 <literallayout class="monospaced">
58542 deny  dnslists = blackholes.mail-abuse.org
58543 warn  message  = X-Warn: sending host is on dialups list
58544       dnslists = dialups.mail-abuse.org
58545 </literallayout>
58546 <para>
58547 <indexterm role="concept">
58548 <primary>caching</primary>
58549 <secondary>of dns lookup</secondary>
58550 </indexterm>
58551 <indexterm role="concept">
58552 <primary>DNS</primary>
58553 <secondary>TTL</secondary>
58554 </indexterm>
58555 DNS list lookups are cached by Exim for the duration of the SMTP session
58556 (but limited by the DNS return TTL value),
58557 so a lookup based on the IP address is done at most once for any incoming
58558 connection (assuming long-enough TTL).
58559 Exim does not share information between multiple incoming
58560 connections (but your local name server cache should be active).
58561 </para>
58562 <para>
58563 There are a number of DNS lists to choose from, some commercial, some free,
58564 or free for small deployments.  An overview can be found at
58565 <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>.
58566 </para>
58567 </section>
58568 <section id="SECID201">
58569 <title>Specifying the IP address for a DNS list lookup</title>
58570 <para>
58571 <indexterm role="concept">
58572 <primary>DNS list</primary>
58573 <secondary>keyed by explicit IP address</secondary>
58574 </indexterm>
58575 By default, the IP address that is used in a DNS list lookup is the IP address
58576 of the calling host. However, you can specify another IP address by listing it
58577 after the domain name, introduced by a slash. For example:
58578 </para>
58579 <literallayout class="monospaced">
58580 deny dnslists = black.list.tld/192.168.1.2
58581 </literallayout>
58582 <para>
58583 This feature is not very helpful with explicit IP addresses; it is intended for
58584 use with IP addresses that are looked up, for example, the IP addresses of the
58585 MX hosts or nameservers of an email sender address. For an example, see section
58586 <xref linkend="SECTmulkeyfor"/> below.
58587 </para>
58588 </section>
58589 <section id="SECID202">
58590 <title>DNS lists keyed on domain names</title>
58591 <para>
58592 <indexterm role="concept">
58593 <primary>DNS list</primary>
58594 <secondary>keyed by domain name</secondary>
58595 </indexterm>
58596 There are some lists that are keyed on domain names rather than inverted IP
58597 addresses (see, e.g., the <emphasis>domain based zones</emphasis> link at
58598 <emphasis role="bold"><ulink url="http://www.rfc-ignorant.org/">http://www.rfc-ignorant.org/</ulink></emphasis>). No reversing of components is used
58599 with these lists. You can change the name that is looked up in a DNS list by
58600 listing it after the domain name, introduced by a slash. For example,
58601 </para>
58602 <literallayout class="monospaced">
58603 deny  message  = Sender's domain is listed at $dnslist_domain
58604       dnslists = dsn.rfc-ignorant.org/$sender_address_domain
58605 </literallayout>
58606 <para>
58607 This particular example is useful only in ACLs that are obeyed after the
58608 RCPT or DATA commands, when a sender address is available. If (for
58609 example) the message&#x2019;s sender is <emphasis>user@tld.example</emphasis> the name that is looked
58610 up by this example is
58611 </para>
58612 <literallayout class="monospaced">
58613 tld.example.dsn.rfc-ignorant.org
58614 </literallayout>
58615 <para>
58616 A single <option>dnslists</option> condition can contain entries for both names and IP
58617 addresses. For example:
58618 </para>
58619 <literallayout class="monospaced">
58620 deny dnslists = sbl.spamhaus.org : \
58621                 dsn.rfc-ignorant.org/$sender_address_domain
58622 </literallayout>
58623 <para>
58624 The first item checks the sending host&#x2019;s IP address; the second checks a domain
58625 name. The whole condition is true if either of the DNS lookups succeeds.
58626 </para>
58627 </section>
58628 <section id="SECTmulkeyfor">
58629 <title>Multiple explicit keys for a DNS list</title>
58630 <para>
58631 <indexterm role="concept">
58632 <primary>DNS list</primary>
58633 <secondary>multiple keys for</secondary>
58634 </indexterm>
58635 The syntax described above for looking up explicitly-defined values (either
58636 names or IP addresses) in a DNS blacklist is a simplification. After the domain
58637 name for the DNS list, what follows the slash can in fact be a list of items.
58638 As with all lists in Exim, the default separator is a colon. However, because
58639 this is a sublist within the list of DNS blacklist domains, it is necessary
58640 either to double the separators like this:
58641 </para>
58642 <literallayout class="monospaced">
58643 dnslists = black.list.tld/name.1::name.2
58644 </literallayout>
58645 <para>
58646 or to change the separator character, like this:
58647 </para>
58648 <literallayout class="monospaced">
58649 dnslists = black.list.tld/&lt;;name.1;name.2
58650 </literallayout>
58651 <para>
58652 If an item in the list is an IP address, it is inverted before the DNS
58653 blacklist domain is appended. If it is not an IP address, no inversion
58654 occurs. Consider this condition:
58655 </para>
58656 <literallayout class="monospaced">
58657 dnslists = black.list.tld/&lt;;192.168.1.2;a.domain
58658 </literallayout>
58659 <para>
58660 The DNS lookups that occur are:
58661 </para>
58662 <literallayout class="monospaced">
58663 2.1.168.192.black.list.tld
58664 a.domain.black.list.tld
58665 </literallayout>
58666 <para>
58667 Once a DNS record has been found (that matches a specific IP return
58668 address, if specified &ndash; see section <xref linkend="SECTaddmatcon"/>), no further lookups
58669 are done. If there is a temporary DNS error, the rest of the sublist of domains
58670 or IP addresses is tried. A temporary error for the whole dnslists item occurs
58671 only if no other DNS lookup in this sublist succeeds. In other words, a
58672 successful lookup for any of the items in the sublist overrides a temporary
58673 error for a previous item.
58674 </para>
58675 <para>
58676 The ability to supply a list of items after the slash is in some sense just a
58677 syntactic convenience. These two examples have the same effect:
58678 </para>
58679 <literallayout class="monospaced">
58680 dnslists = black.list.tld/a.domain : black.list.tld/b.domain
58681 dnslists = black.list.tld/a.domain::b.domain
58682 </literallayout>
58683 <para>
58684 However, when the data for the list is obtained from a lookup, the second form
58685 is usually much more convenient. Consider this example:
58686 </para>
58687 <literallayout class="monospaced">
58688 deny message  = The mail servers for the domain \
58689                 $sender_address_domain \
58690                 are listed at $dnslist_domain ($dnslist_value); \
58691                 see $dnslist_text.
58692      dnslists = sbl.spamhaus.org/&lt;|${lookup dnsdb {&gt;|a=&lt;|\
58693                                    ${lookup dnsdb {&gt;|mxh=\
58694                                    $sender_address_domain} }} }
58695 </literallayout>
58696 <para>
58697 Note the use of <literal>&gt;|</literal> in the dnsdb lookup to specify the separator for
58698 multiple DNS records. The inner dnsdb lookup produces a list of MX hosts
58699 and the outer dnsdb lookup finds the IP addresses for these hosts. The result
58700 of expanding the condition might be something like this:
58701 </para>
58702 <literallayout class="monospaced">
58703 dnslists = sbl.spamhaus.org/&lt;|192.168.2.3|192.168.5.6|...
58704 </literallayout>
58705 <para>
58706 Thus, this example checks whether or not the IP addresses of the sender
58707 domain&#x2019;s mail servers are on the Spamhaus black list.
58708 </para>
58709 <para>
58710 The key that was used for a successful DNS list lookup is put into the variable
58711 <varname>$dnslist_matched</varname> (see section <xref linkend="SECID204"/>).
58712 </para>
58713 </section>
58714 <section id="SECID203">
58715 <title>Data returned by DNS lists</title>
58716 <para>
58717 <indexterm role="concept">
58718 <primary>DNS list</primary>
58719 <secondary>data returned from</secondary>
58720 </indexterm>
58721 DNS lists are constructed using address records in the DNS. The original RBL
58722 just used the address 127.0.0.1 on the right hand side of each record, but the
58723 RBL+ list and some other lists use a number of values with different meanings.
58724 The values used on the RBL+ list are:
58725 </para>
58726 <literallayout>
58727 127.1.0.1  RBL
58728 127.1.0.2  DUL
58729 127.1.0.3  DUL and RBL
58730 127.1.0.4  RSS
58731 127.1.0.5  RSS and RBL
58732 127.1.0.6  RSS and DUL
58733 127.1.0.7  RSS and DUL and RBL
58734 </literallayout>
58735 <para>
58736 Section <xref linkend="SECTaddmatcon"/> below describes how you can distinguish between
58737 different values. Some DNS lists may return more than one address record;
58738 see section <xref linkend="SECThanmuldnsrec"/> for details of how they are checked.
58739 </para>
58740 </section>
58741 <section id="SECID204">
58742 <title>Variables set from DNS lists</title>
58743 <para>
58744 <indexterm role="concept">
58745 <primary>expansion</primary>
58746 <secondary>variables, set from DNS list</secondary>
58747 </indexterm>
58748 <indexterm role="concept">
58749 <primary>DNS list</primary>
58750 <secondary>variables set from</secondary>
58751 </indexterm>
58752 <indexterm role="variable">
58753 <primary><varname>$dnslist_domain</varname></primary>
58754 </indexterm>
58755 <indexterm role="variable">
58756 <primary><varname>$dnslist_matched</varname></primary>
58757 </indexterm>
58758 <indexterm role="variable">
58759 <primary><varname>$dnslist_text</varname></primary>
58760 </indexterm>
58761 <indexterm role="variable">
58762 <primary><varname>$dnslist_value</varname></primary>
58763 </indexterm>
58764 When an entry is found in a DNS list, the variable <varname>$dnslist_domain</varname> contains
58765 the name of the overall domain that matched (for example,
58766 <literal>spamhaus.example</literal>), <varname>$dnslist_matched</varname> contains the key within that domain
58767 (for example, <literal>192.168.5.3</literal>), and <varname>$dnslist_value</varname> contains the data from
58768 the DNS record. When the key is an IP address, it is not reversed in
58769 <varname>$dnslist_matched</varname> (though it is, of course, in the actual lookup). In simple
58770 cases, for example:
58771 </para>
58772 <literallayout class="monospaced">
58773 deny dnslists = spamhaus.example
58774 </literallayout>
58775 <para>
58776 the key is also available in another variable (in this case,
58777 <varname>$sender_host_address</varname>). In more complicated cases, however, this is not true.
58778 For example, using a data lookup (as described in section <xref linkend="SECTmulkeyfor"/>)
58779 might generate a dnslists lookup like this:
58780 </para>
58781 <literallayout class="monospaced">
58782 deny dnslists = spamhaus.example/&lt;|192.168.1.2|192.168.6.7|...
58783 </literallayout>
58784 <para>
58785 If this condition succeeds, the value in <varname>$dnslist_matched</varname> might be
58786 <literal>192.168.6.7</literal> (for example).
58787 </para>
58788 <para>
58789 If more than one address record is returned by the DNS lookup, all the IP
58790 addresses are included in <varname>$dnslist_value</varname>, separated by commas and spaces.
58791 The variable <varname>$dnslist_text</varname> contains the contents of any associated TXT
58792 record. For lists such as RBL+ the TXT record for a merged entry is often not
58793 very meaningful. See section <xref linkend="SECTmordetinf"/> for a way of obtaining more
58794 information.
58795 </para>
58796 <para>
58797 You can use the DNS list variables in <option>message</option> or <option>log_message</option> modifiers
58798 &ndash; although these appear before the condition in the ACL, they are not
58799 expanded until after it has failed. For example:
58800 </para>
58801 <literallayout class="monospaced">
58802 deny    hosts = !+local_networks
58803         message = $sender_host_address is listed \
58804                   at $dnslist_domain
58805         dnslists = rbl-plus.mail-abuse.example
58806 </literallayout>
58807 </section>
58808 <section id="SECTaddmatcon">
58809 <title>Additional matching conditions for DNS lists</title>
58810 <para>
58811 <indexterm role="concept">
58812 <primary>DNS list</primary>
58813 <secondary>matching specific returned data</secondary>
58814 </indexterm>
58815 You can add an equals sign and an IP address after a <option>dnslists</option> domain name
58816 in order to restrict its action to DNS records with a matching right hand side.
58817 For example,
58818 </para>
58819 <literallayout class="monospaced">
58820 deny dnslists = rblplus.mail-abuse.org=127.0.0.2
58821 </literallayout>
58822 <para>
58823 rejects only those hosts that yield 127.0.0.2. Without this additional data,
58824 any address record is considered to be a match. For the moment, we assume
58825 that the DNS lookup returns just one record. Section <xref linkend="SECThanmuldnsrec"/>
58826 describes how multiple records are handled.
58827 </para>
58828 <para>
58829 More than one IP address may be given for checking, using a comma as a
58830 separator. These are alternatives &ndash; if any one of them matches, the
58831 <option>dnslists</option> condition is true. For example:
58832 </para>
58833 <literallayout class="monospaced">
58834 deny  dnslists = a.b.c=127.0.0.2,127.0.0.3
58835 </literallayout>
58836 <para>
58837 If you want to specify a constraining address list and also specify names or IP
58838 addresses to be looked up, the constraining address list must be specified
58839 first. For example:
58840 </para>
58841 <literallayout class="monospaced">
58842 deny dnslists = dsn.rfc-ignorant.org\
58843                 =127.0.0.2/$sender_address_domain
58844 </literallayout>
58845 <para>
58846 If the character <literal>&amp;</literal> is used instead of <literal>=</literal>, the comparison for each
58847 listed IP address is done by a bitwise <quote>and</quote> instead of by an equality test.
58848 In other words, the listed addresses are used as bit masks. The comparison is
58849 true if all the bits in the mask are present in the address that is being
58850 tested. For example:
58851 </para>
58852 <literallayout class="monospaced">
58853 dnslists = a.b.c&amp;0.0.0.3
58854 </literallayout>
58855 <para>
58856 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
58857 want to test whether one bit or another bit is present (as opposed to both
58858 being present), you must use multiple values. For example:
58859 </para>
58860 <literallayout class="monospaced">
58861 dnslists = a.b.c&amp;0.0.0.1,0.0.0.2
58862 </literallayout>
58863 <para>
58864 matches if the final component of the address is an odd number or two times
58865 an odd number.
58866 </para>
58867 </section>
58868 <section id="SECID205">
58869 <title>Negated DNS matching conditions</title>
58870 <para>
58871 You can supply a negative list of IP addresses as part of a <option>dnslists</option>
58872 condition. Whereas
58873 </para>
58874 <literallayout class="monospaced">
58875 deny  dnslists = a.b.c=127.0.0.2,127.0.0.3
58876 </literallayout>
58877 <para>
58878 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
58879 IP address yielded by the list is either 127.0.0.2 or 127.0.0.3</quote>,
58880 </para>
58881 <literallayout class="monospaced">
58882 deny  dnslists = a.b.c!=127.0.0.2,127.0.0.3
58883 </literallayout>
58884 <para>
58885 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
58886 IP address yielded by the list is not 127.0.0.2 and not 127.0.0.3</quote>. In other
58887 words, the result of the test is inverted if an exclamation mark appears before
58888 the <literal>=</literal> (or the <literal>&amp;</literal>) sign.
58889 </para>
58890 <para>
58891 <emphasis role="bold">Note</emphasis>: This kind of negation is not the same as negation in a domain,
58892 host, or address list (which is why the syntax is different).
58893 </para>
58894 <para>
58895 If you are using just one list, the negation syntax does not gain you much. The
58896 previous example is precisely equivalent to
58897 </para>
58898 <literallayout class="monospaced">
58899 deny  dnslists = a.b.c
58900      !dnslists = a.b.c=127.0.0.2,127.0.0.3
58901 </literallayout>
58902 <para>
58903 However, if you are using multiple lists, the negation syntax is clearer.
58904 Consider this example:
58905 </para>
58906 <literallayout class="monospaced">
58907 deny  dnslists = sbl.spamhaus.org : \
58908                  list.dsbl.org : \
58909                  dnsbl.njabl.org!=127.0.0.3 : \
58910                  relays.ordb.org
58911 </literallayout>
58912 <para>
58913 Using only positive lists, this would have to be:
58914 </para>
58915 <literallayout class="monospaced">
58916 deny  dnslists = sbl.spamhaus.org : \
58917                  list.dsbl.org
58918 deny  dnslists = dnsbl.njabl.org
58919      !dnslists = dnsbl.njabl.org=127.0.0.3
58920 deny  dnslists = relays.ordb.org
58921 </literallayout>
58922 <para>
58923 which is less clear, and harder to maintain.
58924 </para>
58925 </section>
58926 <section id="SECThanmuldnsrec">
58927 <title>Handling multiple DNS records from a DNS list</title>
58928 <para>
58929 A DNS lookup for a <option>dnslists</option> condition may return more than one DNS record,
58930 thereby providing more than one IP address. When an item in a <option>dnslists</option> list
58931 is followed by <literal>=</literal> or <literal>&amp;</literal> and a list of IP addresses, in order to restrict
58932 the match to specific results from the DNS lookup, there are two ways in which
58933 the checking can be handled. For example, consider the condition:
58934 </para>
58935 <literallayout class="monospaced">
58936 dnslists = a.b.c=127.0.0.1
58937 </literallayout>
58938 <para>
58939 What happens if the DNS lookup for the incoming IP address yields both
58940 127.0.0.1 and 127.0.0.2 by means of two separate DNS records? Is the
58941 condition true because at least one given value was found, or is it false
58942 because at least one of the found values was not listed? And how does this
58943 affect negated conditions? Both possibilities are provided for with the help of
58944 additional separators <literal>==</literal> and <literal>=&amp;</literal>.
58945 </para>
58946 <itemizedlist>
58947 <listitem>
58948 <para>
58949 If <literal>=</literal> or <literal>&amp;</literal> is used, the condition is true if any one of the looked up
58950 IP addresses matches one of the listed addresses. For the example above, the
58951 condition is true because 127.0.0.1 matches.
58952 </para>
58953 </listitem>
58954 <listitem>
58955 <para>
58956 If <literal>==</literal> or <literal>=&amp;</literal> is used, the condition is true only if every one of the
58957 looked up IP addresses matches one of the listed addresses. If the condition is
58958 changed to:
58959 </para>
58960 <literallayout class="monospaced">
58961 dnslists = a.b.c==127.0.0.1
58962 </literallayout>
58963 <para>
58964 and the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
58965 false because 127.0.0.2 is not listed. You would need to have:
58966 </para>
58967 <literallayout class="monospaced">
58968 dnslists = a.b.c==127.0.0.1,127.0.0.2
58969 </literallayout>
58970 <para>
58971 for the condition to be true.
58972 </para>
58973 </listitem>
58974 </itemizedlist>
58975 <para>
58976 When <literal>!</literal> is used to negate IP address matching, it inverts the result, giving
58977 the precise opposite of the behaviour above. Thus:
58978 </para>
58979 <itemizedlist>
58980 <listitem>
58981 <para>
58982 If <literal>!=</literal> or <literal>!&amp;</literal> is used, the condition is true if none of the looked up IP
58983 addresses matches one of the listed addresses. Consider:
58984 </para>
58985 <literallayout class="monospaced">
58986 dnslists = a.b.c!&amp;0.0.0.1
58987 </literallayout>
58988 <para>
58989 If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
58990 false because 127.0.0.1 matches.
58991 </para>
58992 </listitem>
58993 <listitem>
58994 <para>
58995 If <literal>!==</literal> or <literal>!=&amp;</literal> is used, the condition is true if there is at least one
58996 looked up IP address that does not match. Consider:
58997 </para>
58998 <literallayout class="monospaced">
58999 dnslists = a.b.c!=&amp;0.0.0.1
59000 </literallayout>
59001 <para>
59002 If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
59003 true, because 127.0.0.2 does not match. You would need to have:
59004 </para>
59005 <literallayout class="monospaced">
59006 dnslists = a.b.c!=&amp;0.0.0.1,0.0.0.2
59007 </literallayout>
59008 <para>
59009 for the condition to be false.
59010 </para>
59011 </listitem>
59012 </itemizedlist>
59013 <para>
59014 When the DNS lookup yields only a single IP address, there is no difference
59015 between <literal>=</literal> and <literal>==</literal> and between <literal>&amp;</literal> and <literal>=&amp;</literal>.
59016 </para>
59017 </section>
59018 <section id="SECTmordetinf">
59019 <title>Detailed information from merged DNS lists</title>
59020 <para>
59021 <indexterm role="concept">
59022 <primary>DNS list</primary>
59023 <secondary>information from merged</secondary>
59024 </indexterm>
59025 When the facility for restricting the matching IP values in a DNS list is used,
59026 the text from the TXT record that is set in <varname>$dnslist_text</varname> may not reflect
59027 the true reason for rejection. This happens when lists are merged and the IP
59028 address in the A record is used to distinguish them; unfortunately there is
59029 only one TXT record. One way round this is not to use merged lists, but that
59030 can be inefficient because it requires multiple DNS lookups where one would do
59031 in the vast majority of cases when the host of interest is not on any of the
59032 lists.
59033 </para>
59034 <para>
59035 A less inefficient way of solving this problem is available. If
59036 two domain names, comma-separated, are given, the second is used first to
59037 do an initial check, making use of any IP value restrictions that are set.
59038 If there is a match, the first domain is used, without any IP value
59039 restrictions, to get the TXT record. As a byproduct of this, there is also
59040 a check that the IP being tested is indeed on the first list. The first
59041 domain is the one that is put in <varname>$dnslist_domain</varname>. For example:
59042 </para>
59043 <literallayout class="monospaced">
59044 deny message  = \
59045          rejected because $sender_host_address is blacklisted \
59046          at $dnslist_domain\n$dnslist_text
59047        dnslists = \
59048          sbl.spamhaus.org,sbl-xbl.spamhaus.org=127.0.0.2 : \
59049          dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
59050 </literallayout>
59051 <para>
59052 For the first blacklist item, this starts by doing a lookup in
59053 <emphasis>sbl-xbl.spamhaus.org</emphasis> and testing for a 127.0.0.2 return. If there is a
59054 match, it then looks in <emphasis>sbl.spamhaus.org</emphasis>, without checking the return
59055 value, and as long as something is found, it looks for the corresponding TXT
59056 record. If there is no match in <emphasis>sbl-xbl.spamhaus.org</emphasis>, nothing more is done.
59057 The second blacklist item is processed similarly.
59058 </para>
59059 <para>
59060 If you are interested in more than one merged list, the same list must be
59061 given several times, but because the results of the DNS lookups are cached,
59062 the DNS calls themselves are not repeated. For example:
59063 </para>
59064 <literallayout class="monospaced">
59065 deny dnslists = \
59066          http.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.2 : \
59067          socks.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.3 : \
59068          misc.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.4 : \
59069          dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
59070 </literallayout>
59071 <para>
59072 In this case there is one lookup in <emphasis>dnsbl.sorbs.net</emphasis>, and if none of the IP
59073 values matches (or if no record is found), this is the only lookup that is
59074 done. Only if there is a match is one of the more specific lists consulted.
59075 </para>
59076 </section>
59077 <section id="SECTmorednslistslast">
59078 <title>DNS lists and IPv6</title>
59079 <para>
59080 <indexterm role="concept">
59081 <primary>IPv6</primary>
59082 <secondary>DNS black lists</secondary>
59083 </indexterm>
59084 <indexterm role="concept">
59085 <primary>DNS list</primary>
59086 <secondary>IPv6 usage</secondary>
59087 </indexterm>
59088 If Exim is asked to do a dnslist lookup for an IPv6 address, it inverts it
59089 nibble by nibble. For example, if the calling host&#x2019;s IP address is
59090 3ffe:ffff:836f:0a00:000a:0800:200a:c031, Exim might look up
59091 </para>
59092 <literallayout class="monospaced">
59093 1.3.0.c.a.0.0.2.0.0.8.0.a.0.0.0.0.0.a.0.f.6.3.8.
59094   f.f.f.f.e.f.f.3.blackholes.mail-abuse.org
59095 </literallayout>
59096 <para>
59097 (split over two lines here to fit on the page). Unfortunately, some of the DNS
59098 lists contain wildcard records, intended for IPv4, that interact badly with
59099 IPv6. For example, the DNS entry
59100 </para>
59101 <literallayout class="monospaced">
59102 *.3.some.list.example.    A    127.0.0.1
59103 </literallayout>
59104 <para>
59105 is probably intended to put the entire 3.0.0.0/8 IPv4 network on the list.
59106 Unfortunately, it also matches the entire 3::/4 IPv6 network.
59107 </para>
59108 <para>
59109 You can exclude IPv6 addresses from DNS lookups by making use of a suitable
59110 <option>condition</option> condition, as in this example:
59111 </para>
59112 <literallayout class="monospaced">
59113 deny   condition = ${if isip4{$sender_host_address}}
59114        dnslists  = some.list.example
59115 </literallayout>
59116 <para>
59117 If an explicit key is being used for a DNS lookup and it may be an IPv6
59118 address you should specify alternate list separators for both the outer
59119 (DNS list name) list and inner (lookup keys) list:
59120 </para>
59121 <literallayout class="monospaced">
59122        dnslists = &lt;; dnsbl.example.com/&lt;|$acl_m_addrslist
59123 </literallayout>
59124 </section>
59125 <section id="SECTratelimiting">
59126 <title>Rate limiting incoming messages</title>
59127 <para>
59128 <indexterm role="concept">
59129 <primary>rate limiting</primary>
59130 <secondary>client sending</secondary>
59131 </indexterm>
59132 <indexterm role="concept">
59133 <primary>limiting client sending rates</primary>
59134 </indexterm>
59135 <indexterm role="option">
59136 <primary><option>smtp_ratelimit_*</option></primary>
59137 </indexterm>
59138 The <option>ratelimit</option> ACL condition can be used to measure and control the rate at
59139 which clients can send email. This is more powerful than the
59140 <option>smtp_ratelimit_*</option> options, because those options control the rate of
59141 commands in a single SMTP session only, whereas the <option>ratelimit</option> condition
59142 works across all connections (concurrent and sequential) from the same client
59143 host. The syntax of the <option>ratelimit</option> condition is:
59144 </para>
59145 <literallayout>
59146 <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;
59147 </literallayout>
59148 <para>
59149 If the average client sending rate is less than <emphasis>m</emphasis> messages per time
59150 period <emphasis>p</emphasis> then the condition is false; otherwise it is true.
59151 </para>
59152 <para>
59153 As a side-effect, the <option>ratelimit</option> condition sets the expansion variable
59154 <varname>$sender_rate</varname> to the client&#x2019;s computed rate, <varname>$sender_rate_limit</varname> to the
59155 configured value of <emphasis>m</emphasis>, and <varname>$sender_rate_period</varname> to the configured value
59156 of <emphasis>p</emphasis>.
59157 </para>
59158 <para>
59159 The parameter <emphasis>p</emphasis> is the smoothing time constant, in the form of an Exim
59160 time interval, for example, <literal>8h</literal> for eight hours. A larger time constant
59161 means that it takes Exim longer to forget a client&#x2019;s past behaviour. The
59162 parameter <emphasis>m</emphasis> is the maximum number of messages that a client is permitted to
59163 send in each time interval. It also specifies the number of messages permitted
59164 in a fast burst. By increasing both <emphasis>m</emphasis> and <emphasis>p</emphasis> but keeping <emphasis>m/p</emphasis>
59165 constant, you can allow a client to send more messages in a burst without
59166 changing its long-term sending rate limit. Conversely, if <emphasis>m</emphasis> and <emphasis>p</emphasis> are
59167 both small, messages must be sent at an even rate.
59168 </para>
59169 <para>
59170 There is a script in <filename>util/ratelimit.pl</filename> which extracts sending rates from
59171 log files, to assist with choosing appropriate settings for <emphasis>m</emphasis> and <emphasis>p</emphasis>
59172 when deploying the <option>ratelimit</option> ACL condition. The script prints usage
59173 instructions when it is run with no arguments.
59174 </para>
59175 <para>
59176 The key is used to look up the data for calculating the client&#x2019;s average
59177 sending rate. This data is stored in Exim&#x2019;s spool directory, alongside the
59178 retry and other hints databases. The default key is <varname>$sender_host_address</varname>,
59179 which means Exim computes the sending rate of each client host IP address.
59180 By changing the key you can change how Exim identifies clients for the purpose
59181 of ratelimiting. For example, to limit the sending rate of each authenticated
59182 user, independent of the computer they are sending from, set the key to
59183 <varname>$authenticated_id</varname>. You must ensure that the lookup key is meaningful; for
59184 example, <varname>$authenticated_id</varname> is only meaningful if the client has
59185 authenticated (which you can check with the <option>authenticated</option> ACL condition).
59186 </para>
59187 <para>
59188 The lookup key does not have to identify clients: If you want to limit the
59189 rate at which a recipient receives messages, you can use the key
59190 <literal>$local_part@$domain</literal> with the <option>per_rcpt</option> option (see below) in a RCPT
59191 ACL.
59192 </para>
59193 <para>
59194 Each <option>ratelimit</option> condition can have up to four options. A <option>per_*</option> option
59195 specifies what Exim measures the rate of, for example, messages or recipients
59196 or bytes. You can adjust the measurement using the <option>unique=</option> and/or
59197 <option>count=</option> options. You can also control when Exim updates the recorded rate
59198 using a <option>strict</option>, <option>leaky</option>, or <option>readonly</option> option. The options are
59199 separated by a slash, like the other parameters. They may appear in any order.
59200 </para>
59201 <para>
59202 Internally, Exim appends the smoothing constant <emphasis>p</emphasis> onto the lookup key with
59203 any options that alter the meaning of the stored data. The limit <emphasis>m</emphasis> is not
59204 stored, so you can alter the configured maximum rate and Exim will still
59205 remember clients&#x2019; past behaviour. If you change the <option>per_*</option> mode or add or
59206 remove the <option>unique=</option> option, the lookup key changes so Exim will forget past
59207 behaviour. The lookup key is not affected by changes to the update mode and
59208 the <option>count=</option> option.
59209 </para>
59210 </section>
59211 <section id="ratoptmea">
59212 <title>Ratelimit options for what is being measured</title>
59213 <para>
59214 <indexterm role="concept">
59215 <primary>rate limiting</primary>
59216 <secondary>per_* options</secondary>
59217 </indexterm>
59218 The <option>per_conn</option> option limits the client&#x2019;s connection rate. It is not
59219 normally used in the <option>acl_not_smtp</option>, <option>acl_not_smtp_mime</option>, or
59220 <option>acl_not_smtp_start</option> ACLs.
59221 </para>
59222 <para>
59223 The <option>per_mail</option> option limits the client&#x2019;s rate of sending messages. This is
59224 the default if none of the <option>per_*</option> options is specified. It can be used in
59225 <option>acl_smtp_mail</option>, <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>, <option>acl_smtp_mime</option>,
59226 <option>acl_smtp_data</option>, or <option>acl_not_smtp</option>.
59227 </para>
59228 <para>
59229 The <option>per_byte</option> option limits the sender&#x2019;s email bandwidth. It can be used in
59230 the same ACLs as the <option>per_mail</option> option, though it is best to use this option
59231 in the <option>acl_smtp_mime</option>, <option>acl_smtp_data</option> or <option>acl_not_smtp</option> ACLs; if it is
59232 used in an earlier ACL, Exim relies on the SIZE parameter given by the client
59233 in its MAIL command, which may be inaccurate or completely missing. You can
59234 follow the limit <emphasis>m</emphasis> in the configuration with K, M, or G to specify limits
59235 in kilobytes, megabytes, or gigabytes, respectively.
59236 </para>
59237 <para>
59238 The <option>per_rcpt</option> option causes Exim to limit the rate at which recipients are
59239 accepted. It can be used in the <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>,
59240 <option>acl_smtp_mime</option>, <option>acl_smtp_data</option>, or <option>acl_smtp_rcpt</option> ACLs. In
59241 <option>acl_smtp_rcpt</option> the rate is updated one recipient at a time; in the other
59242 ACLs the rate is updated with the total (accepted) recipient count in one go. Note that
59243 in either case the rate limiting engine will see a message with many
59244 recipients as a large high-speed burst.
59245 </para>
59246 <para>
59247 The <option>per_addr</option> option is like the <option>per_rcpt</option> option, except it counts the
59248 number of different recipients that the client has sent messages to in the
59249 last time period. That is, if the client repeatedly sends messages to the same
59250 recipient, its measured rate is not increased. This option can only be used in
59251 <option>acl_smtp_rcpt</option>.
59252 </para>
59253 <para>
59254 The <option>per_cmd</option> option causes Exim to recompute the rate every time the
59255 condition is processed. This can be used to limit the rate of any SMTP
59256 command. If it is used in multiple ACLs it can limit the aggregate rate of
59257 multiple different commands.
59258 </para>
59259 <para>
59260 The <option>count=</option> option can be used to alter how much Exim adds to the client&#x2019;s
59261 measured rate. For example, the <option>per_byte</option> option is equivalent to
59262 <literal>per_mail/count=$message_size</literal>. If there is no <option>count=</option> option, Exim
59263 increases the measured rate by one (except for the <option>per_rcpt</option> option in ACLs
59264 other than <option>acl_smtp_rcpt</option>). The count does not have to be an integer.
59265 </para>
59266 <para>
59267 The <option>unique=</option> option is described in section <xref linkend="ratoptuniq"/> below.
59268 </para>
59269 </section>
59270 <section id="ratoptupd">
59271 <title>Ratelimit update modes</title>
59272 <para>
59273 <indexterm role="concept">
59274 <primary>rate limiting</primary>
59275 <secondary>reading data without updating</secondary>
59276 </indexterm>
59277 You can specify one of three options with the <option>ratelimit</option> condition to
59278 control when its database is updated. This section describes the <option>readonly</option>
59279 mode, and the next section describes the <option>strict</option> and <option>leaky</option> modes.
59280 </para>
59281 <para>
59282 If the <option>ratelimit</option> condition is used in <option>readonly</option> mode, Exim looks up a
59283 previously-computed rate to check against the limit.
59284 </para>
59285 <para>
59286 For example, you can test the client&#x2019;s sending rate and deny it access (when
59287 it is too fast) in the connect ACL. If the client passes this check then it
59288 can go on to send a message, in which case its recorded rate will be updated
59289 in the MAIL ACL. Subsequent connections from the same client will check this
59290 new rate.
59291 </para>
59292 <literallayout class="monospaced">
59293 acl_check_connect:
59294  deny ratelimit = 100 / 5m / readonly
59295     log_message = RATE CHECK: $sender_rate/$sender_rate_period \
59296                   (max $sender_rate_limit)
59297 # ...
59298 acl_check_mail:
59299  warn ratelimit = 100 / 5m / strict
59300     log_message = RATE UPDATE: $sender_rate/$sender_rate_period \
59301                   (max $sender_rate_limit)
59302 </literallayout>
59303 <para>
59304 If Exim encounters multiple <option>ratelimit</option> conditions with the same key when
59305 processing a message then it may increase the client&#x2019;s measured rate more than
59306 it should. For example, this will happen if you check the <option>per_rcpt</option> option
59307 in both <option>acl_smtp_rcpt</option> and <option>acl_smtp_data</option>. However it&#x2019;s OK to check the
59308 same <option>ratelimit</option> condition multiple times in the same ACL. You can avoid any
59309 multiple update problems by using the <option>readonly</option> option on later ratelimit
59310 checks.
59311 </para>
59312 <para>
59313 The <option>per_*</option> options described above do not make sense in some ACLs. If you
59314 use a <option>per_*</option> option in an ACL where it is not normally permitted then the
59315 update mode defaults to <option>readonly</option> and you cannot specify the <option>strict</option> or
59316 <option>leaky</option> modes. In other ACLs the default update mode is <option>leaky</option> (see the
59317 next section) so you must specify the <option>readonly</option> option explicitly.
59318 </para>
59319 </section>
59320 <section id="ratoptfast">
59321 <title>Ratelimit options for handling fast clients</title>
59322 <para>
59323 <indexterm role="concept">
59324 <primary>rate limiting</primary>
59325 <secondary>strict and leaky modes</secondary>
59326 </indexterm>
59327 If a client&#x2019;s average rate is greater than the maximum, the rate limiting
59328 engine can react in two possible ways, depending on the presence of the
59329 <option>strict</option> or <option>leaky</option> update modes. This is independent of the other
59330 counter-measures (such as rejecting the message) that may be specified by the
59331 rest of the ACL.
59332 </para>
59333 <para>
59334 The <option>leaky</option> (default) option means that the client&#x2019;s recorded rate is not
59335 updated if it is above the limit. The effect of this is that Exim measures the
59336 client&#x2019;s average rate of successfully sent email,
59337 </para>
59338 <para revisionflag="changed">
59339 up to the given limit.
59340 This is appropriate if the countermeasure when the condition is true
59341 consists of refusing the message, and
59342 is generally the better choice if you have clients that retry automatically.
59343 If the action when true is anything more complex then this option is
59344 likely not what is wanted.
59345 </para>
59346 <para>
59347 The <option>strict</option> option means that the client&#x2019;s recorded rate is always
59348 updated. The effect of this is that Exim measures the client&#x2019;s average rate
59349 of attempts to send email, which can be much higher than the maximum it is
59350 actually allowed. If the client is over the limit it may be subjected to
59351 counter-measures by the ACL. It must slow down and allow sufficient time to
59352 pass that its computed rate falls below the maximum before it can send email
59353 again. The time (the number of smoothing periods) it must wait and not
59354 attempt to send mail can be calculated with this formula:
59355 </para>
59356 <literallayout class="monospaced">
59357         ln(peakrate/maxrate)
59358 </literallayout>
59359 </section>
59360 <section id="ratoptuniq">
59361 <title>Limiting the rate of different events</title>
59362 <para>
59363 <indexterm role="concept">
59364 <primary>rate limiting</primary>
59365 <secondary>counting unique events</secondary>
59366 </indexterm>
59367 The <option>ratelimit</option> <option>unique=</option> option controls a mechanism for counting the
59368 rate of different events. For example, the <option>per_addr</option> option uses this
59369 mechanism to count the number of different recipients that the client has
59370 sent messages to in the last time period; it is equivalent to
59371 <literal>per_rcpt/unique=$local_part@$domain</literal>. You could use this feature to
59372 measure the rate that a client uses different sender addresses with the
59373 options <literal>per_mail/unique=$sender_address</literal>.
59374 </para>
59375 <para>
59376 For each <option>ratelimit</option> key Exim stores the set of <option>unique=</option> values that it
59377 has seen for that key. The whole set is thrown away when it is older than the
59378 rate smoothing period <emphasis>p</emphasis>, so each different event is counted at most once
59379 per period. In the <option>leaky</option> update mode, an event that causes the client to
59380 go over the limit is not added to the set, in the same way that the client&#x2019;s
59381 recorded rate is not updated in the same situation.
59382 </para>
59383 <para>
59384 When you combine the <option>unique=</option> and <option>readonly</option> options, the specific
59385 <option>unique=</option> value is ignored, and Exim just retrieves the client&#x2019;s stored
59386 rate.
59387 </para>
59388 <para>
59389 The <option>unique=</option> mechanism needs more space in the ratelimit database than the
59390 other <option>ratelimit</option> options in order to store the event set. The number of
59391 unique values is potentially as large as the rate limit, so the extra space
59392 required increases with larger limits.
59393 </para>
59394 <para>
59395 The uniqueification is not perfect: there is a small probability that Exim
59396 will think a new event has happened before. If the sender&#x2019;s rate is less than
59397 the limit, Exim should be more than 99.9% correct. However in <option>strict</option> mode
59398 the measured rate can go above the limit, in which case Exim may under-count
59399 events by a significant margin. Fortunately, if the rate is high enough (2.7
59400 times the limit) that the false positive rate goes above 9%, then Exim will
59401 throw away the over-full event set before the measured rate falls below the
59402 limit. Therefore the only harm should be that exceptionally high sending rates
59403 are logged incorrectly; any countermeasures you configure will be as effective
59404 as intended.
59405 </para>
59406 </section>
59407 <section id="useratlim">
59408 <title>Using rate limiting</title>
59409 <para>
59410 Exim&#x2019;s other ACL facilities are used to define what counter-measures are taken
59411 when the rate limit is exceeded. This might be anything from logging a warning
59412 (for example, while measuring existing sending rates in order to define
59413 policy), through time delays to slow down fast senders, up to rejecting the
59414 message. For example:
59415 </para>
59416 <literallayout class="monospaced">
59417 # Log all senders' rates
59418 warn ratelimit = 0 / 1h / strict
59419      log_message = Sender rate $sender_rate / $sender_rate_period
59420
59421 # Slow down fast senders; note the need to truncate $sender_rate
59422 # at the decimal point.
59423 warn ratelimit = 100 / 1h / per_rcpt / strict
59424      delay     = ${eval: ${sg{$sender_rate}{[.].*}{}} - \
59425                    $sender_rate_limit }s
59426
59427 # Keep authenticated users under control
59428 deny authenticated = *
59429      ratelimit = 100 / 1d / strict / $authenticated_id
59430
59431 # System-wide rate limit
59432 defer message = Sorry, too busy. Try again later.
59433      ratelimit = 10 / 1s / $primary_hostname
59434
59435 # Restrict incoming rate from each host, with a default
59436 # set using a macro and special cases looked up in a table.
59437 defer message = Sender rate exceeds $sender_rate_limit \
59438                messages per $sender_rate_period
59439      ratelimit = ${lookup {$sender_host_address} \
59440                    cdb {DB/ratelimits.cdb} \
59441                    {$value} {RATELIMIT} }
59442 </literallayout>
59443 <para>
59444 <emphasis role="bold">Warning</emphasis>: If you have a busy server with a lot of <option>ratelimit</option> tests,
59445 especially with the <option>per_rcpt</option> option, you may suffer from a performance
59446 bottleneck caused by locking on the ratelimit hints database. Apart from
59447 making your ACLs less complicated, you can reduce the problem by using a
59448 RAM disk for Exim&#x2019;s hints directory (usually <filename>/var/spool/exim/db/</filename>). However
59449 this means that Exim will lose its hints data after a reboot (including retry
59450 hints, the callout cache, and ratelimit data).
59451 </para>
59452 </section>
59453 <section id="SECTaddressverification">
59454 <title>Address verification</title>
59455 <para>
59456 <indexterm role="concept">
59457 <primary>verifying address</primary>
59458 <secondary>options for</secondary>
59459 </indexterm>
59460 <indexterm role="concept">
59461 <primary>policy control</primary>
59462 <secondary>address verification</secondary>
59463 </indexterm>
59464 Several of the <option>verify</option> conditions described in section
59465 <xref linkend="SECTaclconditions"/> cause addresses to be verified. Section
59466 <xref linkend="SECTsenaddver"/> discusses the reporting of sender verification failures.
59467 The verification conditions can be followed by options that modify the
59468 verification process. The options are separated from the keyword and from each
59469 other by slashes, and some of them contain parameters. For example:
59470 </para>
59471 <literallayout class="monospaced">
59472 verify = sender/callout
59473 verify = recipient/defer_ok/callout=10s,defer_ok
59474 </literallayout>
59475 <para>
59476 The first stage of address verification, which always happens, is to run the
59477 address through the routers, in <quote>verify mode</quote>. Routers can detect the
59478 difference between verification and routing for delivery, and their actions can
59479 be varied by a number of generic options such as <option>verify</option> and <option>verify_only</option>
59480 (see chapter <xref linkend="CHAProutergeneric"/>). If routing fails, verification fails.
59481 The available options are as follows:
59482 </para>
59483 <itemizedlist>
59484 <listitem>
59485 <para>
59486 If the <option>callout</option> option is specified, successful routing to one or more
59487 remote hosts is followed by a <quote>callout</quote> to those hosts as an additional
59488 check. Callouts and their sub-options are discussed in the next section.
59489 </para>
59490 </listitem>
59491 <listitem>
59492 <para>
59493 If there is a defer error while doing verification routing, the ACL
59494 normally returns <quote>defer</quote>. However, if you include <option>defer_ok</option> in the
59495 options, the condition is forced to be true instead. Note that this is a main
59496 verification option as well as a suboption for callouts.
59497 </para>
59498 </listitem>
59499 <listitem>
59500 <para>
59501 The <option>no_details</option> option is covered in section <xref linkend="SECTsenaddver"/>, which
59502 discusses the reporting of sender address verification failures.
59503 </para>
59504 </listitem>
59505 <listitem>
59506 <para>
59507 The <option>success_on_redirect</option> option causes verification always to succeed
59508 immediately after a successful redirection. By default, if a redirection
59509 generates just one address, that address is also verified. See further
59510 discussion in section <xref linkend="SECTredirwhilveri"/>.
59511 </para>
59512 </listitem>
59513 </itemizedlist>
59514 <para>
59515 <indexterm role="concept">
59516 <primary>verifying address</primary>
59517 <secondary>differentiating failures</secondary>
59518 </indexterm>
59519 <indexterm role="variable">
59520 <primary><varname>$recipient_verify_failure</varname></primary>
59521 </indexterm>
59522 <indexterm role="variable">
59523 <primary><varname>$sender_verify_failure</varname></primary>
59524 </indexterm>
59525 <indexterm role="variable">
59526 <primary><varname>$acl_verify_message</varname></primary>
59527 </indexterm>
59528 After an address verification failure, <varname>$acl_verify_message</varname> contains the
59529 error message that is associated with the failure. It can be preserved by
59530 coding like this:
59531 </para>
59532 <literallayout class="monospaced">
59533 warn  !verify = sender
59534        set acl_m0 = $acl_verify_message
59535 </literallayout>
59536 <para>
59537 If you are writing your own custom rejection message or log message when
59538 denying access, you can use this variable to include information about the
59539 verification failure.
59540 </para>
59541 <para>
59542 In addition, <varname>$sender_verify_failure</varname> or <varname>$recipient_verify_failure</varname> (as
59543 appropriate) contains one of the following words:
59544 </para>
59545 <itemizedlist>
59546 <listitem>
59547 <para>
59548 <option>qualify</option>: The address was unqualified (no domain), and the message
59549 was neither local nor came from an exempted host.
59550 </para>
59551 </listitem>
59552 <listitem>
59553 <para>
59554 <option>route</option>: Routing failed.
59555 </para>
59556 </listitem>
59557 <listitem>
59558 <para>
59559 <option>mail</option>: Routing succeeded, and a callout was attempted; rejection
59560 occurred at or before the MAIL command (that is, on initial
59561 connection, HELO, or MAIL).
59562 </para>
59563 </listitem>
59564 <listitem>
59565 <para>
59566 <option>recipient</option>: The RCPT command in a callout was rejected.
59567 </para>
59568 </listitem>
59569 <listitem>
59570 <para>
59571 <option>postmaster</option>: The postmaster check in a callout was rejected.
59572 </para>
59573 </listitem>
59574 </itemizedlist>
59575 <para>
59576 The main use of these variables is expected to be to distinguish between
59577 rejections of MAIL and rejections of RCPT in callouts.
59578 </para>
59579 <para revisionflag="changed">
59580 The above variables may also be set after a <emphasis role="bold">successful</emphasis>
59581 address verification to:
59582 </para>
59583 <itemizedlist revisionflag="changed">
59584 <listitem>
59585 <para revisionflag="changed">
59586 <option>random</option>: A random local-part callout succeeded
59587 </para>
59588 </listitem>
59589 </itemizedlist>
59590 </section>
59591 <section id="SECTcallver">
59592 <title>Callout verification</title>
59593 <para>
59594 <indexterm role="concept">
59595 <primary>verifying address</primary>
59596 <secondary>by callout</secondary>
59597 </indexterm>
59598 <indexterm role="concept">
59599 <primary>callout</primary>
59600 <secondary>verification</secondary>
59601 </indexterm>
59602 <indexterm role="concept">
59603 <primary>SMTP</primary>
59604 <secondary>callout verification</secondary>
59605 </indexterm>
59606 For non-local addresses, routing verifies the domain, but is unable to do any
59607 checking of the local part. There are situations where some means of verifying
59608 the local part is desirable. One way this can be done is to make an SMTP
59609 <emphasis>callback</emphasis> to a delivery host for the sender address or a <emphasis>callforward</emphasis> to
59610 a subsequent host for a recipient address, to see if the host accepts the
59611 address. We use the term <emphasis>callout</emphasis> to cover both cases. Note that for a
59612 sender address, the callback is not to the client host that is trying to
59613 deliver the message, but to one of the hosts that accepts incoming mail for the
59614 sender&#x2019;s domain.
59615 </para>
59616 <para>
59617 Exim does not do callouts by default. If you want them to happen, you must
59618 request them by setting appropriate options on the <option>verify</option> condition, as
59619 described below. This facility should be used with care, because it can add a
59620 lot of resource usage to the cost of verifying an address. However, Exim does
59621 cache the results of callouts, which helps to reduce the cost. Details of
59622 caching are in section <xref linkend="SECTcallvercache"/>.
59623 </para>
59624 <para>
59625 Recipient callouts are usually used only between hosts that are controlled by
59626 the same administration. For example, a corporate gateway host could use
59627 callouts to check for valid recipients on an internal mailserver. A successful
59628 callout does not guarantee that a real delivery to the address would succeed;
59629 on the other hand, a failing callout does guarantee that a delivery would fail.
59630 </para>
59631 <para>
59632 If the <option>callout</option> option is present on a condition that verifies an address, a
59633 second stage of verification occurs if the address is successfully routed to
59634 one or more remote hosts. The usual case is routing by a <command>dnslookup</command> or a
59635 <command>manualroute</command> router, where the router specifies the hosts. However, if a
59636 router that does not set up hosts routes to an <command>smtp</command> transport with a
59637 <option>hosts</option> setting, the transport&#x2019;s hosts are used. If an <command>smtp</command> transport has
59638 <option>hosts_override</option> set, its hosts are always used, whether or not the router
59639 supplies a host list.
59640 Callouts are only supported on <command>smtp</command> transports.
59641 </para>
59642 <para>
59643 The port that is used is taken from the transport, if it is specified and is a
59644 remote transport. (For routers that do verification only, no transport need be
59645 specified.) Otherwise, the default SMTP port is used. If a remote transport
59646 specifies an outgoing interface, this is used; otherwise the interface is not
59647 specified. Likewise, the text that is used for the HELO command is taken from
59648 the transport&#x2019;s <option>helo_data</option> option; if there is no transport, the value of
59649 <varname>$smtp_active_hostname</varname> is used.
59650 </para>
59651 <para>
59652 For a sender callout check, Exim makes SMTP connections to the remote hosts, to
59653 test whether a bounce message could be delivered to the sender address. The
59654 following SMTP commands are sent:
59655 </para>
59656 <literallayout>
59657 <literal>HELO </literal>&lt;<emphasis>local host name</emphasis>&gt;
59658 <literal>MAIL FROM:&lt;&gt;</literal>
59659 <literal>RCPT TO:</literal>&lt;<emphasis>the address to be tested</emphasis>&gt;
59660 <literal>QUIT</literal>
59661 </literallayout>
59662 <para>
59663 LHLO is used instead of HELO if the transport&#x2019;s <option>protocol</option> option is
59664 set to <quote>lmtp</quote>.
59665 </para>
59666 <para>
59667 The callout may use EHLO, AUTH and/or STARTTLS given appropriate option
59668 settings.
59669 </para>
59670 <para>
59671 A recipient callout check is similar. By default, it also uses an empty address
59672 for the sender. This default is chosen because most hosts do not make use of
59673 the sender address when verifying a recipient. Using the same address means
59674 that a single cache entry can be used for each recipient. Some sites, however,
59675 do make use of the sender address when verifying. These are catered for by the
59676 <option>use_sender</option> and <option>use_postmaster</option> options, described in the next section.
59677 </para>
59678 <para>
59679 If the response to the RCPT command is a 2<emphasis>xx</emphasis> code, the verification
59680 succeeds. If it is 5<emphasis>xx</emphasis>, the verification fails. For any other condition,
59681 Exim tries the next host, if any. If there is a problem with all the remote
59682 hosts, the ACL yields <quote>defer</quote>, unless the <option>defer_ok</option> parameter of the
59683 <option>callout</option> option is given, in which case the condition is forced to succeed.
59684 </para>
59685 <para>
59686 <indexterm role="concept">
59687 <primary>SMTP</primary>
59688 <secondary>output flushing, disabling for callout</secondary>
59689 </indexterm>
59690 A callout may take a little time. For this reason, Exim normally flushes SMTP
59691 output before performing a callout in an ACL, to avoid unexpected timeouts in
59692 clients when the SMTP PIPELINING extension is in use. The flushing can be
59693 disabled by using a <option>control</option> modifier to set <option>no_callout_flush</option>.
59694 </para>
59695 </section>
59696 <section id="CALLaddparcall">
59697 <title>Additional parameters for callouts</title>
59698 <para>
59699 <indexterm role="concept">
59700 <primary>callout</primary>
59701 <secondary>additional parameters for</secondary>
59702 </indexterm>
59703 The <option>callout</option> option can be followed by an equals sign and a number of
59704 optional parameters, separated by commas. For example:
59705 </para>
59706 <literallayout class="monospaced">
59707 verify = recipient/callout=10s,defer_ok
59708 </literallayout>
59709 <para>
59710 The old syntax, which had <option>callout_defer_ok</option> and <option>check_postmaster</option> as
59711 separate verify options, is retained for backwards compatibility, but is now
59712 deprecated. The additional parameters for <option>callout</option> are as follows:
59713 </para>
59714 <variablelist>
59715 <varlistentry>
59716 <term>&lt;<emphasis>a&nbsp;time&nbsp;interval</emphasis>&gt;</term>
59717 <listitem>
59718 <para>
59719 <indexterm role="concept">
59720 <primary>callout</primary>
59721 <secondary>timeout, specifying</secondary>
59722 </indexterm>
59723 This specifies the timeout that applies for the callout attempt to each host.
59724 For example:
59725 </para>
59726 <literallayout class="monospaced">
59727 verify = sender/callout=5s
59728 </literallayout>
59729 <para>
59730 The default is 30 seconds. The timeout is used for each response from the
59731 remote host. It is also used for the initial connection, unless overridden by
59732 the <option>connect</option> parameter.
59733 </para>
59734 </listitem></varlistentry>
59735 <varlistentry>
59736 <term><emphasis role="bold">connect&nbsp;=&nbsp;</emphasis>&lt;<emphasis>time&nbsp;interval</emphasis>&gt;</term>
59737 <listitem>
59738 <para>
59739 <indexterm role="concept">
59740 <primary>callout</primary>
59741 <secondary>connection timeout, specifying</secondary>
59742 </indexterm>
59743 This parameter makes it possible to set a different (usually smaller) timeout
59744 for making the SMTP connection. For example:
59745 </para>
59746 <literallayout class="monospaced">
59747 verify = sender/callout=5s,connect=1s
59748 </literallayout>
59749 <para>
59750 If not specified, this timeout defaults to the general timeout value.
59751 </para>
59752 </listitem></varlistentry>
59753 <varlistentry>
59754 <term><emphasis role="bold">defer_ok</emphasis></term>
59755 <listitem>
59756 <para>
59757 <indexterm role="concept">
59758 <primary>callout</primary>
59759 <secondary>defer, action on</secondary>
59760 </indexterm>
59761 When this parameter is present, failure to contact any host, or any other kind
59762 of temporary error, is treated as success by the ACL. However, the cache is not
59763 updated in this circumstance.
59764 </para>
59765 </listitem></varlistentry>
59766 <varlistentry>
59767 <term><emphasis role="bold">fullpostmaster</emphasis></term>
59768 <listitem>
59769 <para>
59770 <indexterm role="concept">
59771 <primary>callout</primary>
59772 <secondary>full postmaster check</secondary>
59773 </indexterm>
59774 This operates like the <option>postmaster</option> option (see below), but if the check for
59775 <emphasis>postmaster@domain</emphasis> fails, it tries just <emphasis>postmaster</emphasis>, without a domain, in
59776 accordance with the specification in RFC 2821. The RFC states that the
59777 unqualified address <emphasis>postmaster</emphasis> should be accepted.
59778 </para>
59779 </listitem></varlistentry>
59780 <varlistentry>
59781 <term><emphasis role="bold">mailfrom&nbsp;=&nbsp;</emphasis>&lt;<emphasis>email&nbsp;address</emphasis>&gt;</term>
59782 <listitem>
59783 <para>
59784 <indexterm role="concept">
59785 <primary>callout</primary>
59786 <secondary>sender when verifying header</secondary>
59787 </indexterm>
59788 When verifying addresses in header lines using the <option>header_sender</option>
59789 verification option, Exim behaves by default as if the addresses are envelope
59790 sender addresses from a message. Callout verification therefore tests to see
59791 whether a bounce message could be delivered, by using an empty address in the
59792 MAIL command. However, it is arguable that these addresses might never be used
59793 as envelope senders, and could therefore justifiably reject bounce messages
59794 (empty senders). The <option>mailfrom</option> callout parameter allows you to specify what
59795 address to use in the MAIL command. For example:
59796 </para>
59797 <literallayout class="monospaced">
59798 require  verify = header_sender/callout=mailfrom=abcd@x.y.z
59799 </literallayout>
59800 <para>
59801 This parameter is available only for the <option>header_sender</option> verification option.
59802 </para>
59803 </listitem></varlistentry>
59804 <varlistentry>
59805 <term><emphasis role="bold">maxwait&nbsp;=&nbsp;</emphasis>&lt;<emphasis>time&nbsp;interval</emphasis>&gt;</term>
59806 <listitem>
59807 <para>
59808 <indexterm role="concept">
59809 <primary>callout</primary>
59810 <secondary>overall timeout, specifying</secondary>
59811 </indexterm>
59812 This parameter sets an overall timeout for performing a callout verification.
59813 For example:
59814 </para>
59815 <literallayout class="monospaced">
59816 verify = sender/callout=5s,maxwait=30s
59817 </literallayout>
59818 <para>
59819 This timeout defaults to four times the callout timeout for individual SMTP
59820 commands. The overall timeout applies when there is more than one host that can
59821 be tried. The timeout is checked before trying the next host. This prevents
59822 very long delays if there are a large number of hosts and all are timing out
59823 (for example, when network connections are timing out).
59824 </para>
59825 </listitem></varlistentry>
59826 <varlistentry>
59827 <term><emphasis role="bold">no_cache</emphasis></term>
59828 <listitem>
59829 <para>
59830 <indexterm role="concept">
59831 <primary>callout</primary>
59832 <secondary>cache, suppressing</secondary>
59833 </indexterm>
59834 <indexterm role="concept">
59835 <primary>caching callout, suppressing</primary>
59836 </indexterm>
59837 When this parameter is given, the callout cache is neither read nor updated.
59838 </para>
59839 </listitem></varlistentry>
59840 <varlistentry>
59841 <term><emphasis role="bold">postmaster</emphasis></term>
59842 <listitem>
59843 <para>
59844 <indexterm role="concept">
59845 <primary>callout</primary>
59846 <secondary>postmaster; checking</secondary>
59847 </indexterm>
59848 When this parameter is set, a successful callout check is followed by a similar
59849 check for the local part <emphasis>postmaster</emphasis> at the same domain. If this address is
59850 rejected, the callout fails (but see <option>fullpostmaster</option> above). The result of
59851 the postmaster check is recorded in a cache record; if it is a failure, this is
59852 used to fail subsequent callouts for the domain without a connection being
59853 made, until the cache record expires.
59854 </para>
59855 </listitem></varlistentry>
59856 <varlistentry>
59857 <term><emphasis role="bold">postmaster_mailfrom&nbsp;=&nbsp;</emphasis>&lt;<emphasis>email&nbsp;address</emphasis>&gt;</term>
59858 <listitem>
59859 <para>
59860 The postmaster check uses an empty sender in the MAIL command by default.
59861 You can use this parameter to do a postmaster check using a different address.
59862 For example:
59863 </para>
59864 <literallayout class="monospaced">
59865 require  verify = sender/callout=postmaster_mailfrom=abc@x.y.z
59866 </literallayout>
59867 <para>
59868 If both <option>postmaster</option> and <option>postmaster_mailfrom</option> are present, the rightmost
59869 one overrides. The <option>postmaster</option> parameter is equivalent to this example:
59870 </para>
59871 <literallayout class="monospaced">
59872 require  verify = sender/callout=postmaster_mailfrom=
59873 </literallayout>
59874 <para>
59875 <emphasis role="bold">Warning</emphasis>: The caching arrangements for postmaster checking do not take
59876 account of the sender address. It is assumed that either the empty address or
59877 a fixed non-empty address will be used. All that Exim remembers is that the
59878 postmaster check for the domain succeeded or failed.
59879 </para>
59880 </listitem></varlistentry>
59881 <varlistentry>
59882 <term><emphasis role="bold">random</emphasis></term>
59883 <listitem>
59884 <para>
59885 <indexterm role="concept">
59886 <primary>callout</primary>
59887 <secondary><quote>random</quote> check</secondary>
59888 </indexterm>
59889 When this parameter is set, before doing the normal callout check, Exim does a
59890 check for a <quote>random</quote> local part at the same domain. The local part is not
59891 really random &ndash; it is defined by the expansion of the option
59892 <option>callout_random_local_part</option>, which defaults to
59893 </para>
59894 <literallayout class="monospaced">
59895 $primary_hostname-$tod_epoch-testing
59896 </literallayout>
59897 <para>
59898 The idea here is to try to determine whether the remote host accepts all local
59899 parts without checking. If it does, there is no point in doing callouts for
59900 specific local parts. If the <quote>random</quote> check succeeds, the result is saved in
59901 a cache record, and used to force the current and subsequent callout checks to
59902 succeed without a connection being made, until the cache record expires.
59903 </para>
59904 </listitem></varlistentry>
59905 <varlistentry>
59906 <term><emphasis role="bold">use_postmaster</emphasis></term>
59907 <listitem>
59908 <para>
59909 <indexterm role="concept">
59910 <primary>callout</primary>
59911 <secondary>sender for recipient check</secondary>
59912 </indexterm>
59913 This parameter applies to recipient callouts only. For example:
59914 </para>
59915 <literallayout class="monospaced">
59916 deny  !verify = recipient/callout=use_postmaster
59917 </literallayout>
59918 <para>
59919 <indexterm role="variable">
59920 <primary><varname>$qualify_domain</varname></primary>
59921 </indexterm>
59922 It causes a non-empty postmaster address to be used in the MAIL command when
59923 performing the callout for the recipient, and also for a <quote>random</quote> check if
59924 that is configured. The local part of the address is <literal>postmaster</literal> and the
59925 domain is the contents of <varname>$qualify_domain</varname>.
59926 </para>
59927 </listitem></varlistentry>
59928 <varlistentry>
59929 <term><emphasis role="bold">use_sender</emphasis></term>
59930 <listitem>
59931 <para>
59932 This option applies to recipient callouts only. For example:
59933 </para>
59934 <literallayout class="monospaced">
59935 require  verify = recipient/callout=use_sender
59936 </literallayout>
59937 <para>
59938 It causes the message&#x2019;s actual sender address to be used in the MAIL
59939 command when performing the callout, instead of an empty address. There is no
59940 need to use this option unless you know that the called hosts make use of the
59941 sender when checking recipients. If used indiscriminately, it reduces the
59942 usefulness of callout caching.
59943 </para>
59944 </listitem></varlistentry>
59945 <varlistentry>
59946 <term><emphasis role="bold">hold</emphasis></term>
59947 <listitem>
59948 <para>
59949 This option applies to recipient callouts only. For example:
59950 </para>
59951 <literallayout class="monospaced">
59952 require  verify = recipient/callout=use_sender,hold
59953 </literallayout>
59954 <para>
59955 It causes the connection to be held open and used for any further recipients
59956 and for eventual delivery (should that be done quickly).
59957 Doing this saves on TCP and SMTP startup costs, and TLS costs also
59958 when that is used for the connections.
59959 The advantage is only gained if there are no callout cache hits
59960 (which could be enforced by the no_cache option),
59961 if the use_sender option is used,
59962 if neither the random nor the use_postmaster option is used,
59963 and if no other callouts intervene.
59964 </para>
59965 </listitem></varlistentry>
59966 </variablelist>
59967 <para>
59968 If you use any of the parameters that set a non-empty sender for the MAIL
59969 command (<option>mailfrom</option>, <option>postmaster_mailfrom</option>, <option>use_postmaster</option>, or
59970 <option>use_sender</option>), you should think about possible loops. Recipient checking is
59971 usually done between two hosts that are under the same management, and the host
59972 that receives the callouts is not normally configured to do callouts itself.
59973 Therefore, it is normally safe to use <option>use_postmaster</option> or <option>use_sender</option> in
59974 these circumstances.
59975 </para>
59976 <para>
59977 However, if you use a non-empty sender address for a callout to an arbitrary
59978 host, there is the likelihood that the remote host will itself initiate a
59979 callout check back to your host. As it is checking what appears to be a message
59980 sender, it is likely to use an empty address in MAIL, thus avoiding a
59981 callout loop. However, to be on the safe side it would be best to set up your
59982 own ACLs so that they do not do sender verification checks when the recipient
59983 is the address you use for header sender or postmaster callout checking.
59984 </para>
59985 <para>
59986 Another issue to think about when using non-empty senders for callouts is
59987 caching. When you set <option>mailfrom</option> or <option>use_sender</option>, the cache record is keyed
59988 by the sender/recipient combination; thus, for any given recipient, many more
59989 actual callouts are performed than when an empty sender or postmaster is used.
59990 </para>
59991 </section>
59992 <section id="SECTcallvercache">
59993 <title>Callout caching</title>
59994 <para>
59995 <indexterm role="concept">
59996 <primary>hints database</primary>
59997 <secondary>callout cache</secondary>
59998 </indexterm>
59999 <indexterm role="concept">
60000 <primary>callout</primary>
60001 <secondary>cache, description of</secondary>
60002 </indexterm>
60003 <indexterm role="concept">
60004 <primary>caching</primary>
60005 <secondary>callout</secondary>
60006 </indexterm>
60007 Exim caches the results of callouts in order to reduce the amount of resources
60008 used, unless you specify the <option>no_cache</option> parameter with the <option>callout</option>
60009 option. A hints database called <quote>callout</quote> is used for the cache. Two
60010 different record types are used: one records the result of a callout check for
60011 a specific address, and the other records information that applies to the
60012 entire domain (for example, that it accepts the local part <emphasis>postmaster</emphasis>).
60013 </para>
60014 <para>
60015 When an original callout fails, a detailed SMTP error message is given about
60016 the failure. However, for subsequent failures use the cache data, this message
60017 is not available.
60018 </para>
60019 <para>
60020 The expiry times for negative and positive address cache records are
60021 independent, and can be set by the global options <option>callout_negative_expire</option>
60022 (default 2h) and <option>callout_positive_expire</option> (default 24h), respectively.
60023 </para>
60024 <para>
60025 If a host gives a negative response to an SMTP connection, or rejects any
60026 commands up to and including
60027 </para>
60028 <literallayout class="monospaced">
60029 MAIL FROM:&lt;&gt;
60030 </literallayout>
60031 <para>
60032 (but not including the MAIL command with a non-empty address),
60033 any callout attempt is bound to fail. Exim remembers such failures in a
60034 domain cache record, which it uses to fail callouts for the domain without
60035 making new connections, until the domain record times out. There are two
60036 separate expiry times for domain cache records:
60037 <option>callout_domain_negative_expire</option> (default 3h) and
60038 <option>callout_domain_positive_expire</option> (default 7d).
60039 </para>
60040 <para>
60041 Domain records expire when the negative expiry time is reached if callouts
60042 cannot be made for the domain, or if the postmaster check failed.
60043 Otherwise, they expire when the positive expiry time is reached. This
60044 ensures that, for example, a host that stops accepting <quote>random</quote> local parts
60045 will eventually be noticed.
60046 </para>
60047 <para>
60048 The callout caching mechanism is based on the domain of the address that is
60049 being tested. If the domain routes to several hosts, it is assumed that their
60050 behaviour will be the same.
60051 </para>
60052 </section>
60053 <section id="SECTsenaddver">
60054 <title>Sender address verification reporting</title>
60055 <para>
60056 <indexterm role="concept">
60057 <primary>verifying</primary>
60058 <secondary>suppressing error details</secondary>
60059 </indexterm>
60060 See section <xref linkend="SECTaddressverification"/> for a general discussion of
60061 verification. When sender verification fails in an ACL, the details of the
60062 failure are given as additional output lines before the 550 response to the
60063 relevant SMTP command (RCPT or DATA). For example, if sender callout is in use,
60064 you might see:
60065 </para>
60066 <literallayout class="monospaced">
60067 MAIL FROM:&lt;xyz@abc.example&gt;
60068 250 OK
60069 RCPT TO:&lt;pqr@def.example&gt;
60070 550-Verification failed for &lt;xyz@abc.example&gt;
60071 550-Called:   192.168.34.43
60072 550-Sent:     RCPT TO:&lt;xyz@abc.example&gt;
60073 550-Response: 550 Unknown local part xyz in &lt;xyz@abc.example&gt;
60074 550 Sender verification failed
60075 </literallayout>
60076 <para>
60077 If more than one RCPT command fails in the same way, the details are given
60078 only for the first of them. However, some administrators do not want to send
60079 out this much information. You can suppress the details by adding
60080 <literal>/no_details</literal> to the ACL statement that requests sender verification. For
60081 example:
60082 </para>
60083 <literallayout class="monospaced">
60084 verify = sender/no_details
60085 </literallayout>
60086 </section>
60087 <section id="SECTredirwhilveri">
60088 <title>Redirection while verifying</title>
60089 <para>
60090 <indexterm role="concept">
60091 <primary>verifying</primary>
60092 <secondary>redirection while</secondary>
60093 </indexterm>
60094 <indexterm role="concept">
60095 <primary>address redirection</primary>
60096 <secondary>while verifying</secondary>
60097 </indexterm>
60098 A dilemma arises when a local address is redirected by aliasing or forwarding
60099 during verification: should the generated addresses themselves be verified,
60100 or should the successful expansion of the original address be enough to verify
60101 it? By default, Exim takes the following pragmatic approach:
60102 </para>
60103 <itemizedlist>
60104 <listitem>
60105 <para>
60106 When an incoming address is redirected to just one child address, verification
60107 continues with the child address, and if that fails to verify, the original
60108 verification also fails.
60109 </para>
60110 </listitem>
60111 <listitem>
60112 <para>
60113 When an incoming address is redirected to more than one child address,
60114 verification does not continue. A success result is returned.
60115 </para>
60116 </listitem>
60117 </itemizedlist>
60118 <para>
60119 This seems the most reasonable behaviour for the common use of aliasing as a
60120 way of redirecting different local parts to the same mailbox. It means, for
60121 example, that a pair of alias entries of the form
60122 </para>
60123 <literallayout class="monospaced">
60124 A.Wol:   aw123
60125 aw123:   :fail: Gone away, no forwarding address
60126 </literallayout>
60127 <para>
60128 work as expected, with both local parts causing verification failure. When a
60129 redirection generates more than one address, the behaviour is more like a
60130 mailing list, where the existence of the alias itself is sufficient for
60131 verification to succeed.
60132 </para>
60133 <para>
60134 It is possible, however, to change the default behaviour so that all successful
60135 redirections count as successful verifications, however many new addresses are
60136 generated. This is specified by the <option>success_on_redirect</option> verification
60137 option. For example:
60138 </para>
60139 <literallayout class="monospaced">
60140 require verify = recipient/success_on_redirect/callout=10s
60141 </literallayout>
60142 <para>
60143 In this example, verification succeeds if a router generates a new address, and
60144 the callout does not occur, because no address was routed to a remote host.
60145 </para>
60146 <para>
60147 When verification is being tested via the <option>-bv</option> option, the treatment of
60148 redirections is as just described, unless the <option>-v</option> or any debugging option is
60149 also specified. In that case, full verification is done for every generated
60150 address and a report is output for each of them.
60151 </para>
60152 </section>
60153 <section id="SECTverifyCSA">
60154 <title>Client SMTP authorization (CSA)</title>
60155 <para>
60156 <indexterm role="concept">
60157 <primary>CSA</primary>
60158 <secondary>verifying</secondary>
60159 </indexterm>
60160 Client SMTP Authorization is a system that allows a site to advertise
60161 which machines are and are not permitted to send email. This is done by placing
60162 special SRV records in the DNS; these are looked up using the client&#x2019;s HELO
60163 domain. At the time of writing, CSA is still an Internet Draft. Client SMTP
60164 Authorization checks in Exim are performed by the ACL condition:
60165 </para>
60166 <literallayout class="monospaced">
60167 verify = csa
60168 </literallayout>
60169 <para>
60170 This fails if the client is not authorized. If there is a DNS problem, or if no
60171 valid CSA SRV record is found, or if the client is authorized, the condition
60172 succeeds. These three cases can be distinguished using the expansion variable
60173 <varname>$csa_status</varname>, which can take one of the values <quote>fail</quote>, <quote>defer</quote>,
60174 <quote>unknown</quote>, or <quote>ok</quote>. The condition does not itself defer because that would
60175 be likely to cause problems for legitimate email.
60176 </para>
60177 <para>
60178 The error messages produced by the CSA code include slightly more
60179 detail. If <varname>$csa_status</varname> is <quote>defer</quote>, this may be because of problems
60180 looking up the CSA SRV record, or problems looking up the CSA target
60181 address record. There are four reasons for <varname>$csa_status</varname> being <quote>fail</quote>:
60182 </para>
60183 <itemizedlist>
60184 <listitem>
60185 <para>
60186 The client&#x2019;s host name is explicitly not authorized.
60187 </para>
60188 </listitem>
60189 <listitem>
60190 <para>
60191 The client&#x2019;s IP address does not match any of the CSA target IP addresses.
60192 </para>
60193 </listitem>
60194 <listitem>
60195 <para>
60196 The client&#x2019;s host name is authorized but it has no valid target IP addresses
60197 (for example, the target&#x2019;s addresses are IPv6 and the client is using IPv4).
60198 </para>
60199 </listitem>
60200 <listitem>
60201 <para>
60202 The client&#x2019;s host name has no CSA SRV record but a parent domain has asserted
60203 that all subdomains must be explicitly authorized.
60204 </para>
60205 </listitem>
60206 </itemizedlist>
60207 <para>
60208 The <option>csa</option> verification condition can take an argument which is the domain to
60209 use for the DNS query. The default is:
60210 </para>
60211 <literallayout class="monospaced">
60212 verify = csa/$sender_helo_name
60213 </literallayout>
60214 <para>
60215 This implementation includes an extension to CSA. If the query domain
60216 is an address literal such as [192.0.2.95], or if it is a bare IP
60217 address, Exim searches for CSA SRV records in the reverse DNS as if
60218 the HELO domain was (for example) <emphasis>95.2.0.192.in-addr.arpa</emphasis>. Therefore it is
60219 meaningful to say:
60220 </para>
60221 <literallayout class="monospaced">
60222 verify = csa/$sender_host_address
60223 </literallayout>
60224 <para>
60225 In fact, this is the check that Exim performs if the client does not say HELO.
60226 This extension can be turned off by setting the main configuration option
60227 <option>dns_csa_use_reverse</option> to be false.
60228 </para>
60229 <para>
60230 If a CSA SRV record is not found for the domain itself, a search
60231 is performed through its parent domains for a record which might be
60232 making assertions about subdomains. The maximum depth of this search is limited
60233 using the main configuration option <option>dns_csa_search_limit</option>, which is 5 by
60234 default. Exim does not look for CSA SRV records in a top level domain, so the
60235 default settings handle HELO domains as long as seven
60236 (<emphasis>hostname.five.four.three.two.one.com</emphasis>). This encompasses the vast majority
60237 of legitimate HELO domains.
60238 </para>
60239 <para>
60240 The <emphasis>dnsdb</emphasis> lookup also has support for CSA. Although <emphasis>dnsdb</emphasis> also supports
60241 direct SRV lookups, this is not sufficient because of the extra parent domain
60242 search behaviour of CSA, and (as with PTR lookups) <emphasis>dnsdb</emphasis> also turns IP
60243 addresses into lookups in the reverse DNS space. The result of a successful
60244 lookup such as:
60245 </para>
60246 <literallayout class="monospaced">
60247 ${lookup dnsdb {csa=$sender_helo_name}}
60248 </literallayout>
60249 <para>
60250 has two space-separated fields: an authorization code and a target host name.
60251 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
60252 authorization required but absent, or <quote>?</quote> for unknown.
60253 </para>
60254 </section>
60255 <section id="SECTverifyPRVS">
60256 <title>Bounce address tag validation</title>
60257 <para>
60258 <indexterm role="concept">
60259 <primary>BATV, verifying</primary>
60260 </indexterm>
60261 Bounce address tag validation (BATV) is a scheme whereby the envelope senders
60262 of outgoing messages have a cryptographic, timestamped <quote>tag</quote> added to them.
60263 Genuine incoming bounce messages should therefore always be addressed to
60264 recipients that have a valid tag. This scheme is a way of detecting unwanted
60265 bounce messages caused by sender address forgeries (often called <quote>collateral
60266 spam</quote>), because the recipients of such messages do not include valid tags.
60267 </para>
60268 <para>
60269 There are two expansion items to help with the implementation of the BATV
60270 <quote>prvs</quote> (private signature) scheme in an Exim configuration. This scheme signs
60271 the original envelope sender address by using a simple key to add a hash of the
60272 address and some time-based randomizing information. The <option>prvs</option> expansion
60273 item creates a signed address, and the <option>prvscheck</option> expansion item checks one.
60274 The syntax of these expansion items is described in section
60275 <xref linkend="SECTexpansionitems"/>.
60276 The validity period on signed addresses is seven days.
60277 </para>
60278 <para>
60279 As an example, suppose the secret per-address keys are stored in an MySQL
60280 database. A query to look up the key for an address could be defined as a macro
60281 like this:
60282 </para>
60283 <literallayout class="monospaced">
60284 PRVSCHECK_SQL = ${lookup mysql{SELECT secret FROM batv_prvs \
60285                 WHERE sender='${quote_mysql:$prvscheck_address}'\
60286                 }{$value}}
60287 </literallayout>
60288 <para>
60289 Suppose also that the senders who make use of BATV are defined by an address
60290 list called <option>batv_senders</option>. Then, in the ACL for RCPT commands, you could
60291 use this:
60292 </para>
60293 <literallayout class="monospaced">
60294 # Bounces: drop unsigned addresses for BATV senders
60295 deny message = This address does not send an unsigned reverse path
60296      senders = :
60297      recipients = +batv_senders
60298
60299 # Bounces: In case of prvs-signed address, check signature.
60300 deny message = Invalid reverse path signature.
60301      senders = :
60302      condition  = ${prvscheck {$local_part@$domain}\
60303                   {PRVSCHECK_SQL}{1}}
60304      !condition = $prvscheck_result
60305 </literallayout>
60306 <para>
60307 The first statement rejects recipients for bounce messages that are addressed
60308 to plain BATV sender addresses, because it is known that BATV senders do not
60309 send out messages with plain sender addresses. The second statement rejects
60310 recipients that are prvs-signed, but with invalid signatures (either because
60311 the key is wrong, or the signature has timed out).
60312 </para>
60313 <para>
60314 A non-prvs-signed address is not rejected by the second statement, because the
60315 <option>prvscheck</option> expansion yields an empty string if its first argument is not a
60316 prvs-signed address, thus causing the <option>condition</option> condition to be false. If
60317 the first argument is a syntactically valid prvs-signed address, the yield is
60318 the third string (in this case <quote>1</quote>), whether or not the cryptographic and
60319 timeout checks succeed. The <varname>$prvscheck_result</varname> variable contains the result
60320 of the checks (empty for failure, <quote>1</quote> for success).
60321 </para>
60322 <para>
60323 There is one more issue you must consider when implementing prvs-signing:
60324 you have to ensure that the routers accept prvs-signed addresses and
60325 deliver them correctly. The easiest way to handle this is to use a <command>redirect</command>
60326 router to remove the signature with a configuration along these lines:
60327 </para>
60328 <literallayout class="monospaced">
60329 batv_redirect:
60330   driver = redirect
60331   data = ${prvscheck {$local_part@$domain}{PRVSCHECK_SQL}}
60332 </literallayout>
60333 <para>
60334 This works because, if the third argument of <option>prvscheck</option> is empty, the result
60335 of the expansion of a prvs-signed address is the decoded value of the original
60336 address. This router should probably be the first of your routers that handles
60337 local addresses.
60338 </para>
60339 <para>
60340 To create BATV-signed addresses in the first place, a transport of this form
60341 can be used:
60342 </para>
60343 <literallayout class="monospaced">
60344 external_smtp_batv:
60345   driver = smtp
60346   return_path = ${prvs {$return_path} \
60347                        {${lookup mysql{SELECT \
60348                        secret FROM batv_prvs WHERE \
60349                        sender='${quote_mysql:$sender_address}'} \
60350                        {$value}fail}}}
60351 </literallayout>
60352 <para>
60353 If no key can be found for the existing return path, no signing takes place.
60354 </para>
60355 </section>
60356 <section id="SECTrelaycontrol">
60357 <title>Using an ACL to control relaying</title>
60358 <para>
60359 <indexterm role="concept">
60360 <primary>access control lists (ACLs)</primary>
60361 <secondary>relay control</secondary>
60362 </indexterm>
60363 <indexterm role="concept">
60364 <primary>relaying</primary>
60365 <secondary>control by ACL</secondary>
60366 </indexterm>
60367 <indexterm role="concept">
60368 <primary>policy control</primary>
60369 <secondary>relay control</secondary>
60370 </indexterm>
60371 An MTA is said to <emphasis>relay</emphasis> a message if it receives it from some host and
60372 delivers it directly to another host as a result of a remote address contained
60373 within it. Redirecting a local address via an alias or forward file and then
60374 passing the message on to another host is not relaying,
60375 <indexterm role="concept">
60376 <primary><quote>percent hack</quote></primary>
60377 </indexterm>
60378 but a redirection as a result of the <quote>percent hack</quote> is.
60379 </para>
60380 <para>
60381 Two kinds of relaying exist, which are termed <quote>incoming</quote> and <quote>outgoing</quote>.
60382 A host which is acting as a gateway or an MX backup is concerned with incoming
60383 relaying from arbitrary hosts to a specific set of domains. On the other hand,
60384 a host which is acting as a smart host for a number of clients is concerned
60385 with outgoing relaying from those clients to the Internet at large. Often the
60386 same host is fulfilling both functions,
60387 but in principle these two kinds of relaying are entirely independent. What is
60388 not wanted is the transmission of mail from arbitrary remote hosts through your
60389 system to arbitrary domains.
60390 </para>
60391 <para>
60392 You can implement relay control by means of suitable statements in the ACL that
60393 runs for each RCPT command. For convenience, it is often easiest to use
60394 Exim&#x2019;s named list facility to define the domains and hosts involved. For
60395 example, suppose you want to do the following:
60396 </para>
60397 <itemizedlist>
60398 <listitem>
60399 <para>
60400 Deliver a number of domains to mailboxes on the local host (or process them
60401 locally in some other way). Let&#x2019;s say these are <emphasis>my.dom1.example</emphasis> and
60402 <emphasis>my.dom2.example</emphasis>.
60403 </para>
60404 </listitem>
60405 <listitem>
60406 <para>
60407 Relay mail for a number of other domains for which you are the secondary MX.
60408 These might be <emphasis>friend1.example</emphasis> and <emphasis>friend2.example</emphasis>.
60409 </para>
60410 </listitem>
60411 <listitem>
60412 <para>
60413 Relay mail from the hosts on your local LAN, to whatever domains are involved.
60414 Suppose your LAN is 192.168.45.0/24.
60415 </para>
60416 </listitem>
60417 </itemizedlist>
60418 <para>
60419 In the main part of the configuration, you put the following definitions:
60420 </para>
60421 <literallayout class="monospaced">
60422 domainlist local_domains    = my.dom1.example : my.dom2.example
60423 domainlist relay_to_domains = friend1.example : friend2.example
60424 hostlist   relay_from_hosts = 192.168.45.0/24
60425 </literallayout>
60426 <para>
60427 Now you can use these definitions in the ACL that is run for every RCPT
60428 command:
60429 </para>
60430 <literallayout class="monospaced">
60431 acl_check_rcpt:
60432   accept domains = +local_domains : +relay_to_domains
60433   accept hosts   = +relay_from_hosts
60434 </literallayout>
60435 <para>
60436 The first statement accepts any RCPT command that contains an address in
60437 the local or relay domains. For any other domain, control passes to the second
60438 statement, which accepts the command only if it comes from one of the relay
60439 hosts. In practice, you will probably want to make your ACL more sophisticated
60440 than this, for example, by including sender and recipient verification. The
60441 default configuration includes a more comprehensive example, which is described
60442 in chapter <xref linkend="CHAPdefconfil"/>.
60443 </para>
60444 </section>
60445 <section id="SECTcheralcon">
60446 <title>Checking a relay configuration</title>
60447 <para>
60448 <indexterm role="concept">
60449 <primary>relaying</primary>
60450 <secondary>checking control of</secondary>
60451 </indexterm>
60452 You can check the relay characteristics of your configuration in the same way
60453 that you can test any ACL behaviour for an incoming SMTP connection, by using
60454 the <option>-bh</option> option to run a fake SMTP session with which you interact.
60455 <indexterm role="concept" startref="IIDacl" class="endofrange"/>
60456 </para>
60457 </section>
60458 </chapter>
60459
60460 <chapter id="CHAPexiscan">
60461 <title>Content scanning at ACL time</title>
60462 <para>
60463 <indexterm role="concept" id="IIDcosca" class="startofrange">
60464 <primary>content scanning</primary>
60465 <secondary>at ACL time</secondary>
60466 </indexterm>
60467 The extension of Exim to include content scanning at ACL time, formerly known
60468 as <quote>exiscan</quote>, was originally implemented as a patch by Tom Kistner. The code
60469 was integrated into the main source for Exim release 4.50, and Tom continues to
60470 maintain it. Most of the wording of this chapter is taken from Tom&#x2019;s
60471 specification.
60472 </para>
60473 <para>
60474 It is also possible to scan the content of messages at other times. The
60475 <function>local_scan()</function> function (see chapter <xref linkend="CHAPlocalscan"/>) allows for content
60476 scanning after all the ACLs have run. A transport filter can be used to scan
60477 messages at delivery time (see the <option>transport_filter</option> option, described in
60478 chapter <xref linkend="CHAPtransportgeneric"/>).
60479 </para>
60480 <para>
60481 If you want to include the ACL-time content-scanning features when you compile
60482 Exim, you need to arrange for WITH_CONTENT_SCAN to be defined in your
60483 <filename>Local/Makefile</filename>. When you do that, the Exim binary is built with:
60484 </para>
60485 <itemizedlist>
60486 <listitem>
60487 <para>
60488 Two additional ACLs (<option>acl_smtp_mime</option> and <option>acl_not_smtp_mime</option>) that are run
60489 for all MIME parts for SMTP and non-SMTP messages, respectively.
60490 </para>
60491 </listitem>
60492 <listitem>
60493 <para>
60494 Additional ACL conditions and modifiers: <option>decode</option>, <option>malware</option>,
60495 <option>mime_regex</option>, <option>regex</option>, and <option>spam</option>. These can be used in the ACL that is
60496 run at the end of message reception (the <option>acl_smtp_data</option> ACL).
60497 </para>
60498 </listitem>
60499 <listitem>
60500 <para>
60501 An additional control feature (<quote>no_mbox_unspool</quote>) that saves spooled copies
60502 of messages, or parts of messages, for debugging purposes.
60503 </para>
60504 </listitem>
60505 <listitem>
60506 <para>
60507 Additional expansion variables that are set in the new ACL and by the new
60508 conditions.
60509 </para>
60510 </listitem>
60511 <listitem>
60512 <para>
60513 Two new main configuration options: <option>av_scanner</option> and <option>spamd_address</option>.
60514 </para>
60515 </listitem>
60516 </itemizedlist>
60517 <para>
60518 Content-scanning is continually evolving, and new features are still being
60519 added. While such features are still unstable and liable to incompatible
60520 changes, they are made available in Exim by setting options whose names begin
60521 EXPERIMENTAL_ in <filename>Local/Makefile</filename>. Such features are not documented in
60522 this manual. You can find out about them by reading the file called
60523 <filename>doc/experimental.txt</filename>.
60524 </para>
60525 <para>
60526 All the content-scanning facilities work on a MBOX copy of the message that is
60527 temporarily created in a file called:
60528 </para>
60529 <literallayout>
60530 &lt;<emphasis>spool_directory</emphasis>&gt;<literal>/scan/</literal>&lt;<emphasis>message_id</emphasis>&gt;/&lt;<emphasis>message_id</emphasis>&gt;<literal>.eml</literal>
60531 </literallayout>
60532 <para>
60533 The <filename>.eml</filename> extension is a friendly hint to virus scanners that they can
60534 expect an MBOX-like structure inside that file. The file is created when the
60535 first content scanning facility is called. Subsequent calls to content
60536 scanning conditions open the same file again. The directory is recursively
60537 removed when the <option>acl_smtp_data</option> ACL has finished running, unless
60538 </para>
60539 <literallayout class="monospaced">
60540 control = no_mbox_unspool
60541 </literallayout>
60542 <para>
60543 has been encountered. When the MIME ACL decodes files, they are put into the
60544 same directory by default.
60545 </para>
60546 <section id="SECTscanvirus">
60547 <title>Scanning for viruses</title>
60548 <para>
60549 <indexterm role="concept">
60550 <primary>virus scanning</primary>
60551 </indexterm>
60552 <indexterm role="concept">
60553 <primary>content scanning</primary>
60554 <secondary>for viruses</secondary>
60555 </indexterm>
60556 <indexterm role="concept">
60557 <primary>content scanning</primary>
60558 <secondary>the <option>malware</option> condition</secondary>
60559 </indexterm>
60560 The <option>malware</option> ACL condition lets you connect virus scanner software to Exim.
60561 It supports a <quote>generic</quote> interface to scanners called via the shell, and
60562 specialized interfaces for <quote>daemon</quote> type virus scanners, which are resident
60563 in memory and thus are much faster.
60564 </para>
60565 <para>
60566 A timeout of 2 minutes is applied to a scanner call (by default);
60567 if it expires then a defer action is taken.
60568 </para>
60569 <para>
60570 <indexterm role="option">
60571 <primary><option>av_scanner</option></primary>
60572 </indexterm>
60573 You can set the <option>av_scanner</option> option in the main part of the configuration
60574 to specify which scanner to use, together with any additional options that
60575 are needed. The basic syntax is as follows:
60576 </para>
60577 <literallayout>
60578 <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>
60579 </literallayout>
60580 <para>
60581 If you do not set <option>av_scanner</option>, it defaults to
60582 </para>
60583 <literallayout class="monospaced">
60584 av_scanner = sophie:/var/run/sophie
60585 </literallayout>
60586 <para>
60587 If the value of <option>av_scanner</option> starts with a dollar character, it is expanded
60588 before use.
60589 The usual list-parsing of the content (see <xref linkend="SECTlistconstruct"/>) applies.
60590 The following scanner types are supported in this release,
60591 though individual ones can be included or not at build time:
60592 </para>
60593 <variablelist>
60594 <varlistentry>
60595 <term><option>avast</option></term>
60596 <listitem>
60597 <para>
60598 <indexterm role="concept">
60599 <primary>virus scanners</primary>
60600 <secondary>avast</secondary>
60601 </indexterm>
60602 This is the scanner daemon of Avast. It has been tested with Avast Core
60603 Security (currently at version 2.2.0).
60604 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
60605 at <emphasis role="bold"><ulink url="https://www.avast.com/linux-server-antivirus">https://www.avast.com/linux-server-antivirus</ulink></emphasis>.
60606 This scanner type takes one option,
60607 which can be either a full path to a UNIX socket,
60608 or host and port specifiers separated by white space.
60609 The host may be a name or an IP address; the port is either a
60610 single number or a pair of numbers with a dash between.
60611 A list of options may follow. These options are interpreted on the
60612 Exim&#x2019;s side of the malware scanner, or are given on separate lines to
60613 the daemon as options before the main scan command.
60614 </para>
60615 <para>
60616 <indexterm role="concept">
60617 <primary><literal>pass_unscanned</literal></primary>
60618 <secondary>avast</secondary>
60619 </indexterm>
60620 If <literal>pass_unscanned</literal>
60621 is set, any files the Avast scanner can&#x2019;t scan (e.g.
60622 decompression bombs, or invalid archives) are considered clean. Use with
60623 care.
60624 </para>
60625 <para>
60626 For example:
60627 </para>
60628 <literallayout class="monospaced">
60629 av_scanner = avast:/var/run/avast/scan.sock:FLAGS -fullfiles:SENSITIVITY -pup
60630 av_scanner = avast:/var/run/avast/scan.sock:pass_unscanned:FLAGS -fullfiles:SENSITIVITY -pup
60631 av_scanner = avast:192.168.2.22 5036
60632 </literallayout>
60633 <para>
60634 If you omit the argument, the default path
60635 <filename>/var/run/avast/scan.sock</filename>
60636 is used.
60637 If you use a remote host,
60638 you need to make Exim&#x2019;s spool directory available to it,
60639 as the scanner is passed a file path, not file contents.
60640 For information about available commands and their options you may use
60641 </para>
60642 <literallayout class="monospaced">
60643 $ socat UNIX:/var/run/avast/scan.sock STDIO:
60644     FLAGS
60645     SENSITIVITY
60646     PACK
60647 </literallayout>
60648 <para>
60649 If the scanner returns a temporary failure (e.g. license issues, or
60650 permission problems), the message is deferred and a paniclog entry is
60651 written.  The usual <literal>defer_ok</literal> option is available.
60652 </para>
60653 </listitem></varlistentry>
60654 <varlistentry>
60655 <term><option>aveserver</option></term>
60656 <listitem>
60657 <para>
60658 <indexterm role="concept">
60659 <primary>virus scanners</primary>
60660 <secondary>Kaspersky</secondary>
60661 </indexterm>
60662 This is the scanner daemon of Kaspersky Version 5. You can get a trial version
60663 at <emphasis role="bold"><ulink url="https://www.kaspersky.com/">https://www.kaspersky.com/</ulink></emphasis>. This scanner type takes one option,
60664 which is the path to the daemon&#x2019;s UNIX socket. The default is shown in this
60665 example:
60666 </para>
60667 <literallayout class="monospaced">
60668 av_scanner = aveserver:/var/run/aveserver
60669 </literallayout>
60670 </listitem></varlistentry>
60671 <varlistentry>
60672 <term><option>clamd</option></term>
60673 <listitem>
60674 <para>
60675 <indexterm role="concept">
60676 <primary>virus scanners</primary>
60677 <secondary>clamd</secondary>
60678 </indexterm>
60679 This daemon-type scanner is GPL and free. You can get it at
60680 <emphasis role="bold"><ulink url="https://www.clamav.net/">https://www.clamav.net/</ulink></emphasis>. Some older versions of clamd do not seem to
60681 unpack MIME containers, so it used to be recommended to unpack MIME attachments
60682 in the MIME ACL. This is no longer believed to be necessary.
60683 </para>
60684 <para>
60685 The options are a list of server specifiers, which may be
60686 a UNIX socket specification,
60687 a TCP socket specification,
60688 or a (global) option.
60689 </para>
60690 <para>
60691 A socket specification consists of a space-separated list.
60692 For a Unix socket the first element is a full path for the socket,
60693 for a TCP socket the first element is the IP address
60694 and the second a port number,
60695 Any further elements are per-server (non-global) options.
60696 These per-server options are supported:
60697 </para>
60698 <literallayout class="monospaced">
60699 retry=&lt;timespec&gt;  Retry on connect fail
60700 </literallayout>
60701 <para>
60702 The <literal>retry</literal> option specifies a time after which a single retry for
60703 a failed connect is made.  The default is to not retry.
60704 </para>
60705 <para>
60706 If a Unix socket file is specified, only one server is supported.
60707 </para>
60708 <para>
60709 Examples:
60710 </para>
60711 <literallayout class="monospaced">
60712 av_scanner = clamd:/opt/clamd/socket
60713 av_scanner = clamd:192.0.2.3 1234
60714 av_scanner = clamd:192.0.2.3 1234:local
60715 av_scanner = clamd:192.0.2.3 1234 retry=10s
60716 av_scanner = clamd:192.0.2.3 1234 : 192.0.2.4 1234
60717 </literallayout>
60718 <para>
60719 If the value of av_scanner points to a UNIX socket file or contains the
60720 <literal>local</literal>
60721 option, then the ClamAV interface will pass a filename containing the data
60722 to be scanned, which should normally result in less I/O happening and be
60723 more efficient.  Normally in the TCP case, the data is streamed to ClamAV as
60724 Exim does not assume that there is a common filesystem with the remote host.
60725 </para>
60726 <para>
60727 The final example shows that multiple TCP targets can be specified.  Exim will
60728 randomly use one for each incoming email (i.e. it load balances them).  Note
60729 that only TCP targets may be used if specifying a list of scanners; a UNIX
60730 socket cannot be mixed in with TCP targets.  If one of the servers becomes
60731 unavailable, Exim will try the remaining one(s) until it finds one that works.
60732 When a clamd server becomes unreachable, Exim will log a message.  Exim does
60733 not keep track of scanner state between multiple messages, and the scanner
60734 selection is random, so the message will get logged in the mainlog for each
60735 email that the down scanner gets chosen first (message wrapped to be readable):
60736 </para>
60737 <literallayout class="monospaced">
60738 2013-10-09 14:30:39 1VTumd-0000Y8-BQ malware acl condition:
60739    clamd: connection to localhost, port 3310 failed
60740    (Connection refused)
60741 </literallayout>
60742 <para>
60743 If the option is unset, the default is <filename>/tmp/clamd</filename>. Thanks to David Saez for
60744 contributing the code for this scanner.
60745 </para>
60746 </listitem></varlistentry>
60747 <varlistentry>
60748 <term><option>cmdline</option></term>
60749 <listitem>
60750 <para>
60751 <indexterm role="concept">
60752 <primary>virus scanners</primary>
60753 <secondary>command line interface</secondary>
60754 </indexterm>
60755 This is the keyword for the generic command line scanner interface. It can be
60756 used to attach virus scanners that are invoked from the shell. This scanner
60757 type takes 3 mandatory options:
60758 </para>
60759 <orderedlist numeration="arabic">
60760 <listitem>
60761 <para>
60762 The full path and name of the scanner binary, with all command line options,
60763 and a placeholder (<literal>%s</literal>) for the directory to scan.
60764 </para>
60765 </listitem>
60766 <listitem>
60767 <para>
60768 A regular expression to match against the STDOUT and STDERR output of the
60769 virus scanner. If the expression matches, a virus was found. You must make
60770 absolutely sure that this expression matches on <quote>virus found</quote>. This is called
60771 the <quote>trigger</quote> expression.
60772 </para>
60773 </listitem>
60774 <listitem>
60775 <para>
60776 Another regular expression, containing exactly one pair of parentheses, to
60777 match the name of the virus found in the scanners output. This is called the
60778 <quote>name</quote> expression.
60779 </para>
60780 </listitem>
60781 </orderedlist>
60782 <para>
60783 For example, Sophos Sweep reports a virus on a line like this:
60784 </para>
60785 <literallayout class="monospaced">
60786 Virus 'W32/Magistr-B' found in file ./those.bat
60787 </literallayout>
60788 <para>
60789 For the trigger expression, we can match the phrase <quote>found in file</quote>. For the
60790 name expression, we want to extract the W32/Magistr-B string, so we can match
60791 for the single quotes left and right of it. Altogether, this makes the
60792 configuration setting:
60793 </para>
60794 <literallayout class="monospaced">
60795 av_scanner = cmdline:\
60796              /path/to/sweep -ss -all -rec -archive %s:\
60797              found in file:'(.+)'
60798 </literallayout>
60799 </listitem></varlistentry>
60800 <varlistentry>
60801 <term><option>drweb</option></term>
60802 <listitem>
60803 <para>
60804 <indexterm role="concept">
60805 <primary>virus scanners</primary>
60806 <secondary>DrWeb</secondary>
60807 </indexterm>
60808 The DrWeb daemon scanner (<emphasis role="bold"><ulink url="https://www.sald.ru/">https://www.sald.ru/</ulink></emphasis>) interface
60809 takes one option,
60810 either a full path to a UNIX socket,
60811 or host and port specifiers separated by white space.
60812 The host may be a name or an IP address; the port is either a
60813 single number or a pair of numbers with a dash between.
60814 For example:
60815 </para>
60816 <literallayout class="monospaced">
60817 av_scanner = drweb:/var/run/drwebd.sock
60818 av_scanner = drweb:192.168.2.20 31337
60819 </literallayout>
60820 <para>
60821 If you omit the argument, the default path <filename>/usr/local/drweb/run/drwebd.sock</filename>
60822 is used. Thanks to Alex Miller for contributing the code for this scanner.
60823 </para>
60824 </listitem></varlistentry>
60825 <varlistentry>
60826 <term><option>f-protd</option></term>
60827 <listitem>
60828 <para>
60829 <indexterm role="concept">
60830 <primary>virus scanners</primary>
60831 <secondary>f-protd</secondary>
60832 </indexterm>
60833 The f-protd scanner is accessed via HTTP over TCP.
60834 One argument is taken, being a space-separated hostname and port number
60835 (or port-range).
60836 For example:
60837 </para>
60838 <literallayout class="monospaced">
60839 av_scanner = f-protd:localhost 10200-10204
60840 </literallayout>
60841 <para>
60842 If you omit the argument, the default values shown above are used.
60843 </para>
60844 </listitem></varlistentry>
60845 <varlistentry>
60846 <term><option>f-prot6d</option></term>
60847 <listitem>
60848 <para>
60849 <indexterm role="concept">
60850 <primary>virus scanners</primary>
60851 <secondary>f-prot6d</secondary>
60852 </indexterm>
60853 The f-prot6d scanner is accessed using the FPSCAND protocol over TCP.
60854 One argument is taken, being a space-separated hostname and port number.
60855 For example:
60856 </para>
60857 <literallayout class="monospaced">
60858 av_scanner = f-prot6d:localhost 10200
60859 </literallayout>
60860 <para>
60861 If you omit the argument, the default values show above are used.
60862 </para>
60863 </listitem></varlistentry>
60864 <varlistentry>
60865 <term><option>fsecure</option></term>
60866 <listitem>
60867 <para>
60868 <indexterm role="concept">
60869 <primary>virus scanners</primary>
60870 <secondary>F-Secure</secondary>
60871 </indexterm>
60872 The F-Secure daemon scanner (<emphasis role="bold"><ulink url="https://www.f-secure.com/">https://www.f-secure.com/</ulink></emphasis>) takes one
60873 argument which is the path to a UNIX socket. For example:
60874 </para>
60875 <literallayout class="monospaced">
60876 av_scanner = fsecure:/path/to/.fsav
60877 </literallayout>
60878 <para>
60879 If no argument is given, the default is <filename>/var/run/.fsav</filename>. Thanks to Johan
60880 Thelmen for contributing the code for this scanner.
60881 </para>
60882 </listitem></varlistentry>
60883 <varlistentry>
60884 <term><option>kavdaemon</option></term>
60885 <listitem>
60886 <para>
60887 <indexterm role="concept">
60888 <primary>virus scanners</primary>
60889 <secondary>Kaspersky</secondary>
60890 </indexterm>
60891 This is the scanner daemon of Kaspersky Version 4. This version of the
60892 Kaspersky scanner is outdated. Please upgrade (see <option>aveserver</option> above). This
60893 scanner type takes one option, which is the path to the daemon&#x2019;s UNIX socket.
60894 For example:
60895 </para>
60896 <literallayout class="monospaced">
60897 av_scanner = kavdaemon:/opt/AVP/AvpCtl
60898 </literallayout>
60899 <para>
60900 The default path is <filename>/var/run/AvpCtl</filename>.
60901 </para>
60902 </listitem></varlistentry>
60903 <varlistentry>
60904 <term><option>mksd</option></term>
60905 <listitem>
60906 <para>
60907 <indexterm role="concept">
60908 <primary>virus scanners</primary>
60909 <secondary>mksd</secondary>
60910 </indexterm>
60911 This was a daemon type scanner that is aimed mainly at Polish users,
60912 though some documentation was available in English.
60913 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>
60914 and this appears to be a candidate for removal from Exim, unless
60915 we are informed of other virus scanners which use the same protocol
60916 to integrate.
60917 The only option for this scanner type is
60918 the maximum number of processes used simultaneously to scan the attachments,
60919 provided that mksd has
60920 been run with at least the same number of child processes. For example:
60921 </para>
60922 <literallayout class="monospaced">
60923 av_scanner = mksd:2
60924 </literallayout>
60925 <para>
60926 You can safely omit this option (the default value is 1).
60927 </para>
60928 </listitem></varlistentry>
60929 <varlistentry>
60930 <term><option>sock</option></term>
60931 <listitem>
60932 <para>
60933 <indexterm role="concept">
60934 <primary>virus scanners</primary>
60935 <secondary>simple socket-connected</secondary>
60936 </indexterm>
60937 This is a general-purpose way of talking to simple scanner daemons
60938 running on the local machine.
60939 There are four options:
60940 an address (which may be an IP address and port, or the path of a Unix socket),
60941 a commandline to send (may include a single %s which will be replaced with
60942 the path to the mail file to be scanned),
60943 an RE to trigger on from the returned data,
60944 and an RE to extract malware_name from the returned data.
60945 For example:
60946 </para>
60947 <literallayout class="monospaced">
60948 av_scanner = sock:127.0.0.1 6001:%s:(SPAM|VIRUS):(.*)$
60949 </literallayout>
60950 <para>
60951 Note that surrounding whitespace is stripped from each option, meaning
60952 there is no way to specify a trailing newline.
60953 The socket specifier and both regular-expressions are required.
60954 Default for the commandline is <filename>%s\n</filename> (note this does have a trailing newline);
60955 specify an empty element to get this.
60956 </para>
60957 </listitem></varlistentry>
60958 <varlistentry>
60959 <term><option>sophie</option></term>
60960 <listitem>
60961 <para>
60962 <indexterm role="concept">
60963 <primary>virus scanners</primary>
60964 <secondary>Sophos and Sophie</secondary>
60965 </indexterm>
60966 Sophie is a daemon that uses Sophos&#x2019; <option>libsavi</option> library to scan for viruses.
60967 You can get Sophie at <emphasis role="bold"><ulink url="http://sophie.sourceforge.net/">http://sophie.sourceforge.net/</ulink></emphasis>. The only option
60968 for this scanner type is the path to the UNIX socket that Sophie uses for
60969 client communication. For example:
60970 </para>
60971 <literallayout class="monospaced">
60972 av_scanner = sophie:/tmp/sophie
60973 </literallayout>
60974 <para>
60975 The default path is <filename>/var/run/sophie</filename>, so if you are using this, you can omit
60976 the option.
60977 </para>
60978 </listitem></varlistentry>
60979 </variablelist>
60980 <para>
60981 When <option>av_scanner</option> is correctly set, you can use the <option>malware</option> condition in
60982 the DATA ACL. <emphasis role="bold">Note</emphasis>: You cannot use the <option>malware</option> condition in the MIME
60983 ACL.
60984 </para>
60985 <para>
60986 The <option>av_scanner</option> option is expanded each time <option>malware</option> is called. This
60987 makes it possible to use different scanners. See further below for an example.
60988 The <option>malware</option> condition caches its results, so when you use it multiple times
60989 for the same message, the actual scanning process is only carried out once.
60990 However, using expandable items in <option>av_scanner</option> disables this caching, in
60991 which case each use of the <option>malware</option> condition causes a new scan of the
60992 message.
60993 </para>
60994 <para>
60995 The <option>malware</option> condition takes a right-hand argument that is expanded before
60996 use and taken as a list, slash-separated by default.
60997 The first element can then be one of
60998 </para>
60999 <itemizedlist>
61000 <listitem>
61001 <para>
61002 <quote>true</quote>, <quote>*</quote>, or <quote>1</quote>, in which case the message is scanned for viruses.
61003 The condition succeeds if a virus was found, and fail otherwise. This is the
61004 recommended usage.
61005 </para>
61006 </listitem>
61007 <listitem>
61008 <para>
61009 <quote>false</quote> or <quote>0</quote> or an empty string, in which case no scanning is done and
61010 the condition fails immediately.
61011 </para>
61012 </listitem>
61013 <listitem>
61014 <para>
61015 A regular expression, in which case the message is scanned for viruses. The
61016 condition succeeds if a virus is found and its name matches the regular
61017 expression. This allows you to take special actions on certain types of virus.
61018 Note that <quote>/</quote> characters in the RE must be doubled due to the list-processing,
61019 unless the separator is changed (in the usual way <xref linkend="SECTlistsepchange"/>).
61020 </para>
61021 </listitem>
61022 </itemizedlist>
61023 <para>
61024 You can append a <literal>defer_ok</literal> element to the <option>malware</option> argument list to accept
61025 messages even if there is a problem with the virus scanner.
61026 Otherwise, such a problem causes the ACL to defer.
61027 </para>
61028 <para>
61029 You can append a <literal>tmo=&lt;val&gt;</literal> element to the <option>malware</option> argument list to
61030 specify a non-default timeout.  The default is two minutes.
61031 For example:
61032 </para>
61033 <literallayout class="monospaced">
61034 malware = * / defer_ok / tmo=10s
61035 </literallayout>
61036 <para>
61037 A timeout causes the ACL to defer.
61038 </para>
61039 <para>
61040 <indexterm role="variable">
61041 <primary><varname>$callout_address</varname></primary>
61042 </indexterm>
61043 When a connection is made to the scanner the expansion variable <varname>$callout_address</varname>
61044 is set to record the actual address used.
61045 </para>
61046 <para>
61047 <indexterm role="variable">
61048 <primary><varname>$malware_name</varname></primary>
61049 </indexterm>
61050 When a virus is found, the condition sets up an expansion variable called
61051 <varname>$malware_name</varname> that contains the name of the virus. You can use it in a
61052 <option>message</option> modifier that specifies the error returned to the sender, and/or in
61053 logging data.
61054 </para>
61055 <para>
61056 Beware the interaction of Exim&#x2019;s <option>message_size_limit</option> with any size limits
61057 imposed by your anti-virus scanner.
61058 </para>
61059 <para>
61060 Here is a very simple scanning example:
61061 </para>
61062 <literallayout class="monospaced">
61063 deny message = This message contains malware ($malware_name)
61064      malware = *
61065 </literallayout>
61066 <para>
61067 The next example accepts messages when there is a problem with the scanner:
61068 </para>
61069 <literallayout class="monospaced">
61070 deny message = This message contains malware ($malware_name)
61071      malware = */defer_ok
61072 </literallayout>
61073 <para>
61074 The next example shows how to use an ACL variable to scan with both sophie and
61075 aveserver. It assumes you have set:
61076 </para>
61077 <literallayout class="monospaced">
61078 av_scanner = $acl_m0
61079 </literallayout>
61080 <para>
61081 in the main Exim configuration.
61082 </para>
61083 <literallayout class="monospaced">
61084 deny message = This message contains malware ($malware_name)
61085      set acl_m0 = sophie
61086      malware = *
61087
61088 deny message = This message contains malware ($malware_name)
61089      set acl_m0 = aveserver
61090      malware = *
61091 </literallayout>
61092 </section>
61093 <section id="SECTscanspamass">
61094 <title>Scanning with SpamAssassin and Rspamd</title>
61095 <para>
61096 <indexterm role="concept">
61097 <primary>content scanning</primary>
61098 <secondary>for spam</secondary>
61099 </indexterm>
61100 <indexterm role="concept">
61101 <primary>spam scanning</primary>
61102 </indexterm>
61103 <indexterm role="concept">
61104 <primary>SpamAssassin</primary>
61105 </indexterm>
61106 <indexterm role="concept">
61107 <primary>Rspamd</primary>
61108 </indexterm>
61109 The <option>spam</option> ACL condition calls SpamAssassin&#x2019;s <option>spamd</option> daemon to get a spam
61110 score and a report for the message.
61111 Support is also provided for Rspamd.
61112 </para>
61113 <para>
61114 For more information about installation and configuration of SpamAssassin or
61115 Rspamd refer to their respective websites at
61116 <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>
61117 </para>
61118 <para>
61119 SpamAssassin can be installed with CPAN by running:
61120 </para>
61121 <literallayout class="monospaced">
61122 perl -MCPAN -e 'install Mail::SpamAssassin'
61123 </literallayout>
61124 <para>
61125 SpamAssassin has its own set of configuration files. Please review its
61126 documentation to see how you can tweak it. The default installation should work
61127 nicely, however.
61128 </para>
61129 <para>
61130 <indexterm role="option">
61131 <primary><option>spamd_address</option></primary>
61132 </indexterm>
61133 By default, SpamAssassin listens on 127.0.0.1, TCP port 783 and if you
61134 intend to use an instance running on the local host you do not need to set
61135 <option>spamd_address</option>. If you intend to use another host or port for SpamAssassin,
61136 you must set the <option>spamd_address</option> option in the global part of the Exim
61137 configuration as follows (example):
61138 </para>
61139 <literallayout class="monospaced">
61140 spamd_address = 192.168.99.45 783
61141 </literallayout>
61142 <para>
61143 The SpamAssassin protocol relies on a TCP half-close from the client.
61144 If your SpamAssassin client side is running a Linux system with an
61145 iptables firewall, consider setting
61146 <option>net.netfilter.nf_conntrack_tcp_timeout_close_wait</option> to at least the
61147 timeout, Exim uses when waiting for a response from the SpamAssassin
61148 server (currently defaulting to 120s).  With a lower value the Linux
61149 connection tracking may consider your half-closed connection as dead too
61150 soon.
61151 </para>
61152 <para>
61153 To use Rspamd (which by default listens on all local addresses
61154 on TCP port 11333)
61155 you should add <option>variant=rspamd</option> after the address/port pair, for example:
61156 </para>
61157 <literallayout class="monospaced">
61158 spamd_address = 127.0.0.1 11333 variant=rspamd
61159 </literallayout>
61160 <para>
61161 As of version 2.60, <option>SpamAssassin</option> also supports communication over UNIX
61162 sockets. If you want to us these, supply <option>spamd_address</option> with an absolute
61163 filename instead of an address/port pair:
61164 </para>
61165 <literallayout class="monospaced">
61166 spamd_address = /var/run/spamd_socket
61167 </literallayout>
61168 <para>
61169 You can have multiple <option>spamd</option> servers to improve scalability. These can
61170 reside on other hardware reachable over the network. To specify multiple
61171 <option>spamd</option> servers, put multiple address/port pairs in the <option>spamd_address</option>
61172 option, separated with colons (the separator can be changed in the usual way <xref linkend="SECTlistsepchange"/>):
61173 </para>
61174 <literallayout class="monospaced">
61175 spamd_address = 192.168.2.10 783 : \
61176                 192.168.2.11 783 : \
61177                 192.168.2.12 783
61178 </literallayout>
61179 <para>
61180 Up to 32 <option>spamd</option> servers are supported.
61181 When a server fails to respond to the connection attempt, all other
61182 servers are tried until one succeeds. If no server responds, the <option>spam</option>
61183 condition defers.
61184 </para>
61185 <para>
61186 Unix and TCP socket specifications may be mixed in any order.
61187 Each element of the list is a list itself, space-separated by default
61188 and changeable in the usual way (<xref linkend="SECTlistsepchange"/>);
61189 take care to not double the separator.
61190 </para>
61191 <para>
61192 For TCP socket specifications a host name or IP (v4 or v6, but
61193 subject to list-separator quoting rules) address can be used,
61194 and the port can be one or a dash-separated pair.
61195 In the latter case, the range is tried in strict order.
61196 </para>
61197 <para>
61198 Elements after the first for Unix sockets, or second for TCP socket,
61199 are options.
61200 The supported options are:
61201 </para>
61202 <literallayout class="monospaced">
61203 pri=&lt;priority&gt;      Selection priority
61204 weight=&lt;value&gt;      Selection bias
61205 time=&lt;start&gt;-&lt;end&gt;  Use only between these times of day
61206 retry=&lt;timespec&gt;    Retry on connect fail
61207 tmo=&lt;timespec&gt;      Connection time limit
61208 variant=rspamd      Use Rspamd rather than SpamAssassin protocol
61209 </literallayout>
61210 <para>
61211 The <literal>pri</literal> option specifies a priority for the server within the list,
61212 higher values being tried first.
61213 The default priority is 1.
61214 </para>
61215 <para>
61216 The <literal>weight</literal> option specifies a selection bias.
61217 Within a priority set
61218 servers are queried in a random fashion, weighted by this value.
61219 The default value for selection bias is 1.
61220 </para>
61221 <para>
61222 Time specifications for the <literal>time</literal> option are &lt;hour&gt;.&lt;minute&gt;.&lt;second&gt;
61223 in the local time zone; each element being one or more digits.
61224 Either the seconds or both minutes and seconds, plus the leading <literal>.</literal>
61225 characters, may be omitted and will be taken as zero.
61226 </para>
61227 <para>
61228 Timeout specifications for the <literal>retry</literal> and <literal>tmo</literal> options
61229 are the usual Exim time interval standard, e.g. <literal>20s</literal> or <literal>1m</literal>.
61230 </para>
61231 <para>
61232 The <literal>tmo</literal> option specifies an overall timeout for communication.
61233 The default value is two minutes.
61234 </para>
61235 <para>
61236 The <literal>retry</literal> option specifies a time after which a single retry for
61237 a failed connect is made.
61238 The default is to not retry.
61239 </para>
61240 <para>
61241 The <option>spamd_address</option> variable is expanded before use if it starts with
61242 a dollar sign. In this case, the expansion may return a string that is
61243 used as the list so that multiple spamd servers can be the result of an
61244 expansion.
61245 </para>
61246 <para>
61247 <indexterm role="variable">
61248 <primary><varname>$callout_address</varname></primary>
61249 </indexterm>
61250 When a connection is made to the server the expansion variable <varname>$callout_address</varname>
61251 is set to record the actual address used.
61252 </para>
61253 </section>
61254 <section id="SECID206">
61255 <title>Calling SpamAssassin from an Exim ACL</title>
61256 <para>
61257 Here is a simple example of the use of the <option>spam</option> condition in a DATA ACL:
61258 </para>
61259 <literallayout class="monospaced">
61260 deny message = This message was classified as SPAM
61261      spam = joe
61262 </literallayout>
61263 <para>
61264 The right-hand side of the <option>spam</option> condition specifies a name. This is
61265 relevant if you have set up multiple SpamAssassin profiles. If you do not want
61266 to scan using a specific profile, but rather use the SpamAssassin system-wide
61267 default profile, you can scan for an unknown name, or simply use <quote>nobody</quote>.
61268 Rspamd does not use this setting. However, you must put something on the
61269 right-hand side.
61270 </para>
61271 <para>
61272 The name allows you to use per-domain or per-user antispam profiles in
61273 principle, but this is not straightforward in practice, because a message may
61274 have multiple recipients, not necessarily all in the same domain. Because the
61275 <option>spam</option> condition has to be called from a DATA-time ACL in order to be able to
61276 read the contents of the message, the variables <varname>$local_part</varname> and <varname>$domain</varname>
61277 are not set.
61278 Careful enforcement of single-recipient messages
61279 (e.g. by responding with defer in the recipient ACL for all recipients
61280 after the first),
61281 or the use of PRDR,
61282 <indexterm role="concept">
61283 <primary>PRDR</primary>
61284 <secondary>use for per-user SpamAssassin profiles</secondary>
61285 </indexterm>
61286 are needed to use this feature.
61287 </para>
61288 <para>
61289 The right-hand side of the <option>spam</option> condition is expanded before being used, so
61290 you can put lookups or conditions there. When the right-hand side evaluates to
61291 <quote>0</quote> or <quote>false</quote>, no scanning is done and the condition fails immediately.
61292 </para>
61293 <para>
61294 Scanning with SpamAssassin uses a lot of resources. If you scan every message,
61295 large ones may cause significant performance degradation. As most spam messages
61296 are quite small, it is recommended that you do not scan the big ones. For
61297 example:
61298 </para>
61299 <literallayout class="monospaced">
61300 deny message = This message was classified as SPAM
61301      condition = ${if &lt; {$message_size}{10K}}
61302      spam = nobody
61303 </literallayout>
61304 <para>
61305 The <option>spam</option> condition returns true if the threshold specified in the user&#x2019;s
61306 SpamAssassin profile has been matched or exceeded. If you want to use the
61307 <option>spam</option> condition for its side effects (see the variables below), you can make
61308 it always return <quote>true</quote> by appending <literal>:true</literal> to the username.
61309 </para>
61310 <para>
61311 <indexterm role="concept">
61312 <primary>spam scanning</primary>
61313 <secondary>returned variables</secondary>
61314 </indexterm>
61315 When the <option>spam</option> condition is run, it sets up a number of expansion
61316 variables.
61317 Except for <varname>$spam_report</varname>,
61318 these variables are saved with the received message so are
61319 available for use at delivery time.
61320 </para>
61321 <variablelist>
61322 <varlistentry>
61323 <term><varname>$spam_score</varname></term>
61324 <listitem>
61325 <para>
61326 The spam score of the message, for example, <quote>3.4</quote> or <quote>30.5</quote>. This is useful
61327 for inclusion in log or reject messages.
61328 </para>
61329 </listitem></varlistentry>
61330 <varlistentry>
61331 <term><varname>$spam_score_int</varname></term>
61332 <listitem>
61333 <para>
61334 The spam score of the message, multiplied by ten, as an integer value. For
61335 example <quote>34</quote> or <quote>305</quote>. It may appear to disagree with <varname>$spam_score</varname>
61336 because <varname>$spam_score</varname> is rounded and <varname>$spam_score_int</varname> is truncated.
61337 The integer value is useful for numeric comparisons in conditions.
61338 </para>
61339 </listitem></varlistentry>
61340 <varlistentry>
61341 <term><varname>$spam_bar</varname></term>
61342 <listitem>
61343 <para>
61344 A string consisting of a number of <quote>+</quote> or <quote>-</quote> characters, representing the
61345 integer part of the spam score value. A spam score of 4.4 would have a
61346 <varname>$spam_bar</varname> value of <quote>++++</quote>. This is useful for inclusion in warning
61347 headers, since MUAs can match on such strings. The maximum length of the
61348 spam bar is 50 characters.
61349 </para>
61350 </listitem></varlistentry>
61351 <varlistentry>
61352 <term><varname>$spam_report</varname></term>
61353 <listitem>
61354 <para>
61355 A multiline text table, containing the full SpamAssassin report for the
61356 message. Useful for inclusion in headers or reject messages.
61357 This variable is only usable in a DATA-time ACL.
61358 Beware that SpamAssassin may return non-ASCII characters, especially
61359 when running in country-specific locales, which are not legal
61360 unencoded in headers.
61361 </para>
61362 </listitem></varlistentry>
61363 <varlistentry>
61364 <term><varname>$spam_action</varname></term>
61365 <listitem>
61366 <para>
61367 For SpamAssassin either &#x2019;reject&#x2019; or &#x2019;no action&#x2019; depending on the
61368 spam score versus threshold.
61369 For Rspamd, the recommended action.
61370 </para>
61371 </listitem></varlistentry>
61372 </variablelist>
61373 <para>
61374 The <option>spam</option> condition caches its results unless expansion in
61375 spamd_address was used. If you call it again with the same user name, it
61376 does not scan again, but rather returns the same values as before.
61377 </para>
61378 <para>
61379 The <option>spam</option> condition returns DEFER if there is any error while running
61380 the message through SpamAssassin or if the expansion of spamd_address
61381 failed. If you want to treat DEFER as FAIL (to pass on to the next ACL
61382 statement block), append <literal>/defer_ok</literal> to the right-hand side of the
61383 spam condition, like this:
61384 </para>
61385 <literallayout class="monospaced">
61386 deny message = This message was classified as SPAM
61387      spam    = joe/defer_ok
61388 </literallayout>
61389 <para>
61390 This causes messages to be accepted even if there is a problem with <option>spamd</option>.
61391 </para>
61392 <para>
61393 Here is a longer, commented example of the use of the <option>spam</option>
61394 condition:
61395 </para>
61396 <literallayout class="monospaced">
61397 # put headers in all messages (no matter if spam or not)
61398 warn  spam = nobody:true
61399       add_header = X-Spam-Score: $spam_score ($spam_bar)
61400       add_header = X-Spam-Report: $spam_report
61401
61402 # add second subject line with *SPAM* marker when message
61403 # is over threshold
61404 warn  spam = nobody
61405       add_header = Subject: *SPAM* $h_Subject:
61406
61407 # reject spam at high scores (&gt; 12)
61408 deny  message = This message scored $spam_score spam points.
61409       spam = nobody:true
61410       condition = ${if &gt;{$spam_score_int}{120}{1}{0}}
61411 </literallayout>
61412 </section>
61413 <section id="SECTscanmimepart">
61414 <title>Scanning MIME parts</title>
61415 <para>
61416 <indexterm role="concept">
61417 <primary>content scanning</primary>
61418 <secondary>MIME parts</secondary>
61419 </indexterm>
61420 <indexterm role="concept">
61421 <primary>MIME content scanning</primary>
61422 </indexterm>
61423 <indexterm role="option">
61424 <primary><option>acl_smtp_mime</option></primary>
61425 </indexterm>
61426 <indexterm role="option">
61427 <primary><option>acl_not_smtp_mime</option></primary>
61428 </indexterm>
61429 The <option>acl_smtp_mime</option> global option specifies an ACL that is called once for
61430 each MIME part of an SMTP message, including multipart types, in the sequence
61431 of their position in the message. Similarly, the <option>acl_not_smtp_mime</option> option
61432 specifies an ACL that is used for the MIME parts of non-SMTP messages. These
61433 options may both refer to the same ACL if you want the same processing in both
61434 cases.
61435 </para>
61436 <para>
61437 These ACLs are called (possibly many times) just before the <option>acl_smtp_data</option>
61438 ACL in the case of an SMTP message, or just before the <option>acl_not_smtp</option> ACL in
61439 the case of a non-SMTP message. However, a MIME ACL is called only if the
61440 message contains a <emphasis>Content-Type:</emphasis> header line. When a call to a MIME
61441 ACL does not yield <quote>accept</quote>, ACL processing is aborted and the appropriate
61442 result code is sent to the client. In the case of an SMTP message, the
61443 <option>acl_smtp_data</option> ACL is not called when this happens.
61444 </para>
61445 <para>
61446 You cannot use the <option>malware</option> or <option>spam</option> conditions in a MIME ACL; these can
61447 only be used in the DATA or non-SMTP ACLs. However, you can use the <option>regex</option>
61448 condition to match against the raw MIME part. You can also use the
61449 <option>mime_regex</option> condition to match against the decoded MIME part (see section
61450 <xref linkend="SECTscanregex"/>).
61451 </para>
61452 <para>
61453 At the start of a MIME ACL, a number of variables are set from the header
61454 information for the relevant MIME part. These are described below. The contents
61455 of the MIME part are not by default decoded into a disk file except for MIME
61456 parts whose content-type is <quote>message/rfc822</quote>. If you want to decode a MIME
61457 part into a disk file, you can use the <option>decode</option> condition. The general
61458 syntax is:
61459 </para>
61460 <literallayout>
61461 <literal>decode = [/</literal>&lt;<emphasis>path</emphasis>&gt;<literal>/]</literal>&lt;<emphasis>filename</emphasis>&gt;
61462 </literallayout>
61463 <para>
61464 The right hand side is expanded before use. After expansion,
61465 the value can be:
61466 </para>
61467 <orderedlist numeration="arabic">
61468 <listitem>
61469 <para>
61470 <quote>0</quote> or <quote>false</quote>, in which case no decoding is done.
61471 </para>
61472 </listitem>
61473 <listitem>
61474 <para>
61475 The string <quote>default</quote>. In that case, the file is put in the temporary
61476 <quote>default</quote> directory &lt;<emphasis>spool_directory</emphasis>&gt;<filename>/scan/</filename>&lt;<emphasis>message_id</emphasis>&gt;<filename>/</filename> with
61477 a sequential filename consisting of the message id and a sequence number. The
61478 full path and name is available in <varname>$mime_decoded_filename</varname> after decoding.
61479 </para>
61480 </listitem>
61481 <listitem>
61482 <para>
61483 A full path name starting with a slash. If the full name is an existing
61484 directory, it is used as a replacement for the default directory. The filename
61485 is then sequentially assigned. If the path does not exist, it is used as
61486 the full path and filename.
61487 </para>
61488 </listitem>
61489 <listitem>
61490 <para>
61491 If the string does not start with a slash, it is used as the
61492 filename, and the default path is then used.
61493 </para>
61494 </listitem>
61495 </orderedlist>
61496 <para>
61497 The <option>decode</option> condition normally succeeds. It is only false for syntax
61498 errors or unusual circumstances such as memory shortages. You can easily decode
61499 a file with its original, proposed filename using
61500 </para>
61501 <literallayout class="monospaced">
61502 decode = $mime_filename
61503 </literallayout>
61504 <para>
61505 However, you should keep in mind that <varname>$mime_filename</varname> might contain
61506 anything. If you place files outside of the default path, they are not
61507 automatically unlinked.
61508 </para>
61509 <para>
61510 For RFC822 attachments (these are messages attached to messages, with a
61511 content-type of <quote>message/rfc822</quote>), the ACL is called again in the same manner
61512 as for the primary message, only that the <varname>$mime_is_rfc822</varname> expansion
61513 variable is set (see below). Attached messages are always decoded to disk
61514 before being checked, and the files are unlinked once the check is done.
61515 </para>
61516 <para>
61517 The MIME ACL supports the <option>regex</option> and <option>mime_regex</option> conditions. These can be
61518 used to match regular expressions against raw and decoded MIME parts,
61519 respectively. They are described in section <xref linkend="SECTscanregex"/>.
61520 </para>
61521 <para>
61522 <indexterm role="concept">
61523 <primary>MIME content scanning</primary>
61524 <secondary>returned variables</secondary>
61525 </indexterm>
61526 The following list describes all expansion variables that are
61527 available in the MIME ACL:
61528 </para>
61529 <variablelist>
61530 <varlistentry>
61531 <term><varname>$mime_boundary</varname></term>
61532 <listitem>
61533 <para>
61534 If the current part is a multipart (see <varname>$mime_is_multipart</varname>) below, it should
61535 have a boundary string, which is stored in this variable. If the current part
61536 has no boundary parameter in the <emphasis>Content-Type:</emphasis> header, this variable
61537 contains the empty string.
61538 </para>
61539 </listitem></varlistentry>
61540 <varlistentry>
61541 <term><varname>$mime_charset</varname></term>
61542 <listitem>
61543 <para>
61544 This variable contains the character set identifier, if one was found in the
61545 <emphasis>Content-Type:</emphasis> header. Examples for charset identifiers are:
61546 </para>
61547 <literallayout class="monospaced">
61548 us-ascii
61549 gb2312 (Chinese)
61550 iso-8859-1
61551 </literallayout>
61552 <para>
61553 Please note that this value is not normalized, so you should do matches
61554 case-insensitively.
61555 </para>
61556 </listitem></varlistentry>
61557 <varlistentry>
61558 <term><varname>$mime_content_description</varname></term>
61559 <listitem>
61560 <para>
61561 This variable contains the normalized content of the <emphasis>Content-Description:</emphasis>
61562 header. It can contain a human-readable description of the parts content. Some
61563 implementations repeat the filename for attachments here, but they are usually
61564 only used for display purposes.
61565 </para>
61566 </listitem></varlistentry>
61567 <varlistentry>
61568 <term><varname>$mime_content_disposition</varname></term>
61569 <listitem>
61570 <para>
61571 This variable contains the normalized content of the <emphasis>Content-Disposition:</emphasis>
61572 header. You can expect strings like <quote>attachment</quote> or <quote>inline</quote> here.
61573 </para>
61574 </listitem></varlistentry>
61575 <varlistentry>
61576 <term><varname>$mime_content_id</varname></term>
61577 <listitem>
61578 <para>
61579 This variable contains the normalized content of the <emphasis>Content-ID:</emphasis> header.
61580 This is a unique ID that can be used to reference a part from another part.
61581 </para>
61582 </listitem></varlistentry>
61583 <varlistentry>
61584 <term><varname>$mime_content_size</varname></term>
61585 <listitem>
61586 <para>
61587 This variable is set only after the <option>decode</option> modifier (see above) has been
61588 successfully run. It contains the size of the decoded part in kilobytes. The
61589 size is always rounded up to full kilobytes, so only a completely empty part
61590 has a <varname>$mime_content_size</varname> of zero.
61591 </para>
61592 </listitem></varlistentry>
61593 <varlistentry>
61594 <term><varname>$mime_content_transfer_encoding</varname></term>
61595 <listitem>
61596 <para>
61597 This variable contains the normalized content of the
61598 <emphasis>Content-transfer-encoding:</emphasis> header. This is a symbolic name for an encoding
61599 type. Typical values are <quote>base64</quote> and <quote>quoted-printable</quote>.
61600 </para>
61601 </listitem></varlistentry>
61602 <varlistentry>
61603 <term><varname>$mime_content_type</varname></term>
61604 <listitem>
61605 <para>
61606 If the MIME part has a <emphasis>Content-Type:</emphasis> header, this variable contains its
61607 value, lowercased, and without any options (like <quote>name</quote> or <quote>charset</quote>). Here
61608 are some examples of popular MIME types, as they may appear in this variable:
61609 </para>
61610 <literallayout class="monospaced">
61611 text/plain
61612 text/html
61613 application/octet-stream
61614 image/jpeg
61615 audio/midi
61616 </literallayout>
61617 <para>
61618 If the MIME part has no <emphasis>Content-Type:</emphasis> header, this variable contains the
61619 empty string.
61620 </para>
61621 </listitem></varlistentry>
61622 <varlistentry>
61623 <term><varname>$mime_decoded_filename</varname></term>
61624 <listitem>
61625 <para>
61626 This variable is set only after the <option>decode</option> modifier (see above) has been
61627 successfully run. It contains the full path and filename of the file
61628 containing the decoded data.
61629 </para>
61630 </listitem></varlistentry>
61631 </variablelist>
61632 <para>
61633 <indexterm role="concept">
61634 <primary>RFC 2047</primary>
61635 </indexterm>
61636 </para>
61637 <variablelist>
61638 <varlistentry>
61639 <term><varname>$mime_filename</varname></term>
61640 <listitem>
61641 <para>
61642 This is perhaps the most important of the MIME variables. It contains a
61643 proposed filename for an attachment, if one was found in either the
61644 <emphasis>Content-Type:</emphasis> or <emphasis>Content-Disposition:</emphasis> headers. The filename will be
61645 RFC2047
61646 or RFC2231
61647 decoded, but no additional sanity checks are done.
61648  If no filename was
61649 found, this variable contains the empty string.
61650 </para>
61651 </listitem></varlistentry>
61652 <varlistentry>
61653 <term><varname>$mime_is_coverletter</varname></term>
61654 <listitem>
61655 <para>
61656 This variable attempts to differentiate the <quote>cover letter</quote> of an e-mail from
61657 attached data. It can be used to clamp down on flashy or unnecessarily encoded
61658 content in the cover letter, while not restricting attachments at all.
61659 </para>
61660 <para>
61661 The variable contains 1 (true) for a MIME part believed to be part of the
61662 cover letter, and 0 (false) for an attachment. At present, the algorithm is as
61663 follows:
61664 </para>
61665 <orderedlist numeration="arabic">
61666 <listitem>
61667 <para>
61668 The outermost MIME part of a message is always a cover letter.
61669 </para>
61670 </listitem>
61671 <listitem>
61672 <para>
61673 If a multipart/alternative or multipart/related MIME part is a cover letter,
61674 so are all MIME subparts within that multipart.
61675 </para>
61676 </listitem>
61677 <listitem>
61678 <para>
61679 If any other multipart is a cover letter, the first subpart is a cover letter,
61680 and the rest are attachments.
61681 </para>
61682 </listitem>
61683 <listitem>
61684 <para>
61685 All parts contained within an attachment multipart are attachments.
61686 </para>
61687 </listitem>
61688 </orderedlist>
61689 <para>
61690 As an example, the following will ban <quote>HTML mail</quote> (including that sent with
61691 alternative plain text), while allowing HTML files to be attached. HTML
61692 coverletter mail attached to non-HTML coverletter mail will also be allowed:
61693 </para>
61694 <literallayout class="monospaced">
61695 deny message = HTML mail is not accepted here
61696 !condition = $mime_is_rfc822
61697 condition = $mime_is_coverletter
61698 condition = ${if eq{$mime_content_type}{text/html}{1}{0}}
61699 </literallayout>
61700 </listitem></varlistentry>
61701 <varlistentry>
61702 <term><varname>$mime_is_multipart</varname></term>
61703 <listitem>
61704 <para>
61705 This variable has the value 1 (true) when the current part has the main type
61706 <quote>multipart</quote>, for example, <quote>multipart/alternative</quote> or <quote>multipart/mixed</quote>.
61707 Since multipart entities only serve as containers for other parts, you may not
61708 want to carry out specific actions on them.
61709 </para>
61710 </listitem></varlistentry>
61711 <varlistentry>
61712 <term><varname>$mime_is_rfc822</varname></term>
61713 <listitem>
61714 <para>
61715 This variable has the value 1 (true) if the current part is not a part of the
61716 checked message itself, but part of an attached message. Attached message
61717 decoding is fully recursive.
61718 </para>
61719 </listitem></varlistentry>
61720 <varlistentry>
61721 <term><varname>$mime_part_count</varname></term>
61722 <listitem>
61723 <para>
61724 This variable is a counter that is raised for each processed MIME part. It
61725 starts at zero for the very first part (which is usually a multipart). The
61726 counter is per-message, so it is reset when processing RFC822 attachments (see
61727 <varname>$mime_is_rfc822</varname>). The counter stays set after <option>acl_smtp_mime</option> is
61728 complete, so you can use it in the DATA ACL to determine the number of MIME
61729 parts of a message. For non-MIME messages, this variable contains the value -1.
61730 </para>
61731 </listitem></varlistentry>
61732 </variablelist>
61733 </section>
61734 <section id="SECTscanregex">
61735 <title>Scanning with regular expressions</title>
61736 <para>
61737 <indexterm role="concept">
61738 <primary>content scanning</primary>
61739 <secondary>with regular expressions</secondary>
61740 </indexterm>
61741 <indexterm role="concept">
61742 <primary>regular expressions</primary>
61743 <secondary>content scanning with</secondary>
61744 </indexterm>
61745 You can specify your own custom regular expression matches on the full body of
61746 the message, or on individual MIME parts.
61747 </para>
61748 <para>
61749 The <option>regex</option> condition takes one or more regular expressions as arguments and
61750 matches them against the full message (when called in the DATA ACL) or a raw
61751 MIME part (when called in the MIME ACL). The <option>regex</option> condition matches
61752 linewise, with a maximum line length of 32K characters. That means you cannot
61753 have multiline matches with the <option>regex</option> condition.
61754 </para>
61755 <para>
61756 The <option>mime_regex</option> condition can be called only in the MIME ACL. It matches up
61757 to 32K of decoded content (the whole content at once, not linewise). If the
61758 part has not been decoded with the <option>decode</option> modifier earlier in the ACL, it
61759 is decoded automatically when <option>mime_regex</option> is executed (using default path
61760 and filename values). If the decoded data is larger than  32K, only the first
61761 32K characters are checked.
61762 </para>
61763 <para>
61764 The regular expressions are passed as a colon-separated list. To include a
61765 literal colon, you must double it. Since the whole right-hand side string is
61766 expanded before being used, you must also escape dollar signs and backslashes
61767 with more backslashes, or use the <literal>\N</literal> facility to disable expansion.
61768 Here is a simple example that contains two regular expressions:
61769 </para>
61770 <literallayout class="monospaced">
61771 deny message = contains blacklisted regex ($regex_match_string)
61772      regex = [Mm]ortgage : URGENT BUSINESS PROPOSAL
61773 </literallayout>
61774 <para>
61775 The conditions returns true if any one of the regular expressions matches. The
61776 <varname>$regex_match_string</varname> expansion variable is then set up and contains the
61777 matching regular expression.
61778 The expansion variables <varname>$regex1</varname> <varname>$regex2</varname> etc
61779 are set to any substrings captured by the regular expression.
61780 </para>
61781 <para>
61782 <emphasis role="bold">Warning</emphasis>: With large messages, these conditions can be fairly
61783 CPU-intensive.
61784 </para>
61785 <para>
61786 <indexterm role="concept" startref="IIDcosca" class="endofrange"/>
61787 </para>
61788 </section>
61789 </chapter>
61790
61791 <chapter id="CHAPlocalscan">
61792 <title>Adding a local scan function to Exim</title>
61793 <titleabbrev>Local scan function</titleabbrev>
61794 <para>
61795 <indexterm role="concept" id="IIDlosca" class="startofrange">
61796 <primary><function>local_scan()</function> function</primary>
61797 <secondary>description of</secondary>
61798 </indexterm>
61799 <indexterm role="concept">
61800 <primary>customizing</primary>
61801 <secondary>input scan using C function</secondary>
61802 </indexterm>
61803 <indexterm role="concept">
61804 <primary>policy control</primary>
61805 <secondary>by local scan function</secondary>
61806 </indexterm>
61807 In these days of email worms, viruses, and ever-increasing spam, some sites
61808 want to apply a lot of checking to messages before accepting them.
61809 </para>
61810 <para>
61811 The content scanning extension (chapter <xref linkend="CHAPexiscan"/>) has facilities for
61812 passing messages to external virus and spam scanning software. You can also do
61813 a certain amount in Exim itself through string expansions and the <option>condition</option>
61814 condition in the ACL that runs after the SMTP DATA command or the ACL for
61815 non-SMTP messages (see chapter <xref linkend="CHAPACL"/>), but this has its limitations.
61816 </para>
61817 <para>
61818 To allow for further customization to a site&#x2019;s own requirements, there is the
61819 possibility of linking Exim with a private message scanning function, written
61820 in C. If you want to run code that is written in something other than C, you
61821 can of course use a little C stub to call it.
61822 </para>
61823 <para>
61824 The local scan function is run once for every incoming message, at the point
61825 when Exim is just about to accept the message.
61826 It can therefore be used to control non-SMTP messages from local processes as
61827 well as messages arriving via SMTP.
61828 </para>
61829 <para>
61830 Exim applies a timeout to calls of the local scan function, and there is an
61831 option called <option>local_scan_timeout</option> for setting it. The default is 5 minutes.
61832 Zero means <quote>no timeout</quote>.
61833 Exim also sets up signal handlers for SIGSEGV, SIGILL, SIGFPE, and SIGBUS
61834 before calling the local scan function, so that the most common types of crash
61835 are caught. If the timeout is exceeded or one of those signals is caught, the
61836 incoming message is rejected with a temporary error if it is an SMTP message.
61837 For a non-SMTP message, the message is dropped and Exim ends with a non-zero
61838 code. The incident is logged on the main and reject logs.
61839 </para>
61840 <section id="SECID207">
61841 <title>Building Exim to use a local scan function</title>
61842 <para>
61843 <indexterm role="concept">
61844 <primary><function>local_scan()</function> function</primary>
61845 <secondary>building Exim to use</secondary>
61846 </indexterm>
61847 To make use of the local scan function feature, you must tell Exim where your
61848 function is before building Exim, by setting
61849 </para>
61850 <para revisionflag="changed">
61851 both HAVE_LOCAL_SCAN and
61852 </para>
61853 <para>
61854 LOCAL_SCAN_SOURCE in your
61855 <filename>Local/Makefile</filename>. A recommended place to put it is in the <filename>Local</filename>
61856 directory, so you might set
61857 </para>
61858 <literallayout class="monospaced">
61859 HAVE_LOCAL_SCAN=yes
61860 LOCAL_SCAN_SOURCE=Local/local_scan.c
61861 </literallayout>
61862 <para>
61863 for example. The function must be called <function>local_scan()</function>. It is called by
61864 Exim after it has received a message, when the success return code is about to
61865 be sent. This is after all the ACLs have been run. The return code from your
61866 function controls whether the message is actually accepted or not. There is a
61867 commented template function (that just accepts the message) in the file
61868 _src/local_scan.c_.
61869 </para>
61870 <para>
61871 If you want to make use of Exim&#x2019;s runtime configuration file to set options
61872 for your <function>local_scan()</function> function, you must also set
61873 </para>
61874 <literallayout class="monospaced">
61875 LOCAL_SCAN_HAS_OPTIONS=yes
61876 </literallayout>
61877 <para>
61878 in <filename>Local/Makefile</filename> (see section <xref linkend="SECTconoptloc"/> below).
61879 </para>
61880 </section>
61881 <section id="SECTapiforloc">
61882 <title>API for local_scan()</title>
61883 <para>
61884 <indexterm role="concept">
61885 <primary><function>local_scan()</function> function</primary>
61886 <secondary>API description</secondary>
61887 </indexterm>
61888 <indexterm role="concept">
61889 <primary><option>dlfunc</option></primary>
61890 <secondary>API description</secondary>
61891 </indexterm>
61892 You must include this line near the start of your code:
61893 </para>
61894 <literallayout class="monospaced">
61895 #include "local_scan.h"
61896 </literallayout>
61897 <para>
61898 This header file defines a number of variables and other values, and the
61899 prototype for the function itself. Exim is coded to use unsigned char values
61900 almost exclusively, and one of the things this header defines is a shorthand
61901 for <literal>unsigned char</literal> called <literal>uschar</literal>.
61902 It also contains the following macro definitions, to simplify casting character
61903 strings and pointers to character strings:
61904 </para>
61905 <literallayout class="monospaced">
61906 #define CS   (char *)
61907 #define CCS  (const char *)
61908 #define CSS  (char **)
61909 #define US   (unsigned char *)
61910 #define CUS  (const unsigned char *)
61911 #define USS  (unsigned char **)
61912 </literallayout>
61913 <para>
61914 The function prototype for <function>local_scan()</function> is:
61915 </para>
61916 <literallayout class="monospaced">
61917 extern int local_scan(int fd, uschar **return_text);
61918 </literallayout>
61919 <para>
61920 The arguments are as follows:
61921 </para>
61922 <itemizedlist>
61923 <listitem>
61924 <para>
61925 <option>fd</option> is a file descriptor for the file that contains the body of the message
61926 (the -D file). The file is open for reading and writing, but updating it is not
61927 recommended. <emphasis role="bold">Warning</emphasis>: You must <emphasis>not</emphasis> close this file descriptor.
61928 </para>
61929 <para>
61930 The descriptor is positioned at character 19 of the file, which is the first
61931 character of the body itself, because the first 19 characters are the message
61932 id followed by <literal>-D</literal> and a newline. If you rewind the file, you should use the
61933 macro SPOOL_DATA_START_OFFSET to reset to the start of the data, just in
61934 case this changes in some future version.
61935 </para>
61936 </listitem>
61937 <listitem>
61938 <para>
61939 <option>return_text</option> is an address which you can use to return a pointer to a text
61940 string at the end of the function. The value it points to on entry is NULL.
61941 </para>
61942 </listitem>
61943 </itemizedlist>
61944 <para>
61945 The function must return an <option>int</option> value which is one of the following macros:
61946 </para>
61947 <variablelist>
61948 <varlistentry>
61949 <term><literal>LOCAL_SCAN_ACCEPT</literal></term>
61950 <listitem>
61951 <para>
61952 <indexterm role="variable">
61953 <primary><varname>$local_scan_data</varname></primary>
61954 </indexterm>
61955 The message is accepted. If you pass back a string of text, it is saved with
61956 the message, and made available in the variable <varname>$local_scan_data</varname>. No
61957 newlines are permitted (if there are any, they are turned into spaces) and the
61958 maximum length of text is 1000 characters.
61959 </para>
61960 </listitem></varlistentry>
61961 <varlistentry>
61962 <term><literal>LOCAL_SCAN_ACCEPT_FREEZE</literal></term>
61963 <listitem>
61964 <para>
61965 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
61966 queued without immediate delivery, and is frozen.
61967 </para>
61968 </listitem></varlistentry>
61969 <varlistentry>
61970 <term><literal>LOCAL_SCAN_ACCEPT_QUEUE</literal></term>
61971 <listitem>
61972 <para>
61973 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
61974 queued without immediate delivery.
61975 </para>
61976 </listitem></varlistentry>
61977 <varlistentry>
61978 <term><literal>LOCAL_SCAN_REJECT</literal></term>
61979 <listitem>
61980 <para>
61981 The message is rejected; the returned text is used as an error message which is
61982 passed back to the sender and which is also logged. Newlines are permitted &ndash;
61983 they cause a multiline response for SMTP rejections, but are converted to
61984 <literal>\n</literal> in log lines. If no message is given, <quote>Administrative prohibition</quote> is
61985 used.
61986 </para>
61987 </listitem></varlistentry>
61988 <varlistentry>
61989 <term><literal>LOCAL_SCAN_TEMPREJECT</literal></term>
61990 <listitem>
61991 <para>
61992 The message is temporarily rejected; the returned text is used as an error
61993 message as for LOCAL_SCAN_REJECT. If no message is given, <quote>Temporary local
61994 problem</quote> is used.
61995 </para>
61996 </listitem></varlistentry>
61997 <varlistentry>
61998 <term><literal>LOCAL_SCAN_REJECT_NOLOGHDR</literal></term>
61999 <listitem>
62000 <para>
62001 This behaves as LOCAL_SCAN_REJECT, except that the header of the rejected
62002 message is not written to the reject log. It has the effect of unsetting the
62003 <option>rejected_header</option> log selector for just this rejection. If
62004 <option>rejected_header</option> is already unset (see the discussion of the
62005 <option>log_selection</option> option in section <xref linkend="SECTlogselector"/>), this code is the
62006 same as LOCAL_SCAN_REJECT.
62007 </para>
62008 </listitem></varlistentry>
62009 <varlistentry>
62010 <term><literal>LOCAL_SCAN_TEMPREJECT_NOLOGHDR</literal></term>
62011 <listitem>
62012 <para>
62013 This code is a variation of LOCAL_SCAN_TEMPREJECT in the same way that
62014 LOCAL_SCAN_REJECT_NOLOGHDR is a variation of LOCAL_SCAN_REJECT.
62015 </para>
62016 </listitem></varlistentry>
62017 </variablelist>
62018 <para>
62019 If the message is not being received by interactive SMTP, rejections are
62020 reported by writing to <option>stderr</option> or by sending an email, as configured by the
62021 <option>-oe</option> command line options.
62022 </para>
62023 </section>
62024 <section id="SECTconoptloc">
62025 <title>Configuration options for local_scan()</title>
62026 <para>
62027 <indexterm role="concept">
62028 <primary><function>local_scan()</function> function</primary>
62029 <secondary>configuration options</secondary>
62030 </indexterm>
62031 It is possible to have option settings in the main configuration file
62032 that set values in static variables in the <function>local_scan()</function> module. If you
62033 want to do this, you must have the line
62034 </para>
62035 <literallayout class="monospaced">
62036 LOCAL_SCAN_HAS_OPTIONS=yes
62037 </literallayout>
62038 <para>
62039 in your <filename>Local/Makefile</filename> when you build Exim. (This line is in
62040 <filename>OS/Makefile-Default</filename>, commented out). Then, in the <function>local_scan()</function> source
62041 file, you must define static variables to hold the option values, and a table
62042 to define them.
62043 </para>
62044 <para>
62045 The table must be a vector called <option>local_scan_options</option>, of type
62046 <literal>optionlist</literal>. Each entry is a triplet, consisting of a name, an option type,
62047 and a pointer to the variable that holds the value. The entries must appear in
62048 alphabetical order. Following <option>local_scan_options</option> you must also define a
62049 variable called <option>local_scan_options_count</option> that contains the number of
62050 entries in the table. Here is a short example, showing two kinds of option:
62051 </para>
62052 <literallayout class="monospaced">
62053 static int my_integer_option = 42;
62054 static uschar *my_string_option = US"a default string";
62055
62056 optionlist local_scan_options[] = {
62057   { "my_integer", opt_int,       &amp;my_integer_option },
62058   { "my_string",  opt_stringptr, &amp;my_string_option }
62059 };
62060
62061 int local_scan_options_count =
62062   sizeof(local_scan_options)/sizeof(optionlist);
62063 </literallayout>
62064 <para>
62065 The values of the variables can now be changed from Exim&#x2019;s runtime
62066 configuration file by including a local scan section as in this example:
62067 </para>
62068 <literallayout class="monospaced">
62069 begin local_scan
62070 my_integer = 99
62071 my_string = some string of text...
62072 </literallayout>
62073 <para>
62074 The available types of option data are as follows:
62075 </para>
62076 <variablelist>
62077 <varlistentry>
62078 <term><emphasis role="bold">opt_bool</emphasis></term>
62079 <listitem>
62080 <para>
62081 This specifies a boolean (true/false) option. The address should point to a
62082 variable of type <literal>BOOL</literal>, which will be set to TRUE or FALSE, which are macros
62083 that are defined as <quote>1</quote> and <quote>0</quote>, respectively. If you want to detect
62084 whether such a variable has been set at all, you can initialize it to
62085 TRUE_UNSET. (BOOL variables are integers underneath, so can hold more than two
62086 values.)
62087 </para>
62088 </listitem></varlistentry>
62089 <varlistentry>
62090 <term><emphasis role="bold">opt_fixed</emphasis></term>
62091 <listitem>
62092 <para>
62093 This specifies a fixed point number, such as is used for load averages.
62094 The address should point to a variable of type <literal>int</literal>. The value is stored
62095 multiplied by 1000, so, for example, 1.4142 is truncated and stored as 1414.
62096 </para>
62097 </listitem></varlistentry>
62098 <varlistentry>
62099 <term><emphasis role="bold">opt_int</emphasis></term>
62100 <listitem>
62101 <para>
62102 This specifies an integer; the address should point to a variable of type
62103 <literal>int</literal>. The value may be specified in any of the integer formats accepted by
62104 Exim.
62105 </para>
62106 </listitem></varlistentry>
62107 <varlistentry>
62108 <term><emphasis role="bold">opt_mkint</emphasis></term>
62109 <listitem>
62110 <para>
62111 This is the same as <option>opt_int</option>, except that when such a value is output in a
62112 <option>-bP</option> listing, if it is an exact number of kilobytes or megabytes, it is
62113 printed with the suffix K or M.
62114 </para>
62115 </listitem></varlistentry>
62116 <varlistentry>
62117 <term><emphasis role="bold">opt_octint</emphasis></term>
62118 <listitem>
62119 <para>
62120 This also specifies an integer, but the value is always interpreted as an
62121 octal integer, whether or not it starts with the digit zero, and it is
62122 always output in octal.
62123 </para>
62124 </listitem></varlistentry>
62125 <varlistentry>
62126 <term><emphasis role="bold">opt_stringptr</emphasis></term>
62127 <listitem>
62128 <para>
62129 This specifies a string value; the address must be a pointer to a
62130 variable that points to a string (for example, of type <literal>uschar *</literal>).
62131 </para>
62132 </listitem></varlistentry>
62133 <varlistentry>
62134 <term><emphasis role="bold">opt_time</emphasis></term>
62135 <listitem>
62136 <para>
62137 This specifies a time interval value. The address must point to a variable of
62138 type <literal>int</literal>. The value that is placed there is a number of seconds.
62139 </para>
62140 </listitem></varlistentry>
62141 </variablelist>
62142 <para>
62143 If the <option>-bP</option> command line option is followed by <literal>local_scan</literal>, Exim prints
62144 out the values of all the <function>local_scan()</function> options.
62145 </para>
62146 </section>
62147 <section id="SECID208">
62148 <title>Available Exim variables</title>
62149 <para>
62150 <indexterm role="concept">
62151 <primary><function>local_scan()</function> function</primary>
62152 <secondary>available Exim variables</secondary>
62153 </indexterm>
62154 The header <filename>local_scan.h</filename> gives you access to a number of C variables. These
62155 are the only ones that are guaranteed to be maintained from release to release.
62156 Note, however, that you can obtain the value of any Exim expansion variable,
62157 including <varname>$recipients</varname>, by calling <emphasis>expand_string()</emphasis>. The exported
62158 C variables are as follows:
62159 </para>
62160 <variablelist>
62161 <varlistentry>
62162 <term><emphasis role="bold">int&nbsp;body_linecount</emphasis></term>
62163 <listitem>
62164 <para>
62165 This variable contains the number of lines in the message&#x2019;s body.
62166 It is not valid if the <option>spool_files_wireformat</option> option is used.
62167 </para>
62168 </listitem></varlistentry>
62169 <varlistentry>
62170 <term><emphasis role="bold">int&nbsp;body_zerocount</emphasis></term>
62171 <listitem>
62172 <para>
62173 This variable contains the number of binary zero bytes in the message&#x2019;s body.
62174 It is not valid if the <option>spool_files_wireformat</option> option is used.
62175 </para>
62176 </listitem></varlistentry>
62177 <varlistentry>
62178 <term><emphasis role="bold">unsigned&nbsp;int&nbsp;debug_selector</emphasis></term>
62179 <listitem>
62180 <para>
62181 This variable is set to zero when no debugging is taking place. Otherwise, it
62182 is a bitmap of debugging selectors. Two bits are identified for use in
62183 <function>local_scan()</function>; they are defined as macros:
62184 </para>
62185 <itemizedlist>
62186 <listitem>
62187 <para>
62188 The <literal>D_v</literal> bit is set when <option>-v</option> was present on the command line. This is a
62189 testing option that is not privileged &ndash; any caller may set it. All the
62190 other selector bits can be set only by admin users.
62191 </para>
62192 </listitem>
62193 <listitem>
62194 <para>
62195 The <literal>D_local_scan</literal> bit is provided for use by <function>local_scan()</function>; it is set
62196 by the <literal>+local_scan</literal> debug selector. It is not included in the default set
62197 of debugging bits.
62198 </para>
62199 </listitem>
62200 </itemizedlist>
62201 <para>
62202 Thus, to write to the debugging output only when <literal>+local_scan</literal> has been
62203 selected, you should use code like this:
62204 </para>
62205 <literallayout class="monospaced">
62206 if ((debug_selector &amp; D_local_scan) != 0)
62207   debug_printf("xxx", ...);
62208 </literallayout>
62209 </listitem></varlistentry>
62210 <varlistentry>
62211 <term><emphasis role="bold">uschar&nbsp;*expand_string_message</emphasis></term>
62212 <listitem>
62213 <para>
62214 After a failing call to <emphasis>expand_string()</emphasis> (returned value NULL), the
62215 variable <option>expand_string_message</option> contains the error message, zero-terminated.
62216 </para>
62217 </listitem></varlistentry>
62218 <varlistentry>
62219 <term><emphasis role="bold">header_line&nbsp;*header_list</emphasis></term>
62220 <listitem>
62221 <para>
62222 A pointer to a chain of header lines. The <option>header_line</option> structure is
62223 discussed below.
62224 </para>
62225 </listitem></varlistentry>
62226 <varlistentry>
62227 <term><emphasis role="bold">header_line&nbsp;*header_last</emphasis></term>
62228 <listitem>
62229 <para>
62230 A pointer to the last of the header lines.
62231 </para>
62232 </listitem></varlistentry>
62233 <varlistentry>
62234 <term><emphasis role="bold">uschar&nbsp;*headers_charset</emphasis></term>
62235 <listitem>
62236 <para>
62237 The value of the <option>headers_charset</option> configuration option.
62238 </para>
62239 </listitem></varlistentry>
62240 <varlistentry>
62241 <term><emphasis role="bold">BOOL&nbsp;host_checking</emphasis></term>
62242 <listitem>
62243 <para>
62244 This variable is TRUE during a host checking session that is initiated by the
62245 <option>-bh</option> command line option.
62246 </para>
62247 </listitem></varlistentry>
62248 <varlistentry>
62249 <term><emphasis role="bold">uschar&nbsp;*interface_address</emphasis></term>
62250 <listitem>
62251 <para>
62252 The IP address of the interface that received the message, as a string. This
62253 is NULL for locally submitted messages.
62254 </para>
62255 </listitem></varlistentry>
62256 <varlistentry>
62257 <term><emphasis role="bold">int&nbsp;interface_port</emphasis></term>
62258 <listitem>
62259 <para>
62260 The port on which this message was received. When testing with the <option>-bh</option>
62261 command line option, the value of this variable is -1 unless a port has been
62262 specified via the <option>-oMi</option> option.
62263 </para>
62264 </listitem></varlistentry>
62265 <varlistentry>
62266 <term><emphasis role="bold">uschar&nbsp;*message_id</emphasis></term>
62267 <listitem>
62268 <para>
62269 This variable contains Exim&#x2019;s message id for the incoming message (the value of
62270 <varname>$message_exim_id</varname>) as a zero-terminated string.
62271 </para>
62272 </listitem></varlistentry>
62273 <varlistentry>
62274 <term><emphasis role="bold">uschar&nbsp;*received_protocol</emphasis></term>
62275 <listitem>
62276 <para>
62277 The name of the protocol by which the message was received.
62278 </para>
62279 </listitem></varlistentry>
62280 <varlistentry>
62281 <term><emphasis role="bold">int&nbsp;recipients_count</emphasis></term>
62282 <listitem>
62283 <para>
62284 The number of accepted recipients.
62285 </para>
62286 </listitem></varlistentry>
62287 <varlistentry>
62288 <term><emphasis role="bold">recipient_item&nbsp;*recipients_list</emphasis></term>
62289 <listitem>
62290 <para>
62291 <indexterm role="concept">
62292 <primary>recipient</primary>
62293 <secondary>adding in local scan</secondary>
62294 </indexterm>
62295 <indexterm role="concept">
62296 <primary>recipient</primary>
62297 <secondary>removing in local scan</secondary>
62298 </indexterm>
62299 The list of accepted recipients, held in a vector of length
62300 <option>recipients_count</option>. The <option>recipient_item</option> structure is discussed below. You
62301 can add additional recipients by calling <emphasis>receive_add_recipient()</emphasis> (see
62302 below). You can delete recipients by removing them from the vector and
62303 adjusting the value in <option>recipients_count</option>. In particular, by setting
62304 <option>recipients_count</option> to zero you remove all recipients. If you then return the
62305 value <literal>LOCAL_SCAN_ACCEPT</literal>, the message is accepted, but immediately
62306 blackholed. To replace the recipients, you can set <option>recipients_count</option> to zero
62307 and then call <emphasis>receive_add_recipient()</emphasis> as often as needed.
62308 </para>
62309 </listitem></varlistentry>
62310 <varlistentry>
62311 <term><emphasis role="bold">uschar&nbsp;*sender_address</emphasis></term>
62312 <listitem>
62313 <para>
62314 The envelope sender address. For bounce messages this is the empty string.
62315 </para>
62316 </listitem></varlistentry>
62317 <varlistentry>
62318 <term><emphasis role="bold">uschar&nbsp;*sender_host_address</emphasis></term>
62319 <listitem>
62320 <para>
62321 The IP address of the sending host, as a string. This is NULL for
62322 locally-submitted messages.
62323 </para>
62324 </listitem></varlistentry>
62325 <varlistentry>
62326 <term><emphasis role="bold">uschar&nbsp;*sender_host_authenticated</emphasis></term>
62327 <listitem>
62328 <para>
62329 The name of the authentication mechanism that was used, or NULL if the message
62330 was not received over an authenticated SMTP connection.
62331 </para>
62332 </listitem></varlistentry>
62333 <varlistentry>
62334 <term><emphasis role="bold">uschar&nbsp;*sender_host_name</emphasis></term>
62335 <listitem>
62336 <para>
62337 The name of the sending host, if known.
62338 </para>
62339 </listitem></varlistentry>
62340 <varlistentry>
62341 <term><emphasis role="bold">int&nbsp;sender_host_port</emphasis></term>
62342 <listitem>
62343 <para>
62344 The port on the sending host.
62345 </para>
62346 </listitem></varlistentry>
62347 <varlistentry>
62348 <term><emphasis role="bold">BOOL&nbsp;smtp_input</emphasis></term>
62349 <listitem>
62350 <para>
62351 This variable is TRUE for all SMTP input, including BSMTP.
62352 </para>
62353 </listitem></varlistentry>
62354 <varlistentry>
62355 <term><emphasis role="bold">BOOL&nbsp;smtp_batched_input</emphasis></term>
62356 <listitem>
62357 <para>
62358 This variable is TRUE for BSMTP input.
62359 </para>
62360 </listitem></varlistentry>
62361 <varlistentry>
62362 <term><emphasis role="bold">int&nbsp;store_pool</emphasis></term>
62363 <listitem>
62364 <para>
62365 The contents of this variable control which pool of memory is used for new
62366 requests. See section <xref linkend="SECTmemhanloc"/> for details.
62367 </para>
62368 </listitem></varlistentry>
62369 </variablelist>
62370 </section>
62371 <section id="SECID209">
62372 <title>Structure of header lines</title>
62373 <para>
62374 The <option>header_line</option> structure contains the members listed below.
62375 You can add additional header lines by calling the <emphasis>header_add()</emphasis> function
62376 (see below). You can cause header lines to be ignored (deleted) by setting
62377 their type to *.
62378 </para>
62379 <variablelist>
62380 <varlistentry>
62381 <term><emphasis role="bold">struct&nbsp;header_line&nbsp;*next</emphasis></term>
62382 <listitem>
62383 <para>
62384 A pointer to the next header line, or NULL for the last line.
62385 </para>
62386 </listitem></varlistentry>
62387 <varlistentry>
62388 <term><emphasis role="bold">int&nbsp;type</emphasis></term>
62389 <listitem>
62390 <para>
62391 A code identifying certain headers that Exim recognizes. The codes are printing
62392 characters, and are documented in chapter <xref linkend="CHAPspool"/> of this manual.
62393 Notice in particular that any header line whose type is * is not transmitted
62394 with the message. This flagging is used for header lines that have been
62395 rewritten, or are to be removed (for example, <emphasis>Envelope-sender:</emphasis> header
62396 lines.) Effectively, * means <quote>deleted</quote>.
62397 </para>
62398 </listitem></varlistentry>
62399 <varlistentry>
62400 <term><emphasis role="bold">int&nbsp;slen</emphasis></term>
62401 <listitem>
62402 <para>
62403 The number of characters in the header line, including the terminating and any
62404 internal newlines.
62405 </para>
62406 </listitem></varlistentry>
62407 <varlistentry>
62408 <term><emphasis role="bold">uschar&nbsp;*text</emphasis></term>
62409 <listitem>
62410 <para>
62411 A pointer to the text of the header. It always ends with a newline, followed by
62412 a zero byte. Internal newlines are preserved.
62413 </para>
62414 </listitem></varlistentry>
62415 </variablelist>
62416 </section>
62417 <section id="SECID210">
62418 <title>Structure of recipient items</title>
62419 <para>
62420 The <option>recipient_item</option> structure contains these members:
62421 </para>
62422 <variablelist>
62423 <varlistentry>
62424 <term><emphasis role="bold">uschar&nbsp;*address</emphasis></term>
62425 <listitem>
62426 <para>
62427 This is a pointer to the recipient address as it was received.
62428 </para>
62429 </listitem></varlistentry>
62430 <varlistentry>
62431 <term><emphasis role="bold">int&nbsp;pno</emphasis></term>
62432 <listitem>
62433 <para>
62434 This is used in later Exim processing when top level addresses are created by
62435 the <option>one_time</option> option. It is not relevant at the time <function>local_scan()</function> is run
62436 and must always contain -1 at this stage.
62437 </para>
62438 </listitem></varlistentry>
62439 <varlistentry>
62440 <term><emphasis role="bold">uschar&nbsp;*errors_to</emphasis></term>
62441 <listitem>
62442 <para>
62443 If this value is not NULL, bounce messages caused by failing to deliver to the
62444 recipient are sent to the address it contains. In other words, it overrides the
62445 envelope sender for this one recipient. (Compare the <option>errors_to</option> generic
62446 router option.) If a <function>local_scan()</function> function sets an <option>errors_to</option> field to
62447 an unqualified address, Exim qualifies it using the domain from
62448 <option>qualify_recipient</option>. When <function>local_scan()</function> is called, the <option>errors_to</option> field
62449 is NULL for all recipients.
62450 </para>
62451 </listitem></varlistentry>
62452 </variablelist>
62453 </section>
62454 <section id="SECID211">
62455 <title>Available Exim functions</title>
62456 <para>
62457 <indexterm role="concept">
62458 <primary><function>local_scan()</function> function</primary>
62459 <secondary>available Exim functions</secondary>
62460 </indexterm>
62461 The header <filename>local_scan.h</filename> gives you access to a number of Exim functions.
62462 These are the only ones that are guaranteed to be maintained from release to
62463 release:
62464 </para>
62465 <variablelist>
62466 <varlistentry>
62467 <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>
62468 <listitem>
62469 <para>
62470 This function creates a child process that runs the command specified by
62471 <option>argv</option>. The environment for the process is specified by <option>envp</option>, which can
62472 be NULL if no environment variables are to be passed. A new umask is supplied
62473 for the process in <option>newumask</option>.
62474 </para>
62475 <para>
62476 Pipes to the standard input and output of the new process are set up
62477 and returned to the caller via the <option>infdptr</option> and <option>outfdptr</option> arguments. The
62478 standard error is cloned to the standard output. If there are any file
62479 descriptors <quote>in the way</quote> in the new process, they are closed. If the final
62480 argument is TRUE, the new process is made into a process group leader.
62481 </para>
62482 <para>
62483 The function returns the pid of the new process, or -1 if things go wrong.
62484 </para>
62485 </listitem></varlistentry>
62486 <varlistentry>
62487 <term><emphasis role="bold">int&nbsp;child_close(pid_t&nbsp;pid,&nbsp;int&nbsp;timeout)</emphasis></term>
62488 <listitem>
62489 <para>
62490 This function waits for a child process to terminate, or for a timeout (in
62491 seconds) to expire. A timeout value of zero means wait as long as it takes. The
62492 return value is as follows:
62493 </para>
62494 <itemizedlist>
62495 <listitem>
62496 <para>
62497 &gt;= 0
62498 </para>
62499 <para>
62500 The process terminated by a normal exit and the value is the process
62501 ending status.
62502 </para>
62503 </listitem>
62504 <listitem>
62505 <para>
62506 &lt; 0 and &gt; &ndash;256
62507 </para>
62508 <para>
62509 The process was terminated by a signal and the value is the negation of the
62510 signal number.
62511 </para>
62512 </listitem>
62513 <listitem>
62514 <para>
62515 &ndash;256
62516 </para>
62517 <para>
62518 The process timed out.
62519 </para>
62520 </listitem>
62521 <listitem>
62522 <para>
62523 &ndash;257
62524 </para>
62525 <para>
62526 The was some other error in wait(); <option>errno</option> is still set.
62527 </para>
62528 </listitem>
62529 </itemizedlist>
62530 </listitem></varlistentry>
62531 <varlistentry>
62532 <term><emphasis role="bold">pid_t&nbsp;child_open_exim(int&nbsp;*fd)</emphasis></term>
62533 <listitem>
62534 <para>
62535 This function provide you with a means of submitting a new message to
62536 Exim. (Of course, you can also call <filename>/usr/sbin/sendmail</filename> yourself if you
62537 want, but this packages it all up for you.) The function creates a pipe,
62538 forks a subprocess that is running
62539 </para>
62540 <literallayout class="monospaced">
62541 exim -t -oem -oi -f &lt;&gt;
62542 </literallayout>
62543 <para>
62544 and returns to you (via the <literal>int *</literal> argument) a file descriptor for the pipe
62545 that is connected to the standard input. The yield of the function is the PID
62546 of the subprocess. You can then write a message to the file descriptor, with
62547 recipients in <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and/or <emphasis>Bcc:</emphasis> header lines.
62548 </para>
62549 <para>
62550 When you have finished, call <emphasis>child_close()</emphasis> to wait for the process to
62551 finish and to collect its ending status. A timeout value of zero is usually
62552 fine in this circumstance. Unless you have made a mistake with the recipient
62553 addresses, you should get a return code of zero.
62554 </para>
62555 </listitem></varlistentry>
62556 <varlistentry>
62557 <term><emphasis role="bold">pid_t&nbsp;child_open_exim2(int&nbsp;*fd,&nbsp;uschar&nbsp;*sender,&nbsp;uschar&nbsp;*sender_authentication)</emphasis></term>
62558 <listitem>
62559 <para>
62560 This function is a more sophisticated version of <emphasis>child_open()</emphasis>. The command
62561 that it runs is:
62562 </para>
62563 <literallayout>
62564 <literal>exim -t -oem -oi -f </literal><emphasis>sender</emphasis><literal> -oMas </literal><emphasis>sender_authentication</emphasis>
62565 </literallayout>
62566 <para>
62567 The third argument may be NULL, in which case the <option>-oMas</option> option is omitted.
62568 </para>
62569 </listitem></varlistentry>
62570 <varlistentry>
62571 <term><emphasis role="bold">void&nbsp;debug_printf(char&nbsp;*,&nbsp;...)</emphasis></term>
62572 <listitem>
62573 <para>
62574 This is Exim&#x2019;s debugging function, with arguments as for <emphasis>(printf()</emphasis>. The
62575 output is written to the standard error stream. If no debugging is selected,
62576 calls to <emphasis>debug_printf()</emphasis> have no effect. Normally, you should make calls
62577 conditional on the <literal>local_scan</literal> debug selector by coding like this:
62578 </para>
62579 <literallayout class="monospaced">
62580 if ((debug_selector &amp; D_local_scan) != 0)
62581   debug_printf("xxx", ...);
62582 </literallayout>
62583 </listitem></varlistentry>
62584 <varlistentry>
62585 <term><emphasis role="bold">uschar&nbsp;*expand_string(uschar&nbsp;*string)</emphasis></term>
62586 <listitem>
62587 <para>
62588 This is an interface to Exim&#x2019;s string expansion code. The return value is the
62589 expanded string, or NULL if there was an expansion failure.
62590 The C variable <option>expand_string_message</option> contains an error message after an
62591 expansion failure. If expansion does not change the string, the return value is
62592 the pointer to the input string. Otherwise, the return value points to a new
62593 block of memory that was obtained by a call to <emphasis>store_get()</emphasis>. See section
62594 <xref linkend="SECTmemhanloc"/> below for a discussion of memory handling.
62595 </para>
62596 </listitem></varlistentry>
62597 <varlistentry>
62598 <term><emphasis role="bold">void&nbsp;header_add(int&nbsp;type,&nbsp;char&nbsp;*format,&nbsp;...)</emphasis></term>
62599 <listitem>
62600 <para>
62601 This function allows you to an add additional header line at the end of the
62602 existing ones. The first argument is the type, and should normally be a space
62603 character. The second argument is a format string and any number of
62604 substitution arguments as for <function>sprintf()</function>. You may include internal newlines
62605 if you want, and you must ensure that the string ends with a newline.
62606 </para>
62607 </listitem></varlistentry>
62608 <varlistentry>
62609 <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>
62610 <listitem>
62611 <para>
62612 This function adds a new header line at a specified point in the header
62613 chain. The header itself is specified as for <emphasis>header_add()</emphasis>.
62614 </para>
62615 <para>
62616 If <option>name</option> is NULL, the new header is added at the end of the chain if
62617 <option>after</option> is true, or at the start if <option>after</option> is false. If <option>name</option> is not
62618 NULL, the header lines are searched for the first non-deleted header that
62619 matches the name. If one is found, the new header is added before it if
62620 <option>after</option> is false. If <option>after</option> is true, the new header is added after the
62621 found header and any adjacent subsequent ones with the same name (even if
62622 marked <quote>deleted</quote>). If no matching non-deleted header is found, the <option>topnot</option>
62623 option controls where the header is added. If it is true, addition is at the
62624 top; otherwise at the bottom. Thus, to add a header after all the <emphasis>Received:</emphasis>
62625 headers, or at the top if there are no <emphasis>Received:</emphasis> headers, you could use
62626 </para>
62627 <literallayout class="monospaced">
62628 header_add_at_position(TRUE, US"Received", TRUE,
62629   ' ', "X-xxx: ...");
62630 </literallayout>
62631 <para>
62632 Normally, there is always at least one non-deleted <emphasis>Received:</emphasis> header, but
62633 there may not be if <option>received_header_text</option> expands to an empty string.
62634 </para>
62635 </listitem></varlistentry>
62636 <varlistentry>
62637 <term><emphasis role="bold">void&nbsp;header_remove(int&nbsp;occurrence,&nbsp;uschar&nbsp;*name)</emphasis></term>
62638 <listitem>
62639 <para>
62640 This function removes header lines. If <option>occurrence</option> is zero or negative, all
62641 occurrences of the header are removed. If occurrence is greater than zero, that
62642 particular instance of the header is removed. If no header(s) can be found that
62643 match the specification, the function does nothing.
62644 </para>
62645 </listitem></varlistentry>
62646 <varlistentry>
62647 <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>
62648 <listitem>
62649 <para>
62650 This function tests whether the given header has the given name. It is not just
62651 a string comparison, because white space is permitted between the name and the
62652 colon. If the <option>notdel</option> argument is true, a false return is forced for all
62653 <quote>deleted</quote> headers; otherwise they are not treated specially. For example:
62654 </para>
62655 <literallayout class="monospaced">
62656 if (header_testname(h, US"X-Spam", 6, TRUE)) ...
62657 </literallayout>
62658 </listitem></varlistentry>
62659 <varlistentry>
62660 <term><emphasis role="bold">uschar&nbsp;*lss_b64encode(uschar&nbsp;*cleartext,&nbsp;int&nbsp;length)</emphasis></term>
62661 <listitem>
62662 <para>
62663 <indexterm role="concept">
62664 <primary>base64 encoding</primary>
62665 <secondary>functions for <function>local_scan()</function> use</secondary>
62666 </indexterm>
62667 This function base64-encodes a string, which is passed by address and length.
62668 The text may contain bytes of any value, including zero. The result is passed
62669 back in dynamic memory that is obtained by calling <emphasis>store_get()</emphasis>. It is
62670 zero-terminated.
62671 </para>
62672 </listitem></varlistentry>
62673 <varlistentry>
62674 <term><emphasis role="bold">int&nbsp;lss_b64decode(uschar&nbsp;*codetext,&nbsp;uschar&nbsp;**cleartext)</emphasis></term>
62675 <listitem>
62676 <para>
62677 This function decodes a base64-encoded string. Its arguments are a
62678 zero-terminated base64-encoded string and the address of a variable that is set
62679 to point to the result, which is in dynamic memory. The length of the decoded
62680 string is the yield of the function. If the input is invalid base64 data, the
62681 yield is -1. A zero byte is added to the end of the output string to make it
62682 easy to interpret as a C string (assuming it contains no zeros of its own). The
62683 added zero byte is not included in the returned count.
62684 </para>
62685 </listitem></varlistentry>
62686 <varlistentry>
62687 <term><emphasis role="bold">int&nbsp;lss_match_domain(uschar&nbsp;*domain,&nbsp;uschar&nbsp;*list)</emphasis></term>
62688 <listitem>
62689 <para>
62690 This function checks for a match in a domain list. Domains are always
62691 matched caselessly. The return value is one of the following:
62692 </para>
62693 <literallayout>
62694 <literal>OK     </literal> match succeeded
62695 <literal>FAIL   </literal> match failed
62696 <literal>DEFER  </literal> match deferred
62697 </literallayout>
62698 <para>
62699 DEFER is usually caused by some kind of lookup defer, such as the
62700 inability to contact a database.
62701 </para>
62702 </listitem></varlistentry>
62703 <varlistentry>
62704 <term><emphasis role="bold">int&nbsp;lss_match_local_part(uschar&nbsp;*localpart,&nbsp;uschar&nbsp;*list,&nbsp;BOOL&nbsp;caseless)</emphasis></term>
62705 <listitem>
62706 <para>
62707 This function checks for a match in a local part list. The third argument
62708 controls case-sensitivity. The return values are as for
62709 <emphasis>lss_match_domain()</emphasis>.
62710 </para>
62711 </listitem></varlistentry>
62712 <varlistentry>
62713 <term><emphasis role="bold">int&nbsp;lss_match_address(uschar&nbsp;*address,&nbsp;uschar&nbsp;*list,&nbsp;BOOL&nbsp;caseless)</emphasis></term>
62714 <listitem>
62715 <para>
62716 This function checks for a match in an address list. The third argument
62717 controls the case-sensitivity of the local part match. The domain is always
62718 matched caselessly. The return values are as for <emphasis>lss_match_domain()</emphasis>.
62719 </para>
62720 </listitem></varlistentry>
62721 <varlistentry>
62722 <term><emphasis role="bold">int&nbsp;lss_match_host(uschar&nbsp;*host_name,&nbsp;uschar&nbsp;*host_address,&nbsp;uschar&nbsp;*list)</emphasis></term>
62723 <listitem>
62724 <para>
62725 This function checks for a match in a host list. The most common usage is
62726 expected to be
62727 </para>
62728 <literallayout class="monospaced">
62729 lss_match_host(sender_host_name, sender_host_address, ...)
62730 </literallayout>
62731 <para>
62732 <indexterm role="variable">
62733 <primary><varname>$sender_host_address</varname></primary>
62734 </indexterm>
62735 An empty address field matches an empty item in the host list. If the host name
62736 is NULL, the name corresponding to <varname>$sender_host_address</varname> is automatically
62737 looked up if a host name is required to match an item in the list. The return
62738 values are as for <emphasis>lss_match_domain()</emphasis>, but in addition, <emphasis>lss_match_host()</emphasis>
62739 returns ERROR in the case when it had to look up a host name, but the lookup
62740 failed.
62741 </para>
62742 </listitem></varlistentry>
62743 <varlistentry>
62744 <term><emphasis role="bold">void&nbsp;log_write(unsigned&nbsp;int&nbsp;selector,&nbsp;int&nbsp;which,&nbsp;char&nbsp;*format,&nbsp;...)</emphasis></term>
62745 <listitem>
62746 <para>
62747 This function writes to Exim&#x2019;s log files. The first argument should be zero (it
62748 is concerned with <option>log_selector</option>). The second argument can be <literal>LOG_MAIN</literal> or
62749 <literal>LOG_REJECT</literal> or <literal>LOG_PANIC</literal> or the inclusive <quote>or</quote> of any combination of
62750 them. It specifies to which log or logs the message is written. The remaining
62751 arguments are a format and relevant insertion arguments. The string should not
62752 contain any newlines, not even at the end.
62753 </para>
62754 </listitem></varlistentry>
62755 <varlistentry>
62756 <term><emphasis role="bold">void&nbsp;receive_add_recipient(uschar&nbsp;*address,&nbsp;int&nbsp;pno)</emphasis></term>
62757 <listitem>
62758 <para>
62759 This function adds an additional recipient to the message. The first argument
62760 is the recipient address. If it is unqualified (has no domain), it is qualified
62761 with the <option>qualify_recipient</option> domain. The second argument must always be -1.
62762 </para>
62763 <para>
62764 This function does not allow you to specify a private <option>errors_to</option> address (as
62765 described with the structure of <option>recipient_item</option> above), because it pre-dates
62766 the addition of that field to the structure. However, it is easy to add such a
62767 value afterwards. For example:
62768 </para>
62769 <literallayout class="monospaced">
62770  receive_add_recipient(US"monitor@mydom.example", -1);
62771  recipients_list[recipients_count-1].errors_to =
62772    US"postmaster@mydom.example";
62773 </literallayout>
62774 </listitem></varlistentry>
62775 <varlistentry>
62776 <term><emphasis role="bold">BOOL&nbsp;receive_remove_recipient(uschar&nbsp;*recipient)</emphasis></term>
62777 <listitem>
62778 <para>
62779 This is a convenience function to remove a named recipient from the list of
62780 recipients. It returns true if a recipient was removed, and false if no
62781 matching recipient could be found. The argument must be a complete email
62782 address.
62783 </para>
62784 </listitem></varlistentry>
62785 </variablelist>
62786 <para>
62787 <indexterm role="concept">
62788 <primary>RFC 2047</primary>
62789 </indexterm>
62790 </para>
62791 <variablelist>
62792 <varlistentry>
62793 <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>
62794 <listitem>
62795 <para>
62796 This function decodes strings that are encoded according to RFC 2047. Typically
62797 these are the contents of header lines. First, each <quote>encoded word</quote> is decoded
62798 from the Q or B encoding into a byte-string. Then, if provided with the name of
62799 a charset encoding, and if the <function>iconv()</function> function is available, an attempt is
62800 made  to translate the result to the named character set. If this fails, the
62801 binary string is returned with an error message.
62802 </para>
62803 <para>
62804 The first argument is the string to be decoded. If <option>lencheck</option> is TRUE, the
62805 maximum MIME word length is enforced. The third argument is the target
62806 encoding, or NULL if no translation is wanted.
62807 </para>
62808 <para>
62809 <indexterm role="concept">
62810 <primary>binary zero</primary>
62811 <secondary>in RFC 2047 decoding</secondary>
62812 </indexterm>
62813 <indexterm role="concept">
62814 <primary>RFC 2047</primary>
62815 <secondary>binary zero in</secondary>
62816 </indexterm>
62817 If a binary zero is encountered in the decoded string, it is replaced by the
62818 contents of the <option>zeroval</option> argument. For use with Exim headers, the value must
62819 not be 0 because header lines are handled as zero-terminated strings.
62820 </para>
62821 <para>
62822 The function returns the result of processing the string, zero-terminated; if
62823 <option>lenptr</option> is not NULL, the length of the result is set in the variable to
62824 which it points. When <option>zeroval</option> is 0, <option>lenptr</option> should not be NULL.
62825 </para>
62826 <para>
62827 If an error is encountered, the function returns NULL and uses the <option>error</option>
62828 argument to return an error message. The variable pointed to by <option>error</option> is
62829 set to NULL if there is no error; it may be set non-NULL even when the function
62830 returns a non-NULL value if decoding was successful, but there was a problem
62831 with translation.
62832 </para>
62833 </listitem></varlistentry>
62834 <varlistentry>
62835 <term><emphasis role="bold">int&nbsp;smtp_fflush(void)</emphasis></term>
62836 <listitem>
62837 <para>
62838 This function is used in conjunction with <emphasis>smtp_printf()</emphasis>, as described
62839 below.
62840 </para>
62841 </listitem></varlistentry>
62842 <varlistentry>
62843 <term><emphasis role="bold">void&nbsp;smtp_printf(char&nbsp;*,&nbsp;...)</emphasis></term>
62844 <listitem>
62845 <para>
62846 The arguments of this function are like <function>printf()</function>; it writes to the SMTP
62847 output stream. You should use this function only when there is an SMTP output
62848 stream, that is, when the incoming message is being received via interactive
62849 SMTP. This is the case when <option>smtp_input</option> is TRUE and <option>smtp_batched_input</option>
62850 is FALSE. If you want to test for an incoming message from another host (as
62851 opposed to a local process that used the <option>-bs</option> command line option), you can
62852 test the value of <option>sender_host_address</option>, which is non-NULL when a remote host
62853 is involved.
62854 </para>
62855 <para>
62856 If an SMTP TLS connection is established, <emphasis>smtp_printf()</emphasis> uses the TLS
62857 output function, so it can be used for all forms of SMTP connection.
62858 </para>
62859 <para>
62860 Strings that are written by <emphasis>smtp_printf()</emphasis> from within <function>local_scan()</function>
62861 must start with an appropriate response code: 550 if you are going to return
62862 LOCAL_SCAN_REJECT, 451 if you are going to return
62863 LOCAL_SCAN_TEMPREJECT, and 250 otherwise. Because you are writing the
62864 initial lines of a multi-line response, the code must be followed by a hyphen
62865 to indicate that the line is not the final response line. You must also ensure
62866 that the lines you write terminate with CRLF. For example:
62867 </para>
62868 <literallayout class="monospaced">
62869 smtp_printf("550-this is some extra info\r\n");
62870 return LOCAL_SCAN_REJECT;
62871 </literallayout>
62872 <para>
62873 Note that you can also create multi-line responses by including newlines in
62874 the data returned via the <option>return_text</option> argument. The added value of using
62875 <emphasis>smtp_printf()</emphasis> is that, for instance, you could introduce delays between
62876 multiple output lines.
62877 </para>
62878 <para>
62879 The <emphasis>smtp_printf()</emphasis> function does not return any error indication, because it
62880 does not automatically flush pending output, and therefore does not test
62881 the state of the stream. (In the main code of Exim, flushing and error
62882 detection is done when Exim is ready for the next SMTP input command.) If
62883 you want to flush the output and check for an error (for example, the
62884 dropping of a TCP/IP connection), you can call <emphasis>smtp_fflush()</emphasis>, which has no
62885 arguments. It flushes the output stream, and returns a non-zero value if there
62886 is an error.
62887 </para>
62888 </listitem></varlistentry>
62889 <varlistentry>
62890 <term><emphasis role="bold">void&nbsp;*store_get(int)</emphasis></term>
62891 <listitem>
62892 <para>
62893 This function accesses Exim&#x2019;s internal store (memory) manager. It gets a new
62894 chunk of memory whose size is given by the argument. Exim bombs out if it ever
62895 runs out of memory. See the next section for a discussion of memory handling.
62896 </para>
62897 </listitem></varlistentry>
62898 <varlistentry>
62899 <term><emphasis role="bold">void&nbsp;*store_get_perm(int)</emphasis></term>
62900 <listitem>
62901 <para>
62902 This function is like <emphasis>store_get()</emphasis>, but it always gets memory from the
62903 permanent pool. See the next section for a discussion of memory handling.
62904 </para>
62905 </listitem></varlistentry>
62906 <varlistentry>
62907 <term><emphasis role="bold">uschar&nbsp;*string_copy(uschar&nbsp;*string)</emphasis></term>
62908 <listitem>
62909 <para>
62910 See below.
62911 </para>
62912 </listitem></varlistentry>
62913 <varlistentry>
62914 <term><emphasis role="bold">uschar&nbsp;*string_copyn(uschar&nbsp;*string,&nbsp;int&nbsp;length)</emphasis></term>
62915 <listitem>
62916 <para>
62917 See below.
62918 </para>
62919 </listitem></varlistentry>
62920 <varlistentry>
62921 <term><emphasis role="bold">uschar&nbsp;*string_sprintf(char&nbsp;*format,&nbsp;...)</emphasis></term>
62922 <listitem>
62923 <para>
62924 These three functions create strings using Exim&#x2019;s dynamic memory facilities.
62925 The first makes a copy of an entire string. The second copies up to a maximum
62926 number of characters, indicated by the second argument. The third uses a format
62927 and insertion arguments to create a new string. In each case, the result is a
62928 pointer to a new string in the current memory pool. See the next section for
62929 more discussion.
62930 </para>
62931 </listitem></varlistentry>
62932 </variablelist>
62933 </section>
62934 <section id="SECTmemhanloc">
62935 <title>More about Exim&#x2019;s memory handling</title>
62936 <para>
62937 <indexterm role="concept">
62938 <primary><function>local_scan()</function> function</primary>
62939 <secondary>memory handling</secondary>
62940 </indexterm>
62941 No function is provided for freeing memory, because that is never needed.
62942 The dynamic memory that Exim uses when receiving a message is automatically
62943 recycled if another message is received by the same process (this applies only
62944 to incoming SMTP connections &ndash; other input methods can supply only one
62945 message at a time). After receiving the last message, a reception process
62946 terminates.
62947 </para>
62948 <para>
62949 Because it is recycled, the normal dynamic memory cannot be used for holding
62950 data that must be preserved over a number of incoming messages on the same SMTP
62951 connection. However, Exim in fact uses two pools of dynamic memory; the second
62952 one is not recycled, and can be used for this purpose.
62953 </para>
62954 <para>
62955 If you want to allocate memory that remains available for subsequent messages
62956 in the same SMTP connection, you should set
62957 </para>
62958 <literallayout class="monospaced">
62959 store_pool = POOL_PERM
62960 </literallayout>
62961 <para>
62962 before calling the function that does the allocation. There is no need to
62963 restore the value if you do not need to; however, if you do want to revert to
62964 the normal pool, you can either restore the previous value of <option>store_pool</option> or
62965 set it explicitly to POOL_MAIN.
62966 </para>
62967 <para>
62968 The pool setting applies to all functions that get dynamic memory, including
62969 <emphasis>expand_string()</emphasis>, <emphasis>store_get()</emphasis>, and the <emphasis>string_xxx()</emphasis> functions.
62970 There is also a convenience function called <emphasis>store_get_perm()</emphasis> that gets a
62971 block of memory from the permanent pool while preserving the value of
62972 <option>store_pool</option>.
62973 <indexterm role="concept" startref="IIDlosca" class="endofrange"/>
62974 </para>
62975 </section>
62976 </chapter>
62977
62978 <chapter id="CHAPsystemfilter">
62979 <title>System-wide message filtering</title>
62980 <para>
62981 <indexterm role="concept" id="IIDsysfil1" class="startofrange">
62982 <primary>filter</primary>
62983 <secondary>system filter</secondary>
62984 </indexterm>
62985 <indexterm role="concept" id="IIDsysfil2" class="startofrange">
62986 <primary>filtering all mail</primary>
62987 </indexterm>
62988 <indexterm role="concept" id="IIDsysfil3" class="startofrange">
62989 <primary>system filter</primary>
62990 </indexterm>
62991 The previous chapters (on ACLs and the local scan function) describe checks
62992 that can be applied to messages before they are accepted by a host. There is
62993 also a mechanism for checking messages once they have been received, but before
62994 they are delivered. This is called the <emphasis>system filter</emphasis>.
62995 </para>
62996 <para>
62997 The system filter operates in a similar manner to users&#x2019; filter files, but it
62998 is run just once per message (however many recipients the message has).
62999 It should not normally be used as a substitute for routing, because <option>deliver</option>
63000 commands in a system router provide new envelope recipient addresses.
63001 The system filter must be an Exim filter. It cannot be a Sieve filter.
63002 </para>
63003 <para>
63004 The system filter is run at the start of a delivery attempt, before any routing
63005 is done. If a message fails to be completely delivered at the first attempt,
63006 the system filter is run again at the start of every retry.
63007 If you want your filter to do something only once per message, you can make use
63008 of the <option>first_delivery</option> condition in an <option>if</option> command in the filter to
63009 prevent it happening on retries.
63010 </para>
63011 <para>
63012 <indexterm role="variable">
63013 <primary><varname>$domain</varname></primary>
63014 </indexterm>
63015 <indexterm role="variable">
63016 <primary><varname>$local_part</varname></primary>
63017 </indexterm>
63018 <emphasis role="bold">Warning</emphasis>: Because the system filter runs just once, variables that are
63019 specific to individual recipient addresses, such as <varname>$local_part</varname> and
63020 <varname>$domain</varname>, are not set, and the <quote>personal</quote> condition is not meaningful. If
63021 you want to run a centrally-specified filter for each recipient address
63022 independently, you can do so by setting up a suitable <command>redirect</command> router, as
63023 described in section <xref linkend="SECTperaddfil"/> below.
63024 </para>
63025 <section id="SECID212">
63026 <title>Specifying a system filter</title>
63027 <para>
63028 <indexterm role="concept">
63029 <primary>uid (user id)</primary>
63030 <secondary>system filter</secondary>
63031 </indexterm>
63032 <indexterm role="concept">
63033 <primary>gid (group id)</primary>
63034 <secondary>system filter</secondary>
63035 </indexterm>
63036 The name of the file that contains the system filter must be specified by
63037 setting <option>system_filter</option>. If you want the filter to run under a uid and gid
63038 other than root, you must also set <option>system_filter_user</option> and
63039 <option>system_filter_group</option> as appropriate. For example:
63040 </para>
63041 <literallayout class="monospaced">
63042 system_filter = /etc/mail/exim.filter
63043 system_filter_user = exim
63044 </literallayout>
63045 <para>
63046 If a system filter generates any deliveries directly to files or pipes (via the
63047 <option>save</option> or <option>pipe</option> commands), transports to handle these deliveries must be
63048 specified by setting <option>system_filter_file_transport</option> and
63049 <option>system_filter_pipe_transport</option>, respectively. Similarly,
63050 <option>system_filter_reply_transport</option> must be set to handle any messages generated
63051 by the <option>reply</option> command.
63052 </para>
63053 </section>
63054 <section id="SECID213">
63055 <title>Testing a system filter</title>
63056 <para>
63057 You can run simple tests of a system filter in the same way as for a user
63058 filter, but you should use <option>-bF</option> rather than <option>-bf</option>, so that features that
63059 are permitted only in system filters are recognized.
63060 </para>
63061 <para>
63062 If you want to test the combined effect of a system filter and a user filter,
63063 you can use both <option>-bF</option> and <option>-bf</option> on the same command line.
63064 </para>
63065 </section>
63066 <section id="SECID214">
63067 <title>Contents of a system filter</title>
63068 <para>
63069 The language used to specify system filters is the same as for users&#x2019; filter
63070 files. It is described in the separate end-user document <emphasis>Exim&#x2019;s interface to
63071 mail filtering</emphasis>. However, there are some additional features that are
63072 available only in system filters; these are described in subsequent sections.
63073 If they are encountered in a user&#x2019;s filter file or when testing with <option>-bf</option>,
63074 they cause errors.
63075 </para>
63076 <para>
63077 <indexterm role="concept">
63078 <primary>frozen messages</primary>
63079 <secondary>manual thaw; testing in filter</secondary>
63080 </indexterm>
63081 There are two special conditions which, though available in users&#x2019; filter
63082 files, are designed for use in system filters. The condition <option>first_delivery</option>
63083 is true only for the first attempt at delivering a message, and
63084 <option>manually_thawed</option> is true only if the message has been frozen, and
63085 subsequently thawed by an admin user. An explicit forced delivery counts as a
63086 manual thaw, but thawing as a result of the <option>auto_thaw</option> setting does not.
63087 </para>
63088 <para>
63089 <emphasis role="bold">Warning</emphasis>: If a system filter uses the <option>first_delivery</option> condition to
63090 specify an <quote>unseen</quote> (non-significant) delivery, and that delivery does not
63091 succeed, it will not be tried again.
63092 If you want Exim to retry an unseen delivery until it succeeds, you should
63093 arrange to set it up every time the filter runs.
63094 </para>
63095 <para>
63096 When a system filter finishes running, the values of the variables <varname>$n0</varname> &ndash;
63097 <varname>$n9</varname> are copied into <varname>$sn0</varname> &ndash; <varname>$sn9</varname> and are thereby made available to
63098 users&#x2019; filter files. Thus a system filter can, for example, set up <quote>scores</quote>
63099 to which users&#x2019; filter files can refer.
63100 </para>
63101 </section>
63102 <section id="SECID215">
63103 <title>Additional variable for system filters</title>
63104 <para>
63105 <indexterm role="variable">
63106 <primary><varname>$recipients</varname></primary>
63107 </indexterm>
63108 The expansion variable <varname>$recipients</varname>, containing a list of all the recipients
63109 of the message (separated by commas and white space), is available in system
63110 filters. It is not available in users&#x2019; filters for privacy reasons.
63111 </para>
63112 </section>
63113 <section id="SECID216">
63114 <title>Defer, freeze, and fail commands for system filters</title>
63115 <para>
63116 <indexterm role="concept">
63117 <primary>freezing messages</primary>
63118 </indexterm>
63119 <indexterm role="concept">
63120 <primary>message</primary>
63121 <secondary>freezing</secondary>
63122 </indexterm>
63123 <indexterm role="concept">
63124 <primary>message</primary>
63125 <secondary>forced failure</secondary>
63126 </indexterm>
63127 <indexterm role="concept">
63128 <primary><option>fail</option></primary>
63129 <secondary>in system filter</secondary>
63130 </indexterm>
63131 <indexterm role="concept">
63132 <primary><option>freeze</option> in system filter</primary>
63133 </indexterm>
63134 <indexterm role="concept">
63135 <primary><option>defer</option> in system filter</primary>
63136 </indexterm>
63137 There are three extra commands (<option>defer</option>, <option>freeze</option> and <option>fail</option>) which are
63138 always available in system filters, but are not normally enabled in users&#x2019;
63139 filters. (See the <option>allow_defer</option>, <option>allow_freeze</option> and <option>allow_fail</option> options
63140 for the <command>redirect</command> router.) These commands can optionally be followed by the
63141 word <option>text</option> and a string containing an error message, for example:
63142 </para>
63143 <literallayout class="monospaced">
63144 fail text "this message looks like spam to me"
63145 </literallayout>
63146 <para>
63147 The keyword <option>text</option> is optional if the next character is a double quote.
63148 </para>
63149 <para>
63150 The <option>defer</option> command defers delivery of the original recipients of the
63151 message. The <option>fail</option> command causes all the original recipients to be failed,
63152 and a bounce message to be created. The <option>freeze</option> command suspends all
63153 delivery attempts for the original recipients. In all cases, any new deliveries
63154 that are specified by the filter are attempted as normal after the filter has
63155 run.
63156 </para>
63157 <para>
63158 The <option>freeze</option> command is ignored if the message has been manually unfrozen and
63159 not manually frozen since. This means that automatic freezing by a system
63160 filter can be used as a way of checking out suspicious messages. If a message
63161 is found to be all right, manually unfreezing it allows it to be delivered.
63162 </para>
63163 <para>
63164 <indexterm role="concept">
63165 <primary>log</primary>
63166 <secondary><option>fail</option> command log line</secondary>
63167 </indexterm>
63168 <indexterm role="concept">
63169 <primary><option>fail</option></primary>
63170 <secondary>log line; reducing</secondary>
63171 </indexterm>
63172 The text given with a fail command is used as part of the bounce message as
63173 well as being written to the log. If the message is quite long, this can fill
63174 up a lot of log space when such failures are common. To reduce the size of the
63175 log message, Exim interprets the text in a special way if it starts with the
63176 two characters <literal>&lt;&lt;</literal> and contains <literal>&gt;&gt;</literal> later. The text between these two
63177 strings is written to the log, and the rest of the text is used in the bounce
63178 message. For example:
63179 </para>
63180 <literallayout class="monospaced">
63181 fail "&lt;&lt;filter test 1&gt;&gt;Your message is rejected \
63182      because it contains attachments that we are \
63183      not prepared to receive."
63184 </literallayout>
63185 <para>
63186 <indexterm role="concept">
63187 <primary>loop</primary>
63188 <secondary>caused by <option>fail</option></secondary>
63189 </indexterm>
63190 Take great care with the <option>fail</option> command when basing the decision to fail on
63191 the contents of the message, because the bounce message will of course include
63192 the contents of the original message and will therefore trigger the <option>fail</option>
63193 command again (causing a mail loop) unless steps are taken to prevent this.
63194 Testing the <option>error_message</option> condition is one way to prevent this. You could
63195 use, for example
63196 </para>
63197 <literallayout class="monospaced">
63198 if $message_body contains "this is spam" and not error_message
63199 then fail text "spam is not wanted here" endif
63200 </literallayout>
63201 <para>
63202 though of course that might let through unwanted bounce messages. The
63203 alternative is clever checking of the body and/or headers to detect bounces
63204 generated by the filter.
63205 </para>
63206 <para>
63207 The interpretation of a system filter file ceases after a
63208 <option>defer</option>,
63209 <option>freeze</option>, or <option>fail</option> command is obeyed. However, any deliveries that were
63210 set up earlier in the filter file are honoured, so you can use a sequence such
63211 as
63212 </para>
63213 <literallayout class="monospaced">
63214 mail ...
63215 freeze
63216 </literallayout>
63217 <para>
63218 to send a specified message when the system filter is freezing (or deferring or
63219 failing) a message. The normal deliveries for the message do not, of course,
63220 take place.
63221 </para>
63222 </section>
63223 <section id="SECTaddremheasys">
63224 <title>Adding and removing headers in a system filter</title>
63225 <para>
63226 <indexterm role="concept">
63227 <primary>header lines</primary>
63228 <secondary>adding; in system filter</secondary>
63229 </indexterm>
63230 <indexterm role="concept">
63231 <primary>header lines</primary>
63232 <secondary>removing; in system filter</secondary>
63233 </indexterm>
63234 <indexterm role="concept">
63235 <primary>filter</primary>
63236 <secondary>header lines; adding/removing</secondary>
63237 </indexterm>
63238 Two filter commands that are available only in system filters are:
63239 </para>
63240 <literallayout class="monospaced">
63241 headers add &lt;string&gt;
63242 headers remove &lt;string&gt;
63243 </literallayout>
63244 <para>
63245 The argument for the <option>headers add</option> is a string that is expanded and then
63246 added to the end of the message&#x2019;s headers. It is the responsibility of the
63247 filter maintainer to make sure it conforms to RFC 2822 syntax. Leading white
63248 space is ignored, and if the string is otherwise empty, or if the expansion is
63249 forced to fail, the command has no effect.
63250 </para>
63251 <para>
63252 You can use <quote>\n</quote> within the string, followed by white space, to specify
63253 continued header lines. More than one header may be added in one command by
63254 including <quote>\n</quote> within the string without any following white space. For
63255 example:
63256 </para>
63257 <literallayout class="monospaced">
63258 headers add "X-header-1: ....\n  \
63259              continuation of X-header-1 ...\n\
63260              X-header-2: ...."
63261 </literallayout>
63262 <para>
63263 Note that the header line continuation white space after the first newline must
63264 be placed before the backslash that continues the input string, because white
63265 space after input continuations is ignored.
63266 </para>
63267 <para>
63268 The argument for <option>headers remove</option> is a colon-separated list of header names.
63269 This command applies only to those headers that are stored with the message;
63270 those that are added at delivery time (such as <emphasis>Envelope-To:</emphasis> and
63271 <emphasis>Return-Path:</emphasis>) cannot be removed by this means. If there is more than one
63272 header with the same name, they are all removed.
63273 </para>
63274 <para>
63275 The <option>headers</option> command in a system filter makes an immediate change to the set
63276 of header lines that was received with the message (with possible additions
63277 from ACL processing). Subsequent commands in the system filter operate on the
63278 modified set, which also forms the basis for subsequent message delivery.
63279 Unless further modified during routing or transporting, this set of headers is
63280 used for all recipients of the message.
63281 </para>
63282 <para>
63283 During routing and transporting, the variables that refer to the contents of
63284 header lines refer only to those lines that are in this set. Thus, header lines
63285 that are added by a system filter are visible to users&#x2019; filter files and to all
63286 routers and transports. This contrasts with the manipulation of header lines by
63287 routers and transports, which is not immediate, but which instead is saved up
63288 until the message is actually being written (see section
63289 <xref linkend="SECTheadersaddrem"/>).
63290 </para>
63291 <para>
63292 If the message is not delivered at the first attempt, header lines that were
63293 added by the system filter are stored with the message, and so are still
63294 present at the next delivery attempt. Header lines that were removed are still
63295 present, but marked <quote>deleted</quote> so that they are not transported with the
63296 message. For this reason, it is usual to make the <option>headers</option> command
63297 conditional on <option>first_delivery</option> so that the set of header lines is not
63298 modified more than once.
63299 </para>
63300 <para>
63301 Because header modification in a system filter acts immediately, you have to
63302 use an indirect approach if you want to modify the contents of a header line.
63303 For example:
63304 </para>
63305 <literallayout class="monospaced">
63306 headers add "Old-Subject: $h_subject:"
63307 headers remove "Subject"
63308 headers add "Subject: new subject (was: $h_old-subject:)"
63309 headers remove "Old-Subject"
63310 </literallayout>
63311 </section>
63312 <section id="SECID217">
63313 <title>Setting an errors address in a system filter</title>
63314 <para>
63315 <indexterm role="concept">
63316 <primary>envelope sender</primary>
63317 </indexterm>
63318 In a system filter, if a <option>deliver</option> command is followed by
63319 </para>
63320 <literallayout class="monospaced">
63321 errors_to &lt;some address&gt;
63322 </literallayout>
63323 <para>
63324 in order to change the envelope sender (and hence the error reporting) for that
63325 delivery, any address may be specified. (In a user filter, only the current
63326 user&#x2019;s address can be set.) For example, if some mail is being monitored, you
63327 might use
63328 </para>
63329 <literallayout class="monospaced">
63330 unseen deliver monitor@spying.example errors_to root@local.example
63331 </literallayout>
63332 <para>
63333 to take a copy which would not be sent back to the normal error reporting
63334 address if its delivery failed.
63335 </para>
63336 </section>
63337 <section id="SECTperaddfil">
63338 <title>Per-address filtering</title>
63339 <para>
63340 <indexterm role="variable">
63341 <primary><varname>$domain</varname></primary>
63342 </indexterm>
63343 <indexterm role="variable">
63344 <primary><varname>$local_part</varname></primary>
63345 </indexterm>
63346 In contrast to the system filter, which is run just once per message for each
63347 delivery attempt, it is also possible to set up a system-wide filtering
63348 operation that runs once for each recipient address. In this case, variables
63349 such as <varname>$local_part</varname> and <varname>$domain</varname> can be used, and indeed, the choice of
63350 filter file could be made dependent on them. This is an example of a router
63351 which implements such a filter:
63352 </para>
63353 <literallayout class="monospaced">
63354 central_filter:
63355   check_local_user
63356   driver = redirect
63357   domains = +local_domains
63358   file = /central/filters/$local_part
63359   no_verify
63360   allow_filter
63361   allow_freeze
63362 </literallayout>
63363 <para>
63364 The filter is run in a separate process under its own uid. Therefore, either
63365 <option>check_local_user</option> must be set (as above), in which case the filter is run as
63366 the local user, or the <option>user</option> option must be used to specify which user to
63367 use. If both are set, <option>user</option> overrides.
63368 </para>
63369 <para>
63370 Care should be taken to ensure that none of the commands in the filter file
63371 specify a significant delivery if the message is to go on to be delivered to
63372 its intended recipient. The router will not then claim to have dealt with the
63373 address, so it will be passed on to subsequent routers to be delivered in the
63374 normal way.
63375 <indexterm role="concept" startref="IIDsysfil1" class="endofrange"/>
63376 <indexterm role="concept" startref="IIDsysfil2" class="endofrange"/>
63377 <indexterm role="concept" startref="IIDsysfil3" class="endofrange"/>
63378 </para>
63379 </section>
63380 </chapter>
63381
63382 <chapter id="CHAPmsgproc">
63383 <title>Message processing</title>
63384 <para>
63385 <indexterm role="concept" id="IIDmesproc" class="startofrange">
63386 <primary>message</primary>
63387 <secondary>general processing</secondary>
63388 </indexterm>
63389 Exim performs various transformations on the sender and recipient addresses of
63390 all messages that it handles, and also on the messages&#x2019; header lines. Some of
63391 these are optional and configurable, while others always take place. All of
63392 this processing, except rewriting as a result of routing, and the addition or
63393 removal of header lines while delivering, happens when a message is received,
63394 before it is placed on Exim&#x2019;s queue.
63395 </para>
63396 <para>
63397 Some of the automatic processing takes place by default only for
63398 <quote>locally-originated</quote> messages. This adjective is used to describe messages
63399 that are not received over TCP/IP, but instead are passed to an Exim process on
63400 its standard input. This includes the interactive <quote>local SMTP</quote> case that is
63401 set up by the <option>-bs</option> command line option.
63402 </para>
63403 <para>
63404 <emphasis role="bold">Note</emphasis>: Messages received over TCP/IP on the loopback interface (127.0.0.1
63405 or ::1) are not considered to be locally-originated. Exim does not treat the
63406 loopback interface specially in any way.
63407 </para>
63408 <para>
63409 If you want the loopback interface to be treated specially, you must ensure
63410 that there are appropriate entries in your ACLs.
63411 </para>
63412 <section id="SECTsubmodnon">
63413 <title>Submission mode for non-local messages</title>
63414 <para>
63415 <indexterm role="concept">
63416 <primary>message</primary>
63417 <secondary>submission</secondary>
63418 </indexterm>
63419 <indexterm role="concept">
63420 <primary>submission mode</primary>
63421 </indexterm>
63422 Processing that happens automatically for locally-originated messages (unless
63423 <option>suppress_local_fixups</option> is set) can also be requested for messages that are
63424 received over TCP/IP. The term <quote>submission mode</quote> is used to describe this
63425 state. Submission mode is set by the modifier
63426 </para>
63427 <literallayout class="monospaced">
63428 control = submission
63429 </literallayout>
63430 <para>
63431 in a MAIL, RCPT, or pre-data ACL for an incoming message (see sections
63432 <xref linkend="SECTACLmodi"/> and <xref linkend="SECTcontrols"/>). This makes Exim treat the message as
63433 a local submission, and is normally used when the source of the message is
63434 known to be an MUA running on a client host (as opposed to an MTA). For
63435 example, to set submission mode for messages originating on the IPv4 loopback
63436 interface, you could include the following in the MAIL ACL:
63437 </para>
63438 <literallayout class="monospaced">
63439 warn  hosts = 127.0.0.1
63440       control = submission
63441 </literallayout>
63442 <para>
63443 <indexterm role="concept">
63444 <primary><option>sender_retain</option> submission option</primary>
63445 </indexterm>
63446 There are some options that can be used when setting submission mode. A slash
63447 is used to separate options. For example:
63448 </para>
63449 <literallayout class="monospaced">
63450 control = submission/sender_retain
63451 </literallayout>
63452 <para>
63453 Specifying <option>sender_retain</option> has the effect of setting <option>local_sender_retain</option>
63454 true and <option>local_from_check</option> false for the current incoming message. The first
63455 of these allows an existing <emphasis>Sender:</emphasis> header in the message to remain, and
63456 the second suppresses the check to ensure that <emphasis>From:</emphasis> matches the
63457 authenticated sender. With this setting, Exim still fixes up messages by adding
63458 <emphasis>Date:</emphasis> and <emphasis>Message-ID:</emphasis> header lines if they are missing, but makes no
63459 attempt to check sender authenticity in header lines.
63460 </para>
63461 <para>
63462 When <option>sender_retain</option> is not set, a submission mode setting may specify a
63463 domain to be used when generating a <emphasis>From:</emphasis> or <emphasis>Sender:</emphasis> header line. For
63464 example:
63465 </para>
63466 <literallayout class="monospaced">
63467 control = submission/domain=some.domain
63468 </literallayout>
63469 <para>
63470 The domain may be empty. How this value is used is described in sections
63471 <xref linkend="SECTthefrohea"/> and <xref linkend="SECTthesenhea"/>. There is also a <option>name</option> option
63472 that allows you to specify the user&#x2019;s full name for inclusion in a created
63473 <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis> header line. For example:
63474 </para>
63475 <literallayout class="monospaced">
63476 accept authenticated = *
63477        control = submission/domain=wonderland.example/\
63478                             name=${lookup {$authenticated_id} \
63479                                    lsearch {/etc/exim/namelist}}
63480 </literallayout>
63481 <para>
63482 Because the name may contain any characters, including slashes, the <option>name</option>
63483 option must be given last. The remainder of the string is used as the name. For
63484 the example above, if <filename>/etc/exim/namelist</filename> contains:
63485 </para>
63486 <literallayout class="monospaced">
63487 bigegg:  Humpty Dumpty
63488 </literallayout>
63489 <para>
63490 then when the sender has authenticated as <emphasis>bigegg</emphasis>, the generated <emphasis>Sender:</emphasis>
63491 line would be:
63492 </para>
63493 <literallayout class="monospaced">
63494 Sender: Humpty Dumpty &lt;bigegg@wonderland.example&gt;
63495 </literallayout>
63496 <para>
63497 <indexterm role="concept">
63498 <primary>return path</primary>
63499 <secondary>in submission mode</secondary>
63500 </indexterm>
63501 By default, submission mode forces the return path to the same address as is
63502 used to create the <emphasis>Sender:</emphasis> header. However, if <option>sender_retain</option> is
63503 specified, the return path is also left unchanged.
63504 </para>
63505 <para>
63506 <emphasis role="bold">Note</emphasis>: The changes caused by submission mode take effect after the predata
63507 ACL. This means that any sender checks performed before the fix-ups use the
63508 untrusted sender address specified by the user, not the trusted sender address
63509 specified by submission mode. Although this might be slightly unexpected, it
63510 does mean that you can configure ACL checks to spot that a user is trying to
63511 spoof another&#x2019;s address.
63512 </para>
63513 </section>
63514 <section id="SECTlineendings">
63515 <title>Line endings</title>
63516 <para>
63517 <indexterm role="concept">
63518 <primary>line endings</primary>
63519 </indexterm>
63520 <indexterm role="concept">
63521 <primary>carriage return</primary>
63522 </indexterm>
63523 <indexterm role="concept">
63524 <primary>linefeed</primary>
63525 </indexterm>
63526 RFC 2821 specifies that CRLF (two characters: carriage-return, followed by
63527 linefeed) is the line ending for messages transmitted over the Internet using
63528 SMTP over TCP/IP. However, within individual operating systems, different
63529 conventions are used. For example, Unix-like systems use just LF, but others
63530 use CRLF or just CR.
63531 </para>
63532 <para>
63533 Exim was designed for Unix-like systems, and internally, it stores messages
63534 using the system&#x2019;s convention of a single LF as a line terminator. When
63535 receiving a message, all line endings are translated to this standard format.
63536 Originally, it was thought that programs that passed messages directly to an
63537 MTA within an operating system would use that system&#x2019;s convention. Experience
63538 has shown that this is not the case; for example, there are Unix applications
63539 that use CRLF in this circumstance. For this reason, and for compatibility with
63540 other MTAs, the way Exim handles line endings for all messages is now as
63541 follows:
63542 </para>
63543 <itemizedlist>
63544 <listitem>
63545 <para>
63546 LF not preceded by CR is treated as a line ending.
63547 </para>
63548 </listitem>
63549 <listitem>
63550 <para>
63551 CR is treated as a line ending; if it is immediately followed by LF, the LF
63552 is ignored.
63553 </para>
63554 </listitem>
63555 <listitem>
63556 <para>
63557 The sequence <quote>CR, dot, CR</quote> does not terminate an incoming SMTP message,
63558 nor a local message in the state where a line containing only a dot is a
63559 terminator.
63560 </para>
63561 </listitem>
63562 <listitem>
63563 <para>
63564 If a bare CR is encountered within a header line, an extra space is added after
63565 the line terminator so as not to end the header line. The reasoning behind this
63566 is that bare CRs in header lines are most likely either to be mistakes, or
63567 people trying to play silly games.
63568 </para>
63569 </listitem>
63570 <listitem>
63571 <para>
63572 If the first header line received in a message ends with CRLF, a subsequent
63573 bare LF in a header line is treated in the same way as a bare CR in a header
63574 line.
63575 </para>
63576 </listitem>
63577 </itemizedlist>
63578 </section>
63579 <section id="SECID218">
63580 <title>Unqualified addresses</title>
63581 <para>
63582 <indexterm role="concept">
63583 <primary>unqualified addresses</primary>
63584 </indexterm>
63585 <indexterm role="concept">
63586 <primary>address</primary>
63587 <secondary>qualification</secondary>
63588 </indexterm>
63589 By default, Exim expects every envelope address it receives from an external
63590 host to be fully qualified. Unqualified addresses cause negative responses to
63591 SMTP commands. However, because SMTP is used as a means of transporting
63592 messages from MUAs running on personal workstations, there is sometimes a
63593 requirement to accept unqualified addresses from specific hosts or IP networks.
63594 </para>
63595 <para>
63596 Exim has two options that separately control which hosts may send unqualified
63597 sender or recipient addresses in SMTP commands, namely
63598 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>. In both
63599 cases, if an unqualified address is accepted, it is qualified by adding the
63600 value of <option>qualify_domain</option> or <option>qualify_recipient</option>, as appropriate.
63601 </para>
63602 <para>
63603 <indexterm role="option">
63604 <primary><option>qualify_domain</option></primary>
63605 </indexterm>
63606 <indexterm role="option">
63607 <primary><option>qualify_recipient</option></primary>
63608 </indexterm>
63609 Unqualified addresses in header lines are automatically qualified for messages
63610 that are locally originated, unless the <option>-bnq</option> option is given on the command
63611 line. For messages received over SMTP, unqualified addresses in header lines
63612 are qualified only if unqualified addresses are permitted in SMTP commands. In
63613 other words, such qualification is also controlled by
63614 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>,
63615 </para>
63616 </section>
63617 <section id="SECID219">
63618 <title>The UUCP From line</title>
63619 <para>
63620 <indexterm role="concept">
63621 <primary><quote>From</quote> line</primary>
63622 </indexterm>
63623 <indexterm role="concept">
63624 <primary>UUCP</primary>
63625 <secondary><quote>From</quote> line</secondary>
63626 </indexterm>
63627 <indexterm role="concept">
63628 <primary>sender</primary>
63629 <secondary>address</secondary>
63630 </indexterm>
63631 <indexterm role="option">
63632 <primary><option>uucp_from_pattern</option></primary>
63633 </indexterm>
63634 <indexterm role="option">
63635 <primary><option>uucp_from_sender</option></primary>
63636 </indexterm>
63637 <indexterm role="concept">
63638 <primary>envelope sender</primary>
63639 </indexterm>
63640 <indexterm role="concept">
63641 <primary>Sendmail compatibility</primary>
63642 <secondary><quote>From</quote> line</secondary>
63643 </indexterm>
63644 Messages that have come from UUCP (and some other applications) often begin
63645 with a line containing the envelope sender and a timestamp, following the word
63646 <quote>From</quote>. Examples of two common formats are:
63647 </para>
63648 <literallayout class="monospaced">
63649 From a.oakley@berlin.mus Fri Jan  5 12:35 GMT 1996
63650 From f.butler@berlin.mus Fri, 7 Jan 97 14:00:00 GMT
63651 </literallayout>
63652 <para>
63653 This line precedes the RFC 2822 header lines. For compatibility with Sendmail,
63654 Exim recognizes such lines at the start of messages that are submitted to it
63655 via the command line (that is, on the standard input). It does not recognize
63656 such lines in incoming SMTP messages, unless the sending host matches
63657 <option>ignore_fromline_hosts</option> or the <option>-bs</option> option was used for a local message
63658 and <option>ignore_fromline_local</option> is set. The recognition is controlled by a
63659 regular expression that is defined by the <option>uucp_from_pattern</option> option, whose
63660 default value matches the two common cases shown above and puts the address
63661 that follows <quote>From</quote> into <varname>$1</varname>.
63662 </para>
63663 <para>
63664 <indexterm role="concept">
63665 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
63666 <secondary>in <quote>From </quote> line handling</secondary>
63667 </indexterm>
63668 When the caller of Exim for a non-SMTP message that contains a <quote>From</quote> line is
63669 a trusted user, the message&#x2019;s sender address is constructed by expanding the
63670 contents of <option>uucp_sender_address</option>, whose default value is <quote>$1</quote>. This is
63671 then parsed as an RFC 2822 address. If there is no domain, the local part is
63672 qualified with <option>qualify_domain</option> unless it is the empty string. However, if
63673 the command line <option>-f</option> option is used, it overrides the <quote>From</quote> line.
63674 </para>
63675 <para>
63676 If the caller of Exim is not trusted, the <quote>From</quote> line is recognized, but the
63677 sender address is not changed. This is also the case for incoming SMTP messages
63678 that are permitted to contain <quote>From</quote> lines.
63679 </para>
63680 <para>
63681 Only one <quote>From</quote> line is recognized. If there is more than one, the second is
63682 treated as a data line that starts the body of the message, as it is not valid
63683 as a header line. This also happens if a <quote>From</quote> line is present in an
63684 incoming SMTP message from a source that is not permitted to send them.
63685 </para>
63686 </section>
63687 <section id="SECID220">
63688 <title>Resent- header lines</title>
63689 <para>
63690 <indexterm role="concept">
63691 <primary><option>Resent-</option> header lines</primary>
63692 </indexterm>
63693 <indexterm role="concept">
63694 <primary>header lines</primary>
63695 <secondary>Resent-</secondary>
63696 </indexterm>
63697 RFC 2822 makes provision for sets of header lines starting with the string
63698 <literal>Resent-</literal> to be added to a message when it is resent by the original
63699 recipient to somebody else. These headers are <emphasis>Resent-Date:</emphasis>,
63700 <emphasis>Resent-From:</emphasis>, <emphasis>Resent-Sender:</emphasis>, <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>,
63701 <emphasis>Resent-Bcc:</emphasis> and <emphasis>Resent-Message-ID:</emphasis>. The RFC says:
63702 </para>
63703 <blockquote>
63704 <para>
63705 <emphasis>Resent fields are strictly informational. They MUST NOT be used in the normal
63706 processing of replies or other such automatic actions on messages.</emphasis>
63707 </para>
63708 </blockquote>
63709 <para>
63710 This leaves things a bit vague as far as other processing actions such as
63711 address rewriting are concerned. Exim treats <option>Resent-</option> header lines as
63712 follows:
63713 </para>
63714 <itemizedlist>
63715 <listitem>
63716 <para>
63717 A <emphasis>Resent-From:</emphasis> line that just contains the login id of the submitting user
63718 is automatically rewritten in the same way as <emphasis>From:</emphasis> (see below).
63719 </para>
63720 </listitem>
63721 <listitem>
63722 <para>
63723 If there&#x2019;s a rewriting rule for a particular header line, it is also applied to
63724 <option>Resent-</option> header lines of the same type. For example, a rule that rewrites
63725 <emphasis>From:</emphasis> also rewrites <emphasis>Resent-From:</emphasis>.
63726 </para>
63727 </listitem>
63728 <listitem>
63729 <para>
63730 For local messages, if <emphasis>Sender:</emphasis> is removed on input, <emphasis>Resent-Sender:</emphasis> is
63731 also removed.
63732 </para>
63733 </listitem>
63734 <listitem>
63735 <para>
63736 For a locally-submitted message,
63737 if there are any <option>Resent-</option> header lines but no <emphasis>Resent-Date:</emphasis>,
63738 <emphasis>Resent-From:</emphasis>, or <emphasis>Resent-Message-Id:</emphasis>, they are added as necessary. It is
63739 the contents of <emphasis>Resent-Message-Id:</emphasis> (rather than <emphasis>Message-Id:</emphasis>) which are
63740 included in log lines in this case.
63741 </para>
63742 </listitem>
63743 <listitem>
63744 <para>
63745 The logic for adding <emphasis>Sender:</emphasis> is duplicated for <emphasis>Resent-Sender:</emphasis> when any
63746 <option>Resent-</option> header lines are present.
63747 </para>
63748 </listitem>
63749 </itemizedlist>
63750 </section>
63751 <section id="SECID221">
63752 <title>The Auto-Submitted: header line</title>
63753 <para>
63754 Whenever Exim generates an autoreply, a bounce, or a delay warning message, it
63755 includes the header line:
63756 </para>
63757 <literallayout class="monospaced">
63758 Auto-Submitted: auto-replied
63759 </literallayout>
63760 </section>
63761 <section id="SECID222">
63762 <title>The Bcc: header line</title>
63763 <para>
63764 <indexterm role="concept">
63765 <primary><emphasis>Bcc:</emphasis> header line</primary>
63766 </indexterm>
63767 If Exim is called with the <option>-t</option> option, to take recipient addresses from a
63768 message&#x2019;s header, it removes any <emphasis>Bcc:</emphasis> header line that may exist (after
63769 extracting its addresses). If <option>-t</option> is not present on the command line, any
63770 existing <emphasis>Bcc:</emphasis> is not removed.
63771 </para>
63772 </section>
63773 <section id="SECID223">
63774 <title>The Date: header line</title>
63775 <para>
63776 <indexterm role="concept">
63777 <primary><emphasis>Date:</emphasis> header line</primary>
63778 </indexterm>
63779 <indexterm role="concept">
63780 <primary>header lines</primary>
63781 <secondary>Date:</secondary>
63782 </indexterm>
63783 If a locally-generated or submission-mode message has no <emphasis>Date:</emphasis> header line,
63784 Exim adds one, using the current date and time, unless the
63785 <option>suppress_local_fixups</option> control has been specified.
63786 </para>
63787 </section>
63788 <section id="SECID224">
63789 <title>The Delivery-date: header line</title>
63790 <para>
63791 <indexterm role="concept">
63792 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
63793 </indexterm>
63794 <indexterm role="option">
63795 <primary><option>delivery_date_remove</option></primary>
63796 </indexterm>
63797 <emphasis>Delivery-date:</emphasis> header lines are not part of the standard RFC 2822 header
63798 set. Exim can be configured to add them to the final delivery of messages. (See
63799 the generic <option>delivery_date_add</option> transport option.) They should not be present
63800 in messages in transit. If the <option>delivery_date_remove</option> configuration option is
63801 set (the default), Exim removes <emphasis>Delivery-date:</emphasis> header lines from incoming
63802 messages.
63803 </para>
63804 </section>
63805 <section id="SECID225">
63806 <title>The Envelope-to: header line</title>
63807 <para>
63808 <indexterm role="concept">
63809 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
63810 </indexterm>
63811 <indexterm role="concept">
63812 <primary>header lines</primary>
63813 <secondary>Envelope-to:</secondary>
63814 </indexterm>
63815 <indexterm role="option">
63816 <primary><option>envelope_to_remove</option></primary>
63817 </indexterm>
63818 <emphasis>Envelope-to:</emphasis> header lines are not part of the standard RFC 2822 header set.
63819 Exim can be configured to add them to the final delivery of messages. (See the
63820 generic <option>envelope_to_add</option> transport option.) They should not be present in
63821 messages in transit. If the <option>envelope_to_remove</option> configuration option is set
63822 (the default), Exim removes <emphasis>Envelope-to:</emphasis> header lines from incoming
63823 messages.
63824 </para>
63825 </section>
63826 <section id="SECTthefrohea">
63827 <title>The From: header line</title>
63828 <para>
63829 <indexterm role="concept">
63830 <primary><emphasis>From:</emphasis> header line</primary>
63831 </indexterm>
63832 <indexterm role="concept">
63833 <primary>header lines</primary>
63834 <secondary>From:</secondary>
63835 </indexterm>
63836 <indexterm role="concept">
63837 <primary>Sendmail compatibility</primary>
63838 <secondary><quote>From</quote> line</secondary>
63839 </indexterm>
63840 <indexterm role="concept">
63841 <primary>message</primary>
63842 <secondary>submission</secondary>
63843 </indexterm>
63844 <indexterm role="concept">
63845 <primary>submission mode</primary>
63846 </indexterm>
63847 If a submission-mode message does not contain a <emphasis>From:</emphasis> header line, Exim
63848 adds one if either of the following conditions is true:
63849 </para>
63850 <itemizedlist>
63851 <listitem>
63852 <para>
63853 The envelope sender address is not empty (that is, this is not a bounce
63854 message). The added header line copies the envelope sender address.
63855 </para>
63856 </listitem>
63857 <listitem>
63858 <para>
63859 <indexterm role="variable">
63860 <primary><varname>$authenticated_id</varname></primary>
63861 </indexterm>
63862 The SMTP session is authenticated and <varname>$authenticated_id</varname> is not empty.
63863 </para>
63864 <orderedlist numeration="arabic">
63865 <listitem>
63866 <para>
63867 <indexterm role="variable">
63868 <primary><varname>$qualify_domain</varname></primary>
63869 </indexterm>
63870 If no domain is specified by the submission control, the local part is
63871 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
63872 </para>
63873 </listitem>
63874 <listitem>
63875 <para>
63876 If a non-empty domain is specified by the submission control, the local
63877 part is <varname>$authenticated_id</varname>, and the domain is the specified domain.
63878 </para>
63879 </listitem>
63880 <listitem>
63881 <para>
63882 If an empty domain is specified by the submission control,
63883 <varname>$authenticated_id</varname> is assumed to be the complete address.
63884 </para>
63885 </listitem>
63886 </orderedlist>
63887 </listitem>
63888 </itemizedlist>
63889 <para>
63890 A non-empty envelope sender takes precedence.
63891 </para>
63892 <para>
63893 If a locally-generated incoming message does not contain a <emphasis>From:</emphasis> header
63894 line, and the <option>suppress_local_fixups</option> control is not set, Exim adds one
63895 containing the sender&#x2019;s address. The calling user&#x2019;s login name and full name
63896 are used to construct the address, as described in section <xref linkend="SECTconstr"/>.
63897 They are obtained from the password data by calling <function>getpwuid()</function> (but see the
63898 <option>unknown_login</option> configuration option). The address is qualified with
63899 <option>qualify_domain</option>.
63900 </para>
63901 <para>
63902 For compatibility with Sendmail, if an incoming, non-SMTP message has a
63903 <emphasis>From:</emphasis> header line containing just the unqualified login name of the calling
63904 user, this is replaced by an address containing the user&#x2019;s login name and full
63905 name as described in section <xref linkend="SECTconstr"/>.
63906 </para>
63907 </section>
63908 <section id="SECID226">
63909 <title>The Message-ID: header line</title>
63910 <para>
63911 <indexterm role="concept">
63912 <primary><emphasis>Message-ID:</emphasis> header line</primary>
63913 </indexterm>
63914 <indexterm role="concept">
63915 <primary>header lines</primary>
63916 <secondary>Message-ID:</secondary>
63917 </indexterm>
63918 <indexterm role="concept">
63919 <primary>message</primary>
63920 <secondary>submission</secondary>
63921 </indexterm>
63922 <indexterm role="option">
63923 <primary><option>message_id_header_text</option></primary>
63924 </indexterm>
63925 If a locally-generated or submission-mode incoming message does not contain a
63926 <emphasis>Message-ID:</emphasis> or <emphasis>Resent-Message-ID:</emphasis> header line, and the
63927 <option>suppress_local_fixups</option> control is not set, Exim adds a suitable header line
63928 to the message. If there are any <emphasis>Resent-:</emphasis> headers in the message, it
63929 creates <emphasis>Resent-Message-ID:</emphasis>. The id is constructed from Exim&#x2019;s internal
63930 message id, preceded by the letter E to ensure it starts with a letter, and
63931 followed by @ and the primary host name. Additional information can be included
63932 in this header line by setting the <option>message_id_header_text</option> and/or
63933 <option>message_id_header_domain</option> options.
63934 </para>
63935 </section>
63936 <section id="SECID227">
63937 <title>The Received: header line</title>
63938 <para>
63939 <indexterm role="concept">
63940 <primary><emphasis>Received:</emphasis> header line</primary>
63941 </indexterm>
63942 <indexterm role="concept">
63943 <primary>header lines</primary>
63944 <secondary>Received:</secondary>
63945 </indexterm>
63946 A <emphasis>Received:</emphasis> header line is added at the start of every message. The
63947 contents are defined by the <option>received_header_text</option> configuration option, and
63948 Exim automatically adds a semicolon and a timestamp to the configured string.
63949 </para>
63950 <para>
63951 The <emphasis>Received:</emphasis> header is generated as soon as the message&#x2019;s header lines
63952 have been received. At this stage, the timestamp in the <emphasis>Received:</emphasis> header
63953 line is the time that the message started to be received. This is the value
63954 that is seen by the DATA ACL and by the <function>local_scan()</function> function.
63955 </para>
63956 <para>
63957 Once a message is accepted, the timestamp in the <emphasis>Received:</emphasis> header line is
63958 changed to the time of acceptance, which is (apart from a small delay while the
63959 -H spool file is written) the earliest time at which delivery could start.
63960 </para>
63961 </section>
63962 <section id="SECID228">
63963 <title>The References: header line</title>
63964 <para>
63965 <indexterm role="concept">
63966 <primary><emphasis>References:</emphasis> header line</primary>
63967 </indexterm>
63968 <indexterm role="concept">
63969 <primary>header lines</primary>
63970 <secondary>References:</secondary>
63971 </indexterm>
63972 Messages created by the <command>autoreply</command> transport include a <emphasis>References:</emphasis>
63973 header line. This is constructed according to the rules that are described in
63974 section 3.64 of RFC 2822 (which states that replies should contain such a
63975 header line), and section 3.14 of RFC 3834 (which states that automatic
63976 responses are not different in this respect). However, because some mail
63977 processing software does not cope well with very long header lines, no more
63978 than 12 message IDs are copied from the <emphasis>References:</emphasis> header line in the
63979 incoming message. If there are more than 12, the first one and then the final
63980 11 are copied, before adding the message ID of the incoming message.
63981 </para>
63982 </section>
63983 <section id="SECID229">
63984 <title>The Return-path: header line</title>
63985 <para>
63986 <indexterm role="concept">
63987 <primary><emphasis>Return-path:</emphasis> header line</primary>
63988 </indexterm>
63989 <indexterm role="concept">
63990 <primary>header lines</primary>
63991 <secondary>Return-path:</secondary>
63992 </indexterm>
63993 <indexterm role="option">
63994 <primary><option>return_path_remove</option></primary>
63995 </indexterm>
63996 <emphasis>Return-path:</emphasis> header lines are defined as something an MTA may insert when
63997 it does the final delivery of messages. (See the generic <option>return_path_add</option>
63998 transport option.) Therefore, they should not be present in messages in
63999 transit. If the <option>return_path_remove</option> configuration option is set (the
64000 default), Exim removes <emphasis>Return-path:</emphasis> header lines from incoming messages.
64001 </para>
64002 </section>
64003 <section id="SECTthesenhea">
64004 <title>The Sender: header line</title>
64005 <para>
64006 <indexterm role="concept">
64007 <primary><emphasis>Sender:</emphasis> header line</primary>
64008 </indexterm>
64009 <indexterm role="concept">
64010 <primary>message</primary>
64011 <secondary>submission</secondary>
64012 </indexterm>
64013 <indexterm role="concept">
64014 <primary>header lines</primary>
64015 <secondary>Sender:</secondary>
64016 </indexterm>
64017 For a locally-originated message from an untrusted user, Exim may remove an
64018 existing <emphasis>Sender:</emphasis> header line, and it may add a new one. You can modify
64019 these actions by setting the <option>local_sender_retain</option> option true, the
64020 <option>local_from_check</option> option false, or by using the <option>suppress_local_fixups</option>
64021 control setting.
64022 </para>
64023 <para>
64024 When a local message is received from an untrusted user and
64025 <option>local_from_check</option> is true (the default), and the <option>suppress_local_fixups</option>
64026 control has not been set, a check is made to see if the address given in the
64027 <emphasis>From:</emphasis> header line is the correct (local) sender of the message. The address
64028 that is expected has the login name as the local part and the value of
64029 <option>qualify_domain</option> as the domain. Prefixes and suffixes for the local part can
64030 be permitted by setting <option>local_from_prefix</option> and <option>local_from_suffix</option>
64031 appropriately. If <emphasis>From:</emphasis> does not contain the correct sender, a <emphasis>Sender:</emphasis>
64032 line is added to the message.
64033 </para>
64034 <para>
64035 If you set <option>local_from_check</option> false, this checking does not occur. However,
64036 the removal of an existing <emphasis>Sender:</emphasis> line still happens, unless you also set
64037 <option>local_sender_retain</option> to be true. It is not possible to set both of these
64038 options true at the same time.
64039 </para>
64040 <para>
64041 <indexterm role="concept">
64042 <primary>submission mode</primary>
64043 </indexterm>
64044 By default, no processing of <emphasis>Sender:</emphasis> header lines is done for messages
64045 received over TCP/IP or for messages submitted by trusted users. However, when
64046 a message is received over TCP/IP in submission mode, and <option>sender_retain</option> is
64047 not specified on the submission control, the following processing takes place:
64048 </para>
64049 <para>
64050 <indexterm role="variable">
64051 <primary><varname>$authenticated_id</varname></primary>
64052 </indexterm>
64053 First, any existing <emphasis>Sender:</emphasis> lines are removed. Then, if the SMTP session is
64054 authenticated, and <varname>$authenticated_id</varname> is not empty, a sender address is
64055 created as follows:
64056 </para>
64057 <itemizedlist>
64058 <listitem>
64059 <para>
64060 <indexterm role="variable">
64061 <primary><varname>$qualify_domain</varname></primary>
64062 </indexterm>
64063 If no domain is specified by the submission control, the local part is
64064 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
64065 </para>
64066 </listitem>
64067 <listitem>
64068 <para>
64069 If a non-empty domain is specified by the submission control, the local part
64070 is <varname>$authenticated_id</varname>, and the domain is the specified domain.
64071 </para>
64072 </listitem>
64073 <listitem>
64074 <para>
64075 If an empty domain is specified by the submission control,
64076 <varname>$authenticated_id</varname> is assumed to be the complete address.
64077 </para>
64078 </listitem>
64079 </itemizedlist>
64080 <para>
64081 This address is compared with the address in the <emphasis>From:</emphasis> header line. If they
64082 are different, a <emphasis>Sender:</emphasis> header line containing the created address is
64083 added. Prefixes and suffixes for the local part in <emphasis>From:</emphasis> can be permitted
64084 by setting <option>local_from_prefix</option> and <option>local_from_suffix</option> appropriately.
64085 </para>
64086 <para>
64087 <indexterm role="concept">
64088 <primary>return path</primary>
64089 <secondary>created from <emphasis>Sender:</emphasis></secondary>
64090 </indexterm>
64091 <emphasis role="bold">Note</emphasis>: Whenever a <emphasis>Sender:</emphasis> header line is created, the return path for
64092 the message (the envelope sender address) is changed to be the same address,
64093 except in the case of submission mode when <option>sender_retain</option> is specified.
64094 </para>
64095 </section>
64096 <section id="SECTheadersaddrem">
64097 <title>Adding and removing header lines in routers and transports</title>
64098 <para>
64099 <indexterm role="concept">
64100 <primary>header lines</primary>
64101 <secondary>adding; in router or transport</secondary>
64102 </indexterm>
64103 <indexterm role="concept">
64104 <primary>header lines</primary>
64105 <secondary>removing; in router or transport</secondary>
64106 </indexterm>
64107 When a message is delivered, the addition and removal of header lines can be
64108 specified in a system filter, or on any of the routers and transports that
64109 process the message. Section <xref linkend="SECTaddremheasys"/> contains details about
64110 modifying headers in a system filter. Header lines can also be added in an ACL
64111 as a message is received (see section <xref linkend="SECTaddheadacl"/>).
64112 </para>
64113 <para>
64114 In contrast to what happens in a system filter, header modifications that are
64115 specified on routers and transports apply only to the particular recipient
64116 addresses that are being processed by those routers and transports. These
64117 changes do not actually take place until a copy of the message is being
64118 transported. Therefore, they do not affect the basic set of header lines, and
64119 they do not affect the values of the variables that refer to header lines.
64120 </para>
64121 <para>
64122 <emphasis role="bold">Note</emphasis>: In particular, this means that any expansions in the configuration of
64123 the transport cannot refer to the modified header lines, because such
64124 expansions all occur before the message is actually transported.
64125 </para>
64126 <para>
64127 For both routers and transports, the argument of a <option>headers_add</option>
64128 option must be in the form of one or more RFC 2822 header lines, separated by
64129 newlines (coded as <quote>\n</quote>). For example:
64130 </para>
64131 <literallayout class="monospaced">
64132 headers_add = X-added-header: added by $primary_hostname\n\
64133               X-added-second: another added header line
64134 </literallayout>
64135 <para>
64136 Exim does not check the syntax of these added header lines.
64137 </para>
64138 <para>
64139 Multiple <option>headers_add</option> options for a single router or transport can be
64140 specified; the values will append to a single list of header lines.
64141 Each header-line is separately expanded.
64142 </para>
64143 <para>
64144 The argument of a <option>headers_remove</option> option must consist of a colon-separated
64145 list of header names. This is confusing, because header names themselves are
64146 often terminated by colons. In this case, the colons are the list separators,
64147 not part of the names. For example:
64148 </para>
64149 <literallayout class="monospaced">
64150 headers_remove = return-receipt-to:acknowledge-to
64151 </literallayout>
64152 <para>
64153 Multiple <option>headers_remove</option> options for a single router or transport can be
64154 specified; the arguments will append to a single header-names list.
64155 Each item is separately expanded.
64156 Note that colons in complex expansions which are used to
64157 form all or part of a <option>headers_remove</option> list
64158 will act as list separators.
64159 </para>
64160 <para>
64161 When <option>headers_add</option> or <option>headers_remove</option> is specified on a router,
64162 items are expanded at routing time,
64163 and then associated with all addresses that are
64164 accepted by that router, and also with any new addresses that it generates. If
64165 an address passes through several routers as a result of aliasing or
64166 forwarding, the changes are cumulative.
64167 </para>
64168 <para>
64169 <indexterm role="option">
64170 <primary><option>unseen</option></primary>
64171 </indexterm>
64172 However, this does not apply to multiple routers that result from the use of
64173 the <option>unseen</option> option. Any header modifications that were specified by the
64174 <quote>unseen</quote> router or its predecessors apply only to the <quote>unseen</quote> delivery.
64175 </para>
64176 <para>
64177 Addresses that end up with different <option>headers_add</option> or <option>headers_remove</option>
64178 settings cannot be delivered together in a batch, so a transport is always
64179 dealing with a set of addresses that have the same header-processing
64180 requirements.
64181 </para>
64182 <para>
64183 The transport starts by writing the original set of header lines that arrived
64184 with the message, possibly modified by the system filter. As it writes out
64185 these lines, it consults the list of header names that were attached to the
64186 recipient address(es) by <option>headers_remove</option> options in routers, and it also
64187 consults the transport&#x2019;s own <option>headers_remove</option> option. Header lines whose
64188 names are on either of these lists are not written out. If there are multiple
64189 instances of any listed header, they are all skipped.
64190 </para>
64191 <para>
64192 After the remaining original header lines have been written, new header
64193 lines that were specified by routers&#x2019; <option>headers_add</option> options are written, in
64194 the order in which they were attached to the address. These are followed by any
64195 header lines specified by the transport&#x2019;s <option>headers_add</option> option.
64196 </para>
64197 <para>
64198 This way of handling header line modifications in routers and transports has
64199 the following consequences:
64200 </para>
64201 <itemizedlist>
64202 <listitem>
64203 <para>
64204 The original set of header lines, possibly modified by the system filter,
64205 remains <quote>visible</quote>, in the sense that the <varname>$header_</varname><emphasis>xxx</emphasis> variables refer
64206 to it, at all times.
64207 </para>
64208 </listitem>
64209 <listitem>
64210 <para>
64211 Header lines that are added by a router&#x2019;s
64212 <option>headers_add</option> option are not accessible by means of the <varname>$header_</varname><emphasis>xxx</emphasis>
64213 expansion syntax in subsequent routers or the transport.
64214 </para>
64215 </listitem>
64216 <listitem>
64217 <para>
64218 Conversely, header lines that are specified for removal by <option>headers_remove</option>
64219 in a router remain visible to subsequent routers and the transport.
64220 </para>
64221 </listitem>
64222 <listitem>
64223 <para>
64224 Headers added to an address by <option>headers_add</option> in a router cannot be removed by
64225 a later router or by a transport.
64226 </para>
64227 </listitem>
64228 <listitem>
64229 <para>
64230 An added header can refer to the contents of an original header that is to be
64231 removed, even it has the same name as the added header. For example:
64232 </para>
64233 <literallayout class="monospaced">
64234 headers_remove = subject
64235 headers_add = Subject: new subject (was: $h_subject:)
64236 </literallayout>
64237 </listitem>
64238 </itemizedlist>
64239 <para>
64240 <emphasis role="bold">Warning</emphasis>: The <option>headers_add</option> and <option>headers_remove</option> options cannot be used
64241 for a <command>redirect</command> router that has the <option>one_time</option> option set.
64242 </para>
64243 </section>
64244 <section id="SECTconstr">
64245 <title>Constructed addresses</title>
64246 <para>
64247 <indexterm role="concept">
64248 <primary>address</primary>
64249 <secondary>constructed</secondary>
64250 </indexterm>
64251 <indexterm role="concept">
64252 <primary>constructed address</primary>
64253 </indexterm>
64254 When Exim constructs a sender address for a locally-generated message, it uses
64255 the form
64256 </para>
64257 <literallayout>
64258 &lt;<emphasis>user name</emphasis>&gt;&nbsp;&nbsp;&lt;<emphasis>login</emphasis><literal>@</literal><emphasis>qualify_domain</emphasis>&gt;
64259 </literallayout>
64260 <para>
64261 For example:
64262 </para>
64263 <literallayout class="monospaced">
64264 Zaphod Beeblebrox &lt;zaphod@end.univ.example&gt;
64265 </literallayout>
64266 <para>
64267 The user name is obtained from the <option>-F</option> command line option if set, or
64268 otherwise by looking up the calling user by <function>getpwuid()</function> and extracting the
64269 <quote>gecos</quote> field from the password entry. If the <quote>gecos</quote> field contains an
64270 ampersand character, this is replaced by the login name with the first letter
64271 upper cased, as is conventional in a number of operating systems. See the
64272 <option>gecos_name</option> option for a way to tailor the handling of the <quote>gecos</quote> field.
64273 The <option>unknown_username</option> option can be used to specify user names in cases when
64274 there is no password file entry.
64275 </para>
64276 <para>
64277 <indexterm role="concept">
64278 <primary>RFC 2047</primary>
64279 </indexterm>
64280 In all cases, the user name is made to conform to RFC 2822 by quoting all or
64281 parts of it if necessary. In addition, if it contains any non-printing
64282 characters, it is encoded as described in RFC 2047, which defines a way of
64283 including non-ASCII characters in header lines. The value of the
64284 <option>headers_charset</option> option specifies the name of the encoding that is used (the
64285 characters are assumed to be in this encoding). The setting of
64286 <option>print_topbitchars</option> controls whether characters with the top bit set (that
64287 is, with codes greater than 127) count as printing characters or not.
64288 </para>
64289 </section>
64290 <section id="SECID230">
64291 <title>Case of local parts</title>
64292 <para>
64293 <indexterm role="concept">
64294 <primary>case of local parts</primary>
64295 </indexterm>
64296 <indexterm role="concept">
64297 <primary>local part</primary>
64298 <secondary>case of</secondary>
64299 </indexterm>
64300 RFC 2822 states that the case of letters in the local parts of addresses cannot
64301 be assumed to be non-significant. Exim preserves the case of local parts of
64302 addresses, but by default it uses a lower-cased form when it is routing,
64303 because on most Unix systems, usernames are in lower case and case-insensitive
64304 routing is required. However, any particular router can be made to use the
64305 original case for local parts by setting the <option>caseful_local_part</option> generic
64306 router option.
64307 </para>
64308 <para>
64309 <indexterm role="concept">
64310 <primary>mixed-case login names</primary>
64311 </indexterm>
64312 If you must have mixed-case user names on your system, the best way to proceed,
64313 assuming you want case-independent handling of incoming email, is to set up
64314 your first router to convert incoming local parts in your domains to the
64315 correct case by means of a file lookup. For example:
64316 </para>
64317 <literallayout class="monospaced">
64318 correct_case:
64319   driver = redirect
64320   domains = +local_domains
64321   data = ${lookup{$local_part}cdb\
64322               {/etc/usercased.cdb}{$value}fail}\
64323               @$domain
64324 </literallayout>
64325 <para>
64326 For this router, the local part is forced to lower case by the default action
64327 (<option>caseful_local_part</option> is not set). The lower-cased local part is used to look
64328 up a new local part in the correct case. If you then set <option>caseful_local_part</option>
64329 on any subsequent routers which process your domains, they will operate on
64330 local parts with the correct case in a case-sensitive manner.
64331 </para>
64332 </section>
64333 <section id="SECID231">
64334 <title>Dots in local parts</title>
64335 <para>
64336 <indexterm role="concept">
64337 <primary>dot</primary>
64338 <secondary>in local part</secondary>
64339 </indexterm>
64340 <indexterm role="concept">
64341 <primary>local part</primary>
64342 <secondary>dots in</secondary>
64343 </indexterm>
64344 RFC 2822 forbids empty components in local parts. That is, an unquoted local
64345 part may not begin or end with a dot, nor have two consecutive dots in the
64346 middle. However, it seems that many MTAs do not enforce this, so Exim permits
64347 empty components for compatibility.
64348 </para>
64349 </section>
64350 <section id="SECID232">
64351 <title>Rewriting addresses</title>
64352 <para>
64353 <indexterm role="concept">
64354 <primary>rewriting</primary>
64355 <secondary>addresses</secondary>
64356 </indexterm>
64357 Rewriting of sender and recipient addresses, and addresses in headers, can
64358 happen automatically, or as the result of configuration options, as described
64359 in chapter <xref linkend="CHAPrewrite"/>. The headers that may be affected by this are
64360 <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>.
64361 </para>
64362 <para>
64363 Automatic rewriting includes qualification, as mentioned above. The other case
64364 in which it can happen is when an incomplete non-local domain is given. The
64365 routing process may cause this to be expanded into the full domain name. For
64366 example, a header such as
64367 </para>
64368 <literallayout class="monospaced">
64369 To: hare@teaparty
64370 </literallayout>
64371 <para>
64372 might get rewritten as
64373 </para>
64374 <literallayout class="monospaced">
64375 To: hare@teaparty.wonderland.fict.example
64376 </literallayout>
64377 <para>
64378 Rewriting as a result of routing is the one kind of message processing that
64379 does not happen at input time, as it cannot be done until the address has
64380 been routed.
64381 </para>
64382 <para>
64383 Strictly, one should not do <emphasis>any</emphasis> deliveries of a message until all its
64384 addresses have been routed, in case any of the headers get changed as a
64385 result of routing. However, doing this in practice would hold up many
64386 deliveries for unreasonable amounts of time, just because one address could not
64387 immediately be routed. Exim therefore does not delay other deliveries when
64388 routing of one or more addresses is deferred.
64389 <indexterm role="concept" startref="IIDmesproc" class="endofrange"/>
64390 </para>
64391 </section>
64392 </chapter>
64393
64394 <chapter id="CHAPSMTP">
64395 <title>SMTP processing</title>
64396 <para>
64397 <indexterm role="concept" id="IIDsmtpproc1" class="startofrange">
64398 <primary>SMTP</primary>
64399 <secondary>processing details</secondary>
64400 </indexterm>
64401 <indexterm role="concept" id="IIDsmtpproc2" class="startofrange">
64402 <primary>LMTP</primary>
64403 <secondary>processing details</secondary>
64404 </indexterm>
64405 Exim supports a number of different ways of using the SMTP protocol, and its
64406 LMTP variant, which is an interactive protocol for transferring messages into a
64407 closed mail store application. This chapter contains details of how SMTP is
64408 processed. For incoming mail, the following are available:
64409 </para>
64410 <itemizedlist>
64411 <listitem>
64412 <para>
64413 SMTP over TCP/IP (Exim daemon or <emphasis>inetd</emphasis>);
64414 </para>
64415 </listitem>
64416 <listitem>
64417 <para>
64418 SMTP over the standard input and output (the <option>-bs</option> option);
64419 </para>
64420 </listitem>
64421 <listitem>
64422 <para>
64423 Batched SMTP on the standard input (the <option>-bS</option> option).
64424 </para>
64425 </listitem>
64426 </itemizedlist>
64427 <para>
64428 For mail delivery, the following are available:
64429 </para>
64430 <itemizedlist>
64431 <listitem>
64432 <para>
64433 SMTP over TCP/IP (the <command>smtp</command> transport);
64434 </para>
64435 </listitem>
64436 <listitem>
64437 <para>
64438 LMTP over TCP/IP (the <command>smtp</command> transport with the <option>protocol</option> option set to
64439 <quote>lmtp</quote>);
64440 </para>
64441 </listitem>
64442 <listitem>
64443 <para>
64444 LMTP over a pipe to a process running in the local host (the <command>lmtp</command>
64445 transport);
64446 </para>
64447 </listitem>
64448 <listitem>
64449 <para>
64450 Batched SMTP to a file or pipe (the <command>appendfile</command> and <command>pipe</command> transports with
64451 the <option>use_bsmtp</option> option set).
64452 </para>
64453 </listitem>
64454 </itemizedlist>
64455 <para>
64456 <emphasis>Batched SMTP</emphasis> is the name for a process in which batches of messages are
64457 stored in or read from files (or pipes), in a format in which SMTP commands are
64458 used to contain the envelope information.
64459 </para>
64460 <section id="SECToutSMTPTCP">
64461 <title>Outgoing SMTP and LMTP over TCP/IP</title>
64462 <para>
64463 <indexterm role="concept">
64464 <primary>SMTP</primary>
64465 <secondary>outgoing over TCP/IP</secondary>
64466 </indexterm>
64467 <indexterm role="concept">
64468 <primary>outgoing SMTP over TCP/IP</primary>
64469 </indexterm>
64470 <indexterm role="concept">
64471 <primary>LMTP</primary>
64472 <secondary>over TCP/IP</secondary>
64473 </indexterm>
64474 <indexterm role="concept">
64475 <primary>outgoing LMTP over TCP/IP</primary>
64476 </indexterm>
64477 <indexterm role="concept">
64478 <primary>EHLO</primary>
64479 </indexterm>
64480 <indexterm role="concept">
64481 <primary>HELO</primary>
64482 </indexterm>
64483 <indexterm role="concept">
64484 <primary>SIZE option on MAIL command</primary>
64485 </indexterm>
64486 Outgoing SMTP and LMTP over TCP/IP is implemented by the <command>smtp</command> transport.
64487 The <option>protocol</option> option selects which protocol is to be used, but the actual
64488 processing is the same in both cases.
64489 </para>
64490 <para>
64491 If, in response to its EHLO command, Exim is told that the SIZE
64492 parameter is supported, it adds SIZE=&lt;<emphasis>n</emphasis>&gt; to each subsequent MAIL
64493 command. The value of &lt;<emphasis>n</emphasis>&gt; is the message size plus the value of the
64494 <option>size_addition</option> option (default 1024) to allow for additions to the message
64495 such as per-transport header lines, or changes made in a
64496 <indexterm role="concept">
64497 <primary>transport</primary>
64498 <secondary>filter</secondary>
64499 </indexterm>
64500 <indexterm role="concept">
64501 <primary>filter</primary>
64502 <secondary>transport filter</secondary>
64503 </indexterm>
64504 transport filter. If <option>size_addition</option> is set negative, the use of SIZE is
64505 suppressed.
64506 </para>
64507 <para>
64508 If the remote server advertises support for PIPELINING, Exim uses the
64509 pipelining extension to SMTP (RFC 2197) to reduce the number of TCP/IP packets
64510 required for the transaction.
64511 </para>
64512 <para>
64513 If the remote server advertises support for the STARTTLS command, and Exim
64514 was built to support TLS encryption, it tries to start a TLS session unless the
64515 server matches <option>hosts_avoid_tls</option>. See chapter <xref linkend="CHAPTLS"/> for more details.
64516 Either a match in that or <option>hosts_verify_avoid_tls</option> apply when the transport
64517 is called for verification.
64518 </para>
64519 <para>
64520 If the remote server advertises support for the AUTH command, Exim scans
64521 the authenticators configuration for any suitable client settings, as described
64522 in chapter <xref linkend="CHAPSMTPAUTH"/>.
64523 </para>
64524 <para>
64525 <indexterm role="concept">
64526 <primary>carriage return</primary>
64527 </indexterm>
64528 <indexterm role="concept">
64529 <primary>linefeed</primary>
64530 </indexterm>
64531 Responses from the remote host are supposed to be terminated by CR followed by
64532 LF. However, there are known to be hosts that do not send CR characters, so in
64533 order to be able to interwork with such hosts, Exim treats LF on its own as a
64534 line terminator.
64535 </para>
64536 <para>
64537 If a message contains a number of different addresses, all those with the same
64538 characteristics (for example, the same envelope sender) that resolve to the
64539 same set of hosts, in the same order, are sent in a single SMTP transaction,
64540 even if they are for different domains, unless there are more than the setting
64541 of the <option>max_rcpt</option>s option in the <command>smtp</command> transport allows, in which case
64542 they are split into groups containing no more than <option>max_rcpt</option>s addresses
64543 each. If <option>remote_max_parallel</option> is greater than one, such groups may be sent
64544 in parallel sessions. The order of hosts with identical MX values is not
64545 significant when checking whether addresses can be batched in this way.
64546 </para>
64547 <para>
64548 When the <command>smtp</command> transport suffers a temporary failure that is not
64549 message-related, Exim updates its transport-specific database, which contains
64550 records indexed by host name that remember which messages are waiting for each
64551 particular host. It also updates the retry database with new retry times.
64552 </para>
64553 <para>
64554 <indexterm role="concept">
64555 <primary>hints database</primary>
64556 <secondary>retry keys</secondary>
64557 </indexterm>
64558 Exim&#x2019;s retry hints are based on host name plus IP address, so if one address of
64559 a multi-homed host is broken, it will soon be skipped most of the time.
64560 See the next section for more detail about error handling.
64561 </para>
64562 <para>
64563 <indexterm role="concept">
64564 <primary>SMTP</primary>
64565 <secondary>passed connection</secondary>
64566 </indexterm>
64567 <indexterm role="concept">
64568 <primary>SMTP</primary>
64569 <secondary>batching over TCP/IP</secondary>
64570 </indexterm>
64571 When a message is successfully delivered over a TCP/IP SMTP connection, Exim
64572 looks in the hints database for the transport to see if there are any queued
64573 messages waiting for the host to which it is connected. If it finds one, it
64574 creates a new Exim process using the <option>-MC</option> option (which can only be used by
64575 a process running as root or the Exim user) and passes the TCP/IP socket to it
64576 so that it can deliver another message using the same socket. The new process
64577 does only those deliveries that are routed to the connected host, and may in
64578 turn pass the socket on to a third process, and so on.
64579 </para>
64580 <para>
64581 The <option>connection_max_messages</option> option of the <command>smtp</command> transport can be used to
64582 limit the number of messages sent down a single TCP/IP connection.
64583 </para>
64584 <para>
64585 <indexterm role="concept">
64586 <primary>asterisk</primary>
64587 <secondary>after IP address</secondary>
64588 </indexterm>
64589 The second and subsequent messages delivered down an existing connection are
64590 identified in the main log by the addition of an asterisk after the closing
64591 square bracket of the IP address.
64592 </para>
64593 </section>
64594 <section id="SECToutSMTPerr">
64595 <title>Errors in outgoing SMTP</title>
64596 <para>
64597 <indexterm role="concept">
64598 <primary>error</primary>
64599 <secondary>in outgoing SMTP</secondary>
64600 </indexterm>
64601 <indexterm role="concept">
64602 <primary>SMTP</primary>
64603 <secondary>errors in outgoing</secondary>
64604 </indexterm>
64605 <indexterm role="concept">
64606 <primary>host</primary>
64607 <secondary>error</secondary>
64608 </indexterm>
64609 Three different kinds of error are recognized for outgoing SMTP: host errors,
64610 message errors, and recipient errors.
64611 </para>
64612 <variablelist>
64613 <varlistentry>
64614 <term><emphasis role="bold">Host errors</emphasis></term>
64615 <listitem>
64616 <para>
64617 A host error is not associated with a particular message or with a
64618 particular recipient of a message. The host errors are:
64619 </para>
64620 <itemizedlist>
64621 <listitem>
64622 <para>
64623 Connection refused or timed out,
64624 </para>
64625 </listitem>
64626 <listitem>
64627 <para>
64628 Any error response code on connection,
64629 </para>
64630 </listitem>
64631 <listitem>
64632 <para>
64633 Any error response code to EHLO or HELO,
64634 </para>
64635 </listitem>
64636 <listitem>
64637 <para>
64638 Loss of connection at any time, except after <quote>.</quote>,
64639 </para>
64640 </listitem>
64641 <listitem>
64642 <para>
64643 I/O errors at any time,
64644 </para>
64645 </listitem>
64646 <listitem>
64647 <para>
64648 Timeouts during the session, other than in response to MAIL, RCPT or
64649 the <quote>.</quote> at the end of the data.
64650 </para>
64651 </listitem>
64652 </itemizedlist>
64653 <para>
64654 For a host error, a permanent error response on connection, or in response to
64655 EHLO, causes all addresses routed to the host to be failed. Any other host
64656 error causes all addresses to be deferred, and retry data to be created for the
64657 host. It is not tried again, for any message, until its retry time arrives. If
64658 the current set of addresses are not all delivered in this run (to some
64659 alternative host), the message is added to the list of those waiting for this
64660 host, so if it is still undelivered when a subsequent successful delivery is
64661 made to the host, it will be sent down the same SMTP connection.
64662 </para>
64663 </listitem></varlistentry>
64664 <varlistentry>
64665 <term><emphasis role="bold">Message errors</emphasis></term>
64666 <listitem>
64667 <para>
64668 <indexterm role="concept">
64669 <primary>message</primary>
64670 <secondary>error</secondary>
64671 </indexterm>
64672 A message error is associated with a particular message when sent to a
64673 particular host, but not with a particular recipient of the message. The
64674 message errors are:
64675 </para>
64676 <itemizedlist>
64677 <listitem>
64678 <para>
64679 Any error response code to MAIL, DATA, or the <quote>.</quote> that terminates
64680 the data,
64681 </para>
64682 </listitem>
64683 <listitem>
64684 <para>
64685 Timeout after MAIL,
64686 </para>
64687 </listitem>
64688 <listitem>
64689 <para>
64690 Timeout or loss of connection after the <quote>.</quote> that terminates the data. A
64691 timeout after the DATA command itself is treated as a host error, as is loss of
64692 connection at any other time.
64693 </para>
64694 </listitem>
64695 </itemizedlist>
64696 <para>
64697 For a message error, a permanent error response (5<emphasis>xx</emphasis>) causes all addresses
64698 to be failed, and a delivery error report to be returned to the sender. A
64699 temporary error response (4<emphasis>xx</emphasis>), or one of the timeouts, causes all
64700 addresses to be deferred. Retry data is not created for the host, but instead,
64701 a retry record for the combination of host plus message id is created. The
64702 message is not added to the list of those waiting for this host. This ensures
64703 that the failing message will not be sent to this host again until the retry
64704 time arrives. However, other messages that are routed to the host are not
64705 affected, so if it is some property of the message that is causing the error,
64706 it will not stop the delivery of other mail.
64707 </para>
64708 <para>
64709 If the remote host specified support for the SIZE parameter in its response
64710 to EHLO, Exim adds SIZE=<emphasis>nnn</emphasis> to the MAIL command, so an
64711 over-large message will cause a message error because the error arrives as a
64712 response to MAIL.
64713 </para>
64714 </listitem></varlistentry>
64715 <varlistentry>
64716 <term><emphasis role="bold">Recipient errors</emphasis></term>
64717 <listitem>
64718 <para>
64719 <indexterm role="concept">
64720 <primary>recipient</primary>
64721 <secondary>error</secondary>
64722 </indexterm>
64723 A recipient error is associated with a particular recipient of a message. The
64724 recipient errors are:
64725 </para>
64726 <itemizedlist>
64727 <listitem>
64728 <para>
64729 Any error response to RCPT,
64730 </para>
64731 </listitem>
64732 <listitem>
64733 <para>
64734 Timeout after RCPT.
64735 </para>
64736 </listitem>
64737 </itemizedlist>
64738 <para>
64739 For a recipient error, a permanent error response (5<emphasis>xx</emphasis>) causes the
64740 recipient address to be failed, and a bounce message to be returned to the
64741 sender. A temporary error response (4<emphasis>xx</emphasis>) or a timeout causes the failing
64742 address to be deferred, and routing retry data to be created for it. This is
64743 used to delay processing of the address in subsequent queue runs, until its
64744 routing retry time arrives. This applies to all messages, but because it
64745 operates only in queue runs, one attempt will be made to deliver a new message
64746 to the failing address before the delay starts to operate. This ensures that,
64747 if the failure is really related to the message rather than the recipient
64748 (<quote>message too big for this recipient</quote> is a possible example), other messages
64749 have a chance of getting delivered. If a delivery to the address does succeed,
64750 the retry information gets cleared, so all stuck messages get tried again, and
64751 the retry clock is reset.
64752 </para>
64753 <para>
64754 The message is not added to the list of those waiting for this host. Use of the
64755 host for other messages is unaffected, and except in the case of a timeout,
64756 other recipients are processed independently, and may be successfully delivered
64757 in the current SMTP session. After a timeout it is of course impossible to
64758 proceed with the session, so all addresses get deferred. However, those other
64759 than the one that failed do not suffer any subsequent retry delays. Therefore,
64760 if one recipient is causing trouble, the others have a chance of getting
64761 through when a subsequent delivery attempt occurs before the failing
64762 recipient&#x2019;s retry time.
64763 </para>
64764 </listitem></varlistentry>
64765 </variablelist>
64766 <para>
64767 In all cases, if there are other hosts (or IP addresses) available for the
64768 current set of addresses (for example, from multiple MX records), they are
64769 tried in this run for any undelivered addresses, subject of course to their
64770 own retry data. In other words, recipient error retry data does not take effect
64771 until the next delivery attempt.
64772 </para>
64773 <para>
64774 Some hosts have been observed to give temporary error responses to every
64775 MAIL command at certain times (<quote>insufficient space</quote> has been seen). It
64776 would be nice if such circumstances could be recognized, and defer data for the
64777 host itself created, but this is not possible within the current Exim design.
64778 What actually happens is that retry data for every (host, message) combination
64779 is created.
64780 </para>
64781 <para>
64782 The reason that timeouts after MAIL and RCPT are treated specially is that
64783 these can sometimes arise as a result of the remote host&#x2019;s verification
64784 procedures. Exim makes this assumption, and treats them as if a temporary error
64785 response had been received. A timeout after <quote>.</quote> is treated specially because
64786 it is known that some broken implementations fail to recognize the end of the
64787 message if the last character of the last line is a binary zero. Thus, it is
64788 helpful to treat this case as a message error.
64789 </para>
64790 <para>
64791 Timeouts at other times are treated as host errors, assuming a problem with the
64792 host, or the connection to it. If a timeout after MAIL, RCPT,
64793 or <quote>.</quote> is really a connection problem, the assumption is that at the next try
64794 the timeout is likely to occur at some other point in the dialogue, causing it
64795 then to be treated as a host error.
64796 </para>
64797 <para>
64798 There is experimental evidence that some MTAs drop the connection after the
64799 terminating <quote>.</quote> if they do not like the contents of the message for some
64800 reason, in contravention of the RFC, which indicates that a 5<emphasis>xx</emphasis> response
64801 should be given. That is why Exim treats this case as a message rather than a
64802 host error, in order not to delay other messages to the same host.
64803 </para>
64804 </section>
64805 <section id="SECID233">
64806 <title>Incoming SMTP messages over TCP/IP</title>
64807 <para>
64808 <indexterm role="concept">
64809 <primary>SMTP</primary>
64810 <secondary>incoming over TCP/IP</secondary>
64811 </indexterm>
64812 <indexterm role="concept">
64813 <primary>incoming SMTP over TCP/IP</primary>
64814 </indexterm>
64815 <indexterm role="concept">
64816 <primary>inetd</primary>
64817 </indexterm>
64818 <indexterm role="concept">
64819 <primary>daemon</primary>
64820 </indexterm>
64821 Incoming SMTP messages can be accepted in one of two ways: by running a
64822 listening daemon, or by using <emphasis>inetd</emphasis>. In the latter case, the entry in
64823 <filename>/etc/inetd.conf</filename> should be like this:
64824 </para>
64825 <literallayout class="monospaced">
64826 smtp stream tcp nowait exim /opt/exim/bin/exim in.exim -bs
64827 </literallayout>
64828 <para>
64829 Exim distinguishes between this case and the case of a locally running user
64830 agent using the <option>-bs</option> option by checking whether or not the standard input is
64831 a socket. When it is, either the port must be privileged (less than 1024), or
64832 the caller must be root or the Exim user. If any other user passes a socket
64833 with an unprivileged port number, Exim prints a message on the standard error
64834 stream and exits with an error code.
64835 </para>
64836 <para>
64837 By default, Exim does not make a log entry when a remote host connects or
64838 disconnects (either via the daemon or <emphasis>inetd</emphasis>), unless the disconnection is
64839 unexpected. It can be made to write such log entries by setting the
64840 <option>smtp_connection</option> log selector.
64841 </para>
64842 <para>
64843 <indexterm role="concept">
64844 <primary>carriage return</primary>
64845 </indexterm>
64846 <indexterm role="concept">
64847 <primary>linefeed</primary>
64848 </indexterm>
64849 Commands from the remote host are supposed to be terminated by CR followed by
64850 LF. However, there are known to be hosts that do not send CR characters. In
64851 order to be able to interwork with such hosts, Exim treats LF on its own as a
64852 line terminator.
64853 Furthermore, because common code is used for receiving messages from all
64854 sources, a CR on its own is also interpreted as a line terminator. However, the
64855 sequence <quote>CR, dot, CR</quote> does not terminate incoming SMTP data.
64856 </para>
64857 <para>
64858 <indexterm role="concept">
64859 <primary>EHLO</primary>
64860 <secondary>invalid data</secondary>
64861 </indexterm>
64862 <indexterm role="concept">
64863 <primary>HELO</primary>
64864 <secondary>invalid data</secondary>
64865 </indexterm>
64866 One area that sometimes gives rise to problems concerns the EHLO or
64867 HELO commands. Some clients send syntactically invalid versions of these
64868 commands, which Exim rejects by default. (This is nothing to do with verifying
64869 the data that is sent, so <option>helo_verify_hosts</option> is not relevant.) You can tell
64870 Exim not to apply a syntax check by setting <option>helo_accept_junk_hosts</option> to
64871 match the broken hosts that send invalid commands.
64872 </para>
64873 <para>
64874 <indexterm role="concept">
64875 <primary>SIZE option on MAIL command</primary>
64876 </indexterm>
64877 <indexterm role="concept">
64878 <primary>MAIL</primary>
64879 <secondary>SIZE option</secondary>
64880 </indexterm>
64881 The amount of disk space available is checked whenever SIZE is received on
64882 a MAIL command, independently of whether <option>message_size_limit</option> or
64883 <option>check_spool_space</option> is configured, unless <option>smtp_check_spool_space</option> is set
64884 false. A temporary error is given if there is not enough space. If
64885 <option>check_spool_space</option> is set, the check is for that amount of space plus the
64886 value given with SIZE, that is, it checks that the addition of the incoming
64887 message will not reduce the space below the threshold.
64888 </para>
64889 <para>
64890 When a message is successfully received, Exim includes the local message id in
64891 its response to the final <quote>.</quote> that terminates the data. If the remote host
64892 logs this text it can help with tracing what has happened to a message.
64893 </para>
64894 <para>
64895 The Exim daemon can limit the number of simultaneous incoming connections it is
64896 prepared to handle (see the <option>smtp_accept_max</option> option). It can also limit the
64897 number of simultaneous incoming connections from a single remote host (see the
64898 <option>smtp_accept_max_per_host</option> option). Additional connection attempts are
64899 rejected using the SMTP temporary error code 421.
64900 </para>
64901 <para>
64902 The Exim daemon does not rely on the SIGCHLD signal to detect when a
64903 subprocess has finished, as this can get lost at busy times. Instead, it looks
64904 for completed subprocesses every time it wakes up. Provided there are other
64905 things happening (new incoming calls, starts of queue runs), completed
64906 processes will be noticed and tidied away. On very quiet systems you may
64907 sometimes see a <quote>defunct</quote> Exim process hanging about. This is not a problem;
64908 it will be noticed when the daemon next wakes up.
64909 </para>
64910 <para>
64911 When running as a daemon, Exim can reserve some SMTP slots for specific hosts,
64912 and can also be set up to reject SMTP calls from non-reserved hosts at times of
64913 high system load &ndash; for details see the <option>smtp_accept_reserve</option>,
64914 <option>smtp_load_reserve</option>, and <option>smtp_reserve_hosts</option> options. The load check
64915 applies in both the daemon and <emphasis>inetd</emphasis> cases.
64916 </para>
64917 <para>
64918 Exim normally starts a delivery process for each message received, though this
64919 can be varied by means of the <option>-odq</option> command line option and the
64920 <option>queue_only</option>, <option>queue_only_file</option>, and <option>queue_only_load</option> options. The
64921 number of simultaneously running delivery processes started in this way from
64922 SMTP input can be limited by the <option>smtp_accept_queue</option> and
64923 <option>smtp_accept_queue_per_connection</option> options. When either limit is reached,
64924 subsequently received messages are just put on the input queue without starting
64925 a delivery process.
64926 </para>
64927 <para>
64928 The controls that involve counts of incoming SMTP calls (<option>smtp_accept_max</option>,
64929 <option>smtp_accept_queue</option>, <option>smtp_accept_reserve</option>) are not available when Exim is
64930 started up from the <emphasis>inetd</emphasis> daemon, because in that case each connection is
64931 handled by an entirely independent Exim process. Control by load average is,
64932 however, available with <emphasis>inetd</emphasis>.
64933 </para>
64934 <para>
64935 Exim can be configured to verify addresses in incoming SMTP commands as they
64936 are received. See chapter <xref linkend="CHAPACL"/> for details. It can also be configured
64937 to rewrite addresses at this time &ndash; before any syntax checking is done. See
64938 section <xref linkend="SECTrewriteS"/>.
64939 </para>
64940 <para>
64941 Exim can also be configured to limit the rate at which a client host submits
64942 MAIL and RCPT commands in a single SMTP session. See the
64943 <option>smtp_ratelimit_hosts</option> option.
64944 </para>
64945 </section>
64946 <section id="SECID234">
64947 <title>Unrecognized SMTP commands</title>
64948 <para>
64949 <indexterm role="concept">
64950 <primary>SMTP</primary>
64951 <secondary>unrecognized commands</secondary>
64952 </indexterm>
64953 If Exim receives more than <option>smtp_max_unknown_commands</option> unrecognized SMTP
64954 commands during a single SMTP connection, it drops the connection after sending
64955 the error response to the last command. The default value for
64956 <option>smtp_max_unknown_commands</option> is 3. This is a defence against some kinds of
64957 abuse that subvert web servers into making connections to SMTP ports; in these
64958 circumstances, a number of non-SMTP lines are sent first.
64959 </para>
64960 </section>
64961 <section id="SECID235">
64962 <title>Syntax and protocol errors in SMTP commands</title>
64963 <para>
64964 <indexterm role="concept">
64965 <primary>SMTP</primary>
64966 <secondary>syntax errors</secondary>
64967 </indexterm>
64968 <indexterm role="concept">
64969 <primary>SMTP</primary>
64970 <secondary>protocol errors</secondary>
64971 </indexterm>
64972 A syntax error is detected if an SMTP command is recognized, but there is
64973 something syntactically wrong with its data, for example, a malformed email
64974 address in a RCPT command. Protocol errors include invalid command
64975 sequencing such as RCPT before MAIL. If Exim receives more than
64976 <option>smtp_max_synprot_errors</option> such commands during a single SMTP connection, it
64977 drops the connection after sending the error response to the last command. The
64978 default value for <option>smtp_max_synprot_errors</option> is 3. This is a defence against
64979 broken clients that loop sending bad commands (yes, it has been seen).
64980 </para>
64981 </section>
64982 <section id="SECID236">
64983 <title>Use of non-mail SMTP commands</title>
64984 <para>
64985 <indexterm role="concept">
64986 <primary>SMTP</primary>
64987 <secondary>non-mail commands</secondary>
64988 </indexterm>
64989 The <quote>non-mail</quote> SMTP commands are those other than MAIL, RCPT, and
64990 DATA. Exim counts such commands, and drops the connection if there are too
64991 many of them in a single SMTP session. This action catches some
64992 denial-of-service attempts and things like repeated failing AUTHs, or a mad
64993 client looping sending EHLO. The global option <option>smtp_accept_max_nonmail</option>
64994 defines what <quote>too many</quote> means. Its default value is 10.
64995 </para>
64996 <para>
64997 When a new message is expected, one occurrence of RSET is not counted. This
64998 allows a client to send one RSET between messages (this is not necessary,
64999 but some clients do it). Exim also allows one uncounted occurrence of HELO
65000 or EHLO, and one occurrence of STARTTLS between messages. After
65001 starting up a TLS session, another EHLO is expected, and so it too is not
65002 counted.
65003 </para>
65004 <para>
65005 The first occurrence of AUTH in a connection, or immediately following
65006 STARTTLS is also not counted. Otherwise, all commands other than MAIL,
65007 RCPT, DATA, and QUIT are counted.
65008 </para>
65009 <para>
65010 You can control which hosts are subject to the limit set by
65011 <option>smtp_accept_max_nonmail</option> by setting
65012 <option>smtp_accept_max_nonmail_hosts</option>. The default value is <literal>*</literal>, which makes
65013 the limit apply to all hosts. This option means that you can exclude any
65014 specific badly-behaved hosts that you have to live with.
65015 </para>
65016 </section>
65017 <section id="SECID237">
65018 <title>The VRFY and EXPN commands</title>
65019 <para>
65020 When Exim receives a VRFY or EXPN command on a TCP/IP connection, it
65021 runs the ACL specified by <option>acl_smtp_vrfy</option> or <option>acl_smtp_expn</option> (as
65022 appropriate) in order to decide whether the command should be accepted or not.
65023 </para>
65024 <para>
65025 <indexterm role="concept">
65026 <primary>VRFY</primary>
65027 <secondary>processing</secondary>
65028 </indexterm>
65029 When no ACL is defined for VRFY, or if it rejects without
65030 setting an explicit response code, the command is accepted
65031 (with a 252 SMTP response code)
65032 in order to support awkward clients that do a VRFY before every RCPT.
65033 When VRFY is accepted, it runs exactly the same code as when Exim is
65034 called with the <option>-bv</option> option, and returns 250/451/550
65035 SMTP response codes.
65036 </para>
65037 <para>
65038 <indexterm role="concept">
65039 <primary>EXPN</primary>
65040 <secondary>processing</secondary>
65041 </indexterm>
65042 If no ACL for EXPN is defined, the command is rejected.
65043 When EXPN is accepted, a single-level expansion of the address is done.
65044 EXPN is treated as an <quote>address test</quote> (similar to the <option>-bt</option> option) rather
65045 than a verification (the <option>-bv</option> option). If an unqualified local part is given
65046 as the argument to EXPN, it is qualified with <option>qualify_domain</option>. Rejections
65047 of VRFY and EXPN commands are logged on the main and reject logs, and
65048 VRFY verification failures are logged on the main log for consistency with
65049 RCPT failures.
65050 </para>
65051 </section>
65052 <section id="SECTETRN">
65053 <title>The ETRN command</title>
65054 <para>
65055 <indexterm role="concept">
65056 <primary>ETRN</primary>
65057 <secondary>processing</secondary>
65058 </indexterm>
65059 RFC 1985 describes an SMTP command called ETRN that is designed to
65060 overcome the security problems of the TURN command (which has fallen into
65061 disuse). When Exim receives an ETRN command on a TCP/IP connection, it runs
65062 the ACL specified by <option>acl_smtp_etrn</option> in order to decide whether the command
65063 should be accepted or not. If no ACL is defined, the command is rejected.
65064 </para>
65065 <para>
65066 The ETRN command is concerned with <quote>releasing</quote> messages that are awaiting
65067 delivery to certain hosts. As Exim does not organize its message queue by host,
65068 the only form of ETRN that is supported by default is the one where the
65069 text starts with the <quote>#</quote> prefix, in which case the remainder of the text is
65070 specific to the SMTP server. A valid ETRN command causes a run of Exim with
65071 the <option>-R</option> option to happen, with the remainder of the ETRN text as its
65072 argument. For example,
65073 </para>
65074 <literallayout class="monospaced">
65075 ETRN #brigadoon
65076 </literallayout>
65077 <para>
65078 runs the command
65079 </para>
65080 <literallayout class="monospaced">
65081 exim -R brigadoon
65082 </literallayout>
65083 <para>
65084 which causes a delivery attempt on all messages with undelivered addresses
65085 containing the text <quote>brigadoon</quote>. When <option>smtp_etrn_serialize</option> is set (the
65086 default), Exim prevents the simultaneous execution of more than one queue run
65087 for the same argument string as a result of an ETRN command. This stops
65088 a misbehaving client from starting more than one queue runner at once.
65089 </para>
65090 <para>
65091 <indexterm role="concept">
65092 <primary>hints database</primary>
65093 <secondary>ETRN serialization</secondary>
65094 </indexterm>
65095 Exim implements the serialization by means of a hints database in which a
65096 record is written whenever a process is started by ETRN, and deleted when
65097 the process completes. However, Exim does not keep the SMTP session waiting for
65098 the ETRN process to complete. Once ETRN is accepted, the client is sent
65099 a <quote>success</quote> return code. Obviously there is scope for hints records to get
65100 left lying around if there is a system or program crash. To guard against this,
65101 Exim ignores any records that are more than six hours old.
65102 </para>
65103 <para>
65104 <indexterm role="option">
65105 <primary><option>smtp_etrn_command</option></primary>
65106 </indexterm>
65107 For more control over what ETRN does, the <option>smtp_etrn_command</option> option can
65108 used. This specifies a command that is run whenever ETRN is received,
65109 whatever the form of its argument. For
65110 example:
65111 </para>
65112 <literallayout class="monospaced">
65113 smtp_etrn_command = /etc/etrn_command $domain \
65114                     $sender_host_address
65115 </literallayout>
65116 <para>
65117 <indexterm role="variable">
65118 <primary><varname>$domain</varname></primary>
65119 </indexterm>
65120 The string is split up into arguments which are independently expanded. The
65121 expansion variable <varname>$domain</varname> is set to the argument of the ETRN command,
65122 and no syntax checking is done on the contents of this argument. Exim does not
65123 wait for the command to complete, so its status code is not checked. Exim runs
65124 under its own uid and gid when receiving incoming SMTP, so it is not possible
65125 for it to change them before running the command.
65126 </para>
65127 </section>
65128 <section id="SECID238">
65129 <title>Incoming local SMTP</title>
65130 <para>
65131 <indexterm role="concept">
65132 <primary>SMTP</primary>
65133 <secondary>local incoming</secondary>
65134 </indexterm>
65135 Some user agents use SMTP to pass messages to their local MTA using the
65136 standard input and output, as opposed to passing the envelope on the command
65137 line and writing the message to the standard input. This is supported by the
65138 <option>-bs</option> option. This form of SMTP is handled in the same way as incoming
65139 messages over TCP/IP (including the use of ACLs), except that the envelope
65140 sender given in a MAIL command is ignored unless the caller is trusted. In
65141 an ACL you can detect this form of SMTP input by testing for an empty host
65142 identification. It is common to have this as the first line in the ACL that
65143 runs for RCPT commands:
65144 </para>
65145 <literallayout class="monospaced">
65146 accept hosts = :
65147 </literallayout>
65148 <para>
65149 This accepts SMTP messages from local processes without doing any other tests.
65150 </para>
65151 </section>
65152 <section id="SECTbatchSMTP">
65153 <title>Outgoing batched SMTP</title>
65154 <para>
65155 <indexterm role="concept">
65156 <primary>SMTP</primary>
65157 <secondary>batched outgoing</secondary>
65158 </indexterm>
65159 <indexterm role="concept">
65160 <primary>batched SMTP output</primary>
65161 </indexterm>
65162 Both the <command>appendfile</command> and <command>pipe</command> transports can be used for handling
65163 batched SMTP. Each has an option called <option>use_bsmtp</option> which causes messages to
65164 be output in BSMTP format. No SMTP responses are possible for this form of
65165 delivery. All it is doing is using SMTP commands as a way of transmitting the
65166 envelope along with the message.
65167 </para>
65168 <para>
65169 The message is written to the file or pipe preceded by the SMTP commands
65170 MAIL and RCPT, and followed by a line containing a single dot. Lines in
65171 the message that start with a dot have an extra dot added. The SMTP command
65172 HELO is not normally used. If it is required, the <option>message_prefix</option> option
65173 can be used to specify it.
65174 </para>
65175 <para>
65176 Because <command>appendfile</command> and <command>pipe</command> are both local transports, they accept only
65177 one recipient address at a time by default. However, you can arrange for them
65178 to handle several addresses at once by setting the <option>batch_max</option> option. When
65179 this is done for BSMTP, messages may contain multiple RCPT commands. See
65180 chapter <xref linkend="CHAPbatching"/> for more details.
65181 </para>
65182 <para>
65183 <indexterm role="variable">
65184 <primary><varname>$host</varname></primary>
65185 </indexterm>
65186 When one or more addresses are routed to a BSMTP transport by a router that
65187 sets up a host list, the name of the first host on the list is available to the
65188 transport in the variable <varname>$host</varname>. Here is an example of such a transport and
65189 router:
65190 </para>
65191 <literallayout class="monospaced">
65192 begin routers
65193 route_append:
65194   driver = manualroute
65195   transport = smtp_appendfile
65196   route_list = domain.example  batch.host.example
65197
65198 begin transports
65199 smtp_appendfile:
65200   driver = appendfile
65201   directory = /var/bsmtp/$host
65202   batch_max = 1000
65203   use_bsmtp
65204   user = exim
65205 </literallayout>
65206 <para>
65207 This causes messages addressed to <emphasis>domain.example</emphasis> to be written in BSMTP
65208 format to <filename>/var/bsmtp/batch.host.example</filename>, with only a single copy of each
65209 message (unless there are more than 1000 recipients).
65210 </para>
65211 </section>
65212 <section id="SECTincomingbatchedSMTP">
65213 <title>Incoming batched SMTP</title>
65214 <para>
65215 <indexterm role="concept">
65216 <primary>SMTP</primary>
65217 <secondary>batched incoming</secondary>
65218 </indexterm>
65219 <indexterm role="concept">
65220 <primary>batched SMTP input</primary>
65221 </indexterm>
65222 The <option>-bS</option> command line option causes Exim to accept one or more messages by
65223 reading SMTP on the standard input, but to generate no responses. If the caller
65224 is trusted, the senders in the MAIL commands are believed; otherwise the
65225 sender is always the caller of Exim. Unqualified senders and receivers are not
65226 rejected (there seems little point) but instead just get qualified. HELO
65227 and EHLO act as RSET; VRFY, EXPN, ETRN and  HELP, act
65228 as NOOP; QUIT quits.
65229 </para>
65230 <para>
65231 Minimal policy checking is done for BSMTP input. Only the non-SMTP
65232 ACL is run in the same way as for non-SMTP local input.
65233 </para>
65234 <para>
65235 If an error is detected while reading a message, including a missing <quote>.</quote> at
65236 the end, Exim gives up immediately. It writes details of the error to the
65237 standard output in a stylized way that the calling program should be able to
65238 make some use of automatically, for example:
65239 </para>
65240 <literallayout class="monospaced">
65241 554 Unexpected end of file
65242 Transaction started in line 10
65243 Error detected in line 14
65244 </literallayout>
65245 <para>
65246 It writes a more verbose version, for human consumption, to the standard error
65247 file, for example:
65248 </para>
65249 <literallayout class="monospaced">
65250 An error was detected while processing a file of BSMTP input.
65251 The error message was:
65252
65253 501 '&gt;' missing at end of address
65254
65255 The SMTP transaction started in line 10.
65256 The error was detected in line 12.
65257 The SMTP command at fault was:
65258
65259 rcpt to:&lt;malformed@in.com.plete
65260
65261 1 previous message was successfully processed.
65262 The rest of the batch was abandoned.
65263 </literallayout>
65264 <para>
65265 The return code from Exim is zero only if there were no errors. It is 1 if some
65266 messages were accepted before an error was detected, and 2 if no messages were
65267 accepted.
65268 <indexterm role="concept" startref="IIDsmtpproc1" class="endofrange"/>
65269 <indexterm role="concept" startref="IIDsmtpproc2" class="endofrange"/>
65270 </para>
65271 </section>
65272 </chapter>
65273
65274 <chapter id="CHAPemsgcust">
65275 <title>Customizing bounce and warning messages</title>
65276 <titleabbrev>Customizing messages</titleabbrev>
65277 <para>
65278 When a message fails to be delivered, or remains in the queue for more than a
65279 configured amount of time, Exim sends a message to the original sender, or
65280 to an alternative configured address. The text of these messages is built into
65281 the code of Exim, but it is possible to change it, either by adding a single
65282 string, or by replacing each of the paragraphs by text supplied in a file.
65283 </para>
65284 <para>
65285 The <emphasis>From:</emphasis> and <emphasis>To:</emphasis> header lines are automatically generated; you can
65286 cause a <emphasis>Reply-To:</emphasis> line to be added by setting the <option>errors_reply_to</option>
65287 option. Exim also adds the line
65288 </para>
65289 <literallayout class="monospaced">
65290 Auto-Submitted: auto-generated
65291 </literallayout>
65292 <para>
65293 to all warning and bounce messages,
65294 </para>
65295 <section id="SECID239">
65296 <title>Customizing bounce messages</title>
65297 <para>
65298 <indexterm role="concept">
65299 <primary>customizing</primary>
65300 <secondary>bounce message</secondary>
65301 </indexterm>
65302 <indexterm role="concept">
65303 <primary>bounce message</primary>
65304 <secondary>customizing</secondary>
65305 </indexterm>
65306 If <option>bounce_message_text</option> is set, its contents are included in the default
65307 message immediately after <quote>This message was created automatically by mail
65308 delivery software.</quote> The string is not expanded. It is not used if
65309 <option>bounce_message_file</option> is set.
65310 </para>
65311 <para>
65312 When <option>bounce_message_file</option> is set, it must point to a template file for
65313 constructing error messages. The file consists of a series of text items,
65314 separated by lines consisting of exactly four asterisks. If the file cannot be
65315 opened, default text is used and a message is written to the main and panic
65316 logs. If any text item in the file is empty, default text is used for that
65317 item.
65318 </para>
65319 <para>
65320 <indexterm role="variable">
65321 <primary><varname>$bounce_recipient</varname></primary>
65322 </indexterm>
65323 <indexterm role="variable">
65324 <primary><varname>$bounce_return_size_limit</varname></primary>
65325 </indexterm>
65326 Each item of text that is read from the file is expanded, and there are two
65327 expansion variables which can be of use here: <varname>$bounce_recipient</varname> is set to
65328 the recipient of an error message while it is being created, and
65329 <varname>$bounce_return_size_limit</varname> contains the value of the <option>return_size_limit</option>
65330 option, rounded to a whole number.
65331 </para>
65332 <para>
65333 The items must appear in the file in the following order:
65334 </para>
65335 <itemizedlist>
65336 <listitem>
65337 <para>
65338 The first item is included in the headers, and should include at least a
65339 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
65340 </para>
65341 </listitem>
65342 <listitem>
65343 <para>
65344 The second item forms the start of the error message. After it, Exim lists the
65345 failing addresses with their error messages.
65346 </para>
65347 </listitem>
65348 <listitem>
65349 <para>
65350 The third item is used to introduce any text from pipe transports that is to be
65351 returned to the sender. It is omitted if there is no such text.
65352 </para>
65353 </listitem>
65354 <listitem>
65355 <para>
65356 The fourth, fifth and sixth items will be ignored and may be empty.
65357 The fields exist for back-compatibility
65358 </para>
65359 </listitem>
65360 </itemizedlist>
65361 <para>
65362 The default state (<option>bounce_message_file</option> unset) is equivalent to the
65363 following file, in which the sixth item is empty. The <emphasis>Subject:</emphasis> and some
65364 other lines have been split in order to fit them on the page:
65365 </para>
65366 <literallayout class="monospaced">
65367 Subject: Mail delivery failed
65368   ${if eq{$sender_address}{$bounce_recipient}
65369   {: returning message to sender}}
65370 ****
65371 This message was created automatically by mail delivery software.
65372
65373 A message ${if eq{$sender_address}{$bounce_recipient}
65374   {that you sent }{sent by
65375
65376 &lt;$sender_address&gt;
65377
65378 }}could not be delivered to all of its recipients.
65379 This is a permanent error. The following address(es) failed:
65380 ****
65381 The following text was generated during the delivery attempt(s):
65382 ****
65383 ------ This is a copy of the message, including all the headers.
65384   ------
65385 ****
65386 ------ The body of the message is $message_size characters long;
65387   only the first
65388 ------ $bounce_return_size_limit or so are included here.
65389 ****
65390 </literallayout>
65391 </section>
65392 <section id="SECTcustwarn">
65393 <title>Customizing warning messages</title>
65394 <para>
65395 <indexterm role="concept">
65396 <primary>customizing</primary>
65397 <secondary>warning message</secondary>
65398 </indexterm>
65399 <indexterm role="concept">
65400 <primary>warning of delay</primary>
65401 <secondary>customizing the message</secondary>
65402 </indexterm>
65403 The option <option>warn_message_file</option> can be pointed at a template file for use when
65404 warnings about message delays are created. In this case there are only three
65405 text sections:
65406 </para>
65407 <itemizedlist>
65408 <listitem>
65409 <para>
65410 The first item is included in the headers, and should include at least a
65411 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
65412 </para>
65413 </listitem>
65414 <listitem>
65415 <para>
65416 The second item forms the start of the warning message. After it, Exim lists
65417 the delayed addresses.
65418 </para>
65419 </listitem>
65420 <listitem>
65421 <para>
65422 The third item then ends the message.
65423 </para>
65424 </listitem>
65425 </itemizedlist>
65426 <para>
65427 The default state is equivalent to the following file, except that some lines
65428 have been split here, in order to fit them on the page:
65429 </para>
65430 <literallayout class="monospaced">
65431 Subject: Warning: message $message_exim_id delayed
65432   $warn_message_delay
65433 ****
65434 This message was created automatically by mail delivery software.
65435
65436 A message ${if eq{$sender_address}{$warn_message_recipients}
65437 {that you sent }{sent by
65438
65439 &lt;$sender_address&gt;
65440
65441 }}has not been delivered to all of its recipients after
65442 more than $warn_message_delay in the queue on $primary_hostname.
65443
65444 The message identifier is:     $message_exim_id
65445 The subject of the message is: $h_subject
65446 The date of the message is:    $h_date
65447
65448 The following address(es) have not yet been delivered:
65449 ****
65450 No action is required on your part. Delivery attempts will
65451 continue for some time, and this warning may be repeated at
65452 intervals if the message remains undelivered. Eventually the
65453 mail delivery software will give up, and when that happens,
65454 the message will be returned to you.
65455 </literallayout>
65456 <para>
65457 <indexterm role="variable">
65458 <primary><varname>$warn_message_delay</varname></primary>
65459 </indexterm>
65460 <indexterm role="variable">
65461 <primary><varname>$warn_message_recipients</varname></primary>
65462 </indexterm>
65463 However, in the default state the subject and date lines are omitted if no
65464 appropriate headers exist. During the expansion of this file,
65465 <varname>$warn_message_delay</varname> is set to the delay time in one of the forms <quote>&lt;<emphasis>n</emphasis>&gt;
65466 minutes</quote> or <quote>&lt;<emphasis>n</emphasis>&gt; hours</quote>, and <varname>$warn_message_recipients</varname> contains a list
65467 of recipients for the warning message. There may be more than one if there are
65468 multiple addresses with different <option>errors_to</option> settings on the routers that
65469 handled them.
65470 </para>
65471 </section>
65472 </chapter>
65473
65474 <chapter id="CHAPcomconreq">
65475 <title>Some common configuration settings</title>
65476 <para>
65477 This chapter discusses some configuration settings that seem to be fairly
65478 common. More examples and discussion can be found in the Exim book.
65479 </para>
65480 <section id="SECID240">
65481 <title>Sending mail to a smart host</title>
65482 <para>
65483 <indexterm role="concept">
65484 <primary>smart host</primary>
65485 <secondary>example router</secondary>
65486 </indexterm>
65487 If you want to send all mail for non-local domains to a <quote>smart host</quote>, you
65488 should replace the default <command>dnslookup</command> router with a router which does the
65489 routing explicitly:
65490 </para>
65491 <literallayout class="monospaced">
65492 send_to_smart_host:
65493   driver = manualroute
65494   route_list = !+local_domains smart.host.name
65495   transport = remote_smtp
65496 </literallayout>
65497 <para>
65498 You can use the smart host&#x2019;s IP address instead of the name if you wish.
65499 If you are using Exim only to submit messages to a smart host, and not for
65500 receiving incoming messages, you can arrange for it to do the submission
65501 synchronously by setting the <option>mua_wrapper</option> option (see chapter
65502 <xref linkend="CHAPnonqueueing"/>).
65503 </para>
65504 </section>
65505 <section id="SECTmailinglists">
65506 <title>Using Exim to handle mailing lists</title>
65507 <para>
65508 <indexterm role="concept">
65509 <primary>mailing lists</primary>
65510 </indexterm>
65511 Exim can be used to run simple mailing lists, but for large and/or complicated
65512 requirements, the use of additional specialized mailing list software such as
65513 Majordomo or Mailman is recommended.
65514 </para>
65515 <para>
65516 The <command>redirect</command> router can be used to handle mailing lists where each list
65517 is maintained in a separate file, which can therefore be managed by an
65518 independent manager. The <option>domains</option> router option can be used to run these
65519 lists in a separate domain from normal mail. For example:
65520 </para>
65521 <literallayout class="monospaced">
65522 lists:
65523   driver = redirect
65524   domains = lists.example
65525   file = /usr/lists/$local_part
65526   forbid_pipe
65527   forbid_file
65528   errors_to = $local_part-request@lists.example
65529   no_more
65530 </literallayout>
65531 <para>
65532 This router is skipped for domains other than <emphasis>lists.example</emphasis>. For addresses
65533 in that domain, it looks for a file that matches the local part. If there is no
65534 such file, the router declines, but because <option>no_more</option> is set, no subsequent
65535 routers are tried, and so the whole delivery fails.
65536 </para>
65537 <para>
65538 The <option>forbid_pipe</option> and <option>forbid_file</option> options prevent a local part from being
65539 expanded into a filename or a pipe delivery, which is usually inappropriate in
65540 a mailing list.
65541 </para>
65542 <para>
65543 <indexterm role="option">
65544 <primary><option>errors_to</option></primary>
65545 </indexterm>
65546 The <option>errors_to</option> option specifies that any delivery errors caused by addresses
65547 taken from a mailing list are to be sent to the given address rather than the
65548 original sender of the message. However, before acting on this, Exim verifies
65549 the error address, and ignores it if verification fails.
65550 </para>
65551 <para>
65552 For example, using the configuration above, mail sent to
65553 <emphasis>dicts@lists.example</emphasis> is passed on to those addresses contained in
65554 <filename>/usr/lists/dicts</filename>, with error reports directed to
65555 <emphasis>dicts-request@lists.example</emphasis>, provided that this address can be verified.
65556 There could be a file called <filename>/usr/lists/dicts-request</filename> containing
65557 the address(es) of this particular list&#x2019;s manager(s), but other approaches,
65558 such as setting up an earlier router (possibly using the <option>local_part_prefix</option>
65559 or <option>local_part_suffix</option> options) to handle addresses of the form
65560 <option>owner-</option><emphasis>xxx</emphasis> or <option>xxx-</option><emphasis>request</emphasis>, are also possible.
65561 </para>
65562 </section>
65563 <section id="SECID241">
65564 <title>Syntax errors in mailing lists</title>
65565 <para>
65566 <indexterm role="concept">
65567 <primary>mailing lists</primary>
65568 <secondary>syntax errors in</secondary>
65569 </indexterm>
65570 If an entry in redirection data contains a syntax error, Exim normally defers
65571 delivery of the original address. That means that a syntax error in a mailing
65572 list holds up all deliveries to the list. This may not be appropriate when a
65573 list is being maintained automatically from data supplied by users, and the
65574 addresses are not rigorously checked.
65575 </para>
65576 <para>
65577 If the <option>skip_syntax_errors</option> option is set, the <command>redirect</command> router just skips
65578 entries that fail to parse, noting the incident in the log. If in addition
65579 <option>syntax_errors_to</option> is set to a verifiable address, a message is sent to it
65580 whenever a broken address is skipped. It is usually appropriate to set
65581 <option>syntax_errors_to</option> to the same address as <option>errors_to</option>.
65582 </para>
65583 </section>
65584 <section id="SECID242">
65585 <title>Re-expansion of mailing lists</title>
65586 <para>
65587 <indexterm role="concept">
65588 <primary>mailing lists</primary>
65589 <secondary>re-expansion of</secondary>
65590 </indexterm>
65591 Exim remembers every individual address to which a message has been delivered,
65592 in order to avoid duplication, but it normally stores only the original
65593 recipient addresses with a message. If all the deliveries to a mailing list
65594 cannot be done at the first attempt, the mailing list is re-expanded when the
65595 delivery is next tried. This means that alterations to the list are taken into
65596 account at each delivery attempt, so addresses that have been added to
65597 the list since the message arrived will therefore receive a copy of the
65598 message, even though it pre-dates their subscription.
65599 </para>
65600 <para>
65601 If this behaviour is felt to be undesirable, the <option>one_time</option> option can be set
65602 on the <command>redirect</command> router. If this is done, any addresses generated by the
65603 router that fail to deliver at the first attempt are added to the message as
65604 <quote>top level</quote> addresses, and the parent address that generated them is marked
65605 <quote>delivered</quote>. Thus, expansion of the mailing list does not happen again at the
65606 subsequent delivery attempts. The disadvantage of this is that if any of the
65607 failing addresses are incorrect, correcting them in the file has no effect on
65608 pre-existing messages.
65609 </para>
65610 <para>
65611 The original top-level address is remembered with each of the generated
65612 addresses, and is output in any log messages. However, any intermediate parent
65613 addresses are not recorded. This makes a difference to the log only if the
65614 <option>all_parents</option> selector is set, but for mailing lists there is normally only
65615 one level of expansion anyway.
65616 </para>
65617 </section>
65618 <section id="SECID243">
65619 <title>Closed mailing lists</title>
65620 <para>
65621 <indexterm role="concept">
65622 <primary>mailing lists</primary>
65623 <secondary>closed</secondary>
65624 </indexterm>
65625 The examples so far have assumed open mailing lists, to which anybody may
65626 send mail. It is also possible to set up closed lists, where mail is accepted
65627 from specified senders only. This is done by making use of the generic
65628 <option>senders</option> option to restrict the router that handles the list.
65629 </para>
65630 <para>
65631 The following example uses the same file as a list of recipients and as a list
65632 of permitted senders. It requires three routers:
65633 </para>
65634 <literallayout class="monospaced">
65635 lists_request:
65636   driver = redirect
65637   domains = lists.example
65638   local_part_suffix = -request
65639   file = /usr/lists/$local_part$local_part_suffix
65640   no_more
65641
65642 lists_post:
65643   driver = redirect
65644   domains = lists.example
65645   senders = ${if exists {/usr/lists/$local_part}\
65646              {lsearch;/usr/lists/$local_part}{*}}
65647   file = /usr/lists/$local_part
65648   forbid_pipe
65649   forbid_file
65650   errors_to = $local_part-request@lists.example
65651   no_more
65652
65653 lists_closed:
65654   driver = redirect
65655   domains = lists.example
65656   allow_fail
65657   data = :fail: $local_part@lists.example is a closed mailing list
65658 </literallayout>
65659 <para>
65660 All three routers have the same <option>domains</option> setting, so for any other domains,
65661 they are all skipped. The first router runs only if the local part ends in
65662 <option>-request</option>. It handles messages to the list manager(s) by means of an open
65663 mailing list.
65664 </para>
65665 <para>
65666 The second router runs only if the <option>senders</option> precondition is satisfied. It
65667 checks for the existence of a list that corresponds to the local part, and then
65668 checks that the sender is on the list by means of a linear search. It is
65669 necessary to check for the existence of the file before trying to search it,
65670 because otherwise Exim thinks there is a configuration error. If the file does
65671 not exist, the expansion of <option>senders</option> is *, which matches all senders. This
65672 means that the router runs, but because there is no list, declines, and
65673 <option>no_more</option> ensures that no further routers are run. The address fails with an
65674 <quote>unrouteable address</quote> error.
65675 </para>
65676 <para>
65677 The third router runs only if the second router is skipped, which happens when
65678 a mailing list exists, but the sender is not on it. This router forcibly fails
65679 the address, giving a suitable error message.
65680 </para>
65681 </section>
65682 <section id="SECTverp">
65683 <title>Variable Envelope Return Paths (VERP)</title>
65684 <para>
65685 <indexterm role="concept">
65686 <primary>VERP</primary>
65687 </indexterm>
65688 <indexterm role="concept">
65689 <primary>Variable Envelope Return Paths</primary>
65690 </indexterm>
65691 <indexterm role="concept">
65692 <primary>envelope sender</primary>
65693 </indexterm>
65694 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;
65695 are a way of helping mailing list administrators discover which subscription
65696 address is the cause of a particular delivery failure. The idea is to encode
65697 the original recipient address in the outgoing envelope sender address, so that
65698 if the message is forwarded by another host and then subsequently bounces, the
65699 original recipient can be extracted from the recipient address of the bounce.
65700 </para>
65701 <para>
65702 <indexterm role="option">
65703 <primary><option>errors_to</option></primary>
65704 </indexterm>
65705 <indexterm role="option">
65706 <primary><option>return_path</option></primary>
65707 </indexterm>
65708 Envelope sender addresses can be modified by Exim using two different
65709 facilities: the <option>errors_to</option> option on a router (as shown in previous mailing
65710 list examples), or the <option>return_path</option> option on a transport. The second of
65711 these is effective only if the message is successfully delivered to another
65712 host; it is not used for errors detected on the local host (see the description
65713 of <option>return_path</option> in chapter <xref linkend="CHAPtransportgeneric"/>). Here is an example
65714 of the use of <option>return_path</option> to implement VERP on an <command>smtp</command> transport:
65715 </para>
65716 <literallayout class="monospaced">
65717 verp_smtp:
65718   driver = smtp
65719   max_rcpt = 1
65720   return_path = \
65721     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
65722       {$1-request+$local_part=$domain@your.dom.example}fail}
65723 </literallayout>
65724 <para>
65725 This has the effect of rewriting the return path (envelope sender) on outgoing
65726 SMTP messages, if the local part of the original return path ends in
65727 <quote>-request</quote>, and the domain is <emphasis>your.dom.example</emphasis>. The rewriting inserts the
65728 local part and domain of the recipient into the return path. Suppose, for
65729 example, that a message whose return path has been set to
65730 <emphasis>somelist-request@your.dom.example</emphasis> is sent to
65731 <emphasis>subscriber@other.dom.example</emphasis>. In the transport, the return path is
65732 rewritten as
65733 </para>
65734 <literallayout class="monospaced">
65735 somelist-request+subscriber=other.dom.example@your.dom.example
65736 </literallayout>
65737 <para>
65738 <indexterm role="variable">
65739 <primary><varname>$local_part</varname></primary>
65740 </indexterm>
65741 For this to work, you must tell Exim to send multiple copies of messages that
65742 have more than one recipient, so that each copy has just one recipient. This is
65743 achieved by setting <option>max_rcpt</option> to 1. Without this, a single copy of a message
65744 might be sent to several different recipients in the same domain, in which case
65745 <varname>$local_part</varname> is not available in the transport, because it is not unique.
65746 </para>
65747 <para>
65748 Unless your host is doing nothing but mailing list deliveries, you should
65749 probably use a separate transport for the VERP deliveries, so as not to use
65750 extra resources in making one-per-recipient copies for other deliveries. This
65751 can easily be done by expanding the <option>transport</option> option in the router:
65752 </para>
65753 <literallayout class="monospaced">
65754 dnslookup:
65755   driver = dnslookup
65756   domains = ! +local_domains
65757   transport = \
65758     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
65759       {verp_smtp}{remote_smtp}}
65760   no_more
65761 </literallayout>
65762 <para>
65763 If you want to change the return path using <option>errors_to</option> in a router instead
65764 of using <option>return_path</option> in the transport, you need to set <option>errors_to</option> on all
65765 routers that handle mailing list addresses. This will ensure that all delivery
65766 errors, including those detected on the local host, are sent to the VERP
65767 address.
65768 </para>
65769 <para>
65770 On a host that does no local deliveries and has no manual routing, only the
65771 <command>dnslookup</command> router needs to be changed. A special transport is not needed for
65772 SMTP deliveries. Every mailing list recipient has its own return path value,
65773 and so Exim must hand them to the transport one at a time. Here is an example
65774 of a <command>dnslookup</command> router that implements VERP:
65775 </para>
65776 <literallayout class="monospaced">
65777 verp_dnslookup:
65778   driver = dnslookup
65779   domains = ! +local_domains
65780   transport = remote_smtp
65781   errors_to = \
65782     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}}
65783      {$1-request+$local_part=$domain@your.dom.example}fail}
65784   no_more
65785 </literallayout>
65786 <para>
65787 Before you start sending out messages with VERPed return paths, you must also
65788 configure Exim to accept the bounce messages that come back to those paths.
65789 Typically this is done by setting a <option>local_part_suffix</option> option for a
65790 router, and using this to route the messages to wherever you want to handle
65791 them.
65792 </para>
65793 <para>
65794 The overhead incurred in using VERP depends very much on the size of the
65795 message, the number of recipient addresses that resolve to the same remote
65796 host, and the speed of the connection over which the message is being sent. If
65797 a lot of addresses resolve to the same host and the connection is slow, sending
65798 a separate copy of the message for each address may take substantially longer
65799 than sending a single copy with many recipients (for which VERP cannot be
65800 used).
65801 </para>
65802 </section>
65803 <section id="SECTvirtualdomains">
65804 <title>Virtual domains</title>
65805 <para>
65806 <indexterm role="concept">
65807 <primary>virtual domains</primary>
65808 </indexterm>
65809 <indexterm role="concept">
65810 <primary>domain</primary>
65811 <secondary>virtual</secondary>
65812 </indexterm>
65813 The phrase <emphasis>virtual domain</emphasis> is unfortunately used with two rather different
65814 meanings:
65815 </para>
65816 <itemizedlist>
65817 <listitem>
65818 <para>
65819 A domain for which there are no real mailboxes; all valid local parts are
65820 aliases for other email addresses. Common examples are organizational
65821 top-level domains and <quote>vanity</quote> domains.
65822 </para>
65823 </listitem>
65824 <listitem>
65825 <para>
65826 One of a number of independent domains that are all handled by the same host,
65827 with mailboxes on that host, but where the mailbox owners do not necessarily
65828 have login accounts on that host.
65829 </para>
65830 </listitem>
65831 </itemizedlist>
65832 <para>
65833 The first usage is probably more common, and does seem more <quote>virtual</quote> than
65834 the second. This kind of domain can be handled in Exim with a straightforward
65835 aliasing router. One approach is to create a separate alias file for each
65836 virtual domain. Exim can test for the existence of the alias file to determine
65837 whether the domain exists. The <command>dsearch</command> lookup type is useful here, leading
65838 to a router of this form:
65839 </para>
65840 <literallayout class="monospaced">
65841 virtual:
65842   driver = redirect
65843   domains = dsearch;/etc/mail/virtual
65844   data = ${lookup{$local_part}lsearch{/etc/mail/virtual/$domain}}
65845   no_more
65846 </literallayout>
65847 <para>
65848 The <option>domains</option> option specifies that the router is to be skipped, unless there
65849 is a file in the <filename>/etc/mail/virtual</filename> directory whose name is the same as the
65850 domain that is being processed. When the router runs, it looks up the local
65851 part in the file to find a new address (or list of addresses). The <option>no_more</option>
65852 setting ensures that if the lookup fails (leading to <option>data</option> being an empty
65853 string), Exim gives up on the address without trying any subsequent routers.
65854 </para>
65855 <para>
65856 This one router can handle all the virtual domains because the alias filenames
65857 follow a fixed pattern. Permissions can be arranged so that appropriate people
65858 can edit the different alias files. A successful aliasing operation results in
65859 a new envelope recipient address, which is then routed from scratch.
65860 </para>
65861 <para>
65862 The other kind of <quote>virtual</quote> domain can also be handled in a straightforward
65863 way. One approach is to create a file for each domain containing a list of
65864 valid local parts, and use it in a router like this:
65865 </para>
65866 <literallayout class="monospaced">
65867 my_domains:
65868   driver = accept
65869   domains = dsearch;/etc/mail/domains
65870   local_parts = lsearch;/etc/mail/domains/$domain
65871   transport = my_mailboxes
65872 </literallayout>
65873 <para>
65874 The address is accepted if there is a file for the domain, and the local part
65875 can be found in the file. The <option>domains</option> option is used to check for the
65876 file&#x2019;s existence because <option>domains</option> is tested before the <option>local_parts</option>
65877 option (see section <xref linkend="SECTrouprecon"/>). You cannot use <option>require_files</option>,
65878 because that option is tested after <option>local_parts</option>. The transport is as
65879 follows:
65880 </para>
65881 <literallayout class="monospaced">
65882 my_mailboxes:
65883   driver = appendfile
65884   file = /var/mail/$domain/$local_part
65885   user = mail
65886 </literallayout>
65887 <para>
65888 This uses a directory of mailboxes for each domain. The <option>user</option> setting is
65889 required, to specify which uid is to be used for writing to the mailboxes.
65890 </para>
65891 <para>
65892 The configuration shown here is just one example of how you might support this
65893 requirement. There are many other ways this kind of configuration can be set
65894 up, for example, by using a database instead of separate files to hold all the
65895 information about the domains.
65896 </para>
65897 </section>
65898 <section id="SECTmulbox">
65899 <title>Multiple user mailboxes</title>
65900 <para>
65901 <indexterm role="concept">
65902 <primary>multiple mailboxes</primary>
65903 </indexterm>
65904 <indexterm role="concept">
65905 <primary>mailbox</primary>
65906 <secondary>multiple</secondary>
65907 </indexterm>
65908 <indexterm role="concept">
65909 <primary>local part</primary>
65910 <secondary>prefix</secondary>
65911 </indexterm>
65912 <indexterm role="concept">
65913 <primary>local part</primary>
65914 <secondary>suffix</secondary>
65915 </indexterm>
65916 Heavy email users often want to operate with multiple mailboxes, into which
65917 incoming mail is automatically sorted. A popular way of handling this is to
65918 allow users to use multiple sender addresses, so that replies can easily be
65919 identified. Users are permitted to add prefixes or suffixes to their local
65920 parts for this purpose. The wildcard facility of the generic router options
65921 <option>local_part_prefix</option> and <option>local_part_suffix</option> can be used for this. For
65922 example, consider this router:
65923 </para>
65924 <literallayout class="monospaced">
65925 userforward:
65926   driver = redirect
65927   check_local_user
65928   file = $home/.forward
65929   local_part_suffix = -*
65930   local_part_suffix_optional
65931   allow_filter
65932 </literallayout>
65933 <para>
65934 <indexterm role="variable">
65935 <primary><varname>$local_part_suffix</varname></primary>
65936 </indexterm>
65937 It runs a user&#x2019;s <filename>.forward</filename> file for all local parts of the form
65938 <emphasis>username-*</emphasis>. Within the filter file the user can distinguish different
65939 cases by testing the variable <varname>$local_part_suffix</varname>. For example:
65940 </para>
65941 <literallayout class="monospaced">
65942 if $local_part_suffix contains -special then
65943 save /home/$local_part/Mail/special
65944 endif
65945 </literallayout>
65946 <para>
65947 If the filter file does not exist, or does not deal with such addresses, they
65948 fall through to subsequent routers, and, assuming no subsequent use of the
65949 <option>local_part_suffix</option> option is made, they presumably fail. Thus, users have
65950 control over which suffixes are valid.
65951 </para>
65952 <para>
65953 Alternatively, a suffix can be used to trigger the use of a different
65954 <filename>.forward</filename> file &ndash; which is the way a similar facility is implemented in
65955 another MTA:
65956 </para>
65957 <literallayout class="monospaced">
65958 userforward:
65959   driver = redirect
65960   check_local_user
65961   file = $home/.forward$local_part_suffix
65962   local_part_suffix = -*
65963   local_part_suffix_optional
65964   allow_filter
65965 </literallayout>
65966 <para>
65967 If there is no suffix, <filename>.forward</filename> is used; if the suffix is <emphasis>-special</emphasis>, for
65968 example, <filename>.forward-special</filename> is used. Once again, if the appropriate file
65969 does not exist, or does not deal with the address, it is passed on to
65970 subsequent routers, which could, if required, look for an unqualified
65971 <filename>.forward</filename> file to use as a default.
65972 </para>
65973 </section>
65974 <section id="SECID244">
65975 <title>Simplified vacation processing</title>
65976 <para>
65977 <indexterm role="concept">
65978 <primary>vacation processing</primary>
65979 </indexterm>
65980 The traditional way of running the <emphasis>vacation</emphasis> program is for a user to set up
65981 a pipe command in a <filename>.forward</filename> file
65982 (see section <xref linkend="SECTspecitredli"/> for syntax details).
65983 This is prone to error by inexperienced users. There are two features of Exim
65984 that can be used to make this process simpler for users:
65985 </para>
65986 <itemizedlist>
65987 <listitem>
65988 <para>
65989 A local part prefix such as <quote>vacation-</quote> can be specified on a router which
65990 can cause the message to be delivered directly to the <emphasis>vacation</emphasis> program, or
65991 alternatively can use Exim&#x2019;s <command>autoreply</command> transport. The contents of a user&#x2019;s
65992 <filename>.forward</filename> file are then much simpler. For example:
65993 </para>
65994 <literallayout class="monospaced">
65995 spqr, vacation-spqr
65996 </literallayout>
65997 </listitem>
65998 <listitem>
65999 <para>
66000 The <option>require_files</option> generic router option can be used to trigger a
66001 vacation delivery by checking for the existence of a certain file in the
66002 user&#x2019;s home directory. The <option>unseen</option> generic option should also be used, to
66003 ensure that the original delivery also proceeds. In this case, all the user has
66004 to do is to create a file called, say, <filename>.vacation</filename>, containing a vacation
66005 message.
66006 </para>
66007 </listitem>
66008 </itemizedlist>
66009 <para>
66010 Another advantage of both these methods is that they both work even when the
66011 use of arbitrary pipes by users is locked out.
66012 </para>
66013 </section>
66014 <section id="SECID245">
66015 <title>Taking copies of mail</title>
66016 <para>
66017 <indexterm role="concept">
66018 <primary>message</primary>
66019 <secondary>copying every</secondary>
66020 </indexterm>
66021 Some installations have policies that require archive copies of all messages to
66022 be made. A single copy of each message can easily be taken by an appropriate
66023 command in a system filter, which could, for example, use a different file for
66024 each day&#x2019;s messages.
66025 </para>
66026 <para>
66027 There is also a shadow transport mechanism that can be used to take copies of
66028 messages that are successfully delivered by local transports, one copy per
66029 delivery. This could be used, <emphasis>inter alia</emphasis>, to implement automatic
66030 notification of delivery by sites that insist on doing such things.
66031 </para>
66032 </section>
66033 <section id="SECID246">
66034 <title>Intermittently connected hosts</title>
66035 <para>
66036 <indexterm role="concept">
66037 <primary>intermittently connected hosts</primary>
66038 </indexterm>
66039 It has become quite common (because it is cheaper) for hosts to connect to the
66040 Internet periodically rather than remain connected all the time. The normal
66041 arrangement is that mail for such hosts accumulates on a system that is
66042 permanently connected.
66043 </para>
66044 <para>
66045 Exim was designed for use on permanently connected hosts, and so it is not
66046 particularly well-suited to use in an intermittently connected environment.
66047 Nevertheless there are some features that can be used.
66048 </para>
66049 </section>
66050 <section id="SECID247">
66051 <title>Exim on the upstream server host</title>
66052 <para>
66053 It is tempting to arrange for incoming mail for the intermittently connected
66054 host to remain in Exim&#x2019;s queue until the client connects. However, this
66055 approach does not scale very well. Two different kinds of waiting message are
66056 being mixed up in the same queue &ndash; those that cannot be delivered because of
66057 some temporary problem, and those that are waiting for their destination host
66058 to connect. This makes it hard to manage the queue, as well as wasting
66059 resources, because each queue runner scans the entire queue.
66060 </para>
66061 <para>
66062 A better approach is to separate off those messages that are waiting for an
66063 intermittently connected host. This can be done by delivering these messages
66064 into local files in batch SMTP, <quote>mailstore</quote>, or other envelope-preserving
66065 format, from where they are transmitted by other software when their
66066 destination connects. This makes it easy to collect all the mail for one host
66067 in a single directory, and to apply local timeout rules on a per-message basis
66068 if required.
66069 </para>
66070 <para>
66071 On a very small scale, leaving the mail on Exim&#x2019;s queue can be made to work. If
66072 you are doing this, you should configure Exim with a long retry period for the
66073 intermittent host. For example:
66074 </para>
66075 <literallayout class="monospaced">
66076 cheshire.wonderland.fict.example    *   F,5d,24h
66077 </literallayout>
66078 <para>
66079 This stops a lot of failed delivery attempts from occurring, but Exim remembers
66080 which messages it has queued up for that host. Once the intermittent host comes
66081 online, forcing delivery of one message (either by using the <option>-M</option> or <option>-R</option>
66082 options, or by using the ETRN SMTP command (see section <xref linkend="SECTETRN"/>)
66083 causes all the queued up messages to be delivered, often down a single SMTP
66084 connection. While the host remains connected, any new messages get delivered
66085 immediately.
66086 </para>
66087 <para>
66088 If the connecting hosts do not have fixed IP addresses, that is, if a host is
66089 issued with a different IP address each time it connects, Exim&#x2019;s retry
66090 mechanisms on the holding host get confused, because the IP address is normally
66091 used as part of the key string for holding retry information. This can be
66092 avoided by unsetting <option>retry_include_ip_address</option> on the <command>smtp</command> transport.
66093 Since this has disadvantages for permanently connected hosts, it is best to
66094 arrange a separate transport for the intermittently connected ones.
66095 </para>
66096 </section>
66097 <section id="SECID248">
66098 <title>Exim on the intermittently connected client host</title>
66099 <para>
66100 The value of <option>smtp_accept_queue_per_connection</option> should probably be
66101 increased, or even set to zero (that is, disabled) on the intermittently
66102 connected host, so that all incoming messages down a single connection get
66103 delivered immediately.
66104 </para>
66105 <para>
66106 <indexterm role="concept">
66107 <primary>SMTP</primary>
66108 <secondary>passed connection</secondary>
66109 </indexterm>
66110 <indexterm role="concept">
66111 <primary>SMTP</primary>
66112 <secondary>multiple deliveries</secondary>
66113 </indexterm>
66114 <indexterm role="concept">
66115 <primary>multiple SMTP deliveries</primary>
66116 </indexterm>
66117 Mail waiting to be sent from an intermittently connected host will probably
66118 not have been routed, because without a connection DNS lookups are not
66119 possible. This means that if a normal queue run is done at connection time,
66120 each message is likely to be sent in a separate SMTP session. This can be
66121 avoided by starting the queue run with a command line option beginning with
66122 <option>-qq</option> instead of <option>-q</option>. In this case, the queue is scanned twice. In the
66123 first pass, routing is done but no deliveries take place. The second pass is a
66124 normal queue run; since all the messages have been previously routed, those
66125 destined for the same host are likely to get sent as multiple deliveries in a
66126 single SMTP connection.
66127 </para>
66128 </section>
66129 </chapter>
66130
66131 <chapter id="CHAPnonqueueing">
66132 <title>Using Exim as a non-queueing client</title>
66133 <titleabbrev>Exim as a non-queueing client</titleabbrev>
66134 <para>
66135 <indexterm role="concept">
66136 <primary>client, non-queueing</primary>
66137 </indexterm>
66138 <indexterm role="concept">
66139 <primary>smart host</primary>
66140 <secondary>suppressing queueing</secondary>
66141 </indexterm>
66142 On a personal computer, it is a common requirement for all
66143 email to be sent to a <quote>smart host</quote>. There are plenty of MUAs that can be
66144 configured to operate that way, for all the popular operating systems.
66145 However, there are some MUAs for Unix-like systems that cannot be so
66146 configured: they submit messages using the command line interface of
66147 <filename>/usr/sbin/sendmail</filename>. Furthermore, utility programs such as <emphasis>cron</emphasis> submit
66148 messages this way.
66149 </para>
66150 <para>
66151 If the personal computer runs continuously, there is no problem, because it can
66152 run a conventional MTA that handles delivery to the smart host, and deal with
66153 any delays via its queueing mechanism. However, if the computer does not run
66154 continuously or runs different operating systems at different times, queueing
66155 email is not desirable.
66156 </para>
66157 <para>
66158 There is therefore a requirement for something that can provide the
66159 <filename>/usr/sbin/sendmail</filename> interface but deliver messages to a smart host without
66160 any queueing or retrying facilities. Furthermore, the delivery to the smart
66161 host should be synchronous, so that if it fails, the sending MUA is immediately
66162 informed. In other words, we want something that extends an MUA that submits
66163 to a local MTA via the command line so that it behaves like one that submits
66164 to a remote smart host using TCP/SMTP.
66165 </para>
66166 <para>
66167 There are a number of applications (for example, there is one called <emphasis>ssmtp</emphasis>)
66168 that do this job. However, people have found them to be lacking in various
66169 ways. For instance, you might want to allow aliasing and forwarding to be done
66170 before sending a message to the smart host.
66171 </para>
66172 <para>
66173 Exim already had the necessary infrastructure for doing this job. Just a few
66174 tweaks were needed to make it behave as required, though it is somewhat of an
66175 overkill to use a fully-featured MTA for this purpose.
66176 </para>
66177 <para>
66178 <indexterm role="option">
66179 <primary><option>mua_wrapper</option></primary>
66180 </indexterm>
66181 There is a Boolean global option called <option>mua_wrapper</option>, defaulting false.
66182 Setting <option>mua_wrapper</option> true causes Exim to run in a special mode where it
66183 assumes that it is being used to <quote>wrap</quote> a command-line MUA in the manner
66184 just described. As well as setting <option>mua_wrapper</option>, you also need to provide a
66185 compatible router and transport configuration. Typically there will be just one
66186 router and one transport, sending everything to a smart host.
66187 </para>
66188 <para>
66189 When run in MUA wrapping mode, the behaviour of Exim changes in the
66190 following ways:
66191 </para>
66192 <itemizedlist>
66193 <listitem>
66194 <para>
66195 A daemon cannot be run, nor will Exim accept incoming messages from <emphasis>inetd</emphasis>.
66196 In other words, the only way to submit messages is via the command line.
66197 </para>
66198 </listitem>
66199 <listitem>
66200 <para>
66201 Each message is synchronously delivered as soon as it is received (<option>-odi</option> is
66202 assumed). All queueing options (<option>queue_only</option>, <option>queue_smtp_domains</option>,
66203 <option>control</option> in an ACL, etc.) are quietly ignored. The Exim reception process
66204 does not finish until the delivery attempt is complete. If the delivery is
66205 successful, a zero return code is given.
66206 </para>
66207 </listitem>
66208 <listitem>
66209 <para>
66210 Address redirection is permitted, but the final routing for all addresses must
66211 be to the same remote transport, and to the same list of hosts. Furthermore,
66212 the return address (envelope sender) must be the same for all recipients, as
66213 must any added or deleted header lines. In other words, it must be possible to
66214 deliver the message in a single SMTP transaction, however many recipients there
66215 are.
66216 </para>
66217 </listitem>
66218 <listitem>
66219 <para>
66220 If these conditions are not met, or if routing any address results in a
66221 failure or defer status, or if Exim is unable to deliver all the recipients
66222 successfully to one of the smart hosts, delivery of the entire message fails.
66223 </para>
66224 </listitem>
66225 <listitem>
66226 <para>
66227 Because no queueing is allowed, all failures are treated as permanent; there
66228 is no distinction between 4<emphasis>xx</emphasis> and 5<emphasis>xx</emphasis> SMTP response codes from the
66229 smart host. Furthermore, because only a single yes/no response can be given to
66230 the caller, it is not possible to deliver to some recipients and not others. If
66231 there is an error (temporary or permanent) for any recipient, all are failed.
66232 </para>
66233 </listitem>
66234 <listitem>
66235 <para>
66236 If more than one smart host is listed, Exim will try another host after a
66237 connection failure or a timeout, in the normal way. However, if this kind of
66238 failure happens for all the hosts, the delivery fails.
66239 </para>
66240 </listitem>
66241 <listitem>
66242 <para>
66243 When delivery fails, an error message is written to the standard error stream
66244 (as well as to Exim&#x2019;s log), and Exim exits to the caller with a return code
66245 value 1. The message is expunged from Exim&#x2019;s spool files. No bounce messages
66246 are ever generated.
66247 </para>
66248 </listitem>
66249 <listitem>
66250 <para>
66251 No retry data is maintained, and any retry rules are ignored.
66252 </para>
66253 </listitem>
66254 <listitem>
66255 <para>
66256 A number of Exim options are overridden: <option>deliver_drop_privilege</option> is forced
66257 true, <option>max_rcpt</option> in the <command>smtp</command> transport is forced to <quote>unlimited</quote>,
66258 <option>remote_max_parallel</option> is forced to one, and fallback hosts are ignored.
66259 </para>
66260 </listitem>
66261 </itemizedlist>
66262 <para>
66263 The overall effect is that Exim makes a single synchronous attempt to deliver
66264 the message, failing if there is any kind of problem. Because no local
66265 deliveries are done and no daemon can be run, Exim does not need root
66266 privilege. It should be possible to run it setuid to <emphasis>exim</emphasis> instead of setuid
66267 to <emphasis>root</emphasis>. See section <xref linkend="SECTrunexiwitpri"/> for a general discussion about
66268 the advantages and disadvantages of running without root privilege.
66269 </para>
66270 </chapter>
66271
66272 <chapter id="CHAPlog">
66273 <title>Log files</title>
66274 <para>
66275 <indexterm role="concept" id="IIDloggen" class="startofrange">
66276 <primary>log</primary>
66277 <secondary>general description</secondary>
66278 </indexterm>
66279 <indexterm role="concept">
66280 <primary>log</primary>
66281 <secondary>types of</secondary>
66282 </indexterm>
66283 Exim writes three different logs, referred to as the main log, the reject log,
66284 and the panic log:
66285 </para>
66286 <itemizedlist>
66287 <listitem>
66288 <para>
66289 <indexterm role="concept">
66290 <primary>main log</primary>
66291 </indexterm>
66292 The main log records the arrival of each message and each delivery in a single
66293 line in each case. The format is as compact as possible, in an attempt to keep
66294 down the size of log files. Two-character flag sequences make it easy to pick
66295 out these lines. A number of other events are recorded in the main log. Some of
66296 them are optional, in which case the <option>log_selector</option> option controls whether
66297 they are included or not. A Perl script called <emphasis>eximstats</emphasis>, which does simple
66298 analysis of main log files, is provided in the Exim distribution (see section
66299 <xref linkend="SECTmailstat"/>).
66300 </para>
66301 </listitem>
66302 <listitem>
66303 <para>
66304 <indexterm role="concept">
66305 <primary>reject log</primary>
66306 </indexterm>
66307 The reject log records information from messages that are rejected as a result
66308 of a configuration option (that is, for policy reasons).
66309 The first line of each rejection is a copy of the line that is also written to
66310 the main log. Then, if the message&#x2019;s header has been read at the time the log
66311 is written, its contents are written to this log. Only the original header
66312 lines are available; header lines added by ACLs are not logged. You can use the
66313 reject log to check that your policy controls are working correctly; on a busy
66314 host this may be easier than scanning the main log for rejection messages. You
66315 can suppress the writing of the reject log by setting <option>write_rejectlog</option>
66316 false.
66317 </para>
66318 </listitem>
66319 <listitem>
66320 <para>
66321 <indexterm role="concept">
66322 <primary>panic log</primary>
66323 </indexterm>
66324 <indexterm role="concept">
66325 <primary>system log</primary>
66326 </indexterm>
66327 When certain serious errors occur, Exim writes entries to its panic log. If the
66328 error is sufficiently disastrous, Exim bombs out afterwards. Panic log entries
66329 are usually written to the main log as well, but can get lost amid the mass of
66330 other entries. The panic log should be empty under normal circumstances. It is
66331 therefore a good idea to check it (or to have a <emphasis>cron</emphasis> script check it)
66332 regularly, in order to become aware of any problems. When Exim cannot open its
66333 panic log, it tries as a last resort to write to the system log (syslog). This
66334 is opened with LOG_PID+LOG_CONS and the facility code of LOG_MAIL. The
66335 message itself is written at priority LOG_CRIT.
66336 </para>
66337 </listitem>
66338 </itemizedlist>
66339 <para>
66340 Every log line starts with a timestamp, in the format shown in the following
66341 example. Note that many of the examples shown in this chapter are line-wrapped.
66342 In the log file, this would be all on one line:
66343 </para>
66344 <literallayout class="monospaced">
66345 2001-09-16 16:09:47 SMTP connection from [127.0.0.1] closed
66346   by QUIT
66347 </literallayout>
66348 <para>
66349 By default, the timestamps are in the local timezone. There are two
66350 ways of changing this:
66351 </para>
66352 <itemizedlist>
66353 <listitem>
66354 <para>
66355 You can set the <option>timezone</option> option to a different time zone; in particular, if
66356 you set
66357 </para>
66358 <literallayout class="monospaced">
66359 timezone = UTC
66360 </literallayout>
66361 <para>
66362 the timestamps will be in UTC (aka GMT).
66363 </para>
66364 </listitem>
66365 <listitem>
66366 <para>
66367 If you set <option>log_timezone</option> true, the time zone is added to the timestamp, for
66368 example:
66369 </para>
66370 <literallayout class="monospaced">
66371 2003-04-25 11:17:07 +0100 Start queue run: pid=12762
66372 </literallayout>
66373 </listitem>
66374 </itemizedlist>
66375 <para>
66376 <indexterm role="concept">
66377 <primary>log</primary>
66378 <secondary>process ids in</secondary>
66379 </indexterm>
66380 <indexterm role="concept">
66381 <primary>pid (process id)</primary>
66382 <secondary>in log lines</secondary>
66383 </indexterm>
66384 Exim does not include its process id in log lines by default, but you can
66385 request that it does so by specifying the <literal>pid</literal> log selector (see section
66386 <xref linkend="SECTlogselector"/>). When this is set, the process id is output, in square
66387 brackets, immediately after the time and date.
66388 </para>
66389 <section id="SECTwhelogwri">
66390 <title>Where the logs are written</title>
66391 <para>
66392 <indexterm role="concept">
66393 <primary>log</primary>
66394 <secondary>destination</secondary>
66395 </indexterm>
66396 <indexterm role="concept">
66397 <primary>log</primary>
66398 <secondary>to file</secondary>
66399 </indexterm>
66400 <indexterm role="concept">
66401 <primary>log</primary>
66402 <secondary>to syslog</secondary>
66403 </indexterm>
66404 <indexterm role="concept">
66405 <primary>syslog</primary>
66406 </indexterm>
66407 The logs may be written to local files, or to syslog, or both. However, it
66408 should be noted that many syslog implementations use UDP as a transport, and
66409 are therefore unreliable in the sense that messages are not guaranteed to
66410 arrive at the loghost, nor is the ordering of messages necessarily maintained.
66411 It has also been reported that on large log files (tens of megabytes) you may
66412 need to tweak syslog to prevent it syncing the file with each write &ndash; on
66413 Linux this has been seen to make syslog take 90% plus of CPU time.
66414 </para>
66415 <para>
66416 The destination for Exim&#x2019;s logs is configured by setting LOG_FILE_PATH in
66417 <filename>Local/Makefile</filename> or by setting <option>log_file_path</option> in the runtime
66418 configuration. This latter string is expanded, so it can contain, for example,
66419 references to the host name:
66420 </para>
66421 <literallayout class="monospaced">
66422 log_file_path = /var/log/$primary_hostname/exim_%slog
66423 </literallayout>
66424 <para>
66425 It is generally advisable, however, to set the string in <filename>Local/Makefile</filename>
66426 rather than at runtime, because then the setting is available right from the
66427 start of Exim&#x2019;s execution. Otherwise, if there&#x2019;s something it wants to log
66428 before it has read the configuration file (for example, an error in the
66429 configuration file) it will not use the path you want, and may not be able to
66430 log at all.
66431 </para>
66432 <para>
66433 The value of LOG_FILE_PATH or <option>log_file_path</option> is a colon-separated
66434 list, currently limited to at most two items. This is one option where the
66435 facility for changing a list separator may not be used. The list must always be
66436 colon-separated. If an item in the list is <quote>syslog</quote> then syslog is used;
66437 otherwise the item must either be an absolute path, containing <literal>%s</literal> at the
66438 point where <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote> is to be inserted, or be empty,
66439 implying the use of a default path.
66440 </para>
66441 <para>
66442 When Exim encounters an empty item in the list, it searches the list defined by
66443 LOG_FILE_PATH, and uses the first item it finds that is neither empty nor
66444 <quote>syslog</quote>. This means that an empty item in <option>log_file_path</option> can be used to
66445 mean <quote>use the path specified at build time</quote>. It no such item exists, log
66446 files are written in the <filename>log</filename> subdirectory of the spool directory. This is
66447 equivalent to the setting:
66448 </para>
66449 <literallayout class="monospaced">
66450 log_file_path = $spool_directory/log/%slog
66451 </literallayout>
66452 <para>
66453 If you do not specify anything at build time or runtime,
66454 or if you unset the option at runtime (i.e. <literal>log_file_path = </literal>),
66455 that is where the logs are written.
66456 </para>
66457 <para>
66458 A log file path may also contain <literal>%D</literal> or <literal>%M</literal> if datestamped log filenames
66459 are in use &ndash; see section <xref linkend="SECTdatlogfil"/> below.
66460 </para>
66461 <para>
66462 Here are some examples of possible settings:
66463 </para>
66464 <literallayout>
66465 <literal>LOG_FILE_PATH=syslog                    </literal> syslog only
66466 <literal>LOG_FILE_PATH=:syslog                   </literal> syslog and default path
66467 <literal>LOG_FILE_PATH=syslog : /usr/log/exim_%s </literal> syslog and specified path
66468 <literal>LOG_FILE_PATH=/usr/log/exim_%s          </literal> specified path only
66469 </literallayout>
66470 <para>
66471 If there are more than two paths in the list, the first is used and a panic
66472 error is logged.
66473 </para>
66474 </section>
66475 <section id="SECID285">
66476 <title>Logging to local files that are periodically <quote>cycled</quote></title>
66477 <para>
66478 <indexterm role="concept">
66479 <primary>log</primary>
66480 <secondary>cycling local files</secondary>
66481 </indexterm>
66482 <indexterm role="concept">
66483 <primary>cycling logs</primary>
66484 </indexterm>
66485 <indexterm role="concept">
66486 <primary><emphasis>exicyclog</emphasis></primary>
66487 </indexterm>
66488 <indexterm role="concept">
66489 <primary>log</primary>
66490 <secondary>local files; writing to</secondary>
66491 </indexterm>
66492 Some operating systems provide centralized and standardized methods for cycling
66493 log files. For those that do not, a utility script called <emphasis>exicyclog</emphasis> is
66494 provided (see section <xref linkend="SECTcyclogfil"/>). This renames and compresses the
66495 main and reject logs each time it is called. The maximum number of old logs to
66496 keep can be set. It is suggested this script is run as a daily <emphasis>cron</emphasis> job.
66497 </para>
66498 <para>
66499 An Exim delivery process opens the main log when it first needs to write to it,
66500 and it keeps the file open in case subsequent entries are required &ndash; for
66501 example, if a number of different deliveries are being done for the same
66502 message. However, remote SMTP deliveries can take a long time, and this means
66503 that the file may be kept open long after it is renamed if <emphasis>exicyclog</emphasis> or
66504 something similar is being used to rename log files on a regular basis. To
66505 ensure that a switch of log files is noticed as soon as possible, Exim calls
66506 <function>stat()</function> on the main log&#x2019;s name before reusing an open file, and if the file
66507 does not exist, or its inode has changed, the old file is closed and Exim
66508 tries to open the main log from scratch. Thus, an old log file may remain open
66509 for quite some time, but no Exim processes should write to it once it has been
66510 renamed.
66511 </para>
66512 </section>
66513 <section id="SECTdatlogfil">
66514 <title>Datestamped log files</title>
66515 <para>
66516 <indexterm role="concept">
66517 <primary>log</primary>
66518 <secondary>datestamped files</secondary>
66519 </indexterm>
66520 Instead of cycling the main and reject log files by renaming them
66521 periodically, some sites like to use files whose names contain a datestamp,
66522 for example, <filename>mainlog-20031225</filename>. The datestamp is in the form <filename>yyyymmdd</filename> or
66523 <filename>yyyymm</filename>. Exim has support for this way of working. It is enabled by setting
66524 the <option>log_file_path</option> option to a path that includes <literal>%D</literal> or <literal>%M</literal> at the
66525 point where the datestamp is required. For example:
66526 </para>
66527 <literallayout class="monospaced">
66528 log_file_path = /var/spool/exim/log/%slog-%D
66529 log_file_path = /var/log/exim-%s-%D.log
66530 log_file_path = /var/spool/exim/log/%D-%slog
66531 log_file_path = /var/log/exim/%s.%M
66532 </literallayout>
66533 <para>
66534 As before, <literal>%s</literal> is replaced by <quote>main</quote> or <quote>reject</quote>; the following are
66535 examples of names generated by the above examples:
66536 </para>
66537 <literallayout class="monospaced">
66538 /var/spool/exim/log/mainlog-20021225
66539 /var/log/exim-reject-20021225.log
66540 /var/spool/exim/log/20021225-mainlog
66541 /var/log/exim/main.200212
66542 </literallayout>
66543 <para>
66544 When this form of log file is specified, Exim automatically switches to new
66545 files at midnight. It does not make any attempt to compress old logs; you
66546 will need to write your own script if you require this. You should not
66547 run <emphasis>exicyclog</emphasis> with this form of logging.
66548 </para>
66549 <para>
66550 The location of the panic log is also determined by <option>log_file_path</option>, but it
66551 is not datestamped, because rotation of the panic log does not make sense.
66552 When generating the name of the panic log, <literal>%D</literal> or <literal>%M</literal> are removed from
66553 the string. In addition, if it immediately follows a slash, a following
66554 non-alphanumeric character is removed; otherwise a preceding non-alphanumeric
66555 character is removed. Thus, the four examples above would give these panic
66556 log names:
66557 </para>
66558 <literallayout class="monospaced">
66559 /var/spool/exim/log/paniclog
66560 /var/log/exim-panic.log
66561 /var/spool/exim/log/paniclog
66562 /var/log/exim/panic
66563 </literallayout>
66564 </section>
66565 <section id="SECID249">
66566 <title>Logging to syslog</title>
66567 <para>
66568 <indexterm role="concept">
66569 <primary>log</primary>
66570 <secondary>syslog; writing to</secondary>
66571 </indexterm>
66572 The use of syslog does not change what Exim logs or the format of its messages,
66573 except in one respect. If <option>syslog_timestamp</option> is set false, the timestamps on
66574 Exim&#x2019;s log lines are omitted when these lines are sent to syslog. Apart from
66575 that, the same strings are written to syslog as to log files. The syslog
66576 <quote>facility</quote> is set to LOG_MAIL, and the program name to <quote>exim</quote>
66577 by default, but you can change these by setting the <option>syslog_facility</option> and
66578 <option>syslog_processname</option> options, respectively. If Exim was compiled with
66579 SYSLOG_LOG_PID set in <filename>Local/Makefile</filename> (this is the default in
66580 <filename>src/EDITME</filename>), then, on systems that permit it (all except ULTRIX), the
66581 LOG_PID flag is set so that the <function>syslog()</function> call adds the pid as well as
66582 the time and host name to each line.
66583 The three log streams are mapped onto syslog priorities as follows:
66584 </para>
66585 <itemizedlist>
66586 <listitem>
66587 <para>
66588 <emphasis>mainlog</emphasis> is mapped to LOG_INFO
66589 </para>
66590 </listitem>
66591 <listitem>
66592 <para>
66593 <emphasis>rejectlog</emphasis> is mapped to LOG_NOTICE
66594 </para>
66595 </listitem>
66596 <listitem>
66597 <para>
66598 <emphasis>paniclog</emphasis> is mapped to LOG_ALERT
66599 </para>
66600 </listitem>
66601 </itemizedlist>
66602 <para>
66603 Many log lines are written to both <emphasis>mainlog</emphasis> and <emphasis>rejectlog</emphasis>, and some are
66604 written to both <emphasis>mainlog</emphasis> and <emphasis>paniclog</emphasis>, so there will be duplicates if
66605 these are routed by syslog to the same place. You can suppress this duplication
66606 by setting <option>syslog_duplication</option> false.
66607 </para>
66608 <para>
66609 Exim&#x2019;s log lines can sometimes be very long, and some of its <emphasis>rejectlog</emphasis>
66610 entries contain multiple lines when headers are included. To cope with both
66611 these cases, entries written to syslog are split into separate <function>syslog()</function>
66612 calls at each internal newline, and also after a maximum of
66613 870 data characters. (This allows for a total syslog line length of 1024, when
66614 additions such as timestamps are added.) If you are running a syslog
66615 replacement that can handle lines longer than the 1024 characters allowed by
66616 RFC 3164, you should set
66617 </para>
66618 <literallayout class="monospaced">
66619 SYSLOG_LONG_LINES=yes
66620 </literallayout>
66621 <para>
66622 in <filename>Local/Makefile</filename> before building Exim. That stops Exim from splitting long
66623 lines, but it still splits at internal newlines in <emphasis>reject</emphasis> log entries.
66624 </para>
66625 <para>
66626 To make it easy to re-assemble split lines later, each component of a split
66627 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;]
66628 where &lt;<emphasis>n</emphasis>&gt; is the component number and &lt;<emphasis>m</emphasis>&gt; is the total number of
66629 components in the entry. The / delimiter is used when the line was split
66630 because it was too long; if it was split because of an internal newline, the \
66631 delimiter is used. For example, supposing the length limit to be 50 instead of
66632 870, the following would be the result of a typical rejection message to
66633 <emphasis>mainlog</emphasis> (LOG_INFO), each line in addition being preceded by the time, host
66634 name, and pid as added by syslog:
66635 </para>
66636 <literallayout class="monospaced">
66637 [1/5] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected from
66638 [2/5]  [127.0.0.1] (ph10): syntax error in 'From' header
66639 [3/5]  when scanning for sender: missing or malformed lo
66640 [4/5] cal part in "&lt;&gt;" (envelope sender is &lt;ph10@cam.exa
66641 [5/5] mple&gt;)
66642 </literallayout>
66643 <para>
66644 The same error might cause the following lines to be written to <quote>rejectlog</quote>
66645 (LOG_NOTICE):
66646 </para>
66647 <literallayout class="monospaced">
66648 [1/18] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected fro
66649 [2/18] m [127.0.0.1] (ph10): syntax error in 'From' head
66650 [3/18] er when scanning for sender: missing or malformed
66651 [4/18]  local part in "&lt;&gt;" (envelope sender is &lt;ph10@cam
66652 [5\18] .example&gt;)
66653 [6\18] Recipients: ph10@some.domain.cam.example
66654 [7\18] P Received: from [127.0.0.1] (ident=ph10)
66655 [8\18]        by xxxxx.cam.example with smtp (Exim 4.00)
66656 [9\18]        id 16RdAL-0006pc-00
66657 [10/18]        for ph10@cam.example; Mon, 16 Sep 2002 16:
66658 [11\18] 09:43 +0100
66659 [12\18] F From: &lt;&gt;
66660 [13\18]   Subject: this is a test header
66661 [18\18]   X-something: this is another header
66662 [15/18] I Message-Id: &lt;E16RdAL-0006pc-00@xxxxx.cam.examp
66663 [16\18] le&gt;
66664 [17\18] B Bcc:
66665 [18/18]   Date: Mon, 16 Sep 2002 16:09:43 +0100
66666 </literallayout>
66667 <para>
66668 Log lines that are neither too long nor contain newlines are written to syslog
66669 without modification.
66670 </para>
66671 <para>
66672 If only syslog is being used, the Exim monitor is unable to provide a log tail
66673 display, unless syslog is routing <emphasis>mainlog</emphasis> to a file on the local host and
66674 the environment variable EXIMON_LOG_FILE_PATH is set to tell the monitor
66675 where it is.
66676 </para>
66677 </section>
66678 <section id="SECID250">
66679 <title>Log line flags</title>
66680 <para>
66681 One line is written to the main log for each message received, and for each
66682 successful, unsuccessful, and delayed delivery. These lines can readily be
66683 picked out by the distinctive two-character flags that immediately follow the
66684 timestamp. The flags are:
66685 </para>
66686 <literallayout>
66687 <literal>&lt;=</literal>     message arrival
66688 <literal>(=</literal>     message fakereject
66689 <literal>=&gt;</literal>     normal message delivery
66690 <literal>-&gt;</literal>     additional address in same delivery
66691 <literal>&gt;&gt;</literal>     cutthrough message delivery
66692 <literal>*&gt;</literal>     delivery suppressed by <option>-N</option>
66693 <literal>**</literal>     delivery failed; address bounced
66694 <literal>==</literal>     delivery deferred; temporary problem
66695 </literallayout>
66696 </section>
66697 <section id="SECID251">
66698 <title>Logging message reception</title>
66699 <para>
66700 <indexterm role="concept">
66701 <primary>log</primary>
66702 <secondary>reception line</secondary>
66703 </indexterm>
66704 The format of the single-line entry in the main log that is written for every
66705 message received is shown in the basic example below, which is split over
66706 several lines in order to fit it on the page:
66707 </para>
66708 <literallayout class="monospaced">
66709 2002-10-31 08:57:53 16ZCW1-0005MB-00 &lt;= kryten@dwarf.fict.example
66710   H=mailer.fict.example [192.168.123.123] U=exim
66711   P=smtp S=5678 id=&lt;incoming message id&gt;
66712 </literallayout>
66713 <para>
66714 The address immediately following <quote>&lt;=</quote> is the envelope sender address. A
66715 bounce message is shown with the sender address <quote>&lt;&gt;</quote>, and if it is locally
66716 generated, this is followed by an item of the form
66717 </para>
66718 <literallayout class="monospaced">
66719 R=&lt;message id&gt;
66720 </literallayout>
66721 <para>
66722 which is a reference to the message that caused the bounce to be sent.
66723 </para>
66724 <para>
66725 <indexterm role="concept">
66726 <primary>HELO</primary>
66727 </indexterm>
66728 <indexterm role="concept">
66729 <primary>EHLO</primary>
66730 </indexterm>
66731 For messages from other hosts, the H and U fields identify the remote host and
66732 record the RFC 1413 identity of the user that sent the message, if one was
66733 received. The number given in square brackets is the IP address of the sending
66734 host. If there is a single, unparenthesized  host name in the H field, as
66735 above, it has been verified to correspond to the IP address (see the
66736 <option>host_lookup</option> option). If the name is in parentheses, it was the name quoted
66737 by the remote host in the SMTP HELO or EHLO command, and has not been
66738 verified. If verification yields a different name to that given for HELO or
66739 EHLO, the verified name appears first, followed by the HELO or EHLO
66740 name in parentheses.
66741 </para>
66742 <para>
66743 Misconfigured hosts (and mail forgers) sometimes put an IP address, with or
66744 without brackets, in the HELO or EHLO command, leading to entries in
66745 the log containing text like these examples:
66746 </para>
66747 <literallayout class="monospaced">
66748 H=(10.21.32.43) [192.168.8.34]
66749 H=([10.21.32.43]) [192.168.8.34]
66750 </literallayout>
66751 <para>
66752 This can be confusing. Only the final address in square brackets can be relied
66753 on.
66754 </para>
66755 <para>
66756 For locally generated messages (that is, messages not received over TCP/IP),
66757 the H field is omitted, and the U field contains the login name of the caller
66758 of Exim.
66759 </para>
66760 <para>
66761 <indexterm role="concept">
66762 <primary>authentication</primary>
66763 <secondary>logging</secondary>
66764 </indexterm>
66765 <indexterm role="concept">
66766 <primary>AUTH</primary>
66767 <secondary>logging</secondary>
66768 </indexterm>
66769 For all messages, the P field specifies the protocol used to receive the
66770 message. This is the value that is stored in <varname>$received_protocol</varname>. In the case
66771 of incoming SMTP messages, the value indicates whether or not any SMTP
66772 extensions (ESMTP), encryption, or authentication were used. If the SMTP
66773 session was encrypted, there is an additional X field that records the cipher
66774 suite that was used.
66775 </para>
66776 <para>
66777 <indexterm role="concept">
66778 <primary>log</primary>
66779 <secondary>protocol</secondary>
66780 </indexterm>
66781 The protocol is set to <quote>esmtpsa</quote> or <quote>esmtpa</quote> for messages received from
66782 hosts that have authenticated themselves using the SMTP AUTH command. The first
66783 value is used when the SMTP connection was encrypted (<quote>secure</quote>). In this case
66784 there is an additional item A= followed by the name of the authenticator that
66785 was used. If an authenticated identification was set up by the authenticator&#x2019;s
66786 <option>server_set_id</option> option, this is logged too, separated by a colon from the
66787 authenticator name.
66788 </para>
66789 <para>
66790 <indexterm role="concept">
66791 <primary>size</primary>
66792 <secondary>of message</secondary>
66793 </indexterm>
66794 The id field records the existing message id, if present. The size of the
66795 received message is given by the S field. When the message is delivered,
66796 headers may be removed or added, so that the size of delivered copies of the
66797 message may not correspond with this value (and indeed may be different to each
66798 other).
66799 </para>
66800 <para>
66801 The <option>log_selector</option> option can be used to request the logging of additional
66802 data when a message is received. See section <xref linkend="SECTlogselector"/> below.
66803 </para>
66804 </section>
66805 <section id="SECID252">
66806 <title>Logging deliveries</title>
66807 <para>
66808 <indexterm role="concept">
66809 <primary>log</primary>
66810 <secondary>delivery line</secondary>
66811 </indexterm>
66812 The format of the single-line entry in the main log that is written for every
66813 delivery is shown in one of the examples below, for local and remote
66814 deliveries, respectively. Each example has been split into multiple lines in order
66815 to fit it on the page:
66816 </para>
66817 <literallayout class="monospaced">
66818 2002-10-31 08:59:13 16ZCW1-0005MB-00 =&gt; marv
66819   &lt;marv@hitch.fict.example&gt; R=localuser T=local_delivery
66820 2002-10-31 09:00:10 16ZCW1-0005MB-00 =&gt;
66821   monk@holistic.fict.example R=dnslookup T=remote_smtp
66822   H=holistic.fict.example [192.168.234.234]
66823 </literallayout>
66824 <para>
66825 For ordinary local deliveries, the original address is given in angle brackets
66826 after the final delivery address, which might be a pipe or a file. If
66827 intermediate address(es) exist between the original and the final address, the
66828 last of these is given in parentheses after the final address. The R and T
66829 fields record the router and transport that were used to process the address.
66830 </para>
66831 <para>
66832 If SMTP AUTH was used for the delivery there is an additional item A=
66833 followed by the name of the authenticator that was used.
66834 If an authenticated identification was set up by the authenticator&#x2019;s <option>client_set_id</option>
66835 option, this is logged too, separated by a colon from the authenticator name.
66836 </para>
66837 <para>
66838 If a shadow transport was run after a successful local delivery, the log line
66839 for the successful delivery has an item added on the end, of the form
66840 </para>
66841 <literallayout>
66842 <literal>ST=&lt;</literal><emphasis>shadow transport name</emphasis><literal>&gt;</literal>
66843 </literallayout>
66844 <para>
66845 If the shadow transport did not succeed, the error message is put in
66846 parentheses afterwards.
66847 </para>
66848 <para>
66849 <indexterm role="concept">
66850 <primary>asterisk</primary>
66851 <secondary>after IP address</secondary>
66852 </indexterm>
66853 When more than one address is included in a single delivery (for example, two
66854 SMTP RCPT commands in one transaction) the second and subsequent addresses are
66855 flagged with <literal>-&gt;</literal> instead of <literal>=&gt;</literal>. When two or more messages are delivered
66856 down a single SMTP connection, an asterisk follows the IP address in the log
66857 lines for the second and subsequent messages.
66858 When two or more messages are delivered down a single TLS connection, the
66859 DNS and some TLS-related information logged for the first message delivered
66860 will not be present in the log lines for the second and subsequent messages.
66861 TLS cipher information is still available.
66862 </para>
66863 <para>
66864 <indexterm role="concept">
66865 <primary>delivery</primary>
66866 <secondary>cutthrough; logging</secondary>
66867 </indexterm>
66868 <indexterm role="concept">
66869 <primary>cutthrough</primary>
66870 <secondary>logging</secondary>
66871 </indexterm>
66872 When delivery is done in cutthrough mode it is flagged with <literal>&gt;&gt;</literal> and the log
66873 line precedes the reception line, since cutthrough waits for a possible
66874 rejection from the destination in case it can reject the sourced item.
66875 </para>
66876 <para>
66877 The generation of a reply message by a filter file gets logged as a
66878 <quote>delivery</quote> to the addressee, preceded by <quote>&gt;</quote>.
66879 </para>
66880 <para>
66881 The <option>log_selector</option> option can be used to request the logging of additional
66882 data when a message is delivered. See section <xref linkend="SECTlogselector"/> below.
66883 </para>
66884 </section>
66885 <section id="SECID253">
66886 <title>Discarded deliveries</title>
66887 <para>
66888 <indexterm role="concept">
66889 <primary>discarded messages</primary>
66890 </indexterm>
66891 <indexterm role="concept">
66892 <primary>message</primary>
66893 <secondary>discarded</secondary>
66894 </indexterm>
66895 <indexterm role="concept">
66896 <primary>delivery</primary>
66897 <secondary>discarded; logging</secondary>
66898 </indexterm>
66899 When a message is discarded as a result of the command <quote>seen finish</quote> being
66900 obeyed in a filter file which generates no deliveries, a log entry of the form
66901 </para>
66902 <literallayout class="monospaced">
66903 2002-12-10 00:50:49 16auJc-0001UB-00 =&gt; discarded
66904   &lt;low.club@bridge.example&gt; R=userforward
66905 </literallayout>
66906 <para>
66907 is written, to record why no deliveries are logged. When a message is discarded
66908 because it is aliased to <quote>:blackhole:</quote> the log line is like this:
66909 </para>
66910 <literallayout class="monospaced">
66911 1999-03-02 09:44:33 10HmaX-0005vi-00 =&gt; :blackhole:
66912   &lt;hole@nowhere.example&gt; R=blackhole_router
66913 </literallayout>
66914 </section>
66915 <section id="SECID254">
66916 <title>Deferred deliveries</title>
66917 <para>
66918 When a delivery is deferred, a line of the following form is logged:
66919 </para>
66920 <literallayout class="monospaced">
66921 2002-12-19 16:20:23 16aiQz-0002Q5-00 == marvin@endrest.example
66922   R=dnslookup T=smtp defer (146): Connection refused
66923 </literallayout>
66924 <para>
66925 In the case of remote deliveries, the error is the one that was given for the
66926 last IP address that was tried. Details of individual SMTP failures are also
66927 written to the log, so the above line would be preceded by something like
66928 </para>
66929 <literallayout class="monospaced">
66930 2002-12-19 16:20:23 16aiQz-0002Q5-00 Failed to connect to
66931   mail1.endrest.example [192.168.239.239]: Connection refused
66932 </literallayout>
66933 <para>
66934 When a deferred address is skipped because its retry time has not been reached,
66935 a message is written to the log, but this can be suppressed by setting an
66936 appropriate value in <option>log_selector</option>.
66937 </para>
66938 </section>
66939 <section id="SECID255">
66940 <title>Delivery failures</title>
66941 <para>
66942 <indexterm role="concept">
66943 <primary>delivery</primary>
66944 <secondary>failure; logging</secondary>
66945 </indexterm>
66946 If a delivery fails because an address cannot be routed, a line of the
66947 following form is logged:
66948 </para>
66949 <literallayout class="monospaced">
66950 1995-12-19 16:20:23 0tRiQz-0002Q5-00 ** jim@trek99.example
66951   &lt;jim@trek99.example&gt;: unknown mail domain
66952 </literallayout>
66953 <para>
66954 If a delivery fails at transport time, the router and transport are shown, and
66955 the response from the remote host is included, as in this example:
66956 </para>
66957 <literallayout class="monospaced">
66958 2002-07-11 07:14:17 17SXDU-000189-00 ** ace400@pb.example
66959   R=dnslookup T=remote_smtp: SMTP error from remote mailer
66960   after pipelined RCPT TO:&lt;ace400@pb.example&gt;: host
66961   pbmail3.py.example [192.168.63.111]: 553 5.3.0
66962   &lt;ace400@pb.example&gt;...Addressee unknown
66963 </literallayout>
66964 <para>
66965 The word <quote>pipelined</quote> indicates that the SMTP PIPELINING extension was being
66966 used. See <option>hosts_avoid_esmtp</option> in the <command>smtp</command> transport for a way of
66967 disabling PIPELINING. The log lines for all forms of delivery failure are
66968 flagged with <literal>**</literal>.
66969 </para>
66970 </section>
66971 <section id="SECID256">
66972 <title>Fake deliveries</title>
66973 <para>
66974 <indexterm role="concept">
66975 <primary>delivery</primary>
66976 <secondary>fake; logging</secondary>
66977 </indexterm>
66978 If a delivery does not actually take place because the <option>-N</option> option has been
66979 used to suppress it, a normal delivery line is written to the log, except that
66980 <quote>=&gt;</quote> is replaced by <quote>*&gt;</quote>.
66981 </para>
66982 </section>
66983 <section id="SECID257">
66984 <title>Completion</title>
66985 <para>
66986 A line of the form
66987 </para>
66988 <literallayout class="monospaced">
66989 2002-10-31 09:00:11 16ZCW1-0005MB-00 Completed
66990 </literallayout>
66991 <para>
66992 is written to the main log when a message is about to be removed from the spool
66993 at the end of its processing.
66994 </para>
66995 </section>
66996 <section id="SECID258">
66997 <title>Summary of Fields in Log Lines</title>
66998 <para>
66999 <indexterm role="concept">
67000 <primary>log</primary>
67001 <secondary>summary of fields</secondary>
67002 </indexterm>
67003 A summary of the field identifiers that are used in log lines is shown in
67004 the following table:
67005 </para>
67006 <literallayout>
67007 <literal>A   </literal>        authenticator name (and optional id and sender)
67008 <literal>C   </literal>        SMTP confirmation on delivery
67009 <literal>    </literal>        command list for <quote>no mail in SMTP session</quote>
67010 <literal>CV  </literal>        certificate verification status
67011 <literal>D   </literal>        duration of <quote>no mail in SMTP session</quote>
67012 <literal>DKIM</literal>        domain verified in incoming message
67013 <literal>DN  </literal>        distinguished name from peer certificate
67014 <literal>DS  </literal>        DNSSEC secured lookups
67015 <literal>DT  </literal>        on <literal>=&gt;</literal> lines: time taken for a delivery
67016 <literal>F   </literal>        sender address (on delivery lines)
67017 <literal>H   </literal>        host name and IP address
67018 <literal>I   </literal>        local interface used
67019 <literal>id  </literal>        message id for incoming message
67020 <literal>K   </literal>        CHUNKING extension used
67021 <literal>L   </literal>        on <literal>&lt;=</literal> and <literal>=&gt;</literal> lines: PIPELINING extension used
67022 <literal>M8S </literal>        8BITMIME status for incoming message
67023 <literal>P   </literal>        on <literal>&lt;=</literal> lines: protocol used
67024 <literal>    </literal>        on <literal>=&gt;</literal> and <literal>**</literal> lines: return path
67025 <literal>PRDR</literal>        PRDR extension used
67026 <literal>PRX </literal>        on <literal>&lt;=</literal> and <literal>=&gt;</literal> lines: proxy address
67027 <literal>Q   </literal>        alternate queue name
67028 <literal>QT  </literal>        on <literal>=&gt;</literal> lines: time spent on queue so far
67029 <literal>    </literal>        on <quote>Completed</quote> lines: time spent on queue
67030 <literal>R   </literal>        on <literal>&lt;=</literal> lines: reference for local bounce
67031 <literal>    </literal>        on <literal>=&gt;</literal>  <literal>&gt;&gt;</literal> <literal>**</literal> and <literal>==</literal> lines: router name
67032 <literal>RT  </literal>        on <literal>&lt;=</literal> lines: time taken for reception
67033 <literal>S   </literal>        size of message in bytes
67034 <literal>SNI </literal>        server name indication from TLS client hello
67035 <literal>ST  </literal>        shadow transport name
67036 <literal>T   </literal>        on <literal>&lt;=</literal> lines: message subject (topic)
67037 <literal>TFO </literal>        connection took advantage of TCP Fast Open
67038 <literal>    </literal>        on <literal>=&gt;</literal> <literal>**</literal> and <literal>==</literal> lines: transport name
67039 <literal>U   </literal>        local user or RFC 1413 identity
67040 <literal>X   </literal>        TLS cipher suite
67041 </literallayout>
67042 </section>
67043 <section id="SECID259">
67044 <title>Other log entries</title>
67045 <para>
67046 Various other types of log entry are written from time to time. Most should be
67047 self-explanatory. Among the more common are:
67048 </para>
67049 <itemizedlist>
67050 <listitem>
67051 <para>
67052 <indexterm role="concept">
67053 <primary>retry</primary>
67054 <secondary>time not reached</secondary>
67055 </indexterm>
67056 <emphasis>retry time not reached</emphasis>&nbsp;&nbsp;An address previously suffered a temporary error
67057 during routing or local delivery, and the time to retry has not yet arrived.
67058 This message is not written to an individual message log file unless it happens
67059 during the first delivery attempt.
67060 </para>
67061 </listitem>
67062 <listitem>
67063 <para>
67064 <emphasis>retry time not reached for any host</emphasis>&nbsp;&nbsp;An address previously suffered
67065 temporary errors during remote delivery, and the retry time has not yet arrived
67066 for any of the hosts to which it is routed.
67067 </para>
67068 </listitem>
67069 <listitem>
67070 <para>
67071 <indexterm role="concept">
67072 <primary>spool directory</primary>
67073 <secondary>file locked</secondary>
67074 </indexterm>
67075 <emphasis>spool file locked</emphasis>&nbsp;&nbsp;An attempt to deliver a message cannot proceed because
67076 some other Exim process is already working on the message. This can be quite
67077 common if queue running processes are started at frequent intervals. The
67078 <emphasis>exiwhat</emphasis> utility script can be used to find out what Exim processes are
67079 doing.
67080 </para>
67081 </listitem>
67082 <listitem>
67083 <para>
67084 <indexterm role="concept">
67085 <primary>error</primary>
67086 <secondary>ignored</secondary>
67087 </indexterm>
67088 <emphasis>error ignored</emphasis>&nbsp;&nbsp;There are several circumstances that give rise to this
67089 message:
67090 </para>
67091 <orderedlist numeration="arabic">
67092 <listitem>
67093 <para>
67094 Exim failed to deliver a bounce message whose age was greater than
67095 <option>ignore_bounce_errors_after</option>. The bounce was discarded.
67096 </para>
67097 </listitem>
67098 <listitem>
67099 <para>
67100 A filter file set up a delivery using the <quote>noerror</quote> option, and the delivery
67101 failed. The delivery was discarded.
67102 </para>
67103 </listitem>
67104 <listitem>
67105 <para>
67106 A delivery set up by a router configured with
67107 </para>
67108 <literallayout class="monospaced">
67109     errors_to = &lt;&gt;
67110 </literallayout>
67111 <para>
67112 failed. The delivery was discarded.
67113 </para>
67114 </listitem>
67115 </orderedlist>
67116 </listitem>
67117 <listitem>
67118 <para>
67119 <indexterm role="concept">
67120 <primary>DKIM</primary>
67121 <secondary>log line</secondary>
67122 </indexterm>
67123 <emphasis>DKIM: d=</emphasis>&nbsp;&nbsp;Verbose results of a DKIM verification attempt, if enabled for
67124 logging and the message has a DKIM signature header.
67125 </para>
67126 </listitem>
67127 </itemizedlist>
67128 </section>
67129 <section id="SECTlogselector">
67130 <title>Reducing or increasing what is logged</title>
67131 <para>
67132 <indexterm role="concept">
67133 <primary>log</primary>
67134 <secondary>selectors</secondary>
67135 </indexterm>
67136 By setting the <option>log_selector</option> global option, you can disable some of Exim&#x2019;s
67137 default logging, or you can request additional logging. The value of
67138 <option>log_selector</option> is made up of names preceded by plus or minus characters. For
67139 example:
67140 </para>
67141 <literallayout class="monospaced">
67142 log_selector = +arguments -retry_defer
67143 </literallayout>
67144 <para>
67145 The list of optional log items is in the following table, with the default
67146 selection marked by asterisks:
67147 </para>
67148 <literallayout>
67149 <literal> 8bitmime                   </literal>  received 8BITMIME status
67150 <literal>*acl_warn_skipped           </literal>  skipped <option>warn</option> statement in ACL
67151 <literal> address_rewrite            </literal>  address rewriting
67152 <literal> all_parents                </literal>  all parents in =&gt; lines
67153 <literal> arguments                  </literal>  command line arguments
67154 <literal>*connection_reject          </literal>  connection rejections
67155 <literal>*delay_delivery             </literal>  immediate delivery delayed
67156 <literal> deliver_time               </literal>  time taken to perform delivery
67157 <literal> delivery_size              </literal>  add <literal>S=</literal><emphasis>nnn</emphasis> to =&gt; lines
67158 <literal>*dkim                       </literal>  DKIM verified domain on &lt;= lines
67159 <literal> dkim_verbose               </literal>  separate full DKIM verification result line, per signature
67160 <literal>*dnslist_defer              </literal>  defers of DNS list (aka RBL) lookups
67161 <literal> dnssec                     </literal>  DNSSEC secured lookups
67162 <literal>*etrn                       </literal>  ETRN commands
67163 <literal>*host_lookup_failed         </literal>  as it says
67164 <literal> ident_timeout              </literal>  timeout for ident connection
67165 <literal> incoming_interface         </literal>  local interface on &lt;= and =&gt; lines
67166 <literal> incoming_port              </literal>  remote port on &lt;= lines
67167 <literal>*lost_incoming_connection   </literal>  as it says (includes timeouts)
67168 <literal> millisec                   </literal>  millisecond timestamps and RT,QT,DT,D times
67169 <literal> outgoing_interface         </literal>  local interface on =&gt; lines
67170 <literal> outgoing_port              </literal>  add remote port to =&gt; lines
67171 <literal>*queue_run                  </literal>  start and end queue runs
67172 <literal> queue_time                 </literal>  time on queue for one recipient
67173 <literal> queue_time_overall         </literal>  time on queue for whole message
67174 <literal> pid                        </literal>  Exim process id
67175 <literal> pipelining                 </literal>  PIPELINING use, on &lt;= and =&gt; lines
67176 <literal> proxy                      </literal>  proxy address on &lt;= and =&gt; lines
67177 <literal> receive_time               </literal>  time taken to receive message
67178 <literal> received_recipients        </literal>  recipients on &lt;= lines
67179 <literal> received_sender            </literal>  sender on &lt;= lines
67180 <literal>*rejected_header            </literal>  header contents on reject log
67181 <literal>*retry_defer                </literal>  <quote>retry time not reached</quote>
67182 <literal> return_path_on_delivery    </literal>  put return path on =&gt; and ** lines
67183 <literal> sender_on_delivery         </literal>  add sender to =&gt; lines
67184 <literal>*sender_verify_fail         </literal>  sender verification failures
67185 <literal>*size_reject                </literal>  rejection because too big
67186 <literal>*skip_delivery              </literal>  delivery skipped in a queue run
67187 <literal>*smtp_confirmation          </literal>  SMTP confirmation on =&gt; lines
67188 <literal> smtp_connection            </literal>  incoming SMTP connections
67189 <literal> smtp_incomplete_transaction</literal>  incomplete SMTP transactions
67190 <literal> smtp_mailauth              </literal>  AUTH argument to MAIL commands
67191 <literal> smtp_no_mail               </literal>  session with no MAIL commands
67192 <literal> smtp_protocol_error        </literal>  SMTP protocol errors
67193 <literal> smtp_syntax_error          </literal>  SMTP syntax errors
67194 <literal> subject                    </literal>  contents of <emphasis>Subject:</emphasis> on &lt;= lines
67195 <literal>*tls_certificate_verified   </literal>  certificate verification status
67196 <literal>*tls_cipher                 </literal>  TLS cipher suite on &lt;= and =&gt; lines
67197 <literal> tls_peerdn                 </literal>  TLS peer DN on &lt;= and =&gt; lines
67198 <literal> tls_sni                    </literal>  TLS SNI on &lt;= lines
67199 <literal> unknown_in_list            </literal>  DNS lookup failed in list match
67200
67201 <literal> all                        </literal>  all of the above
67202 </literallayout>
67203 <para>
67204 See also the <option>slow_lookup_log</option> main configuration option,
67205 section <xref linkend="SECID99"/>
67206 </para>
67207 <para>
67208 More details on each of these items follows:
67209 </para>
67210 <itemizedlist>
67211 <listitem>
67212 <para>
67213 <indexterm role="concept">
67214 <primary>8BITMIME</primary>
67215 </indexterm>
67216 <indexterm role="concept">
67217 <primary>log</primary>
67218 <secondary>8BITMIME</secondary>
67219 </indexterm>
67220 <option>8bitmime</option>: This causes Exim to log any 8BITMIME status of received messages,
67221 which may help in tracking down interoperability issues with ancient MTAs
67222 that are not 8bit clean.  This is added to the <quote>&lt;=</quote> line, tagged with
67223 <literal>M8S=</literal> and a value of <literal>0</literal>, <literal>7</literal> or <literal>8</literal>, corresponding to "not given",
67224 <literal>7BIT</literal> and <literal>8BITMIME</literal> respectively.
67225 </para>
67226 </listitem>
67227 <listitem>
67228 <para>
67229 <indexterm role="concept">
67230 <primary><option>warn</option> ACL verb</primary>
67231 <secondary>log when skipping</secondary>
67232 </indexterm>
67233 <option>acl_warn_skipped</option>: When an ACL <option>warn</option> statement is skipped because one of
67234 its conditions cannot be evaluated, a log line to this effect is written if
67235 this log selector is set.
67236 </para>
67237 </listitem>
67238 <listitem>
67239 <para>
67240 <indexterm role="concept">
67241 <primary>log</primary>
67242 <secondary>rewriting</secondary>
67243 </indexterm>
67244 <indexterm role="concept">
67245 <primary>rewriting</primary>
67246 <secondary>logging</secondary>
67247 </indexterm>
67248 <option>address_rewrite</option>: This applies both to global rewrites and per-transport
67249 rewrites, but not to rewrites in filters run as an unprivileged user (because
67250 such users cannot access the log).
67251 </para>
67252 </listitem>
67253 <listitem>
67254 <para>
67255 <indexterm role="concept">
67256 <primary>log</primary>
67257 <secondary>full parentage</secondary>
67258 </indexterm>
67259 <option>all_parents</option>: Normally only the original and final addresses are logged on
67260 delivery lines; with this selector, intermediate parents are given in
67261 parentheses between them.
67262 </para>
67263 </listitem>
67264 <listitem>
67265 <para>
67266 <indexterm role="concept">
67267 <primary>log</primary>
67268 <secondary>Exim arguments</secondary>
67269 </indexterm>
67270 <indexterm role="concept">
67271 <primary>Exim arguments, logging</primary>
67272 </indexterm>
67273 <option>arguments</option>: This causes Exim to write the arguments with which it was called
67274 to the main log, preceded by the current working directory. This is a debugging
67275 feature, added to make it easier to find out how certain MUAs call
67276 <filename>/usr/sbin/sendmail</filename>. The logging does not happen if Exim has given up root
67277 privilege because it was called with the <option>-C</option> or <option>-D</option> options. Arguments
67278 that are empty or that contain white space are quoted. Non-printing characters
67279 are shown as escape sequences. This facility cannot log unrecognized arguments,
67280 because the arguments are checked before the configuration file is read. The
67281 only way to log such cases is to interpose a script such as <filename>util/logargs.sh</filename>
67282 between the caller and Exim.
67283 </para>
67284 </listitem>
67285 <listitem>
67286 <para>
67287 <indexterm role="concept">
67288 <primary>log</primary>
67289 <secondary>connection rejections</secondary>
67290 </indexterm>
67291 <option>connection_reject</option>: A log entry is written whenever an incoming SMTP
67292 connection is rejected, for whatever reason.
67293 </para>
67294 </listitem>
67295 <listitem>
67296 <para>
67297 <indexterm role="concept">
67298 <primary>log</primary>
67299 <secondary>delayed delivery</secondary>
67300 </indexterm>
67301 <indexterm role="concept">
67302 <primary>delayed delivery, logging</primary>
67303 </indexterm>
67304 <option>delay_delivery</option>: A log entry is written whenever a delivery process is not
67305 started for an incoming message because the load is too high or too many
67306 messages were received on one connection. Logging does not occur if no delivery
67307 process is started because <option>queue_only</option> is set or <option>-odq</option> was used.
67308 </para>
67309 </listitem>
67310 <listitem>
67311 <para>
67312 <indexterm role="concept">
67313 <primary>log</primary>
67314 <secondary>delivery duration</secondary>
67315 </indexterm>
67316 <option>deliver_time</option>: For each delivery, the amount of real time it has taken to
67317 perform the actual delivery is logged as DT=&lt;<emphasis>time</emphasis>&gt;, for example, <literal>DT=1s</literal>.
67318 If millisecond logging is enabled, short times will be shown with greater
67319 precision, eg. <literal>DT=0.304s</literal>.
67320 </para>
67321 </listitem>
67322 <listitem>
67323 <para>
67324 <indexterm role="concept">
67325 <primary>log</primary>
67326 <secondary>message size on delivery</secondary>
67327 </indexterm>
67328 <indexterm role="concept">
67329 <primary>size</primary>
67330 <secondary>of message</secondary>
67331 </indexterm>
67332 <option>delivery_size</option>: For each delivery, the size of message delivered is added to
67333 the <quote>=&gt;</quote> line, tagged with S=.
67334 </para>
67335 </listitem>
67336 <listitem>
67337 <para>
67338 <indexterm role="concept">
67339 <primary>log</primary>
67340 <secondary>DKIM verification</secondary>
67341 </indexterm>
67342 <indexterm role="concept">
67343 <primary>DKIM</primary>
67344 <secondary>verification logging</secondary>
67345 </indexterm>
67346 <option>dkim</option>: For message acceptance log lines, when an DKIM signature in the header
67347 verifies successfully a tag of DKIM is added, with one of the verified domains.
67348 </para>
67349 </listitem>
67350 <listitem>
67351 <para>
67352 <indexterm role="concept">
67353 <primary>log</primary>
67354 <secondary>DKIM verification</secondary>
67355 </indexterm>
67356 <indexterm role="concept">
67357 <primary>DKIM</primary>
67358 <secondary>verification logging</secondary>
67359 </indexterm>
67360 <option>dkim_verbose</option>: A log entry is written for each attempted DKIM verification.
67361 </para>
67362 </listitem>
67363 <listitem>
67364 <para>
67365 <indexterm role="concept">
67366 <primary>log</primary>
67367 <secondary>dnslist defer</secondary>
67368 </indexterm>
67369 <indexterm role="concept">
67370 <primary>DNS list</primary>
67371 <secondary>logging defer</secondary>
67372 </indexterm>
67373 <indexterm role="concept">
67374 <primary>black list (DNS)</primary>
67375 </indexterm>
67376 <option>dnslist_defer</option>: A log entry is written if an attempt to look up a host in a
67377 DNS black list suffers a temporary error.
67378 </para>
67379 </listitem>
67380 <listitem>
67381 <para>
67382 <indexterm role="concept">
67383 <primary>log</primary>
67384 <secondary>dnssec</secondary>
67385 </indexterm>
67386 <indexterm role="concept">
67387 <primary>dnssec</primary>
67388 <secondary>logging</secondary>
67389 </indexterm>
67390 <option>dnssec</option>: For message acceptance and (attempted) delivery log lines, when
67391 dns lookups gave secure results a tag of DS is added.
67392 For acceptance this covers the reverse and forward lookups for host name verification.
67393 It does not cover helo-name verification.
67394 For delivery this covers the SRV, MX, A and/or AAAA lookups.
67395 </para>
67396 </listitem>
67397 <listitem>
67398 <para>
67399 <indexterm role="concept">
67400 <primary>log</primary>
67401 <secondary>ETRN commands</secondary>
67402 </indexterm>
67403 <indexterm role="concept">
67404 <primary>ETRN</primary>
67405 <secondary>logging</secondary>
67406 </indexterm>
67407 <option>etrn</option>: Every valid ETRN command that is received is logged, before the ACL
67408 is run to determine whether or not it is actually accepted. An invalid ETRN
67409 command, or one received within a message transaction is not logged by this
67410 selector (see <option>smtp_syntax_error</option> and <option>smtp_protocol_error</option>).
67411 </para>
67412 </listitem>
67413 <listitem>
67414 <para>
67415 <indexterm role="concept">
67416 <primary>log</primary>
67417 <secondary>host lookup failure</secondary>
67418 </indexterm>
67419 <option>host_lookup_failed</option>: When a lookup of a host&#x2019;s IP addresses fails to find
67420 any addresses, or when a lookup of an IP address fails to find a host name, a
67421 log line is written. This logging does not apply to direct DNS lookups when
67422 routing email addresses, but it does apply to <quote>byname</quote> lookups.
67423 </para>
67424 </listitem>
67425 <listitem>
67426 <para>
67427 <indexterm role="concept">
67428 <primary>log</primary>
67429 <secondary>ident timeout</secondary>
67430 </indexterm>
67431 <indexterm role="concept">
67432 <primary>RFC 1413</primary>
67433 <secondary>logging timeout</secondary>
67434 </indexterm>
67435 <option>ident_timeout</option>: A log line is written whenever an attempt to connect to a
67436 client&#x2019;s ident port times out.
67437 </para>
67438 </listitem>
67439 <listitem>
67440 <para>
67441 <indexterm role="concept">
67442 <primary>log</primary>
67443 <secondary>incoming interface</secondary>
67444 </indexterm>
67445 <indexterm role="concept">
67446 <primary>log</primary>
67447 <secondary>local interface</secondary>
67448 </indexterm>
67449 <indexterm role="concept">
67450 <primary>log</primary>
67451 <secondary>local address and port</secondary>
67452 </indexterm>
67453 <indexterm role="concept">
67454 <primary>TCP/IP</primary>
67455 <secondary>logging local address and port</secondary>
67456 </indexterm>
67457 <indexterm role="concept">
67458 <primary>interface</primary>
67459 <secondary>logging</secondary>
67460 </indexterm>
67461 <option>incoming_interface</option>: The interface on which a message was received is added
67462 to the <quote>&lt;=</quote> line as an IP address in square brackets, tagged by I= and
67463 followed by a colon and the port number. The local interface and port are also
67464 added to other SMTP log lines, for example, <quote>SMTP connection from</quote>, to
67465 rejection lines, and (despite the name) to outgoing <quote>=&gt;</quote> and <quote>-&gt;</quote> lines.
67466 The latter can be disabled by turning off the <option>outgoing_interface</option> option.
67467 </para>
67468 </listitem>
67469 <listitem>
67470 <para>
67471 <indexterm role="concept">
67472 <primary>log</primary>
67473 <secondary>incoming proxy address</secondary>
67474 </indexterm>
67475 <indexterm role="concept">
67476 <primary>proxy</primary>
67477 <secondary>logging proxy address</secondary>
67478 </indexterm>
67479 <indexterm role="concept">
67480 <primary>TCP/IP</primary>
67481 <secondary>logging proxy address</secondary>
67482 </indexterm>
67483 <option>proxy</option>: The internal (closest to the system running Exim) IP address
67484 of the proxy, tagged by PRX=, on the <quote>&lt;=</quote> line for a message accepted
67485 on a proxied connection
67486 or the <quote>=&gt;</quote> line for a message delivered on a proxied connection.
67487 See <xref linkend="SECTproxyInbound"/> for more information.
67488 </para>
67489 </listitem>
67490 <listitem>
67491 <para>
67492 <indexterm role="concept">
67493 <primary>log</primary>
67494 <secondary>incoming remote port</secondary>
67495 </indexterm>
67496 <indexterm role="concept">
67497 <primary>port</primary>
67498 <secondary>logging remote</secondary>
67499 </indexterm>
67500 <indexterm role="concept">
67501 <primary>TCP/IP</primary>
67502 <secondary>logging incoming remote port</secondary>
67503 </indexterm>
67504 <indexterm role="variable">
67505 <primary><varname>$sender_fullhost</varname></primary>
67506 </indexterm>
67507 <indexterm role="variable">
67508 <primary><varname>$sender_rcvhost</varname></primary>
67509 </indexterm>
67510 <option>incoming_port</option>: The remote port number from which a message was received is
67511 added to log entries and <emphasis>Received:</emphasis> header lines, following the IP address
67512 in square brackets, and separated from it by a colon. This is implemented by
67513 changing the value that is put in the <varname>$sender_fullhost</varname> and
67514 <varname>$sender_rcvhost</varname> variables. Recording the remote port number has become more
67515 important with the widening use of NAT (see RFC 2505).
67516 </para>
67517 </listitem>
67518 <listitem>
67519 <para>
67520 <indexterm role="concept">
67521 <primary>log</primary>
67522 <secondary>dropped connection</secondary>
67523 </indexterm>
67524 <option>lost_incoming_connection</option>: A log line is written when an incoming SMTP
67525 connection is unexpectedly dropped.
67526 </para>
67527 </listitem>
67528 <listitem>
67529 <para>
67530 <indexterm role="concept">
67531 <primary>log</primary>
67532 <secondary>millisecond timestamps</secondary>
67533 </indexterm>
67534 <indexterm role="concept">
67535 <primary>millisecond</primary>
67536 <secondary>logging</secondary>
67537 </indexterm>
67538 <indexterm role="concept">
67539 <primary>timestamps</primary>
67540 <secondary>millisecond, in logs</secondary>
67541 </indexterm>
67542 <option>millisec</option>: Timestamps have a period and three decimal places of finer granularity
67543 appended to the seconds value.
67544 </para>
67545 </listitem>
67546 <listitem>
67547 <para>
67548 <indexterm role="concept">
67549 <primary>log</primary>
67550 <secondary>outgoing interface</secondary>
67551 </indexterm>
67552 <indexterm role="concept">
67553 <primary>log</primary>
67554 <secondary>local interface</secondary>
67555 </indexterm>
67556 <indexterm role="concept">
67557 <primary>log</primary>
67558 <secondary>local address and port</secondary>
67559 </indexterm>
67560 <indexterm role="concept">
67561 <primary>TCP/IP</primary>
67562 <secondary>logging local address and port</secondary>
67563 </indexterm>
67564 <indexterm role="concept">
67565 <primary>interface</primary>
67566 <secondary>logging</secondary>
67567 </indexterm>
67568 <option>outgoing_interface</option>: If <option>incoming_interface</option> is turned on, then the
67569 interface on which a message was sent is added to delivery lines as an I= tag
67570 followed by IP address in square brackets. You can disable this by turning
67571 off the <option>outgoing_interface</option> option.
67572 </para>
67573 </listitem>
67574 <listitem>
67575 <para>
67576 <indexterm role="concept">
67577 <primary>log</primary>
67578 <secondary>outgoing remote port</secondary>
67579 </indexterm>
67580 <indexterm role="concept">
67581 <primary>port</primary>
67582 <secondary>logging outgoing remote</secondary>
67583 </indexterm>
67584 <indexterm role="concept">
67585 <primary>TCP/IP</primary>
67586 <secondary>logging outgoing remote port</secondary>
67587 </indexterm>
67588 <option>outgoing_port</option>: The remote port number is added to delivery log lines (those
67589 containing =&gt; tags) following the IP address.
67590 The local port is also added if <option>incoming_interface</option> and
67591 <option>outgoing_interface</option> are both enabled.
67592 This option is not included in the default setting, because for most ordinary
67593 configurations, the remote port number is always 25 (the SMTP port), and the
67594 local port is a random ephemeral port.
67595 </para>
67596 </listitem>
67597 <listitem>
67598 <para>
67599 <indexterm role="concept">
67600 <primary>log</primary>
67601 <secondary>process ids in</secondary>
67602 </indexterm>
67603 <indexterm role="concept">
67604 <primary>pid (process id)</primary>
67605 <secondary>in log lines</secondary>
67606 </indexterm>
67607 <option>pid</option>: The current process id is added to every log line, in square brackets,
67608 immediately after the time and date.
67609 </para>
67610 </listitem>
67611 <listitem>
67612 <para revisionflag="changed">
67613 <indexterm role="concept">
67614 <primary>log</primary>
67615 <secondary>pipelining</secondary>
67616 </indexterm>
67617 <indexterm role="concept">
67618 <primary>pipelining</primary>
67619 <secondary>logging outgoing</secondary>
67620 </indexterm>
67621 <option>pipelining</option>: A field is added to delivery and accept
67622 log lines when the ESMTP PIPELINING extension was used.
67623 The field is a single "L".
67624 </para>
67625 <para revisionflag="changed">
67626 On accept lines, where PIPELINING was offered but not used by the client,
67627 the field has a minus appended.
67628 </para>
67629 </listitem>
67630 <listitem>
67631 <para revisionflag="changed">
67632 <indexterm role="concept">
67633 <primary>log</primary>
67634 <secondary>queue run</secondary>
67635 </indexterm>
67636 <indexterm role="concept">
67637 <primary>queue runner</primary>
67638 <secondary>logging</secondary>
67639 </indexterm>
67640 <option>queue_run</option>: The start and end of every queue run are logged.
67641 </para>
67642 </listitem>
67643 <listitem>
67644 <para revisionflag="changed">
67645 <indexterm role="concept">
67646 <primary>log</primary>
67647 <secondary>queue time</secondary>
67648 </indexterm>
67649 <option>queue_time</option>: The amount of time the message has been in the queue on the
67650 local host is logged as QT=&lt;<emphasis>time</emphasis>&gt; on delivery (<literal>=&gt;</literal>) lines, for example,
67651 <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the message, so it
67652 includes reception time as well as the delivery time for the current address.
67653 This means that it may be longer than the difference between the arrival and
67654 delivery log line times, because the arrival log line is not written until the
67655 message has been successfully received.
67656 If millisecond logging is enabled, short times will be shown with greater
67657 precision, eg. <literal>QT=1.578s</literal>.
67658 </para>
67659 </listitem>
67660 <listitem>
67661 <para revisionflag="changed">
67662 <option>queue_time_overall</option>: The amount of time the message has been in the queue on
67663 the local host is logged as QT=&lt;<emphasis>time</emphasis>&gt; on <quote>Completed</quote> lines, for
67664 example, <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the
67665 message, so it includes reception time as well as the total delivery time.
67666 </para>
67667 </listitem>
67668 <listitem>
67669 <para revisionflag="changed">
67670 <indexterm role="concept">
67671 <primary>log</primary>
67672 <secondary>receive duration</secondary>
67673 </indexterm>
67674 <option>receive_time</option>: For each message, the amount of real time it has taken to
67675 perform the reception is logged as RT=&lt;<emphasis>time</emphasis>&gt;, for example, <literal>RT=1s</literal>.
67676 If millisecond logging is enabled, short times will be shown with greater
67677 precision, eg. <literal>RT=0.204s</literal>.
67678 </para>
67679 </listitem>
67680 <listitem>
67681 <para revisionflag="changed">
67682 <indexterm role="concept">
67683 <primary>log</primary>
67684 <secondary>recipients</secondary>
67685 </indexterm>
67686 <option>received_recipients</option>: The recipients of a message are listed in the main log
67687 as soon as the message is received. The list appears at the end of the log line
67688 that is written when a message is received, preceded by the word <quote>for</quote>. The
67689 addresses are listed after they have been qualified, but before any rewriting
67690 has taken place.
67691 Recipients that were discarded by an ACL for MAIL or RCPT do not appear
67692 in the list.
67693 </para>
67694 </listitem>
67695 <listitem>
67696 <para revisionflag="changed">
67697 <indexterm role="concept">
67698 <primary>log</primary>
67699 <secondary>sender reception</secondary>
67700 </indexterm>
67701 <option>received_sender</option>: The unrewritten original sender of a message is added to
67702 the end of the log line that records the message&#x2019;s arrival, after the word
67703 <quote>from</quote> (before the recipients if <option>received_recipients</option> is also set).
67704 </para>
67705 </listitem>
67706 <listitem>
67707 <para revisionflag="changed">
67708 <indexterm role="concept">
67709 <primary>log</primary>
67710 <secondary>header lines for rejection</secondary>
67711 </indexterm>
67712 <option>rejected_header</option>: If a message&#x2019;s header has been received at the time a
67713 rejection is written to the reject log, the complete header is added to the
67714 log. Header logging can be turned off individually for messages that are
67715 rejected by the <function>local_scan()</function> function (see section <xref linkend="SECTapiforloc"/>).
67716 </para>
67717 </listitem>
67718 <listitem>
67719 <para revisionflag="changed">
67720 <indexterm role="concept">
67721 <primary>log</primary>
67722 <secondary>retry defer</secondary>
67723 </indexterm>
67724 <option>retry_defer</option>: A log line is written if a delivery is deferred because a
67725 retry time has not yet been reached. However, this <quote>retry time not reached</quote>
67726 message is always omitted from individual message logs after the first delivery
67727 attempt.
67728 </para>
67729 </listitem>
67730 <listitem>
67731 <para revisionflag="changed">
67732 <indexterm role="concept">
67733 <primary>log</primary>
67734 <secondary>return path</secondary>
67735 </indexterm>
67736 <option>return_path_on_delivery</option>: The return path that is being transmitted with
67737 the message is included in delivery and bounce lines, using the tag P=.
67738 This is omitted if no delivery actually happens, for example, if routing fails,
67739 or if delivery is to <filename>/dev/null</filename> or to <literal>:blackhole:</literal>.
67740 </para>
67741 </listitem>
67742 <listitem>
67743 <para revisionflag="changed">
67744 <indexterm role="concept">
67745 <primary>log</primary>
67746 <secondary>sender on delivery</secondary>
67747 </indexterm>
67748 <option>sender_on_delivery</option>: The message&#x2019;s sender address is added to every delivery
67749 and bounce line, tagged by F= (for <quote>from</quote>).
67750 This is the original sender that was received with the message; it is not
67751 necessarily the same as the outgoing return path.
67752 </para>
67753 </listitem>
67754 <listitem>
67755 <para revisionflag="changed">
67756 <indexterm role="concept">
67757 <primary>log</primary>
67758 <secondary>sender verify failure</secondary>
67759 </indexterm>
67760 <option>sender_verify_fail</option>: If this selector is unset, the separate log line that
67761 gives details of a sender verification failure is not written. Log lines for
67762 the rejection of SMTP commands contain just <quote>sender verify failed</quote>, so some
67763 detail is lost.
67764 </para>
67765 </listitem>
67766 <listitem>
67767 <para revisionflag="changed">
67768 <indexterm role="concept">
67769 <primary>log</primary>
67770 <secondary>size rejection</secondary>
67771 </indexterm>
67772 <option>size_reject</option>: A log line is written whenever a message is rejected because
67773 it is too big.
67774 </para>
67775 </listitem>
67776 <listitem>
67777 <para revisionflag="changed">
67778 <indexterm role="concept">
67779 <primary>log</primary>
67780 <secondary>frozen messages; skipped</secondary>
67781 </indexterm>
67782 <indexterm role="concept">
67783 <primary>frozen messages</primary>
67784 <secondary>logging skipping</secondary>
67785 </indexterm>
67786 <option>skip_delivery</option>: A log line is written whenever a message is skipped during a
67787 queue run because it is frozen or because another process is already delivering
67788 it.
67789 <indexterm role="concept">
67790 <primary><quote>spool file is locked</quote></primary>
67791 </indexterm>
67792 The message that is written is <quote>spool file is locked</quote>.
67793 </para>
67794 </listitem>
67795 <listitem>
67796 <para revisionflag="changed">
67797 <indexterm role="concept">
67798 <primary>log</primary>
67799 <secondary>smtp confirmation</secondary>
67800 </indexterm>
67801 <indexterm role="concept">
67802 <primary>SMTP</primary>
67803 <secondary>logging confirmation</secondary>
67804 </indexterm>
67805 <indexterm role="concept">
67806 <primary>LMTP</primary>
67807 <secondary>logging confirmation</secondary>
67808 </indexterm>
67809 <option>smtp_confirmation</option>: The response to the final <quote>.</quote> in the SMTP or LMTP dialogue for
67810 outgoing messages is added to delivery log lines in the form <literal>C=</literal>&lt;<emphasis>text</emphasis>&gt;.
67811 A number of MTAs (including Exim) return an identifying string in this
67812 response.
67813 </para>
67814 </listitem>
67815 <listitem>
67816 <para revisionflag="changed">
67817 <indexterm role="concept">
67818 <primary>log</primary>
67819 <secondary>SMTP connections</secondary>
67820 </indexterm>
67821 <indexterm role="concept">
67822 <primary>SMTP</primary>
67823 <secondary>logging connections</secondary>
67824 </indexterm>
67825 <option>smtp_connection</option>: A log line is written whenever an incoming SMTP connection is
67826 established or closed, unless the connection is from a host that matches
67827 <option>hosts_connection_nolog</option>. (In contrast, <option>lost_incoming_connection</option> applies
67828 only when the closure is unexpected.) This applies to connections from local
67829 processes that use <option>-bs</option> as well as to TCP/IP connections. If a connection is
67830 dropped in the middle of a message, a log line is always written, whether or
67831 not this selector is set, but otherwise nothing is written at the start and end
67832 of connections unless this selector is enabled.
67833 </para>
67834 <para revisionflag="changed">
67835 For TCP/IP connections to an Exim daemon, the current number of connections is
67836 included in the log message for each new connection, but note that the count is
67837 reset if the daemon is restarted.
67838 Also, because connections are closed (and the closure is logged) in
67839 subprocesses, the count may not include connections that have been closed but
67840 whose termination the daemon has not yet noticed. Thus, while it is possible to
67841 match up the opening and closing of connections in the log, the value of the
67842 logged counts may not be entirely accurate.
67843 </para>
67844 </listitem>
67845 <listitem>
67846 <para revisionflag="changed">
67847 <indexterm role="concept">
67848 <primary>log</primary>
67849 <secondary>SMTP transaction; incomplete</secondary>
67850 </indexterm>
67851 <indexterm role="concept">
67852 <primary>SMTP</primary>
67853 <secondary>logging incomplete transactions</secondary>
67854 </indexterm>
67855 <option>smtp_incomplete_transaction</option>: When a mail transaction is aborted by
67856 RSET, QUIT, loss of connection, or otherwise, the incident is logged,
67857 and the message sender plus any accepted recipients are included in the log
67858 line. This can provide evidence of dictionary attacks.
67859 </para>
67860 </listitem>
67861 <listitem>
67862 <para revisionflag="changed">
67863 <indexterm role="concept">
67864 <primary>log</primary>
67865 <secondary>non-MAIL SMTP sessions</secondary>
67866 </indexterm>
67867 <indexterm role="concept">
67868 <primary>MAIL</primary>
67869 <secondary>logging session without</secondary>
67870 </indexterm>
67871 <option>smtp_no_mail</option>: A line is written to the main log whenever an accepted SMTP
67872 connection terminates without having issued a MAIL command. This includes both
67873 the case when the connection is dropped, and the case when QUIT is used. It
67874 does not include cases where the connection is rejected right at the start (by
67875 an ACL, or because there are too many connections, or whatever). These cases
67876 already have their own log lines.
67877 </para>
67878 <para revisionflag="changed">
67879 The log line that is written contains the identity of the client in the usual
67880 way, followed by D= and a time, which records the duration of the connection.
67881 If the connection was authenticated, this fact is logged exactly as it is for
67882 an incoming message, with an A= item. If the connection was encrypted, CV=,
67883 DN=, and X= items may appear as they do for an incoming message, controlled by
67884 the same logging options.
67885 </para>
67886 <para revisionflag="changed">
67887 Finally, if any SMTP commands were issued during the connection, a C= item
67888 is added to the line, listing the commands that were used. For example,
67889 </para>
67890 <literallayout class="monospaced" revisionflag="changed">
67891 C=EHLO,QUIT
67892 </literallayout>
67893 <para revisionflag="changed">
67894 shows that the client issued QUIT straight after EHLO. If there were fewer
67895 than 20 commands, they are all listed. If there were more than 20 commands,
67896 the last 20 are listed, preceded by <quote>...</quote>. However, with the default
67897 setting of 10 for <option>smtp_accept_max_nonmail</option>, the connection will in any case
67898 have been aborted before 20 non-mail commands are processed.
67899 </para>
67900 </listitem>
67901 <listitem>
67902 <para revisionflag="changed">
67903 <option>smtp_mailauth</option>: A third subfield with the authenticated sender,
67904 colon-separated, is appended to the A= item for a message arrival or delivery
67905 log line, if an AUTH argument to the SMTP MAIL command (see <xref linkend="SECTauthparamail"/>)
67906 was accepted or used.
67907 </para>
67908 </listitem>
67909 <listitem>
67910 <para revisionflag="changed">
67911 <indexterm role="concept">
67912 <primary>log</primary>
67913 <secondary>SMTP protocol error</secondary>
67914 </indexterm>
67915 <indexterm role="concept">
67916 <primary>SMTP</primary>
67917 <secondary>logging protocol error</secondary>
67918 </indexterm>
67919 <option>smtp_protocol_error</option>: A log line is written for every SMTP protocol error
67920 encountered. Exim does not have perfect detection of all protocol errors
67921 because of transmission delays and the use of pipelining. If PIPELINING has
67922 been advertised to a client, an Exim server assumes that the client will use
67923 it, and therefore it does not count <quote>expected</quote> errors (for example, RCPT
67924 received after rejecting MAIL) as protocol errors.
67925 </para>
67926 </listitem>
67927 <listitem>
67928 <para revisionflag="changed">
67929 <indexterm role="concept">
67930 <primary>SMTP</primary>
67931 <secondary>logging syntax errors</secondary>
67932 </indexterm>
67933 <indexterm role="concept">
67934 <primary>SMTP</primary>
67935 <secondary>syntax errors; logging</secondary>
67936 </indexterm>
67937 <indexterm role="concept">
67938 <primary>SMTP</primary>
67939 <secondary>unknown command; logging</secondary>
67940 </indexterm>
67941 <indexterm role="concept">
67942 <primary>log</primary>
67943 <secondary>unknown SMTP command</secondary>
67944 </indexterm>
67945 <indexterm role="concept">
67946 <primary>log</primary>
67947 <secondary>SMTP syntax error</secondary>
67948 </indexterm>
67949 <option>smtp_syntax_error</option>: A log line is written for every SMTP syntax error
67950 encountered. An unrecognized command is treated as a syntax error. For an
67951 external connection, the host identity is given; for an internal connection
67952 using <option>-bs</option> the sender identification (normally the calling user) is given.
67953 </para>
67954 </listitem>
67955 <listitem>
67956 <para revisionflag="changed">
67957 <indexterm role="concept">
67958 <primary>log</primary>
67959 <secondary>subject</secondary>
67960 </indexterm>
67961 <indexterm role="concept">
67962 <primary>subject, logging</primary>
67963 </indexterm>
67964 <option>subject</option>: The subject of the message is added to the arrival log line,
67965 preceded by <quote>T=</quote> (T for <quote>topic</quote>, since S is already used for <quote>size</quote>).
67966 Any MIME <quote>words</quote> in the subject are decoded. The <option>print_topbitchars</option> option
67967 specifies whether characters with values greater than 127 should be logged
67968 unchanged, or whether they should be rendered as escape sequences.
67969 </para>
67970 </listitem>
67971 <listitem>
67972 <para revisionflag="changed">
67973 <indexterm role="concept">
67974 <primary>log</primary>
67975 <secondary>certificate verification</secondary>
67976 </indexterm>
67977 <indexterm role="concept">
67978 <primary>log</primary>
67979 <secondary>DANE</secondary>
67980 </indexterm>
67981 <indexterm role="concept">
67982 <primary>DANE</primary>
67983 <secondary>logging</secondary>
67984 </indexterm>
67985 <option>tls_certificate_verified</option>: An extra item is added to &lt;= and =&gt; log lines
67986 when TLS is in use. The item is <literal>CV=yes</literal> if the peer&#x2019;s certificate was
67987 verified
67988 using a CA trust anchor,
67989 <literal>CA=dane</literal> if using a DNS trust anchor,
67990 and <literal>CV=no</literal> if not.
67991 </para>
67992 </listitem>
67993 <listitem>
67994 <para revisionflag="changed">
67995 <indexterm role="concept">
67996 <primary>log</primary>
67997 <secondary>TLS cipher</secondary>
67998 </indexterm>
67999 <indexterm role="concept">
68000 <primary>TLS</primary>
68001 <secondary>logging cipher</secondary>
68002 </indexterm>
68003 <option>tls_cipher</option>: When a message is sent or received over an encrypted
68004 connection, the cipher suite used is added to the log line, preceded by X=.
68005 </para>
68006 </listitem>
68007 <listitem>
68008 <para revisionflag="changed">
68009 <indexterm role="concept">
68010 <primary>log</primary>
68011 <secondary>TLS peer DN</secondary>
68012 </indexterm>
68013 <indexterm role="concept">
68014 <primary>TLS</primary>
68015 <secondary>logging peer DN</secondary>
68016 </indexterm>
68017 <option>tls_peerdn</option>: When a message is sent or received over an encrypted
68018 connection, and a certificate is supplied by the remote host, the peer DN is
68019 added to the log line, preceded by DN=.
68020 </para>
68021 </listitem>
68022 <listitem>
68023 <para revisionflag="changed">
68024 <indexterm role="concept">
68025 <primary>log</primary>
68026 <secondary>TLS SNI</secondary>
68027 </indexterm>
68028 <indexterm role="concept">
68029 <primary>TLS</primary>
68030 <secondary>logging SNI</secondary>
68031 </indexterm>
68032 <option>tls_sni</option>: When a message is received over an encrypted connection, and
68033 the remote host provided the Server Name Indication extension, the SNI is
68034 added to the log line, preceded by SNI=.
68035 </para>
68036 </listitem>
68037 <listitem>
68038 <para revisionflag="changed">
68039 <indexterm role="concept">
68040 <primary>log</primary>
68041 <secondary>DNS failure in list</secondary>
68042 </indexterm>
68043 <option>unknown_in_list</option>: This setting causes a log entry to be written when the
68044 result of a list match is failure because a DNS lookup failed.
68045 </para>
68046 </listitem>
68047 </itemizedlist>
68048 </section>
68049 <section id="SECID260" revisionflag="changed">
68050 <title>Message log</title>
68051 <para revisionflag="changed">
68052 <indexterm role="concept">
68053 <primary>message</primary>
68054 <secondary>log file for</secondary>
68055 </indexterm>
68056 <indexterm role="concept">
68057 <primary>log</primary>
68058 <secondary>message log; description of</secondary>
68059 </indexterm>
68060 <indexterm role="concept">
68061 <primary><filename>msglog</filename> directory</primary>
68062 </indexterm>
68063 <indexterm role="option">
68064 <primary><option>preserve_message_logs</option></primary>
68065 </indexterm>
68066 In addition to the general log files, Exim writes a log file for each message
68067 that it handles. The names of these per-message logs are the message ids, and
68068 they are kept in the <filename>msglog</filename> sub-directory of the spool directory. Each
68069 message log contains copies of the log lines that apply to the message. This
68070 makes it easier to inspect the status of an individual message without having
68071 to search the main log. A message log is deleted when processing of the message
68072 is complete, unless <option>preserve_message_logs</option> is set, but this should be used
68073 only with great care because they can fill up your disk very quickly.
68074 </para>
68075 <para revisionflag="changed">
68076 On a heavily loaded system, it may be desirable to disable the use of
68077 per-message logs, in order to reduce disk I/O. This can be done by setting the
68078 <option>message_logs</option> option false.
68079 <indexterm role="concept" startref="IIDloggen" class="endofrange"/>
68080 </para>
68081 </section>
68082 </chapter>
68083
68084 <chapter id="CHAPutils" revisionflag="changed">
68085 <title>Exim utilities</title>
68086 <para revisionflag="changed">
68087 <indexterm role="concept" id="IIDutils" class="startofrange">
68088 <primary>utilities</primary>
68089 </indexterm>
68090 A number of utility scripts and programs are supplied with Exim and are
68091 described in this chapter. There is also the Exim Monitor, which is covered in
68092 the next chapter. The utilities described here are:
68093 </para>
68094 <informaltable frame="none" revisionflag="changed">
68095 <tgroup cols="3" colsep="0" rowsep="0">
68096 <colspec colwidth="7*" align="left"/>
68097 <colspec colwidth="15*" align="left"/>
68098 <colspec colwidth="40*" align="left"/>
68099 <tbody>
68100 <row>
68101 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTfinoutwha"/></entry>
68102 <entry><emphasis>exiwhat</emphasis></entry>
68103 <entry>list what Exim processes are doing</entry>
68104 </row>
68105 <row>
68106 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTgreptheque"/></entry>
68107 <entry><emphasis>exiqgrep</emphasis></entry>
68108 <entry>grep the queue</entry>
68109 </row>
68110 <row>
68111 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTsumtheque"/></entry>
68112 <entry><emphasis>exiqsumm</emphasis></entry>
68113 <entry>summarize the queue</entry>
68114 </row>
68115 <row>
68116 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTextspeinf"/></entry>
68117 <entry><emphasis>exigrep</emphasis></entry>
68118 <entry>search the main log</entry>
68119 </row>
68120 <row>
68121 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTexipick"/></entry>
68122 <entry><emphasis>exipick</emphasis></entry>
68123 <entry>select messages on various criteria</entry>
68124 </row>
68125 <row>
68126 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTcyclogfil"/></entry>
68127 <entry><emphasis>exicyclog</emphasis></entry>
68128 <entry>cycle (rotate) log files</entry>
68129 </row>
68130 <row>
68131 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTmailstat"/></entry>
68132 <entry><emphasis>eximstats</emphasis></entry>
68133 <entry>extract statistics from the log</entry>
68134 </row>
68135 <row>
68136 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTcheckaccess"/></entry>
68137 <entry><emphasis>exim_checkaccess</emphasis></entry>
68138 <entry>check address acceptance from given IP</entry>
68139 </row>
68140 <row>
68141 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTdbmbuild"/></entry>
68142 <entry><emphasis>exim_dbmbuild</emphasis></entry>
68143 <entry>build a DBM file</entry>
68144 </row>
68145 <row>
68146 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTfinindret"/></entry>
68147 <entry><emphasis>exinext</emphasis></entry>
68148 <entry>extract retry information</entry>
68149 </row>
68150 <row>
68151 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
68152 <entry><emphasis>exim_dumpdb</emphasis></entry>
68153 <entry>dump a hints database</entry>
68154 </row>
68155 <row>
68156 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
68157 <entry><emphasis>exim_tidydb</emphasis></entry>
68158 <entry>clean up a hints database</entry>
68159 </row>
68160 <row>
68161 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
68162 <entry><emphasis>exim_fixdb</emphasis></entry>
68163 <entry>patch a hints database</entry>
68164 </row>
68165 <row>
68166 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTmailboxmaint"/></entry>
68167 <entry><emphasis>exim_lock</emphasis></entry>
68168 <entry>lock a mailbox file</entry>
68169 </row>
68170 </tbody>
68171 </tgroup>
68172 </informaltable>
68173 <para revisionflag="changed">
68174 Another utility that might be of use to sites with many MTAs is Tom Kistner&#x2019;s
68175 <emphasis>exilog</emphasis>. It provides log visualizations across multiple Exim servers. See
68176 <emphasis role="bold"><ulink url="https://duncanthrax.net/exilog/">https://duncanthrax.net/exilog/</ulink></emphasis> for details.
68177 </para>
68178 <section id="SECTfinoutwha" revisionflag="changed">
68179 <title>Finding out what Exim processes are doing (exiwhat)</title>
68180 <para revisionflag="changed">
68181 <indexterm role="concept">
68182 <primary><emphasis>exiwhat</emphasis></primary>
68183 </indexterm>
68184 <indexterm role="concept">
68185 <primary>process, querying</primary>
68186 </indexterm>
68187 <indexterm role="concept">
68188 <primary>SIGUSR1</primary>
68189 </indexterm>
68190 On operating systems that can restart a system call after receiving a signal
68191 (most modern OS), an Exim process responds to the SIGUSR1 signal by writing
68192 a line describing what it is doing to the file <filename>exim-process.info</filename> in the
68193 Exim spool directory. The <emphasis>exiwhat</emphasis> script sends the signal to all Exim
68194 processes it can find, having first emptied the file. It then waits for one
68195 second to allow the Exim processes to react before displaying the results. In
68196 order to run <emphasis>exiwhat</emphasis> successfully you have to have sufficient privilege to
68197 send the signal to the Exim processes, so it is normally run as root.
68198 </para>
68199 <para revisionflag="changed">
68200 <emphasis role="bold">Warning</emphasis>: This is not an efficient process. It is intended for occasional
68201 use by system administrators. It is not sensible, for example, to set up a
68202 script that sends SIGUSR1 signals to Exim processes at short intervals.
68203 </para>
68204 <para revisionflag="changed">
68205 Unfortunately, the <emphasis>ps</emphasis> command that <emphasis>exiwhat</emphasis> uses to find Exim processes
68206 varies in different operating systems. Not only are different options used,
68207 but the format of the output is different. For this reason, there are some
68208 system configuration options that configure exactly how <emphasis>exiwhat</emphasis> works. If
68209 it doesn&#x2019;t seem to be working for you, check the following compile-time
68210 options:
68211 </para>
68212 <literallayout revisionflag="changed">
68213 <literal>EXIWHAT_PS_CMD    </literal> the command for running <emphasis>ps</emphasis>
68214 <literal>EXIWHAT_PS_ARG    </literal> the argument for <emphasis>ps</emphasis>
68215 <literal>EXIWHAT_EGREP_ARG </literal> the argument for <emphasis>egrep</emphasis> to select from <emphasis>ps</emphasis> output
68216 <literal>EXIWHAT_KILL_ARG  </literal> the argument for the <emphasis>kill</emphasis> command
68217 </literallayout>
68218 <para revisionflag="changed">
68219 An example of typical output from <emphasis>exiwhat</emphasis> is
68220 </para>
68221 <literallayout class="monospaced" revisionflag="changed">
68222 164 daemon: -q1h, listening on port 25
68223 10483 running queue: waiting for 0tAycK-0002ij-00 (10492)
68224 10492 delivering 0tAycK-0002ij-00 to mail.ref.example
68225   [10.19.42.42] (editor@ref.example)
68226 10592 handling incoming call from [192.168.243.242]
68227 10628 accepting a local non-SMTP message
68228 </literallayout>
68229 <para revisionflag="changed">
68230 The first number in the output line is the process number. The third line has
68231 been split here, in order to fit it on the page.
68232 </para>
68233 </section>
68234 <section id="SECTgreptheque" revisionflag="changed">
68235 <title>Selective queue listing (exiqgrep)</title>
68236 <para revisionflag="changed">
68237 <indexterm role="concept">
68238 <primary><emphasis>exiqgrep</emphasis></primary>
68239 </indexterm>
68240 <indexterm role="concept">
68241 <primary>queue</primary>
68242 <secondary>grepping</secondary>
68243 </indexterm>
68244 This utility is a Perl script contributed by Matt Hubbard. It runs
68245 </para>
68246 <literallayout class="monospaced" revisionflag="changed">
68247 exim -bpu
68248 </literallayout>
68249 <para revisionflag="changed">
68250 or (in case <emphasis role="bold">-a</emphasis> switch is specified)
68251 </para>
68252 <literallayout class="monospaced" revisionflag="changed">
68253 exim -bp
68254 </literallayout>
68255 <para revisionflag="changed">
68256 The <emphasis role="bold">-C</emphasis> option is used to specify an alternate <filename>exim.conf</filename> which might
68257 contain alternate exim configuration the queue management might be using.
68258 </para>
68259 <para revisionflag="changed">
68260 to obtain a queue listing, and then greps the output to select messages
68261 that match given criteria. The following selection options are available:
68262 </para>
68263 <variablelist revisionflag="changed">
68264 <varlistentry revisionflag="changed">
68265 <term><emphasis role="bold">-f</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
68266 <listitem>
68267 <para revisionflag="changed">
68268 Match the sender address using a case-insensitive search. The field that is
68269 tested is enclosed in angle brackets, so you can test for bounce messages with
68270 </para>
68271 <literallayout class="monospaced" revisionflag="changed">
68272 exiqgrep -f '^&lt;&gt;$'
68273 </literallayout>
68274 </listitem></varlistentry>
68275 <varlistentry revisionflag="changed">
68276 <term><emphasis role="bold">-r</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
68277 <listitem>
68278 <para revisionflag="changed">
68279 Match a recipient address using a case-insensitive search. The field that is
68280 tested is not enclosed in angle brackets.
68281 </para>
68282 </listitem></varlistentry>
68283 <varlistentry revisionflag="changed">
68284 <term><emphasis role="bold">-s</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
68285 <listitem>
68286 <para revisionflag="changed">
68287 Match against the size field.
68288 </para>
68289 </listitem></varlistentry>
68290 <varlistentry revisionflag="changed">
68291 <term><emphasis role="bold">-y</emphasis>&nbsp;&lt;<emphasis>seconds</emphasis>&gt;</term>
68292 <listitem>
68293 <para revisionflag="changed">
68294 Match messages that are younger than the given time.
68295 </para>
68296 </listitem></varlistentry>
68297 <varlistentry revisionflag="changed">
68298 <term><emphasis role="bold">-o</emphasis>&nbsp;&lt;<emphasis>seconds</emphasis>&gt;</term>
68299 <listitem>
68300 <para revisionflag="changed">
68301 Match messages that are older than the given time.
68302 </para>
68303 </listitem></varlistentry>
68304 <varlistentry revisionflag="changed">
68305 <term><emphasis role="bold">-z</emphasis></term>
68306 <listitem>
68307 <para revisionflag="changed">
68308 Match only frozen messages.
68309 </para>
68310 </listitem></varlistentry>
68311 <varlistentry revisionflag="changed">
68312 <term><emphasis role="bold">-x</emphasis></term>
68313 <listitem>
68314 <para revisionflag="changed">
68315 Match only non-frozen messages.
68316 </para>
68317 </listitem></varlistentry>
68318 </variablelist>
68319 <para revisionflag="changed">
68320 The following options control the format of the output:
68321 </para>
68322 <variablelist revisionflag="changed">
68323 <varlistentry revisionflag="changed">
68324 <term><emphasis role="bold">-c</emphasis></term>
68325 <listitem>
68326 <para revisionflag="changed">
68327 Display only the count of matching messages.
68328 </para>
68329 </listitem></varlistentry>
68330 <varlistentry revisionflag="changed">
68331 <term><emphasis role="bold">-l</emphasis></term>
68332 <listitem>
68333 <para revisionflag="changed">
68334 Long format &ndash; display the full message information as output by Exim. This is
68335 the default.
68336 </para>
68337 </listitem></varlistentry>
68338 <varlistentry revisionflag="changed">
68339 <term><emphasis role="bold">-i</emphasis></term>
68340 <listitem>
68341 <para revisionflag="changed">
68342 Display message ids only.
68343 </para>
68344 </listitem></varlistentry>
68345 <varlistentry revisionflag="changed">
68346 <term><emphasis role="bold">-b</emphasis></term>
68347 <listitem>
68348 <para revisionflag="changed">
68349 Brief format &ndash; one line per message.
68350 </para>
68351 </listitem></varlistentry>
68352 <varlistentry revisionflag="changed">
68353 <term><emphasis role="bold">-R</emphasis></term>
68354 <listitem>
68355 <para revisionflag="changed">
68356 Display messages in reverse order.
68357 </para>
68358 </listitem></varlistentry>
68359 <varlistentry revisionflag="changed">
68360 <term><emphasis role="bold">-a</emphasis></term>
68361 <listitem>
68362 <para revisionflag="changed">
68363 Include delivered recipients in queue listing.
68364 </para>
68365 </listitem></varlistentry>
68366 </variablelist>
68367 <para revisionflag="changed">
68368 There is one more option, <option>-h</option>, which outputs a list of options.
68369 </para>
68370 </section>
68371 <section id="SECTsumtheque" revisionflag="changed">
68372 <title>Summarizing the queue (exiqsumm)</title>
68373 <para revisionflag="changed">
68374 <indexterm role="concept">
68375 <primary><emphasis>exiqsumm</emphasis></primary>
68376 </indexterm>
68377 <indexterm role="concept">
68378 <primary>queue</primary>
68379 <secondary>summary</secondary>
68380 </indexterm>
68381 The <emphasis>exiqsumm</emphasis> utility is a Perl script which reads the output of <literal>exim
68382 -bp</literal> and produces a summary of the messages in the queue. Thus, you use it by
68383 running a command such as
68384 </para>
68385 <literallayout class="monospaced" revisionflag="changed">
68386 exim -bp | exiqsumm
68387 </literallayout>
68388 <para revisionflag="changed">
68389 The output consists of one line for each domain that has messages waiting for
68390 it, as in the following example:
68391 </para>
68392 <literallayout class="monospaced" revisionflag="changed">
68393 3   2322   74m   66m  msn.com.example
68394 </literallayout>
68395 <para revisionflag="changed">
68396 Each line lists the number of pending deliveries for a domain, their total
68397 volume, and the length of time that the oldest and the newest messages have
68398 been waiting. Note that the number of pending deliveries is greater than the
68399 number of messages when messages have more than one recipient.
68400 </para>
68401 <para revisionflag="changed">
68402 A summary line is output at the end. By default the output is sorted on the
68403 domain name, but <emphasis>exiqsumm</emphasis> has the options <option>-a</option> and <option>-c</option>, which cause
68404 the output to be sorted by oldest message and by count of messages,
68405 respectively. There are also three options that split the messages for each
68406 domain into two or more subcounts: <option>-b</option> separates bounce messages, <option>-f</option>
68407 separates frozen messages, and <option>-s</option> separates messages according to their
68408 sender.
68409 </para>
68410 <para revisionflag="changed">
68411 The output of <emphasis>exim -bp</emphasis> contains the original addresses in the message, so
68412 this also applies to the output from <emphasis>exiqsumm</emphasis>. No domains from addresses
68413 generated by aliasing or forwarding are included (unless the <option>one_time</option>
68414 option of the <command>redirect</command> router has been used to convert them into <quote>top
68415 level</quote> addresses).
68416 </para>
68417 </section>
68418 <section id="SECTextspeinf" revisionflag="changed">
68419 <title>Extracting specific information from the log (exigrep)</title>
68420 <para revisionflag="changed">
68421 <indexterm role="concept">
68422 <primary><emphasis>exigrep</emphasis></primary>
68423 </indexterm>
68424 <indexterm role="concept">
68425 <primary>log</primary>
68426 <secondary>extracts; grepping for</secondary>
68427 </indexterm>
68428 The <emphasis>exigrep</emphasis> utility is a Perl script that searches one or more main log
68429 files for entries that match a given pattern. When it finds a match, it
68430 extracts all the log entries for the relevant message, not just those that
68431 match the pattern. Thus, <emphasis>exigrep</emphasis> can extract complete log entries for a
68432 given message, or all mail for a given user, or for a given host, for example.
68433 The input files can be in Exim log format or syslog format.
68434 If a matching log line is not associated with a specific message, it is
68435 included in <emphasis>exigrep</emphasis>&#x2019;s output without any additional lines. The usage is:
68436 </para>
68437 <literallayout revisionflag="changed">
68438 <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>
68439 </literallayout>
68440 <para revisionflag="changed">
68441 If no log filenames are given on the command line, the standard input is read.
68442 </para>
68443 <para revisionflag="changed">
68444 The <option>-t</option> argument specifies a number of seconds. It adds an additional
68445 condition for message selection. Messages that are complete are shown only if
68446 they spent more than &lt;<emphasis>n</emphasis>&gt; seconds in the queue.
68447 </para>
68448 <para revisionflag="changed">
68449 By default, <emphasis>exigrep</emphasis> does case-insensitive matching. The <option>-I</option> option
68450 makes it case-sensitive. This may give a performance improvement when searching
68451 large log files. Without <option>-I</option>, the Perl pattern matches use Perl&#x2019;s <literal>/i</literal>
68452 option; with <option>-I</option> they do not. In both cases it is possible to change the
68453 case sensitivity within the pattern by using <literal>(?i)</literal> or <literal>(?-i)</literal>.
68454 </para>
68455 <para revisionflag="changed">
68456 The <option>-l</option> option means <quote>literal</quote>, that is, treat all characters in the
68457 pattern as standing for themselves. Otherwise the pattern must be a Perl
68458 regular expression.
68459 </para>
68460 <para revisionflag="changed">
68461 The <option>-v</option> option inverts the matching condition. That is, a line is selected
68462 if it does <emphasis>not</emphasis> match the pattern.
68463 </para>
68464 <para revisionflag="changed">
68465 The <option>-M</option> options means <quote>related messages</quote>. <emphasis>exigrep</emphasis> will show messages
68466 that are generated as a result/response to a message that <emphasis>exigrep</emphasis> matched
68467 normally.
68468 </para>
68469 <para revisionflag="changed">
68470 Example of <option>-M</option>:
68471 user_a sends a message to user_b, which generates a bounce back to user_b. If
68472 <emphasis>exigrep</emphasis> is used to search for <quote>user_a</quote>, only the first message will be
68473 displayed.  But if <emphasis>exigrep</emphasis> is used to search for <quote>user_b</quote>, the first and
68474 the second (bounce) message will be displayed. Using <option>-M</option> with <emphasis>exigrep</emphasis>
68475 when searching for <quote>user_a</quote> will show both messages since the bounce is
68476 <quote>related</quote> to or a <quote>result</quote> of the first message that was found by the
68477 search term.
68478 </para>
68479 <para revisionflag="changed">
68480 If the location of a <emphasis>zcat</emphasis> command is known from the definition of
68481 ZCAT_COMMAND in <filename>Local/Makefile</filename>, <emphasis>exigrep</emphasis> automatically passes any file
68482 whose name ends in COMPRESS_SUFFIX through <emphasis>zcat</emphasis> as it searches it.
68483 If the ZCAT_COMMAND is not executable, <emphasis>exigrep</emphasis> tries to use
68484 autodetection of some well known compression extensions.
68485 </para>
68486 </section>
68487 <section id="SECTexipick" revisionflag="changed">
68488 <title>Selecting messages by various criteria (exipick)</title>
68489 <para revisionflag="changed">
68490 <indexterm role="concept">
68491 <primary><emphasis>exipick</emphasis></primary>
68492 </indexterm>
68493 John Jetmore&#x2019;s <emphasis>exipick</emphasis> utility is included in the Exim distribution. It
68494 lists messages from the queue according to a variety of criteria. For details
68495 of <emphasis>exipick</emphasis>&#x2019;s facilities, run <emphasis>exipick</emphasis> with
68496 the <option>--help</option> option.
68497 </para>
68498 </section>
68499 <section id="SECTcyclogfil" revisionflag="changed">
68500 <title>Cycling log files (exicyclog)</title>
68501 <para revisionflag="changed">
68502 <indexterm role="concept">
68503 <primary>log</primary>
68504 <secondary>cycling local files</secondary>
68505 </indexterm>
68506 <indexterm role="concept">
68507 <primary>cycling logs</primary>
68508 </indexterm>
68509 <indexterm role="concept">
68510 <primary><emphasis>exicyclog</emphasis></primary>
68511 </indexterm>
68512 The <emphasis>exicyclog</emphasis> script can be used to cycle (rotate) <emphasis>mainlog</emphasis> and
68513 <emphasis>rejectlog</emphasis> files. This is not necessary if only syslog is being used, or if
68514 you are using log files with datestamps in their names (see section
68515 <xref linkend="SECTdatlogfil"/>). Some operating systems have their own standard mechanisms
68516 for log cycling, and these can be used instead of <emphasis>exicyclog</emphasis> if preferred.
68517 There are two command line options for <emphasis>exicyclog</emphasis>:
68518 </para>
68519 <itemizedlist revisionflag="changed">
68520 <listitem>
68521 <para revisionflag="changed">
68522 <option>-k</option> &lt;<emphasis>count</emphasis>&gt; specifies the number of log files to keep, overriding the
68523 default that is set when Exim is built. The default default is 10.
68524 </para>
68525 </listitem>
68526 <listitem>
68527 <para revisionflag="changed">
68528 <option>-l</option> &lt;<emphasis>path</emphasis>&gt; specifies the log file path, in the same format as Exim&#x2019;s
68529 <option>log_file_path</option> option (for example, <literal>/var/log/exim_%slog</literal>), again
68530 overriding the script&#x2019;s default, which is to find the setting from Exim&#x2019;s
68531 configuration.
68532 </para>
68533 </listitem>
68534 </itemizedlist>
68535 <para revisionflag="changed">
68536 Each time <emphasis>exicyclog</emphasis> is run the filenames get <quote>shuffled down</quote> by one. If
68537 the main log filename is <filename>mainlog</filename> (the default) then when <emphasis>exicyclog</emphasis> is
68538 run <filename>mainlog</filename> becomes <filename>mainlog.01</filename>, the previous <filename>mainlog.01</filename> becomes
68539 <filename>mainlog.02</filename> and so on, up to the limit that is set in the script or by the
68540 <option>-k</option> option. Log files whose numbers exceed the limit are discarded. Reject
68541 logs are handled similarly.
68542 </para>
68543 <para revisionflag="changed">
68544 If the limit is greater than 99, the script uses 3-digit numbers such as
68545 <filename>mainlog.001</filename>, <filename>mainlog.002</filename>, etc. If you change from a number less than 99
68546 to one that is greater, or <emphasis>vice versa</emphasis>, you will have to fix the names of
68547 any existing log files.
68548 </para>
68549 <para revisionflag="changed">
68550 If no <filename>mainlog</filename> file exists, the script does nothing. Files that <quote>drop off</quote>
68551 the end are deleted. All files with numbers greater than 01 are compressed,
68552 using a compression command which is configured by the COMPRESS_COMMAND
68553 setting in <filename>Local/Makefile</filename>. It is usual to run <emphasis>exicyclog</emphasis> daily from a
68554 root <option>crontab</option> entry of the form
68555 </para>
68556 <literallayout class="monospaced" revisionflag="changed">
68557 1 0 * * * su exim -c /usr/exim/bin/exicyclog
68558 </literallayout>
68559 <para revisionflag="changed">
68560 assuming you have used the name <quote>exim</quote> for the Exim user. You can run
68561 <emphasis>exicyclog</emphasis> as root if you wish, but there is no need.
68562 </para>
68563 </section>
68564 <section id="SECTmailstat" revisionflag="changed">
68565 <title>Mail statistics (eximstats)</title>
68566 <para revisionflag="changed">
68567 <indexterm role="concept">
68568 <primary>statistics</primary>
68569 </indexterm>
68570 <indexterm role="concept">
68571 <primary><emphasis>eximstats</emphasis></primary>
68572 </indexterm>
68573 A Perl script called <emphasis>eximstats</emphasis> is provided for extracting statistical
68574 information from log files. The output is either plain text, or HTML.
68575 </para>
68576 <para revisionflag="changed">
68577 The <emphasis>eximstats</emphasis> script has been hacked about quite a bit over time. The
68578 latest version is the result of some extensive revision by Steve Campbell. A
68579 lot of information is given by default, but there are options for suppressing
68580 various parts of it. Following any options, the arguments to the script are a
68581 list of files, which should be main log files. For example:
68582 </para>
68583 <literallayout class="monospaced" revisionflag="changed">
68584 eximstats -nr /var/spool/exim/log/mainlog.01
68585 </literallayout>
68586 <para revisionflag="changed">
68587 By default, <emphasis>eximstats</emphasis> extracts information about the number and volume of
68588 messages received from or delivered to various hosts. The information is sorted
68589 both by message count and by volume, and the top fifty hosts in each category
68590 are listed on the standard output. Similar information, based on email
68591 addresses or domains instead of hosts can be requested by means of various
68592 options. For messages delivered and received locally, similar statistics are
68593 also produced per user.
68594 </para>
68595 <para revisionflag="changed">
68596 The output also includes total counts and statistics about delivery errors, and
68597 histograms showing the number of messages received and deliveries made in each
68598 hour of the day. A delivery with more than one address in its envelope (for
68599 example, an SMTP transaction with more than one RCPT command) is counted
68600 as a single delivery by <emphasis>eximstats</emphasis>.
68601 </para>
68602 <para revisionflag="changed">
68603 Though normally more deliveries than receipts are reported (as messages may
68604 have multiple recipients), it is possible for <emphasis>eximstats</emphasis> to report more
68605 messages received than delivered, even though the queue is empty at the start
68606 and end of the period in question. If an incoming message contains no valid
68607 recipients, no deliveries are recorded for it. A bounce message is handled as
68608 an entirely separate message.
68609 </para>
68610 <para revisionflag="changed">
68611 <emphasis>eximstats</emphasis> always outputs a grand total summary giving the volume and number
68612 of messages received and deliveries made, and the number of hosts involved in
68613 each case. It also outputs the number of messages that were delayed (that is,
68614 not completely delivered at the first attempt), and the number that had at
68615 least one address that failed.
68616 </para>
68617 <para revisionflag="changed">
68618 The remainder of the output is in sections that can be independently disabled
68619 or modified by various options. It consists of a summary of deliveries by
68620 transport, histograms of messages received and delivered per time interval
68621 (default per hour), information about the time messages spent in the queue,
68622 a list of relayed messages, lists of the top fifty sending hosts, local
68623 senders, destination hosts, and destination local users by count and by volume,
68624 and a list of delivery errors that occurred.
68625 </para>
68626 <para revisionflag="changed">
68627 The relay information lists messages that were actually relayed, that is, they
68628 came from a remote host and were directly delivered to some other remote host,
68629 without being processed (for example, for aliasing or forwarding) locally.
68630 </para>
68631 <para revisionflag="changed">
68632 There are quite a few options for <emphasis>eximstats</emphasis> to control exactly what it
68633 outputs. These are documented in the Perl script itself, and can be extracted
68634 by running the command <command>perldoc</command> on the script. For example:
68635 </para>
68636 <literallayout class="monospaced" revisionflag="changed">
68637 perldoc /usr/exim/bin/eximstats
68638 </literallayout>
68639 </section>
68640 <section id="SECTcheckaccess" revisionflag="changed">
68641 <title>Checking access policy (exim_checkaccess)</title>
68642 <para revisionflag="changed">
68643 <indexterm role="concept">
68644 <primary><emphasis>exim_checkaccess</emphasis></primary>
68645 </indexterm>
68646 <indexterm role="concept">
68647 <primary>policy control</primary>
68648 <secondary>checking access</secondary>
68649 </indexterm>
68650 <indexterm role="concept">
68651 <primary>checking access</primary>
68652 </indexterm>
68653 The <option>-bh</option> command line argument allows you to run a fake SMTP session with
68654 debugging output, in order to check what Exim is doing when it is applying
68655 policy controls to incoming SMTP mail. However, not everybody is sufficiently
68656 familiar with the SMTP protocol to be able to make full use of <option>-bh</option>, and
68657 sometimes you just want to answer the question <quote>Does this address have
68658 access?</quote> without bothering with any further details.
68659 </para>
68660 <para revisionflag="changed">
68661 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option>. It takes
68662 two arguments, an IP address and an email address:
68663 </para>
68664 <literallayout class="monospaced" revisionflag="changed">
68665 exim_checkaccess 10.9.8.7 A.User@a.domain.example
68666 </literallayout>
68667 <para revisionflag="changed">
68668 The utility runs a call to Exim with the <option>-bh</option> option, to test whether the
68669 given email address would be accepted in a RCPT command in a TCP/IP
68670 connection from the host with the given IP address. The output of the utility
68671 is either the word <quote>accepted</quote>, or the SMTP error response, for example:
68672 </para>
68673 <literallayout class="monospaced" revisionflag="changed">
68674 Rejected:
68675 550 Relay not permitted
68676 </literallayout>
68677 <para revisionflag="changed">
68678 When running this test, the utility uses <literal>&lt;&gt;</literal> as the envelope sender address
68679 for the MAIL command, but you can change this by providing additional
68680 options. These are passed directly to the Exim command. For example, to specify
68681 that the test is to be run with the sender address <emphasis>himself@there.example</emphasis>
68682 you can use:
68683 </para>
68684 <literallayout class="monospaced" revisionflag="changed">
68685 exim_checkaccess 10.9.8.7 A.User@a.domain.example \
68686                  -f himself@there.example
68687 </literallayout>
68688 <para revisionflag="changed">
68689 Note that these additional Exim command line items must be given after the two
68690 mandatory arguments.
68691 </para>
68692 <para revisionflag="changed">
68693 Because the <option>exim_checkaccess</option> uses <option>-bh</option>, it does not perform callouts
68694 while running its checks. You can run checks that include callouts by using
68695 <option>-bhc</option>, but this is not yet available in a <quote>packaged</quote> form.
68696 </para>
68697 </section>
68698 <section id="SECTdbmbuild" revisionflag="changed">
68699 <title>Making DBM files (exim_dbmbuild)</title>
68700 <para revisionflag="changed">
68701 <indexterm role="concept">
68702 <primary>DBM</primary>
68703 <secondary>building dbm files</secondary>
68704 </indexterm>
68705 <indexterm role="concept">
68706 <primary>building DBM files</primary>
68707 </indexterm>
68708 <indexterm role="concept">
68709 <primary><emphasis>exim_dbmbuild</emphasis></primary>
68710 </indexterm>
68711 <indexterm role="concept">
68712 <primary>lower casing</primary>
68713 </indexterm>
68714 <indexterm role="concept">
68715 <primary>binary zero</primary>
68716 <secondary>in lookup key</secondary>
68717 </indexterm>
68718 The <emphasis>exim_dbmbuild</emphasis> program reads an input file containing keys and data in
68719 the format used by the <command>lsearch</command> lookup (see section
68720 <xref linkend="SECTsinglekeylookups"/>). It writes a DBM file using the lower-cased alias
68721 names as keys and the remainder of the information as data. The lower-casing
68722 can be prevented by calling the program with the <option>-nolc</option> option.
68723 </para>
68724 <para revisionflag="changed">
68725 A terminating zero is included as part of the key string. This is expected by
68726 the <command>dbm</command> lookup type. However, if the option <option>-nozero</option> is given,
68727 <emphasis>exim_dbmbuild</emphasis> creates files without terminating zeroes in either the key
68728 strings or the data strings. The <command>dbmnz</command> lookup type can be used with such
68729 files.
68730 </para>
68731 <para revisionflag="changed">
68732 The program requires two arguments: the name of the input file (which can be a
68733 single hyphen to indicate the standard input), and the name of the output file.
68734 It creates the output under a temporary name, and then renames it if all went
68735 well.
68736 </para>
68737 <para revisionflag="changed">
68738 <indexterm role="concept">
68739 <primary>USE_DB</primary>
68740 </indexterm>
68741 If the native DB interface is in use (USE_DB is set in a compile-time
68742 configuration file &ndash; this is common in free versions of Unix) the two
68743 filenames must be different, because in this mode the Berkeley DB functions
68744 create a single output file using exactly the name given. For example,
68745 </para>
68746 <literallayout class="monospaced" revisionflag="changed">
68747 exim_dbmbuild /etc/aliases /etc/aliases.db
68748 </literallayout>
68749 <para revisionflag="changed">
68750 reads the system alias file and creates a DBM version of it in
68751 <filename>/etc/aliases.db</filename>.
68752 </para>
68753 <para revisionflag="changed">
68754 In systems that use the <emphasis>ndbm</emphasis> routines (mostly proprietary versions of
68755 Unix), two files are used, with the suffixes <filename>.dir</filename> and <filename>.pag</filename>. In this
68756 environment, the suffixes are added to the second argument of
68757 <emphasis>exim_dbmbuild</emphasis>, so it can be the same as the first. This is also the case
68758 when the Berkeley functions are used in compatibility mode (though this is not
68759 recommended), because in that case it adds a <filename>.db</filename> suffix to the filename.
68760 </para>
68761 <para revisionflag="changed">
68762 If a duplicate key is encountered, the program outputs a warning, and when it
68763 finishes, its return code is 1 rather than zero, unless the <option>-noduperr</option>
68764 option is used. By default, only the first of a set of duplicates is used &ndash;
68765 this makes it compatible with <command>lsearch</command> lookups. There is an option
68766 <option>-lastdup</option> which causes it to use the data for the last duplicate instead.
68767 There is also an option <option>-nowarn</option>, which stops it listing duplicate keys to
68768 <option>stderr</option>. For other errors, where it doesn&#x2019;t actually make a new file, the
68769 return code is 2.
68770 </para>
68771 </section>
68772 <section id="SECTfinindret" revisionflag="changed">
68773 <title>Finding individual retry times (exinext)</title>
68774 <para revisionflag="changed">
68775 <indexterm role="concept">
68776 <primary>retry</primary>
68777 <secondary>times</secondary>
68778 </indexterm>
68779 <indexterm role="concept">
68780 <primary><emphasis>exinext</emphasis></primary>
68781 </indexterm>
68782 A utility called <emphasis>exinext</emphasis> (mostly a Perl script) provides the ability to
68783 fish specific information out of the retry database. Given a mail domain (or a
68784 complete address), it looks up the hosts for that domain, and outputs any retry
68785 information for the hosts or for the domain. At present, the retry information
68786 is obtained by running <emphasis>exim_dumpdb</emphasis> (see below) and post-processing the
68787 output. For example:
68788 </para>
68789 <literallayout class="monospaced" revisionflag="changed">
68790 $ exinext piglet@milne.fict.example
68791 kanga.milne.example:192.168.8.1 error 146: Connection refused
68792   first failed: 21-Feb-1996 14:57:34
68793   last tried:   21-Feb-1996 14:57:34
68794   next try at:  21-Feb-1996 15:02:34
68795 roo.milne.example:192.168.8.3 error 146: Connection refused
68796   first failed: 20-Jan-1996 13:12:08
68797   last tried:   21-Feb-1996 11:42:03
68798   next try at:  21-Feb-1996 19:42:03
68799   past final cutoff time
68800 </literallayout>
68801 <para revisionflag="changed">
68802 You can also give <emphasis>exinext</emphasis> a local part, without a domain, and it
68803 will give any retry information for that local part in your default domain.
68804 A message id can be used to obtain retry information pertaining to a specific
68805 message. This exists only when an attempt to deliver a message to a remote host
68806 suffers a message-specific error (see section <xref linkend="SECToutSMTPerr"/>).
68807 <emphasis>exinext</emphasis> is not particularly efficient, but then it is not expected to be
68808 run very often.
68809 </para>
68810 <para revisionflag="changed">
68811 The <emphasis>exinext</emphasis> utility calls Exim to find out information such as the location
68812 of the spool directory. The utility has <option>-C</option> and <option>-D</option> options, which are
68813 passed on to the <emphasis>exim</emphasis> commands. The first specifies an alternate Exim
68814 configuration file, and the second sets macros for use within the configuration
68815 file. These features are mainly to help in testing, but might also be useful in
68816 environments where more than one configuration file is in use.
68817 </para>
68818 </section>
68819 <section id="SECThindatmai" revisionflag="changed">
68820 <title>Hints database maintenance</title>
68821 <para revisionflag="changed">
68822 <indexterm role="concept">
68823 <primary>hints database</primary>
68824 <secondary>maintenance</secondary>
68825 </indexterm>
68826 <indexterm role="concept">
68827 <primary>maintaining Exim&#x2019;s hints database</primary>
68828 </indexterm>
68829 Three utility programs are provided for maintaining the DBM files that Exim
68830 uses to contain its delivery hint information. Each program requires two
68831 arguments. The first specifies the name of Exim&#x2019;s spool directory, and the
68832 second is the name of the database it is to operate on. These are as follows:
68833 </para>
68834 <itemizedlist revisionflag="changed">
68835 <listitem>
68836 <para revisionflag="changed">
68837 <emphasis>retry</emphasis>: the database of retry information
68838 </para>
68839 </listitem>
68840 <listitem>
68841 <para revisionflag="changed">
68842 <emphasis>wait-</emphasis>&lt;<emphasis>transport name</emphasis>&gt;: databases of information about messages waiting
68843 for remote hosts
68844 </para>
68845 </listitem>
68846 <listitem>
68847 <para revisionflag="changed">
68848 <emphasis>callout</emphasis>: the callout cache
68849 </para>
68850 </listitem>
68851 <listitem>
68852 <para revisionflag="changed">
68853 <emphasis>ratelimit</emphasis>: the data for implementing the ratelimit ACL condition
68854 </para>
68855 </listitem>
68856 <listitem>
68857 <para revisionflag="changed">
68858 <emphasis>misc</emphasis>: other hints data
68859 </para>
68860 </listitem>
68861 </itemizedlist>
68862 <para revisionflag="changed">
68863 The <emphasis>misc</emphasis> database is used for
68864 </para>
68865 <itemizedlist revisionflag="changed">
68866 <listitem>
68867 <para revisionflag="changed">
68868 Serializing ETRN runs (when <option>smtp_etrn_serialize</option> is set)
68869 </para>
68870 </listitem>
68871 <listitem>
68872 <para revisionflag="changed">
68873 Serializing delivery to a specific host (when <option>serialize_hosts</option> is set in an
68874 <command>smtp</command> transport)
68875 </para>
68876 </listitem>
68877 <listitem>
68878 <para revisionflag="changed">
68879 Limiting the concurrency of specific transports (when <option>max_parallel</option> is set
68880 in a transport)
68881 </para>
68882 </listitem>
68883 </itemizedlist>
68884 </section>
68885 <section id="SECID261" revisionflag="changed">
68886 <title>exim_dumpdb</title>
68887 <para revisionflag="changed">
68888 <indexterm role="concept">
68889 <primary><emphasis>exim_dumpdb</emphasis></primary>
68890 </indexterm>
68891 The entire contents of a database are written to the standard output by the
68892 <emphasis>exim_dumpdb</emphasis> program, which has no options or arguments other than the
68893 spool and database names. For example, to dump the retry database:
68894 </para>
68895 <literallayout class="monospaced" revisionflag="changed">
68896 exim_dumpdb /var/spool/exim retry
68897 </literallayout>
68898 <para revisionflag="changed">
68899 Two lines of output are produced for each entry:
68900 </para>
68901 <literallayout class="monospaced" revisionflag="changed">
68902 T:mail.ref.example:192.168.242.242 146 77 Connection refused
68903 31-Oct-1995 12:00:12 02-Nov-1995 12:21:39 02-Nov-1995 20:21:39 *
68904 </literallayout>
68905 <para revisionflag="changed">
68906 The first item on the first line is the key of the record. It starts with one
68907 of the letters R, or T, depending on whether it refers to a routing or
68908 transport retry. For a local delivery, the next part is the local address; for
68909 a remote delivery it is the name of the remote host, followed by its failing IP
68910 address (unless <option>retry_include_ip_address</option> is set false on the <command>smtp</command>
68911 transport). If the remote port is not the standard one (port 25), it is added
68912 to the IP address. Then there follows an error code, an additional error code,
68913 and a textual description of the error.
68914 </para>
68915 <para revisionflag="changed">
68916 The three times on the second line are the time of first failure, the time of
68917 the last delivery attempt, and the computed time for the next attempt. The line
68918 ends with an asterisk if the cutoff time for the last retry rule has been
68919 exceeded.
68920 </para>
68921 <para revisionflag="changed">
68922 Each output line from <emphasis>exim_dumpdb</emphasis> for the <emphasis>wait-xxx</emphasis> databases
68923 consists of a host name followed by a list of ids for messages that are or were
68924 waiting to be delivered to that host. If there are a very large number for any
68925 one host, continuation records, with a sequence number added to the host name,
68926 may be seen. The data in these records is often out of date, because a message
68927 may be routed to several alternative hosts, and Exim makes no effort to keep
68928 cross-references.
68929 </para>
68930 </section>
68931 <section id="SECID262" revisionflag="changed">
68932 <title>exim_tidydb</title>
68933 <para revisionflag="changed">
68934 <indexterm role="concept">
68935 <primary><emphasis>exim_tidydb</emphasis></primary>
68936 </indexterm>
68937 The <emphasis>exim_tidydb</emphasis> utility program is used to tidy up the contents of a hints
68938 database. If run with no options, it removes all records that are more than 30
68939 days old. The age is calculated from the date and time that the record was last
68940 updated. Note that, in the case of the retry database, it is <emphasis>not</emphasis> the time
68941 since the first delivery failure. Information about a host that has been down
68942 for more than 30 days will remain in the database, provided that the record is
68943 updated sufficiently often.
68944 </para>
68945 <para revisionflag="changed">
68946 The cutoff date can be altered by means of the <option>-t</option> option, which must be
68947 followed by a time. For example, to remove all records older than a week from
68948 the retry database:
68949 </para>
68950 <literallayout class="monospaced" revisionflag="changed">
68951 exim_tidydb -t 7d /var/spool/exim retry
68952 </literallayout>
68953 <para revisionflag="changed">
68954 Both the <emphasis>wait-xxx</emphasis> and <emphasis>retry</emphasis> databases contain items that involve
68955 message ids. In the former these appear as data in records keyed by host &ndash;
68956 they were messages that were waiting for that host &ndash; and in the latter they
68957 are the keys for retry information for messages that have suffered certain
68958 types of error. When <emphasis>exim_tidydb</emphasis> is run, a check is made to ensure that
68959 message ids in database records are those of messages that are still on the
68960 queue. Message ids for messages that no longer exist are removed from
68961 <emphasis>wait-xxx</emphasis> records, and if this leaves any records empty, they are deleted.
68962 For the <emphasis>retry</emphasis> database, records whose keys are non-existent message ids are
68963 removed. The <emphasis>exim_tidydb</emphasis> utility outputs comments on the standard output
68964 whenever it removes information from the database.
68965 </para>
68966 <para revisionflag="changed">
68967 Certain records are automatically removed by Exim when they are no longer
68968 needed, but others are not. For example, if all the MX hosts for a domain are
68969 down, a retry record is created for each one. If the primary MX host comes back
68970 first, its record is removed when Exim successfully delivers to it, but the
68971 records for the others remain because Exim has not tried to use those hosts.
68972 </para>
68973 <para revisionflag="changed">
68974 It is important, therefore, to run <emphasis>exim_tidydb</emphasis> periodically on all the
68975 hints databases. You should do this at a quiet time of day, because it requires
68976 a database to be locked (and therefore inaccessible to Exim) while it does its
68977 work. Removing records from a DBM file does not normally make the file smaller,
68978 but all the common DBM libraries are able to re-use the space that is released.
68979 After an initial phase of increasing in size, the databases normally reach a
68980 point at which they no longer get any bigger, as long as they are regularly
68981 tidied.
68982 </para>
68983 <para revisionflag="changed">
68984 <emphasis role="bold">Warning</emphasis>: If you never run <emphasis>exim_tidydb</emphasis>, the space used by the hints
68985 databases is likely to keep on increasing.
68986 </para>
68987 </section>
68988 <section id="SECID263" revisionflag="changed">
68989 <title>exim_fixdb</title>
68990 <para revisionflag="changed">
68991 <indexterm role="concept">
68992 <primary><emphasis>exim_fixdb</emphasis></primary>
68993 </indexterm>
68994 The <emphasis>exim_fixdb</emphasis> program is a utility for interactively modifying databases.
68995 Its main use is for testing Exim, but it might also be occasionally useful for
68996 getting round problems in a live system. It has no options, and its interface
68997 is somewhat crude. On entry, it prompts for input with a right angle-bracket. A
68998 key of a database record can then be entered, and the data for that record is
68999 displayed.
69000 </para>
69001 <para revisionflag="changed">
69002 If <quote>d</quote> is typed at the next prompt, the entire record is deleted. For all
69003 except the <emphasis>retry</emphasis> database, that is the only operation that can be carried
69004 out. For the <emphasis>retry</emphasis> database, each field is output preceded by a number, and
69005 data for individual fields can be changed by typing the field number followed
69006 by new data, for example:
69007 </para>
69008 <literallayout class="monospaced" revisionflag="changed">
69009 &gt; 4 951102:1000
69010 </literallayout>
69011 <para revisionflag="changed">
69012 resets the time of the next delivery attempt. Time values are given as a
69013 sequence of digit pairs for year, month, day, hour, and minute. Colons can be
69014 used as optional separators.
69015 </para>
69016 </section>
69017 <section id="SECTmailboxmaint" revisionflag="changed">
69018 <title>Mailbox maintenance (exim_lock)</title>
69019 <para revisionflag="changed">
69020 <indexterm role="concept">
69021 <primary>mailbox</primary>
69022 <secondary>maintenance</secondary>
69023 </indexterm>
69024 <indexterm role="concept">
69025 <primary><emphasis>exim_lock</emphasis></primary>
69026 </indexterm>
69027 <indexterm role="concept">
69028 <primary>locking mailboxes</primary>
69029 </indexterm>
69030 The <emphasis>exim_lock</emphasis> utility locks a mailbox file using the same algorithm as
69031 Exim. For a discussion of locking issues, see section <xref linkend="SECTopappend"/>.
69032 <emphasis>Exim_lock</emphasis> can be used to prevent any modification of a mailbox by Exim or
69033 a user agent while investigating a problem. The utility requires the name of
69034 the file as its first argument. If the locking is successful, the second
69035 argument is run as a command (using C&#x2019;s <function>system()</function> function); if there is no
69036 second argument, the value of the SHELL environment variable is used; if this
69037 is unset or empty, <filename>/bin/sh</filename> is run. When the command finishes, the mailbox
69038 is unlocked and the utility ends. The following options are available:
69039 </para>
69040 <variablelist revisionflag="changed">
69041 <varlistentry revisionflag="changed">
69042 <term><option>-fcntl</option></term>
69043 <listitem>
69044 <para revisionflag="changed">
69045 Use <function>fcntl()</function> locking on the open mailbox.
69046 </para>
69047 </listitem></varlistentry>
69048 <varlistentry revisionflag="changed">
69049 <term><option>-flock</option></term>
69050 <listitem>
69051 <para revisionflag="changed">
69052 Use <function>flock()</function> locking on the open mailbox, provided the operating system
69053 supports it.
69054 </para>
69055 </listitem></varlistentry>
69056 <varlistentry revisionflag="changed">
69057 <term><option>-interval</option></term>
69058 <listitem>
69059 <para revisionflag="changed">
69060 This must be followed by a number, which is a number of seconds; it sets the
69061 interval to sleep between retries (default 3).
69062 </para>
69063 </listitem></varlistentry>
69064 <varlistentry revisionflag="changed">
69065 <term><option>-lockfile</option></term>
69066 <listitem>
69067 <para revisionflag="changed">
69068 Create a lock file before opening the mailbox.
69069 </para>
69070 </listitem></varlistentry>
69071 <varlistentry revisionflag="changed">
69072 <term><option>-mbx</option></term>
69073 <listitem>
69074 <para revisionflag="changed">
69075 Lock the mailbox using MBX rules.
69076 </para>
69077 </listitem></varlistentry>
69078 <varlistentry revisionflag="changed">
69079 <term><option>-q</option></term>
69080 <listitem>
69081 <para revisionflag="changed">
69082 Suppress verification output.
69083 </para>
69084 </listitem></varlistentry>
69085 <varlistentry revisionflag="changed">
69086 <term><option>-retries</option></term>
69087 <listitem>
69088 <para revisionflag="changed">
69089 This must be followed by a number; it sets the number of times to try to get
69090 the lock (default 10).
69091 </para>
69092 </listitem></varlistentry>
69093 <varlistentry revisionflag="changed">
69094 <term><option>-restore_time</option></term>
69095 <listitem>
69096 <para revisionflag="changed">
69097 This option causes <option>exim_lock</option> to restore the modified and read times to the
69098 locked file before exiting. This allows you to access a locked mailbox (for
69099 example, to take a backup copy) without disturbing the times that the user
69100 subsequently sees.
69101 </para>
69102 </listitem></varlistentry>
69103 <varlistentry revisionflag="changed">
69104 <term><option>-timeout</option></term>
69105 <listitem>
69106 <para revisionflag="changed">
69107 This must be followed by a number, which is a number of seconds; it sets a
69108 timeout to be used with a blocking <function>fcntl()</function> lock. If it is not set (the
69109 default), a non-blocking call is used.
69110 </para>
69111 </listitem></varlistentry>
69112 <varlistentry revisionflag="changed">
69113 <term><option>-v</option></term>
69114 <listitem>
69115 <para revisionflag="changed">
69116 Generate verbose output.
69117 </para>
69118 </listitem></varlistentry>
69119 </variablelist>
69120 <para revisionflag="changed">
69121 If none of <option>-fcntl</option>, <option>-flock</option>, <option>-lockfile</option> or <option>-mbx</option> are given, the
69122 default is to create a lock file and also to use <function>fcntl()</function> locking on the
69123 mailbox, which is the same as Exim&#x2019;s default. The use of <option>-flock</option> or
69124 <option>-fcntl</option> requires that the file be writeable; the use of <option>-lockfile</option>
69125 requires that the directory containing the file be writeable. Locking by lock
69126 file does not last forever; Exim assumes that a lock file is expired if it is
69127 more than 30 minutes old.
69128 </para>
69129 <para revisionflag="changed">
69130 The <option>-mbx</option> option can be used with either or both of <option>-fcntl</option> or
69131 <option>-flock</option>. It assumes <option>-fcntl</option> by default. MBX locking causes a shared lock
69132 to be taken out on the open mailbox, and an exclusive lock on the file
69133 <filename>/tmp/.n.m</filename> where <emphasis>n</emphasis> and <emphasis>m</emphasis> are the device number and inode
69134 number of the mailbox file. When the locking is released, if an exclusive lock
69135 can be obtained for the mailbox, the file in <filename>/tmp</filename> is deleted.
69136 </para>
69137 <para revisionflag="changed">
69138 The default output contains verification of the locking that takes place. The
69139 <option>-v</option> option causes some additional information to be given. The <option>-q</option> option
69140 suppresses all output except error messages.
69141 </para>
69142 <para revisionflag="changed">
69143 A command such as
69144 </para>
69145 <literallayout class="monospaced" revisionflag="changed">
69146 exim_lock /var/spool/mail/spqr
69147 </literallayout>
69148 <para revisionflag="changed">
69149 runs an interactive shell while the file is locked, whereas
69150 </para>
69151 <literallayout revisionflag="changed">
69152 <literal>exim_lock -q /var/spool/mail/spqr &lt;&lt;End</literal>
69153 &lt;<emphasis>some commands</emphasis>&gt;
69154 <literal>End</literal>
69155 </literallayout>
69156 <para revisionflag="changed">
69157 runs a specific non-interactive sequence of commands while the file is locked,
69158 suppressing all verification output. A single command can be run by a command
69159 such as
69160 </para>
69161 <literallayout class="monospaced" revisionflag="changed">
69162 exim_lock -q /var/spool/mail/spqr \
69163   "cp /var/spool/mail/spqr /some/where"
69164 </literallayout>
69165 <para revisionflag="changed">
69166 Note that if a command is supplied, it must be entirely contained within the
69167 second argument &ndash; hence the quotes.
69168 <indexterm role="concept" startref="IIDutils" class="endofrange"/>
69169 </para>
69170 </section>
69171 </chapter>
69172
69173 <chapter id="CHAPeximon" revisionflag="changed">
69174 <title>The Exim monitor</title>
69175 <para revisionflag="changed">
69176 <indexterm role="concept" id="IIDeximon" class="startofrange">
69177 <primary>Exim monitor</primary>
69178 <secondary>description</secondary>
69179 </indexterm>
69180 <indexterm role="concept">
69181 <primary>X-windows</primary>
69182 </indexterm>
69183 <indexterm role="concept">
69184 <primary><emphasis>eximon</emphasis></primary>
69185 </indexterm>
69186 <indexterm role="concept">
69187 <primary>Local/eximon.conf</primary>
69188 </indexterm>
69189 <indexterm role="concept">
69190 <primary><filename>exim_monitor/EDITME</filename></primary>
69191 </indexterm>
69192 The Exim monitor is an application which displays in an X window information
69193 about the state of Exim&#x2019;s queue and what Exim is doing. An admin user can
69194 perform certain operations on messages from this GUI interface; however all
69195 such facilities are also available from the command line, and indeed, the
69196 monitor itself makes use of the command line to perform any actions requested.
69197 </para>
69198 <section id="SECID264" revisionflag="changed">
69199 <title>Running the monitor</title>
69200 <para revisionflag="changed">
69201 The monitor is started by running the script called <emphasis>eximon</emphasis>. This is a shell
69202 script that sets up a number of environment variables, and then runs the
69203 binary called <filename>eximon.bin</filename>. The default appearance of the monitor window can
69204 be changed by editing the <filename>Local/eximon.conf</filename> file created by editing
69205 <filename>exim_monitor/EDITME</filename>. Comments in that file describe what the various
69206 parameters are for.
69207 </para>
69208 <para revisionflag="changed">
69209 The parameters that get built into the <emphasis>eximon</emphasis> script can be overridden for
69210 a particular invocation by setting up environment variables of the same names,
69211 preceded by <literal>EXIMON_</literal>. For example, a shell command such as
69212 </para>
69213 <literallayout class="monospaced" revisionflag="changed">
69214 EXIMON_LOG_DEPTH=400 eximon
69215 </literallayout>
69216 <para revisionflag="changed">
69217 (in a Bourne-compatible shell) runs <emphasis>eximon</emphasis> with an overriding setting of
69218 the LOG_DEPTH parameter. If EXIMON_LOG_FILE_PATH is set in the environment, it
69219 overrides the Exim log file configuration. This makes it possible to have
69220 <emphasis>eximon</emphasis> tailing log data that is written to syslog, provided that MAIL.INFO
69221 syslog messages are routed to a file on the local host.
69222 </para>
69223 <para revisionflag="changed">
69224 X resources can be used to change the appearance of the window in the normal
69225 way. For example, a resource setting of the form
69226 </para>
69227 <literallayout class="monospaced" revisionflag="changed">
69228 Eximon*background: gray94
69229 </literallayout>
69230 <para revisionflag="changed">
69231 changes the colour of the background to light grey rather than white. The
69232 stripcharts are drawn with both the data lines and the reference lines in
69233 black. This means that the reference lines are not visible when on top of the
69234 data. However, their colour can be changed by setting a resource called
69235 <quote>highlight</quote> (an odd name, but that&#x2019;s what the Athena stripchart widget uses).
69236 For example, if your X server is running Unix, you could set up lighter
69237 reference lines in the stripcharts by obeying
69238 </para>
69239 <literallayout class="monospaced" revisionflag="changed">
69240 xrdb -merge &lt;&lt;End
69241 Eximon*highlight: gray
69242 End
69243 </literallayout>
69244 <para revisionflag="changed">
69245 <indexterm role="concept">
69246 <primary>admin user</primary>
69247 </indexterm>
69248 In order to see the contents of messages in the queue, and to operate on them,
69249 <emphasis>eximon</emphasis> must either be run as root or by an admin user.
69250 </para>
69251 <para revisionflag="changed">
69252 The command-line parameters of <emphasis>eximon</emphasis> are passed to <filename>eximon.bin</filename> and may
69253 contain X11 resource parameters interpreted by the X11 library.  In addition,
69254 if the first parameter starts with the string "gdb" then it is removed and the
69255 binary is invoked under gdb (the parameter is used as the gdb command-name, so
69256 versioned variants of gdb can be invoked).
69257 </para>
69258 <para revisionflag="changed">
69259 The monitor&#x2019;s window is divided into three parts. The first contains one or
69260 more stripcharts and two action buttons, the second contains a <quote>tail</quote> of the
69261 main log file, and the third is a display of the queue of messages awaiting
69262 delivery, with two more action buttons. The following sections describe these
69263 different parts of the display.
69264 </para>
69265 </section>
69266 <section id="SECID265" revisionflag="changed">
69267 <title>The stripcharts</title>
69268 <para revisionflag="changed">
69269 <indexterm role="concept">
69270 <primary>stripchart</primary>
69271 </indexterm>
69272 The first stripchart is always a count of messages in the queue. Its name can
69273 be configured by setting QUEUE_STRIPCHART_NAME in the
69274 <filename>Local/eximon.conf</filename> file. The remaining stripcharts are defined in the
69275 configuration script by regular expression matches on log file entries, making
69276 it possible to display, for example, counts of messages delivered to certain
69277 hosts or using certain transports. The supplied defaults display counts of
69278 received and delivered messages, and of local and SMTP deliveries. The default
69279 period between stripchart updates is one minute; this can be adjusted by a
69280 parameter in the <filename>Local/eximon.conf</filename> file.
69281 </para>
69282 <para revisionflag="changed">
69283 The stripchart displays rescale themselves automatically as the value they are
69284 displaying changes. There are always 10 horizontal lines in each chart; the
69285 title string indicates the value of each division when it is greater than one.
69286 For example, <quote>x2</quote> means that each division represents a value of 2.
69287 </para>
69288 <para revisionflag="changed">
69289 It is also possible to have a stripchart which shows the percentage fullness of
69290 a particular disk partition, which is useful when local deliveries are confined
69291 to a single partition.
69292 </para>
69293 <para revisionflag="changed">
69294 <indexterm role="concept">
69295 <primary><option>statvfs</option> function</primary>
69296 </indexterm>
69297 This relies on the availability of the <function>statvfs()</function> function or equivalent in
69298 the operating system. Most, but not all versions of Unix that support Exim have
69299 this. For this particular stripchart, the top of the chart always represents
69300 100%, and the scale is given as <quote>x10%</quote>. This chart is configured by setting
69301 SIZE_STRIPCHART and (optionally) SIZE_STRIPCHART_NAME in the
69302 <filename>Local/eximon.conf</filename> file.
69303 </para>
69304 </section>
69305 <section id="SECID266" revisionflag="changed">
69306 <title>Main action buttons</title>
69307 <para revisionflag="changed">
69308 <indexterm role="concept">
69309 <primary>size</primary>
69310 <secondary>of monitor window</secondary>
69311 </indexterm>
69312 <indexterm role="concept">
69313 <primary>Exim monitor</primary>
69314 <secondary>window size</secondary>
69315 </indexterm>
69316 <indexterm role="concept">
69317 <primary>window size</primary>
69318 </indexterm>
69319 Below the stripcharts there is an action button for quitting the monitor. Next
69320 to this is another button marked <quote>Size</quote>. They are placed here so that
69321 shrinking the window to its default minimum size leaves just the queue count
69322 stripchart and these two buttons visible. Pressing the <quote>Size</quote> button causes
69323 the window to expand to its maximum size, unless it is already at the maximum,
69324 in which case it is reduced to its minimum.
69325 </para>
69326 <para revisionflag="changed">
69327 When expanding to the maximum, if the window cannot be fully seen where it
69328 currently is, it is moved back to where it was the last time it was at full
69329 size. When it is expanding from its minimum size, the old position is
69330 remembered, and next time it is reduced to the minimum it is moved back there.
69331 </para>
69332 <para revisionflag="changed">
69333 The idea is that you can keep a reduced window just showing one or two
69334 stripcharts at a convenient place on your screen, easily expand it to show
69335 the full window when required, and just as easily put it back to what it was.
69336 The idea is copied from what the <emphasis>twm</emphasis> window manager does for its
69337 <emphasis>f.fullzoom</emphasis> action. The minimum size of the window can be changed by setting
69338 the MIN_HEIGHT and MIN_WIDTH values in <filename>Local/eximon.conf</filename>.
69339 </para>
69340 <para revisionflag="changed">
69341 Normally, the monitor starts up with the window at its full size, but it can be
69342 built so that it starts up with the window at its smallest size, by setting
69343 START_SMALL=yes in <filename>Local/eximon.conf</filename>.
69344 </para>
69345 </section>
69346 <section id="SECID267" revisionflag="changed">
69347 <title>The log display</title>
69348 <para revisionflag="changed">
69349 <indexterm role="concept">
69350 <primary>log</primary>
69351 <secondary>tail of; in monitor</secondary>
69352 </indexterm>
69353 The second section of the window is an area in which a display of the tail of
69354 the main log is maintained.
69355 To save space on the screen, the timestamp on each log line is shortened by
69356 removing the date and, if <option>log_timezone</option> is set, the timezone.
69357 The log tail is not available when the only destination for logging data is
69358 syslog, unless the syslog lines are routed to a local file whose name is passed
69359 to <emphasis>eximon</emphasis> via the EXIMON_LOG_FILE_PATH environment variable.
69360 </para>
69361 <para revisionflag="changed">
69362 The log sub-window has a scroll bar at its lefthand side which can be used to
69363 move back to look at earlier text, and the up and down arrow keys also have a
69364 scrolling effect. The amount of log that is kept depends on the setting of
69365 LOG_BUFFER in <filename>Local/eximon.conf</filename>, which specifies the amount of memory
69366 to use. When this is full, the earlier 50% of data is discarded &ndash; this is
69367 much more efficient than throwing it away line by line. The sub-window also has
69368 a horizontal scroll bar for accessing the ends of long log lines. This is the
69369 only means of horizontal scrolling; the right and left arrow keys are not
69370 available. Text can be cut from this part of the window using the mouse in the
69371 normal way. The size of this subwindow is controlled by parameters in the
69372 configuration file <filename>Local/eximon.conf</filename>.
69373 </para>
69374 <para revisionflag="changed">
69375 Searches of the text in the log window can be carried out by means of the ^R
69376 and ^S keystrokes, which default to a reverse and a forward search,
69377 respectively. The search covers only the text that is displayed in the window.
69378 It cannot go further back up the log.
69379 </para>
69380 <para revisionflag="changed">
69381 The point from which the search starts is indicated by a caret marker. This is
69382 normally at the end of the text in the window, but can be positioned explicitly
69383 by pointing and clicking with the left mouse button, and is moved automatically
69384 by a successful search. If new text arrives in the window when it is scrolled
69385 back, the caret remains where it is, but if the window is not scrolled back,
69386 the caret is moved to the end of the new text.
69387 </para>
69388 <para revisionflag="changed">
69389 Pressing ^R or ^S pops up a window into which the search text can be typed.
69390 There are buttons for selecting forward or reverse searching, for carrying out
69391 the search, and for cancelling. If the <quote>Search</quote> button is pressed, the search
69392 happens and the window remains so that further searches can be done. If the
69393 <quote>Return</quote> key is pressed, a single search is done and the window is closed. If
69394 ^C is typed the search is cancelled.
69395 </para>
69396 <para revisionflag="changed">
69397 The searching facility is implemented using the facilities of the Athena text
69398 widget. By default this pops up a window containing both <quote>search</quote> and
69399 <quote>replace</quote> options. In order to suppress the unwanted <quote>replace</quote> portion for
69400 eximon, a modified version of the <option>TextPop</option> widget is distributed with Exim.
69401 However, the linkers in BSDI and HP-UX seem unable to handle an externally
69402 provided version of <option>TextPop</option> when the remaining parts of the text widget
69403 come from the standard libraries. The compile-time option EXIMON_TEXTPOP can be
69404 unset to cut out the modified <option>TextPop</option>, making it possible to build Eximon
69405 on these systems, at the expense of having unwanted items in the search popup
69406 window.
69407 </para>
69408 </section>
69409 <section id="SECID268" revisionflag="changed">
69410 <title>The queue display</title>
69411 <para revisionflag="changed">
69412 <indexterm role="concept">
69413 <primary>queue</primary>
69414 <secondary>display in monitor</secondary>
69415 </indexterm>
69416 The bottom section of the monitor window contains a list of all messages that
69417 are in the queue, which includes those currently being received or delivered,
69418 as well as those awaiting delivery. The size of this subwindow is controlled by
69419 parameters in the configuration file <filename>Local/eximon.conf</filename>, and the frequency
69420 at which it is updated is controlled by another parameter in the same file &ndash;
69421 the default is 5 minutes, since queue scans can be quite expensive. However,
69422 there is an <quote>Update</quote> action button just above the display which can be used
69423 to force an update of the queue display at any time.
69424 </para>
69425 <para revisionflag="changed">
69426 When a host is down for some time, a lot of pending mail can build up for it,
69427 and this can make it hard to deal with other messages in the queue. To help
69428 with this situation there is a button next to <quote>Update</quote> called <quote>Hide</quote>. If
69429 pressed, a dialogue box called <quote>Hide addresses ending with</quote> is put up. If you
69430 type anything in here and press <quote>Return</quote>, the text is added to a chain of
69431 such texts, and if every undelivered address in a message matches at least one
69432 of the texts, the message is not displayed.
69433 </para>
69434 <para revisionflag="changed">
69435 If there is an address that does not match any of the texts, all the addresses
69436 are displayed as normal. The matching happens on the ends of addresses so, for
69437 example, <emphasis>cam.ac.uk</emphasis> specifies all addresses in Cambridge, while
69438 <emphasis>xxx@foo.com.example</emphasis> specifies just one specific address. When any hiding
69439 has been set up, a button called <quote>Unhide</quote> is displayed. If pressed, it
69440 cancels all hiding. Also, to ensure that hidden messages do not get forgotten,
69441 a hide request is automatically cancelled after one hour.
69442 </para>
69443 <para revisionflag="changed">
69444 While the dialogue box is displayed, you can&#x2019;t press any buttons or do anything
69445 else to the monitor window. For this reason, if you want to cut text from the
69446 queue display to use in the dialogue box, you have to do the cutting before
69447 pressing the <quote>Hide</quote> button.
69448 </para>
69449 <para revisionflag="changed">
69450 The queue display contains, for each unhidden queued message, the length of
69451 time it has been in the queue, the size of the message, the message id, the
69452 message sender, and the first undelivered recipient, all on one line. If it is
69453 a bounce message, the sender is shown as <quote>&lt;&gt;</quote>. If there is more than one
69454 recipient to which the message has not yet been delivered, subsequent ones are
69455 listed on additional lines, up to a maximum configured number, following which
69456 an ellipsis is displayed. Recipients that have already received the message are
69457 not shown.
69458 </para>
69459 <para revisionflag="changed">
69460 <indexterm role="concept">
69461 <primary>frozen messages</primary>
69462 <secondary>display</secondary>
69463 </indexterm>
69464 If a message is frozen, an asterisk is displayed at the left-hand side.
69465 </para>
69466 <para revisionflag="changed">
69467 The queue display has a vertical scroll bar, and can also be scrolled by means
69468 of the arrow keys. Text can be cut from it using the mouse in the normal way.
69469 The text searching facilities, as described above for the log window, are also
69470 available, but the caret is always moved to the end of the text when the queue
69471 display is updated.
69472 </para>
69473 </section>
69474 <section id="SECID269" revisionflag="changed">
69475 <title>The queue menu</title>
69476 <para revisionflag="changed">
69477 <indexterm role="concept">
69478 <primary>queue</primary>
69479 <secondary>menu in monitor</secondary>
69480 </indexterm>
69481 If the <option>shift</option> key is held down and the left button is clicked when the mouse
69482 pointer is over the text for any message, an action menu pops up, and the first
69483 line of the queue display for the message is highlighted. This does not affect
69484 any selected text.
69485 </para>
69486 <para revisionflag="changed">
69487 If you want to use some other event for popping up the menu, you can set the
69488 MENU_EVENT parameter in <filename>Local/eximon.conf</filename> to change the default, or
69489 set EXIMON_MENU_EVENT in the environment before starting the monitor. The
69490 value set in this parameter is a standard X event description. For example, to
69491 run eximon using <option>ctrl</option> rather than <option>shift</option> you could use
69492 </para>
69493 <literallayout class="monospaced" revisionflag="changed">
69494 EXIMON_MENU_EVENT='Ctrl&lt;Btn1Down&gt;' eximon
69495 </literallayout>
69496 <para revisionflag="changed">
69497 The title of the menu is the message id, and it contains entries which act as
69498 follows:
69499 </para>
69500 <itemizedlist revisionflag="changed">
69501 <listitem>
69502 <para revisionflag="changed">
69503 <emphasis>message log</emphasis>: The contents of the message log for the message are displayed
69504 in a new text window.
69505 </para>
69506 </listitem>
69507 <listitem>
69508 <para revisionflag="changed">
69509 <emphasis>headers</emphasis>: Information from the spool file that contains the envelope
69510 information and headers is displayed in a new text window. See chapter
69511 <xref linkend="CHAPspool"/> for a description of the format of spool files.
69512 </para>
69513 </listitem>
69514 <listitem>
69515 <para revisionflag="changed">
69516 <emphasis>body</emphasis>: The contents of the spool file containing the body of the message are
69517 displayed in a new text window. There is a default limit of 20,000 bytes to the
69518 amount of data displayed. This can be changed by setting the BODY_MAX
69519 option at compile time, or the EXIMON_BODY_MAX option at runtime.
69520 </para>
69521 </listitem>
69522 <listitem>
69523 <para revisionflag="changed">
69524 <emphasis>deliver message</emphasis>: A call to Exim is made using the <option>-M</option> option to request
69525 delivery of the message. This causes an automatic thaw if the message is
69526 frozen. The <option>-v</option> option is also set, and the output from Exim is displayed in
69527 a new text window. The delivery is run in a separate process, to avoid holding
69528 up the monitor while the delivery proceeds.
69529 </para>
69530 </listitem>
69531 <listitem>
69532 <para revisionflag="changed">
69533 <emphasis>freeze message</emphasis>: A call to Exim is made using the <option>-Mf</option> option to request
69534 that the message be frozen.
69535 </para>
69536 </listitem>
69537 <listitem>
69538 <para revisionflag="changed">
69539 <indexterm role="concept">
69540 <primary>thawing messages</primary>
69541 </indexterm>
69542 <indexterm role="concept">
69543 <primary>unfreezing messages</primary>
69544 </indexterm>
69545 <indexterm role="concept">
69546 <primary>frozen messages</primary>
69547 <secondary>thawing</secondary>
69548 </indexterm>
69549 <emphasis>thaw message</emphasis>: A call to Exim is made using the <option>-Mt</option> option to request
69550 that the message be thawed.
69551 </para>
69552 </listitem>
69553 <listitem>
69554 <para revisionflag="changed">
69555 <indexterm role="concept">
69556 <primary>delivery</primary>
69557 <secondary>forcing failure</secondary>
69558 </indexterm>
69559 <emphasis>give up on msg</emphasis>: A call to Exim is made using the <option>-Mg</option> option to request
69560 that Exim gives up trying to deliver the message. A bounce message is generated
69561 for any remaining undelivered addresses.
69562 </para>
69563 </listitem>
69564 <listitem>
69565 <para revisionflag="changed">
69566 <emphasis>remove message</emphasis>: A call to Exim is made using the <option>-Mrm</option> option to request
69567 that the message be deleted from the system without generating a bounce
69568 message.
69569 </para>
69570 </listitem>
69571 <listitem>
69572 <para revisionflag="changed">
69573 <emphasis>add recipient</emphasis>: A dialog box is displayed into which a recipient address can
69574 be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
69575 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
69576 Otherwise it must be entered as a fully qualified address. Pressing RETURN
69577 causes a call to Exim to be made using the <option>-Mar</option> option to request that an
69578 additional recipient be added to the message, unless the entry box is empty, in
69579 which case no action is taken.
69580 </para>
69581 </listitem>
69582 <listitem>
69583 <para revisionflag="changed">
69584 <emphasis>mark delivered</emphasis>: A dialog box is displayed into which a recipient address
69585 can be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
69586 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
69587 Otherwise it must be entered as a fully qualified address. Pressing RETURN
69588 causes a call to Exim to be made using the <option>-Mmd</option> option to mark the given
69589 recipient address as already delivered, unless the entry box is empty, in which
69590 case no action is taken.
69591 </para>
69592 </listitem>
69593 <listitem>
69594 <para revisionflag="changed">
69595 <emphasis>mark all delivered</emphasis>: A call to Exim is made using the <option>-Mmad</option> option to
69596 mark all recipient addresses as already delivered.
69597 </para>
69598 </listitem>
69599 <listitem>
69600 <para revisionflag="changed">
69601 <emphasis>edit sender</emphasis>: A dialog box is displayed initialized with the current
69602 sender&#x2019;s address. Pressing RETURN causes a call to Exim to be made using the
69603 <option>-Mes</option> option to replace the sender address, unless the entry box is empty,
69604 in which case no action is taken. If you want to set an empty sender (as in
69605 bounce messages), you must specify it as <quote>&lt;&gt;</quote>. Otherwise, if the address is
69606 not qualified and the QUALIFY_DOMAIN parameter is set in <filename>Local/eximon.conf</filename>,
69607 the address is qualified with that domain.
69608 </para>
69609 </listitem>
69610 </itemizedlist>
69611 <para revisionflag="changed">
69612 When a delivery is forced, a window showing the <option>-v</option> output is displayed. In
69613 other cases when a call to Exim is made, if there is any output from Exim (in
69614 particular, if the command fails) a window containing the command and the
69615 output is displayed. Otherwise, the results of the action are normally apparent
69616 from the log and queue displays. However, if you set ACTION_OUTPUT=yes in
69617 <filename>Local/eximon.conf</filename>, a window showing the Exim command is always opened, even
69618 if no output is generated.
69619 </para>
69620 <para revisionflag="changed">
69621 The queue display is automatically updated for actions such as freezing and
69622 thawing, unless ACTION_QUEUE_UPDATE=no has been set in
69623 <filename>Local/eximon.conf</filename>. In this case the <quote>Update</quote> button has to be used to
69624 force an update of the display after one of these actions.
69625 </para>
69626 <para revisionflag="changed">
69627 In any text window that is displayed as result of a menu action, the normal
69628 cut-and-paste facility is available, and searching can be carried out using ^R
69629 and ^S, as described above for the log tail window.
69630 <indexterm role="concept" startref="IIDeximon" class="endofrange"/>
69631 </para>
69632 </section>
69633 </chapter>
69634
69635 <chapter id="CHAPsecurity" revisionflag="changed">
69636 <title>Security considerations</title>
69637 <para revisionflag="changed">
69638 <indexterm role="concept" id="IIDsecurcon" class="startofrange">
69639 <primary>security</primary>
69640 <secondary>discussion of</secondary>
69641 </indexterm>
69642 This chapter discusses a number of issues concerned with security, some of
69643 which are also covered in other parts of this manual.
69644 </para>
69645 <para revisionflag="changed">
69646 For reasons that this author does not understand, some people have promoted
69647 Exim as a <quote>particularly secure</quote> mailer. Perhaps it is because of the
69648 existence of this chapter in the documentation. However, the intent of the
69649 chapter is simply to describe the way Exim works in relation to certain
69650 security concerns, not to make any specific claims about the effectiveness of
69651 its security as compared with other MTAs.
69652 </para>
69653 <para revisionflag="changed">
69654 What follows is a description of the way Exim is supposed to be. Best efforts
69655 have been made to try to ensure that the code agrees with the theory, but an
69656 absence of bugs can never be guaranteed. Any that are reported will get fixed
69657 as soon as possible.
69658 </para>
69659 <section id="SECID286" revisionflag="changed">
69660 <title>Building a more <quote>hardened</quote> Exim</title>
69661 <para revisionflag="changed">
69662 <indexterm role="concept">
69663 <primary>security</primary>
69664 <secondary>build-time features</secondary>
69665 </indexterm>
69666 There are a number of build-time options that can be set in <filename>Local/Makefile</filename>
69667 to create Exim binaries that are <quote>harder</quote> to attack, in particular by a rogue
69668 Exim administrator who does not have the root password, or by someone who has
69669 penetrated the Exim (but not the root) account. These options are as follows:
69670 </para>
69671 <itemizedlist revisionflag="changed">
69672 <listitem>
69673 <para revisionflag="changed">
69674 ALT_CONFIG_PREFIX can be set to a string that is required to match the
69675 start of any filenames used with the <option>-C</option> option. When it is set, these
69676 filenames are also not allowed to contain the sequence <quote>/../</quote>. (However, if
69677 the value of the <option>-C</option> option is identical to the value of CONFIGURE_FILE in
69678 <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as usual.) There is no
69679 default setting for <option>ALT_CONFIG_PREFIX</option>.
69680 </para>
69681 <para revisionflag="changed">
69682 If the permitted configuration files are confined to a directory to
69683 which only root has access, this guards against someone who has broken
69684 into the Exim account from running a privileged Exim with an arbitrary
69685 configuration file, and using it to break into other accounts.
69686 </para>
69687 </listitem>
69688 <listitem>
69689 <para revisionflag="changed">
69690 If a non-trusted configuration file (i.e. not the default configuration file
69691 or one which is trusted by virtue of being listed in the TRUSTED_CONFIG_LIST
69692 file) is specified with <option>-C</option>, or if macros are given with <option>-D</option> (but see
69693 the next item), then root privilege is retained only if the caller of Exim is
69694 root. This locks out the possibility of testing a configuration using <option>-C</option>
69695 right through message reception and delivery, even if the caller is root. The
69696 reception works, but by that time, Exim is running as the Exim user, so when
69697 it re-execs to regain privilege for the delivery, the use of <option>-C</option> causes
69698 privilege to be lost. However, root can test reception and delivery using two
69699 separate commands.
69700 </para>
69701 </listitem>
69702 <listitem>
69703 <para revisionflag="changed">
69704 The WHITELIST_D_MACROS build option declares some macros to be safe to override
69705 with <option>-D</option> if the real uid is one of root, the Exim run-time user or the
69706 CONFIGURE_OWNER, if defined.  The potential impact of this option is limited by
69707 requiring the run-time value supplied to <option>-D</option> to match a regex that errs on
69708 the restrictive side.  Requiring build-time selection of safe macros is onerous
69709 but this option is intended solely as a transition mechanism to permit
69710 previously-working configurations to continue to work after release 4.73.
69711 </para>
69712 </listitem>
69713 <listitem>
69714 <para revisionflag="changed">
69715 If DISABLE_D_OPTION is defined, the use of the <option>-D</option> command line option
69716 is disabled.
69717 </para>
69718 </listitem>
69719 <listitem>
69720 <para revisionflag="changed">
69721 FIXED_NEVER_USERS can be set to a colon-separated list of users that are
69722 never to be used for any deliveries. This is like the <option>never_users</option> runtime
69723 option, but it cannot be overridden; the runtime option adds additional users
69724 to the list. The default setting is <quote>root</quote>; this prevents a non-root user who
69725 is permitted to modify the runtime file from using Exim as a way to get root.
69726 </para>
69727 </listitem>
69728 </itemizedlist>
69729 </section>
69730 <section id="SECID270" revisionflag="changed">
69731 <title>Root privilege</title>
69732 <para revisionflag="changed">
69733 <indexterm role="concept">
69734 <primary>setuid</primary>
69735 </indexterm>
69736 <indexterm role="concept">
69737 <primary>root privilege</primary>
69738 </indexterm>
69739 The Exim binary is normally setuid to root, which means that it gains root
69740 privilege (runs as root) when it starts execution. In some special cases (for
69741 example, when the daemon is not in use and there are no local deliveries), it
69742 may be possible to run Exim setuid to some user other than root. This is
69743 discussed in the next section. However, in most installations, root privilege
69744 is required for two things:
69745 </para>
69746 <itemizedlist revisionflag="changed">
69747 <listitem>
69748 <para revisionflag="changed">
69749 To set up a socket connected to the standard SMTP port (25) when initialising
69750 the listening daemon. If Exim is run from <emphasis>inetd</emphasis>, this privileged action is
69751 not required.
69752 </para>
69753 </listitem>
69754 <listitem>
69755 <para revisionflag="changed">
69756 To be able to change uid and gid in order to read users&#x2019; <filename>.forward</filename> files and
69757 perform local deliveries as the receiving user or as specified in the
69758 configuration.
69759 </para>
69760 </listitem>
69761 </itemizedlist>
69762 <para revisionflag="changed">
69763 It is not necessary to be root to do any of the other things Exim does, such as
69764 receiving messages and delivering them externally over SMTP, and it is
69765 obviously more secure if Exim does not run as root except when necessary.
69766 For this reason, a user and group for Exim to use must be defined in
69767 <filename>Local/Makefile</filename>. These are known as <quote>the Exim user</quote> and <quote>the Exim
69768 group</quote>. Their values can be changed by the runtime configuration, though this
69769 is not recommended. Often a user called <emphasis>exim</emphasis> is used, but some sites use
69770 <emphasis>mail</emphasis> or another user name altogether.
69771 </para>
69772 <para revisionflag="changed">
69773 Exim uses <function>setuid()</function> whenever it gives up root privilege. This is a permanent
69774 abdication; the process cannot regain root afterwards. Prior to release 4.00,
69775 <function>seteuid()</function> was used in some circumstances, but this is no longer the case.
69776 </para>
69777 <para revisionflag="changed">
69778 After a new Exim process has interpreted its command line options, it changes
69779 uid and gid in the following cases:
69780 </para>
69781 <itemizedlist revisionflag="changed">
69782 <listitem>
69783 <para revisionflag="changed">
69784 <indexterm role="option">
69785 <primary><option>-C</option></primary>
69786 </indexterm>
69787 <indexterm role="option">
69788 <primary><option>-D</option></primary>
69789 </indexterm>
69790 If the <option>-C</option> option is used to specify an alternate configuration file, or if
69791 the <option>-D</option> option is used to define macro values for the configuration, and the
69792 calling process is not running as root, the uid and gid are changed to those of
69793 the calling process.
69794 However, if DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the <option>-D</option>
69795 option may not be used at all.
69796 If WHITELIST_D_MACROS is defined in <filename>Local/Makefile</filename>, then some macro values
69797 can be supplied if the calling process is running as root, the Exim run-time
69798 user or CONFIGURE_OWNER, if defined.
69799 </para>
69800 </listitem>
69801 <listitem>
69802 <para revisionflag="changed">
69803 <indexterm role="option">
69804 <primary><option>-be</option></primary>
69805 </indexterm>
69806 <indexterm role="option">
69807 <primary><option>-bf</option></primary>
69808 </indexterm>
69809 <indexterm role="option">
69810 <primary><option>-bF</option></primary>
69811 </indexterm>
69812 If the expansion test option (<option>-be</option>) or one of the filter testing options
69813 (<option>-bf</option> or <option>-bF</option>) are used, the uid and gid are changed to those of the
69814 calling process.
69815 </para>
69816 </listitem>
69817 <listitem>
69818 <para revisionflag="changed">
69819 If the process is not a daemon process or a queue runner process or a delivery
69820 process or a process for testing address routing (started with <option>-bt</option>), the
69821 uid and gid are changed to the Exim user and group. This means that Exim always
69822 runs under its own uid and gid when receiving messages. This also applies when
69823 testing address verification
69824 <indexterm role="option">
69825 <primary><option>-bv</option></primary>
69826 </indexterm>
69827 <indexterm role="option">
69828 <primary><option>-bh</option></primary>
69829 </indexterm>
69830 (the <option>-bv</option> option) and testing incoming message policy controls (the <option>-bh</option>
69831 option).
69832 </para>
69833 </listitem>
69834 <listitem>
69835 <para revisionflag="changed">
69836 For a daemon, queue runner, delivery, or address testing process, the uid
69837 remains as root at this stage, but the gid is changed to the Exim group.
69838 </para>
69839 </listitem>
69840 </itemizedlist>
69841 <para revisionflag="changed">
69842 The processes that initially retain root privilege behave as follows:
69843 </para>
69844 <itemizedlist revisionflag="changed">
69845 <listitem>
69846 <para revisionflag="changed">
69847 A daemon process changes the gid to the Exim group and the uid to the Exim
69848 user after setting up one or more listening sockets. The <function>initgroups()</function>
69849 function is called, so that if the Exim user is in any additional groups, they
69850 will be used during message reception.
69851 </para>
69852 </listitem>
69853 <listitem>
69854 <para revisionflag="changed">
69855 A queue runner process retains root privilege throughout its execution. Its
69856 job is to fork a controlled sequence of delivery processes.
69857 </para>
69858 </listitem>
69859 <listitem>
69860 <para revisionflag="changed">
69861 A delivery process retains root privilege throughout most of its execution,
69862 but any actual deliveries (that is, the transports themselves) are run in
69863 subprocesses which always change to a non-root uid and gid. For local
69864 deliveries this is typically the uid and gid of the owner of the mailbox; for
69865 remote deliveries, the Exim uid and gid are used. Once all the delivery
69866 subprocesses have been run, a delivery process changes to the Exim uid and gid
69867 while doing post-delivery tidying up such as updating the retry database and
69868 generating bounce and warning messages.
69869 </para>
69870 <para revisionflag="changed">
69871 While the recipient addresses in a message are being routed, the delivery
69872 process runs as root. However, if a user&#x2019;s filter file has to be processed,
69873 this is done in a subprocess that runs under the individual user&#x2019;s uid and
69874 gid. A system filter is run as root unless <option>system_filter_user</option> is set.
69875 </para>
69876 </listitem>
69877 <listitem>
69878 <para revisionflag="changed">
69879 A process that is testing addresses (the <option>-bt</option> option) runs as root so that
69880 the routing is done in the same environment as a message delivery.
69881 </para>
69882 </listitem>
69883 </itemizedlist>
69884 </section>
69885 <section id="SECTrunexiwitpri" revisionflag="changed">
69886 <title>Running Exim without privilege</title>
69887 <para revisionflag="changed">
69888 <indexterm role="concept">
69889 <primary>privilege, running without</primary>
69890 </indexterm>
69891 <indexterm role="concept">
69892 <primary>unprivileged running</primary>
69893 </indexterm>
69894 <indexterm role="concept">
69895 <primary>root privilege</primary>
69896 <secondary>running without</secondary>
69897 </indexterm>
69898 Some installations like to run Exim in an unprivileged state for more of its
69899 operation, for added security. Support for this mode of operation is provided
69900 by the global option <option>deliver_drop_privilege</option>. When this is set, the uid and
69901 gid are changed to the Exim user and group at the start of a delivery process
69902 (and also queue runner and address testing processes). This means that address
69903 routing is no longer run as root, and the deliveries themselves cannot change
69904 to any other uid.
69905 </para>
69906 <para revisionflag="changed">
69907 <indexterm role="concept">
69908 <primary>SIGHUP</primary>
69909 </indexterm>
69910 <indexterm role="concept">
69911 <primary>daemon</primary>
69912 <secondary>restarting</secondary>
69913 </indexterm>
69914 Leaving the binary setuid to root, but setting <option>deliver_drop_privilege</option> means
69915 that the daemon can still be started in the usual way, and it can respond
69916 correctly to SIGHUP because the re-invocation regains root privilege.
69917 </para>
69918 <para revisionflag="changed">
69919 An alternative approach is to make Exim setuid to the Exim user and also setgid
69920 to the Exim group. If you do this, the daemon must be started from a root
69921 process. (Calling Exim from a root process makes it behave in the way it does
69922 when it is setuid root.) However, the daemon cannot restart itself after a
69923 SIGHUP signal because it cannot regain privilege.
69924 </para>
69925 <para revisionflag="changed">
69926 It is still useful to set <option>deliver_drop_privilege</option> in this case, because it
69927 stops Exim from trying to re-invoke itself to do a delivery after a message has
69928 been received. Such a re-invocation is a waste of resources because it has no
69929 effect.
69930 </para>
69931 <para revisionflag="changed">
69932 If restarting the daemon is not an issue (for example, if <option>mua_wrapper</option> is
69933 set, or <emphasis>inetd</emphasis> is being used instead of a daemon), having the binary setuid
69934 to the Exim user seems a clean approach, but there is one complication:
69935 </para>
69936 <para revisionflag="changed">
69937 In this style of operation, Exim is running with the real uid and gid set to
69938 those of the calling process, and the effective uid/gid set to Exim&#x2019;s values.
69939 Ideally, any association with the calling process&#x2019; uid/gid should be dropped,
69940 that is, the real uid/gid should be reset to the effective values so as to
69941 discard any privileges that the caller may have. While some operating systems
69942 have a function that permits this action for a non-root effective uid, quite a
69943 number of them do not. Because of this lack of standardization, Exim does not
69944 address this problem at this time.
69945 </para>
69946 <para revisionflag="changed">
69947 For this reason, the recommended approach for <quote>mostly unprivileged</quote> running
69948 is to keep the Exim binary setuid to root, and to set
69949 <option>deliver_drop_privilege</option>. This also has the advantage of allowing a daemon to
69950 be used in the most straightforward way.
69951 </para>
69952 <para revisionflag="changed">
69953 If you configure Exim not to run delivery processes as root, there are a
69954 number of restrictions on what you can do:
69955 </para>
69956 <itemizedlist revisionflag="changed">
69957 <listitem>
69958 <para revisionflag="changed">
69959 You can deliver only as the Exim user/group. You should  explicitly use the
69960 <option>user</option> and <option>group</option> options to override routers or local transports that
69961 normally deliver as the recipient. This makes sure that configurations that
69962 work in this mode function the same way in normal mode. Any implicit or
69963 explicit specification of another user causes an error.
69964 </para>
69965 </listitem>
69966 <listitem>
69967 <para revisionflag="changed">
69968 Use of <filename>.forward</filename> files is severely restricted, such that it is usually
69969 not worthwhile to include them in the configuration.
69970 </para>
69971 </listitem>
69972 <listitem>
69973 <para revisionflag="changed">
69974 Users who wish to use <filename>.forward</filename> would have to make their home directory and
69975 the file itself accessible to the Exim user. Pipe and append-to-file entries,
69976 and their equivalents in Exim filters, cannot be used. While they could be
69977 enabled in the Exim user&#x2019;s name, that would be insecure and not very useful.
69978 </para>
69979 </listitem>
69980 <listitem>
69981 <para revisionflag="changed">
69982 Unless the local user mailboxes are all owned by the Exim user (possible in
69983 some POP3 or IMAP-only environments):
69984 </para>
69985 <orderedlist numeration="arabic" revisionflag="changed">
69986 <listitem>
69987 <para revisionflag="changed">
69988 They must be owned by the Exim group and be writeable by that group. This
69989 implies you must set <option>mode</option> in the appendfile configuration, as well as the
69990 mode of the mailbox files themselves.
69991 </para>
69992 </listitem>
69993 <listitem>
69994 <para revisionflag="changed">
69995 You must set <option>no_check_owner</option>, since most or all of the files will not be
69996 owned by the Exim user.
69997 </para>
69998 </listitem>
69999 <listitem>
70000 <para revisionflag="changed">
70001 You must set <option>file_must_exist</option>, because Exim cannot set the owner correctly
70002 on a newly created mailbox when unprivileged. This also implies that new
70003 mailboxes need to be created manually.
70004 </para>
70005 </listitem>
70006 </orderedlist>
70007 </listitem>
70008 </itemizedlist>
70009 <para revisionflag="changed">
70010 These restrictions severely restrict what can be done in local deliveries.
70011 However, there are no restrictions on remote deliveries. If you are running a
70012 gateway host that does no local deliveries, setting <option>deliver_drop_privilege</option>
70013 gives more security at essentially no cost.
70014 </para>
70015 <para revisionflag="changed">
70016 If you are using the <option>mua_wrapper</option> facility (see chapter
70017 <xref linkend="CHAPnonqueueing"/>), <option>deliver_drop_privilege</option> is forced to be true.
70018 </para>
70019 </section>
70020 <section id="SECID271" revisionflag="changed">
70021 <title>Delivering to local files</title>
70022 <para revisionflag="changed">
70023 Full details of the checks applied by <command>appendfile</command> before it writes to a file
70024 are given in chapter <xref linkend="CHAPappendfile"/>.
70025 </para>
70026 </section>
70027 <section id="SECTsecconslocalcmds" revisionflag="changed">
70028 <title>Running local commands</title>
70029 <para revisionflag="changed">
70030 <indexterm role="concept">
70031 <primary>security</primary>
70032 <secondary>local commands</secondary>
70033 </indexterm>
70034 <indexterm role="concept">
70035 <primary>security</primary>
70036 <secondary>command injection attacks</secondary>
70037 </indexterm>
70038 There are a number of ways in which an administrator can configure Exim to run
70039 commands based upon received, untrustworthy, data. Further, in some
70040 configurations a user who can control a <filename>.forward</filename> file can also arrange to
70041 run commands. Configuration to check includes, but is not limited to:
70042 </para>
70043 <itemizedlist revisionflag="changed">
70044 <listitem>
70045 <para revisionflag="changed">
70046 Use of <option>use_shell</option> in the pipe transport: various forms of shell command
70047 injection may be possible with this option present. It is dangerous and should
70048 be used only with considerable caution. Consider constraints which whitelist
70049 allowed characters in a variable which is to be used in a pipe transport that
70050 has <option>use_shell</option> enabled.
70051 </para>
70052 </listitem>
70053 <listitem>
70054 <para revisionflag="changed">
70055 A number of options such as <option>forbid_filter_run</option>, <option>forbid_filter_perl</option>,
70056 <option>forbid_filter_dlfunc</option> and so forth which restrict facilities available to
70057 <filename>.forward</filename> files in a redirect router. If Exim is running on a central mail
70058 hub to which ordinary users do not have shell access, but home directories are
70059 NFS mounted (for instance) then administrators should review the list of these
70060 forbid options available, and should bear in mind that the options that may
70061 need forbidding can change as new features are added between releases.
70062 </para>
70063 </listitem>
70064 <listitem>
70065 <para revisionflag="changed">
70066 The <option>${run...}</option> expansion item does not use a shell by default, but
70067 administrators can configure use of <filename>/bin/sh</filename> as part of the command.
70068 Such invocations should be viewed with prejudicial suspicion.
70069 </para>
70070 </listitem>
70071 <listitem>
70072 <para revisionflag="changed">
70073 Administrators who use embedded Perl are advised to explore how Perl&#x2019;s
70074 taint checking might apply to their usage.
70075 </para>
70076 </listitem>
70077 <listitem>
70078 <para revisionflag="changed">
70079 Use of <option>${expand...}</option> is somewhat analogous to shell&#x2019;s eval builtin and
70080 administrators are well advised to view its use with suspicion, in case (for
70081 instance) it allows a local-part to contain embedded Exim directives.
70082 </para>
70083 </listitem>
70084 <listitem>
70085 <para revisionflag="changed">
70086 Use of <option>${match_local_part...}</option> and friends becomes more dangerous if
70087 Exim was built with EXPAND_LISTMATCH_RHS defined: the second string in
70088 each can reference arbitrary lists and files, rather than just being a list
70089 of opaque strings.
70090 The EXPAND_LISTMATCH_RHS option was added and set false by default because of
70091 real-world security vulnerabilities caused by its use with untrustworthy data
70092 injected in, for SQL injection attacks.
70093 Consider the use of the <option>inlisti</option> expansion condition instead.
70094 </para>
70095 </listitem>
70096 </itemizedlist>
70097 </section>
70098 <section id="SECTsecconfdata" revisionflag="changed">
70099 <title>Trust in configuration data</title>
70100 <para revisionflag="changed">
70101 <indexterm role="concept">
70102 <primary>security</primary>
70103 <secondary>data sources</secondary>
70104 </indexterm>
70105 <indexterm role="concept">
70106 <primary>security</primary>
70107 <secondary>regular expressions</secondary>
70108 </indexterm>
70109 <indexterm role="concept">
70110 <primary>regular expressions</primary>
70111 <secondary>security</secondary>
70112 </indexterm>
70113 <indexterm role="concept">
70114 <primary>PCRE</primary>
70115 <secondary>security</secondary>
70116 </indexterm>
70117 If configuration data for Exim can come from untrustworthy sources, there
70118 are some issues to be aware of:
70119 </para>
70120 <itemizedlist revisionflag="changed">
70121 <listitem>
70122 <para revisionflag="changed">
70123 Use of <option>${expand...}</option> may provide a path for shell injection attacks.
70124 </para>
70125 </listitem>
70126 <listitem>
70127 <para revisionflag="changed">
70128 Letting untrusted data provide a regular expression is unwise.
70129 </para>
70130 </listitem>
70131 <listitem>
70132 <para revisionflag="changed">
70133 Using <option>${match...}</option> to apply a fixed regular expression against untrusted
70134 data may result in pathological behaviour within PCRE.  Be aware of what
70135 "backtracking" means and consider options for being more strict with a regular
70136 expression. Avenues to explore include limiting what can match (avoiding <literal>.</literal>
70137 when <literal>[a-z0-9]</literal> or other character class will do), use of atomic grouping and
70138 possessive quantifiers or just not using regular expressions against untrusted
70139 data.
70140 </para>
70141 </listitem>
70142 <listitem>
70143 <para revisionflag="changed">
70144 It can be important to correctly use <option>${quote:...}</option>,
70145 <option>${quote_local_part:...}</option> and <option>${quote_</option>&lt;<emphasis>lookup-type</emphasis>&gt;<option>:...}</option> expansion
70146 items to ensure that data is correctly constructed.
70147 </para>
70148 </listitem>
70149 <listitem>
70150 <para revisionflag="changed">
70151 Some lookups might return multiple results, even though normal usage is only
70152 expected to yield one result.
70153 </para>
70154 </listitem>
70155 </itemizedlist>
70156 </section>
70157 <section id="SECID272" revisionflag="changed">
70158 <title>IPv4 source routing</title>
70159 <para revisionflag="changed">
70160 <indexterm role="concept">
70161 <primary>source routing</primary>
70162 <secondary>in IP packets</secondary>
70163 </indexterm>
70164 <indexterm role="concept">
70165 <primary>IP source routing</primary>
70166 </indexterm>
70167 Many operating systems suppress IP source-routed packets in the kernel, but
70168 some cannot be made to do this, so Exim does its own check. It logs incoming
70169 IPv4 source-routed TCP calls, and then drops them. Things are all different in
70170 IPv6. No special checking is currently done.
70171 </para>
70172 </section>
70173 <section id="SECID273" revisionflag="changed">
70174 <title>The VRFY, EXPN, and ETRN commands in SMTP</title>
70175 <para revisionflag="changed">
70176 Support for these SMTP commands is disabled by default. If required, they can
70177 be enabled by defining suitable ACLs.
70178 </para>
70179 </section>
70180 <section id="SECID274" revisionflag="changed">
70181 <title>Privileged users</title>
70182 <para revisionflag="changed">
70183 <indexterm role="concept">
70184 <primary>trusted users</primary>
70185 </indexterm>
70186 <indexterm role="concept">
70187 <primary>admin user</primary>
70188 </indexterm>
70189 <indexterm role="concept">
70190 <primary>privileged user</primary>
70191 </indexterm>
70192 <indexterm role="concept">
70193 <primary>user</primary>
70194 <secondary>trusted</secondary>
70195 </indexterm>
70196 <indexterm role="concept">
70197 <primary>user</primary>
70198 <secondary>admin</secondary>
70199 </indexterm>
70200 Exim recognizes two sets of users with special privileges. Trusted users are
70201 able to submit new messages to Exim locally, but supply their own sender
70202 addresses and information about a sending host. For other users submitting
70203 local messages, Exim sets up the sender address from the uid, and doesn&#x2019;t
70204 permit a remote host to be specified.
70205 </para>
70206 <para revisionflag="changed">
70207 <indexterm role="option">
70208 <primary><option>-f</option></primary>
70209 </indexterm>
70210 However, an untrusted user is permitted to use the <option>-f</option> command line option
70211 in the special form <option>-f &lt;&gt;</option> to indicate that a delivery failure for the
70212 message should not cause an error report. This affects the message&#x2019;s envelope,
70213 but it does not affect the <emphasis>Sender:</emphasis> header. Untrusted users may also be
70214 permitted to use specific forms of address with the <option>-f</option> option by setting
70215 the <option>untrusted_set_sender</option> option.
70216 </para>
70217 <para revisionflag="changed">
70218 Trusted users are used to run processes that receive mail messages from some
70219 other mail domain and pass them on to Exim for delivery either locally, or over
70220 the Internet. Exim trusts a caller that is running as root, as the Exim user,
70221 as any user listed in the <option>trusted_users</option> configuration option, or under any
70222 group listed in the <option>trusted_groups</option> option.
70223 </para>
70224 <para revisionflag="changed">
70225 Admin users are permitted to do things to the messages on Exim&#x2019;s queue. They
70226 can freeze or thaw messages, cause them to be returned to their senders, remove
70227 them entirely, or modify them in various ways. In addition, admin users can run
70228 the Exim monitor and see all the information it is capable of providing, which
70229 includes the contents of files on the spool.
70230 </para>
70231 <para revisionflag="changed">
70232 <indexterm role="option">
70233 <primary><option>-M</option></primary>
70234 </indexterm>
70235 <indexterm role="option">
70236 <primary><option>-q</option></primary>
70237 </indexterm>
70238 By default, the use of the <option>-M</option> and <option>-q</option> options to cause Exim to attempt
70239 delivery of messages on its queue is restricted to admin users. This
70240 restriction can be relaxed by setting the <option>no_prod_requires_admin</option> option.
70241 Similarly, the use of <option>-bp</option> (and its variants) to list the contents of the
70242 queue is also restricted to admin users. This restriction can be relaxed by
70243 setting <option>no_queue_list_requires_admin</option>.
70244 </para>
70245 <para revisionflag="changed">
70246 Exim recognizes an admin user if the calling process is running as root or as
70247 the Exim user or if any of the groups associated with the calling process is
70248 the Exim group. It is not necessary actually to be running under the Exim
70249 group. However, if admin users who are not root or the Exim user are to access
70250 the contents of files on the spool via the Exim monitor (which runs
70251 unprivileged), Exim must be built to allow group read access to its spool
70252 files.
70253 </para>
70254 <para revisionflag="changed">
70255 By default, regular users are trusted to perform basic testing and
70256 introspection commands, as themselves.  This setting can be tightened by
70257 setting the <option>commandline_checks_require_admin</option> option.
70258 This affects most of the checking options,
70259 such as <option>-be</option> and anything else <option>-b*</option>.
70260 </para>
70261 </section>
70262 <section id="SECID275" revisionflag="changed">
70263 <title>Spool files</title>
70264 <para revisionflag="changed">
70265 <indexterm role="concept">
70266 <primary>spool directory</primary>
70267 <secondary>files</secondary>
70268 </indexterm>
70269 Exim&#x2019;s spool directory and everything it contains is owned by the Exim user and
70270 set to the Exim group. The mode for spool files is defined in the
70271 <filename>Local/Makefile</filename> configuration file, and defaults to 0640. This means that
70272 any user who is a member of the Exim group can access these files.
70273 </para>
70274 </section>
70275 <section id="SECID276" revisionflag="changed">
70276 <title>Use of argv[0]</title>
70277 <para revisionflag="changed">
70278 Exim examines the last component of <option>argv[0]</option>, and if it matches one of a set
70279 of specific strings, Exim assumes certain options. For example, calling Exim
70280 with the last component of <option>argv[0]</option> set to <quote>rsmtp</quote> is exactly equivalent
70281 to calling it with the option <option>-bS</option>. There are no security implications in
70282 this.
70283 </para>
70284 </section>
70285 <section id="SECID277" revisionflag="changed">
70286 <title>Use of %f formatting</title>
70287 <para revisionflag="changed">
70288 The only use made of <quote>%f</quote> by Exim is in formatting load average values. These
70289 are actually stored in integer variables as 1000 times the load average.
70290 Consequently, their range is limited and so therefore is the length of the
70291 converted output.
70292 </para>
70293 </section>
70294 <section id="SECID278" revisionflag="changed">
70295 <title>Embedded Exim path</title>
70296 <para revisionflag="changed">
70297 Exim uses its own path name, which is embedded in the code, only when it needs
70298 to re-exec in order to regain root privilege. Therefore, it is not root when it
70299 does so. If some bug allowed the path to get overwritten, it would lead to an
70300 arbitrary program&#x2019;s being run as exim, not as root.
70301 </para>
70302 </section>
70303 <section id="SECTdynmoddir" revisionflag="changed">
70304 <title>Dynamic module directory</title>
70305 <para revisionflag="changed">
70306 Any dynamically loadable modules must be installed into the directory
70307 defined in <literal>LOOKUP_MODULE_DIR</literal> in <filename>Local/Makefile</filename> for Exim to permit
70308 loading it.
70309 </para>
70310 </section>
70311 <section id="SECID279" revisionflag="changed">
70312 <title>Use of sprintf()</title>
70313 <para revisionflag="changed">
70314 <indexterm role="concept">
70315 <primary><function>sprintf()</function></primary>
70316 </indexterm>
70317 A large number of occurrences of <quote>sprintf</quote> in the code are actually calls to
70318 <emphasis>string_sprintf()</emphasis>, a function that returns the result in malloc&#x2019;d store.
70319 The intermediate formatting is done into a large fixed buffer by a function
70320 that runs through the format string itself, and checks the length of each
70321 conversion before performing it, thus preventing buffer overruns.
70322 </para>
70323 <para revisionflag="changed">
70324 The remaining uses of <function>sprintf()</function> happen in controlled circumstances where
70325 the output buffer is known to be sufficiently long to contain the converted
70326 string.
70327 </para>
70328 </section>
70329 <section id="SECID280" revisionflag="changed">
70330 <title>Use of debug_printf() and log_write()</title>
70331 <para revisionflag="changed">
70332 Arbitrary strings are passed to both these functions, but they do their
70333 formatting by calling the function <emphasis>string_vformat()</emphasis>, which runs through
70334 the format string itself, and checks the length of each conversion.
70335 </para>
70336 </section>
70337 <section id="SECID281" revisionflag="changed">
70338 <title>Use of strcat() and strcpy()</title>
70339 <para revisionflag="changed">
70340 These are used only in cases where the output buffer is known to be large
70341 enough to hold the result.
70342 <indexterm role="concept" startref="IIDsecurcon" class="endofrange"/>
70343 </para>
70344 </section>
70345 </chapter>
70346
70347 <chapter id="CHAPspool" revisionflag="changed">
70348 <title>Format of spool files</title>
70349 <para revisionflag="changed">
70350 <indexterm role="concept" id="IIDforspo1" class="startofrange">
70351 <primary>format</primary>
70352 <secondary>spool files</secondary>
70353 </indexterm>
70354 <indexterm role="concept" id="IIDforspo2" class="startofrange">
70355 <primary>spool directory</primary>
70356 <secondary>format of files</secondary>
70357 </indexterm>
70358 <indexterm role="concept" id="IIDforspo3" class="startofrange">
70359 <primary>spool files</primary>
70360 <secondary>format of</secondary>
70361 </indexterm>
70362 <indexterm role="concept">
70363 <primary>spool files</primary>
70364 <secondary>editing</secondary>
70365 </indexterm>
70366 A message on Exim&#x2019;s queue consists of two files, whose names are the message id
70367 followed by -D and -H, respectively. The data portion of the message is kept in
70368 the -D file on its own. The message&#x2019;s envelope, status, and headers are all
70369 kept in the -H file, whose format is described in this chapter. Each of these
70370 two files contains the final component of its own name as its first line. This
70371 is insurance against disk crashes where the directory is lost but the files
70372 themselves are recoverable.
70373 </para>
70374 <para revisionflag="changed">
70375 The file formats may be changed, or new formats added, at any release.
70376 Spool files are not intended as an interface to other programs
70377 and should not be used as such.
70378 </para>
70379 <para>
70380 Some people are tempted into editing -D files in order to modify messages. You
70381 need to be extremely careful if you do this; it is not recommended and you are
70382 on your own if you do it. Here are some of the pitfalls:
70383 </para>
70384 <itemizedlist>
70385 <listitem>
70386 <para>
70387 You must ensure that Exim does not try to deliver the message while you are
70388 fiddling with it. The safest way is to take out a write lock on the -D file,
70389 which is what Exim itself does, using <function>fcntl()</function>. If you update the file in
70390 place, the lock will be retained. If you write a new file and rename it, the
70391 lock will be lost at the instant of rename.
70392 </para>
70393 </listitem>
70394 <listitem>
70395 <para>
70396 <indexterm role="variable">
70397 <primary><varname>$body_linecount</varname></primary>
70398 </indexterm>
70399 If you change the number of lines in the file, the value of
70400 <varname>$body_linecount</varname>, which is stored in the -H file, will be incorrect and can
70401 cause incomplete transmission of messages or undeliverable messages.
70402 </para>
70403 </listitem>
70404 <listitem>
70405 <para>
70406 If the message is in MIME format, you must take care not to break it.
70407 </para>
70408 </listitem>
70409 <listitem>
70410 <para>
70411 If the message is cryptographically signed, any change will invalidate the
70412 signature.
70413 </para>
70414 </listitem>
70415 </itemizedlist>
70416 <para>
70417 All in all, modifying -D files is fraught with danger.
70418 </para>
70419 <para>
70420 Files whose names end with -J may also be seen in the <filename>input</filename> directory (or
70421 its subdirectories when <option>split_spool_directory</option> is set). These are journal
70422 files, used to record addresses to which the message has been delivered during
70423 the course of a delivery attempt. If there are still undelivered recipients at
70424 the end, the -H file is updated, and the -J file is deleted. If, however, there
70425 is some kind of crash (for example, a power outage) before this happens, the -J
70426 file remains in existence. When Exim next processes the message, it notices the
70427 -J file and uses it to update the -H file before starting the next delivery
70428 attempt.
70429 </para>
70430 <para>
70431 Files whose names end with -K or .eml may also be seen in the spool.
70432 These are temporaries used for DKIM or malware processing, when that is used.
70433 They should be tidied up by normal operations; any old ones are probably
70434 relics of crashes and can be removed.
70435 </para>
70436 <section id="SECID282">
70437 <title>Format of the -H file</title>
70438 <para>
70439 <indexterm role="concept">
70440 <primary>uid (user id)</primary>
70441 <secondary>in spool file</secondary>
70442 </indexterm>
70443 <indexterm role="concept">
70444 <primary>gid (group id)</primary>
70445 <secondary>in spool file</secondary>
70446 </indexterm>
70447 The second line of the -H file contains the login name for the uid of the
70448 process that called Exim to read the message, followed by the numerical uid and
70449 gid. For a locally generated message, this is normally the user who sent the
70450 message. For a message received over TCP/IP via the daemon, it is
70451 normally the Exim user.
70452 </para>
70453 <para>
70454 The third line of the file contains the address of the message&#x2019;s sender as
70455 transmitted in the envelope, contained in angle brackets. The sender address is
70456 empty for bounce messages. For incoming SMTP mail, the sender address is given
70457 in the MAIL command. For locally generated mail, the sender address is
70458 created by Exim from the login name of the current user and the configured
70459 <option>qualify_domain</option>. However, this can be overridden by the <option>-f</option> option or a
70460 leading <quote>From&nbsp;</quote> line if the caller is trusted, or if the supplied address is
70461 <quote>&lt;&gt;</quote> or an address that matches <option>untrusted_set_senders</option>.
70462 </para>
70463 <para>
70464 The fourth line contains two numbers. The first is the time that the message
70465 was received, in the conventional Unix form &ndash; the number of seconds since the
70466 start of the epoch. The second number is a count of the number of messages
70467 warning of delayed delivery that have been sent to the sender.
70468 </para>
70469 <para>
70470 There follow a number of lines starting with a hyphen. These can appear in any
70471 order, and are omitted when not relevant:
70472 </para>
70473 <variablelist>
70474 <varlistentry>
70475 <term><option>-acl</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
70476 <listitem>
70477 <para>
70478 This item is obsolete, and is not generated from Exim release 4.61 onwards;
70479 <option>-aclc</option> and <option>-aclm</option> are used instead. However, <option>-acl</option> is still
70480 recognized, to provide backward compatibility. In the old format, a line of
70481 this form is present for every ACL variable that is not empty. The number
70482 identifies the variable; the <option>acl_c</option><emphasis role="bold">x</emphasis> variables are numbered 0&ndash;9 and
70483 the <option>acl_m</option><emphasis role="bold">x</emphasis> variables are numbered 10&ndash;19. The length is the length of
70484 the data string for the variable. The string itself starts at the beginning of
70485 the next line, and is followed by a newline character. It may contain internal
70486 newlines.
70487 </para>
70488 </listitem></varlistentry>
70489 <varlistentry>
70490 <term><option>-aclc</option>&nbsp;&lt;<emphasis>rest-of-name</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
70491 <listitem>
70492 <para>
70493 A line of this form is present for every ACL connection variable that is
70494 defined. Note that there is a space between <option>-aclc</option> and the rest of the name.
70495 The length is the length of the data string for the variable. The string itself
70496 starts at the beginning of the next line, and is followed by a newline
70497 character. It may contain internal newlines.
70498 </para>
70499 </listitem></varlistentry>
70500 <varlistentry>
70501 <term><option>-aclm</option>&nbsp;&lt;<emphasis>rest-of-name</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
70502 <listitem>
70503 <para>
70504 A line of this form is present for every ACL message variable that is defined.
70505 Note that there is a space between <option>-aclm</option> and the rest of the name. The
70506 length is the length of the data string for the variable. The string itself
70507 starts at the beginning of the next line, and is followed by a newline
70508 character. It may contain internal newlines.
70509 </para>
70510 </listitem></varlistentry>
70511 <varlistentry>
70512 <term><option>-active_hostname</option>&nbsp;&lt;<emphasis>hostname</emphasis>&gt;</term>
70513 <listitem>
70514 <para>
70515 This is present if, when the message was received over SMTP, the value of
70516 <varname>$smtp_active_hostname</varname> was different to the value of <varname>$primary_hostname</varname>.
70517 </para>
70518 </listitem></varlistentry>
70519 <varlistentry>
70520 <term><option>-allow_unqualified_recipient</option></term>
70521 <listitem>
70522 <para>
70523 This is present if unqualified recipient addresses are permitted in header
70524 lines (to stop such addresses from being qualified if rewriting occurs at
70525 transport time). Local messages that were input using <option>-bnq</option> and remote
70526 messages from hosts that match <option>recipient_unqualified_hosts</option> set this flag.
70527 </para>
70528 </listitem></varlistentry>
70529 <varlistentry>
70530 <term><option>-allow_unqualified_sender</option></term>
70531 <listitem>
70532 <para>
70533 This is present if unqualified sender addresses are permitted in header lines
70534 (to stop such addresses from being qualified if rewriting occurs at transport
70535 time). Local messages that were input using <option>-bnq</option> and remote messages from
70536 hosts that match <option>sender_unqualified_hosts</option> set this flag.
70537 </para>
70538 </listitem></varlistentry>
70539 <varlistentry>
70540 <term><option>-auth_id</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
70541 <listitem>
70542 <para>
70543 The id information for a message received on an authenticated SMTP connection
70544 &ndash; the value of the <varname>$authenticated_id</varname> variable.
70545 </para>
70546 </listitem></varlistentry>
70547 <varlistentry>
70548 <term><option>-auth_sender</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
70549 <listitem>
70550 <para>
70551 The address of an authenticated sender &ndash; the value of the
70552 <varname>$authenticated_sender</varname> variable.
70553 </para>
70554 </listitem></varlistentry>
70555 <varlistentry>
70556 <term><option>-body_linecount</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
70557 <listitem>
70558 <para>
70559 This records the number of lines in the body of the message, and is
70560 present unless <option>-spool_file_wireformat</option> is.
70561 </para>
70562 </listitem></varlistentry>
70563 <varlistentry>
70564 <term><option>-body_zerocount</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
70565 <listitem>
70566 <para>
70567 This records the number of binary zero bytes in the body of the message, and is
70568 present if the number is greater than zero.
70569 </para>
70570 </listitem></varlistentry>
70571 <varlistentry>
70572 <term><option>-deliver_firsttime</option></term>
70573 <listitem>
70574 <para>
70575 This is written when a new message is first added to the spool. When the spool
70576 file is updated after a deferral, it is omitted.
70577 </para>
70578 </listitem></varlistentry>
70579 <varlistentry>
70580 <term><option>-frozen</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
70581 <listitem>
70582 <para>
70583 <indexterm role="concept">
70584 <primary>frozen messages</primary>
70585 <secondary>spool data</secondary>
70586 </indexterm>
70587 The message is frozen, and the freezing happened at &lt;<emphasis>time</emphasis>&gt;.
70588 </para>
70589 </listitem></varlistentry>
70590 <varlistentry>
70591 <term><option>-helo_name</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
70592 <listitem>
70593 <para>
70594 This records the host name as specified by a remote host in a HELO or EHLO
70595 command.
70596 </para>
70597 </listitem></varlistentry>
70598 <varlistentry>
70599 <term><option>-host_address</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;.&lt;<emphasis>port</emphasis>&gt;</term>
70600 <listitem>
70601 <para>
70602 This records the IP address of the host from which the message was received and
70603 the remote port number that was used. It is omitted for locally generated
70604 messages.
70605 </para>
70606 </listitem></varlistentry>
70607 <varlistentry>
70608 <term><option>-host_auth</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
70609 <listitem>
70610 <para>
70611 If the message was received on an authenticated SMTP connection, this records
70612 the name of the authenticator &ndash; the value of the
70613 <varname>$sender_host_authenticated</varname> variable.
70614 </para>
70615 </listitem></varlistentry>
70616 <varlistentry>
70617 <term><option>-host_lookup_failed</option></term>
70618 <listitem>
70619 <para>
70620 This is present if an attempt to look up the sending host&#x2019;s name from its IP
70621 address failed. It corresponds to the <varname>$host_lookup_failed</varname> variable.
70622 </para>
70623 </listitem></varlistentry>
70624 <varlistentry>
70625 <term><option>-host_name</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
70626 <listitem>
70627 <para>
70628 <indexterm role="concept">
70629 <primary>reverse DNS lookup</primary>
70630 </indexterm>
70631 <indexterm role="concept">
70632 <primary>DNS</primary>
70633 <secondary>reverse lookup</secondary>
70634 </indexterm>
70635 This records the name of the remote host from which the message was received,
70636 if the host name was looked up from the IP address when the message was being
70637 received. It is not present if no reverse lookup was done.
70638 </para>
70639 </listitem></varlistentry>
70640 <varlistentry>
70641 <term><option>-ident</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
70642 <listitem>
70643 <para>
70644 For locally submitted messages, this records the login of the originating user,
70645 unless it was a trusted user and the <option>-oMt</option> option was used to specify an
70646 ident value. For messages received over TCP/IP, this records the ident string
70647 supplied by the remote host, if any.
70648 </para>
70649 </listitem></varlistentry>
70650 <varlistentry>
70651 <term><option>-interface_address</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;.&lt;<emphasis>port</emphasis>&gt;</term>
70652 <listitem>
70653 <para>
70654 This records the IP address of the local interface and the port number through
70655 which a message was received from a remote host. It is omitted for locally
70656 generated messages.
70657 </para>
70658 </listitem></varlistentry>
70659 <varlistentry>
70660 <term><option>-local</option></term>
70661 <listitem>
70662 <para>
70663 The message is from a local sender.
70664 </para>
70665 </listitem></varlistentry>
70666 <varlistentry>
70667 <term><option>-localerror</option></term>
70668 <listitem>
70669 <para>
70670 The message is a locally-generated bounce message.
70671 </para>
70672 </listitem></varlistentry>
70673 <varlistentry>
70674 <term><option>-local_scan</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
70675 <listitem>
70676 <para>
70677 This records the data string that was returned by the <function>local_scan()</function> function
70678 when the message was received &ndash; the value of the <varname>$local_scan_data</varname>
70679 variable. It is omitted if no data was returned.
70680 </para>
70681 </listitem></varlistentry>
70682 <varlistentry>
70683 <term><option>-manual_thaw</option></term>
70684 <listitem>
70685 <para>
70686 The message was frozen but has been thawed manually, that is, by an explicit
70687 Exim command rather than via the auto-thaw process.
70688 </para>
70689 </listitem></varlistentry>
70690 <varlistentry>
70691 <term><option>-N</option></term>
70692 <listitem>
70693 <para>
70694 A testing delivery process was started using the <option>-N</option> option to suppress any
70695 actual deliveries, but delivery was deferred. At any further delivery attempts,
70696 <option>-N</option> is assumed.
70697 </para>
70698 </listitem></varlistentry>
70699 <varlistentry>
70700 <term><option>-received_protocol</option></term>
70701 <listitem>
70702 <para>
70703 This records the value of the <varname>$received_protocol</varname> variable, which contains
70704 the name of the protocol by which the message was received.
70705 </para>
70706 </listitem></varlistentry>
70707 <varlistentry>
70708 <term><option>-sender_set_untrusted</option></term>
70709 <listitem>
70710 <para>
70711 The envelope sender of this message was set by an untrusted local caller (used
70712 to ensure that the caller is displayed in queue listings).
70713 </para>
70714 </listitem></varlistentry>
70715 <varlistentry>
70716 <term><option>-spam_score_int</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
70717 <listitem>
70718 <para>
70719 If a message was scanned by SpamAssassin, this is present. It records the value
70720 of <varname>$spam_score_int</varname>.
70721 </para>
70722 </listitem></varlistentry>
70723 <varlistentry>
70724 <term><option>-spool_file_wireformat</option></term>
70725 <listitem>
70726 <para>
70727 The -D file for this message is in wire-format (for ESMTP CHUNKING)
70728 rather than Unix-format.
70729 The line-ending is CRLF rather than newline.
70730 There is still, however, no leading-dot-stuffing.
70731 </para>
70732 </listitem></varlistentry>
70733 <varlistentry>
70734 <term><option>-tls_certificate_verified</option></term>
70735 <listitem>
70736 <para>
70737 A TLS certificate was received from the client that sent this message, and the
70738 certificate was verified by the server.
70739 </para>
70740 </listitem></varlistentry>
70741 <varlistentry>
70742 <term><option>-tls_cipher</option>&nbsp;&lt;<emphasis>cipher name</emphasis>&gt;</term>
70743 <listitem>
70744 <para>
70745 When the message was received over an encrypted connection, this records the
70746 name of the cipher suite that was used.
70747 </para>
70748 </listitem></varlistentry>
70749 <varlistentry>
70750 <term><option>-tls_peerdn</option>&nbsp;&lt;<emphasis>peer DN</emphasis>&gt;</term>
70751 <listitem>
70752 <para>
70753 When the message was received over an encrypted connection, and a certificate
70754 was received from the client, this records the Distinguished Name from that
70755 certificate.
70756 </para>
70757 </listitem></varlistentry>
70758 </variablelist>
70759 <para>
70760 Following the options there is a list of those addresses to which the message
70761 is not to be delivered. This set of addresses is initialized from the command
70762 line when the <option>-t</option> option is used and <option>extract_addresses_remove_arguments</option>
70763 is set; otherwise it starts out empty. Whenever a successful delivery is made,
70764 the address is added to this set. The addresses are kept internally as a
70765 balanced binary tree, and it is a representation of that tree which is written
70766 to the spool file. If an address is expanded via an alias or forward file, the
70767 original address is added to the tree when deliveries to all its child
70768 addresses are complete.
70769 </para>
70770 <para>
70771 If the tree is empty, there is a single line in the spool file containing just
70772 the text <quote>XX</quote>. Otherwise, each line consists of two letters, which are either
70773 Y or N, followed by an address. The address is the value for the node of the
70774 tree, and the letters indicate whether the node has a left branch and/or a
70775 right branch attached to it, respectively. If branches exist, they immediately
70776 follow. Here is an example of a three-node tree:
70777 </para>
70778 <literallayout class="monospaced">
70779 YY darcy@austen.fict.example
70780 NN alice@wonderland.fict.example
70781 NN editor@thesaurus.ref.example
70782 </literallayout>
70783 <para>
70784 After the non-recipients tree, there is a list of the message&#x2019;s recipients.
70785 This is a simple list, preceded by a count. It includes all the original
70786 recipients of the message, including those to whom the message has already been
70787 delivered. In the simplest case, the list contains one address per line. For
70788 example:
70789 </para>
70790 <literallayout class="monospaced">
70791 4
70792 editor@thesaurus.ref.example
70793 darcy@austen.fict.example
70794 rdo@foundation
70795 alice@wonderland.fict.example
70796 </literallayout>
70797 <para>
70798 However, when a child address has been added to the top-level addresses as a
70799 result of the use of the <option>one_time</option> option on a <command>redirect</command> router, each
70800 line is of the following form:
70801 </para>
70802 <literallayout>
70803 &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;
70804 </literallayout>
70805 <para>
70806 The 01 flag bit indicates the presence of the three other fields that follow
70807 the top-level address. Other bits may be used in future to support additional
70808 fields. The &lt;<emphasis>parent number</emphasis>&gt; is the offset in the recipients list of the
70809 original parent of the <quote>one time</quote> address. The first two fields are the
70810 envelope sender that is associated with this address and its length. If the
70811 length is zero, there is no special envelope sender (there are then two space
70812 characters in the line). A non-empty field can arise from a <command>redirect</command> router
70813 that has an <option>errors_to</option> setting.
70814 </para>
70815 <para>
70816 A blank line separates the envelope and status information from the headers
70817 which follow. A header may occupy several lines of the file, and to save effort
70818 when reading it in, each header is preceded by a number and an identifying
70819 character. The number is the number of characters in the header, including any
70820 embedded newlines and the terminating newline. The character is one of the
70821 following:
70822 </para>
70823 <informaltable frame="none">
70824 <tgroup cols="2" colsep="0" rowsep="0">
70825 <colspec colwidth="50pt" align="left"/>
70826 <colspec colwidth="254pt" align="left"/>
70827 <tbody>
70828 <row>
70829 <entry>&lt;<emphasis>blank</emphasis>&gt;</entry>
70830 <entry>header in which Exim has no special interest</entry>
70831 </row>
70832 <row>
70833 <entry><literal>B</literal></entry>
70834 <entry><emphasis>Bcc:</emphasis> header</entry>
70835 </row>
70836 <row>
70837 <entry><literal>C</literal></entry>
70838 <entry><emphasis>Cc:</emphasis> header</entry>
70839 </row>
70840 <row>
70841 <entry><literal>F</literal></entry>
70842 <entry><emphasis>From:</emphasis> header</entry>
70843 </row>
70844 <row>
70845 <entry><literal>I</literal></entry>
70846 <entry><emphasis>Message-id:</emphasis> header</entry>
70847 </row>
70848 <row>
70849 <entry><literal>P</literal></entry>
70850 <entry><emphasis>Received:</emphasis> header &ndash; P for <quote>postmark</quote></entry>
70851 </row>
70852 <row>
70853 <entry><literal>R</literal></entry>
70854 <entry><emphasis>Reply-To:</emphasis> header</entry>
70855 </row>
70856 <row>
70857 <entry><literal>S</literal></entry>
70858 <entry><emphasis>Sender:</emphasis> header</entry>
70859 </row>
70860 <row>
70861 <entry><literal>T</literal></entry>
70862 <entry><emphasis>To:</emphasis> header</entry>
70863 </row>
70864 <row>
70865 <entry><literal>*</literal></entry>
70866 <entry>replaced or deleted header</entry>
70867 </row>
70868 </tbody>
70869 </tgroup>
70870 </informaltable>
70871 <para>
70872 Deleted or replaced (rewritten) headers remain in the spool file for debugging
70873 purposes. They are not transmitted when the message is delivered. Here is a
70874 typical set of headers:
70875 </para>
70876 <literallayout class="monospaced">
70877 111P Received: by hobbit.fict.example with local (Exim 4.00)
70878 id 14y9EI-00026G-00; Fri, 11 May 2001 10:28:59 +0100
70879 049  Message-Id: &lt;E14y9EI-00026G-00@hobbit.fict.example&gt;
70880 038* X-rewrote-sender: bb@hobbit.fict.example
70881 042* From: Bilbo Baggins &lt;bb@hobbit.fict.example&gt;
70882 049F From: Bilbo Baggins &lt;B.Baggins@hobbit.fict.example&gt;
70883 099* To: alice@wonderland.fict.example, rdo@foundation,
70884 darcy@austen.fict.example, editor@thesaurus.ref.example
70885 104T To: alice@wonderland.fict.example, rdo@foundation.example,
70886 darcy@austen.fict.example, editor@thesaurus.ref.example
70887 038  Date: Fri, 11 May 2001 10:28:59 +0100
70888 </literallayout>
70889 <para>
70890 The asterisked headers indicate that the envelope sender, <emphasis>From:</emphasis> header, and
70891 <emphasis>To:</emphasis> header have been rewritten, the last one because routing expanded the
70892 unqualified domain <emphasis>foundation</emphasis>.
70893 <indexterm role="concept" startref="IIDforspo1" class="endofrange"/>
70894 <indexterm role="concept" startref="IIDforspo2" class="endofrange"/>
70895 <indexterm role="concept" startref="IIDforspo3" class="endofrange"/>
70896 </para>
70897 </section>
70898 <section id="SECID282a">
70899 <title>Format of the -D file</title>
70900 <para>
70901 The data file is traditionally in Unix-standard format: lines are ended with
70902 an ASCII newline character.
70903 However, when the <option>spool_wireformat</option> main option is used some -D files
70904 can have an alternate format.
70905 This is flagged by a <option>-spool_file_wireformat</option> line in the corresponding -H file.
70906 The -D file lines (not including the first name-component line) are
70907 suitable for direct copying to the wire when transmitting using the
70908 ESMTP CHUNKING option, meaning lower processing overhead.
70909 Lines are terminated with an ASCII CRLF pair.
70910 There is no dot-stuffing (and no dot-termination).
70911 </para>
70912 </section>
70913 </chapter>
70914
70915 <chapter id="CHAPdkim">
70916 <title>DKIM and SPF</title>
70917 <titleabbrev>DKIM and SPF Support</titleabbrev>
70918 <para>
70919 <indexterm role="concept">
70920 <primary>DKIM</primary>
70921 </indexterm>
70922 </para>
70923 <section id="SECDKIM">
70924 <title>DKIM (DomainKeys Identified Mail)</title>
70925 <para>
70926 DKIM is a mechanism by which messages sent by some entity can be provably
70927 linked to a domain which that entity controls.  It permits reputation to
70928 be tracked on a per-domain basis, rather than merely upon source IP address.
70929 DKIM is documented in RFC 6376.
70930 </para>
70931 <para>
70932 As DKIM relies on the message being unchanged in transit, messages handled
70933 by a mailing-list (which traditionally adds to the message) will not match
70934 any original DKIM signature.
70935 </para>
70936 <para>
70937 DKIM support is compiled into Exim by default if TLS support is present.
70938 It can be disabled by setting DISABLE_DKIM=yes in <filename>Local/Makefile</filename>.
70939 </para>
70940 <para>
70941 Exim&#x2019;s DKIM implementation allows for
70942 </para>
70943 <orderedlist numeration="arabic">
70944 <listitem>
70945 <para>
70946 Signing outgoing messages: This function is implemented in the SMTP transport.
70947 It can co-exist with all other Exim features
70948 (including transport filters)
70949 except cutthrough delivery.
70950 </para>
70951 </listitem>
70952 <listitem>
70953 <para>
70954 Verifying signatures in incoming messages: This is implemented by an additional
70955 ACL (acl_smtp_dkim), which can be called several times per message, with
70956 different signature contexts.
70957 </para>
70958 </listitem>
70959 </orderedlist>
70960 <para>
70961 In typical Exim style, the verification implementation does not include any
70962 default "policy". Instead it enables you to build your own policy using
70963 Exim&#x2019;s standard controls.
70964 </para>
70965 <para>
70966 Please note that verification of DKIM signatures in incoming mail is turned
70967 on by default for logging (in the &lt;= line) purposes.
70968 </para>
70969 <para>
70970 Additional log detail can be enabled using the <option>dkim_verbose</option> log_selector.
70971 When set, for each signature in incoming email,
70972 exim will log a line displaying the most important signature details, and the
70973 signature status. Here is an example (with line-breaks added for clarity):
70974 </para>
70975 <literallayout class="monospaced">
70976 2009-09-09 10:22:28 1MlIRf-0003LU-U3 DKIM:
70977     d=facebookmail.com s=q1-2009b
70978     c=relaxed/relaxed a=rsa-sha1
70979     i=@facebookmail.com t=1252484542 [verification succeeded]
70980 </literallayout>
70981 <para>
70982 You might want to turn off DKIM verification processing entirely for internal
70983 or relay mail sources. To do that, set the <option>dkim_disable_verify</option> ACL
70984 control modifier. This should typically be done in the RCPT ACL, at points
70985 where you accept mail from relay sources (internal hosts or authenticated
70986 senders).
70987 </para>
70988 </section>
70989 <section id="SECDKIMSIGN">
70990 <title>Signing outgoing messages</title>
70991 <para>
70992 <indexterm role="concept">
70993 <primary>DKIM</primary>
70994 <secondary>signing</secondary>
70995 </indexterm>
70996 </para>
70997 <para>
70998 For signing to be usable you must have published a DKIM record in DNS.
70999 Note that RFC 8301 says:
71000 </para>
71001 <literallayout class="monospaced">
71002 rsa-sha1 MUST NOT be used for signing or verifying.
71003
71004 Signers MUST use RSA keys of at least 1024 bits for all keys.
71005 Signers SHOULD use RSA keys of at least 2048 bits.
71006 </literallayout>
71007 <para>
71008 Note also that the key content (the &#x2019;p=&#x2019; field)
71009 in the DNS record is different between RSA and EC keys;
71010 for the former it is the base64 of the ASN.1 for the RSA public key
71011 (equivalent to the private-key .pem with the header/trailer stripped)
71012 but for EC keys it is the base64 of the pure key; no ASN.1 wrapping.
71013 </para>
71014 <para>
71015 Signing is enabled by setting private options on the SMTP transport.
71016 These options take (expandable) strings as arguments.
71017 </para>
71018 <para>
71019 <indexterm role="option">
71020 <primary><option>unset</option></primary>
71021 </indexterm>
71022 </para>
71023 <informaltable frame="all">
71024 <tgroup cols="4" colsep="0" rowsep="0">
71025 <colspec colwidth="8*" align="left"/>
71026 <colspec colwidth="6*" align="center"/>
71027 <colspec colwidth="6*" align="center"/>
71028 <colspec colwidth="6*" align="right"/>
71029 <tbody>
71030 <row>
71031 <entry><option>dkim_domain</option></entry>
71032 <entry>Use: <emphasis>smtp</emphasis></entry>
71033 <entry>Type: <emphasis>string</emphasis></entry>
71034 <entry>Default: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
71035 </row>
71036 </tbody>
71037 </tgroup>
71038 </informaltable>
71039 <para>
71040 The domain(s) you want to sign with.
71041 After expansion, this can be a list.
71042 Each element in turn is put into the <option>$dkim_domain</option> expansion variable
71043 while expanding the remaining signing options.
71044 If it is empty after expansion, DKIM signing is not done,
71045 and no error will result even if <option>dkim_strict</option> is set.
71046 </para>
71047 <para>
71048 <indexterm role="option">
71049 <primary><option>unset</option></primary>
71050 </indexterm>
71051 </para>
71052 <informaltable frame="all">
71053 <tgroup cols="4" colsep="0" rowsep="0">
71054 <colspec colwidth="8*" align="left"/>
71055 <colspec colwidth="6*" align="center"/>
71056 <colspec colwidth="6*" align="center"/>
71057 <colspec colwidth="6*" align="right"/>
71058 <tbody>
71059 <row>
71060 <entry><option>dkim_selector</option></entry>
71061 <entry>Use: <emphasis>smtp</emphasis></entry>
71062 <entry>Type: <emphasis>string</emphasis></entry>
71063 <entry>Default: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
71064 </row>
71065 </tbody>
71066 </tgroup>
71067 </informaltable>
71068 <para>
71069 This sets the key selector string.
71070 After expansion, which can use <varname>$dkim_domain</varname>, this can be a list.
71071 Each element in turn is put in the expansion
71072 variable <option>$dkim_selector</option> which may be used in the <option>dkim_private_key</option>
71073 option along with <option>$dkim_domain</option>.
71074 If the option is empty after expansion, DKIM signing is not done for this domain,
71075 and no error will result even if <option>dkim_strict</option> is set.
71076 </para>
71077 <para>
71078 <indexterm role="option">
71079 <primary><option>dkim_private_key</option></primary>
71080 </indexterm>
71081 </para>
71082 <informaltable frame="all">
71083 <tgroup cols="4" colsep="0" rowsep="0">
71084 <colspec colwidth="8*" align="left"/>
71085 <colspec colwidth="6*" align="center"/>
71086 <colspec colwidth="6*" align="center"/>
71087 <colspec colwidth="6*" align="right"/>
71088 <tbody>
71089 <row>
71090 <entry><option>dkim_private_key</option></entry>
71091 <entry>Use: <emphasis>smtp</emphasis></entry>
71092 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
71093 <entry>Default: <emphasis>unset</emphasis></entry>
71094 </row>
71095 </tbody>
71096 </tgroup>
71097 </informaltable>
71098 <para>
71099 This sets the private key to use.
71100 You can use the <option>$dkim_domain</option> and
71101 <option>$dkim_selector</option> expansion variables to determine the private key to use.
71102 The result can either
71103 </para>
71104 <itemizedlist>
71105 <listitem>
71106 <para>
71107 be a valid RSA private key in ASCII armor (.pem file), including line breaks
71108 </para>
71109 </listitem>
71110 <listitem>
71111 <para>
71112 with GnuTLS 3.6.0 or OpenSSL 1.1.1 or later,
71113 be a valid Ed25519 private key (same format as above)
71114 </para>
71115 </listitem>
71116 <listitem>
71117 <para>
71118 start with a slash, in which case it is treated as a file that contains
71119 the private key
71120 </para>
71121 </listitem>
71122 <listitem>
71123 <para>
71124 be "0", "false" or the empty string, in which case the message will not
71125 be signed. This case will not result in an error, even if <option>dkim_strict</option>
71126 is set.
71127 </para>
71128 </listitem>
71129 </itemizedlist>
71130 <para>
71131 To generate keys under OpenSSL:
71132 </para>
71133 <literallayout class="monospaced">
71134 openssl genrsa -out dkim_rsa.private 2048
71135 openssl rsa -in dkim_rsa.private -out /dev/stdout -pubout -outform PEM
71136 </literallayout>
71137 <para>
71138 Take the base-64 lines from the output of the second command, concatenated,
71139 for the DNS TXT record.
71140 See section 3.6 of RFC6376 for the record specification.
71141 </para>
71142 <para>
71143 Under GnuTLS:
71144 </para>
71145 <literallayout class="monospaced">
71146 certtool --generate-privkey --rsa --bits=2048 --password='' -8 --outfile=dkim_rsa.private
71147 certtool --load-privkey=dkim_rsa.private --pubkey-info
71148 </literallayout>
71149 <para>
71150 Note that RFC 8301 says:
71151 </para>
71152 <literallayout class="monospaced">
71153 Signers MUST use RSA keys of at least 1024 bits for all keys.
71154 Signers SHOULD use RSA keys of at least 2048 bits.
71155 </literallayout>
71156 <para>
71157 Support for EC keys is being developed under
71158 <emphasis role="bold"><ulink url="https://datatracker.ietf.org/doc/draft-ietf-dcrup-dkim-crypto/">https://datatracker.ietf.org/doc/draft-ietf-dcrup-dkim-crypto/</ulink></emphasis>.
71159 They are considerably smaller than RSA keys for equivalent protection.
71160 As they are a recent development, users should consider dual-signing
71161 (by setting a list of selectors, and an expansion for this option)
71162 for some transition period.
71163 The "_CRYPTO_SIGN_ED25519" macro will be defined if support is present
71164 for EC keys.
71165 </para>
71166 <para>
71167 OpenSSL 1.1.1 and GnuTLS 3.6.0 can create Ed25519 private keys:
71168 </para>
71169 <literallayout class="monospaced">
71170 openssl genpkey -algorithm ed25519 -out dkim_ed25519.private
71171 certtool --generate-privkey --key-type=ed25519 --outfile=dkim_ed25519.private
71172 </literallayout>
71173 <para>
71174 To produce the required public key value for a DNS record:
71175 </para>
71176 <literallayout class="monospaced">
71177 openssl pkey -outform DER -pubout -in dkim_ed25519.private | tail -c +13 | base64
71178 certtool --load_privkey=dkim_ed25519.private --pubkey_info --outder | tail -c +13 | base64
71179 </literallayout>
71180 <para>
71181 Note that the format
71182 of Ed25519 keys in DNS has not yet been decided; this release supports
71183 both of the leading candidates at this time, a future release will
71184 probably drop support for whichever proposal loses.
71185 </para>
71186 <para>
71187 <indexterm role="option">
71188 <primary><option>dkim_hash</option></primary>
71189 </indexterm>
71190 </para>
71191 <informaltable frame="all">
71192 <tgroup cols="4" colsep="0" rowsep="0">
71193 <colspec colwidth="8*" align="left"/>
71194 <colspec colwidth="6*" align="center"/>
71195 <colspec colwidth="6*" align="center"/>
71196 <colspec colwidth="6*" align="right"/>
71197 <tbody>
71198 <row>
71199 <entry><option>dkim_hash</option></entry>
71200 <entry>Use: <emphasis>smtp</emphasis></entry>
71201 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
71202 <entry>Default: <emphasis>sha256</emphasis></entry>
71203 </row>
71204 </tbody>
71205 </tgroup>
71206 </informaltable>
71207 <para>
71208 Can be set to any one of the supported hash methods, which are:
71209 </para>
71210 <itemizedlist>
71211 <listitem>
71212 <para>
71213 <literal>sha1</literal> &ndash; should not be used, is old and insecure
71214 </para>
71215 </listitem>
71216 <listitem>
71217 <para>
71218 <literal>sha256</literal> &ndash; the default
71219 </para>
71220 </listitem>
71221 <listitem>
71222 <para>
71223 <literal>sha512</literal> &ndash; possibly more secure but less well supported
71224 </para>
71225 </listitem>
71226 </itemizedlist>
71227 <para>
71228 Note that RFC 8301 says:
71229 </para>
71230 <literallayout class="monospaced">
71231 rsa-sha1 MUST NOT be used for signing or verifying.
71232 </literallayout>
71233 <para>
71234 <indexterm role="option">
71235 <primary><option>dkim_identity</option></primary>
71236 </indexterm>
71237 </para>
71238 <informaltable frame="all">
71239 <tgroup cols="4" colsep="0" rowsep="0">
71240 <colspec colwidth="8*" align="left"/>
71241 <colspec colwidth="6*" align="center"/>
71242 <colspec colwidth="6*" align="center"/>
71243 <colspec colwidth="6*" align="right"/>
71244 <tbody>
71245 <row>
71246 <entry><option>dkim_identity</option></entry>
71247 <entry>Use: <emphasis>smtp</emphasis></entry>
71248 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
71249 <entry>Default: <emphasis>unset</emphasis></entry>
71250 </row>
71251 </tbody>
71252 </tgroup>
71253 </informaltable>
71254 <para>
71255 If set after expansion, the value is used to set an "i=" tag in
71256 the signing header.  The DKIM standards restrict the permissible
71257 syntax of this optional tag to a mail address, with possibly-empty
71258 local part, an @, and a domain identical to or subdomain of the "d="
71259 tag value.  Note that Exim does not check the value.
71260 </para>
71261 <para>
71262 <indexterm role="option">
71263 <primary><option>dkim_canon</option></primary>
71264 </indexterm>
71265 </para>
71266 <informaltable frame="all">
71267 <tgroup cols="4" colsep="0" rowsep="0">
71268 <colspec colwidth="8*" align="left"/>
71269 <colspec colwidth="6*" align="center"/>
71270 <colspec colwidth="6*" align="center"/>
71271 <colspec colwidth="6*" align="right"/>
71272 <tbody>
71273 <row>
71274 <entry><option>dkim_canon</option></entry>
71275 <entry>Use: <emphasis>smtp</emphasis></entry>
71276 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
71277 <entry>Default: <emphasis>unset</emphasis></entry>
71278 </row>
71279 </tbody>
71280 </tgroup>
71281 </informaltable>
71282 <para>
71283 This option sets the canonicalization method used when signing a message.
71284 The DKIM RFC currently supports two methods: "simple" and "relaxed".
71285 The option defaults to "relaxed" when unset. Note: the current implementation
71286 only supports signing with the same canonicalization method for both headers and body.
71287 </para>
71288 <para>
71289 <indexterm role="option">
71290 <primary><option>dkim_strict</option></primary>
71291 </indexterm>
71292 </para>
71293 <informaltable frame="all">
71294 <tgroup cols="4" colsep="0" rowsep="0">
71295 <colspec colwidth="8*" align="left"/>
71296 <colspec colwidth="6*" align="center"/>
71297 <colspec colwidth="6*" align="center"/>
71298 <colspec colwidth="6*" align="right"/>
71299 <tbody>
71300 <row>
71301 <entry><option>dkim_strict</option></entry>
71302 <entry>Use: <emphasis>smtp</emphasis></entry>
71303 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
71304 <entry>Default: <emphasis>unset</emphasis></entry>
71305 </row>
71306 </tbody>
71307 </tgroup>
71308 </informaltable>
71309 <para>
71310 This  option  defines  how  Exim  behaves  when  signing a message that
71311 should be signed fails for some reason.  When the expansion evaluates to
71312 either "1" or "true", Exim will defer. Otherwise Exim will send the message
71313 unsigned. You can use the <option>$dkim_domain</option> and <option>$dkim_selector</option> expansion
71314 variables here.
71315 </para>
71316 <para>
71317 <indexterm role="option">
71318 <primary><option>dkim_sign_headers</option></primary>
71319 </indexterm>
71320 </para>
71321 <informaltable frame="all">
71322 <tgroup cols="4" colsep="0" rowsep="0">
71323 <colspec colwidth="8*" align="left"/>
71324 <colspec colwidth="6*" align="center"/>
71325 <colspec colwidth="6*" align="center"/>
71326 <colspec colwidth="6*" align="right"/>
71327 <tbody>
71328 <row>
71329 <entry><option>dkim_sign_headers</option></entry>
71330 <entry>Use: <emphasis>smtp</emphasis></entry>
71331 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
71332 <entry>Default: <emphasis>see below</emphasis></entry>
71333 </row>
71334 </tbody>
71335 </tgroup>
71336 </informaltable>
71337 <para>
71338 If set, this option must expand to a colon-separated
71339 list of header names.
71340 Headers with these names, or the absence or such a header, will be included
71341 in the message signature.
71342 When unspecified, the header names listed in RFC4871 will be used,
71343 whether or not each header is present in the message.
71344 The default list is available for the expansion in the macro
71345 "_DKIM_SIGN_HEADERS".
71346 </para>
71347 <para>
71348 If a name is repeated, multiple headers by that name (or the absence thereof)
71349 will be signed.  The textually later headers in the headers part of the
71350 message are signed first, if there are multiples.
71351 </para>
71352 <para>
71353 A name can be prefixed with either an &#x2019;=&#x2019; or a &#x2019;+&#x2019; character.
71354 If an &#x2019;=&#x2019; prefix is used, all headers that are present with this name
71355 will be signed.
71356 If a &#x2019;+&#x2019; prefix if used, all headers that are present with this name
71357 will be signed, and one signature added for a missing header with the
71358 name will be appended.
71359 </para>
71360 <para revisionflag="changed">
71361 <indexterm role="option">
71362 <primary><option>dkim_timestamps</option></primary>
71363 </indexterm>
71364 </para>
71365 <informaltable frame="all" revisionflag="changed">
71366 <tgroup cols="4" colsep="0" rowsep="0">
71367 <colspec colwidth="8*" align="left"/>
71368 <colspec colwidth="6*" align="center"/>
71369 <colspec colwidth="6*" align="center"/>
71370 <colspec colwidth="6*" align="right"/>
71371 <tbody>
71372 <row>
71373 <entry><option>dkim_timestamps</option></entry>
71374 <entry>Use: <emphasis>smtp</emphasis></entry>
71375 <entry>Type: <emphasis>integer</emphasis>&dagger;<emphasis></emphasis></entry>
71376 <entry>Default: <emphasis>unset</emphasis></entry>
71377 </row>
71378 </tbody>
71379 </tgroup>
71380 </informaltable>
71381 <para revisionflag="changed">
71382 This option controls the inclusion of timestamp information in the signature.
71383 If not set, no such information will be included.
71384 Otherwise, must be an unsigned number giving an offset in seconds from the current time
71385 for the expiry tag
71386 (eg. 1209600 for two weeks);
71387 both creation (t=) and expiry (x=) tags will be included.
71388 </para>
71389 <para revisionflag="changed">
71390 RFC 6376 lists these tags as RECOMMENDED.
71391 </para>
71392 </section>
71393 <section id="SECDKIMVFY">
71394 <title>Verifying DKIM signatures in incoming mail</title>
71395 <para>
71396 <indexterm role="concept">
71397 <primary>DKIM</primary>
71398 <secondary>verification</secondary>
71399 </indexterm>
71400 </para>
71401 <para revisionflag="changed">
71402 Verification of DKIM signatures in SMTP incoming email is done for all
71403 messages for which an ACL control <option>dkim_disable_verify</option> has not been set.
71404 <indexterm role="concept">
71405 <primary>authentication</primary>
71406 <secondary>expansion item</secondary>
71407 </indexterm>
71408 Performing verification sets up information used by the
71409 <varname>$authresults</varname> expansion item.
71410 </para>
71411 <para>
71412 <phrase revisionflag="changed">The</phrase>
71413 <option>acl_smtp_dkim</option> ACL, <phrase revisionflag="changed">which can examine and modify them</phrase>.
71414 By default, this ACL is called once for each
71415 syntactically(!) correct signature in the incoming message.
71416 A missing ACL definition defaults to accept.
71417 If any ACL call does not accept, the message is not accepted.
71418 If a cutthrough delivery was in progress for the message, that is
71419 summarily dropped (having wasted the transmission effort).
71420 </para>
71421 <para>
71422 To evaluate the <phrase revisionflag="changed">verification result</phrase> in the ACL
71423 a large number of expansion variables
71424 containing the signature status and its details are set up during the
71425 runtime of the ACL.
71426 </para>
71427 <para>
71428 Calling the ACL only for existing signatures is not sufficient to build
71429 more advanced policies. For that reason, the global option
71430 <option>dkim_verify_signers</option>, and a global expansion variable
71431 <option>$dkim_signers</option> exist.
71432 </para>
71433 <para>
71434 The global option <option>dkim_verify_signers</option> can be set to a colon-separated
71435 list of DKIM domains or identities for which the ACL <option>acl_smtp_dkim</option> is
71436 called. It is expanded when the message has been received. At this point,
71437 the expansion variable <option>$dkim_signers</option> already contains a colon-separated
71438 list of signer domains and identities for the message. When
71439 <option>dkim_verify_signers</option> is not specified in the main configuration,
71440 it defaults as:
71441 </para>
71442 <literallayout class="monospaced">
71443 dkim_verify_signers = $dkim_signers
71444 </literallayout>
71445 <para>
71446 This leads to the default behaviour of calling <option>acl_smtp_dkim</option> for each
71447 DKIM signature in the message. Current DKIM verifiers may want to explicitly
71448 call the ACL for known domains or identities. This would be achieved as follows:
71449 </para>
71450 <literallayout class="monospaced">
71451 dkim_verify_signers = paypal.com:ebay.com:$dkim_signers
71452 </literallayout>
71453 <para>
71454 This would result in <option>acl_smtp_dkim</option> always being called for "paypal.com"
71455 and "ebay.com", plus all domains and identities that have signatures in the message.
71456 You can also be more creative in constructing your policy. For example:
71457 </para>
71458 <literallayout class="monospaced">
71459 dkim_verify_signers = $sender_address_domain:$dkim_signers
71460 </literallayout>
71461 <para>
71462 If a domain or identity is listed several times in the (expanded) value of
71463 <option>dkim_verify_signers</option>, the ACL is only called once for that domain or identity.
71464 </para>
71465 <para>
71466 If multiple signatures match a domain (or identity), the ACL is called once
71467 for each matching signature.
71468 </para>
71469 <para>
71470 Inside the <option>acl_smtp_dkim</option>, the following expansion variables are
71471 available (from most to least important):
71472 </para>
71473 <variablelist>
71474 <varlistentry>
71475 <term><option>$dkim_cur_signer</option></term>
71476 <listitem>
71477 <para>
71478 The signer that is being evaluated in this ACL run. This can be a domain or
71479 an identity. This is one of the list items from the expanded main option
71480 <option>dkim_verify_signers</option> (see above).
71481 </para>
71482 </listitem></varlistentry>
71483 <varlistentry>
71484 <term><option>$dkim_verify_status</option></term>
71485 <listitem>
71486 <para>
71487 Within the DKIM ACL,
71488 a string describing the general status of the signature. One of
71489 </para>
71490 <itemizedlist>
71491 <listitem>
71492 <para>
71493 <option>none</option>: There is no signature in the message for the current domain or
71494 identity (as reflected by <option>$dkim_cur_signer</option>).
71495 </para>
71496 </listitem>
71497 <listitem>
71498 <para>
71499 <option>invalid</option>: The signature could not be verified due to a processing error.
71500 More detail is available in <option>$dkim_verify_reason</option>.
71501 </para>
71502 </listitem>
71503 <listitem>
71504 <para>
71505 <option>fail</option>: Verification of the signature failed.  More detail is
71506 available in <option>$dkim_verify_reason</option>.
71507 </para>
71508 </listitem>
71509 <listitem>
71510 <para>
71511 <option>pass</option>: The signature passed verification. It is valid.
71512 </para>
71513 </listitem>
71514 </itemizedlist>
71515 <para>
71516 This variable can be overwritten using an ACL &#x2019;set&#x2019; modifier.
71517 This might, for instance, be done to enforce a policy restriction on
71518 hash-method or key-size:
71519 </para>
71520 <literallayout class="monospaced">
71521   warn condition       = ${if eq {$dkim_verify_status}{pass}}
71522        condition       = ${if eq {${length_3:$dkim_algo}}{rsa}}
71523        condition       = ${if or {{eq {$dkim_algo}{rsa-sha1}} \
71524                                   {&lt; {$dkim_key_length}{1024}}}}
71525        logwrite        = NOTE: forcing DKIM verify fail (was pass)
71526        set dkim_verify_status = fail
71527        set dkim_verify_reason = hash too weak or key too short
71528 </literallayout>
71529 <para>
71530 So long as a DKIM ACL is defined (it need do no more than accept),
71531 after all the DKIM ACL runs have completed, the value becomes a
71532 colon-separated list of the values after each run.
71533 This is maintained for the mime, prdr and data ACLs.
71534 </para>
71535 </listitem></varlistentry>
71536 <varlistentry>
71537 <term><option>$dkim_verify_reason</option></term>
71538 <listitem>
71539 <para>
71540 A string giving a little bit more detail when <option>$dkim_verify_status</option> is either
71541 "fail" or "invalid". One of
71542 </para>
71543 <itemizedlist>
71544 <listitem>
71545 <para>
71546 <option>pubkey_unavailable</option> (when <option>$dkim_verify_status</option>="invalid"): The public
71547 key for the domain could not be retrieved. This may be a temporary problem.
71548 </para>
71549 </listitem>
71550 <listitem>
71551 <para>
71552 <option>pubkey_syntax</option> (when <option>$dkim_verify_status</option>="invalid"): The public key
71553 record for the domain is syntactically invalid.
71554 </para>
71555 </listitem>
71556 <listitem>
71557 <para>
71558 <option>bodyhash_mismatch</option> (when <option>$dkim_verify_status</option>="fail"): The calculated
71559 body hash does not match the one specified in the signature header. This
71560 means that the message body was modified in transit.
71561 </para>
71562 </listitem>
71563 <listitem>
71564 <para>
71565 <option>signature_incorrect</option> (when <option>$dkim_verify_status</option>="fail"): The signature
71566 could not be verified. This may mean that headers were modified,
71567 re-written or otherwise changed in a way which is incompatible with
71568 DKIM verification. It may of course also mean that the signature is forged.
71569 </para>
71570 </listitem>
71571 </itemizedlist>
71572 <para>
71573 This variable can be overwritten, with any value, using an ACL &#x2019;set&#x2019; modifier.
71574 </para>
71575 </listitem></varlistentry>
71576 <varlistentry>
71577 <term><option>$dkim_domain</option></term>
71578 <listitem>
71579 <para>
71580 The signing domain. IMPORTANT: This variable is only populated if there is
71581 an actual signature in the message for the current domain or identity (as
71582 reflected by <option>$dkim_cur_signer</option>).
71583 </para>
71584 </listitem></varlistentry>
71585 <varlistentry>
71586 <term><option>$dkim_identity</option></term>
71587 <listitem>
71588 <para>
71589 The signing identity, if present. IMPORTANT: This variable is only populated
71590 if there is an actual signature in the message for the current domain or
71591 identity (as reflected by <option>$dkim_cur_signer</option>).
71592 </para>
71593 </listitem></varlistentry>
71594 <varlistentry>
71595 <term><option>$dkim_selector</option></term>
71596 <listitem>
71597 <para>
71598 The key record selector string.
71599 </para>
71600 </listitem></varlistentry>
71601 <varlistentry>
71602 <term><option>$dkim_algo</option></term>
71603 <listitem>
71604 <para>
71605 The algorithm used. One of &#x2019;rsa-sha1&#x2019; or &#x2019;rsa-sha256&#x2019;.
71606 If running under GnuTLS 3.6.0 or OpenSSL 1.1.1 or later,
71607 may also be &#x2019;ed25519-sha256&#x2019;.
71608 The "_CRYPTO_SIGN_ED25519" macro will be defined if support is present
71609 for EC keys.
71610 </para>
71611 <para>
71612 Note that RFC 8301 says:
71613 </para>
71614 <literallayout class="monospaced">
71615 rsa-sha1 MUST NOT be used for signing or verifying.
71616
71617 DKIM signatures identified as having been signed with historic
71618 algorithms (currently, rsa-sha1) have permanently failed evaluation
71619 </literallayout>
71620 <para>
71621 To enforce this you must have a DKIM ACL which checks this variable
71622 and overwrites the <varname>$dkim_verify_status</varname> variable as discussed above.
71623 </para>
71624 </listitem></varlistentry>
71625 <varlistentry>
71626 <term><option>$dkim_canon_body</option></term>
71627 <listitem>
71628 <para>
71629 The body canonicalization method. One of &#x2019;relaxed&#x2019; or &#x2019;simple&#x2019;.
71630 </para>
71631 </listitem></varlistentry>
71632 <varlistentry>
71633 <term><option>$dkim_canon_headers</option></term>
71634 <listitem>
71635 <para>
71636 The header canonicalization method. One of &#x2019;relaxed&#x2019; or &#x2019;simple&#x2019;.
71637 </para>
71638 </listitem></varlistentry>
71639 <varlistentry>
71640 <term><option>$dkim_copiedheaders</option></term>
71641 <listitem>
71642 <para>
71643 A transcript of headers and their values which are included in the signature
71644 (copied from the &#x2019;z=&#x2019; tag of the signature).
71645 Note that RFC6376 requires that verification fail if the From: header is
71646 not included in the signature.  Exim does not enforce this; sites wishing
71647 strict enforcement should code the check explicitly.
71648 </para>
71649 </listitem></varlistentry>
71650 <varlistentry>
71651 <term><option>$dkim_bodylength</option></term>
71652 <listitem>
71653 <para>
71654 The number of signed body bytes. If zero ("0"), the body is unsigned. If no
71655 limit was set by the signer, "9999999999999" is returned. This makes sure
71656 that this variable always expands to an integer value.
71657 </para>
71658 <para revisionflag="changed">
71659 <emphasis role="bold">Note:</emphasis> The presence of the signature tag specifying a signing body length
71660 is one possible route to spoofing of valid DKIM signatures.
71661 A paranoid implementation might wish to regard signature where this variable
71662 shows less than the "no limit" return as being invalid.
71663 </para>
71664 </listitem></varlistentry>
71665 <varlistentry>
71666 <term><option>$dkim_created</option></term>
71667 <listitem>
71668 <para>
71669 UNIX timestamp reflecting the date and time when the signature was created.
71670 When this was not specified by the signer, "0" is returned.
71671 </para>
71672 </listitem></varlistentry>
71673 <varlistentry>
71674 <term><option>$dkim_expires</option></term>
71675 <listitem>
71676 <para>
71677 UNIX timestamp reflecting the date and time when the signer wants the
71678 signature to be treated as "expired". When this was not specified by the
71679 signer, "9999999999999" is returned. This makes it possible to do useful
71680 integer size comparisons against this value.
71681 Note that Exim does not check this value.
71682 </para>
71683 </listitem></varlistentry>
71684 <varlistentry>
71685 <term><option>$dkim_headernames</option></term>
71686 <listitem>
71687 <para>
71688 A colon-separated list of names of headers included in the signature.
71689 </para>
71690 </listitem></varlistentry>
71691 <varlistentry>
71692 <term><option>$dkim_key_testing</option></term>
71693 <listitem>
71694 <para>
71695 "1" if the key record has the "testing" flag set, "0" if not.
71696 </para>
71697 </listitem></varlistentry>
71698 <varlistentry>
71699 <term><option>$dkim_key_nosubdomains</option></term>
71700 <listitem>
71701 <para>
71702 "1" if the key record forbids subdomaining, "0" otherwise.
71703 </para>
71704 </listitem></varlistentry>
71705 <varlistentry>
71706 <term><option>$dkim_key_srvtype</option></term>
71707 <listitem>
71708 <para>
71709 Service type (tag s=) from the key record. Defaults to "*" if not specified
71710 in the key record.
71711 </para>
71712 </listitem></varlistentry>
71713 <varlistentry>
71714 <term><option>$dkim_key_granularity</option></term>
71715 <listitem>
71716 <para>
71717 Key granularity (tag g=) from the key record. Defaults to "*" if not specified
71718 in the key record.
71719 </para>
71720 </listitem></varlistentry>
71721 <varlistentry>
71722 <term><option>$dkim_key_notes</option></term>
71723 <listitem>
71724 <para>
71725 Notes from the key record (tag n=).
71726 </para>
71727 </listitem></varlistentry>
71728 <varlistentry>
71729 <term><option>$dkim_key_length</option></term>
71730 <listitem>
71731 <para>
71732 Number of bits in the key.
71733 </para>
71734 <para>
71735 Note that RFC 8301 says:
71736 </para>
71737 <literallayout class="monospaced">
71738 Verifiers MUST NOT consider signatures using RSA keys of
71739 less than 1024 bits as valid signatures.
71740 </literallayout>
71741 <para>
71742 To enforce this you must have a DKIM ACL which checks this variable
71743 and overwrites the <varname>$dkim_verify_status</varname> variable as discussed above.
71744 As EC keys are much smaller, the check should only do this for RSA keys.
71745 </para>
71746 </listitem></varlistentry>
71747 </variablelist>
71748 <para>
71749 In addition, two ACL conditions are provided:
71750 </para>
71751 <variablelist>
71752 <varlistentry>
71753 <term><option>dkim_signers</option></term>
71754 <listitem>
71755 <para>
71756 ACL condition that checks a colon-separated list of domains or identities
71757 for a match against the domain or identity that the ACL is currently verifying
71758 (reflected by <option>$dkim_cur_signer</option>). This is typically used to restrict an ACL
71759 verb to a group of domains or identities. For example:
71760 </para>
71761 <literallayout class="monospaced">
71762 # Warn when Mail purportedly from GMail has no gmail signature
71763 warn log_message = GMail sender without gmail.com DKIM signature
71764      sender_domains = gmail.com
71765      dkim_signers = gmail.com
71766      dkim_status = none
71767 </literallayout>
71768 <para>
71769 Note that the above does not check for a total lack of DKIM signing;
71770 for that check for empty <varname>$h_DKIM-Signature:</varname> in the data ACL.
71771 </para>
71772 </listitem></varlistentry>
71773 <varlistentry>
71774 <term><option>dkim_status</option></term>
71775 <listitem>
71776 <para>
71777 ACL condition that checks a colon-separated list of possible DKIM verification
71778 results against the actual result of verification. This is typically used
71779 to restrict an ACL verb to a list of verification outcomes, for example:
71780 </para>
71781 <literallayout class="monospaced">
71782 deny message = Mail from Paypal with invalid/missing signature
71783      sender_domains = paypal.com:paypal.de
71784      dkim_signers = paypal.com:paypal.de
71785      dkim_status = none:invalid:fail
71786 </literallayout>
71787 <para>
71788 The possible status keywords are: &#x2019;none&#x2019;,&#x2019;invalid&#x2019;,&#x2019;fail&#x2019; and &#x2019;pass&#x2019;. Please
71789 see the documentation of the <option>$dkim_verify_status</option> expansion variable above
71790 for more information of what they mean.
71791 </para>
71792 </listitem></varlistentry>
71793 </variablelist>
71794 </section>
71795 <section id="SECSPF">
71796 <title>SPF (Sender Policy Framework)</title>
71797 <para>
71798 <indexterm role="concept">
71799 <primary>SPF</primary>
71800 <secondary>verification</secondary>
71801 </indexterm>
71802 </para>
71803 <para>
71804 SPF is a mechanism whereby a domain may assert which IP addresses may transmit
71805 messages with its domain in the envelope from, documented by RFC 7208.
71806 For more information on SPF see <emphasis role="bold"><ulink url="http://www.openspf.org">http://www.openspf.org</ulink></emphasis>.
71807 </para>
71808 <para>
71809 Messages sent by a system not authorised will fail checking of such assertions.
71810 This includes retransmissions done by traditional forwarders.
71811 </para>
71812 <para>
71813 SPF verification support is built into Exim if SUPPORT_SPF=yes is set in
71814 <filename>Local/Makefile</filename>.  The support uses the <filename>libspf2</filename> library
71815 <emphasis role="bold"><ulink url="https://www.libspf2.org/">https://www.libspf2.org/</ulink></emphasis>.
71816 There is no Exim involvement in the transmission of messages;
71817 publishing certain DNS records is all that is required.
71818 </para>
71819 <para>
71820 For verification, an ACL condition and an expansion lookup are provided.
71821 <indexterm role="concept">
71822 <primary>authentication</primary>
71823 <secondary>expansion item</secondary>
71824 </indexterm>
71825 Performing verification sets up information used by the
71826 <varname>$authresults</varname> expansion item.
71827 </para>
71828 <para>
71829 <indexterm role="concept">
71830 <primary>SPF</primary>
71831 <secondary>ACL condition</secondary>
71832 </indexterm>
71833 <indexterm role="concept">
71834 <primary>ACL</primary>
71835 <secondary>spf condition</secondary>
71836 </indexterm>
71837 The ACL condition "spf" can be used at or after the MAIL ACL.
71838 It takes as an argument a list of strings giving the outcome of the SPF check,
71839 and will succeed for any matching outcome.
71840 Valid strings are:
71841 </para>
71842 <variablelist>
71843 <varlistentry>
71844 <term><option>pass</option></term>
71845 <listitem>
71846 <para>
71847 The SPF check passed, the sending host is positively verified by SPF.
71848 </para>
71849 </listitem></varlistentry>
71850 <varlistentry>
71851 <term><option>fail</option></term>
71852 <listitem>
71853 <para>
71854 The SPF check failed, the sending host is NOT allowed to send mail for the
71855 domain in the envelope-from address.
71856 </para>
71857 </listitem></varlistentry>
71858 <varlistentry>
71859 <term><option>softfail</option></term>
71860 <listitem>
71861 <para>
71862 The SPF check failed, but the queried domain can&#x2019;t absolutely confirm that this
71863 is a forgery.
71864 </para>
71865 </listitem></varlistentry>
71866 <varlistentry>
71867 <term><option>none</option></term>
71868 <listitem>
71869 <para>
71870 The queried domain does not publish SPF records.
71871 </para>
71872 </listitem></varlistentry>
71873 <varlistentry>
71874 <term><option>neutral</option></term>
71875 <listitem>
71876 <para>
71877 The SPF check returned a "neutral" state.  This means the queried domain has
71878 published a SPF record, but wants to allow outside servers to send mail under
71879 its domain as well.  This should be treated like "none".
71880 </para>
71881 </listitem></varlistentry>
71882 <varlistentry>
71883 <term><option>permerror</option></term>
71884 <listitem>
71885 <para>
71886 This indicates a syntax error in the SPF record of the queried domain.
71887 You may deny messages when this occurs.
71888 </para>
71889 </listitem></varlistentry>
71890 <varlistentry>
71891 <term><option>temperror</option></term>
71892 <listitem>
71893 <para>
71894 This indicates a temporary error during all processing, including Exim&#x2019;s
71895 SPF processing.  You may defer messages when this occurs.
71896 </para>
71897 </listitem></varlistentry>
71898 </variablelist>
71899 <para>
71900 You can prefix each string with an exclamation mark to  invert
71901 its meaning,  for example  "!fail" will  match all  results but
71902 "fail".  The  string  list is  evaluated  left-to-right,  in a
71903 short-circuit fashion.
71904 </para>
71905 <para>
71906 Example:
71907 </para>
71908 <literallayout class="monospaced">
71909 deny spf = fail
71910      message = $sender_host_address is not allowed to send mail from \
71911                ${if def:sender_address_domain \
71912                     {$sender_address_domain}{$sender_helo_name}}.  \
71913                Please see http://www.openspf.org/Why?scope=\
71914                ${if def:sender_address_domain {mfrom}{helo}};\
71915                identity=${if def:sender_address_domain \
71916                              {$sender_address}{$sender_helo_name}};\
71917                ip=$sender_host_address
71918 </literallayout>
71919 <para>
71920 When the spf condition has run, it sets up several expansion
71921 variables:
71922 </para>
71923 <para>
71924 <indexterm role="concept">
71925 <primary>SPF</primary>
71926 <secondary>verification variables</secondary>
71927 </indexterm>
71928 </para>
71929 <variablelist>
71930 <varlistentry>
71931 <term><varname>$spf_header_comment</varname></term>
71932 <listitem>
71933 <para>
71934 <indexterm role="variable">
71935 <primary><varname>$spf_header_comment</varname></primary>
71936 </indexterm>
71937   This contains a human-readable string describing the outcome
71938   of the SPF check. You can add it to a custom header or use
71939   it for logging purposes.
71940 </para>
71941 </listitem></varlistentry>
71942 <varlistentry>
71943 <term><varname>$spf_received</varname></term>
71944 <listitem>
71945 <para>
71946 <indexterm role="variable">
71947 <primary><varname>$spf_received</varname></primary>
71948 </indexterm>
71949   This contains a complete Received-SPF: header that can be
71950   added to the message. Please note that according to the SPF
71951   draft, this header must be added at the top of the header
71952   list. Please see section 10 on how you can do this.
71953 </para>
71954 <para>
71955   Note: in case of "Best-guess" (see below), the convention is
71956   to put this string in a header called X-SPF-Guess: instead.
71957 </para>
71958 </listitem></varlistentry>
71959 <varlistentry>
71960 <term><varname>$spf_result</varname></term>
71961 <listitem>
71962 <para>
71963 <indexterm role="variable">
71964 <primary><varname>$spf_result</varname></primary>
71965 </indexterm>
71966   This contains the outcome of the SPF check in string form,
71967   one of pass, fail, softfail, none, neutral, permerror or
71968   temperror.
71969 </para>
71970 </listitem></varlistentry>
71971 <varlistentry>
71972 <term><varname>$spf_result_guessed</varname></term>
71973 <listitem>
71974 <para>
71975 <indexterm role="variable">
71976 <primary><varname>$spf_result_guessed</varname></primary>
71977 </indexterm>
71978   This boolean is true only if a best-guess operation was used
71979   and required in order to obtain a result.
71980 </para>
71981 </listitem></varlistentry>
71982 <varlistentry>
71983 <term><varname>$spf_smtp_comment</varname></term>
71984 <listitem>
71985 <para>
71986 <indexterm role="variable">
71987 <primary><varname>$spf_smtp_comment</varname></primary>
71988 </indexterm>
71989   This contains a string that can be used in a SMTP response
71990   to the calling party. Useful for "fail".
71991 </para>
71992 </listitem></varlistentry>
71993 </variablelist>
71994 <para>
71995 <indexterm role="concept">
71996 <primary>SPF</primary>
71997 <secondary>ACL condition</secondary>
71998 </indexterm>
71999 <indexterm role="concept">
72000 <primary>ACL</primary>
72001 <secondary>spf_guess condition</secondary>
72002 </indexterm>
72003 <indexterm role="concept">
72004 <primary>SPF</primary>
72005 <secondary>best guess</secondary>
72006 </indexterm>
72007 In addition to SPF, you can also perform checks for so-called
72008 "Best-guess".  Strictly speaking, "Best-guess" is not standard
72009 SPF, but it is supported by the same framework that enables SPF
72010 capability.
72011 Refer to <emphasis role="bold"><ulink url="http://www.openspf.org/FAQ/Best_guess_record">http://www.openspf.org/FAQ/Best_guess_record</ulink></emphasis>
72012 for a description of what it means.
72013 </para>
72014 <para>
72015 To access this feature, simply use the spf_guess condition in place
72016 of the spf one.  For example:
72017 </para>
72018 <literallayout class="monospaced">
72019 deny spf_guess = fail
72020      message = $sender_host_address doesn't look trustworthy to me
72021 </literallayout>
72022 <para>
72023 In case you decide to reject messages based on this check, you
72024 should note that although it uses the same framework, "Best-guess"
72025 is not SPF, and therefore you should not mention SPF at all in your
72026 reject message.
72027 </para>
72028 <para>
72029 When the spf_guess condition has run, it sets up the same expansion
72030 variables as when spf condition is run, described above.
72031 </para>
72032 <para>
72033 Additionally, since Best-guess is not standardized, you may redefine
72034 what "Best-guess" means to you by redefining the main configuration
72035 <option>spf_guess</option> option.
72036 For example, the following:
72037 </para>
72038 <literallayout class="monospaced">
72039 spf_guess = v=spf1 a/16 mx/16 ptr ?all
72040 </literallayout>
72041 <para>
72042 would relax host matching rules to a broader network range.
72043 </para>
72044 <para>
72045 <indexterm role="concept">
72046 <primary>SPF</primary>
72047 <secondary>lookup expansion</secondary>
72048 </indexterm>
72049 <indexterm role="concept">
72050 <primary>lookup</primary>
72051 <secondary>spf</secondary>
72052 </indexterm>
72053 A lookup expansion is also available. It takes an email
72054 address as the key and an IP address as the database:
72055 </para>
72056 <literallayout class="monospaced">
72057   ${lookup {username@domain} spf {ip.ip.ip.ip}}
72058 </literallayout>
72059 <para>
72060 The lookup will return the same result strings as can appear in
72061 <varname>$spf_result</varname> (pass,fail,softfail,neutral,none,err_perm,err_temp).
72062 Currently, only IPv4 addresses are supported.
72063 </para>
72064 </section>
72065 </chapter>
72066
72067 <chapter id="CHAPproxies">
72068 <title>Proxies</title>
72069 <titleabbrev>Proxy support</titleabbrev>
72070 <para>
72071 <indexterm role="concept">
72072 <primary>proxy support</primary>
72073 </indexterm>
72074 <indexterm role="concept">
72075 <primary>proxy</primary>
72076 <secondary>access via</secondary>
72077 </indexterm>
72078 </para>
72079 <para>
72080 A proxy is an intermediate system through which communication is passed.
72081 Proxies may provide a security, availability or load-distribution function.
72082 </para>
72083 <section id="SECTproxyInbound">
72084 <title>Inbound proxies</title>
72085 <para>
72086 <indexterm role="concept">
72087 <primary>proxy</primary>
72088 <secondary>inbound</secondary>
72089 </indexterm>
72090 <indexterm role="concept">
72091 <primary>proxy</primary>
72092 <secondary>server side</secondary>
72093 </indexterm>
72094 <indexterm role="concept">
72095 <primary>proxy</primary>
72096 <secondary>Proxy protocol</secondary>
72097 </indexterm>
72098 <indexterm role="concept">
72099 <primary>Proxy protocol</primary>
72100 <secondary>proxy</secondary>
72101 </indexterm>
72102 </para>
72103 <para>
72104 Exim has support for receiving inbound SMTP connections via a proxy
72105 that uses <quote>Proxy Protocol</quote> to speak to it.
72106 To include this support, include <quote>SUPPORT_PROXY=yes</quote>
72107 in Local/Makefile.
72108 </para>
72109 <para>
72110 It was built on the HAProxy specification, found at
72111 <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>.
72112 </para>
72113 <para>
72114 The purpose of this facility is so that an application load balancer,
72115 such as HAProxy, can sit in front of several Exim servers
72116 to distribute load.
72117 Exim uses the local protocol communication with the proxy to obtain
72118 the remote SMTP system IP address and port information.
72119 There is no logging if a host passes or
72120 fails Proxy Protocol negotiation, but it can easily be determined and
72121 recorded in an ACL (example is below).
72122 </para>
72123 <para>
72124 Use of a proxy is enabled by setting the <option>hosts_proxy</option>
72125 main configuration option to a hostlist; connections from these
72126 hosts will use Proxy Protocol.
72127 Exim supports both version 1 and version 2 of the Proxy Protocol and
72128 automatically determines which version is in use.
72129 </para>
72130 <para>
72131 The Proxy Protocol header is the first data received on a TCP connection
72132 and is inserted before any TLS-on-connect handshake from the client; Exim
72133 negotiates TLS between Exim-as-server and the remote client, not between
72134 Exim and the proxy server.
72135 </para>
72136 <para>
72137 The following expansion variables are usable
72138 (<quote>internal</quote> and <quote>external</quote> here refer to the interfaces
72139 of the proxy):
72140 </para>
72141 <literallayout>
72142 <emphasis>proxy_external_address   </emphasis> IP of host being proxied or IP of remote interface of proxy
72143 <emphasis>proxy_external_port      </emphasis> Port of host being proxied or Port on remote interface of proxy
72144 <emphasis>proxy_local_address      </emphasis> IP of proxy server inbound or IP of local interface of proxy
72145 <emphasis>proxy_local_port         </emphasis> Port of proxy server inbound or Port on local interface of proxy
72146 <emphasis>proxy_session            </emphasis> boolean: SMTP connection via proxy
72147 </literallayout>
72148 <para>
72149 If <varname>$proxy_session</varname> is set but <varname>$proxy_external_address</varname> is empty
72150 there was a protocol error.
72151 </para>
72152 <para>
72153 Since the real connections are all coming from the proxy, and the
72154 per host connection tracking is done before Proxy Protocol is
72155 evaluated, <option>smtp_accept_max_per_host</option> must be set high enough to
72156 handle all of the parallel volume you expect per inbound proxy.
72157 With the option set so high, you lose the ability
72158 to protect your server from many connections from one IP.
72159 In order to prevent your server from overload, you
72160 need to add a per connection ratelimit to your connect ACL.
72161 A possible solution is:
72162 </para>
72163 <literallayout>
72164   # Set max number of connections per host
72165   LIMIT   = 5
72166   # Or do some kind of IP lookup in a flat file or database
72167   # LIMIT = ${lookup{$sender_host_address}iplsearch{/etc/exim/proxy_limits}}
72168
72169   defer   message        = Too many connections from this IP right now
72170           ratelimit      = LIMIT / 5s / per_conn / strict
72171 </literallayout>
72172 </section>
72173 <section id="SECTproxySOCKS">
72174 <title>Outbound proxies</title>
72175 <para>
72176 <indexterm role="concept">
72177 <primary>proxy</primary>
72178 <secondary>outbound</secondary>
72179 </indexterm>
72180 <indexterm role="concept">
72181 <primary>proxy</primary>
72182 <secondary>client side</secondary>
72183 </indexterm>
72184 <indexterm role="concept">
72185 <primary>proxy</primary>
72186 <secondary>SOCKS</secondary>
72187 </indexterm>
72188 <indexterm role="concept">
72189 <primary>SOCKS</primary>
72190 <secondary>proxy</secondary>
72191 </indexterm>
72192 Exim has support for sending outbound SMTP via a proxy
72193 using a protocol called SOCKS5 (defined by RFC1928).
72194 The support can be optionally included by defining SUPPORT_SOCKS=yes in
72195 Local/Makefile.
72196 </para>
72197 <para>
72198 Use of a proxy is enabled by setting the <option>socks_proxy</option> option
72199 on an smtp transport.
72200 The option value is expanded and should then be a list
72201 (colon-separated by default) of proxy specifiers.
72202 Each proxy specifier is a list
72203 (space-separated by default) where the initial element
72204 is an IP address and any subsequent elements are options.
72205 </para>
72206 <para>
72207 Options are a string &lt;name&gt;=&lt;value&gt;.
72208 The list of options is in the following table:
72209 </para>
72210 <literallayout>
72211 <emphasis>auth   </emphasis> authentication method
72212 <emphasis>name   </emphasis> authentication username
72213 <emphasis>pass   </emphasis> authentication password
72214 <emphasis>port   </emphasis> tcp port
72215 <emphasis>tmo    </emphasis> connection timeout
72216 <emphasis>pri    </emphasis> priority
72217 <emphasis>weight </emphasis> selection bias
72218 </literallayout>
72219 <para>
72220 More details on each of these options follows:
72221 </para>
72222 <itemizedlist>
72223 <listitem>
72224 <para>
72225 <indexterm role="concept">
72226 <primary>authentication</primary>
72227 <secondary>to proxy</secondary>
72228 </indexterm>
72229 <indexterm role="concept">
72230 <primary>proxy</primary>
72231 <secondary>authentication</secondary>
72232 </indexterm>
72233 <option>auth</option>: Either <quote>none</quote> (default) or <quote>name</quote>.
72234 Using <quote>name</quote> selects username/password authentication per RFC 1929
72235 for access to the proxy.
72236 Default is <quote>none</quote>.
72237 </para>
72238 </listitem>
72239 <listitem>
72240 <para>
72241 <option>name</option>: sets the username for the <quote>name</quote> authentication method.
72242 Default is empty.
72243 </para>
72244 </listitem>
72245 <listitem>
72246 <para>
72247 <option>pass</option>: sets the password for the <quote>name</quote> authentication method.
72248 Default is empty.
72249 </para>
72250 </listitem>
72251 <listitem>
72252 <para>
72253 <option>port</option>: the TCP port number to use for the connection to the proxy.
72254 Default is 1080.
72255 </para>
72256 </listitem>
72257 <listitem>
72258 <para>
72259 <option>tmo</option>: sets a connection timeout in seconds for this proxy.
72260 Default is 5.
72261 </para>
72262 </listitem>
72263 <listitem>
72264 <para>
72265 <option>pri</option>: specifies a priority for the proxy within the list,
72266 higher values being tried first.
72267 The default priority is 1.
72268 </para>
72269 </listitem>
72270 <listitem>
72271 <para>
72272 <option>weight</option>: specifies a selection bias.
72273 Within a priority set servers are queried in a random fashion,
72274 weighted by this value.
72275 The default value for selection bias is 1.
72276 </para>
72277 </listitem>
72278 </itemizedlist>
72279 <para>
72280 Proxies from the list are tried according to their priority
72281 and weight settings until one responds.  The timeout for the
72282 overall connection applies to the set of proxied attempts.
72283 </para>
72284 </section>
72285 <section id="SECTproxyLog">
72286 <title>Logging</title>
72287 <para>
72288 To log the (local) IP of a proxy in the incoming or delivery logline,
72289 add <quote>+proxy</quote> to the <option>log_selector</option> option.
72290 This will add a component tagged with <quote>PRX=</quote> to the line.
72291 </para>
72292 </section>
72293 </chapter>
72294
72295 <chapter id="CHAPi18n">
72296 <title>Internationalisation</title>
72297 <titleabbrev>Internationalisation"</titleabbrev>
72298 <para>
72299 <indexterm role="concept">
72300 <primary>internationalisation</primary>
72301 <secondary>email address</secondary>
72302 </indexterm>
72303 <indexterm role="concept">
72304 <primary>EAI</primary>
72305 </indexterm>
72306 <indexterm role="concept">
72307 <primary>i18n</primary>
72308 </indexterm>
72309 <indexterm role="concept">
72310 <primary>utf8</primary>
72311 <secondary>mail name handling</secondary>
72312 </indexterm>
72313 </para>
72314 <para>
72315 Exim has support for Internationalised mail names.
72316 To include this it must be built with SUPPORT_I18N and the libidn library.
72317 Standards supported are RFCs 2060, 5890, 6530 and 6533.
72318 </para>
72319 <para>
72320 If Exim is built with SUPPORT_I18N_2008 (in addition to SUPPORT_I18N, not
72321 instead of it) then IDNA2008 is supported; this adds an extra library
72322 requirement, upon libidn2.
72323 </para>
72324 <section id="SECTi18nMTA">
72325 <title>MTA operations</title>
72326 <para>
72327 <indexterm role="concept">
72328 <primary>SMTPUTF8</primary>
72329 <secondary>ESMTP option</secondary>
72330 </indexterm>
72331 The main configuration option <option>smtputf8_advertise_hosts</option> specifies
72332 a host list.  If this matches the sending host and
72333 accept_8bitmime is true (the default) then the ESMTP option
72334 SMTPUTF8 will be advertised.
72335 </para>
72336 <para>
72337 If the sender specifies the SMTPUTF8 option on a MAIL command
72338 international handling for the message is enabled and
72339 the expansion variable <varname>$message_smtputf8</varname> will have value TRUE.
72340 </para>
72341 <para>
72342 The option <option>allow_utf8_domains</option> is set to true for this
72343 message. All DNS lookups are converted to a-label form
72344 whatever the setting of <option>allow_utf8_domains</option>
72345 when Exim is built with SUPPORT_I18N.
72346 </para>
72347 <para>
72348 Both localparts and domain are maintained as the original
72349 UTF-8 form internally; any comparison or regular-expression use will
72350 require appropriate care.  Filenames created, eg. by
72351 the appendfile transport, will have UTF-8 names.
72352 </para>
72353 <para>
72354 HELO names sent by the smtp transport will have any UTF-8
72355 components expanded to a-label form,
72356 and any certificate name checks will be done using the a-label
72357 form of the name.
72358 </para>
72359 <para>
72360 <indexterm role="concept">
72361 <primary>log</primary>
72362 <secondary>protocol</secondary>
72363 </indexterm>
72364 <indexterm role="concept">
72365 <primary>SMTPUTF8</primary>
72366 <secondary>logging</secondary>
72367 </indexterm>
72368 <indexterm role="concept">
72369 <primary>i18n</primary>
72370 <secondary>logging</secondary>
72371 </indexterm>
72372 Log lines and Received-by: header lines will acquire a "utf8"
72373 prefix on the protocol element, eg. utf8esmtp.
72374 </para>
72375 <para>
72376 The following expansion operators can be used:
72377 </para>
72378 <literallayout class="monospaced">
72379 ${utf8_domain_to_alabel:str}
72380 ${utf8_domain_from_alabel:str}
72381 ${utf8_localpart_to_alabel:str}
72382 ${utf8_localpart_from_alabel:str}
72383 </literallayout>
72384 <para>
72385 <indexterm role="concept">
72386 <primary>utf8</primary>
72387 <secondary>address downconversion</secondary>
72388 </indexterm>
72389 <indexterm role="concept">
72390 <primary>i18n</primary>
72391 <secondary>utf8 address downconversion</secondary>
72392 </indexterm>
72393 The RCPT ACL
72394 may use the following modifier:
72395 </para>
72396 <literallayout>
72397 control = utf8_downconvert
72398 control = utf8_downconvert/&lt;value&gt;
72399 </literallayout>
72400 <para>
72401 This sets a flag requiring that addresses are converted to
72402 a-label form before smtp delivery, for use in a
72403 Message Submission Agent context.
72404 If a value is appended it may be:
72405 </para>
72406 <literallayout>
72407 <literal>1  </literal> (default) mandatory downconversion
72408 <literal>0  </literal> no downconversion
72409 <literal>-1 </literal> if SMTPUTF8 not supported by destination host
72410 </literallayout>
72411 <para>
72412 If mua_wrapper is set, the utf8_downconvert control
72413 is initially set to -1.
72414 </para>
72415 <para revisionflag="changed">
72416 The smtp transport has an option <option>utf8_downconvert</option>.
72417 If set it must expand to one of the three values described above,
72418 and it overrides any previously set value.
72419 </para>
72420 <para>
72421 There is no explicit support for VRFY and EXPN.
72422 Configurations supporting these should inspect
72423 <varname>$smtp_command_argument</varname> for an SMTPUTF8 argument.
72424 </para>
72425 <para>
72426 There is no support for LMTP on Unix sockets.
72427 Using the "lmtp" protocol option on an smtp transport,
72428 for LMTP over TCP, should work as expected.
72429 </para>
72430 <para>
72431 There is no support for DSN unitext handling,
72432 and no provision for converting logging from or to UTF-8.
72433 </para>
72434 </section>
72435 <section id="SECTi18nMDA">
72436 <title>MDA operations</title>
72437 <para>
72438 To aid in constructing names suitable for IMAP folders
72439 the following expansion operator can be used:
72440 </para>
72441 <literallayout class="monospaced">
72442 ${imapfolder {&lt;string&gt;} {&lt;sep&gt;} {&lt;specials&gt;}}
72443 </literallayout>
72444 <para>
72445 The string is converted from the charset specified by
72446 the "headers charset" command (in a filter file)
72447 or <option>headers_charset</option> main configuration option (otherwise),
72448 to the
72449 modified UTF-7 encoding specified by RFC 2060,
72450 with the following exception: All occurrences of &lt;sep&gt;
72451 (which has to be a single character)
72452 are replaced with periods ("."), and all periods and slashes that are not
72453 &lt;sep&gt; and are not in the &lt;specials&gt; string are BASE64 encoded.
72454 </para>
72455 <para>
72456 The third argument can be omitted, defaulting to an empty string.
72457 The second argument can be omitted, defaulting to "/".
72458 </para>
72459 <para>
72460 This is the encoding used by Courier for Maildir names on disk, and followed
72461 by many other IMAP servers.
72462 </para>
72463 <para>
72464 Examples:
72465 </para>
72466 <literallayout>
72467 <literal>${imapfolder {Foo/Bar}}       </literal> yields <literal>Foo.Bar</literal>
72468 <literal>${imapfolder {Foo/Bar}{.}{/}} </literal> yields <literal>Foo&amp;AC8-Bar</literal>
72469 <literal>${imapfolder {Räksmörgås}}    </literal> yields <literal>R&amp;AOQ-ksm&amp;APY-rg&amp;AOU-s</literal>
72470 </literallayout>
72471 <para>
72472 Note that the source charset setting is vital, and also that characters
72473 must be representable in UTF-16.
72474 </para>
72475 </section>
72476 </chapter>
72477
72478 <chapter id="CHAPevents">
72479 <title>Events</title>
72480 <titleabbrev>Events</titleabbrev>
72481 <para>
72482 <indexterm role="concept">
72483 <primary>events</primary>
72484 </indexterm>
72485 </para>
72486 <para>
72487 The events mechanism in Exim can be used to intercept processing at a number
72488 of points.  It was originally invented to give a way to do customised logging
72489 actions (for example, to a database) but can also be used to modify some
72490 processing actions.
72491 </para>
72492 <para>
72493 Most installations will never need to use Events.
72494 The support can be left out of a build by defining DISABLE_EVENT=yes
72495 in <filename>Local/Makefile</filename>.
72496 </para>
72497 <para>
72498 There are two major classes of events: main and transport.
72499 The main configuration option <option>event_action</option> controls reception events;
72500 a transport option <option>event_action</option> controls delivery events.
72501 </para>
72502 <para>
72503 Both options are a string which is expanded when the event fires.
72504 An example might look like:
72505 <indexterm role="concept">
72506 <primary>logging</primary>
72507 <secondary>custom</secondary>
72508 </indexterm>
72509 </para>
72510 <literallayout class="monospaced">
72511 event_action = ${if eq {msg:delivery}{$event_name} \
72512 {${lookup pgsql {SELECT * FROM record_Delivery( \
72513     '${quote_pgsql:$sender_address_domain}',\
72514     '${quote_pgsql:${lc:$sender_address_local_part}}', \
72515     '${quote_pgsql:$domain}', \
72516     '${quote_pgsql:${lc:$local_part}}', \
72517     '${quote_pgsql:$host_address}', \
72518     '${quote_pgsql:${lc:$host}}', \
72519     '${quote_pgsql:$message_exim_id}')}} \
72520 } {}}
72521 </literallayout>
72522 <para>
72523 Events have names which correspond to the point in process at which they fire.
72524 The name is placed in the variable <varname>$event_name</varname> and the event action
72525 expansion must check this, as it will be called for every possible event type.
72526 </para>
72527 <para>
72528 The current list of events is:
72529 </para>
72530 <literallayout>
72531 <literal>dane:fail              after    transport  </literal> per connection
72532 <literal>msg:complete           after    main       </literal> per message
72533 <literal>msg:delivery           after    transport  </literal> per recipient
72534 <literal>msg:rcpt:host:defer    after    transport  </literal> per recipient per host
72535 <literal>msg:rcpt:defer         after    transport  </literal> per recipient
72536 <literal>msg:host:defer         after    transport  </literal> per attempt
72537 <literal>msg:fail:delivery      after    transport  </literal> per recipient
72538 <literal>msg:fail:internal      after    main       </literal> per recipient
72539 <literal>tcp:connect            before   transport  </literal> per connection
72540 <literal>tcp:close              after    transport  </literal> per connection
72541 <literal>tls:cert               before   both       </literal> per certificate in verification chain
72542 <literal>smtp:connect           after    transport  </literal> per connection
72543 </literallayout>
72544 <para>
72545 New event types may be added in future.
72546 </para>
72547 <para>
72548 The event name is a colon-separated list, defining the type of
72549 event in a tree of possibilities.  It may be used as a list
72550 or just matched on as a whole.  There will be no spaces in the name.
72551 </para>
72552 <para>
72553 The second column in the table above describes whether the event fires
72554 before or after the action is associates with.  Those which fire before
72555 can be used to affect that action (more on this below).
72556 </para>
72557 <para>
72558 The third column in the table above says what section of the configuration
72559 should define the event action.
72560 </para>
72561 <para>
72562 An additional variable, <varname>$event_data</varname>, is filled with information varying
72563 with the event type:
72564 </para>
72565 <literallayout>
72566 <literal>dane:fail            </literal> failure reason
72567 <literal>msg:delivery         </literal> smtp confirmation message
72568 <literal>msg:fail:internal    </literal> failure reason
72569 <literal>msg:fail:delivery    </literal> smtp error message
72570 <literal>msg:rcpt:host:defer  </literal> error string
72571 <literal>msg:rcpt:defer       </literal> error string
72572 <literal>msg:host:defer       </literal> error string
72573 <literal>tls:cert             </literal> verification chain depth
72574 <literal>smtp:connect         </literal> smtp banner
72575 </literallayout>
72576 <para>
72577 The :defer events populate one extra variable: <varname>$event_defer_errno</varname>.
72578 </para>
72579 <para>
72580 For complex operations an ACL expansion can be used in <option>event_action</option>
72581 however due to the multiple contexts that Exim operates in during
72582 the course of its processing:
72583 </para>
72584 <itemizedlist>
72585 <listitem>
72586 <para>
72587 variables set in transport events will not be visible outside that
72588 transport call
72589 </para>
72590 </listitem>
72591 <listitem>
72592 <para>
72593 acl_m variables in a server context are lost on a new connection,
72594 and after smtp helo/ehlo/mail/starttls/rset commands
72595 </para>
72596 </listitem>
72597 </itemizedlist>
72598 <para>
72599 Using an ACL expansion with the logwrite modifier can be
72600 a useful way of writing to the main log.
72601 </para>
72602 <para>
72603 The expansion of the event_action option should normally
72604 return an empty string.  Should it return anything else the
72605 following will be forced:
72606 </para>
72607 <literallayout>
72608 <literal>tcp:connect      </literal>  do not connect
72609 <literal>tls:cert         </literal>  refuse verification
72610 <literal>smtp:connect     </literal>  close connection
72611 </literallayout>
72612 <para>
72613 All other message types ignore the result string, and
72614 no other use is made of it.
72615 </para>
72616 <para>
72617 For a tcp:connect event, if the connection is being made to a proxy
72618 then the address and port variables will be that of the proxy and not
72619 the target system.
72620 </para>
72621 <para>
72622 For tls:cert events, if GnuTLS is in use this will trigger only per
72623 chain element received on the connection.
72624 For OpenSSL it will trigger for every chain element including those
72625 loaded locally.
72626 </para>
72627 </chapter>
72628
72629 <chapter id="CHID13">
72630 <title>Adding new drivers or lookup types</title>
72631 <titleabbrev>Adding drivers or lookups</titleabbrev>
72632 <para>
72633 <indexterm role="concept">
72634 <primary>adding drivers</primary>
72635 </indexterm>
72636 <indexterm role="concept">
72637 <primary>new drivers, adding</primary>
72638 </indexterm>
72639 <indexterm role="concept">
72640 <primary>drivers</primary>
72641 <secondary>adding new</secondary>
72642 </indexterm>
72643 The following actions have to be taken in order to add a new router, transport,
72644 authenticator, or lookup type to Exim:
72645 </para>
72646 <orderedlist numeration="arabic">
72647 <listitem>
72648 <para>
72649 Choose a name for the driver or lookup type that does not conflict with any
72650 existing name; I will use <quote>newdriver</quote> in what follows.
72651 </para>
72652 </listitem>
72653 <listitem>
72654 <para>
72655 Add to <filename>src/EDITME</filename> the line:
72656 </para>
72657 <literallayout>
72658 &lt;<emphasis>type</emphasis>&gt;<literal>_NEWDRIVER=yes</literal>
72659 </literallayout>
72660 <para>
72661 where &lt;<emphasis>type</emphasis>&gt; is ROUTER, TRANSPORT, AUTH, or LOOKUP. If the
72662 code is not to be included in the binary by default, comment this line out. You
72663 should also add any relevant comments about the driver or lookup type.
72664 </para>
72665 </listitem>
72666 <listitem>
72667 <para>
72668 Add to <filename>src/config.h.defaults</filename> the line:
72669 </para>
72670 <literallayout class="monospaced">
72671 #define &lt;type&gt;_NEWDRIVER
72672 </literallayout>
72673 </listitem>
72674 <listitem>
72675 <para>
72676 Edit <filename>src/drtables.c</filename>, adding conditional code to pull in the private header
72677 and create a table entry as is done for all the other drivers and lookup types.
72678 </para>
72679 </listitem>
72680 <listitem>
72681 <para>
72682 Edit <filename>scripts/lookups-Makefile</filename> if this is a new lookup; there is a for-loop
72683 near the bottom, ranging the <literal>name_mod</literal> variable over a list of all lookups.
72684 Add your <literal>NEWDRIVER</literal> to that list.
72685 As long as the dynamic module would be named <filename>newdriver.so</filename>, you can use the
72686 simple form that most lookups have.
72687 </para>
72688 </listitem>
72689 <listitem>
72690 <para>
72691 Edit <filename>Makefile</filename> in the appropriate sub-directory (<filename>src/routers</filename>,
72692 <filename>src/transports</filename>, <filename>src/auths</filename>, or <filename>src/lookups</filename>); add a line for the new
72693 driver or lookup type and add it to the definition of OBJ.
72694 </para>
72695 </listitem>
72696 <listitem>
72697 <para>
72698 Edit <filename>OS/Makefile-Base</filename> adding a <filename>.o</filename> file for the predefined-macros, to the
72699 definition of OBJ_MACRO.  Add a set of line to do the compile also.
72700 </para>
72701 </listitem>
72702 <listitem>
72703 <para>
72704 Create <filename>newdriver.h</filename> and <filename>newdriver.c</filename> in the appropriate sub-directory of
72705 <filename>src</filename>.
72706 </para>
72707 </listitem>
72708 <listitem>
72709 <para>
72710 Edit <filename>scripts/MakeLinks</filename> and add commands to link the <filename>.h</filename> and <filename>.c</filename> files
72711 as for other drivers and lookups.
72712 </para>
72713 </listitem>
72714 </orderedlist>
72715 <para>
72716 Then all you need to do is write the code! A good way to start is to make a
72717 proforma by copying an existing module of the same type, globally changing all
72718 occurrences of the name, and cutting out most of the code. Note that any
72719 options you create must be listed in alphabetical order, because the tables are
72720 searched using a binary chop procedure.
72721 </para>
72722 <para>
72723 There is a <filename>README</filename> file in each of the sub-directories of <filename>src</filename> describing
72724 the interface that is expected.
72725 </para>
72726 <?sdop
72727   format="newpage"
72728   foot_right_recto="&chaptertitle;"
72729   foot_right_verso="&chaptertitle;"
72730 ?>
72731 </chapter>
72732
72733 <index role="option">
72734 <title>Options index</title>
72735 </index>
72736
72737 <index role="variable">
72738 <title>Variables index</title>
72739 </index>
72740
72741 <index role="concept">
72742 <title>Concept index</title>
72743 </index>
72744
72745 </book>