chg: mention CVE for 3.97.1
[exim-website.git] / docbook / 4.90.1 / spec.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
3
4
5 <?sdop
6   foot_right_recto="&chaptertitle; (&chapternumber;)"
7   foot_right_verso="&chaptertitle; (&chapternumber;)"
8   toc_chapter_blanks="yes,yes"
9   table_warn_overflow="overprint"
10 ?>
11 <book>
12 <bookinfo>
13 <title>Specification of the Exim Mail Transfer Agent</title>
14 <titleabbrev>The Exim MTA</titleabbrev>
15 <date>
16 08 Feb 2018
17 </date>
18 <author><firstname>Exim</firstname><surname>Maintainers</surname></author>
19 <authorinitials>EM</authorinitials>
20 <revhistory><revision>
21 <revnumber>4.90.1</revnumber>
22 <date>08 Feb 2018</date>
23   <authorinitials>EM</authorinitials>
24 </revision></revhistory>
25 <copyright><year>
26 2017
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 the program,
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.90.1 of Exim.
206 Substantive changes from the 4.89 edition are marked in some
207 renditions of the 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, the 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="http://www.uit.co.uk/exim-book/">http://www.uit.co.uk/exim-book/</ulink></emphasis>).
228 </para>
229 <para>
230 This 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 the program 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 the program (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 and web sites</title>
328 <para>
329 <indexterm role="concept">
330 <primary>web site</primary>
331 </indexterm>
332 <indexterm role="concept">
333 <primary>FTP site</primary>
334 </indexterm>
335 The primary site for Exim source distributions is currently the University of
336 Cambridge&#x2019;s FTP site, whose contents are described in <emphasis>Where to find the Exim
337 distribution</emphasis> below. In addition, there is a web site and an FTP site at
338 <option>exim.org</option>. These are now also hosted at the University of Cambridge. The
339 <option>exim.org</option> site was previously hosted for a number of years by Energis
340 Squared, formerly Planet Online Ltd, whose support I gratefully acknowledge.
341 </para>
342 <para>
343 <indexterm role="concept">
344 <primary>wiki</primary>
345 </indexterm>
346 <indexterm role="concept">
347 <primary>FAQ</primary>
348 </indexterm>
349 As well as Exim distribution tar files, the Exim web site contains a number of
350 differently formatted versions of the documentation. A recent addition to the
351 online information is the Exim wiki (<emphasis role="bold"><ulink url="http://wiki.exim.org">http://wiki.exim.org</ulink></emphasis>),
352 which contains what used to be a separate FAQ, as well as various other
353 examples, tips, and know-how that have been contributed by Exim users.
354 </para>
355 <para>
356 <indexterm role="concept">
357 <primary>Bugzilla</primary>
358 </indexterm>
359 An Exim Bugzilla exists at <emphasis role="bold"><ulink url="https://bugs.exim.org">https://bugs.exim.org</ulink></emphasis>. You can use
360 this to report bugs, and also to add items to the wish list. Please search
361 first to check that you are not duplicating a previous entry.
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="http://lists.alioth.debian.org/mailman/listinfo/pkg-exim4-users">http://lists.alioth.debian.org/mailman/listinfo/pkg-exim4-users</ulink></emphasis>
410 </literallayout>
411 <para>
412 Please ask Debian-specific questions on this 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>distribution</primary>
439 <secondary>ftp site</secondary>
440 </indexterm>
441 The master ftp site for the Exim distribution is
442 </para>
443 <literallayout>
444 <emphasis role="bold">ftp://ftp.exim.org/pub/exim</emphasis>
445 </literallayout>
446 <para>
447 The file references that follow are relative to the <filename>exim</filename> directories at
448 these sites. There are now quite a number of independent mirror sites around
449 the world. Those that I know about are listed in the file called <filename>Mirrors</filename>.
450 </para>
451 <para>
452 Within the <filename>exim</filename> directory there are subdirectories called <filename>exim3</filename> (for
453 previous Exim 3 distributions), <filename>exim4</filename> (for the latest Exim 4
454 distributions), and <filename>Testing</filename> for testing versions. In the <filename>exim4</filename>
455 subdirectory, the current release can always be found in files called
456 </para>
457 <literallayout>
458 <filename>exim-n.nn.tar.gz</filename>
459 <filename>exim-n.nn.tar.bz2</filename>
460 </literallayout>
461 <para>
462 where <emphasis>n.nn</emphasis> is the highest such version number in the directory. The two
463 files contain identical data; the only difference is the type of compression.
464 The <filename>.bz2</filename> file is usually a lot smaller than the <filename>.gz</filename> file.
465 </para>
466 <para>
467 <indexterm role="concept">
468 <primary>distribution</primary>
469 <secondary>signing details</secondary>
470 </indexterm>
471 <indexterm role="concept">
472 <primary>distribution</primary>
473 <secondary>public key</secondary>
474 </indexterm>
475 <indexterm role="concept">
476 <primary>public key for signed distribution</primary>
477 </indexterm>
478 The distributions will be PGP signed by an individual key of the Release
479 Coordinator.  This key will have a uid containing an email address in the
480 <emphasis>exim.org</emphasis> domain and will have signatures from other people, including
481 other Exim maintainers.  We expect that the key will be in the "strong set" of
482 PGP keys.  There should be a trust path to that key from Nigel Metheringham&#x2019;s
483 PGP key, a version of which can be found in the release directory in the file
484 <filename>nigel-pubkey.asc</filename>.  All keys used will be available in public keyserver pools,
485 such as <emphasis>pool.sks-keyservers.net</emphasis>.
486 </para>
487 <para>
488 At time of last update, releases were being made by Phil Pennock and signed with
489 key <emphasis>0x403043153903637F</emphasis>, although that key is expected to be replaced in 2013.
490 A trust path from Nigel&#x2019;s key to Phil&#x2019;s can be observed at
491 <emphasis role="bold"><ulink url="https://www.security.spodhuis.org/exim-trustpath">https://www.security.spodhuis.org/exim-trustpath</ulink></emphasis>.
492 </para>
493 <para>
494 Releases have also been authorized to be performed by Todd Lyons who signs with
495 key <emphasis>0xC4F4F94804D29EBA</emphasis>. A direct trust path exists between previous RE Phil
496 Pennock and Todd Lyons through a common associate.
497 </para>
498 <para>
499 The signatures for the tar bundles are in:
500 </para>
501 <literallayout>
502 <filename>exim-n.nn.tar.gz.asc</filename>
503 <filename>exim-n.nn.tar.bz2.asc</filename>
504 </literallayout>
505 <para>
506 For each released version, the log of changes is made separately available in a
507 separate file in the directory <filename>ChangeLogs</filename> so that it is possible to
508 find out what has changed without having to download the entire distribution.
509 </para>
510 <para>
511 <indexterm role="concept">
512 <primary>documentation</primary>
513 <secondary>available formats</secondary>
514 </indexterm>
515 The main distribution contains ASCII versions of this specification and other
516 documentation; other formats of the documents are available in separate files
517 inside the <filename>exim4</filename> directory of the FTP site:
518 </para>
519 <literallayout>
520 <filename>exim-html-n.nn.tar.gz</filename>
521 <filename>exim-pdf-n.nn.tar.gz</filename>
522 <filename>exim-postscript-n.nn.tar.gz</filename>
523 <filename>exim-texinfo-n.nn.tar.gz</filename>
524 </literallayout>
525 <para>
526 These tar files contain only the <filename>doc</filename> directory, not the complete
527 distribution, and are also available in <filename>.bz2</filename> as well as <filename>.gz</filename> forms.
528 </para>
529 </section>
530 <section id="SECID6">
531 <title>Limitations</title>
532 <itemizedlist>
533 <listitem>
534 <para>
535 <indexterm role="concept">
536 <primary>limitations of Exim</primary>
537 </indexterm>
538 <indexterm role="concept">
539 <primary>bang paths</primary>
540 <secondary>not handled by Exim</secondary>
541 </indexterm>
542 Exim is designed for use as an Internet MTA, and therefore handles addresses in
543 RFC 2822 domain format only. It cannot handle UUCP <quote>bang paths</quote>, though
544 simple two-component bang paths can be converted by a straightforward rewriting
545 configuration. This restriction does not prevent Exim from being interfaced to
546 UUCP as a transport mechanism, provided that domain addresses are used.
547 </para>
548 </listitem>
549 <listitem>
550 <para>
551 <indexterm role="concept">
552 <primary>domainless addresses</primary>
553 </indexterm>
554 <indexterm role="concept">
555 <primary>address</primary>
556 <secondary>without domain</secondary>
557 </indexterm>
558 Exim insists that every address it handles has a domain attached. For incoming
559 local messages, domainless addresses are automatically qualified with a
560 configured domain value. Configuration options specify from which remote
561 systems unqualified addresses are acceptable. These are then qualified on
562 arrival.
563 </para>
564 </listitem>
565 <listitem>
566 <para>
567 <indexterm role="concept">
568 <primary>transport</primary>
569 <secondary>external</secondary>
570 </indexterm>
571 <indexterm role="concept">
572 <primary>external transports</primary>
573 </indexterm>
574 The only external transport mechanisms that are currently implemented are SMTP
575 and LMTP over a TCP/IP network (including support for IPv6). However, a pipe
576 transport is available, and there are facilities for writing messages to files
577 and pipes, optionally in <emphasis>batched SMTP</emphasis> format; these facilities can be used
578 to send messages to other transport mechanisms such as UUCP, provided they can
579 handle domain-style addresses. Batched SMTP input is also catered for.
580 </para>
581 </listitem>
582 <listitem>
583 <para>
584 Exim is not designed for storing mail for dial-in hosts. When the volumes of
585 such mail are large, it is better to get the messages <quote>delivered</quote> into files
586 (that is, off Exim&#x2019;s queue) and subsequently passed on to the dial-in hosts by
587 other means.
588 </para>
589 </listitem>
590 <listitem>
591 <para>
592 Although Exim does have basic facilities for scanning incoming messages, these
593 are not comprehensive enough to do full virus or spam scanning. Such operations
594 are best carried out using additional specialized software packages. If you
595 compile Exim with the content-scanning extension, straightforward interfaces to
596 a number of common scanners are provided.
597 </para>
598 </listitem>
599 </itemizedlist>
600 </section>
601 <section id="SECID7">
602 <title>Run time configuration</title>
603 <para>
604 Exim&#x2019;s run time configuration is held in a single text file that is divided
605 into a number of sections. The entries in this file consist of keywords and
606 values, in the style of Smail 3 configuration files. A default configuration
607 file which is suitable for simple online installations is provided in the
608 distribution, and is described in chapter <xref linkend="CHAPdefconfil"/> below.
609 </para>
610 </section>
611 <section id="SECID8">
612 <title>Calling interface</title>
613 <para>
614 <indexterm role="concept">
615 <primary>Sendmail compatibility</primary>
616 <secondary>command line interface</secondary>
617 </indexterm>
618 Like many MTAs, Exim has adopted the Sendmail command line interface so that it
619 can be a straight replacement for <filename>/usr/lib/sendmail</filename> or
620 <filename>/usr/sbin/sendmail</filename> when sending mail, but you do not need to know anything
621 about Sendmail in order to run Exim. For actions other than sending messages,
622 Sendmail-compatible options also exist, but those that produce output (for
623 example, <option>-bp</option>, which lists the messages on the queue) do so in Exim&#x2019;s own
624 format. There are also some additional options that are compatible with Smail
625 3, and some further options that are new to Exim. Chapter <xref linkend="CHAPcommandline"/>
626 documents all Exim&#x2019;s command line options. This information is automatically
627 made into the man page that forms part of the Exim distribution.
628 </para>
629 <para>
630 Control of messages on the queue can be done via certain privileged command
631 line options. There is also an optional monitor program called <emphasis>eximon</emphasis>,
632 which displays current information in an X window, and which contains a menu
633 interface to Exim&#x2019;s command line administration options.
634 </para>
635 </section>
636 <section id="SECID9">
637 <title>Terminology</title>
638 <para>
639 <indexterm role="concept">
640 <primary>terminology definitions</primary>
641 </indexterm>
642 <indexterm role="concept">
643 <primary>body of message</primary>
644 <secondary>definition of</secondary>
645 </indexterm>
646 The <emphasis>body</emphasis> of a message is the actual data that the sender wants to transmit.
647 It is the last part of a message, and is separated from the <emphasis>header</emphasis> (see
648 below) by a blank line.
649 </para>
650 <para>
651 <indexterm role="concept">
652 <primary>bounce message</primary>
653 <secondary>definition of</secondary>
654 </indexterm>
655 When a message cannot be delivered, it is normally returned to the sender in a
656 delivery failure message or a <quote>non-delivery report</quote> (NDR). The term
657 <emphasis>bounce</emphasis> is commonly used for this action, and the error reports are often
658 called <emphasis>bounce messages</emphasis>. This is a convenient shorthand for <quote>delivery
659 failure error report</quote>. Such messages have an empty sender address in the
660 message&#x2019;s <emphasis>envelope</emphasis> (see below) to ensure that they cannot themselves give
661 rise to further bounce messages.
662 </para>
663 <para>
664 The term <emphasis>default</emphasis> appears frequently in this manual. It is used to qualify a
665 value which is used in the absence of any setting in the configuration. It may
666 also qualify an action which is taken unless a configuration setting specifies
667 otherwise.
668 </para>
669 <para>
670 The term <emphasis>defer</emphasis> is used when the delivery of a message to a specific
671 destination cannot immediately take place for some reason (a remote host may be
672 down, or a user&#x2019;s local mailbox may be full). Such deliveries are <emphasis>deferred</emphasis>
673 until a later time.
674 </para>
675 <para>
676 The word <emphasis>domain</emphasis> is sometimes used to mean all but the first component of a
677 host&#x2019;s name. It is <emphasis>not</emphasis> used in that sense here, where it normally refers to
678 the part of an email address following the @ sign.
679 </para>
680 <para>
681 <indexterm role="concept">
682 <primary>envelope, definition of</primary>
683 </indexterm>
684 <indexterm role="concept">
685 <primary>sender</primary>
686 <secondary>definition of</secondary>
687 </indexterm>
688 A message in transit has an associated <emphasis>envelope</emphasis>, as well as a header and a
689 body. The envelope contains a sender address (to which bounce messages should
690 be delivered), and any number of recipient addresses. References to the
691 sender or the recipients of a message usually mean the addresses in the
692 envelope. An MTA uses these addresses for delivery, and for returning bounce
693 messages, not the addresses that appear in the header lines.
694 </para>
695 <para>
696 <indexterm role="concept">
697 <primary>message</primary>
698 <secondary>header, definition of</secondary>
699 </indexterm>
700 <indexterm role="concept">
701 <primary>header section</primary>
702 <secondary>definition of</secondary>
703 </indexterm>
704 The <emphasis>header</emphasis> of a message is the first part of a message&#x2019;s text, consisting
705 of a number of lines, each of which has a name such as <emphasis>From:</emphasis>, <emphasis>To:</emphasis>,
706 <emphasis>Subject:</emphasis>, etc. Long header lines can be split over several text lines by
707 indenting the continuations. The header is separated from the body by a blank
708 line.
709 </para>
710 <para>
711 <indexterm role="concept">
712 <primary>local part</primary>
713 <secondary>definition of</secondary>
714 </indexterm>
715 <indexterm role="concept">
716 <primary>domain</primary>
717 <secondary>definition of</secondary>
718 </indexterm>
719 The term <emphasis>local part</emphasis>, which is taken from RFC 2822, is used to refer to that
720 part of an email address that precedes the @ sign. The part that follows the
721 @ sign is called the <emphasis>domain</emphasis> or <emphasis>mail domain</emphasis>.
722 </para>
723 <para>
724 <indexterm role="concept">
725 <primary>local delivery</primary>
726 <secondary>definition of</secondary>
727 </indexterm>
728 <indexterm role="concept">
729 <primary>remote delivery, definition of</primary>
730 </indexterm>
731 The terms <emphasis>local delivery</emphasis> and <emphasis>remote delivery</emphasis> are used to distinguish
732 delivery to a file or a pipe on the local host from delivery by SMTP over
733 TCP/IP to another host. As far as Exim is concerned, all hosts other than the
734 host it is running on are <emphasis>remote</emphasis>.
735 </para>
736 <para>
737 <indexterm role="concept">
738 <primary>return path</primary>
739 <secondary>definition of</secondary>
740 </indexterm>
741 <emphasis>Return path</emphasis> is another name that is used for the sender address in a
742 message&#x2019;s envelope.
743 </para>
744 <para>
745 <indexterm role="concept">
746 <primary>queue</primary>
747 <secondary>definition of</secondary>
748 </indexterm>
749 The term <emphasis>queue</emphasis> is used to refer to the set of messages awaiting delivery,
750 because this term is in widespread use in the context of MTAs. However, in
751 Exim&#x2019;s case the reality is more like a pool than a queue, because there is
752 normally no ordering of waiting messages.
753 </para>
754 <para>
755 <indexterm role="concept">
756 <primary>queue runner</primary>
757 <secondary>definition of</secondary>
758 </indexterm>
759 The term <emphasis>queue runner</emphasis> is used to describe a process that scans the queue
760 and attempts to deliver those messages whose retry times have come. This term
761 is used by other MTAs, and also relates to the command <option>runq</option>, but in Exim
762 the waiting messages are normally processed in an unpredictable order.
763 </para>
764 <para>
765 <indexterm role="concept">
766 <primary>spool directory</primary>
767 <secondary>definition of</secondary>
768 </indexterm>
769 The term <emphasis>spool directory</emphasis> is used for a directory in which Exim keeps the
770 messages on its queue &ndash; that is, those that it is in the process of
771 delivering. This should not be confused with the directory in which local
772 mailboxes are stored, which is called a <quote>spool directory</quote> by some people. In
773 the Exim documentation, <quote>spool</quote> is always used in the first sense.
774 </para>
775 </section>
776 </chapter>
777
778 <chapter id="CHID2">
779 <title>Incorporated code</title>
780 <para>
781 <indexterm role="concept">
782 <primary>incorporated code</primary>
783 </indexterm>
784 <indexterm role="concept">
785 <primary>regular expressions</primary>
786 <secondary>library</secondary>
787 </indexterm>
788 <indexterm role="concept">
789 <primary>PCRE</primary>
790 </indexterm>
791 <indexterm role="concept">
792 <primary>OpenDMARC</primary>
793 </indexterm>
794 A number of pieces of external code are included in the Exim distribution.
795 </para>
796 <itemizedlist>
797 <listitem>
798 <para>
799 Regular expressions are supported in the main Exim program and in the
800 Exim monitor using the freely-distributable PCRE library, copyright
801 &copy; University of Cambridge. The source to PCRE is no longer shipped with
802 Exim, so you will need to use the version of PCRE shipped with your system,
803 or obtain and install the full version of the library from
804 <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>.
805 </para>
806 </listitem>
807 <listitem>
808 <para>
809 <indexterm role="concept">
810 <primary>cdb</primary>
811 <secondary>acknowledgment</secondary>
812 </indexterm>
813 Support for the cdb (Constant DataBase) lookup method is provided by code
814 contributed by Nigel Metheringham of (at the time he contributed it) Planet
815 Online Ltd. The implementation is completely contained within the code of Exim.
816 It does not link against an external cdb library. The code contains the
817 following statements:
818 </para>
819 <blockquote>
820 <para>
821 Copyright &copy; 1998 Nigel Metheringham, Planet Online Ltd
822 </para>
823 <para>
824 This program is free software; you can redistribute it and/or modify it under
825 the terms of the GNU General Public License as published by the Free Software
826 Foundation; either version 2 of the License, or (at your option) any later
827 version.
828 This code implements Dan Bernstein&#x2019;s Constant DataBase (cdb) spec. Information,
829 the spec and sample code for cdb can be obtained from
830 <emphasis role="bold"><ulink url="http://www.pobox.com/~djb/cdb.html">http://www.pobox.com/~djb/cdb.html</ulink></emphasis>. This implementation borrows
831 some code from Dan Bernstein&#x2019;s implementation (which has no license
832 restrictions applied to it).
833 </para>
834 </blockquote>
835 </listitem>
836 <listitem>
837 <para>
838 <indexterm role="concept">
839 <primary>SPA authentication</primary>
840 </indexterm>
841 <indexterm role="concept">
842 <primary>Samba project</primary>
843 </indexterm>
844 <indexterm role="concept">
845 <primary>Microsoft Secure Password Authentication</primary>
846 </indexterm>
847 Client support for Microsoft&#x2019;s <emphasis>Secure Password Authentication</emphasis> is provided
848 by code contributed by Marc Prud&#x2019;hommeaux. Server support was contributed by
849 Tom Kistner. This includes code taken from the Samba project, which is released
850 under the Gnu GPL.
851 </para>
852 </listitem>
853 <listitem>
854 <para>
855 <indexterm role="concept">
856 <primary>Cyrus</primary>
857 </indexterm>
858 <indexterm role="concept">
859 <primary><emphasis>pwcheck</emphasis> daemon</primary>
860 </indexterm>
861 <indexterm role="concept">
862 <primary><emphasis>pwauthd</emphasis> daemon</primary>
863 </indexterm>
864 Support for calling the Cyrus <emphasis>pwcheck</emphasis> and <emphasis>saslauthd</emphasis> daemons is provided
865 by code taken from the Cyrus-SASL library and adapted by Alexander S.
866 Sabourenkov. The permission notice appears below, in accordance with the
867 conditions expressed therein.
868 </para>
869 <blockquote>
870 <para>
871 Copyright &copy; 2001 Carnegie Mellon University.  All rights reserved.
872 </para>
873 <para>
874 Redistribution and use in source and binary forms, with or without
875 modification, are permitted provided that the following conditions
876 are met:
877 </para>
878 <orderedlist numeration="arabic">
879 <listitem>
880 <para>
881 Redistributions of source code must retain the above copyright
882 notice, this list of conditions and the following disclaimer.
883 </para>
884 </listitem>
885 <listitem>
886 <para>
887 Redistributions in binary form must reproduce the above copyright
888 notice, this list of conditions and the following disclaimer in
889 the documentation and/or other materials provided with the
890 distribution.
891 </para>
892 </listitem>
893 <listitem>
894 <para>
895 The name <quote>Carnegie Mellon University</quote> must not be used to
896 endorse or promote products derived from this software without
897 prior written permission. For permission or any other legal
898 details, please contact
899 </para>
900 <literallayout>
901               Office of Technology Transfer
902               Carnegie Mellon University
903               5000 Forbes Avenue
904               Pittsburgh, PA  15213-3890
905               (412) 268-4387, fax: (412) 268-7395
906               tech-transfer@andrew.cmu.edu
907 </literallayout>
908 </listitem>
909 <listitem>
910 <para>
911 Redistributions of any form whatsoever must retain the following
912 acknowledgment:
913 </para>
914 <para>
915 <quote>This product includes software developed by Computing Services
916 at Carnegie Mellon University (<emphasis role="bold"><ulink url="http://www.cmu.edu/computing/">http://www.cmu.edu/computing/</ulink></emphasis>.</quote>
917 </para>
918 <para>
919 CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
920 THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
921 AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
922 FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
923 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
924 AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
925 OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
926 </para>
927 </listitem>
928 </orderedlist>
929 </blockquote>
930 </listitem>
931 <listitem>
932 <para>
933 <indexterm role="concept">
934 <primary>Exim monitor</primary>
935 <secondary>acknowledgment</secondary>
936 </indexterm>
937 <indexterm role="concept">
938 <primary>X-windows</primary>
939 </indexterm>
940 <indexterm role="concept">
941 <primary>Athena</primary>
942 </indexterm>
943 The Exim Monitor program, which is an X-Window application, includes
944 modified versions of the Athena StripChart and TextPop widgets.
945 This code is copyright by DEC and MIT, and their permission notice appears
946 below, in accordance with the conditions expressed therein.
947 </para>
948 <blockquote>
949 <para>
950 Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
951 and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
952 </para>
953 <para>
954 All Rights Reserved
955 </para>
956 <para>
957 Permission to use, copy, modify, and distribute this software and its
958 documentation for any purpose and without fee is hereby granted,
959 provided that the above copyright notice appear in all copies and that
960 both that copyright notice and this permission notice appear in
961 supporting documentation, and that the names of Digital or MIT not be
962 used in advertising or publicity pertaining to distribution of the
963 software without specific, written prior permission.
964 </para>
965 <para>
966 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
967 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
968 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
969 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
970 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
971 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
972 SOFTWARE.
973 </para>
974 </blockquote>
975 </listitem>
976 <listitem>
977 <para>
978 <indexterm role="concept">
979 <primary>opendmarc</primary>
980 <secondary>acknowledgment</secondary>
981 </indexterm>
982 The DMARC implementation uses the OpenDMARC library which is Copyrighted by
983 The Trusted Domain Project. Portions of Exim source which use OpenDMARC
984 derived code are indicated in the respective source files. The full OpenDMARC
985 license is provided in the LICENSE.opendmarc file contained in the distributed
986 source code.
987 </para>
988 </listitem>
989 <listitem>
990 <para>
991 Many people have contributed code fragments, some large, some small, that were
992 not covered by any specific licence requirements. It is assumed that the
993 contributors are happy to see their code incorporated into Exim under the GPL.
994 </para>
995 </listitem>
996 </itemizedlist>
997 </chapter>
998
999 <chapter id="CHID11">
1000 <title>How Exim receives and delivers mail</title>
1001 <titleabbrev>Receiving and delivering mail</titleabbrev>
1002 <section id="SECID10">
1003 <title>Overall philosophy</title>
1004 <para>
1005 <indexterm role="concept">
1006 <primary>design philosophy</primary>
1007 </indexterm>
1008 Exim is designed to work efficiently on systems that are permanently connected
1009 to the Internet and are handling a general mix of mail. In such circumstances,
1010 most messages can be delivered immediately. Consequently, Exim does not
1011 maintain independent queues of messages for specific domains or hosts, though
1012 it does try to send several messages in a single SMTP connection after a host
1013 has been down, and it also maintains per-host retry information.
1014 </para>
1015 </section>
1016 <section id="SECID11">
1017 <title>Policy control</title>
1018 <para>
1019 <indexterm role="concept">
1020 <primary>policy control</primary>
1021 <secondary>overview</secondary>
1022 </indexterm>
1023 Policy controls are now an important feature of MTAs that are connected to the
1024 Internet. Perhaps their most important job is to stop MTAs being abused as
1025 <quote>open relays</quote> by misguided individuals who send out vast amounts of
1026 unsolicited junk, and want to disguise its source. Exim provides flexible
1027 facilities for specifying policy controls on incoming mail:
1028 </para>
1029 <itemizedlist>
1030 <listitem>
1031 <para>
1032 <indexterm role="concept">
1033 <primary>access control lists (ACLs)</primary>
1034 <secondary>introduction</secondary>
1035 </indexterm>
1036 Exim 4 (unlike previous versions of Exim) implements policy controls on
1037 incoming mail by means of <emphasis>Access Control Lists</emphasis> (ACLs). Each list is a
1038 series of statements that may either grant or deny access. ACLs can be used at
1039 several places in the SMTP dialogue while receiving a message from a remote
1040 host. However, the most common places are after each RCPT command, and at the
1041 very end of the message. The sysadmin can specify conditions for accepting or
1042 rejecting individual recipients or the entire message, respectively, at these
1043 two points (see chapter <xref linkend="CHAPACL"/>). Denial of access results in an SMTP
1044 error code.
1045 </para>
1046 </listitem>
1047 <listitem>
1048 <para>
1049 An ACL is also available for locally generated, non-SMTP messages. In this
1050 case, the only available actions are to accept or deny the entire message.
1051 </para>
1052 </listitem>
1053 <listitem>
1054 <para>
1055 When Exim is compiled with the content-scanning extension, facilities are
1056 provided in the ACL mechanism for passing the message to external virus and/or
1057 spam scanning software. The result of such a scan is passed back to the ACL,
1058 which can then use it to decide what to do with the message.
1059 </para>
1060 </listitem>
1061 <listitem>
1062 <para>
1063 When a message has been received, either from a remote host or from the local
1064 host, but before the final acknowledgment has been sent, a locally supplied C
1065 function called <function>local_scan()</function> can be run to inspect the message and decide
1066 whether to accept it or not (see chapter <xref linkend="CHAPlocalscan"/>). If the message
1067 is accepted, the list of recipients can be modified by the function.
1068 </para>
1069 </listitem>
1070 <listitem>
1071 <para>
1072 Using the <function>local_scan()</function> mechanism is another way of calling external scanner
1073 software. The <option>SA-Exim</option> add-on package works this way. It does not require
1074 Exim to be compiled with the content-scanning extension.
1075 </para>
1076 </listitem>
1077 <listitem>
1078 <para>
1079 After a message has been accepted, a further checking mechanism is available in
1080 the form of the <emphasis>system filter</emphasis> (see chapter <xref linkend="CHAPsystemfilter"/>). This
1081 runs at the start of every delivery process.
1082 </para>
1083 </listitem>
1084 </itemizedlist>
1085 </section>
1086 <section id="SECID12">
1087 <title>User filters</title>
1088 <para>
1089 <indexterm role="concept">
1090 <primary>filter</primary>
1091 <secondary>introduction</secondary>
1092 </indexterm>
1093 <indexterm role="concept">
1094 <primary>Sieve filter</primary>
1095 </indexterm>
1096 In a conventional Exim configuration, users are able to run private filters by
1097 setting up appropriate <filename>.forward</filename> files in their home directories. See
1098 chapter <xref linkend="CHAPredirect"/> (about the <command>redirect</command> router) for the
1099 configuration needed to support this, and the separate document entitled
1100 <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis> for user details. Two different kinds
1101 of filtering are available:
1102 </para>
1103 <itemizedlist>
1104 <listitem>
1105 <para>
1106 Sieve filters are written in the standard filtering language that is defined
1107 by RFC 3028.
1108 </para>
1109 </listitem>
1110 <listitem>
1111 <para>
1112 Exim filters are written in a syntax that is unique to Exim, but which is more
1113 powerful than Sieve, which it pre-dates.
1114 </para>
1115 </listitem>
1116 </itemizedlist>
1117 <para>
1118 User filters are run as part of the routing process, described below.
1119 </para>
1120 </section>
1121 <section id="SECTmessiden">
1122 <title>Message identification</title>
1123 <para>
1124 <indexterm role="concept">
1125 <primary>message ids</primary>
1126 <secondary>details of format</secondary>
1127 </indexterm>
1128 <indexterm role="concept">
1129 <primary>format</primary>
1130 <secondary>of message id</secondary>
1131 </indexterm>
1132 <indexterm role="concept">
1133 <primary>id of message</primary>
1134 </indexterm>
1135 <indexterm role="concept">
1136 <primary>base62</primary>
1137 </indexterm>
1138 <indexterm role="concept">
1139 <primary>base36</primary>
1140 </indexterm>
1141 <indexterm role="concept">
1142 <primary>Darwin</primary>
1143 </indexterm>
1144 <indexterm role="concept">
1145 <primary>Cygwin</primary>
1146 </indexterm>
1147 Every message handled by Exim is given a <emphasis>message id</emphasis> which is sixteen
1148 characters long. It is divided into three parts, separated by hyphens, for
1149 example <literal>16VDhn-0001bo-D3</literal>. Each part is a sequence of letters and digits,
1150 normally encoding numbers in base 62. However, in the Darwin operating
1151 system (Mac OS X) and when Exim is compiled to run under Cygwin, base 36
1152 (avoiding the use of lower case letters) is used instead, because the message
1153 id is used to construct file names, and the names of files in those systems are
1154 not always case-sensitive.
1155 </para>
1156 <para>
1157 <indexterm role="concept">
1158 <primary>pid (process id)</primary>
1159 <secondary>re-use of</secondary>
1160 </indexterm>
1161 The detail of the contents of the message id have changed as Exim has evolved.
1162 Earlier versions relied on the operating system not re-using a process id (pid)
1163 within one second. On modern operating systems, this assumption can no longer
1164 be made, so the algorithm had to be changed. To retain backward compatibility,
1165 the format of the message id was retained, which is why the following rules are
1166 somewhat eccentric:
1167 </para>
1168 <itemizedlist>
1169 <listitem>
1170 <para>
1171 The first six characters of the message id are the time at which the message
1172 started to be received, to a granularity of one second. That is, this field
1173 contains the number of seconds since the start of the epoch (the normal Unix
1174 way of representing the date and time of day).
1175 </para>
1176 </listitem>
1177 <listitem>
1178 <para>
1179 After the first hyphen, the next six characters are the id of the process that
1180 received the message.
1181 </para>
1182 </listitem>
1183 <listitem>
1184 <para>
1185 There are two different possibilities for the final two characters:
1186 </para>
1187 <orderedlist numeration="arabic">
1188 <listitem>
1189 <para>
1190 <indexterm role="option">
1191 <primary><option>localhost_number</option></primary>
1192 </indexterm>
1193 If <option>localhost_number</option> is not set, this value is the fractional part of the
1194 time of reception, normally in units of 1/2000 of a second, but for systems
1195 that must use base 36 instead of base 62 (because of case-insensitive file
1196 systems), the units are 1/1000 of a second.
1197 </para>
1198 </listitem>
1199 <listitem>
1200 <para>
1201 If <option>localhost_number</option> is set, it is multiplied by 200 (100) and added to
1202 the fractional part of the time, which in this case is in units of 1/200
1203 (1/100) of a second.
1204 </para>
1205 </listitem>
1206 </orderedlist>
1207 </listitem>
1208 </itemizedlist>
1209 <para>
1210 After a message has been received, Exim waits for the clock to tick at the
1211 appropriate resolution before proceeding, so that if another message is
1212 received by the same process, or by another process with the same (re-used)
1213 pid, it is guaranteed that the time will be different. In most cases, the clock
1214 will already have ticked while the message was being received.
1215 </para>
1216 </section>
1217 <section id="SECID13">
1218 <title>Receiving mail</title>
1219 <para>
1220 <indexterm role="concept">
1221 <primary>receiving mail</primary>
1222 </indexterm>
1223 <indexterm role="concept">
1224 <primary>message</primary>
1225 <secondary>reception</secondary>
1226 </indexterm>
1227 The only way Exim can receive mail from another host is using SMTP over
1228 TCP/IP, in which case the sender and recipient addresses are transferred using
1229 SMTP commands. However, from a locally running process (such as a user&#x2019;s MUA),
1230 there are several possibilities:
1231 </para>
1232 <itemizedlist>
1233 <listitem>
1234 <para>
1235 If the process runs Exim with the <option>-bm</option> option, the message is read
1236 non-interactively (usually via a pipe), with the recipients taken from the
1237 command line, or from the body of the message if <option>-t</option> is also used.
1238 </para>
1239 </listitem>
1240 <listitem>
1241 <para>
1242 If the process runs Exim with the <option>-bS</option> option, the message is also read
1243 non-interactively, but in this case the recipients are listed at the start of
1244 the message in a series of SMTP RCPT commands, terminated by a DATA
1245 command. This is so-called <quote>batch SMTP</quote> format,
1246 but it isn&#x2019;t really SMTP. The SMTP commands are just another way of passing
1247 envelope addresses in a non-interactive submission.
1248 </para>
1249 </listitem>
1250 <listitem>
1251 <para>
1252 If the process runs Exim with the <option>-bs</option> option, the message is read
1253 interactively, using the SMTP protocol. A two-way pipe is normally used for
1254 passing data between the local process and the Exim process.
1255 This is <quote>real</quote> SMTP and is handled in the same way as SMTP over TCP/IP. For
1256 example, the ACLs for SMTP commands are used for this form of submission.
1257 </para>
1258 </listitem>
1259 <listitem>
1260 <para>
1261 A local process may also make a TCP/IP call to the host&#x2019;s loopback address
1262 (127.0.0.1) or any other of its IP addresses. When receiving messages, Exim
1263 does not treat the loopback address specially. It treats all such connections
1264 in the same way as connections from other hosts.
1265 </para>
1266 </listitem>
1267 </itemizedlist>
1268 <para>
1269 <indexterm role="concept">
1270 <primary>message sender, constructed by Exim</primary>
1271 </indexterm>
1272 <indexterm role="concept">
1273 <primary>sender</primary>
1274 <secondary>constructed by Exim</secondary>
1275 </indexterm>
1276 In the three cases that do not involve TCP/IP, the sender address is
1277 constructed from the login name of the user that called Exim and a default
1278 qualification domain (which can be set by the <option>qualify_domain</option> configuration
1279 option). For local or batch SMTP, a sender address that is passed using the
1280 SMTP MAIL command is ignored. However, the system administrator may allow
1281 certain users (<quote>trusted users</quote>) to specify a different sender address
1282 unconditionally, or all users to specify certain forms of different sender
1283 address. The <option>-f</option> option or the SMTP MAIL command is used to specify these
1284 different addresses. See section <xref linkend="SECTtrustedadmin"/> for details of trusted
1285 users, and the <option>untrusted_set_sender</option> option for a way of allowing untrusted
1286 users to change sender addresses.
1287 </para>
1288 <para>
1289 Messages received by either of the non-interactive mechanisms are subject to
1290 checking by the non-SMTP ACL, if one is defined. Messages received using SMTP
1291 (either over TCP/IP, or interacting with a local process) can be checked by a
1292 number of ACLs that operate at different times during the SMTP session. Either
1293 individual recipients, or the entire message, can be rejected if local policy
1294 requirements are not met. The <function>local_scan()</function> function (see chapter
1295 <xref linkend="CHAPlocalscan"/>) is run for all incoming messages.
1296 </para>
1297 <para>
1298 Exim can be configured not to start a delivery process when a message is
1299 received; this can be unconditional, or depend on the number of incoming SMTP
1300 connections or the system load. In these situations, new messages wait on the
1301 queue until a queue runner process picks them up. However, in standard
1302 configurations under normal conditions, delivery is started as soon as a
1303 message is received.
1304 </para>
1305 </section>
1306 <section id="SECID14">
1307 <title>Handling an incoming message</title>
1308 <para>
1309 <indexterm role="concept">
1310 <primary>spool directory</primary>
1311 <secondary>files that hold a message</secondary>
1312 </indexterm>
1313 <indexterm role="concept">
1314 <primary>file</primary>
1315 <secondary>how a message is held</secondary>
1316 </indexterm>
1317 When Exim accepts a message, it writes two files in its spool directory. The
1318 first contains the envelope information, the current status of the message, and
1319 the header lines, and the second contains the body of the message. The names of
1320 the two spool files consist of the message id, followed by <literal>-H</literal> for the
1321 file containing the envelope and header, and <literal>-D</literal> for the data file.
1322 </para>
1323 <para>
1324 <indexterm role="concept">
1325 <primary>spool directory</primary>
1326 <secondary><filename>input</filename> sub-directory</secondary>
1327 </indexterm>
1328 By default all these message files are held in a single directory called
1329 <filename>input</filename> inside the general Exim spool directory. Some operating systems do
1330 not perform very well if the number of files in a directory gets large; to
1331 improve performance in such cases, the <option>split_spool_directory</option> option can be
1332 used. This causes Exim to split up the input files into 62 sub-directories
1333 whose names are single letters or digits. When this is done, the queue is
1334 processed one sub-directory at a time instead of all at once, which can improve
1335 overall performance even when there are not enough files in each directory to
1336 affect file system performance.
1337 </para>
1338 <para>
1339 The envelope information consists of the address of the message&#x2019;s sender and
1340 the addresses of the recipients. This information is entirely separate from
1341 any addresses contained in the header lines. The status of the message includes
1342 a list of recipients who have already received the message. The format of the
1343 first spool file is described in chapter <xref linkend="CHAPspool"/>.
1344 </para>
1345 <para>
1346 <indexterm role="concept">
1347 <primary>rewriting</primary>
1348 <secondary>addresses</secondary>
1349 </indexterm>
1350 Address rewriting that is specified in the rewrite section of the configuration
1351 (see chapter <xref linkend="CHAPrewrite"/>) is done once and for all on incoming addresses,
1352 both in the header lines and the envelope, at the time the message is accepted.
1353 If during the course of delivery additional addresses are generated (for
1354 example, via aliasing), these new addresses are rewritten as soon as they are
1355 generated. At the time a message is actually delivered (transported) further
1356 rewriting can take place; because this is a transport option, it can be
1357 different for different forms of delivery. It is also possible to specify the
1358 addition or removal of certain header lines at the time the message is
1359 delivered (see chapters <xref linkend="CHAProutergeneric"/> and
1360 <xref linkend="CHAPtransportgeneric"/>).
1361 </para>
1362 </section>
1363 <section id="SECID15">
1364 <title>Life of a message</title>
1365 <para>
1366 <indexterm role="concept">
1367 <primary>message</primary>
1368 <secondary>life of</secondary>
1369 </indexterm>
1370 <indexterm role="concept">
1371 <primary>message</primary>
1372 <secondary>frozen</secondary>
1373 </indexterm>
1374 A message remains in the spool directory until it is completely delivered to
1375 its recipients or to an error address, or until it is deleted by an
1376 administrator or by the user who originally created it. In cases when delivery
1377 cannot proceed &ndash; for example, when a message can neither be delivered to its
1378 recipients nor returned to its sender, the message is marked <quote>frozen</quote> on the
1379 spool, and no more deliveries are attempted.
1380 </para>
1381 <para>
1382 <indexterm role="concept">
1383 <primary>frozen messages</primary>
1384 <secondary>thawing</secondary>
1385 </indexterm>
1386 <indexterm role="concept">
1387 <primary>message</primary>
1388 <secondary>thawing frozen</secondary>
1389 </indexterm>
1390 An administrator can <quote>thaw</quote> such messages when the problem has been
1391 corrected, and can also freeze individual messages by hand if necessary. In
1392 addition, an administrator can force a delivery error, causing a bounce message
1393 to be sent.
1394 </para>
1395 <para>
1396 <indexterm role="option">
1397 <primary><option>timeout_frozen_after</option></primary>
1398 </indexterm>
1399 <indexterm role="option">
1400 <primary><option>ignore_bounce_errors_after</option></primary>
1401 </indexterm>
1402 There are options called <option>ignore_bounce_errors_after</option> and
1403 <option>timeout_frozen_after</option>, which discard frozen messages after a certain time.
1404 The first applies only to frozen bounces, the second to any frozen messages.
1405 </para>
1406 <para>
1407 <indexterm role="concept">
1408 <primary>message</primary>
1409 <secondary>log file for</secondary>
1410 </indexterm>
1411 <indexterm role="concept">
1412 <primary>log</primary>
1413 <secondary>file for each message</secondary>
1414 </indexterm>
1415 While Exim is working on a message, it writes information about each delivery
1416 attempt to its main log file. This includes successful, unsuccessful, and
1417 delayed deliveries for each recipient (see chapter <xref linkend="CHAPlog"/>). The log
1418 lines are also written to a separate <emphasis>message log</emphasis> file for each message.
1419 These logs are solely for the benefit of the administrator, and are normally
1420 deleted along with the spool files when processing of a message is complete.
1421 The use of individual message logs can be disabled by setting
1422 <option>no_message_logs</option>; this might give an improvement in performance on very busy
1423 systems.
1424 </para>
1425 <para>
1426 <indexterm role="concept">
1427 <primary>journal file</primary>
1428 </indexterm>
1429 <indexterm role="concept">
1430 <primary>file</primary>
1431 <secondary>journal</secondary>
1432 </indexterm>
1433 All the information Exim itself needs to set up a delivery is kept in the first
1434 spool file, along with the header lines. When a successful delivery occurs, the
1435 address is immediately written at the end of a journal file, whose name is the
1436 message id followed by <literal>-J</literal>. At the end of a delivery run, if there are some
1437 addresses left to be tried again later, the first spool file (the <literal>-H</literal> file)
1438 is updated to indicate which these are, and the journal file is then deleted.
1439 Updating the spool file is done by writing a new file and renaming it, to
1440 minimize the possibility of data loss.
1441 </para>
1442 <para>
1443 Should the system or the program crash after a successful delivery but before
1444 the spool file has been updated, the journal is left lying around. The next
1445 time Exim attempts to deliver the message, it reads the journal file and
1446 updates the spool file before proceeding. This minimizes the chances of double
1447 deliveries caused by crashes.
1448 </para>
1449 </section>
1450 <section id="SECTprocaddress">
1451 <title>Processing an address for delivery</title>
1452 <para>
1453 <indexterm role="concept">
1454 <primary>drivers</primary>
1455 <secondary>definition of</secondary>
1456 </indexterm>
1457 <indexterm role="concept">
1458 <primary>router</primary>
1459 <secondary>definition of</secondary>
1460 </indexterm>
1461 <indexterm role="concept">
1462 <primary>transport</primary>
1463 <secondary>definition of</secondary>
1464 </indexterm>
1465 The main delivery processing elements of Exim are called <emphasis>routers</emphasis> and
1466 <emphasis>transports</emphasis>, and collectively these are known as <emphasis>drivers</emphasis>. Code for a
1467 number of them is provided in the source distribution, and compile-time options
1468 specify which ones are included in the binary. Run time options specify which
1469 ones are actually used for delivering messages.
1470 </para>
1471 <para>
1472 <indexterm role="concept">
1473 <primary>drivers</primary>
1474 <secondary>instance definition</secondary>
1475 </indexterm>
1476 Each driver that is specified in the run time configuration is an <emphasis>instance</emphasis>
1477 of that particular driver type. Multiple instances are allowed; for example,
1478 you can set up several different <command>smtp</command> transports, each with different
1479 option values that might specify different ports or different timeouts. Each
1480 instance has its own identifying name. In what follows we will normally use the
1481 instance name when discussing one particular instance (that is, one specific
1482 configuration of the driver), and the generic driver name when discussing
1483 the driver&#x2019;s features in general.
1484 </para>
1485 <para>
1486 A <emphasis>router</emphasis> is a driver that operates on an address, either determining how
1487 its delivery should happen, by assigning it to a specific transport, or
1488 converting the address into one or more new addresses (for example, via an
1489 alias file). A router may also explicitly choose to fail an address, causing it
1490 to be bounced.
1491 </para>
1492 <para>
1493 A <emphasis>transport</emphasis> is a driver that transmits a copy of the message from Exim&#x2019;s
1494 spool to some destination. There are two kinds of transport: for a <emphasis>local</emphasis>
1495 transport, the destination is a file or a pipe on the local host, whereas for a
1496 <emphasis>remote</emphasis> transport the destination is some other host. A message is passed
1497 to a specific transport as a result of successful routing. If a message has
1498 several recipients, it may be passed to a number of different transports.
1499 </para>
1500 <para>
1501 <indexterm role="concept">
1502 <primary>preconditions</primary>
1503 <secondary>definition of</secondary>
1504 </indexterm>
1505 An address is processed by passing it to each configured router instance in
1506 turn, subject to certain preconditions, until a router accepts the address or
1507 specifies that it should be bounced. We will describe this process in more
1508 detail shortly. First, as a simple example, we consider how each recipient
1509 address in a message is processed in a small configuration of three routers.
1510 </para>
1511 <para>
1512 To make this a more concrete example, it is described in terms of some actual
1513 routers, but remember, this is only an example. You can configure Exim&#x2019;s
1514 routers in many different ways, and there may be any number of routers in a
1515 configuration.
1516 </para>
1517 <para>
1518 The first router that is specified in a configuration is often one that handles
1519 addresses in domains that are not recognized specially by the local host. These
1520 are typically addresses for arbitrary domains on the Internet. A precondition
1521 is set up which looks for the special domains known to the host (for example,
1522 its own domain name), and the router is run for addresses that do <emphasis>not</emphasis>
1523 match. Typically, this is a router that looks up domains in the DNS in order to
1524 find the hosts to which this address routes. If it succeeds, the address is
1525 assigned to a suitable SMTP transport; if it does not succeed, the router is
1526 configured to fail the address.
1527 </para>
1528 <para>
1529 The second router is reached only when the domain is recognized as one that
1530 <quote>belongs</quote> to the local host. This router does redirection &ndash; also known as
1531 aliasing and forwarding. When it generates one or more new addresses from the
1532 original, each of them is routed independently from the start. Otherwise, the
1533 router may cause an address to fail, or it may simply decline to handle the
1534 address, in which case the address is passed to the next router.
1535 </para>
1536 <para>
1537 The final router in many configurations is one that checks to see if the
1538 address belongs to a local mailbox. The precondition may involve a check to
1539 see if the local part is the name of a login account, or it may look up the
1540 local part in a file or a database. If its preconditions are not met, or if
1541 the router declines, we have reached the end of the routers. When this happens,
1542 the address is bounced.
1543 </para>
1544 </section>
1545 <section id="SECID16">
1546 <title>Processing an address for verification</title>
1547 <para>
1548 <indexterm role="concept">
1549 <primary>router</primary>
1550 <secondary>for verification</secondary>
1551 </indexterm>
1552 <indexterm role="concept">
1553 <primary>verifying address</primary>
1554 <secondary>overview</secondary>
1555 </indexterm>
1556 As well as being used to decide how to deliver to an address, Exim&#x2019;s routers
1557 are also used for <emphasis>address verification</emphasis>. Verification can be requested as
1558 one of the checks to be performed in an ACL for incoming messages, on both
1559 sender and recipient addresses, and it can be tested using the <option>-bv</option> and
1560 <option>-bvs</option> command line options.
1561 </para>
1562 <para>
1563 When an address is being verified, the routers are run in <quote>verify mode</quote>. This
1564 does not affect the way the routers work, but it is a state that can be
1565 detected. By this means, a router can be skipped or made to behave differently
1566 when verifying. A common example is a configuration in which the first router
1567 sends all messages to a message-scanning program, unless they have been
1568 previously scanned. Thus, the first router accepts all addresses without any
1569 checking, making it useless for verifying. Normally, the <option>no_verify</option> option
1570 would be set for such a router, causing it to be skipped in verify mode.
1571 </para>
1572 </section>
1573 <section id="SECTrunindrou">
1574 <title>Running an individual router</title>
1575 <para>
1576 <indexterm role="concept">
1577 <primary>router</primary>
1578 <secondary>running details</secondary>
1579 </indexterm>
1580 <indexterm role="concept">
1581 <primary>preconditions</primary>
1582 <secondary>checking</secondary>
1583 </indexterm>
1584 <indexterm role="concept">
1585 <primary>router</primary>
1586 <secondary>result of running</secondary>
1587 </indexterm>
1588 As explained in the example above, a number of preconditions are checked before
1589 running a router. If any are not met, the router is skipped, and the address is
1590 passed to the next router. When all the preconditions on a router <emphasis>are</emphasis> met,
1591 the router is run. What happens next depends on the outcome, which is one of
1592 the following:
1593 </para>
1594 <itemizedlist>
1595 <listitem>
1596 <para>
1597 <emphasis>accept</emphasis>: The router accepts the address, and either assigns it to a
1598 transport, or generates one or more <quote>child</quote> addresses. Processing the
1599 original address ceases,
1600 <indexterm role="option">
1601 <primary><option>unseen</option></primary>
1602 </indexterm>
1603 unless the <option>unseen</option> option is set on the router. This option
1604 can be used to set up multiple deliveries with different routing (for example,
1605 for keeping archive copies of messages). When <option>unseen</option> is set, the address is
1606 passed to the next router. Normally, however, an <emphasis>accept</emphasis> return marks the
1607 end of routing.
1608 </para>
1609 <para>
1610 Any child addresses generated by the router are processed independently,
1611 starting with the first router by default. It is possible to change this by
1612 setting the <option>redirect_router</option> option to specify which router to start at for
1613 child addresses. Unlike <option>pass_router</option> (see below) the router specified by
1614 <option>redirect_router</option> may be anywhere in the router configuration.
1615 </para>
1616 </listitem>
1617 <listitem>
1618 <para>
1619 <emphasis>pass</emphasis>: The router recognizes the address, but cannot handle it itself. It
1620 requests that the address be passed to another router. By default the address
1621 is passed to the next router, but this can be changed by setting the
1622 <option>pass_router</option> option. However, (unlike <option>redirect_router</option>) the named router
1623 must be below the current router (to avoid loops).
1624 </para>
1625 </listitem>
1626 <listitem>
1627 <para>
1628 <emphasis>decline</emphasis>: The router declines to accept the address because it does not
1629 recognize it at all. By default, the address is passed to the next router, but
1630 this can be prevented by setting the <option>no_more</option> option. When <option>no_more</option> is
1631 set, all the remaining routers are skipped. In effect, <option>no_more</option> converts
1632 <emphasis>decline</emphasis> into <emphasis>fail</emphasis>.
1633 </para>
1634 </listitem>
1635 <listitem>
1636 <para>
1637 <emphasis>fail</emphasis>: The router determines that the address should fail, and queues it for
1638 the generation of a bounce message. There is no further processing of the
1639 original address unless <option>unseen</option> is set on the router.
1640 </para>
1641 </listitem>
1642 <listitem>
1643 <para>
1644 <emphasis>defer</emphasis>: The router cannot handle the address at the present time. (A
1645 database may be offline, or a DNS lookup may have timed out.) No further
1646 processing of the address happens in this delivery attempt. It is tried again
1647 next time the message is considered for delivery.
1648 </para>
1649 </listitem>
1650 <listitem>
1651 <para>
1652 <emphasis>error</emphasis>: There is some error in the router (for example, a syntax error in
1653 its configuration). The action is as for defer.
1654 </para>
1655 </listitem>
1656 </itemizedlist>
1657 <para>
1658 If an address reaches the end of the routers without having been accepted by
1659 any of them, it is bounced as unrouteable. The default error message in this
1660 situation is <quote>unrouteable address</quote>, but you can set your own message by
1661 making use of the <option>cannot_route_message</option> option. This can be set for any
1662 router; the value from the last router that <quote>saw</quote> the address is used.
1663 </para>
1664 <para>
1665 Sometimes while routing you want to fail a delivery when some conditions are
1666 met but others are not, instead of passing the address on for further routing.
1667 You can do this by having a second router that explicitly fails the delivery
1668 when the relevant conditions are met. The <command>redirect</command> router has a <quote>fail</quote>
1669 facility for this purpose.
1670 </para>
1671 </section>
1672 <section id="SECID17">
1673 <title>Duplicate addresses</title>
1674 <para>
1675 <indexterm role="concept">
1676 <primary>case of local parts</primary>
1677 </indexterm>
1678 <indexterm role="concept">
1679 <primary>address duplicate, discarding</primary>
1680 </indexterm>
1681 <indexterm role="concept">
1682 <primary>duplicate addresses</primary>
1683 </indexterm>
1684 Once routing is complete, Exim scans the addresses that are assigned to local
1685 and remote transports, and discards any duplicates that it finds. During this
1686 check, local parts are treated as case-sensitive. This happens only when
1687 actually delivering a message; when testing routers with <option>-bt</option>, all the
1688 routed addresses are shown.
1689 </para>
1690 </section>
1691 <section id="SECTrouprecon">
1692 <title>Router preconditions</title>
1693 <para>
1694 <indexterm role="concept">
1695 <primary>router</primary>
1696 <secondary>preconditions, order of processing</secondary>
1697 </indexterm>
1698 <indexterm role="concept">
1699 <primary>preconditions</primary>
1700 <secondary>order of processing</secondary>
1701 </indexterm>
1702 The preconditions that are tested for each router are listed below, in the
1703 order in which they are tested. The individual configuration options are
1704 described in more detail in chapter <xref linkend="CHAProutergeneric"/>.
1705 </para>
1706 <itemizedlist>
1707 <listitem>
1708 <para>
1709 The <option>local_part_prefix</option> and <option>local_part_suffix</option> options can specify that
1710 the local parts handled by the router may or must have certain prefixes and/or
1711 suffixes. If a mandatory affix (prefix or suffix) is not present, the router is
1712 skipped. These conditions are tested first. When an affix is present, it is
1713 removed from the local part before further processing, including the evaluation
1714 of any other conditions.
1715 </para>
1716 </listitem>
1717 <listitem>
1718 <para>
1719 Routers can be designated for use only when not verifying an address, that is,
1720 only when routing it for delivery (or testing its delivery routing). If the
1721 <option>verify</option> option is set false, the router is skipped when Exim is verifying an
1722 address.
1723 Setting the <option>verify</option> option actually sets two options, <option>verify_sender</option> and
1724 <option>verify_recipient</option>, which independently control the use of the router for
1725 sender and recipient verification. You can set these options directly if
1726 you want a router to be used for only one type of verification.
1727 Note that cutthrough delivery is classed as a recipient verification for this purpose.
1728 </para>
1729 </listitem>
1730 <listitem>
1731 <para>
1732 If the <option>address_test</option> option is set false, the router is skipped when Exim is
1733 run with the <option>-bt</option> option to test an address routing. This can be helpful
1734 when the first router sends all new messages to a scanner of some sort; it
1735 makes it possible to use <option>-bt</option> to test subsequent delivery routing without
1736 having to simulate the effect of the scanner.
1737 </para>
1738 </listitem>
1739 <listitem>
1740 <para>
1741 Routers can be designated for use only when verifying an address, as
1742 opposed to routing it for delivery. The <option>verify_only</option> option controls this.
1743 Again, cutthrough delivery counts as a verification.
1744 </para>
1745 </listitem>
1746 <listitem>
1747 <para>
1748 Individual routers can be explicitly skipped when running the routers to
1749 check an address given in the SMTP EXPN command (see the <option>expn</option> option).
1750 </para>
1751 </listitem>
1752 <listitem>
1753 <para>
1754 If the <option>domains</option> option is set, the domain of the address must be in the set
1755 of domains that it defines.
1756 </para>
1757 </listitem>
1758 <listitem>
1759 <para>
1760 <indexterm role="variable">
1761 <primary><varname>$local_part_prefix</varname></primary>
1762 </indexterm>
1763 <indexterm role="variable">
1764 <primary><varname>$local_part</varname></primary>
1765 </indexterm>
1766 <indexterm role="variable">
1767 <primary><varname>$local_part_suffix</varname></primary>
1768 </indexterm>
1769 If the <option>local_parts</option> option is set, the local part of the address must be in
1770 the set of local parts that it defines. If <option>local_part_prefix</option> or
1771 <option>local_part_suffix</option> is in use, the prefix or suffix is removed from the local
1772 part before this check. If you want to do precondition tests on local parts
1773 that include affixes, you can do so by using a <option>condition</option> option (see below)
1774 that uses the variables <varname>$local_part</varname>, <varname>$local_part_prefix</varname>, and
1775 <varname>$local_part_suffix</varname> as necessary.
1776 </para>
1777 </listitem>
1778 <listitem>
1779 <para>
1780 <indexterm role="variable">
1781 <primary><varname>$local_user_uid</varname></primary>
1782 </indexterm>
1783 <indexterm role="variable">
1784 <primary><varname>$local_user_gid</varname></primary>
1785 </indexterm>
1786 <indexterm role="variable">
1787 <primary><varname>$home</varname></primary>
1788 </indexterm>
1789 If the <option>check_local_user</option> option is set, the local part must be the name of
1790 an account on the local host. If this check succeeds, the uid and gid of the
1791 local user are placed in <varname>$local_user_uid</varname> and <varname>$local_user_gid</varname> and the
1792 user&#x2019;s home directory is placed in <varname>$home</varname>; these values can be used in the
1793 remaining preconditions.
1794 </para>
1795 </listitem>
1796 <listitem>
1797 <para>
1798 If the <option>router_home_directory</option> option is set, it is expanded at this point,
1799 because it overrides the value of <varname>$home</varname>. If this expansion were left till
1800 later, the value of <varname>$home</varname> as set by <option>check_local_user</option> would be used in
1801 subsequent tests. Having two different values of <varname>$home</varname> in the same router
1802 could lead to confusion.
1803 </para>
1804 </listitem>
1805 <listitem>
1806 <para>
1807 If the <option>senders</option> option is set, the envelope sender address must be in the
1808 set of addresses that it defines.
1809 </para>
1810 </listitem>
1811 <listitem>
1812 <para>
1813 If the <option>require_files</option> option is set, the existence or non-existence of
1814 specified files is tested.
1815 </para>
1816 </listitem>
1817 <listitem>
1818 <para>
1819 <indexterm role="concept">
1820 <primary>customizing</primary>
1821 <secondary>precondition</secondary>
1822 </indexterm>
1823 If the <option>condition</option> option is set, it is evaluated and tested. This option
1824 uses an expanded string to allow you to set up your own custom preconditions.
1825 Expanded strings are described in chapter <xref linkend="CHAPexpand"/>.
1826 </para>
1827 </listitem>
1828 </itemizedlist>
1829 <para>
1830 Note that <option>require_files</option> comes near the end of the list, so you cannot use
1831 it to check for the existence of a file in which to lookup up a domain, local
1832 part, or sender. However, as these options are all expanded, you can use the
1833 <option>exists</option> expansion condition to make such tests within each condition. The
1834 <option>require_files</option> option is intended for checking files that the router may be
1835 going to use internally, or which are needed by a specific transport (for
1836 example, <filename>.procmailrc</filename>).
1837 </para>
1838 </section>
1839 <section id="SECID18">
1840 <title>Delivery in detail</title>
1841 <para>
1842 <indexterm role="concept">
1843 <primary>delivery</primary>
1844 <secondary>in detail</secondary>
1845 </indexterm>
1846 When a message is to be delivered, the sequence of events is as follows:
1847 </para>
1848 <itemizedlist>
1849 <listitem>
1850 <para>
1851 If a system-wide filter file is specified, the message is passed to it. The
1852 filter may add recipients to the message, replace the recipients, discard the
1853 message, cause a new message to be generated, or cause the message delivery to
1854 fail. The format of the system filter file is the same as for Exim user filter
1855 files, described in the separate document entitled <emphasis>Exim&#x2019;s interfaces to mail
1856 filtering</emphasis>.
1857 <indexterm role="concept">
1858 <primary>Sieve filter</primary>
1859 <secondary>not available for system filter</secondary>
1860 </indexterm>
1861 (<emphasis role="bold">Note</emphasis>: Sieve cannot be used for system filter files.)
1862 </para>
1863 <para>
1864 Some additional features are available in system filters &ndash; see chapter
1865 <xref linkend="CHAPsystemfilter"/> for details. Note that a message is passed to the system
1866 filter only once per delivery attempt, however many recipients it has. However,
1867 if there are several delivery attempts because one or more addresses could not
1868 be immediately delivered, the system filter is run each time. The filter
1869 condition <option>first_delivery</option> can be used to detect the first run of the system
1870 filter.
1871 </para>
1872 </listitem>
1873 <listitem>
1874 <para>
1875 Each recipient address is offered to each configured router in turn, subject to
1876 its preconditions, until one is able to handle it. If no router can handle the
1877 address, that is, if they all decline, the address is failed. Because routers
1878 can be targeted at particular domains, several locally handled domains can be
1879 processed entirely independently of each other.
1880 </para>
1881 </listitem>
1882 <listitem>
1883 <para>
1884 <indexterm role="concept">
1885 <primary>routing</primary>
1886 <secondary>loops in</secondary>
1887 </indexterm>
1888 <indexterm role="concept">
1889 <primary>loop</primary>
1890 <secondary>while routing</secondary>
1891 </indexterm>
1892 A router that accepts an address may assign it to a local or a remote
1893 transport. However, the transport is not run at this time. Instead, the address
1894 is placed on a list for the particular transport, which will be run later.
1895 Alternatively, the router may generate one or more new addresses (typically
1896 from alias, forward, or filter files). New addresses are fed back into this
1897 process from the top, but in order to avoid loops, a router ignores any address
1898 which has an identically-named ancestor that was processed by itself.
1899 </para>
1900 </listitem>
1901 <listitem>
1902 <para>
1903 When all the routing has been done, addresses that have been successfully
1904 handled are passed to their assigned transports. When local transports are
1905 doing real local deliveries, they handle only one address at a time, but if a
1906 local transport is being used as a pseudo-remote transport (for example, to
1907 collect batched SMTP messages for transmission by some other means) multiple
1908 addresses can be handled. Remote transports can always handle more than one
1909 address at a time, but can be configured not to do so, or to restrict multiple
1910 addresses to the same domain.
1911 </para>
1912 </listitem>
1913 <listitem>
1914 <para>
1915 Each local delivery to a file or a pipe runs in a separate process under a
1916 non-privileged uid, and these deliveries are run one at a time. Remote
1917 deliveries also run in separate processes, normally under a uid that is private
1918 to Exim (<quote>the Exim user</quote>), but in this case, several remote deliveries can be
1919 run in parallel. The maximum number of simultaneous remote deliveries for any
1920 one message is set by the <option>remote_max_parallel</option> option.
1921 The order in which deliveries are done is not defined, except that all local
1922 deliveries happen before any remote deliveries.
1923 </para>
1924 </listitem>
1925 <listitem>
1926 <para>
1927 <indexterm role="concept">
1928 <primary>queue runner</primary>
1929 </indexterm>
1930 When it encounters a local delivery during a queue run, Exim checks its retry
1931 database to see if there has been a previous temporary delivery failure for the
1932 address before running the local transport. If there was a previous failure,
1933 Exim does not attempt a new delivery until the retry time for the address is
1934 reached. However, this happens only for delivery attempts that are part of a
1935 queue run. Local deliveries are always attempted when delivery immediately
1936 follows message reception, even if retry times are set for them. This makes for
1937 better behaviour if one particular message is causing problems (for example,
1938 causing quota overflow, or provoking an error in a filter file).
1939 </para>
1940 </listitem>
1941 <listitem>
1942 <para>
1943 <indexterm role="concept">
1944 <primary>delivery</primary>
1945 <secondary>retry in remote transports</secondary>
1946 </indexterm>
1947 Remote transports do their own retry handling, since an address may be
1948 deliverable to one of a number of hosts, each of which may have a different
1949 retry time. If there have been previous temporary failures and no host has
1950 reached its retry time, no delivery is attempted, whether in a queue run or
1951 not. See chapter <xref linkend="CHAPretry"/> for details of retry strategies.
1952 </para>
1953 </listitem>
1954 <listitem>
1955 <para>
1956 If there were any permanent errors, a bounce message is returned to an
1957 appropriate address (the sender in the common case), with details of the error
1958 for each failing address. Exim can be configured to send copies of bounce
1959 messages to other addresses.
1960 </para>
1961 </listitem>
1962 <listitem>
1963 <para>
1964 <indexterm role="concept">
1965 <primary>delivery</primary>
1966 <secondary>deferral</secondary>
1967 </indexterm>
1968 If one or more addresses suffered a temporary failure, the message is left on
1969 the queue, to be tried again later. Delivery of these addresses is said to be
1970 <emphasis>deferred</emphasis>.
1971 </para>
1972 </listitem>
1973 <listitem>
1974 <para>
1975 When all the recipient addresses have either been delivered or bounced,
1976 handling of the message is complete. The spool files and message log are
1977 deleted, though the message log can optionally be preserved if required.
1978 </para>
1979 </listitem>
1980 </itemizedlist>
1981 </section>
1982 <section id="SECID19">
1983 <title>Retry mechanism</title>
1984 <para>
1985 <indexterm role="concept">
1986 <primary>delivery</primary>
1987 <secondary>retry mechanism</secondary>
1988 </indexterm>
1989 <indexterm role="concept">
1990 <primary>retry</primary>
1991 <secondary>description of mechanism</secondary>
1992 </indexterm>
1993 <indexterm role="concept">
1994 <primary>queue runner</primary>
1995 </indexterm>
1996 Exim&#x2019;s mechanism for retrying messages that fail to get delivered at the first
1997 attempt is the queue runner process. You must either run an Exim daemon that
1998 uses the <option>-q</option> option with a time interval to start queue runners at regular
1999 intervals, or use some other means (such as <emphasis>cron</emphasis>) to start them. If you do
2000 not arrange for queue runners to be run, messages that fail temporarily at the
2001 first attempt will remain on your queue for ever. A queue runner process works
2002 its way through the queue, one message at a time, trying each delivery that has
2003 passed its retry time.
2004 You can run several queue runners at once.
2005 </para>
2006 <para>
2007 Exim uses a set of configured rules to determine when next to retry the failing
2008 address (see chapter <xref linkend="CHAPretry"/>). These rules also specify when Exim
2009 should give up trying to deliver to the address, at which point it generates a
2010 bounce message. If no retry rules are set for a particular host, address, and
2011 error combination, no retries are attempted, and temporary errors are treated
2012 as permanent.
2013 </para>
2014 </section>
2015 <section id="SECID20">
2016 <title>Temporary delivery failure</title>
2017 <para>
2018 <indexterm role="concept">
2019 <primary>delivery</primary>
2020 <secondary>temporary failure</secondary>
2021 </indexterm>
2022 There are many reasons why a message may not be immediately deliverable to a
2023 particular address. Failure to connect to a remote machine (because it, or the
2024 connection to it, is down) is one of the most common. Temporary failures may be
2025 detected during routing as well as during the transport stage of delivery.
2026 Local deliveries may be delayed if NFS files are unavailable, or if a mailbox
2027 is on a file system where the user is over quota. Exim can be configured to
2028 impose its own quotas on local mailboxes; where system quotas are set they will
2029 also apply.
2030 </para>
2031 <para>
2032 If a host is unreachable for a period of time, a number of messages may be
2033 waiting for it by the time it recovers, and sending them in a single SMTP
2034 connection is clearly beneficial. Whenever a delivery to a remote host is
2035 deferred,
2036 <indexterm role="concept">
2037 <primary>hints database</primary>
2038 <secondary>deferred deliveries</secondary>
2039 </indexterm>
2040 Exim makes a note in its hints database, and whenever a successful
2041 SMTP delivery has happened, it looks to see if any other messages are waiting
2042 for the same host. If any are found, they are sent over the same SMTP
2043 connection, subject to a configuration limit as to the maximum number in any
2044 one connection.
2045 </para>
2046 </section>
2047 <section id="SECID21">
2048 <title>Permanent delivery failure</title>
2049 <para>
2050 <indexterm role="concept">
2051 <primary>delivery</primary>
2052 <secondary>permanent failure</secondary>
2053 </indexterm>
2054 <indexterm role="concept">
2055 <primary>bounce message</primary>
2056 <secondary>when generated</secondary>
2057 </indexterm>
2058 When a message cannot be delivered to some or all of its intended recipients, a
2059 bounce message is generated. Temporary delivery failures turn into permanent
2060 errors when their timeout expires. All the addresses that fail in a given
2061 delivery attempt are listed in a single message. If the original message has
2062 many recipients, it is possible for some addresses to fail in one delivery
2063 attempt and others to fail subsequently, giving rise to more than one bounce
2064 message. The wording of bounce messages can be customized by the administrator.
2065 See chapter <xref linkend="CHAPemsgcust"/> for details.
2066 </para>
2067 <para>
2068 <indexterm role="concept">
2069 <primary><emphasis>X-Failed-Recipients:</emphasis> header line</primary>
2070 </indexterm>
2071 Bounce messages contain an <emphasis>X-Failed-Recipients:</emphasis> header line that lists the
2072 failed addresses, for the benefit of programs that try to analyse such messages
2073 automatically.
2074 </para>
2075 <para>
2076 <indexterm role="concept">
2077 <primary>bounce message</primary>
2078 <secondary>recipient of</secondary>
2079 </indexterm>
2080 A bounce message is normally sent to the sender of the original message, as
2081 obtained from the message&#x2019;s envelope. For incoming SMTP messages, this is the
2082 address given in the MAIL command. However, when an address is expanded via a
2083 forward or alias file, an alternative address can be specified for delivery
2084 failures of the generated addresses. For a mailing list expansion (see section
2085 <xref linkend="SECTmailinglists"/>) it is common to direct bounce messages to the manager
2086 of the list.
2087 </para>
2088 </section>
2089 <section id="SECID22">
2090 <title>Failures to deliver bounce messages</title>
2091 <para>
2092 <indexterm role="concept">
2093 <primary>bounce message</primary>
2094 <secondary>failure to deliver</secondary>
2095 </indexterm>
2096 If a bounce message (either locally generated or received from a remote host)
2097 itself suffers a permanent delivery failure, the message is left on the queue,
2098 but it is frozen, awaiting the attention of an administrator. There are options
2099 that can be used to make Exim discard such failed messages, or to keep them
2100 for only a short time (see <option>timeout_frozen_after</option> and
2101 <option>ignore_bounce_errors_after</option>).
2102 </para>
2103 </section>
2104 </chapter>
2105
2106 <chapter id="CHID3">
2107 <title>Building and installing Exim</title>
2108 <para>
2109 <indexterm role="concept" id="IIDbuex" class="startofrange">
2110 <primary>building Exim</primary>
2111 </indexterm>
2112 </para>
2113 <section id="SECID23">
2114 <title>Unpacking</title>
2115 <para>
2116 Exim is distributed as a gzipped or bzipped tar file which, when unpacked,
2117 creates a directory with the name of the current release (for example,
2118 <filename>exim-4.90.1</filename>) into which the following files are placed:
2119 </para>
2120 <informaltable frame="none">
2121 <tgroup cols="2" colsep="0" rowsep="0">
2122 <colspec colwidth="140pt" align="left"/>
2123 <colspec colwidth="254pt" align="left"/>
2124 <tbody>
2125 <row>
2126 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>ACKNOWLEDGMENTS</filename></entry>
2127 <entry>contains some acknowledgments</entry>
2128 </row>
2129 <row>
2130 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>CHANGES</filename></entry>
2131 <entry>contains a reference to where changes are documented</entry>
2132 </row>
2133 <row>
2134 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>LICENCE</filename></entry>
2135 <entry>the GNU General Public Licence</entry>
2136 </row>
2137 <row>
2138 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>Makefile</filename></entry>
2139 <entry>top-level make file</entry>
2140 </row>
2141 <row>
2142 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>NOTICE</filename></entry>
2143 <entry>conditions for the use of Exim</entry>
2144 </row>
2145 <row>
2146 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>README</filename></entry>
2147 <entry>list of files, directories and simple build instructions</entry>
2148 </row>
2149 </tbody>
2150 </tgroup>
2151 </informaltable>
2152 <para>
2153 Other files whose names begin with <filename>README</filename> may also be present. The
2154 following subdirectories are created:
2155 </para>
2156 <informaltable frame="none">
2157 <tgroup cols="2" colsep="0" rowsep="0">
2158 <colspec colwidth="140pt" align="left"/>
2159 <colspec colwidth="254pt" align="left"/>
2160 <tbody>
2161 <row>
2162 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>Local</filename></entry>
2163 <entry>an empty directory for local configuration files</entry>
2164 </row>
2165 <row>
2166 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>OS</filename></entry>
2167 <entry>OS-specific files</entry>
2168 </row>
2169 <row>
2170 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>doc</filename></entry>
2171 <entry>documentation files</entry>
2172 </row>
2173 <row>
2174 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>exim_monitor</filename></entry>
2175 <entry>source files for the Exim monitor</entry>
2176 </row>
2177 <row>
2178 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>scripts</filename></entry>
2179 <entry>scripts used in the build process</entry>
2180 </row>
2181 <row>
2182 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>src</filename></entry>
2183 <entry>remaining source files</entry>
2184 </row>
2185 <row>
2186 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>util</filename></entry>
2187 <entry>independent utilities</entry>
2188 </row>
2189 </tbody>
2190 </tgroup>
2191 </informaltable>
2192 <para>
2193 The main utility programs are contained in the <filename>src</filename> directory, and are built
2194 with the Exim binary. The <filename>util</filename> directory contains a few optional scripts
2195 that may be useful to some sites.
2196 </para>
2197 </section>
2198 <section id="SECID24">
2199 <title>Multiple machine architectures and operating systems</title>
2200 <para>
2201 <indexterm role="concept">
2202 <primary>building Exim</primary>
2203 <secondary>multiple OS/architectures</secondary>
2204 </indexterm>
2205 The building process for Exim is arranged to make it easy to build binaries for
2206 a number of different architectures and operating systems from the same set of
2207 source files. Compilation does not take place in the <filename>src</filename> directory.
2208 Instead, a <emphasis>build directory</emphasis> is created for each architecture and operating
2209 system.
2210 <indexterm role="concept">
2211 <primary>symbolic link</primary>
2212 <secondary>to build directory</secondary>
2213 </indexterm>
2214 Symbolic links to the sources are installed in this directory, which is where
2215 the actual building takes place. In most cases, Exim can discover the machine
2216 architecture and operating system for itself, but the defaults can be
2217 overridden if necessary.
2218 <indexterm role="concept">
2219 <primary>compiler</primary>
2220 <secondary>requirements</secondary>
2221 </indexterm>
2222 <indexterm role="concept">
2223 <primary>compiler</primary>
2224 <secondary>version</secondary>
2225 </indexterm>
2226 A C99-capable compiler will be required for the build.
2227 </para>
2228 </section>
2229 <section id="SECTpcre">
2230 <title>PCRE library</title>
2231 <para>
2232 <indexterm role="concept">
2233 <primary>PCRE library</primary>
2234 </indexterm>
2235 Exim no longer has an embedded PCRE library as the vast majority of
2236 modern systems include PCRE as a system library, although you may need
2237 to install the PCRE or PCRE development package for your operating
2238 system. If your system has a normal PCRE installation the Exim build
2239 process will need no further configuration. If the library or the
2240 headers are in an unusual location you will need to either set the PCRE_LIBS
2241 and INCLUDE directives appropriately,
2242 or set PCRE_CONFIG=yes to use the installed <command>pcre-config</command> command.
2243 If your operating system has no
2244 PCRE support then you will need to obtain and build the current PCRE
2245 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>.
2246 More information on PCRE is available at <emphasis role="bold"><ulink url="http://www.pcre.org/">http://www.pcre.org/</ulink></emphasis>.
2247 </para>
2248 </section>
2249 <section id="SECTdb">
2250 <title>DBM libraries</title>
2251 <para>
2252 <indexterm role="concept">
2253 <primary>DBM libraries</primary>
2254 <secondary>discussion of</secondary>
2255 </indexterm>
2256 <indexterm role="concept">
2257 <primary>hints database</primary>
2258 <secondary>DBM files used for</secondary>
2259 </indexterm>
2260 Even if you do not use any DBM files in your configuration, Exim still needs a
2261 DBM library in order to operate, because it uses indexed files for its hints
2262 databases. Unfortunately, there are a number of DBM libraries in existence, and
2263 different operating systems often have different ones installed.
2264 </para>
2265 <para>
2266 <indexterm role="concept">
2267 <primary>Solaris</primary>
2268 <secondary>DBM library for</secondary>
2269 </indexterm>
2270 <indexterm role="concept">
2271 <primary>IRIX, DBM library for</primary>
2272 </indexterm>
2273 <indexterm role="concept">
2274 <primary>BSD, DBM library for</primary>
2275 </indexterm>
2276 <indexterm role="concept">
2277 <primary>Linux, DBM library for</primary>
2278 </indexterm>
2279 If you are using Solaris, IRIX, one of the modern BSD systems, or a modern
2280 Linux distribution, the DBM configuration should happen automatically, and you
2281 may be able to ignore this section. Otherwise, you may have to learn more than
2282 you would like about DBM libraries from what follows.
2283 </para>
2284 <para>
2285 <indexterm role="concept">
2286 <primary><emphasis>ndbm</emphasis> DBM library</primary>
2287 </indexterm>
2288 Licensed versions of Unix normally contain a library of DBM functions operating
2289 via the <emphasis>ndbm</emphasis> interface, and this is what Exim expects by default. Free
2290 versions of Unix seem to vary in what they contain as standard. In particular,
2291 some early versions of Linux have no default DBM library, and different
2292 distributors have chosen to bundle different libraries with their packaged
2293 versions. However, the more recent releases seem to have standardized on the
2294 Berkeley DB library.
2295 </para>
2296 <para>
2297 Different DBM libraries have different conventions for naming the files they
2298 use. When a program opens a file called <filename>dbmfile</filename>, there are several
2299 possibilities:
2300 </para>
2301 <orderedlist numeration="arabic">
2302 <listitem>
2303 <para>
2304 A traditional <emphasis>ndbm</emphasis> implementation, such as that supplied as part of
2305 Solaris, operates on two files called <filename>dbmfile.dir</filename> and <filename>dbmfile.pag</filename>.
2306 </para>
2307 </listitem>
2308 <listitem>
2309 <para>
2310 <indexterm role="concept">
2311 <primary><emphasis>gdbm</emphasis> DBM library</primary>
2312 </indexterm>
2313 The GNU library, <emphasis>gdbm</emphasis>, operates on a single file. If used via its <emphasis>ndbm</emphasis>
2314 compatibility interface it makes two different hard links to it with names
2315 <filename>dbmfile.dir</filename> and <filename>dbmfile.pag</filename>, but if used via its native interface, the
2316 file name is used unmodified.
2317 </para>
2318 </listitem>
2319 <listitem>
2320 <para>
2321 <indexterm role="concept">
2322 <primary>Berkeley DB library</primary>
2323 </indexterm>
2324 The Berkeley DB package, if called via its <emphasis>ndbm</emphasis> compatibility interface,
2325 operates on a single file called <filename>dbmfile.db</filename>, but otherwise looks to the
2326 programmer exactly the same as the traditional <emphasis>ndbm</emphasis> implementation.
2327 </para>
2328 </listitem>
2329 <listitem>
2330 <para>
2331 If the Berkeley package is used in its native mode, it operates on a single
2332 file called <filename>dbmfile</filename>; the programmer&#x2019;s interface is somewhat different to
2333 the traditional <emphasis>ndbm</emphasis> interface.
2334 </para>
2335 </listitem>
2336 <listitem>
2337 <para>
2338 To complicate things further, there are several very different versions of the
2339 Berkeley DB package. Version 1.85 was stable for a very long time, releases
2340 2.<emphasis>x</emphasis> and 3.<emphasis>x</emphasis> were current for a while, but the latest versions are now
2341 numbered 4.<emphasis>x</emphasis>. Maintenance of some of the earlier releases has ceased. All
2342 versions of Berkeley DB can be obtained from
2343 <emphasis role="bold"><ulink url="http://www.sleepycat.com/">http://www.sleepycat.com/</ulink></emphasis>.
2344 </para>
2345 </listitem>
2346 <listitem>
2347 <para>
2348 <indexterm role="concept">
2349 <primary><emphasis>tdb</emphasis> DBM library</primary>
2350 </indexterm>
2351 Yet another DBM library, called <emphasis>tdb</emphasis>, is available from
2352 <emphasis role="bold"><ulink url="http://download.sourceforge.net/tdb">http://download.sourceforge.net/tdb</ulink></emphasis>. It has its own interface, and also
2353 operates on a single file.
2354 </para>
2355 </listitem>
2356 </orderedlist>
2357 <para>
2358 <indexterm role="concept">
2359 <primary>USE_DB</primary>
2360 </indexterm>
2361 <indexterm role="concept">
2362 <primary>DBM libraries</primary>
2363 <secondary>configuration for building</secondary>
2364 </indexterm>
2365 Exim and its utilities can be compiled to use any of these interfaces. In order
2366 to use any version of the Berkeley DB package in native mode, you must set
2367 USE_DB in an appropriate configuration file (typically
2368 <filename>Local/Makefile</filename>). For example:
2369 </para>
2370 <literallayout class="monospaced">
2371 USE_DB=yes
2372 </literallayout>
2373 <para>
2374 Similarly, for gdbm you set USE_GDBM, and for tdb you set USE_TDB. An
2375 error is diagnosed if you set more than one of these.
2376 </para>
2377 <para>
2378 At the lowest level, the build-time configuration sets none of these options,
2379 thereby assuming an interface of type (1). However, some operating system
2380 configuration files (for example, those for the BSD operating systems and
2381 Linux) assume type (4) by setting USE_DB as their default, and the
2382 configuration files for Cygwin set USE_GDBM. Anything you set in
2383 <filename>Local/Makefile</filename>, however, overrides these system defaults.
2384 </para>
2385 <para>
2386 As well as setting USE_DB, USE_GDBM, or USE_TDB, it may also be
2387 necessary to set DBMLIB, to cause inclusion of the appropriate library, as
2388 in one of these lines:
2389 </para>
2390 <literallayout class="monospaced">
2391 DBMLIB = -ldb
2392 DBMLIB = -ltdb
2393 </literallayout>
2394 <para>
2395 Settings like that will work if the DBM library is installed in the standard
2396 place. Sometimes it is not, and the library&#x2019;s header file may also not be in
2397 the default path. You may need to set INCLUDE to specify where the header
2398 file is, and to specify the path to the library more fully in DBMLIB, as in
2399 this example:
2400 </para>
2401 <literallayout class="monospaced">
2402 INCLUDE=-I/usr/local/include/db-4.1
2403 DBMLIB=/usr/local/lib/db-4.1/libdb.a
2404 </literallayout>
2405 <para>
2406 There is further detailed discussion about the various DBM libraries in the
2407 file <filename>doc/dbm.discuss.txt</filename> in the Exim distribution.
2408 </para>
2409 </section>
2410 <section id="SECID25">
2411 <title>Pre-building configuration</title>
2412 <para>
2413 <indexterm role="concept">
2414 <primary>building Exim</primary>
2415 <secondary>pre-building configuration</secondary>
2416 </indexterm>
2417 <indexterm role="concept">
2418 <primary>configuration for building Exim</primary>
2419 </indexterm>
2420 <indexterm role="concept">
2421 <primary><filename>Local/Makefile</filename></primary>
2422 </indexterm>
2423 <indexterm role="concept">
2424 <primary><filename>src/EDITME</filename></primary>
2425 </indexterm>
2426 Before building Exim, a local configuration file that specifies options
2427 independent of any operating system has to be created with the name
2428 <filename>Local/Makefile</filename>. A template for this file is supplied as the file
2429 <filename>src/EDITME</filename>, and it contains full descriptions of all the option settings
2430 therein. These descriptions are therefore not repeated here. If you are
2431 building Exim for the first time, the simplest thing to do is to copy
2432 <filename>src/EDITME</filename> to <filename>Local/Makefile</filename>, then read it and edit it appropriately.
2433 </para>
2434 <para>
2435 There are three settings that you must supply, because Exim will not build
2436 without them. They are the location of the run time configuration file
2437 (CONFIGURE_FILE), the directory in which Exim binaries will be installed
2438 (BIN_DIRECTORY), and the identity of the Exim user (EXIM_USER and
2439 maybe EXIM_GROUP as well). The value of CONFIGURE_FILE can in fact be
2440 a colon-separated list of file names; Exim uses the first of them that exists.
2441 </para>
2442 <para>
2443 There are a few other parameters that can be specified either at build time or
2444 at run time, to enable the same binary to be used on a number of different
2445 machines. However, if the locations of Exim&#x2019;s spool directory and log file
2446 directory (if not within the spool directory) are fixed, it is recommended that
2447 you specify them in <filename>Local/Makefile</filename> instead of at run time, so that errors
2448 detected early in Exim&#x2019;s execution (such as a malformed configuration file) can
2449 be logged.
2450 </para>
2451 <para>
2452 <indexterm role="concept">
2453 <primary>content scanning</primary>
2454 <secondary>specifying at build time</secondary>
2455 </indexterm>
2456 Exim&#x2019;s interfaces for calling virus and spam scanning software directly from
2457 access control lists are not compiled by default. If you want to include these
2458 facilities, you need to set
2459 </para>
2460 <literallayout class="monospaced">
2461 WITH_CONTENT_SCAN=yes
2462 </literallayout>
2463 <para>
2464 in your <filename>Local/Makefile</filename>. For details of the facilities themselves, see
2465 chapter <xref linkend="CHAPexiscan"/>.
2466 </para>
2467 <para>
2468 <indexterm role="concept">
2469 <primary><filename>Local/eximon.conf</filename></primary>
2470 </indexterm>
2471 <indexterm role="concept">
2472 <primary><filename>exim_monitor/EDITME</filename></primary>
2473 </indexterm>
2474 If you are going to build the Exim monitor, a similar configuration process is
2475 required. The file <filename>exim_monitor/EDITME</filename> must be edited appropriately for
2476 your installation and saved under the name <filename>Local/eximon.conf</filename>. If you are
2477 happy with the default settings described in <filename>exim_monitor/EDITME</filename>,
2478 <filename>Local/eximon.conf</filename> can be empty, but it must exist.
2479 </para>
2480 <para>
2481 This is all the configuration that is needed in straightforward cases for known
2482 operating systems. However, the building process is set up so that it is easy
2483 to override options that are set by default or by operating-system-specific
2484 configuration files, for example to change the name of the C compiler, which
2485 defaults to <option>gcc</option>. See section <xref linkend="SECToverride"/> below for details of how to
2486 do this.
2487 </para>
2488 </section>
2489 <section id="SECID26">
2490 <title>Support for iconv()</title>
2491 <para>
2492 <indexterm role="concept">
2493 <primary><function>iconv()</function> support</primary>
2494 </indexterm>
2495 <indexterm role="concept">
2496 <primary>RFC 2047</primary>
2497 </indexterm>
2498 The contents of header lines in messages may be encoded according to the rules
2499 described RFC 2047. This makes it possible to transmit characters that are not
2500 in the ASCII character set, and to label them as being in a particular
2501 character set. When Exim is inspecting header lines by means of the <option>$h_</option>
2502 mechanism, it decodes them, and translates them into a specified character set
2503 (default is set at build time). The translation is possible only if the operating system
2504 supports the <function>iconv()</function> function.
2505 </para>
2506 <para>
2507 However, some of the operating systems that supply <function>iconv()</function> do not support
2508 very many conversions. The GNU <option>libiconv</option> library (available from
2509 <emphasis role="bold"><ulink url="http://www.gnu.org/software/libiconv/">http://www.gnu.org/software/libiconv/</ulink></emphasis>) can be installed on such
2510 systems to remedy this deficiency, as well as on systems that do not supply
2511 <function>iconv()</function> at all. After installing <option>libiconv</option>, you should add
2512 </para>
2513 <literallayout class="monospaced">
2514 HAVE_ICONV=yes
2515 </literallayout>
2516 <para>
2517 to your <filename>Local/Makefile</filename> and rebuild Exim.
2518 </para>
2519 </section>
2520 <section id="SECTinctlsssl">
2521 <title>Including TLS/SSL encryption support</title>
2522 <para>
2523 <indexterm role="concept">
2524 <primary>TLS</primary>
2525 <secondary>including support for TLS</secondary>
2526 </indexterm>
2527 <indexterm role="concept">
2528 <primary>encryption</primary>
2529 <secondary>including support for</secondary>
2530 </indexterm>
2531 <indexterm role="concept">
2532 <primary>SUPPORT_TLS</primary>
2533 </indexterm>
2534 <indexterm role="concept">
2535 <primary>OpenSSL</primary>
2536 <secondary>building Exim with</secondary>
2537 </indexterm>
2538 <indexterm role="concept">
2539 <primary>GnuTLS</primary>
2540 <secondary>building Exim with</secondary>
2541 </indexterm>
2542 Exim can be built to support encrypted SMTP connections, using the STARTTLS
2543 command as per RFC 2487. It can also support legacy clients that expect to
2544 start a TLS session immediately on connection to a non-standard port (see the
2545 <option>tls_on_connect_ports</option> runtime option and the <option>-tls-on-connect</option> command
2546 line option).
2547 </para>
2548 <para>
2549 If you want to build Exim with TLS support, you must first install either the
2550 OpenSSL or GnuTLS library. There is no cryptographic code in Exim itself for
2551 implementing SSL.
2552 </para>
2553 <para>
2554 If OpenSSL is installed, you should set
2555 </para>
2556 <literallayout class="monospaced">
2557 SUPPORT_TLS=yes
2558 TLS_LIBS=-lssl -lcrypto
2559 </literallayout>
2560 <para>
2561 in <filename>Local/Makefile</filename>. You may also need to specify the locations of the
2562 OpenSSL library and include files. For example:
2563 </para>
2564 <literallayout class="monospaced">
2565 SUPPORT_TLS=yes
2566 TLS_LIBS=-L/usr/local/openssl/lib -lssl -lcrypto
2567 TLS_INCLUDE=-I/usr/local/openssl/include/
2568 </literallayout>
2569 <para>
2570 <indexterm role="concept">
2571 <primary>pkg-config</primary>
2572 <secondary>OpenSSL</secondary>
2573 </indexterm>
2574 If you have <emphasis>pkg-config</emphasis> available, then instead you can just use:
2575 </para>
2576 <literallayout class="monospaced">
2577 SUPPORT_TLS=yes
2578 USE_OPENSSL_PC=openssl
2579 </literallayout>
2580 <para>
2581 <indexterm role="concept">
2582 <primary>USE_GNUTLS</primary>
2583 </indexterm>
2584 If GnuTLS is installed, you should set
2585 </para>
2586 <literallayout class="monospaced">
2587 SUPPORT_TLS=yes
2588 USE_GNUTLS=yes
2589 TLS_LIBS=-lgnutls -ltasn1 -lgcrypt
2590 </literallayout>
2591 <para>
2592 in <filename>Local/Makefile</filename>, and again you may need to specify the locations of the
2593 library and include files. For example:
2594 </para>
2595 <literallayout class="monospaced">
2596 SUPPORT_TLS=yes
2597 USE_GNUTLS=yes
2598 TLS_LIBS=-L/usr/gnu/lib -lgnutls -ltasn1 -lgcrypt
2599 TLS_INCLUDE=-I/usr/gnu/include
2600 </literallayout>
2601 <para>
2602 <indexterm role="concept">
2603 <primary>pkg-config</primary>
2604 <secondary>GnuTLS</secondary>
2605 </indexterm>
2606 If you have <emphasis>pkg-config</emphasis> available, then instead you can just use:
2607 </para>
2608 <literallayout class="monospaced">
2609 SUPPORT_TLS=yes
2610 USE_GNUTLS=yes
2611 USE_GNUTLS_PC=gnutls
2612 </literallayout>
2613 <para>
2614 You do not need to set TLS_INCLUDE if the relevant directory is already
2615 specified in INCLUDE. Details of how to configure Exim to make use of TLS are
2616 given in chapter <xref linkend="CHAPTLS"/>.
2617 </para>
2618 </section>
2619 <section id="SECID27">
2620 <title>Use of tcpwrappers</title>
2621 <para>
2622 <indexterm role="concept">
2623 <primary>tcpwrappers, building Exim to support</primary>
2624 </indexterm>
2625 <indexterm role="concept">
2626 <primary>USE_TCP_WRAPPERS</primary>
2627 </indexterm>
2628 <indexterm role="concept">
2629 <primary>TCP_WRAPPERS_DAEMON_NAME</primary>
2630 </indexterm>
2631 <indexterm role="concept">
2632 <primary>tcp_wrappers_daemon_name</primary>
2633 </indexterm>
2634 Exim can be linked with the <emphasis>tcpwrappers</emphasis> library in order to check incoming
2635 SMTP calls using the <emphasis>tcpwrappers</emphasis> control files. This may be a convenient
2636 alternative to Exim&#x2019;s own checking facilities for installations that are
2637 already making use of <emphasis>tcpwrappers</emphasis> for other purposes. To do this, you
2638 should set USE_TCP_WRAPPERS in <filename>Local/Makefile</filename>, arrange for the file
2639 <filename>tcpd.h</filename> to be available at compile time, and also ensure that the library
2640 <filename>libwrap.a</filename> is available at link time, typically by including <option>-lwrap</option> in
2641 EXTRALIBS_EXIM. For example, if <emphasis>tcpwrappers</emphasis> is installed in <filename>/usr/local</filename>,
2642 you might have
2643 </para>
2644 <literallayout class="monospaced">
2645 USE_TCP_WRAPPERS=yes
2646 CFLAGS=-O -I/usr/local/include
2647 EXTRALIBS_EXIM=-L/usr/local/lib -lwrap
2648 </literallayout>
2649 <para>
2650 in <filename>Local/Makefile</filename>. The daemon name to use in the <emphasis>tcpwrappers</emphasis> control
2651 files is <quote>exim</quote>. For example, the line
2652 </para>
2653 <literallayout class="monospaced">
2654 exim : LOCAL  192.168.1.  .friendly.domain.example
2655 </literallayout>
2656 <para>
2657 in your <filename>/etc/hosts.allow</filename> file allows connections from the local host, from
2658 the subnet 192.168.1.0/24, and from all hosts in <emphasis>friendly.domain.example</emphasis>.
2659 All other connections are denied. The daemon name used by <emphasis>tcpwrappers</emphasis>
2660 can be changed at build time by setting TCP_WRAPPERS_DAEMON_NAME in
2661 <filename>Local/Makefile</filename>, or by setting tcp_wrappers_daemon_name in the
2662 configure file. Consult the <emphasis>tcpwrappers</emphasis> documentation for
2663 further details.
2664 </para>
2665 </section>
2666 <section id="SECID28">
2667 <title>Including support for IPv6</title>
2668 <para>
2669 <indexterm role="concept">
2670 <primary>IPv6</primary>
2671 <secondary>including support for</secondary>
2672 </indexterm>
2673 Exim contains code for use on systems that have IPv6 support. Setting
2674 <literal>HAVE_IPV6=YES</literal> in <filename>Local/Makefile</filename> causes the IPv6 code to be included;
2675 it may also be necessary to set IPV6_INCLUDE and IPV6_LIBS on systems
2676 where the IPv6 support is not fully integrated into the normal include and
2677 library files.
2678 </para>
2679 <para>
2680 Two different types of DNS record for handling IPv6 addresses have been
2681 defined. AAAA records (analogous to A records for IPv4) are in use, and are
2682 currently seen as the mainstream. Another record type called A6 was proposed
2683 as better than AAAA because it had more flexibility. However, it was felt to be
2684 over-complex, and its status was reduced to <quote>experimental</quote>.
2685 Exim used to
2686 have a compile option for including A6 record support but this has now been
2687 withdrawn.
2688 </para>
2689 </section>
2690 <section id="SECTdynamicmodules">
2691 <title>Dynamically loaded lookup module support</title>
2692 <para>
2693 <indexterm role="concept">
2694 <primary>lookup modules</primary>
2695 </indexterm>
2696 <indexterm role="concept">
2697 <primary>dynamic modules</primary>
2698 </indexterm>
2699 <indexterm role="concept">
2700 <primary>.so building</primary>
2701 </indexterm>
2702 On some platforms, Exim supports not compiling all lookup types directly into
2703 the main binary, instead putting some into external modules which can be loaded
2704 on demand.
2705 This permits packagers to build Exim with support for lookups with extensive
2706 library dependencies without requiring all users to install all of those
2707 dependencies.
2708 Most, but not all, lookup types can be built this way.
2709 </para>
2710 <para>
2711 Set <literal>LOOKUP_MODULE_DIR</literal> to the directory into which the modules will be
2712 installed; Exim will only load modules from that directory, as a security
2713 measure.  You will need to set <literal>CFLAGS_DYNAMIC</literal> if not already defined
2714 for your OS; see <filename>OS/Makefile-Linux</filename> for an example.
2715 Some other requirements for adjusting <literal>EXTRALIBS</literal> may also be necessary,
2716 see <filename>src/EDITME</filename> for details.
2717 </para>
2718 <para>
2719 Then, for each module to be loaded dynamically, define the relevant
2720 <literal>LOOKUP_</literal>&lt;<emphasis>lookup_type</emphasis>&gt; flags to have the value "2" instead of "yes".
2721 For example, this will build in lsearch but load sqlite and mysql support
2722 on demand:
2723 </para>
2724 <literallayout class="monospaced">
2725 LOOKUP_LSEARCH=yes
2726 LOOKUP_SQLITE=2
2727 LOOKUP_MYSQL=2
2728 </literallayout>
2729 </section>
2730 <section id="SECID29">
2731 <title>The building process</title>
2732 <para>
2733 <indexterm role="concept">
2734 <primary>build directory</primary>
2735 </indexterm>
2736 Once <filename>Local/Makefile</filename> (and <filename>Local/eximon.conf</filename>, if required) have been
2737 created, run <emphasis>make</emphasis> at the top level. It determines the architecture and
2738 operating system types, and creates a build directory if one does not exist.
2739 For example, on a Sun system running Solaris 8, the directory
2740 <filename>build-SunOS5-5.8-sparc</filename> is created.
2741 <indexterm role="concept">
2742 <primary>symbolic link</primary>
2743 <secondary>to source files</secondary>
2744 </indexterm>
2745 Symbolic links to relevant source files are installed in the build directory.
2746 </para>
2747 <para>
2748 If this is the first time <emphasis>make</emphasis> has been run, it calls a script that builds
2749 a make file inside the build directory, using the configuration files from the
2750 <filename>Local</filename> directory. The new make file is then passed to another instance of
2751 <emphasis>make</emphasis>. This does the real work, building a number of utility scripts, and
2752 then compiling and linking the binaries for the Exim monitor (if configured), a
2753 number of utility programs, and finally Exim itself. The command <literal>make
2754 makefile</literal> can be used to force a rebuild of the make file in the build
2755 directory, should this ever be necessary.
2756 </para>
2757 <para>
2758 If you have problems building Exim, check for any comments there may be in the
2759 <filename>README</filename> file concerning your operating system, and also take a look at the
2760 FAQ, where some common problems are covered.
2761 </para>
2762 </section>
2763 <section id="SECID283">
2764 <title>Output from <quote>make</quote></title>
2765 <para>
2766 The output produced by the <emphasis>make</emphasis> process for compile lines is often very
2767 unreadable, because these lines can be very long. For this reason, the normal
2768 output is suppressed by default, and instead output similar to that which
2769 appears when compiling the 2.6 Linux kernel is generated: just a short line for
2770 each module that is being compiled or linked. However, it is still possible to
2771 get the full output, by calling <emphasis>make</emphasis> like this:
2772 </para>
2773 <literallayout class="monospaced">
2774 FULLECHO='' make -e
2775 </literallayout>
2776 <para>
2777 The value of FULLECHO defaults to <quote>@</quote>, the flag character that suppresses
2778 command reflection in <emphasis>make</emphasis>. When you ask for the full output, it is
2779 given in addition to the short output.
2780 </para>
2781 </section>
2782 <section id="SECToverride">
2783 <title>Overriding build-time options for Exim</title>
2784 <para>
2785 <indexterm role="concept">
2786 <primary>build-time options, overriding</primary>
2787 </indexterm>
2788 The main make file that is created at the beginning of the building process
2789 consists of the concatenation of a number of files which set configuration
2790 values, followed by a fixed set of <emphasis>make</emphasis> instructions. If a value is set
2791 more than once, the last setting overrides any previous ones. This provides a
2792 convenient way of overriding defaults. The files that are concatenated are, in
2793 order:
2794 </para>
2795 <literallayout>
2796 <filename>OS/Makefile-Default</filename>
2797 <filename>OS/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2798 <filename>Local/Makefile</filename>
2799 <filename>Local/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2800 <filename>Local/Makefile-</filename>&lt;<emphasis>archtype</emphasis>&gt;
2801 <filename>Local/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;-&lt;<emphasis>archtype</emphasis>&gt;
2802 <filename>OS/Makefile-Base</filename>
2803 </literallayout>
2804 <para>
2805 <indexterm role="concept">
2806 <primary><filename>Local/Makefile</filename></primary>
2807 </indexterm>
2808 <indexterm role="concept">
2809 <primary>building Exim</primary>
2810 <secondary>operating system type</secondary>
2811 </indexterm>
2812 <indexterm role="concept">
2813 <primary>building Exim</primary>
2814 <secondary>architecture type</secondary>
2815 </indexterm>
2816 where &lt;<emphasis>ostype</emphasis>&gt; is the operating system type and &lt;<emphasis>archtype</emphasis>&gt; is the
2817 architecture type. <filename>Local/Makefile</filename> is required to exist, and the building
2818 process fails if it is absent. The other three <filename>Local</filename> files are optional,
2819 and are often not needed.
2820 </para>
2821 <para>
2822 The values used for &lt;<emphasis>ostype</emphasis>&gt; and &lt;<emphasis>archtype</emphasis>&gt; are obtained from scripts
2823 called <filename>scripts/os-type</filename> and <filename>scripts/arch-type</filename> respectively. If either of
2824 the environment variables EXIM_OSTYPE or EXIM_ARCHTYPE is set, their
2825 values are used, thereby providing a means of forcing particular settings.
2826 Otherwise, the scripts try to get values from the <option>uname</option> command. If this
2827 fails, the shell variables OSTYPE and ARCHTYPE are inspected. A number
2828 of <emphasis>ad hoc</emphasis> transformations are then applied, to produce the standard names
2829 that Exim expects. You can run these scripts directly from the shell in order
2830 to find out what values are being used on your system.
2831 </para>
2832 <para>
2833 <filename>OS/Makefile-Default</filename> contains comments about the variables that are set
2834 therein. Some (but not all) are mentioned below. If there is something that
2835 needs changing, review the contents of this file and the contents of the make
2836 file for your operating system (<filename>OS/Makefile-&lt;ostype&gt;</filename>) to see what the
2837 default values are.
2838 </para>
2839 <para>
2840 <indexterm role="concept">
2841 <primary>building Exim</primary>
2842 <secondary>overriding default settings</secondary>
2843 </indexterm>
2844 If you need to change any of the values that are set in <filename>OS/Makefile-Default</filename>
2845 or in <filename>OS/Makefile-&lt;ostype&gt;</filename>, or to add any new definitions, you do not
2846 need to change the original files. Instead, you should make the changes by
2847 putting the new values in an appropriate <filename>Local</filename> file. For example,
2848 <indexterm role="concept">
2849 <primary>Tru64-Unix build-time settings</primary>
2850 </indexterm>
2851 when building Exim in many releases of the Tru64-Unix (formerly Digital UNIX,
2852 formerly DEC-OSF1) operating system, it is necessary to specify that the C
2853 compiler is called <emphasis>cc</emphasis> rather than <emphasis>gcc</emphasis>. Also, the compiler must be
2854 called with the option <option>-std1</option>, to make it recognize some of the features of
2855 Standard C that Exim uses. (Most other compilers recognize Standard C by
2856 default.) To do this, you should create a file called <filename>Local/Makefile-OSF1</filename>
2857 containing the lines
2858 </para>
2859 <literallayout class="monospaced">
2860 CC=cc
2861 CFLAGS=-std1
2862 </literallayout>
2863 <para>
2864 If you are compiling for just one operating system, it may be easier to put
2865 these lines directly into <filename>Local/Makefile</filename>.
2866 </para>
2867 <para>
2868 Keeping all your local configuration settings separate from the distributed
2869 files makes it easy to transfer them to new versions of Exim simply by copying
2870 the contents of the <filename>Local</filename> directory.
2871 </para>
2872 <para>
2873 <indexterm role="concept">
2874 <primary>NIS lookup type</primary>
2875 <secondary>including support for</secondary>
2876 </indexterm>
2877 <indexterm role="concept">
2878 <primary>NIS+ lookup type</primary>
2879 <secondary>including support for</secondary>
2880 </indexterm>
2881 <indexterm role="concept">
2882 <primary>LDAP</primary>
2883 <secondary>including support for</secondary>
2884 </indexterm>
2885 <indexterm role="concept">
2886 <primary>lookup</primary>
2887 <secondary>inclusion in binary</secondary>
2888 </indexterm>
2889 Exim contains support for doing LDAP, NIS, NIS+, and other kinds of file
2890 lookup, but not all systems have these components installed, so the default is
2891 not to include the relevant code in the binary. All the different kinds of file
2892 and database lookup that Exim supports are implemented as separate code modules
2893 which are included only if the relevant compile-time options are set. In the
2894 case of LDAP, NIS, and NIS+, the settings for <filename>Local/Makefile</filename> are:
2895 </para>
2896 <literallayout class="monospaced">
2897 LOOKUP_LDAP=yes
2898 LOOKUP_NIS=yes
2899 LOOKUP_NISPLUS=yes
2900 </literallayout>
2901 <para>
2902 and similar settings apply to the other lookup types. They are all listed in
2903 <filename>src/EDITME</filename>. In many cases the relevant include files and interface
2904 libraries need to be installed before compiling Exim.
2905 <indexterm role="concept">
2906 <primary>cdb</primary>
2907 <secondary>including support for</secondary>
2908 </indexterm>
2909 However, there are some optional lookup types (such as cdb) for which
2910 the code is entirely contained within Exim, and no external include
2911 files or libraries are required. When a lookup type is not included in the
2912 binary, attempts to configure Exim to use it cause run time configuration
2913 errors.
2914 </para>
2915 <para>
2916 <indexterm role="concept">
2917 <primary>pkg-config</primary>
2918 <secondary>lookups</secondary>
2919 </indexterm>
2920 <indexterm role="concept">
2921 <primary>pkg-config</primary>
2922 <secondary>authenticators</secondary>
2923 </indexterm>
2924 Many systems now use a tool called <emphasis>pkg-config</emphasis> to encapsulate information
2925 about how to compile against a library; Exim has some initial support for
2926 being able to use pkg-config for lookups and authenticators.  For any given
2927 makefile variable which starts <literal>LOOKUP_</literal> or <literal>AUTH_</literal>, you can add a new
2928 variable with the <literal>_PC</literal> suffix in the name and assign as the value the
2929 name of the package to be queried.  The results of querying via the
2930 <emphasis>pkg-config</emphasis> command will be added to the appropriate Makefile variables
2931 with <literal>+=</literal> directives, so your version of <emphasis>make</emphasis> will need to support that
2932 syntax.  For instance:
2933 </para>
2934 <literallayout class="monospaced">
2935 LOOKUP_SQLITE=yes
2936 LOOKUP_SQLITE_PC=sqlite3
2937 AUTH_GSASL=yes
2938 AUTH_GSASL_PC=libgsasl
2939 AUTH_HEIMDAL_GSSAPI=yes
2940 AUTH_HEIMDAL_GSSAPI_PC=heimdal-gssapi
2941 </literallayout>
2942 <para>
2943 <indexterm role="concept">
2944 <primary>Perl</primary>
2945 <secondary>including support for</secondary>
2946 </indexterm>
2947 Exim can be linked with an embedded Perl interpreter, allowing Perl
2948 subroutines to be called during string expansion. To enable this facility,
2949 </para>
2950 <literallayout class="monospaced">
2951 EXIM_PERL=perl.o
2952 </literallayout>
2953 <para>
2954 must be defined in <filename>Local/Makefile</filename>. Details of this facility are given in
2955 chapter <xref linkend="CHAPperl"/>.
2956 </para>
2957 <para>
2958 <indexterm role="concept">
2959 <primary>X11 libraries, location of</primary>
2960 </indexterm>
2961 The location of the X11 libraries is something that varies a lot between
2962 operating systems, and there may be different versions of X11 to cope
2963 with. Exim itself makes no use of X11, but if you are compiling the Exim
2964 monitor, the X11 libraries must be available.
2965 The following three variables are set in <filename>OS/Makefile-Default</filename>:
2966 </para>
2967 <literallayout class="monospaced">
2968 X11=/usr/X11R6
2969 XINCLUDE=-I$(X11)/include
2970 XLFLAGS=-L$(X11)/lib
2971 </literallayout>
2972 <para>
2973 These are overridden in some of the operating-system configuration files. For
2974 example, in <filename>OS/Makefile-SunOS5</filename> there is
2975 </para>
2976 <literallayout class="monospaced">
2977 X11=/usr/openwin
2978 XINCLUDE=-I$(X11)/include
2979 XLFLAGS=-L$(X11)/lib -R$(X11)/lib
2980 </literallayout>
2981 <para>
2982 If you need to override the default setting for your operating system, place a
2983 definition of all three of these variables into your
2984 <filename>Local/Makefile-&lt;ostype&gt;</filename> file.
2985 </para>
2986 <para>
2987 <indexterm role="concept">
2988 <primary>EXTRALIBS</primary>
2989 </indexterm>
2990 If you need to add any extra libraries to the link steps, these can be put in a
2991 variable called EXTRALIBS, which appears in all the link commands, but by
2992 default is not defined. In contrast, EXTRALIBS_EXIM is used only on the
2993 command for linking the main Exim binary, and not for any associated utilities.
2994 </para>
2995 <para>
2996 <indexterm role="concept">
2997 <primary>DBM libraries</primary>
2998 <secondary>configuration for building</secondary>
2999 </indexterm>
3000 There is also DBMLIB, which appears in the link commands for binaries that
3001 use DBM functions (see also section <xref linkend="SECTdb"/>). Finally, there is
3002 EXTRALIBS_EXIMON, which appears only in the link step for the Exim monitor
3003 binary, and which can be used, for example, to include additional X11
3004 libraries.
3005 </para>
3006 <para>
3007 <indexterm role="concept">
3008 <primary>configuration file</primary>
3009 <secondary>editing</secondary>
3010 </indexterm>
3011 The make file copes with rebuilding Exim correctly if any of the configuration
3012 files are edited. However, if an optional configuration file is deleted, it is
3013 necessary to touch the associated non-optional file (that is,
3014 <filename>Local/Makefile</filename> or <filename>Local/eximon.conf</filename>) before rebuilding.
3015 </para>
3016 </section>
3017 <section id="SECID30">
3018 <title>OS-specific header files</title>
3019 <para>
3020 <indexterm role="concept">
3021 <primary><filename>os.h</filename></primary>
3022 </indexterm>
3023 <indexterm role="concept">
3024 <primary>building Exim</primary>
3025 <secondary>OS-specific C header files</secondary>
3026 </indexterm>
3027 The <filename>OS</filename> directory contains a number of files with names of the form
3028 <filename>os.h-&lt;ostype&gt;</filename>. These are system-specific C header files that should not
3029 normally need to be changed. There is a list of macro settings that are
3030 recognized in the file <filename>OS/os.configuring</filename>, which should be consulted if you
3031 are porting Exim to a new operating system.
3032 </para>
3033 </section>
3034 <section id="SECID31">
3035 <title>Overriding build-time options for the monitor</title>
3036 <para>
3037 <indexterm role="concept">
3038 <primary>building Eximon</primary>
3039 </indexterm>
3040 A similar process is used for overriding things when building the Exim monitor,
3041 where the files that are involved are
3042 </para>
3043 <literallayout>
3044 <filename>OS/eximon.conf-Default</filename>
3045 <filename>OS/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;
3046 <filename>Local/eximon.conf</filename>
3047 <filename>Local/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;
3048 <filename>Local/eximon.conf-</filename>&lt;<emphasis>archtype</emphasis>&gt;
3049 <filename>Local/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;-&lt;<emphasis>archtype</emphasis>&gt;
3050 </literallayout>
3051 <para>
3052 <indexterm role="concept">
3053 <primary><filename>Local/eximon.conf</filename></primary>
3054 </indexterm>
3055 As with Exim itself, the final three files need not exist, and in this case the
3056 <filename>OS/eximon.conf-&lt;ostype&gt;</filename> file is also optional. The default values in
3057 <filename>OS/eximon.conf-Default</filename> can be overridden dynamically by setting environment
3058 variables of the same name, preceded by EXIMON_. For example, setting
3059 EXIMON_LOG_DEPTH in the environment overrides the value of
3060 LOG_DEPTH at run time.
3061 <indexterm role="concept" startref="IIDbuex" class="endofrange"/>
3062 </para>
3063 </section>
3064 <section id="SECID32">
3065 <title>Installing Exim binaries and scripts</title>
3066 <para>
3067 <indexterm role="concept">
3068 <primary>installing Exim</primary>
3069 </indexterm>
3070 <indexterm role="concept">
3071 <primary>BIN_DIRECTORY</primary>
3072 </indexterm>
3073 The command <literal>make install</literal> runs the <command>exim_install</command> script with no
3074 arguments. The script copies binaries and utility scripts into the directory
3075 whose name is specified by the BIN_DIRECTORY setting in <filename>Local/Makefile</filename>.
3076 <indexterm role="concept">
3077 <primary>setuid</primary>
3078 <secondary>installing Exim with</secondary>
3079 </indexterm>
3080 The install script copies files only if they are newer than the files they are
3081 going to replace. The Exim binary is required to be owned by root and have the
3082 <emphasis>setuid</emphasis> bit set, for normal configurations. Therefore, you must run <literal>make
3083 install</literal> as root so that it can set up the Exim binary in this way. However, in
3084 some special situations (for example, if a host is doing no local deliveries)
3085 it may be possible to run Exim without making the binary setuid root (see
3086 chapter <xref linkend="CHAPsecurity"/> for details).
3087 </para>
3088 <para>
3089 <indexterm role="concept">
3090 <primary>CONFIGURE_FILE</primary>
3091 </indexterm>
3092 Exim&#x2019;s run time configuration file is named by the CONFIGURE_FILE setting
3093 in <filename>Local/Makefile</filename>. If this names a single file, and the file does not
3094 exist, the default configuration file <filename>src/configure.default</filename> is copied there
3095 by the installation script. If a run time configuration file already exists, it
3096 is left alone. If CONFIGURE_FILE is a colon-separated list, naming several
3097 alternative files, no default is installed.
3098 </para>
3099 <para>
3100 <indexterm role="concept">
3101 <primary>system aliases file</primary>
3102 </indexterm>
3103 <indexterm role="concept">
3104 <primary><filename>/etc/aliases</filename></primary>
3105 </indexterm>
3106 One change is made to the default configuration file when it is installed: the
3107 default configuration contains a router that references a system aliases file.
3108 The path to this file is set to the value specified by
3109 SYSTEM_ALIASES_FILE in <filename>Local/Makefile</filename> (<filename>/etc/aliases</filename> by default).
3110 If the system aliases file does not exist, the installation script creates it,
3111 and outputs a comment to the user.
3112 </para>
3113 <para>
3114 The created file contains no aliases, but it does contain comments about the
3115 aliases a site should normally have. Mail aliases have traditionally been
3116 kept in <filename>/etc/aliases</filename>. However, some operating systems are now using
3117 <filename>/etc/mail/aliases</filename>. You should check if yours is one of these, and change
3118 Exim&#x2019;s configuration if necessary.
3119 </para>
3120 <para>
3121 The default configuration uses the local host&#x2019;s name as the only local domain,
3122 and is set up to do local deliveries into the shared directory <filename>/var/mail</filename>,
3123 running as the local user. System aliases and <filename>.forward</filename> files in users&#x2019; home
3124 directories are supported, but no NIS or NIS+ support is configured. Domains
3125 other than the name of the local host are routed using the DNS, with delivery
3126 over SMTP.
3127 </para>
3128 <para>
3129 It is possible to install Exim for special purposes (such as building a binary
3130 distribution) in a private part of the file system. You can do this by a
3131 command such as
3132 </para>
3133 <literallayout class="monospaced">
3134 make DESTDIR=/some/directory/ install
3135 </literallayout>
3136 <para>
3137 This has the effect of pre-pending the specified directory to all the file
3138 paths, except the name of the system aliases file that appears in the default
3139 configuration. (If a default alias file is created, its name <emphasis>is</emphasis> modified.)
3140 For backwards compatibility, ROOT is used if DESTDIR is not set,
3141 but this usage is deprecated.
3142 </para>
3143 <para>
3144 <indexterm role="concept">
3145 <primary>installing Exim</primary>
3146 <secondary>what is not installed</secondary>
3147 </indexterm>
3148 Running <emphasis>make install</emphasis> does not copy the Exim 4 conversion script
3149 <emphasis>convert4r4</emphasis>. You will probably run this only once if you are
3150 upgrading from Exim 3. None of the documentation files in the <filename>doc</filename>
3151 directory are copied, except for the info files when you have set
3152 INFO_DIRECTORY, as described in section <xref linkend="SECTinsinfdoc"/> below.
3153 </para>
3154 <para>
3155 For the utility programs, old versions are renamed by adding the suffix <filename>.O</filename>
3156 to their names. The Exim binary itself, however, is handled differently. It is
3157 installed under a name that includes the version number and the compile number,
3158 for example <filename>exim-4.90.1-1</filename>. The script then arranges for a symbolic link
3159 called <filename>exim</filename> to point to the binary. If you are updating a previous version
3160 of Exim, the script takes care to ensure that the name <filename>exim</filename> is never absent
3161 from the directory (as seen by other processes).
3162 </para>
3163 <para>
3164 <indexterm role="concept">
3165 <primary>installing Exim</primary>
3166 <secondary>testing the script</secondary>
3167 </indexterm>
3168 If you want to see what the <emphasis>make install</emphasis> will do before running it for
3169 real, you can pass the <option>-n</option> option to the installation script by this
3170 command:
3171 </para>
3172 <literallayout class="monospaced">
3173 make INSTALL_ARG=-n install
3174 </literallayout>
3175 <para>
3176 The contents of the variable INSTALL_ARG are passed to the installation
3177 script. You do not need to be root to run this test. Alternatively, you can run
3178 the installation script directly, but this must be from within the build
3179 directory. For example, from the top-level Exim directory you could use this
3180 command:
3181 </para>
3182 <literallayout class="monospaced">
3183 (cd build-SunOS5-5.5.1-sparc; ../scripts/exim_install -n)
3184 </literallayout>
3185 <para>
3186 <indexterm role="concept">
3187 <primary>installing Exim</primary>
3188 <secondary>install script options</secondary>
3189 </indexterm>
3190 There are two other options that can be supplied to the installation script.
3191 </para>
3192 <itemizedlist>
3193 <listitem>
3194 <para>
3195 <option>-no_chown</option> bypasses the call to change the owner of the installed binary
3196 to root, and the call to make it a setuid binary.
3197 </para>
3198 </listitem>
3199 <listitem>
3200 <para>
3201 <option>-no_symlink</option> bypasses the setting up of the symbolic link <filename>exim</filename> to the
3202 installed binary.
3203 </para>
3204 </listitem>
3205 </itemizedlist>
3206 <para>
3207 INSTALL_ARG can be used to pass these options to the script. For example:
3208 </para>
3209 <literallayout class="monospaced">
3210 make INSTALL_ARG=-no_symlink install
3211 </literallayout>
3212 <para>
3213 The installation script can also be given arguments specifying which files are
3214 to be copied. For example, to install just the Exim binary, and nothing else,
3215 without creating the symbolic link, you could use:
3216 </para>
3217 <literallayout class="monospaced">
3218 make INSTALL_ARG='-no_symlink exim' install
3219 </literallayout>
3220 </section>
3221 <section id="SECTinsinfdoc">
3222 <title>Installing info documentation</title>
3223 <para>
3224 <indexterm role="concept">
3225 <primary>installing Exim</primary>
3226 <secondary><emphasis>info</emphasis> documentation</secondary>
3227 </indexterm>
3228 Not all systems use the GNU <emphasis>info</emphasis> system for documentation, and for this
3229 reason, the Texinfo source of Exim&#x2019;s documentation is not included in the main
3230 distribution. Instead it is available separately from the ftp site (see section
3231 <xref linkend="SECTavail"/>).
3232 </para>
3233 <para>
3234 If you have defined INFO_DIRECTORY in <filename>Local/Makefile</filename> and the Texinfo
3235 source of the documentation is found in the source tree, running <literal>make
3236 install</literal> automatically builds the info files and installs them.
3237 </para>
3238 </section>
3239 <section id="SECID33">
3240 <title>Setting up the spool directory</title>
3241 <para>
3242 <indexterm role="concept">
3243 <primary>spool directory</primary>
3244 <secondary>creating</secondary>
3245 </indexterm>
3246 When it starts up, Exim tries to create its spool directory if it does not
3247 exist. The Exim uid and gid are used for the owner and group of the spool
3248 directory. Sub-directories are automatically created in the spool directory as
3249 necessary.
3250 </para>
3251 </section>
3252 <section id="SECID34">
3253 <title>Testing</title>
3254 <para>
3255 <indexterm role="concept">
3256 <primary>testing</primary>
3257 <secondary>installation</secondary>
3258 </indexterm>
3259 Having installed Exim, you can check that the run time configuration file is
3260 syntactically valid by running the following command, which assumes that the
3261 Exim binary directory is within your PATH environment variable:
3262 </para>
3263 <literallayout class="monospaced">
3264 exim -bV
3265 </literallayout>
3266 <para>
3267 If there are any errors in the configuration file, Exim outputs error messages.
3268 Otherwise it outputs the version number and build date,
3269 the DBM library that is being used, and information about which drivers and
3270 other optional code modules are included in the binary.
3271 Some simple routing tests can be done by using the address testing option. For
3272 example,
3273 </para>
3274 <literallayout>
3275 <literal>exim -bt</literal> &lt;<emphasis>local username</emphasis>&gt;
3276 </literallayout>
3277 <para>
3278 should verify that it recognizes a local mailbox, and
3279 </para>
3280 <literallayout>
3281 <literal>exim -bt</literal> &lt;<emphasis>remote address</emphasis>&gt;
3282 </literallayout>
3283 <para>
3284 a remote one. Then try getting it to deliver mail, both locally and remotely.
3285 This can be done by passing messages directly to Exim, without going through a
3286 user agent. For example:
3287 </para>
3288 <literallayout class="monospaced">
3289 exim -v postmaster@your.domain.example
3290 From: user@your.domain.example
3291 To: postmaster@your.domain.example
3292 Subject: Testing Exim
3293
3294 This is a test message.
3295 ^D
3296 </literallayout>
3297 <para>
3298 The <option>-v</option> option causes Exim to output some verification of what it is doing.
3299 In this case you should see copies of three log lines, one for the message&#x2019;s
3300 arrival, one for its delivery, and one containing <quote>Completed</quote>.
3301 </para>
3302 <para>
3303 <indexterm role="concept">
3304 <primary>delivery</primary>
3305 <secondary>problems with</secondary>
3306 </indexterm>
3307 If you encounter problems, look at Exim&#x2019;s log files (<emphasis>mainlog</emphasis> and
3308 <emphasis>paniclog</emphasis>) to see if there is any relevant information there. Another source
3309 of information is running Exim with debugging turned on, by specifying the
3310 <option>-d</option> option. If a message is stuck on Exim&#x2019;s spool, you can force a delivery
3311 with debugging turned on by a command of the form
3312 </para>
3313 <literallayout>
3314 <literal>exim -d -M</literal> &lt;<emphasis>exim-message-id</emphasis>&gt;
3315 </literallayout>
3316 <para>
3317 You must be root or an <quote>admin user</quote> in order to do this. The <option>-d</option> option
3318 produces rather a lot of output, but you can cut this down to specific areas.
3319 For example, if you use <option>-d-all+route</option> only the debugging information
3320 relevant to routing is included. (See the <option>-d</option> option in chapter
3321 <xref linkend="CHAPcommandline"/> for more details.)
3322 </para>
3323 <para>
3324 <indexterm role="concept">
3325 <primary><quote>sticky</quote> bit</primary>
3326 </indexterm>
3327 <indexterm role="concept">
3328 <primary>lock files</primary>
3329 </indexterm>
3330 One specific problem that has shown up on some sites is the inability to do
3331 local deliveries into a shared mailbox directory, because it does not have the
3332 <quote>sticky bit</quote> set on it. By default, Exim tries to create a lock file before
3333 writing to a mailbox file, and if it cannot create the lock file, the delivery
3334 is deferred. You can get round this either by setting the <quote>sticky bit</quote> on the
3335 directory, or by setting a specific group for local deliveries and allowing
3336 that group to create files in the directory (see the comments above the
3337 <command>local_delivery</command> transport in the default configuration file). Another
3338 approach is to configure Exim not to use lock files, but just to rely on
3339 <function>fcntl()</function> locking instead. However, you should do this only if all user
3340 agents also use <function>fcntl()</function> locking. For further discussion of locking issues,
3341 see chapter <xref linkend="CHAPappendfile"/>.
3342 </para>
3343 <para>
3344 One thing that cannot be tested on a system that is already running an MTA is
3345 the receipt of incoming SMTP mail on the standard SMTP port. However, the
3346 <option>-oX</option> option can be used to run an Exim daemon that listens on some other
3347 port, or <emphasis>inetd</emphasis> can be used to do this. The <option>-bh</option> option and the
3348 <emphasis>exim_checkaccess</emphasis> utility can be used to check out policy controls on
3349 incoming SMTP mail.
3350 </para>
3351 <para>
3352 Testing a new version on a system that is already running Exim can most easily
3353 be done by building a binary with a different CONFIGURE_FILE setting. From
3354 within the run time configuration, all other file and directory names
3355 that Exim uses can be altered, in order to keep it entirely clear of the
3356 production version.
3357 </para>
3358 </section>
3359 <section id="SECID35">
3360 <title>Replacing another MTA with Exim</title>
3361 <para>
3362 <indexterm role="concept">
3363 <primary>replacing another MTA</primary>
3364 </indexterm>
3365 Building and installing Exim for the first time does not of itself put it in
3366 general use. The name by which the system&#x2019;s MTA is called by mail user agents
3367 is either <filename>/usr/sbin/sendmail</filename>, or <filename>/usr/lib/sendmail</filename> (depending on the
3368 operating system), and it is necessary to make this name point to the <emphasis>exim</emphasis>
3369 binary in order to get the user agents to pass messages to Exim. This is
3370 normally done by renaming any existing file and making <filename>/usr/sbin/sendmail</filename>
3371 or <filename>/usr/lib/sendmail</filename>
3372 <indexterm role="concept">
3373 <primary>symbolic link</primary>
3374 <secondary>to <emphasis>exim</emphasis> binary</secondary>
3375 </indexterm>
3376 a symbolic link to the <emphasis>exim</emphasis> binary. It is a good idea to remove any setuid
3377 privilege and executable status from the old MTA. It is then necessary to stop
3378 and restart the mailer daemon, if one is running.
3379 </para>
3380 <para>
3381 <indexterm role="concept">
3382 <primary>FreeBSD, MTA indirection</primary>
3383 </indexterm>
3384 <indexterm role="concept">
3385 <primary><filename>/etc/mail/mailer.conf</filename></primary>
3386 </indexterm>
3387 Some operating systems have introduced alternative ways of switching MTAs. For
3388 example, if you are running FreeBSD, you need to edit the file
3389 <filename>/etc/mail/mailer.conf</filename> instead of setting up a symbolic link as just
3390 described. A typical example of the contents of this file for running Exim is
3391 as follows:
3392 </para>
3393 <literallayout class="monospaced">
3394 sendmail            /usr/exim/bin/exim
3395 send-mail           /usr/exim/bin/exim
3396 mailq               /usr/exim/bin/exim -bp
3397 newaliases          /usr/bin/true
3398 </literallayout>
3399 <para>
3400 Once you have set up the symbolic link, or edited <filename>/etc/mail/mailer.conf</filename>,
3401 your Exim installation is <quote>live</quote>. Check it by sending a message from your
3402 favourite user agent.
3403 </para>
3404 <para>
3405 You should consider what to tell your users about the change of MTA. Exim may
3406 have different capabilities to what was previously running, and there are
3407 various operational differences such as the text of messages produced by
3408 command line options and in bounce messages. If you allow your users to make
3409 use of Exim&#x2019;s filtering capabilities, you should make the document entitled
3410 <emphasis>Exim&#x2019;s interface to mail filtering</emphasis> available to them.
3411 </para>
3412 </section>
3413 <section id="SECID36">
3414 <title>Upgrading Exim</title>
3415 <para>
3416 <indexterm role="concept">
3417 <primary>upgrading Exim</primary>
3418 </indexterm>
3419 If you are already running Exim on your host, building and installing a new
3420 version automatically makes it available to MUAs, or any other programs that
3421 call the MTA directly. However, if you are running an Exim daemon, you do need
3422 to send it a HUP signal, to make it re-execute itself, and thereby pick up the
3423 new binary. You do not need to stop processing mail in order to install a new
3424 version of Exim. The install script does not modify an existing runtime
3425 configuration file.
3426 </para>
3427 </section>
3428 <section id="SECID37">
3429 <title>Stopping the Exim daemon on Solaris</title>
3430 <para>
3431 <indexterm role="concept">
3432 <primary>Solaris</primary>
3433 <secondary>stopping Exim on</secondary>
3434 </indexterm>
3435 The standard command for stopping the mailer daemon on Solaris is
3436 </para>
3437 <literallayout class="monospaced">
3438 /etc/init.d/sendmail stop
3439 </literallayout>
3440 <para>
3441 If <filename>/usr/lib/sendmail</filename> has been turned into a symbolic link, this script
3442 fails to stop Exim because it uses the command <emphasis>ps -e</emphasis> and greps the output
3443 for the text <quote>sendmail</quote>; this is not present because the actual program name
3444 (that is, <quote>exim</quote>) is given by the <emphasis>ps</emphasis> command with these options. A
3445 solution is to replace the line that finds the process id with something like
3446 </para>
3447 <literallayout class="monospaced">
3448 pid=`cat /var/spool/exim/exim-daemon.pid`
3449 </literallayout>
3450 <para>
3451 to obtain the daemon&#x2019;s pid directly from the file that Exim saves it in.
3452 </para>
3453 <para>
3454 Note, however, that stopping the daemon does not <quote>stop Exim</quote>. Messages can
3455 still be received from local processes, and if automatic delivery is configured
3456 (the normal case), deliveries will still occur.
3457 </para>
3458 </section>
3459 </chapter>
3460
3461 <chapter id="CHAPcommandline">
3462 <title>The Exim command line</title>
3463 <para>
3464 <indexterm role="concept" id="IIDclo1" class="startofrange">
3465 <primary>command line</primary>
3466 <secondary>options</secondary>
3467 </indexterm>
3468 <indexterm role="concept" id="IIDclo2" class="startofrange">
3469 <primary>options</primary>
3470 <secondary>command line</secondary>
3471 </indexterm>
3472 Exim&#x2019;s command line takes the standard Unix form of a sequence of options,
3473 each starting with a hyphen character, followed by a number of arguments. The
3474 options are compatible with the main options of Sendmail, and there are also
3475 some additional options, some of which are compatible with Smail 3. Certain
3476 combinations of options do not make sense, and provoke an error if used.
3477 The form of the arguments depends on which options are set.
3478 </para>
3479 <section id="SECID38">
3480 <title>Setting options by program name</title>
3481 <para>
3482 <indexterm role="concept">
3483 <primary><emphasis>mailq</emphasis></primary>
3484 </indexterm>
3485 If Exim is called under the name <emphasis>mailq</emphasis>, it behaves as if the option <option>-bp</option>
3486 were present before any other options.
3487 The <option>-bp</option> option requests a listing of the contents of the mail queue on the
3488 standard output.
3489 This feature is for compatibility with some systems that contain a command of
3490 that name in one of the standard libraries, symbolically linked to
3491 <filename>/usr/sbin/sendmail</filename> or <filename>/usr/lib/sendmail</filename>.
3492 </para>
3493 <para>
3494 <indexterm role="concept">
3495 <primary><emphasis>rsmtp</emphasis></primary>
3496 </indexterm>
3497 If Exim is called under the name <emphasis>rsmtp</emphasis> it behaves as if the option <option>-bS</option>
3498 were present before any other options, for compatibility with Smail. The
3499 <option>-bS</option> option is used for reading in a number of messages in batched SMTP
3500 format.
3501 </para>
3502 <para>
3503 <indexterm role="concept">
3504 <primary><emphasis>rmail</emphasis></primary>
3505 </indexterm>
3506 If Exim is called under the name <emphasis>rmail</emphasis> it behaves as if the <option>-i</option> and
3507 <option>-oee</option> options were present before any other options, for compatibility with
3508 Smail. The name <emphasis>rmail</emphasis> is used as an interface by some UUCP systems.
3509 </para>
3510 <para>
3511 <indexterm role="concept">
3512 <primary><emphasis>runq</emphasis></primary>
3513 </indexterm>
3514 <indexterm role="concept">
3515 <primary>queue runner</primary>
3516 </indexterm>
3517 If Exim is called under the name <emphasis>runq</emphasis> it behaves as if the option <option>-q</option>
3518 were present before any other options, for compatibility with Smail. The <option>-q</option>
3519 option causes a single queue runner process to be started.
3520 </para>
3521 <para>
3522 <indexterm role="concept">
3523 <primary><emphasis>newaliases</emphasis></primary>
3524 </indexterm>
3525 <indexterm role="concept">
3526 <primary>alias file</primary>
3527 <secondary>building</secondary>
3528 </indexterm>
3529 <indexterm role="concept">
3530 <primary>Sendmail compatibility</primary>
3531 <secondary>calling Exim as <emphasis>newaliases</emphasis></secondary>
3532 </indexterm>
3533 If Exim is called under the name <emphasis>newaliases</emphasis> it behaves as if the option
3534 <option>-bi</option> were present before any other options, for compatibility with Sendmail.
3535 This option is used for rebuilding Sendmail&#x2019;s alias file. Exim does not have
3536 the concept of a single alias file, but can be configured to run a given
3537 command if called with the <option>-bi</option> option.
3538 </para>
3539 </section>
3540 <section id="SECTtrustedadmin">
3541 <title>Trusted and admin users</title>
3542 <para>
3543 Some Exim options are available only to <emphasis>trusted users</emphasis> and others are
3544 available only to <emphasis>admin users</emphasis>. In the description below, the phrases <quote>Exim
3545 user</quote> and <quote>Exim group</quote> mean the user and group defined by EXIM_USER and
3546 EXIM_GROUP in <filename>Local/Makefile</filename> or set by the <option>exim_user</option> and
3547 <option>exim_group</option> options. These do not necessarily have to use the name <quote>exim</quote>.
3548 </para>
3549 <itemizedlist>
3550 <listitem>
3551 <para>
3552 <indexterm role="concept">
3553 <primary>trusted users</primary>
3554 <secondary>definition of</secondary>
3555 </indexterm>
3556 <indexterm role="concept">
3557 <primary>user</primary>
3558 <secondary>trusted definition of</secondary>
3559 </indexterm>
3560 The trusted users are root, the Exim user, any user listed in the
3561 <option>trusted_users</option> configuration option, and any user whose current group or any
3562 supplementary group is one of those listed in the <option>trusted_groups</option>
3563 configuration option. Note that the Exim group is not automatically trusted.
3564 </para>
3565 <para>
3566 <indexterm role="concept">
3567 <primary><quote>From</quote> line</primary>
3568 </indexterm>
3569 <indexterm role="concept">
3570 <primary>envelope sender</primary>
3571 </indexterm>
3572 Trusted users are always permitted to use the <option>-f</option> option or a leading
3573 <quote>From&nbsp;</quote> line to specify the envelope sender of a message that is passed to
3574 Exim through the local interface (see the <option>-bm</option> and <option>-f</option> options below).
3575 See the <option>untrusted_set_sender</option> option for a way of permitting non-trusted
3576 users to set envelope senders.
3577 </para>
3578 <para>
3579 <indexterm role="concept">
3580 <primary><emphasis>From:</emphasis> header line</primary>
3581 </indexterm>
3582 <indexterm role="concept">
3583 <primary><emphasis>Sender:</emphasis> header line</primary>
3584 </indexterm>
3585 <indexterm role="concept">
3586 <primary>header lines</primary>
3587 <secondary>From:</secondary>
3588 </indexterm>
3589 <indexterm role="concept">
3590 <primary>header lines</primary>
3591 <secondary>Sender:</secondary>
3592 </indexterm>
3593 For a trusted user, there is never any check on the contents of the <emphasis>From:</emphasis>
3594 header line, and a <emphasis>Sender:</emphasis> line is never added. Furthermore, any existing
3595 <emphasis>Sender:</emphasis> line in incoming local (non-TCP/IP) messages is not removed.
3596 </para>
3597 <para>
3598 Trusted users may also specify a host name, host address, interface address,
3599 protocol name, ident value, and authentication data when submitting a message
3600 locally. Thus, they are able to insert messages into Exim&#x2019;s queue locally that
3601 have the characteristics of messages received from a remote host. Untrusted
3602 users may in some circumstances use <option>-f</option>, but can never set the other values
3603 that are available to trusted users.
3604 </para>
3605 </listitem>
3606 <listitem>
3607 <para>
3608 <indexterm role="concept">
3609 <primary>user</primary>
3610 <secondary>admin definition of</secondary>
3611 </indexterm>
3612 <indexterm role="concept">
3613 <primary>admin user</primary>
3614 <secondary>definition of</secondary>
3615 </indexterm>
3616 The admin users are root, the Exim user, and any user that is a member of the
3617 Exim group or of any group listed in the <option>admin_groups</option> configuration option.
3618 The current group does not have to be one of these groups.
3619 </para>
3620 <para>
3621 Admin users are permitted to list the queue, and to carry out certain
3622 operations on messages, for example, to force delivery failures. It is also
3623 necessary to be an admin user in order to see the full information provided by
3624 the Exim monitor, and full debugging output.
3625 </para>
3626 <para>
3627 By default, the use of the <option>-M</option>, <option>-q</option>, <option>-R</option>, and <option>-S</option> options to cause
3628 Exim to attempt delivery of messages on its queue is restricted to admin users.
3629 However, this restriction can be relaxed by setting the <option>prod_requires_admin</option>
3630 option false (that is, specifying <option>no_prod_requires_admin</option>).
3631 </para>
3632 <para>
3633 Similarly, the use of the <option>-bp</option> option to list all the messages in the queue
3634 is restricted to admin users unless <option>queue_list_requires_admin</option> is set
3635 false.
3636 </para>
3637 </listitem>
3638 </itemizedlist>
3639 <para>
3640 <emphasis role="bold">Warning</emphasis>: If you configure your system so that admin users are able to
3641 edit Exim&#x2019;s configuration file, you are giving those users an easy way of
3642 getting root. There is further discussion of this issue at the start of chapter
3643 <xref linkend="CHAPconf"/>.
3644 </para>
3645 </section>
3646 <section id="SECID39">
3647 <title>Command line options</title>
3648 <para>
3649 Exim&#x2019;s command line options are described in alphabetical order below. If none
3650 of the options that specifies a specific action (such as starting the daemon or
3651 a queue runner, or testing an address, or receiving a message in a specific
3652 format, or listing the queue) are present, and there is at least one argument
3653 on the command line, <option>-bm</option> (accept a local message on the standard input,
3654 with the arguments specifying the recipients) is assumed. Otherwise, Exim
3655 outputs a brief message about itself and exits.
3656 </para>
3657 <!-- === Start of command line options === -->
3658 <variablelist>
3659 <varlistentry>
3660 <term><option>--</option></term>
3661 <listitem>
3662 <para>
3663 <indexterm role="option">
3664 <primary>--</primary>
3665 </indexterm>
3666 <indexterm role="concept">
3667 <primary>options</primary>
3668 <secondary>command line; terminating</secondary>
3669 </indexterm>
3670 This is a pseudo-option whose only purpose is to terminate the options and
3671 therefore to cause subsequent command line items to be treated as arguments
3672 rather than options, even if they begin with hyphens.
3673 </para>
3674 </listitem></varlistentry>
3675 <varlistentry>
3676 <term><option>--help</option></term>
3677 <listitem>
3678 <para>
3679 <indexterm role="option">
3680 <primary><option>--help</option></primary>
3681 </indexterm>
3682 This option causes Exim to output a few sentences stating what it is.
3683 The same output is generated if the Exim binary is called with no options and
3684 no arguments.
3685 </para>
3686 </listitem></varlistentry>
3687 <varlistentry>
3688 <term><option>--version</option></term>
3689 <listitem>
3690 <para>
3691 <indexterm role="option">
3692 <primary><option>--version</option></primary>
3693 </indexterm>
3694 This option is an alias for <option>-bV</option> and causes version information to be
3695 displayed.
3696 </para>
3697 </listitem></varlistentry>
3698 <varlistentry>
3699 <term><option>-Ac</option></term>
3700 <term><option>-Am</option></term>
3701 <listitem>
3702 <para>
3703 <indexterm role="option">
3704 <primary><option>-Ac</option></primary>
3705 </indexterm>
3706 <indexterm role="option">
3707 <primary><option>-Am</option></primary>
3708 </indexterm>
3709 These options are used by Sendmail for selecting configuration files and are
3710 ignored by Exim.
3711 </para>
3712 </listitem></varlistentry>
3713 <varlistentry>
3714 <term><option>-B</option>&lt;<emphasis>type</emphasis>&gt;</term>
3715 <listitem>
3716 <para>
3717 <indexterm role="option">
3718 <primary><option>-B</option></primary>
3719 </indexterm>
3720 <indexterm role="concept">
3721 <primary>8-bit characters</primary>
3722 </indexterm>
3723 <indexterm role="concept">
3724 <primary>Sendmail compatibility</primary>
3725 <secondary>8-bit characters</secondary>
3726 </indexterm>
3727 This is a Sendmail option for selecting 7 or 8 bit processing. Exim is 8-bit
3728 clean; it ignores this option.
3729 </para>
3730 </listitem></varlistentry>
3731 <varlistentry>
3732 <term><option>-bd</option></term>
3733 <listitem>
3734 <para>
3735 <indexterm role="option">
3736 <primary><option>-bd</option></primary>
3737 </indexterm>
3738 <indexterm role="concept">
3739 <primary>daemon</primary>
3740 </indexterm>
3741 <indexterm role="concept">
3742 <primary>SMTP</primary>
3743 <secondary>listener</secondary>
3744 </indexterm>
3745 <indexterm role="concept">
3746 <primary>queue runner</primary>
3747 </indexterm>
3748 This option runs Exim as a daemon, awaiting incoming SMTP connections. Usually
3749 the <option>-bd</option> option is combined with the <option>-q</option>&lt;<emphasis>time</emphasis>&gt; option, to specify
3750 that the daemon should also initiate periodic queue runs.
3751 </para>
3752 <para>
3753 The <option>-bd</option> option can be used only by an admin user. If either of the <option>-d</option>
3754 (debugging) or <option>-v</option> (verifying) options are set, the daemon does not
3755 disconnect from the controlling terminal. When running this way, it can be
3756 stopped by pressing ctrl-C.
3757 </para>
3758 <para>
3759 By default, Exim listens for incoming connections to the standard SMTP port on
3760 all the host&#x2019;s running interfaces. However, it is possible to listen on other
3761 ports, on multiple ports, and only on specific interfaces. Chapter
3762 <xref linkend="CHAPinterfaces"/> contains a description of the options that control this.
3763 </para>
3764 <para>
3765 When a listening daemon
3766 <indexterm role="concept">
3767 <primary>daemon</primary>
3768 <secondary>process id (pid)</secondary>
3769 </indexterm>
3770 <indexterm role="concept">
3771 <primary>pid (process id)</primary>
3772 <secondary>of daemon</secondary>
3773 </indexterm>
3774 is started without the use of <option>-oX</option> (that is, without overriding the normal
3775 configuration), it writes its process id to a file called <filename>exim-daemon.pid</filename>
3776 in Exim&#x2019;s spool directory. This location can be overridden by setting
3777 PID_FILE_PATH in <filename>Local/Makefile</filename>. The file is written while Exim is still
3778 running as root.
3779 </para>
3780 <para>
3781 When <option>-oX</option> is used on the command line to start a listening daemon, the
3782 process id is not written to the normal pid file path. However, <option>-oP</option> can be
3783 used to specify a path on the command line if a pid file is required.
3784 </para>
3785 <para>
3786 The SIGHUP signal
3787 <indexterm role="concept">
3788 <primary>SIGHUP</primary>
3789 </indexterm>
3790 <indexterm role="concept">
3791 <primary>daemon</primary>
3792 <secondary>restarting</secondary>
3793 </indexterm>
3794 can be used to cause the daemon to re-execute itself. This should be done
3795 whenever Exim&#x2019;s configuration file, or any file that is incorporated into it by
3796 means of the <option>.include</option> facility, is changed, and also whenever a new version
3797 of Exim is installed. It is not necessary to do this when other files that are
3798 referenced from the configuration (for example, alias files) are changed,
3799 because these are reread each time they are used.
3800 </para>
3801 </listitem></varlistentry>
3802 <varlistentry>
3803 <term><option>-bdf</option></term>
3804 <listitem>
3805 <para>
3806 <indexterm role="option">
3807 <primary><option>-bdf</option></primary>
3808 </indexterm>
3809 This option has the same effect as <option>-bd</option> except that it never disconnects
3810 from the controlling terminal, even when no debugging is specified.
3811 </para>
3812 </listitem></varlistentry>
3813 <varlistentry>
3814 <term><option>-be</option></term>
3815 <listitem>
3816 <para>
3817 <indexterm role="option">
3818 <primary><option>-be</option></primary>
3819 </indexterm>
3820 <indexterm role="concept">
3821 <primary>testing</primary>
3822 <secondary>string expansion</secondary>
3823 </indexterm>
3824 <indexterm role="concept">
3825 <primary>expansion</primary>
3826 <secondary>testing</secondary>
3827 </indexterm>
3828 Run Exim in expansion testing mode. Exim discards its root privilege, to
3829 prevent ordinary users from using this mode to read otherwise inaccessible
3830 files. If no arguments are given, Exim runs interactively, prompting for lines
3831 of data. Otherwise, it processes each argument in turn.
3832 </para>
3833 <para>
3834 If Exim was built with USE_READLINE=yes in <filename>Local/Makefile</filename>, it tries
3835 to load the <option>libreadline</option> library dynamically whenever the <option>-be</option> option is
3836 used without command line arguments. If successful, it uses the <function>readline()</function>
3837 function, which provides extensive line-editing facilities, for reading the
3838 test data. A line history is supported.
3839 </para>
3840 <para>
3841 Long expansion expressions can be split over several lines by using backslash
3842 continuations. As in Exim&#x2019;s run time configuration, white space at the start of
3843 continuation lines is ignored. Each argument or data line is passed through the
3844 string expansion mechanism, and the result is output. Variable values from the
3845 configuration file (for example, <varname>$qualify_domain</varname>) are available, but no
3846 message-specific values (such as <varname>$message_exim_id</varname>) are set, because no message
3847 is being processed (but see <option>-bem</option> and <option>-Mset</option>).
3848 </para>
3849 <para>
3850 <emphasis role="bold">Note</emphasis>: If you use this mechanism to test lookups, and you change the data
3851 files or databases you are using, you must exit and restart Exim before trying
3852 the same lookup again. Otherwise, because each Exim process caches the results
3853 of lookups, you will just get the same result as before.
3854 </para>
3855 <para revisionflag="changed">
3856 Macro processing is done on lines before string-expansion: new macros can be
3857 defined and macros will be expanded.
3858 Because macros in the config file are often used for secrets, those are only
3859 available to admin users.
3860 </para>
3861 </listitem></varlistentry>
3862 <varlistentry>
3863 <term><option>-bem</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3864 <listitem>
3865 <para>
3866 <indexterm role="option">
3867 <primary><option>-bem</option></primary>
3868 </indexterm>
3869 <indexterm role="concept">
3870 <primary>testing</primary>
3871 <secondary>string expansion</secondary>
3872 </indexterm>
3873 <indexterm role="concept">
3874 <primary>expansion</primary>
3875 <secondary>testing</secondary>
3876 </indexterm>
3877 This option operates like <option>-be</option> except that it must be followed by the name
3878 of a file. For example:
3879 </para>
3880 <literallayout class="monospaced">
3881 exim -bem /tmp/testmessage
3882 </literallayout>
3883 <para>
3884 The file is read as a message (as if receiving a locally-submitted non-SMTP
3885 message) before any of the test expansions are done. Thus, message-specific
3886 variables such as <varname>$message_size</varname> and <varname>$header_from:</varname> are available. However,
3887 no <emphasis>Received:</emphasis> header is added to the message. If the <option>-t</option> option is set,
3888 recipients are read from the headers in the normal way, and are shown in the
3889 <varname>$recipients</varname> variable. Note that recipients cannot be given on the command
3890 line, because further arguments are taken as strings to expand (just like
3891 <option>-be</option>).
3892 </para>
3893 </listitem></varlistentry>
3894 <varlistentry>
3895 <term><option>-bF</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3896 <listitem>
3897 <para>
3898 <indexterm role="option">
3899 <primary><option>-bF</option></primary>
3900 </indexterm>
3901 <indexterm role="concept">
3902 <primary>system filter</primary>
3903 <secondary>testing</secondary>
3904 </indexterm>
3905 <indexterm role="concept">
3906 <primary>testing</primary>
3907 <secondary>system filter</secondary>
3908 </indexterm>
3909 This option is the same as <option>-bf</option> except that it assumes that the filter being
3910 tested is a system filter. The additional commands that are available only in
3911 system filters are recognized.
3912 </para>
3913 </listitem></varlistentry>
3914 <varlistentry>
3915 <term><option>-bf</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3916 <listitem>
3917 <para>
3918 <indexterm role="option">
3919 <primary><option>-bf</option></primary>
3920 </indexterm>
3921 <indexterm role="concept">
3922 <primary>filter</primary>
3923 <secondary>testing</secondary>
3924 </indexterm>
3925 <indexterm role="concept">
3926 <primary>testing</primary>
3927 <secondary>filter file</secondary>
3928 </indexterm>
3929 <indexterm role="concept">
3930 <primary>forward file</primary>
3931 <secondary>testing</secondary>
3932 </indexterm>
3933 <indexterm role="concept">
3934 <primary>testing</primary>
3935 <secondary>forward file</secondary>
3936 </indexterm>
3937 <indexterm role="concept">
3938 <primary>Sieve filter</primary>
3939 <secondary>testing</secondary>
3940 </indexterm>
3941 This option runs Exim in user filter testing mode; the file is the filter file
3942 to be tested, and a test message must be supplied on the standard input. If
3943 there are no message-dependent tests in the filter, an empty file can be
3944 supplied.
3945 </para>
3946 <para>
3947 If you want to test a system filter file, use <option>-bF</option> instead of <option>-bf</option>. You
3948 can use both <option>-bF</option> and <option>-bf</option> on the same command, in order to test a system
3949 filter and a user filter in the same run. For example:
3950 </para>
3951 <literallayout class="monospaced">
3952 exim -bF /system/filter -bf /user/filter &lt;/test/message
3953 </literallayout>
3954 <para>
3955 This is helpful when the system filter adds header lines or sets filter
3956 variables that are used by the user filter.
3957 </para>
3958 <para>
3959 If the test filter file does not begin with one of the special lines
3960 </para>
3961 <literallayout class="monospaced">
3962 # Exim filter
3963 # Sieve filter
3964 </literallayout>
3965 <para>
3966 it is taken to be a normal <filename>.forward</filename> file, and is tested for validity under
3967 that interpretation. See sections <xref linkend="SECTitenonfilred"/> to
3968 <xref linkend="SECTspecitredli"/> for a description of the possible contents of non-filter
3969 redirection lists.
3970 </para>
3971 <para>
3972 The result of an Exim command that uses <option>-bf</option>, provided no errors are
3973 detected, is a list of the actions that Exim would try to take if presented
3974 with the message for real. More details of filter testing are given in the
3975 separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>.
3976 </para>
3977 <para>
3978 When testing a filter file,
3979 <indexterm role="concept">
3980 <primary><quote>From</quote> line</primary>
3981 </indexterm>
3982 <indexterm role="concept">
3983 <primary>envelope sender</primary>
3984 </indexterm>
3985 <indexterm role="option">
3986 <primary><option>-f</option></primary>
3987 <secondary>for filter testing</secondary>
3988 </indexterm>
3989 the envelope sender can be set by the <option>-f</option> option,
3990 or by a <quote>From&nbsp;</quote> line at the start of the test message. Various parameters
3991 that would normally be taken from the envelope recipient address of the message
3992 can be set by means of additional command line options (see the next four
3993 options).
3994 </para>
3995 </listitem></varlistentry>
3996 <varlistentry>
3997 <term><option>-bfd</option>&nbsp;&lt;<emphasis>domain</emphasis>&gt;</term>
3998 <listitem>
3999 <para>
4000 <indexterm role="option">
4001 <primary><option>-bfd</option></primary>
4002 </indexterm>
4003 <indexterm role="variable">
4004 <primary><varname>$qualify_domain</varname></primary>
4005 </indexterm>
4006 This sets the domain of the recipient address when a filter file is being
4007 tested by means of the <option>-bf</option> option. The default is the value of
4008 <varname>$qualify_domain</varname>.
4009 </para>
4010 </listitem></varlistentry>
4011 <varlistentry>
4012 <term><option>-bfl</option>&nbsp;&lt;<emphasis>local&nbsp;part</emphasis>&gt;</term>
4013 <listitem>
4014 <para>
4015 <indexterm role="option">
4016 <primary><option>-bfl</option></primary>
4017 </indexterm>
4018 This sets the local part of the recipient address when a filter file is being
4019 tested by means of the <option>-bf</option> option. The default is the username of the
4020 process that calls Exim. A local part should be specified with any prefix or
4021 suffix stripped, because that is how it appears to the filter when a message is
4022 actually being delivered.
4023 </para>
4024 </listitem></varlistentry>
4025 <varlistentry>
4026 <term><option>-bfp</option>&nbsp;&lt;<emphasis>prefix</emphasis>&gt;</term>
4027 <listitem>
4028 <para>
4029 <indexterm role="option">
4030 <primary><option>-bfp</option></primary>
4031 </indexterm>
4032 This sets the prefix of the local part of the recipient address when a filter
4033 file is being tested by means of the <option>-bf</option> option. The default is an empty
4034 prefix.
4035 </para>
4036 </listitem></varlistentry>
4037 <varlistentry>
4038 <term><option>-bfs</option>&nbsp;&lt;<emphasis>suffix</emphasis>&gt;</term>
4039 <listitem>
4040 <para>
4041 <indexterm role="option">
4042 <primary><option>-bfs</option></primary>
4043 </indexterm>
4044 This sets the suffix of the local part of the recipient address when a filter
4045 file is being tested by means of the <option>-bf</option> option. The default is an empty
4046 suffix.
4047 </para>
4048 </listitem></varlistentry>
4049 <varlistentry>
4050 <term><option>-bh</option>&nbsp;&lt;<emphasis>IP&nbsp;address</emphasis>&gt;</term>
4051 <listitem>
4052 <para>
4053 <indexterm role="option">
4054 <primary><option>-bh</option></primary>
4055 </indexterm>
4056 <indexterm role="concept">
4057 <primary>testing</primary>
4058 <secondary>incoming SMTP</secondary>
4059 </indexterm>
4060 <indexterm role="concept">
4061 <primary>SMTP</primary>
4062 <secondary>testing incoming</secondary>
4063 </indexterm>
4064 <indexterm role="concept">
4065 <primary>testing</primary>
4066 <secondary>relay control</secondary>
4067 </indexterm>
4068 <indexterm role="concept">
4069 <primary>relaying</primary>
4070 <secondary>testing configuration</secondary>
4071 </indexterm>
4072 <indexterm role="concept">
4073 <primary>policy control</primary>
4074 <secondary>testing</secondary>
4075 </indexterm>
4076 <indexterm role="concept">
4077 <primary>debugging</primary>
4078 <secondary><option>-bh</option> option</secondary>
4079 </indexterm>
4080 This option runs a fake SMTP session as if from the given IP address, using the
4081 standard input and output. The IP address may include a port number at the end,
4082 after a full stop. For example:
4083 </para>
4084 <literallayout class="monospaced">
4085 exim -bh 10.9.8.7.1234
4086 exim -bh fe80::a00:20ff:fe86:a061.5678
4087 </literallayout>
4088 <para>
4089 When an IPv6 address is given, it is converted into canonical form. In the case
4090 of the second example above, the value of <varname>$sender_host_address</varname> after
4091 conversion to the canonical form is
4092 <literal>fe80:0000:0000:0a00:20ff:fe86:a061.5678</literal>.
4093 </para>
4094 <para>
4095 Comments as to what is going on are written to the standard error file. These
4096 include lines beginning with <quote>LOG</quote> for anything that would have been logged.
4097 This facility is provided for testing configuration options for incoming
4098 messages, to make sure they implement the required policy. For example, you can
4099 test your relay controls using <option>-bh</option>.
4100 </para>
4101 <para>
4102 <emphasis role="bold">Warning 1</emphasis>:
4103 <indexterm role="concept">
4104 <primary>RFC 1413</primary>
4105 </indexterm>
4106 You can test features of the configuration that rely on ident (RFC 1413)
4107 information by using the <option>-oMt</option> option. However, Exim cannot actually perform
4108 an ident callout when testing using <option>-bh</option> because there is no incoming SMTP
4109 connection.
4110 </para>
4111 <para>
4112 <emphasis role="bold">Warning 2</emphasis>: Address verification callouts (see section <xref linkend="SECTcallver"/>)
4113 are also skipped when testing using <option>-bh</option>. If you want these callouts to
4114 occur, use <option>-bhc</option> instead.
4115 </para>
4116 <para>
4117 Messages supplied during the testing session are discarded, and nothing is
4118 written to any of the real log files. There may be pauses when DNS (and other)
4119 lookups are taking place, and of course these may time out. The <option>-oMi</option> option
4120 can be used to specify a specific IP interface and port if this is important,
4121 and <option>-oMaa</option> and <option>-oMai</option> can be used to set parameters as if the SMTP
4122 session were authenticated.
4123 </para>
4124 <para>
4125 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option> whose
4126 output just states whether a given recipient address from a given host is
4127 acceptable or not. See section <xref linkend="SECTcheckaccess"/>.
4128 </para>
4129 <para>
4130 Features such as authentication and encryption, where the client input is not
4131 plain text, cannot easily be tested with <option>-bh</option>. Instead, you should use a
4132 specialized SMTP test program such as
4133 <emphasis role="bold"><ulink url="http://jetmore.org/john/code/#swaks">swaks</ulink></emphasis>.
4134 </para>
4135 </listitem></varlistentry>
4136 <varlistentry>
4137 <term><option>-bhc</option>&nbsp;&lt;<emphasis>IP&nbsp;address</emphasis>&gt;</term>
4138 <listitem>
4139 <para>
4140 <indexterm role="option">
4141 <primary><option>-bhc</option></primary>
4142 </indexterm>
4143 This option operates in the same way as <option>-bh</option>, except that address
4144 verification callouts are performed if required. This includes consulting and
4145 updating the callout cache database.
4146 </para>
4147 </listitem></varlistentry>
4148 <varlistentry>
4149 <term><option>-bi</option></term>
4150 <listitem>
4151 <para>
4152 <indexterm role="option">
4153 <primary><option>-bi</option></primary>
4154 </indexterm>
4155 <indexterm role="concept">
4156 <primary>alias file</primary>
4157 <secondary>building</secondary>
4158 </indexterm>
4159 <indexterm role="concept">
4160 <primary>building alias file</primary>
4161 </indexterm>
4162 <indexterm role="concept">
4163 <primary>Sendmail compatibility</primary>
4164 <secondary><option>-bi</option> option</secondary>
4165 </indexterm>
4166 Sendmail interprets the <option>-bi</option> option as a request to rebuild its alias file.
4167 Exim does not have the concept of a single alias file, and so it cannot mimic
4168 this behaviour. However, calls to <filename>/usr/lib/sendmail</filename> with the <option>-bi</option> option
4169 tend to appear in various scripts such as NIS make files, so the option must be
4170 recognized.
4171 </para>
4172 <para>
4173 If <option>-bi</option> is encountered, the command specified by the <option>bi_command</option>
4174 configuration option is run, under the uid and gid of the caller of Exim. If
4175 the <option>-oA</option> option is used, its value is passed to the command as an argument.
4176 The command set by <option>bi_command</option> may not contain arguments. The command can
4177 use the <emphasis>exim_dbmbuild</emphasis> utility, or some other means, to rebuild alias files
4178 if this is required. If the <option>bi_command</option> option is not set, calling Exim with
4179 <option>-bi</option> is a no-op.
4180 </para>
4181 </listitem></varlistentry>
4182 <varlistentry>
4183 <term><option>-bI:help</option></term>
4184 <listitem>
4185 <para>
4186 <indexterm role="option">
4187 <primary><option>-bI:help</option></primary>
4188 </indexterm>
4189 <indexterm role="concept">
4190 <primary>querying exim information</primary>
4191 </indexterm>
4192 We shall provide various options starting <literal>-bI:</literal> for querying Exim for
4193 information.  The output of many of these will be intended for machine
4194 consumption.  This one is not.  The <option>-bI:help</option> option asks Exim for a
4195 synopsis of supported options beginning <literal>-bI:</literal>.  Use of any of these
4196 options shall cause Exim to exit after producing the requested output.
4197 </para>
4198 </listitem></varlistentry>
4199 <varlistentry>
4200 <term><option>-bI:dscp</option></term>
4201 <listitem>
4202 <para>
4203 <indexterm role="option">
4204 <primary><option>-bI:dscp</option></primary>
4205 </indexterm>
4206 <indexterm role="concept">
4207 <primary>DSCP</primary>
4208 <secondary>values</secondary>
4209 </indexterm>
4210 This option causes Exim to emit an alphabetically sorted list of all
4211 recognised DSCP names.
4212 </para>
4213 </listitem></varlistentry>
4214 <varlistentry>
4215 <term><option>-bI:sieve</option></term>
4216 <listitem>
4217 <para>
4218 <indexterm role="option">
4219 <primary><option>-bI:sieve</option></primary>
4220 </indexterm>
4221 <indexterm role="concept">
4222 <primary>Sieve filter</primary>
4223 <secondary>capabilities</secondary>
4224 </indexterm>
4225 This option causes Exim to emit an alphabetically sorted list of all supported
4226 Sieve protocol extensions on stdout, one per line.  This is anticipated to be
4227 useful for ManageSieve (RFC 5804) implementations, in providing that protocol&#x2019;s
4228 <literal>SIEVE</literal> capability response line.  As the precise list may depend upon
4229 compile-time build options, which this option will adapt to, this is the only
4230 way to guarantee a correct response.
4231 </para>
4232 </listitem></varlistentry>
4233 <varlistentry>
4234 <term><option>-bm</option></term>
4235 <listitem>
4236 <para>
4237 <indexterm role="option">
4238 <primary><option>-bm</option></primary>
4239 </indexterm>
4240 <indexterm role="concept">
4241 <primary>local message reception</primary>
4242 </indexterm>
4243 This option runs an Exim receiving process that accepts an incoming,
4244 locally-generated message on the standard input. The recipients are given as the
4245 command arguments (except when <option>-t</option> is also present &ndash; see below). Each
4246 argument can be a comma-separated list of RFC 2822 addresses. This is the
4247 default option for selecting the overall action of an Exim call; it is assumed
4248 if no other conflicting option is present.
4249 </para>
4250 <para>
4251 If any addresses in the message are unqualified (have no domain), they are
4252 qualified by the values of the <option>qualify_domain</option> or <option>qualify_recipient</option>
4253 options, as appropriate. The <option>-bnq</option> option (see below) provides a way of
4254 suppressing this for special cases.
4255 </para>
4256 <para>
4257 Policy checks on the contents of local messages can be enforced by means of
4258 the non-SMTP ACL. See chapter <xref linkend="CHAPACL"/> for details.
4259 </para>
4260 <para>
4261 <indexterm role="concept">
4262 <primary>return code</primary>
4263 <secondary>for <option>-bm</option></secondary>
4264 </indexterm>
4265 The return code is zero if the message is successfully accepted. Otherwise, the
4266 action is controlled by the <option>-oe</option><emphasis>x</emphasis> option setting &ndash; see below.
4267 </para>
4268 <para>
4269 The format
4270 <indexterm role="concept">
4271 <primary>message</primary>
4272 <secondary>format</secondary>
4273 </indexterm>
4274 <indexterm role="concept">
4275 <primary>format</primary>
4276 <secondary>message</secondary>
4277 </indexterm>
4278 <indexterm role="concept">
4279 <primary><quote>From</quote> line</primary>
4280 </indexterm>
4281 <indexterm role="concept">
4282 <primary>UUCP</primary>
4283 <secondary><quote>From</quote> line</secondary>
4284 </indexterm>
4285 <indexterm role="concept">
4286 <primary>Sendmail compatibility</primary>
4287 <secondary><quote>From</quote> line</secondary>
4288 </indexterm>
4289 of the message must be as defined in RFC 2822, except that, for
4290 compatibility with Sendmail and Smail, a line in one of the forms
4291 </para>
4292 <literallayout class="monospaced">
4293 From sender Fri Jan  5 12:55 GMT 1997
4294 From sender Fri, 5 Jan 97 12:55:01
4295 </literallayout>
4296 <para>
4297 (with the weekday optional, and possibly with additional text after the date)
4298 is permitted to appear at the start of the message. There appears to be no
4299 authoritative specification of the format of this line. Exim recognizes it by
4300 matching against the regular expression defined by the <option>uucp_from_pattern</option>
4301 option, which can be changed if necessary.
4302 </para>
4303 <para>
4304 <indexterm role="option">
4305 <primary><option>-f</option></primary>
4306 <secondary>overriding <quote>From</quote> line</secondary>
4307 </indexterm>
4308 The specified sender is treated as if it were given as the argument to the
4309 <option>-f</option> option, but if a <option>-f</option> option is also present, its argument is used in
4310 preference to the address taken from the message. The caller of Exim must be a
4311 trusted user for the sender of a message to be set in this way.
4312 </para>
4313 </listitem></varlistentry>
4314 <varlistentry>
4315 <term><option>-bmalware</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
4316 <listitem>
4317 <para>
4318 <indexterm role="option">
4319 <primary><option>-bmalware</option></primary>
4320 </indexterm>
4321 <indexterm role="concept">
4322 <primary>testing</primary>
4323 <secondary>,</secondary>
4324 </indexterm>
4325 <indexterm role="concept">
4326 <primary>malware scan test</primary>
4327 </indexterm>
4328 This debugging option causes Exim to scan the given file or directory
4329 (depending on the used scanner interface),
4330 using the malware scanning framework.  The option of <option>av_scanner</option> influences
4331 this option, so if <option>av_scanner</option>&#x2019;s value is dependent upon an expansion then
4332 the expansion should have defaults which apply to this invocation.  ACLs are
4333 not invoked, so if <option>av_scanner</option> references an ACL variable then that variable
4334 will never be populated and <option>-bmalware</option> will fail.
4335 </para>
4336 <para>
4337 Exim will have changed working directory before resolving the filename, so
4338 using fully qualified pathnames is advisable.  Exim will be running as the Exim
4339 user when it tries to open the file, rather than as the invoking user.
4340 This option requires admin privileges.
4341 </para>
4342 <para>
4343 The <option>-bmalware</option> option will not be extended to be more generally useful,
4344 there are better tools for file-scanning.  This option exists to help
4345 administrators verify their Exim and AV scanner configuration.
4346 </para>
4347 </listitem></varlistentry>
4348 <varlistentry>
4349 <term><option>-bnq</option></term>
4350 <listitem>
4351 <para>
4352 <indexterm role="option">
4353 <primary><option>-bnq</option></primary>
4354 </indexterm>
4355 <indexterm role="concept">
4356 <primary>address qualification, suppressing</primary>
4357 </indexterm>
4358 By default, Exim automatically qualifies unqualified addresses (those
4359 without domains) that appear in messages that are submitted locally (that
4360 is, not over TCP/IP). This qualification applies both to addresses in
4361 envelopes, and addresses in header lines. Sender addresses are qualified using
4362 <option>qualify_domain</option>, and recipient addresses using <option>qualify_recipient</option> (which
4363 defaults to the value of <option>qualify_domain</option>).
4364 </para>
4365 <para>
4366 Sometimes, qualification is not wanted. For example, if <option>-bS</option> (batch SMTP) is
4367 being used to re-submit messages that originally came from remote hosts after
4368 content scanning, you probably do not want to qualify unqualified addresses in
4369 header lines. (Such lines will be present only if you have not enabled a header
4370 syntax check in the appropriate ACL.)
4371 </para>
4372 <para>
4373 The <option>-bnq</option> option suppresses all qualification of unqualified addresses in
4374 messages that originate on the local host. When this is used, unqualified
4375 addresses in the envelope provoke errors (causing message rejection) and
4376 unqualified addresses in header lines are left alone.
4377 </para>
4378 </listitem></varlistentry>
4379 <varlistentry>
4380 <term><option>-bP</option></term>
4381 <listitem>
4382 <para>
4383 <indexterm role="option">
4384 <primary><option>-bP</option></primary>
4385 </indexterm>
4386 <indexterm role="concept">
4387 <primary>configuration options</primary>
4388 <secondary>extracting</secondary>
4389 </indexterm>
4390 <indexterm role="concept">
4391 <primary>options</primary>
4392 <secondary>configuration &ndash; extracting</secondary>
4393 </indexterm>
4394 If this option is given with no arguments, it causes the values of all Exim&#x2019;s
4395 main configuration options to be written to the standard output. The values
4396 of one or more specific options can be requested by giving their names as
4397 arguments, for example:
4398 </para>
4399 <literallayout class="monospaced">
4400 exim -bP qualify_domain hold_domains
4401 </literallayout>
4402 <para>
4403 <indexterm role="concept">
4404 <primary>hiding configuration option values</primary>
4405 </indexterm>
4406 <indexterm role="concept">
4407 <primary>configuration options</primary>
4408 <secondary>hiding value of</secondary>
4409 </indexterm>
4410 <indexterm role="concept">
4411 <primary>options</primary>
4412 <secondary>hiding value of</secondary>
4413 </indexterm>
4414 However, any option setting that is preceded by the word <quote>hide</quote> in the
4415 configuration file is not shown in full, except to an admin user. For other
4416 users, the output is as in this example:
4417 </para>
4418 <literallayout class="monospaced">
4419 mysql_servers = &lt;value not displayable&gt;
4420 </literallayout>
4421 <para>
4422 If <option>config</option> is given as an argument, the config is
4423 output, as it was parsed, any include file resolved, any comment removed.
4424 </para>
4425 <para>
4426 If <option>config_file</option> is given as an argument, the name of the run time
4427 configuration file is output. (<option>configure_file</option> works too, for
4428 backward compatibility.)
4429 If a list of configuration files was supplied, the value that is output here
4430 is the name of the file that was actually used.
4431 </para>
4432 <para>
4433 <indexterm role="concept">
4434 <primary>options</primary>
4435 <secondary>hiding name of</secondary>
4436 </indexterm>
4437 If the <option>-n</option> flag is given, then for most modes of <option>-bP</option> operation the
4438 name will not be output.
4439 </para>
4440 <para>
4441 <indexterm role="concept">
4442 <primary>daemon</primary>
4443 <secondary>process id (pid)</secondary>
4444 </indexterm>
4445 <indexterm role="concept">
4446 <primary>pid (process id)</primary>
4447 <secondary>of daemon</secondary>
4448 </indexterm>
4449 If <option>log_file_path</option> or <option>pid_file_path</option> are given, the names of the
4450 directories where log files and daemon pid files are written are output,
4451 respectively. If these values are unset, log files are written in a
4452 sub-directory of the spool directory called <option>log</option>, and the pid file is
4453 written directly into the spool directory.
4454 </para>
4455 <para>
4456 If <option>-bP</option> is followed by a name preceded by <literal>+</literal>, for example,
4457 </para>
4458 <literallayout class="monospaced">
4459 exim -bP +local_domains
4460 </literallayout>
4461 <para>
4462 it searches for a matching named list of any type (domain, host, address, or
4463 local part) and outputs what it finds.
4464 </para>
4465 <para>
4466 <indexterm role="concept">
4467 <primary>options</primary>
4468 <secondary>router &ndash; extracting</secondary>
4469 </indexterm>
4470 <indexterm role="concept">
4471 <primary>options</primary>
4472 <secondary>transport &ndash; extracting</secondary>
4473 </indexterm>
4474 <indexterm role="concept">
4475 <primary>options</primary>
4476 <secondary>authenticator &ndash; extracting</secondary>
4477 </indexterm>
4478 If one of the words <option>router</option>, <option>transport</option>, or <option>authenticator</option> is given,
4479 followed by the name of an appropriate driver instance, the option settings for
4480 that driver are output. For example:
4481 </para>
4482 <literallayout class="monospaced">
4483 exim -bP transport local_delivery
4484 </literallayout>
4485 <para>
4486 The generic driver options are output first, followed by the driver&#x2019;s private
4487 options. A list of the names of drivers of a particular type can be obtained by
4488 using one of the words <option>router_list</option>, <option>transport_list</option>, or
4489 <option>authenticator_list</option>, and a complete list of all drivers with their option
4490 settings can be obtained by using <option>routers</option>, <option>transports</option>, or
4491 <option>authenticators</option>.
4492 </para>
4493 <para>
4494 <indexterm role="concept">
4495 <primary>environment</primary>
4496 </indexterm>
4497 If <option>environment</option> is given as an argument, the set of environment
4498 variables is output, line by line. Using the <option>-n</option> flag suppresses the value of the
4499 variables.
4500 </para>
4501 <para>
4502 <indexterm role="concept">
4503 <primary>options</primary>
4504 <secondary>macro &ndash; extracting</secondary>
4505 </indexterm>
4506 If invoked by an admin user, then <option>macro</option>, <option>macro_list</option> and <option>macros</option>
4507 are available, similarly to the drivers.  Because macros are sometimes used
4508 for storing passwords, this option is restricted.
4509 The output format is one item per line.
4510 </para>
4511 </listitem></varlistentry>
4512 <varlistentry>
4513 <term><option>-bp</option></term>
4514 <listitem>
4515 <para>
4516 <indexterm role="option">
4517 <primary><option>-bp</option></primary>
4518 </indexterm>
4519 <indexterm role="concept">
4520 <primary>queue</primary>
4521 <secondary>listing messages on</secondary>
4522 </indexterm>
4523 <indexterm role="concept">
4524 <primary>listing</primary>
4525 <secondary>messages on the queue</secondary>
4526 </indexterm>
4527 This option requests a listing of the contents of the mail queue on the
4528 standard output. If the <option>-bp</option> option is followed by a list of message ids,
4529 just those messages are listed. By default, this option can be used only by an
4530 admin user. However, the <option>queue_list_requires_admin</option> option can be set false
4531 to allow any user to see the queue.
4532 </para>
4533 <para>
4534 Each message on the queue is displayed as in the following example:
4535 </para>
4536 <literallayout class="monospaced">
4537 25m  2.9K 0t5C6f-0000c8-00 &lt;alice@wonderland.fict.example&gt;
4538           red.king@looking-glass.fict.example
4539           &lt;other addresses&gt;
4540 </literallayout>
4541 <para>
4542 <indexterm role="concept">
4543 <primary>message</primary>
4544 <secondary>size in queue listing</secondary>
4545 </indexterm>
4546 <indexterm role="concept">
4547 <primary>size</primary>
4548 <secondary>of message</secondary>
4549 </indexterm>
4550 The first line contains the length of time the message has been on the queue
4551 (in this case 25 minutes), the size of the message (2.9K), the unique local
4552 identifier for the message, and the message sender, as contained in the
4553 envelope. For bounce messages, the sender address is empty, and appears as
4554 <quote>&lt;&gt;</quote>. If the message was submitted locally by an untrusted user who overrode
4555 the default sender address, the user&#x2019;s login name is shown in parentheses
4556 before the sender address.
4557 </para>
4558 <para>
4559 <indexterm role="concept">
4560 <primary>frozen messages</primary>
4561 <secondary>in queue listing</secondary>
4562 </indexterm>
4563 If the message is frozen (attempts to deliver it are suspended) then the text
4564 <quote>*** frozen ***</quote> is displayed at the end of this line.
4565 </para>
4566 <para>
4567 The recipients of the message (taken from the envelope, not the headers) are
4568 displayed on subsequent lines. Those addresses to which the message has already
4569 been delivered are marked with the letter D. If an original address gets
4570 expanded into several addresses via an alias or forward file, the original is
4571 displayed with a D only when deliveries for all of its child addresses are
4572 complete.
4573 </para>
4574 </listitem></varlistentry>
4575 <varlistentry>
4576 <term><option>-bpa</option></term>
4577 <listitem>
4578 <para>
4579 <indexterm role="option">
4580 <primary><option>-bpa</option></primary>
4581 </indexterm>
4582 This option operates like <option>-bp</option>, but in addition it shows delivered addresses
4583 that were generated from the original top level address(es) in each message by
4584 alias or forwarding operations. These addresses are flagged with <quote>+D</quote> instead
4585 of just <quote>D</quote>.
4586 </para>
4587 </listitem></varlistentry>
4588 <varlistentry>
4589 <term><option>-bpc</option></term>
4590 <listitem>
4591 <para>
4592 <indexterm role="option">
4593 <primary><option>-bpc</option></primary>
4594 </indexterm>
4595 <indexterm role="concept">
4596 <primary>queue</primary>
4597 <secondary>count of messages on</secondary>
4598 </indexterm>
4599 This option counts the number of messages on the queue, and writes the total
4600 to the standard output. It is restricted to admin users, unless
4601 <option>queue_list_requires_admin</option> is set false.
4602 </para>
4603 </listitem></varlistentry>
4604 <varlistentry>
4605 <term><option>-bpr</option></term>
4606 <listitem>
4607 <para>
4608 <indexterm role="option">
4609 <primary><option>-bpr</option></primary>
4610 </indexterm>
4611 This option operates like <option>-bp</option>, but the output is not sorted into
4612 chronological order of message arrival. This can speed it up when there are
4613 lots of messages on the queue, and is particularly useful if the output is
4614 going to be post-processed in a way that doesn&#x2019;t need the sorting.
4615 </para>
4616 </listitem></varlistentry>
4617 <varlistentry>
4618 <term><option>-bpra</option></term>
4619 <listitem>
4620 <para>
4621 <indexterm role="option">
4622 <primary><option>-bpra</option></primary>
4623 </indexterm>
4624 This option is a combination of <option>-bpr</option> and <option>-bpa</option>.
4625 </para>
4626 </listitem></varlistentry>
4627 <varlistentry>
4628 <term><option>-bpru</option></term>
4629 <listitem>
4630 <para>
4631 <indexterm role="option">
4632 <primary><option>-bpru</option></primary>
4633 </indexterm>
4634 This option is a combination of <option>-bpr</option> and <option>-bpu</option>.
4635 </para>
4636 </listitem></varlistentry>
4637 <varlistentry>
4638 <term><option>-bpu</option></term>
4639 <listitem>
4640 <para>
4641 <indexterm role="option">
4642 <primary><option>-bpu</option></primary>
4643 </indexterm>
4644 This option operates like <option>-bp</option> but shows only undelivered top-level
4645 addresses for each message displayed. Addresses generated by aliasing or
4646 forwarding are not shown, unless the message was deferred after processing by a
4647 router with the <option>one_time</option> option set.
4648 </para>
4649 </listitem></varlistentry>
4650 <varlistentry>
4651 <term><option>-brt</option></term>
4652 <listitem>
4653 <para>
4654 <indexterm role="option">
4655 <primary><option>-brt</option></primary>
4656 </indexterm>
4657 <indexterm role="concept">
4658 <primary>testing</primary>
4659 <secondary>retry configuration</secondary>
4660 </indexterm>
4661 <indexterm role="concept">
4662 <primary>retry</primary>
4663 <secondary>configuration testing</secondary>
4664 </indexterm>
4665 This option is for testing retry rules, and it must be followed by up to three
4666 arguments. It causes Exim to look for a retry rule that matches the values
4667 and to write it to the standard output. For example:
4668 </para>
4669 <literallayout class="monospaced">
4670 exim -brt bach.comp.mus.example
4671 Retry rule: *.comp.mus.example  F,2h,15m; F,4d,30m;
4672 </literallayout>
4673 <para>
4674 See chapter <xref linkend="CHAPretry"/> for a description of Exim&#x2019;s retry rules. The first
4675 argument, which is required, can be a complete address in the form
4676 <emphasis>local_part@domain</emphasis>, or it can be just a domain name. If the second argument
4677 contains a dot, it is interpreted as an optional second domain name; if no
4678 retry rule is found for the first argument, the second is tried. This ties in
4679 with Exim&#x2019;s behaviour when looking for retry rules for remote hosts &ndash; if no
4680 rule is found that matches the host, one that matches the mail domain is
4681 sought. Finally, an argument that is the name of a specific delivery error, as
4682 used in setting up retry rules, can be given. For example:
4683 </para>
4684 <literallayout class="monospaced">
4685 exim -brt haydn.comp.mus.example quota_3d
4686 Retry rule: *@haydn.comp.mus.example quota_3d  F,1h,15m
4687 </literallayout>
4688 </listitem></varlistentry>
4689 <varlistentry>
4690 <term><option>-brw</option></term>
4691 <listitem>
4692 <para>
4693 <indexterm role="option">
4694 <primary><option>-brw</option></primary>
4695 </indexterm>
4696 <indexterm role="concept">
4697 <primary>testing</primary>
4698 <secondary>rewriting</secondary>
4699 </indexterm>
4700 <indexterm role="concept">
4701 <primary>rewriting</primary>
4702 <secondary>testing</secondary>
4703 </indexterm>
4704 This option is for testing address rewriting rules, and it must be followed by
4705 a single argument, consisting of either a local part without a domain, or a
4706 complete address with a fully qualified domain. Exim outputs how this address
4707 would be rewritten for each possible place it might appear. See chapter
4708 <xref linkend="CHAPrewrite"/> for further details.
4709 </para>
4710 </listitem></varlistentry>
4711 <varlistentry>
4712 <term><option>-bS</option></term>
4713 <listitem>
4714 <para>
4715 <indexterm role="option">
4716 <primary><option>-bS</option></primary>
4717 </indexterm>
4718 <indexterm role="concept">
4719 <primary>SMTP</primary>
4720 <secondary>batched incoming</secondary>
4721 </indexterm>
4722 <indexterm role="concept">
4723 <primary>batched SMTP input</primary>
4724 </indexterm>
4725 This option is used for batched SMTP input, which is an alternative interface
4726 for non-interactive local message submission. A number of messages can be
4727 submitted in a single run. However, despite its name, this is not really SMTP
4728 input. Exim reads each message&#x2019;s envelope from SMTP commands on the standard
4729 input, but generates no responses. If the caller is trusted, or
4730 <option>untrusted_set_sender</option> is set, the senders in the SMTP MAIL commands are
4731 believed; otherwise the sender is always the caller of Exim.
4732 </para>
4733 <para>
4734 The message itself is read from the standard input, in SMTP format (leading
4735 dots doubled), terminated by a line containing just a single dot. An error is
4736 provoked if the terminating dot is missing. A further message may then follow.
4737 </para>
4738 <para>
4739 As for other local message submissions, the contents of incoming batch SMTP
4740 messages can be checked using the non-SMTP ACL (see chapter <xref linkend="CHAPACL"/>).
4741 Unqualified addresses are automatically qualified using <option>qualify_domain</option> and
4742 <option>qualify_recipient</option>, as appropriate, unless the <option>-bnq</option> option is used.
4743 </para>
4744 <para>
4745 Some other SMTP commands are recognized in the input. HELO and EHLO act
4746 as RSET; VRFY, EXPN, ETRN, and HELP act as NOOP;
4747 QUIT quits, ignoring the rest of the standard input.
4748 </para>
4749 <para>
4750 <indexterm role="concept">
4751 <primary>return code</primary>
4752 <secondary>for <option>-bS</option></secondary>
4753 </indexterm>
4754 If any error is encountered, reports are written to the standard output and
4755 error streams, and Exim gives up immediately. The return code is 0 if no error
4756 was detected; it is 1 if one or more messages were accepted before the error
4757 was detected; otherwise it is 2.
4758 </para>
4759 <para>
4760 More details of input using batched SMTP are given in section
4761 <xref linkend="SECTincomingbatchedSMTP"/>.
4762 </para>
4763 </listitem></varlistentry>
4764 <varlistentry>
4765 <term><option>-bs</option></term>
4766 <listitem>
4767 <para>
4768 <indexterm role="option">
4769 <primary><option>-bs</option></primary>
4770 </indexterm>
4771 <indexterm role="concept">
4772 <primary>SMTP</primary>
4773 <secondary>local input</secondary>
4774 </indexterm>
4775 <indexterm role="concept">
4776 <primary>local SMTP input</primary>
4777 </indexterm>
4778 This option causes Exim to accept one or more messages by reading SMTP commands
4779 on the standard input, and producing SMTP replies on the standard output. SMTP
4780 policy controls, as defined in ACLs (see chapter <xref linkend="CHAPACL"/>) are applied.
4781 Some user agents use this interface as a way of passing locally-generated
4782 messages to the MTA.
4783 </para>
4784 <para>
4785 In
4786 <indexterm role="concept">
4787 <primary>sender</primary>
4788 <secondary>source of</secondary>
4789 </indexterm>
4790 this usage, if the caller of Exim is trusted, or <option>untrusted_set_sender</option> is
4791 set, the senders of messages are taken from the SMTP MAIL commands.
4792 Otherwise the content of these commands is ignored and the sender is set up as
4793 the calling user. Unqualified addresses are automatically qualified using
4794 <option>qualify_domain</option> and <option>qualify_recipient</option>, as appropriate, unless the
4795 <option>-bnq</option> option is used.
4796 </para>
4797 <para>
4798 <indexterm role="concept">
4799 <primary>inetd</primary>
4800 </indexterm>
4801 The
4802 <option>-bs</option> option is also used to run Exim from <emphasis>inetd</emphasis>, as an alternative to
4803 using a listening daemon. Exim can distinguish the two cases by checking
4804 whether the standard input is a TCP/IP socket. When Exim is called from
4805 <emphasis>inetd</emphasis>, the source of the mail is assumed to be remote, and the comments
4806 above concerning senders and qualification do not apply. In this situation,
4807 Exim behaves in exactly the same way as it does when receiving a message via
4808 the listening daemon.
4809 </para>
4810 </listitem></varlistentry>
4811 <varlistentry>
4812 <term><option>-bt</option></term>
4813 <listitem>
4814 <para>
4815 <indexterm role="option">
4816 <primary><option>-bt</option></primary>
4817 </indexterm>
4818 <indexterm role="concept">
4819 <primary>testing</primary>
4820 <secondary>addresses</secondary>
4821 </indexterm>
4822 <indexterm role="concept">
4823 <primary>address</primary>
4824 <secondary>testing</secondary>
4825 </indexterm>
4826 This option runs Exim in address testing mode, in which each argument is taken
4827 as a recipient address to be tested for deliverability. The results are
4828 written to the standard output. If a test fails, and the caller is not an admin
4829 user, no details of the failure are output, because these might contain
4830 sensitive information such as usernames and passwords for database lookups.
4831 </para>
4832 <para>
4833 If no arguments are given, Exim runs in an interactive manner, prompting with a
4834 right angle bracket for addresses to be tested.
4835 </para>
4836 <para>
4837 Unlike the <option>-be</option> test option, you cannot arrange for Exim to use the
4838 <function>readline()</function> function, because it is running as <emphasis>root</emphasis> and there are
4839 security issues.
4840 </para>
4841 <para>
4842 Each address is handled as if it were the recipient address of a message
4843 (compare the <option>-bv</option> option). It is passed to the routers and the result is
4844 written to the standard output. However, any router that has
4845 <option>no_address_test</option> set is bypassed. This can make <option>-bt</option> easier to use for
4846 genuine routing tests if your first router passes everything to a scanner
4847 program.
4848 </para>
4849 <para>
4850 <indexterm role="concept">
4851 <primary>return code</primary>
4852 <secondary>for <option>-bt</option></secondary>
4853 </indexterm>
4854 The return code is 2 if any address failed outright; it is 1 if no address
4855 failed outright but at least one could not be resolved for some reason. Return
4856 code 0 is given only when all addresses succeed.
4857 </para>
4858 <para>
4859 <indexterm role="concept">
4860 <primary>duplicate addresses</primary>
4861 </indexterm>
4862 <emphasis role="bold">Note</emphasis>: When actually delivering a message, Exim removes duplicate recipient
4863 addresses after routing is complete, so that only one delivery takes place.
4864 This does not happen when testing with <option>-bt</option>; the full results of routing are
4865 always shown.
4866 </para>
4867 <para>
4868 <emphasis role="bold">Warning</emphasis>: <option>-bt</option> can only do relatively simple testing. If any of the
4869 routers in the configuration makes any tests on the sender address of a
4870 message,
4871 <indexterm role="option">
4872 <primary><option>-f</option></primary>
4873 <secondary>for address testing</secondary>
4874 </indexterm>
4875 you can use the <option>-f</option> option to set an appropriate sender when running
4876 <option>-bt</option> tests. Without it, the sender is assumed to be the calling user at the
4877 default qualifying domain. However, if you have set up (for example) routers
4878 whose behaviour depends on the contents of an incoming message, you cannot test
4879 those conditions using <option>-bt</option>. The <option>-N</option> option provides a possible way of
4880 doing such tests.
4881 </para>
4882 </listitem></varlistentry>
4883 <varlistentry>
4884 <term><option>-bV</option></term>
4885 <listitem>
4886 <para>
4887 <indexterm role="option">
4888 <primary><option>-bV</option></primary>
4889 </indexterm>
4890 <indexterm role="concept">
4891 <primary>version number of Exim</primary>
4892 </indexterm>
4893 This option causes Exim to write the current version number, compilation
4894 number, and compilation date of the <emphasis>exim</emphasis> binary to the standard output.
4895 It also lists the DBM library that is being used, the optional modules (such as
4896 specific lookup types), the drivers that are included in the binary, and the
4897 name of the run time configuration file that is in use.
4898 </para>
4899 <para>
4900 As part of its operation, <option>-bV</option> causes Exim to read and syntax check its
4901 configuration file. However, this is a static check only. It cannot check
4902 values that are to be expanded. For example, although a misspelt ACL verb is
4903 detected, an error in the verb&#x2019;s arguments is not. You cannot rely on <option>-bV</option>
4904 alone to discover (for example) all the typos in the configuration; some
4905 realistic testing is needed. The <option>-bh</option> and <option>-N</option> options provide more
4906 dynamic testing facilities.
4907 </para>
4908 </listitem></varlistentry>
4909 <varlistentry>
4910 <term><option>-bv</option></term>
4911 <listitem>
4912 <para>
4913 <indexterm role="option">
4914 <primary><option>-bv</option></primary>
4915 </indexterm>
4916 <indexterm role="concept">
4917 <primary>verifying address</primary>
4918 <secondary>using <option>-bv</option></secondary>
4919 </indexterm>
4920 <indexterm role="concept">
4921 <primary>address</primary>
4922 <secondary>verification</secondary>
4923 </indexterm>
4924 This option runs Exim in address verification mode, in which each argument is
4925 taken as a recipient address to be verified by the routers. (This does
4926 not involve any verification callouts). During normal operation, verification
4927 happens mostly as a consequence processing a <option>verify</option> condition in an ACL
4928 (see chapter <xref linkend="CHAPACL"/>). If you want to test an entire ACL, possibly
4929 including callouts, see the <option>-bh</option> and <option>-bhc</option> options.
4930 </para>
4931 <para>
4932 If verification fails, and the caller is not an admin user, no details of the
4933 failure are output, because these might contain sensitive information such as
4934 usernames and passwords for database lookups.
4935 </para>
4936 <para>
4937 If no arguments are given, Exim runs in an interactive manner, prompting with a
4938 right angle bracket for addresses to be verified.
4939 </para>
4940 <para>
4941 Unlike the <option>-be</option> test option, you cannot arrange for Exim to use the
4942 <function>readline()</function> function, because it is running as <emphasis>exim</emphasis> and there are
4943 security issues.
4944 </para>
4945 <para>
4946 Verification differs from address testing (the <option>-bt</option> option) in that routers
4947 that have <option>no_verify</option> set are skipped, and if the address is accepted by a
4948 router that has <option>fail_verify</option> set, verification fails. The address is
4949 verified as a recipient if <option>-bv</option> is used; to test verification for a sender
4950 address, <option>-bvs</option> should be used.
4951 </para>
4952 <para>
4953 If the <option>-v</option> option is not set, the output consists of a single line for each
4954 address, stating whether it was verified or not, and giving a reason in the
4955 latter case. Without <option>-v</option>, generating more than one address by redirection
4956 causes verification to end successfully, without considering the generated
4957 addresses. However, if just one address is generated, processing continues,
4958 and the generated address must verify successfully for the overall verification
4959 to succeed.
4960 </para>
4961 <para>
4962 When <option>-v</option> is set, more details are given of how the address has been handled,
4963 and in the case of address redirection, all the generated addresses are also
4964 considered. Verification may succeed for some and fail for others.
4965 </para>
4966 <para>
4967 The
4968 <indexterm role="concept">
4969 <primary>return code</primary>
4970 <secondary>for <option>-bv</option></secondary>
4971 </indexterm>
4972 return code is 2 if any address failed outright; it is 1 if no address
4973 failed outright but at least one could not be resolved for some reason. Return
4974 code 0 is given only when all addresses succeed.
4975 </para>
4976 <para>
4977 If any of the routers in the configuration makes any tests on the sender
4978 address of a message, you should use the <option>-f</option> option to set an appropriate
4979 sender when running <option>-bv</option> tests. Without it, the sender is assumed to be the
4980 calling user at the default qualifying domain.
4981 </para>
4982 </listitem></varlistentry>
4983 <varlistentry>
4984 <term><option>-bvs</option></term>
4985 <listitem>
4986 <para>
4987 <indexterm role="option">
4988 <primary><option>-bvs</option></primary>
4989 </indexterm>
4990 This option acts like <option>-bv</option>, but verifies the address as a sender rather
4991 than a recipient address. This affects any rewriting and qualification that
4992 might happen.
4993 </para>
4994 </listitem></varlistentry>
4995 <varlistentry>
4996 <term><option>-bw</option></term>
4997 <listitem>
4998 <para>
4999 <indexterm role="option">
5000 <primary><option>-bw</option></primary>
5001 </indexterm>
5002 <indexterm role="concept">
5003 <primary>daemon</primary>
5004 </indexterm>
5005 <indexterm role="concept">
5006 <primary>inetd</primary>
5007 </indexterm>
5008 <indexterm role="concept">
5009 <primary>inetd</primary>
5010 <secondary>wait mode</secondary>
5011 </indexterm>
5012 This option runs Exim as a daemon, awaiting incoming SMTP connections,
5013 similarly to the <option>-bd</option> option.  All port specifications on the command-line
5014 and in the configuration file are ignored.  Queue-running may not be specified.
5015 </para>
5016 <para>
5017 In this mode, Exim expects to be passed a socket as fd 0 (stdin) which is
5018 listening for connections.  This permits the system to start up and have
5019 inetd (or equivalent) listen on the SMTP ports, starting an Exim daemon for
5020 each port only when the first connection is received.
5021 </para>
5022 <para>
5023 If the option is given as <option>-bw</option>&lt;<emphasis>time</emphasis>&gt; then the time is a timeout, after
5024 which the daemon will exit, which should cause inetd to listen once more.
5025 </para>
5026 </listitem></varlistentry>
5027 <varlistentry>
5028 <term><option>-C</option>&nbsp;&lt;<emphasis>filelist</emphasis>&gt;</term>
5029 <listitem>
5030 <para>
5031 <indexterm role="option">
5032 <primary><option>-C</option></primary>
5033 </indexterm>
5034 <indexterm role="concept">
5035 <primary>configuration file</primary>
5036 <secondary>alternate</secondary>
5037 </indexterm>
5038 <indexterm role="concept">
5039 <primary>CONFIGURE_FILE</primary>
5040 </indexterm>
5041 <indexterm role="concept">
5042 <primary>alternate configuration file</primary>
5043 </indexterm>
5044 This option causes Exim to find the run time configuration file from the given
5045 list instead of from the list specified by the CONFIGURE_FILE
5046 compile-time setting. Usually, the list will consist of just a single file
5047 name, but it can be a colon-separated list of names. In this case, the first
5048 file that exists is used. Failure to open an existing file stops Exim from
5049 proceeding any further along the list, and an error is generated.
5050 </para>
5051 <para>
5052 When this option is used by a caller other than root, and the list is different
5053 from the compiled-in list, Exim gives up its root privilege immediately, and
5054 runs with the real and effective uid and gid set to those of the caller.
5055 However, if a TRUSTED_CONFIG_LIST file is defined in <filename>Local/Makefile</filename>, that
5056 file contains a list of full pathnames, one per line, for configuration files
5057 which are trusted. Root privilege is retained for any configuration file so
5058 listed, as long as the caller is the Exim user (or the user specified in the
5059 CONFIGURE_OWNER option, if any), and as long as the configuration file is
5060 not writeable by inappropriate users or groups.
5061 </para>
5062 <para>
5063 Leaving TRUSTED_CONFIG_LIST unset precludes the possibility of testing a
5064 configuration using <option>-C</option> right through message reception and delivery,
5065 even if the caller is root. The reception works, but by that time, Exim is
5066 running as the Exim user, so when it re-executes to regain privilege for the
5067 delivery, the use of <option>-C</option> causes privilege to be lost. However, root can
5068 test reception and delivery using two separate commands (one to put a message
5069 on the queue, using <option>-odq</option>, and another to do the delivery, using <option>-M</option>).
5070 </para>
5071 <para>
5072 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
5073 prefix string with which any file named in a <option>-C</option> command line option
5074 must start. In addition, the file name must not contain the sequence <literal>/../</literal>.
5075 However, if the value of the <option>-C</option> option is identical to the value of
5076 CONFIGURE_FILE in <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as
5077 usual. There is no default setting for ALT_CONFIG_PREFIX; when it is
5078 unset, any file name can be used with <option>-C</option>.
5079 </para>
5080 <para>
5081 ALT_CONFIG_PREFIX can be used to confine alternative configuration files
5082 to a directory to which only root has access. This prevents someone who has
5083 broken into the Exim account from running a privileged Exim with an arbitrary
5084 configuration file.
5085 </para>
5086 <para>
5087 The <option>-C</option> facility is useful for ensuring that configuration files are
5088 syntactically correct, but cannot be used for test deliveries, unless the
5089 caller is privileged, or unless it is an exotic configuration that does not
5090 require privilege. No check is made on the owner or group of the files
5091 specified by this option.
5092 </para>
5093 </listitem></varlistentry>
5094 <varlistentry>
5095 <term><option>-D</option>&lt;<emphasis>macro</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt;</term>
5096 <listitem>
5097 <para>
5098 <indexterm role="option">
5099 <primary><option>-D</option></primary>
5100 </indexterm>
5101 <indexterm role="concept">
5102 <primary>macro</primary>
5103 <secondary>setting on command line</secondary>
5104 </indexterm>
5105 This option can be used to override macro definitions in the configuration file
5106 (see section <xref linkend="SECTmacrodefs"/>). However, like <option>-C</option>, if it is used by an
5107 unprivileged caller, it causes Exim to give up its root privilege.
5108 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
5109 completely disabled, and its use causes an immediate error exit.
5110 </para>
5111 <para>
5112 If WHITELIST_D_MACROS is defined in <filename>Local/Makefile</filename> then it should be a
5113 colon-separated list of macros which are considered safe and, if <option>-D</option> only
5114 supplies macros from this list, and the values are acceptable, then Exim will
5115 not give up root privilege if the caller is root, the Exim run-time user, or
5116 the CONFIGURE_OWNER, if set.  This is a transition mechanism and is expected
5117 to be removed in the future.  Acceptable values for the macros satisfy the
5118 regexp: <literal>^[A-Za-z0-9_/.-]*$</literal>
5119 </para>
5120 <para>
5121 The entire option (including equals sign if present) must all be within one
5122 command line item. <option>-D</option> can be used to set the value of a macro to the empty
5123 string, in which case the equals sign is optional. These two commands are
5124 synonymous:
5125 </para>
5126 <literallayout class="monospaced">
5127 exim -DABC  ...
5128 exim -DABC= ...
5129 </literallayout>
5130 <para>
5131 To include spaces in a macro definition item, quotes must be used. If you use
5132 quotes, spaces are permitted around the macro name and the equals sign. For
5133 example:
5134 </para>
5135 <literallayout class="monospaced">
5136 exim '-D ABC = something' ...
5137 </literallayout>
5138 <para>
5139 <option>-D</option> may be repeated up to 10 times on a command line.
5140 Only macro names up to 22 letters long can be set.
5141 </para>
5142 </listitem></varlistentry>
5143 <varlistentry>
5144 <term><option>-d</option>&lt;<emphasis>debug&nbsp;options</emphasis>&gt;</term>
5145 <listitem>
5146 <para>
5147 <indexterm role="option">
5148 <primary><option>-d</option></primary>
5149 </indexterm>
5150 <indexterm role="concept">
5151 <primary>debugging</primary>
5152 <secondary>list of selectors</secondary>
5153 </indexterm>
5154 <indexterm role="concept">
5155 <primary>debugging</primary>
5156 <secondary><option>-d</option> option</secondary>
5157 </indexterm>
5158 This option causes debugging information to be written to the standard
5159 error stream. It is restricted to admin users because debugging output may show
5160 database queries that contain password information. Also, the details of users&#x2019;
5161 filter files should be protected. If a non-admin user uses <option>-d</option>, Exim
5162 writes an error message to the standard error stream and exits with a non-zero
5163 return code.
5164 </para>
5165 <para>
5166 When <option>-d</option> is used, <option>-v</option> is assumed. If <option>-d</option> is given on its own, a lot of
5167 standard debugging data is output. This can be reduced, or increased to include
5168 some more rarely needed information, by directly following <option>-d</option> with a string
5169 made up of names preceded by plus or minus characters. These add or remove sets
5170 of debugging data, respectively. For example, <option>-d+filter</option> adds filter
5171 debugging, whereas <option>-d-all+filter</option> selects only filter debugging. Note that
5172 no spaces are allowed in the debug setting. The available debugging categories
5173 are:
5174 </para>
5175 <literallayout>
5176 <literal>acl            </literal> ACL interpretation
5177 <literal>auth           </literal> authenticators
5178 <literal>deliver        </literal> general delivery logic
5179 <literal>dns            </literal> DNS lookups (see also resolver)
5180 <literal>dnsbl          </literal> DNS black list (aka RBL) code
5181 <literal>exec           </literal> arguments for <function>execv()</function> calls
5182 <literal>expand         </literal> detailed debugging for string expansions
5183 <literal>filter         </literal> filter handling
5184 <literal>hints_lookup   </literal> hints data lookups
5185 <literal>host_lookup    </literal> all types of name-to-IP address handling
5186 <literal>ident          </literal> ident lookup
5187 <literal>interface      </literal> lists of local interfaces
5188 <literal>lists          </literal> matching things in lists
5189 <literal>load           </literal> system load checks
5190 <literal>local_scan     </literal> can be used by <function>local_scan()</function> (see chapter <xref linkend="CHAPlocalscan"/>)
5191 <literal>lookup         </literal> general lookup code and all lookups
5192 <literal>memory         </literal> memory handling
5193 <literal>pid            </literal> add pid to debug output lines
5194 <literal>process_info   </literal> setting info for the process log
5195 <literal>queue_run      </literal> queue runs
5196 <literal>receive        </literal> general message reception logic
5197 <literal>resolver       </literal> turn on the DNS resolver&#x2019;s debugging output
5198 <literal>retry          </literal> retry handling
5199 <literal>rewrite        </literal> address rewriting
5200 <literal>route          </literal> address routing
5201 <literal>timestamp      </literal> add timestamp to debug output lines
5202 <literal>tls            </literal> TLS logic
5203 <literal>transport      </literal> transports
5204 <literal>uid            </literal> changes of uid/gid and looking up uid/gid
5205 <literal>verify         </literal> address verification logic
5206 <literal>all            </literal> almost all of the above (see below), and also <option>-v</option>
5207 </literallayout>
5208 <para>
5209 The <literal>all</literal> option excludes <literal>memory</literal> when used as <literal>+all</literal>, but includes it
5210 for <literal>-all</literal>. The reason for this is that <literal>+all</literal> is something that people
5211 tend to use when generating debug output for Exim maintainers. If <literal>+memory</literal>
5212 is included, an awful lot of output that is very rarely of interest is
5213 generated, so it now has to be explicitly requested. However, <literal>-all</literal> does
5214 turn everything off.
5215 </para>
5216 <para>
5217 <indexterm role="concept">
5218 <primary>resolver, debugging output</primary>
5219 </indexterm>
5220 <indexterm role="concept">
5221 <primary>DNS resolver, debugging output</primary>
5222 </indexterm>
5223 The <literal>resolver</literal> option produces output only if the DNS resolver was compiled
5224 with DEBUG enabled. This is not the case in some operating systems. Also,
5225 unfortunately, debugging output from the DNS resolver is written to stdout
5226 rather than stderr.
5227 </para>
5228 <para>
5229 The default (<option>-d</option> with no argument) omits <literal>expand</literal>, <literal>filter</literal>,
5230 <literal>interface</literal>, <literal>load</literal>, <literal>memory</literal>, <literal>pid</literal>, <literal>resolver</literal>, and <literal>timestamp</literal>.
5231 However, the <literal>pid</literal> selector is forced when debugging is turned on for a
5232 daemon, which then passes it on to any re-executed Exims. Exim also
5233 automatically adds the pid to debug lines when several remote deliveries are
5234 run in parallel.
5235 </para>
5236 <para>
5237 The <literal>timestamp</literal> selector causes the current time to be inserted at the start
5238 of all debug output lines. This can be useful when trying to track down delays
5239 in processing.
5240 </para>
5241 <para>
5242 If the <option>debug_print</option> option is set in any driver, it produces output whenever
5243 any debugging is selected, or if <option>-v</option> is used.
5244 </para>
5245 </listitem></varlistentry>
5246 <varlistentry>
5247 <term><option>-dd</option>&lt;<emphasis>debug&nbsp;options</emphasis>&gt;</term>
5248 <listitem>
5249 <para>
5250 <indexterm role="option">
5251 <primary><option>-dd</option></primary>
5252 </indexterm>
5253 This option behaves exactly like <option>-d</option> except when used on a command that
5254 starts a daemon process. In that case, debugging is turned off for the
5255 subprocesses that the daemon creates. Thus, it is useful for monitoring the
5256 behaviour of the daemon without creating as much output as full debugging does.
5257 </para>
5258 </listitem></varlistentry>
5259 <varlistentry>
5260 <term><option>-dropcr</option></term>
5261 <listitem>
5262 <para>
5263 <indexterm role="option">
5264 <primary><option>-dropcr</option></primary>
5265 </indexterm>
5266 This is an obsolete option that is now a no-op. It used to affect the way Exim
5267 handled CR and LF characters in incoming messages. What happens now is
5268 described in section <xref linkend="SECTlineendings"/>.
5269 </para>
5270 </listitem></varlistentry>
5271 <varlistentry>
5272 <term><option>-E</option></term>
5273 <listitem>
5274 <para>
5275 <indexterm role="option">
5276 <primary><option>-E</option></primary>
5277 </indexterm>
5278 <indexterm role="concept">
5279 <primary>bounce message</primary>
5280 <secondary>generating</secondary>
5281 </indexterm>
5282 This option specifies that an incoming message is a locally-generated delivery
5283 failure report. It is used internally by Exim when handling delivery failures
5284 and is not intended for external use. Its only effect is to stop Exim
5285 generating certain messages to the postmaster, as otherwise message cascades
5286 could occur in some situations. As part of the same option, a message id may
5287 follow the characters <option>-E</option>. If it does, the log entry for the receipt of the
5288 new message contains the id, following <quote>R=</quote>, as a cross-reference.
5289 </para>
5290 </listitem></varlistentry>
5291 <varlistentry>
5292 <term><option>-e</option><emphasis>x</emphasis></term>
5293 <listitem>
5294 <para>
5295 <indexterm role="option">
5296 <primary><option>-e</option><emphasis>x</emphasis></primary>
5297 </indexterm>
5298 There are a number of Sendmail options starting with <option>-oe</option> which seem to be
5299 called by various programs without the leading <option>o</option> in the option. For
5300 example, the <option>vacation</option> program uses <option>-eq</option>. Exim treats all options of the
5301 form <option>-e</option><emphasis>x</emphasis> as synonymous with the corresponding <option>-oe</option><emphasis>x</emphasis> options.
5302 </para>
5303 </listitem></varlistentry>
5304 <varlistentry>
5305 <term><option>-F</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
5306 <listitem>
5307 <para>
5308 <indexterm role="option">
5309 <primary><option>-F</option></primary>
5310 </indexterm>
5311 <indexterm role="concept">
5312 <primary>sender</primary>
5313 <secondary>name</secondary>
5314 </indexterm>
5315 <indexterm role="concept">
5316 <primary>name</primary>
5317 <secondary>of sender</secondary>
5318 </indexterm>
5319 This option sets the sender&#x2019;s full name for use when a locally-generated
5320 message is being accepted. In the absence of this option, the user&#x2019;s <emphasis>gecos</emphasis>
5321 entry from the password data is used. As users are generally permitted to alter
5322 their <emphasis>gecos</emphasis> entries, no security considerations are involved. White space
5323 between <option>-F</option> and the &lt;<emphasis>string</emphasis>&gt; is optional.
5324 </para>
5325 </listitem></varlistentry>
5326 <varlistentry>
5327 <term><option>-f</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
5328 <listitem>
5329 <para>
5330 <indexterm role="option">
5331 <primary><option>-f</option></primary>
5332 </indexterm>
5333 <indexterm role="concept">
5334 <primary>sender</primary>
5335 <secondary>address</secondary>
5336 </indexterm>
5337 <indexterm role="concept">
5338 <primary>address</primary>
5339 <secondary>sender</secondary>
5340 </indexterm>
5341 <indexterm role="concept">
5342 <primary>trusted users</primary>
5343 </indexterm>
5344 <indexterm role="concept">
5345 <primary>envelope sender</primary>
5346 </indexterm>
5347 <indexterm role="concept">
5348 <primary>user</primary>
5349 <secondary>trusted</secondary>
5350 </indexterm>
5351 This option sets the address of the envelope sender of a locally-generated
5352 message (also known as the return path). The option can normally be used only
5353 by a trusted user, but <option>untrusted_set_sender</option> can be set to allow untrusted
5354 users to use it.
5355 </para>
5356 <para>
5357 Processes running as root or the Exim user are always trusted. Other
5358 trusted users are defined by the <option>trusted_users</option> or <option>trusted_groups</option>
5359 options. In the absence of <option>-f</option>, or if the caller is not trusted, the sender
5360 of a local message is set to the caller&#x2019;s login name at the default qualify
5361 domain.
5362 </para>
5363 <para>
5364 There is one exception to the restriction on the use of <option>-f</option>: an empty sender
5365 can be specified by any user, trusted or not, to create a message that can
5366 never provoke a bounce. An empty sender can be specified either as an empty
5367 string, or as a pair of angle brackets with nothing between them, as in these
5368 examples of shell commands:
5369 </para>
5370 <literallayout class="monospaced">
5371 exim -f '&lt;&gt;' user@domain
5372 exim -f "" user@domain
5373 </literallayout>
5374 <para>
5375 In addition, the use of <option>-f</option> is not restricted when testing a filter file
5376 with <option>-bf</option> or when testing or verifying addresses using the <option>-bt</option> or
5377 <option>-bv</option> options.
5378 </para>
5379 <para>
5380 Allowing untrusted users to change the sender address does not of itself make
5381 it possible to send anonymous mail. Exim still checks that the <emphasis>From:</emphasis> header
5382 refers to the local user, and if it does not, it adds a <emphasis>Sender:</emphasis> header,
5383 though this can be overridden by setting <option>no_local_from_check</option>.
5384 </para>
5385 <para>
5386 White
5387 <indexterm role="concept">
5388 <primary><quote>From</quote> line</primary>
5389 </indexterm>
5390 space between <option>-f</option> and the &lt;<emphasis>address</emphasis>&gt; is optional (that is, they can be
5391 given as two arguments or one combined argument). The sender of a
5392 locally-generated message can also be set (when permitted) by an initial
5393 <quote>From&nbsp;</quote> line in the message &ndash; see the description of <option>-bm</option> above &ndash; but
5394 if <option>-f</option> is also present, it overrides <quote>From&nbsp;</quote>.
5395 </para>
5396 </listitem></varlistentry>
5397 <varlistentry>
5398 <term><option>-G</option></term>
5399 <listitem>
5400 <para>
5401 <indexterm role="option">
5402 <primary><option>-G</option></primary>
5403 </indexterm>
5404 <indexterm role="concept">
5405 <primary>submission fixups, suppressing (command-line)</primary>
5406 </indexterm>
5407 This option is equivalent to an ACL applying:
5408 </para>
5409 <literallayout class="monospaced">
5410 control = suppress_local_fixups
5411 </literallayout>
5412 <para>
5413 for every message received.  Note that Sendmail will complain about such
5414 bad formatting, where Exim silently just does not fix it up.  This may change
5415 in future.
5416 </para>
5417 <para>
5418 As this affects audit information, the caller must be a trusted user to use
5419 this option.
5420 </para>
5421 </listitem></varlistentry>
5422 <varlistentry>
5423 <term><option>-h</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
5424 <listitem>
5425 <para>
5426 <indexterm role="option">
5427 <primary><option>-h</option></primary>
5428 </indexterm>
5429 <indexterm role="concept">
5430 <primary>Sendmail compatibility</primary>
5431 <secondary><option>-h</option> option ignored</secondary>
5432 </indexterm>
5433 This option is accepted for compatibility with Sendmail, but has no effect. (In
5434 Sendmail it overrides the <quote>hop count</quote> obtained by counting <emphasis>Received:</emphasis>
5435 headers.)
5436 </para>
5437 </listitem></varlistentry>
5438 <varlistentry>
5439 <term><option>-i</option></term>
5440 <listitem>
5441 <para>
5442 <indexterm role="option">
5443 <primary><option>-i</option></primary>
5444 </indexterm>
5445 <indexterm role="concept">
5446 <primary>Solaris</primary>
5447 <secondary><emphasis>mail</emphasis> command</secondary>
5448 </indexterm>
5449 <indexterm role="concept">
5450 <primary>dot</primary>
5451 <secondary>in incoming non-SMTP message</secondary>
5452 </indexterm>
5453 This option, which has the same effect as <option>-oi</option>, specifies that a dot on a
5454 line by itself should not terminate an incoming, non-SMTP message. I can find
5455 no documentation for this option in Solaris 2.4 Sendmail, but the <emphasis>mailx</emphasis>
5456 command in Solaris 2.4 uses it. See also <option>-ti</option>.
5457 </para>
5458 </listitem></varlistentry>
5459 <varlistentry>
5460 <term><option>-L</option>&nbsp;&lt;<emphasis>tag</emphasis>&gt;</term>
5461 <listitem>
5462 <para>
5463 <indexterm role="option">
5464 <primary><option>-L</option></primary>
5465 </indexterm>
5466 <indexterm role="concept">
5467 <primary>syslog</primary>
5468 <secondary>process name; set with flag</secondary>
5469 </indexterm>
5470 This option is equivalent to setting <option>syslog_processname</option> in the config
5471 file and setting <option>log_file_path</option> to <literal>syslog</literal>.
5472 Its use is restricted to administrators.  The configuration file has to be
5473 read and parsed, to determine access rights, before this is set and takes
5474 effect, so early configuration file errors will not honour this flag.
5475 </para>
5476 <para>
5477 The tag should not be longer than 32 characters.
5478 </para>
5479 </listitem></varlistentry>
5480 <varlistentry>
5481 <term><option>-M</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5482 <listitem>
5483 <para>
5484 <indexterm role="option">
5485 <primary><option>-M</option></primary>
5486 </indexterm>
5487 <indexterm role="concept">
5488 <primary>forcing delivery</primary>
5489 </indexterm>
5490 <indexterm role="concept">
5491 <primary>delivery</primary>
5492 <secondary>forcing attempt</secondary>
5493 </indexterm>
5494 <indexterm role="concept">
5495 <primary>frozen messages</primary>
5496 <secondary>forcing delivery</secondary>
5497 </indexterm>
5498 This option requests Exim to run a delivery attempt on each message in turn. If
5499 any of the messages are frozen, they are automatically thawed before the
5500 delivery attempt. The settings of <option>queue_domains</option>, <option>queue_smtp_domains</option>,
5501 and <option>hold_domains</option> are ignored.
5502 </para>
5503 <para>
5504 Retry
5505 <indexterm role="concept">
5506 <primary>hints database</primary>
5507 <secondary>overriding retry hints</secondary>
5508 </indexterm>
5509 hints for any of the addresses are overridden &ndash; Exim tries to deliver even if
5510 the normal retry time has not yet been reached. This option requires the caller
5511 to be an admin user. However, there is an option called <option>prod_requires_admin</option>
5512 which can be set false to relax this restriction (and also the same requirement
5513 for the <option>-q</option>, <option>-R</option>, and <option>-S</option> options).
5514 </para>
5515 <para>
5516 The deliveries happen synchronously, that is, the original Exim process does
5517 not terminate until all the delivery attempts have finished. No output is
5518 produced unless there is a serious error. If you want to see what is happening,
5519 use the <option>-v</option> option as well, or inspect Exim&#x2019;s main log.
5520 </para>
5521 </listitem></varlistentry>
5522 <varlistentry>
5523 <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>
5524 <listitem>
5525 <para>
5526 <indexterm role="option">
5527 <primary><option>-Mar</option></primary>
5528 </indexterm>
5529 <indexterm role="concept">
5530 <primary>message</primary>
5531 <secondary>adding recipients</secondary>
5532 </indexterm>
5533 <indexterm role="concept">
5534 <primary>recipient</primary>
5535 <secondary>adding</secondary>
5536 </indexterm>
5537 This option requests Exim to add the addresses to the list of recipients of the
5538 message (<quote>ar</quote> for <quote>add recipients</quote>). The first argument must be a message
5539 id, and the remaining ones must be email addresses. However, if the message is
5540 active (in the middle of a delivery attempt), it is not altered. This option
5541 can be used only by an admin user.
5542 </para>
5543 </listitem></varlistentry>
5544 <varlistentry>
5545 <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>
5546 <listitem>
5547 <para>
5548 <indexterm role="option">
5549 <primary><option>-MC</option></primary>
5550 </indexterm>
5551 <indexterm role="concept">
5552 <primary>SMTP</primary>
5553 <secondary>passed connection</secondary>
5554 </indexterm>
5555 <indexterm role="concept">
5556 <primary>SMTP</primary>
5557 <secondary>multiple deliveries</secondary>
5558 </indexterm>
5559 <indexterm role="concept">
5560 <primary>multiple SMTP deliveries</primary>
5561 </indexterm>
5562 This option is not intended for use by external callers. It is used internally
5563 by Exim to invoke another instance of itself to deliver a waiting message using
5564 an existing SMTP connection, which is passed as the standard input. Details are
5565 given in chapter <xref linkend="CHAPSMTP"/>. This must be the final option, and the caller
5566 must be root or the Exim user in order to use it.
5567 </para>
5568 </listitem></varlistentry>
5569 <varlistentry>
5570 <term><option>-MCA</option></term>
5571 <listitem>
5572 <para>
5573 <indexterm role="option">
5574 <primary><option>-MCA</option></primary>
5575 </indexterm>
5576 This option is not intended for use by external callers. It is used internally
5577 by Exim in conjunction with the <option>-MC</option> option. It signifies that the
5578 connection to the remote host has been authenticated.
5579 </para>
5580 </listitem></varlistentry>
5581 <varlistentry>
5582 <term><option>-MCD</option></term>
5583 <listitem>
5584 <para>
5585 <indexterm role="option">
5586 <primary><option>-MCD</option></primary>
5587 </indexterm>
5588 This option is not intended for use by external callers. It is used internally
5589 by Exim in conjunction with the <option>-MC</option> option. It signifies that the
5590 remote host supports the ESMTP <filename>DSN</filename> extension.
5591 </para>
5592 </listitem></varlistentry>
5593 <varlistentry>
5594 <term><option>-MCG</option>&nbsp;&lt;<emphasis>queue&nbsp;name</emphasis>&gt;</term>
5595 <listitem>
5596 <para>
5597 <indexterm role="option">
5598 <primary><option>-MCG</option></primary>
5599 </indexterm>
5600 This option is not intended for use by external callers. It is used internally
5601 by Exim in conjunction with the <option>-MC</option> option. It signifies that an
5602 alternate queue is used, named by the following argument.
5603 </para>
5604 </listitem></varlistentry>
5605 <varlistentry>
5606 <term><option>-MCK</option></term>
5607 <listitem>
5608 <para>
5609 <indexterm role="option">
5610 <primary><option>-MCK</option></primary>
5611 </indexterm>
5612 This option is not intended for use by external callers. It is used internally
5613 by Exim in conjunction with the <option>-MC</option> option. It signifies that an
5614 remote host supports the ESMTP <filename>CHUNKING</filename> extension.
5615 </para>
5616 </listitem></varlistentry>
5617 <varlistentry>
5618 <term><option>-MCP</option></term>
5619 <listitem>
5620 <para>
5621 <indexterm role="option">
5622 <primary><option>-MCP</option></primary>
5623 </indexterm>
5624 This option is not intended for use by external callers. It is used internally
5625 by Exim in conjunction with the <option>-MC</option> option. It signifies that the server to
5626 which Exim is connected supports pipelining.
5627 </para>
5628 </listitem></varlistentry>
5629 <varlistentry>
5630 <term><option>-MCQ</option>&nbsp;&lt;<emphasis>process&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>pipe&nbsp;fd</emphasis>&gt;</term>
5631 <listitem>
5632 <para>
5633 <indexterm role="option">
5634 <primary><option>-MCQ</option></primary>
5635 </indexterm>
5636 This option is not intended for use by external callers. It is used internally
5637 by Exim in conjunction with the <option>-MC</option> option when the original delivery was
5638 started by a queue runner. It passes on the process id of the queue runner,
5639 together with the file descriptor number of an open pipe. Closure of the pipe
5640 signals the final completion of the sequence of processes that are passing
5641 messages through the same SMTP connection.
5642 </para>
5643 </listitem></varlistentry>
5644 <varlistentry>
5645 <term><option>-MCS</option></term>
5646 <listitem>
5647 <para>
5648 <indexterm role="option">
5649 <primary><option>-MCS</option></primary>
5650 </indexterm>
5651 This option is not intended for use by external callers. It is used internally
5652 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5653 SMTP SIZE option should be used on messages delivered down the existing
5654 connection.
5655 </para>
5656 </listitem></varlistentry>
5657 <varlistentry>
5658 <term><option>-MCT</option></term>
5659 <listitem>
5660 <para>
5661 <indexterm role="option">
5662 <primary><option>-MCT</option></primary>
5663 </indexterm>
5664 This option is not intended for use by external callers. It is used internally
5665 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5666 host to which Exim is connected supports TLS encryption.
5667 </para>
5668 </listitem></varlistentry>
5669 <varlistentry revisionflag="changed">
5670 <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>
5671 <listitem>
5672 <para revisionflag="changed">
5673 <indexterm role="option">
5674 <primary><option>-MCt</option></primary>
5675 </indexterm>
5676 This option is not intended for use by external callers. It is used internally
5677 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5678 connection is being proxied by a parent process for handling TLS encryption.
5679 The arguments give the local address and port being proxied, and the TLS cipher.
5680 </para>
5681 </listitem></varlistentry>
5682 <varlistentry>
5683 <term><option>-Mc</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5684 <listitem>
5685 <para>
5686 <indexterm role="option">
5687 <primary><option>-Mc</option></primary>
5688 </indexterm>
5689 <indexterm role="concept">
5690 <primary>hints database</primary>
5691 <secondary>not overridden by <option>-Mc</option></secondary>
5692 </indexterm>
5693 <indexterm role="concept">
5694 <primary>delivery</primary>
5695 <secondary>manually started &ndash; not forced</secondary>
5696 </indexterm>
5697 This option requests Exim to run a delivery attempt on each message in turn,
5698 but unlike the <option>-M</option> option, it does check for retry hints, and respects any
5699 that are found. This option is not very useful to external callers. It is
5700 provided mainly for internal use by Exim when it needs to re-invoke itself in
5701 order to regain root privilege for a delivery (see chapter <xref linkend="CHAPsecurity"/>).
5702 However, <option>-Mc</option> can be useful when testing, in order to run a delivery that
5703 respects retry times and other options such as <option>hold_domains</option> that are
5704 overridden when <option>-M</option> is used. Such a delivery does not count as a queue run.
5705 If you want to run a specific delivery as if in a queue run, you should use
5706 <option>-q</option> with a message id argument. A distinction between queue run deliveries
5707 and other deliveries is made in one or two places.
5708 </para>
5709 </listitem></varlistentry>
5710 <varlistentry>
5711 <term><option>-Mes</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
5712 <listitem>
5713 <para>
5714 <indexterm role="option">
5715 <primary><option>-Mes</option></primary>
5716 </indexterm>
5717 <indexterm role="concept">
5718 <primary>message</primary>
5719 <secondary>changing sender</secondary>
5720 </indexterm>
5721 <indexterm role="concept">
5722 <primary>sender</primary>
5723 <secondary>changing</secondary>
5724 </indexterm>
5725 This option requests Exim to change the sender address in the message to the
5726 given address, which must be a fully qualified address or <quote>&lt;&gt;</quote> (<quote>es</quote> for
5727 <quote>edit sender</quote>). There must be exactly two arguments. The first argument must
5728 be a message id, and the second one an email address. However, if the message
5729 is active (in the middle of a delivery attempt), its status is not altered.
5730 This option can be used only by an admin user.
5731 </para>
5732 </listitem></varlistentry>
5733 <varlistentry>
5734 <term><option>-Mf</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5735 <listitem>
5736 <para>
5737 <indexterm role="option">
5738 <primary><option>-Mf</option></primary>
5739 </indexterm>
5740 <indexterm role="concept">
5741 <primary>freezing messages</primary>
5742 </indexterm>
5743 <indexterm role="concept">
5744 <primary>message</primary>
5745 <secondary>manually freezing</secondary>
5746 </indexterm>
5747 This option requests Exim to mark each listed message as <quote>frozen</quote>. This
5748 prevents any delivery attempts taking place until the message is <quote>thawed</quote>,
5749 either manually or as a result of the <option>auto_thaw</option> configuration option.
5750 However, if any of the messages are active (in the middle of a delivery
5751 attempt), their status is not altered. This option can be used only by an admin
5752 user.
5753 </para>
5754 </listitem></varlistentry>
5755 <varlistentry>
5756 <term><option>-Mg</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5757 <listitem>
5758 <para>
5759 <indexterm role="option">
5760 <primary><option>-Mg</option></primary>
5761 </indexterm>
5762 <indexterm role="concept">
5763 <primary>giving up on messages</primary>
5764 </indexterm>
5765 <indexterm role="concept">
5766 <primary>message</primary>
5767 <secondary>abandoning delivery attempts</secondary>
5768 </indexterm>
5769 <indexterm role="concept">
5770 <primary>delivery</primary>
5771 <secondary>abandoning further attempts</secondary>
5772 </indexterm>
5773 This option requests Exim to give up trying to deliver the listed messages,
5774 including any that are frozen. However, if any of the messages are active,
5775 their status is not altered. For non-bounce messages, a delivery error message
5776 is sent to the sender, containing the text <quote>cancelled by administrator</quote>.
5777 Bounce messages are just discarded. This option can be used only by an admin
5778 user.
5779 </para>
5780 </listitem></varlistentry>
5781 <varlistentry>
5782 <term><option>-Mmad</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5783 <listitem>
5784 <para>
5785 <indexterm role="option">
5786 <primary><option>-Mmad</option></primary>
5787 </indexterm>
5788 <indexterm role="concept">
5789 <primary>delivery</primary>
5790 <secondary>cancelling all</secondary>
5791 </indexterm>
5792 This option requests Exim to mark all the recipient addresses in the messages
5793 as already delivered (<quote>mad</quote> for <quote>mark all delivered</quote>). However, if any
5794 message is active (in the middle of a delivery attempt), its status is not
5795 altered. This option can be used only by an admin user.
5796 </para>
5797 </listitem></varlistentry>
5798 <varlistentry>
5799 <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>
5800 <listitem>
5801 <para>
5802 <indexterm role="option">
5803 <primary><option>-Mmd</option></primary>
5804 </indexterm>
5805 <indexterm role="concept">
5806 <primary>delivery</primary>
5807 <secondary>cancelling by address</secondary>
5808 </indexterm>
5809 <indexterm role="concept">
5810 <primary>recipient</primary>
5811 <secondary>removing</secondary>
5812 </indexterm>
5813 <indexterm role="concept">
5814 <primary>removing recipients</primary>
5815 </indexterm>
5816 This option requests Exim to mark the given addresses as already delivered
5817 (<quote>md</quote> for <quote>mark delivered</quote>). The first argument must be a message id, and
5818 the remaining ones must be email addresses. These are matched to recipient
5819 addresses in the message in a case-sensitive manner. If the message is active
5820 (in the middle of a delivery attempt), its status is not altered. This option
5821 can be used only by an admin user.
5822 </para>
5823 </listitem></varlistentry>
5824 <varlistentry>
5825 <term><option>-Mrm</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5826 <listitem>
5827 <para>
5828 <indexterm role="option">
5829 <primary><option>-Mrm</option></primary>
5830 </indexterm>
5831 <indexterm role="concept">
5832 <primary>removing messages</primary>
5833 </indexterm>
5834 <indexterm role="concept">
5835 <primary>abandoning mail</primary>
5836 </indexterm>
5837 <indexterm role="concept">
5838 <primary>message</primary>
5839 <secondary>manually discarding</secondary>
5840 </indexterm>
5841 This option requests Exim to remove the given messages from the queue. No
5842 bounce messages are sent; each message is simply forgotten. However, if any of
5843 the messages are active, their status is not altered. This option can be used
5844 only by an admin user or by the user who originally caused the message to be
5845 placed on the queue.
5846 </para>
5847 </listitem></varlistentry>
5848 <varlistentry>
5849 <term><option>-Mset</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5850 <listitem>
5851 <para>
5852 <indexterm role="option">
5853 <primary><option>-Mset</option></primary>
5854 </indexterm>
5855 <indexterm role="concept">
5856 <primary>testing</primary>
5857 <secondary>string expansion</secondary>
5858 </indexterm>
5859 <indexterm role="concept">
5860 <primary>expansion</primary>
5861 <secondary>testing</secondary>
5862 </indexterm>
5863 This option is useful only in conjunction with <option>-be</option> (that is, when testing
5864 string expansions). Exim loads the given message from its spool before doing
5865 the test expansions, thus setting message-specific variables such as
5866 <varname>$message_size</varname> and the header variables. The <varname>$recipients</varname> variable is made
5867 available. This feature is provided to make it easier to test expansions that
5868 make use of these variables. However, this option can be used only by an admin
5869 user. See also <option>-bem</option>.
5870 </para>
5871 </listitem></varlistentry>
5872 <varlistentry>
5873 <term><option>-Mt</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5874 <listitem>
5875 <para>
5876 <indexterm role="option">
5877 <primary><option>-Mt</option></primary>
5878 </indexterm>
5879 <indexterm role="concept">
5880 <primary>thawing messages</primary>
5881 </indexterm>
5882 <indexterm role="concept">
5883 <primary>unfreezing messages</primary>
5884 </indexterm>
5885 <indexterm role="concept">
5886 <primary>frozen messages</primary>
5887 <secondary>thawing</secondary>
5888 </indexterm>
5889 <indexterm role="concept">
5890 <primary>message</primary>
5891 <secondary>thawing frozen</secondary>
5892 </indexterm>
5893 This option requests Exim to <quote>thaw</quote> any of the listed messages that are
5894 <quote>frozen</quote>, so that delivery attempts can resume. However, if any of the
5895 messages are active, their status is not altered. This option can be used only
5896 by an admin user.
5897 </para>
5898 </listitem></varlistentry>
5899 <varlistentry>
5900 <term><option>-Mvb</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5901 <listitem>
5902 <para>
5903 <indexterm role="option">
5904 <primary><option>-Mvb</option></primary>
5905 </indexterm>
5906 <indexterm role="concept">
5907 <primary>listing</primary>
5908 <secondary>message body</secondary>
5909 </indexterm>
5910 <indexterm role="concept">
5911 <primary>message</primary>
5912 <secondary>listing body of</secondary>
5913 </indexterm>
5914 This option causes the contents of the message body (-D) spool file to be
5915 written to the standard output. This option can be used only by an admin user.
5916 </para>
5917 </listitem></varlistentry>
5918 <varlistentry>
5919 <term><option>-Mvc</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5920 <listitem>
5921 <para>
5922 <indexterm role="option">
5923 <primary><option>-Mvc</option></primary>
5924 </indexterm>
5925 <indexterm role="concept">
5926 <primary>message</primary>
5927 <secondary>listing in RFC 2822 format</secondary>
5928 </indexterm>
5929 <indexterm role="concept">
5930 <primary>listing</primary>
5931 <secondary>message in RFC 2822 format</secondary>
5932 </indexterm>
5933 This option causes a copy of the complete message (header lines plus body) to
5934 be written to the standard output in RFC 2822 format. This option can be used
5935 only by an admin user.
5936 </para>
5937 </listitem></varlistentry>
5938 <varlistentry>
5939 <term><option>-Mvh</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5940 <listitem>
5941 <para>
5942 <indexterm role="option">
5943 <primary><option>-Mvh</option></primary>
5944 </indexterm>
5945 <indexterm role="concept">
5946 <primary>listing</primary>
5947 <secondary>message headers</secondary>
5948 </indexterm>
5949 <indexterm role="concept">
5950 <primary>header lines</primary>
5951 <secondary>listing</secondary>
5952 </indexterm>
5953 <indexterm role="concept">
5954 <primary>message</primary>
5955 <secondary>listing header lines</secondary>
5956 </indexterm>
5957 This option causes the contents of the message headers (-H) spool file to be
5958 written to the standard output. This option can be used only by an admin user.
5959 </para>
5960 </listitem></varlistentry>
5961 <varlistentry>
5962 <term><option>-Mvl</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5963 <listitem>
5964 <para>
5965 <indexterm role="option">
5966 <primary><option>-Mvl</option></primary>
5967 </indexterm>
5968 <indexterm role="concept">
5969 <primary>listing</primary>
5970 <secondary>message log</secondary>
5971 </indexterm>
5972 <indexterm role="concept">
5973 <primary>message</primary>
5974 <secondary>listing message log</secondary>
5975 </indexterm>
5976 This option causes the contents of the message log spool file to be written to
5977 the standard output. This option can be used only by an admin user.
5978 </para>
5979 </listitem></varlistentry>
5980 <varlistentry>
5981 <term><option>-m</option></term>
5982 <listitem>
5983 <para>
5984 <indexterm role="option">
5985 <primary><option>-m</option></primary>
5986 </indexterm>
5987 This is apparently a synonym for <option>-om</option> that is accepted by Sendmail, so Exim
5988 treats it that way too.
5989 </para>
5990 </listitem></varlistentry>
5991 <varlistentry>
5992 <term><option>-N</option></term>
5993 <listitem>
5994 <para>
5995 <indexterm role="option">
5996 <primary><option>-N</option></primary>
5997 </indexterm>
5998 <indexterm role="concept">
5999 <primary>debugging</primary>
6000 <secondary><option>-N</option> option</secondary>
6001 </indexterm>
6002 <indexterm role="concept">
6003 <primary>debugging</primary>
6004 <secondary>suppressing delivery</secondary>
6005 </indexterm>
6006 This is a debugging option that inhibits delivery of a message at the transport
6007 level. It implies <option>-v</option>. Exim goes through many of the motions of delivery &ndash;
6008 it just doesn&#x2019;t actually transport the message, but instead behaves as if it
6009 had successfully done so. However, it does not make any updates to the retry
6010 database, and the log entries for deliveries are flagged with <quote>*&gt;</quote> rather
6011 than <quote>=&gt;</quote>.
6012 </para>
6013 <para>
6014 Because <option>-N</option> discards any message to which it applies, only root or the Exim
6015 user are allowed to use it with <option>-bd</option>, <option>-q</option>, <option>-R</option> or <option>-M</option>. In other
6016 words, an ordinary user can use it only when supplying an incoming message to
6017 which it will apply. Although transportation never fails when <option>-N</option> is set, an
6018 address may be deferred because of a configuration problem on a transport, or a
6019 routing problem. Once <option>-N</option> has been used for a delivery attempt, it sticks to
6020 the message, and applies to any subsequent delivery attempts that may happen
6021 for that message.
6022 </para>
6023 </listitem></varlistentry>
6024 <varlistentry>
6025 <term><option>-n</option></term>
6026 <listitem>
6027 <para>
6028 <indexterm role="option">
6029 <primary><option>-n</option></primary>
6030 </indexterm>
6031 This option is interpreted by Sendmail to mean <quote>no aliasing</quote>.
6032 For normal modes of operation, it is ignored by Exim.
6033 When combined with <option>-bP</option> it makes the output more terse (suppresses
6034 option names, environment values and config pretty printing).
6035 </para>
6036 </listitem></varlistentry>
6037 <varlistentry>
6038 <term><option>-O</option>&nbsp;&lt;<emphasis>data</emphasis>&gt;</term>
6039 <listitem>
6040 <para>
6041 <indexterm role="option">
6042 <primary><option>-O</option></primary>
6043 </indexterm>
6044 This option is interpreted by Sendmail to mean <literal>set option</literal>. It is ignored by
6045 Exim.
6046 </para>
6047 </listitem></varlistentry>
6048 <varlistentry>
6049 <term><option>-oA</option>&nbsp;&lt;<emphasis>file&nbsp;name</emphasis>&gt;</term>
6050 <listitem>
6051 <para>
6052 <indexterm role="option">
6053 <primary><option>-oA</option></primary>
6054 </indexterm>
6055 <indexterm role="concept">
6056 <primary>Sendmail compatibility</primary>
6057 <secondary><option>-oA</option> option</secondary>
6058 </indexterm>
6059 This option is used by Sendmail in conjunction with <option>-bi</option> to specify an
6060 alternative alias file name. Exim handles <option>-bi</option> differently; see the
6061 description above.
6062 </para>
6063 </listitem></varlistentry>
6064 <varlistentry>
6065 <term><option>-oB</option>&nbsp;&lt;<emphasis>n</emphasis>&gt;</term>
6066 <listitem>
6067 <para>
6068 <indexterm role="option">
6069 <primary><option>-oB</option></primary>
6070 </indexterm>
6071 <indexterm role="concept">
6072 <primary>SMTP</primary>
6073 <secondary>passed connection</secondary>
6074 </indexterm>
6075 <indexterm role="concept">
6076 <primary>SMTP</primary>
6077 <secondary>multiple deliveries</secondary>
6078 </indexterm>
6079 <indexterm role="concept">
6080 <primary>multiple SMTP deliveries</primary>
6081 </indexterm>
6082 This is a debugging option which limits the maximum number of messages that can
6083 be delivered down one SMTP connection, overriding the value set in any <command>smtp</command>
6084 transport. If &lt;<emphasis>n</emphasis>&gt; is omitted, the limit is set to 1.
6085 </para>
6086 </listitem></varlistentry>
6087 <varlistentry>
6088 <term><option>-odb</option></term>
6089 <listitem>
6090 <para>
6091 <indexterm role="option">
6092 <primary><option>-odb</option></primary>
6093 </indexterm>
6094 <indexterm role="concept">
6095 <primary>background delivery</primary>
6096 </indexterm>
6097 <indexterm role="concept">
6098 <primary>delivery</primary>
6099 <secondary>in the background</secondary>
6100 </indexterm>
6101 This option applies to all modes in which Exim accepts incoming messages,
6102 including the listening daemon. It requests <quote>background</quote> delivery of such
6103 messages, which means that the accepting process automatically starts a
6104 delivery process for each message received, but does not wait for the delivery
6105 processes to finish.
6106 </para>
6107 <para>
6108 When all the messages have been received, the reception process exits,
6109 leaving the delivery processes to finish in their own time. The standard output
6110 and error streams are closed at the start of each delivery process.
6111 This is the default action if none of the <option>-od</option> options are present.
6112 </para>
6113 <para>
6114 If one of the queueing options in the configuration file
6115 (<option>queue_only</option> or <option>queue_only_file</option>, for example) is in effect, <option>-odb</option>
6116 overrides it if <option>queue_only_override</option> is set true, which is the default
6117 setting. If <option>queue_only_override</option> is set false, <option>-odb</option> has no effect.
6118 </para>
6119 </listitem></varlistentry>
6120 <varlistentry>
6121 <term><option>-odf</option></term>
6122 <listitem>
6123 <para>
6124 <indexterm role="option">
6125 <primary><option>-odf</option></primary>
6126 </indexterm>
6127 <indexterm role="concept">
6128 <primary>foreground delivery</primary>
6129 </indexterm>
6130 <indexterm role="concept">
6131 <primary>delivery</primary>
6132 <secondary>in the foreground</secondary>
6133 </indexterm>
6134 This option requests <quote>foreground</quote> (synchronous) delivery when Exim has
6135 accepted a locally-generated message. (For the daemon it is exactly the same as
6136 <option>-odb</option>.) A delivery process is automatically started to deliver the message,
6137 and Exim waits for it to complete before proceeding.
6138 </para>
6139 <para>
6140 The original Exim reception process does not finish until the delivery
6141 process for the final message has ended. The standard error stream is left open
6142 during deliveries.
6143 </para>
6144 <para>
6145 However, like <option>-odb</option>, this option has no effect if <option>queue_only_override</option> is
6146 false and one of the queueing options in the configuration file is in effect.
6147 </para>
6148 <para>
6149 If there is a temporary delivery error during foreground delivery, the
6150 message is left on the queue for later delivery, and the original reception
6151 process exits. See chapter <xref linkend="CHAPnonqueueing"/> for a way of setting up a
6152 restricted configuration that never queues messages.
6153 </para>
6154 </listitem></varlistentry>
6155 <varlistentry>
6156 <term><option>-odi</option></term>
6157 <listitem>
6158 <para>
6159 <indexterm role="option">
6160 <primary><option>-odi</option></primary>
6161 </indexterm>
6162 This option is synonymous with <option>-odf</option>. It is provided for compatibility with
6163 Sendmail.
6164 </para>
6165 </listitem></varlistentry>
6166 <varlistentry>
6167 <term><option>-odq</option></term>
6168 <listitem>
6169 <para>
6170 <indexterm role="option">
6171 <primary><option>-odq</option></primary>
6172 </indexterm>
6173 <indexterm role="concept">
6174 <primary>non-immediate delivery</primary>
6175 </indexterm>
6176 <indexterm role="concept">
6177 <primary>delivery</primary>
6178 <secondary>suppressing immediate</secondary>
6179 </indexterm>
6180 <indexterm role="concept">
6181 <primary>queueing incoming messages</primary>
6182 </indexterm>
6183 This option applies to all modes in which Exim accepts incoming messages,
6184 including the listening daemon. It specifies that the accepting process should
6185 not automatically start a delivery process for each message received. Messages
6186 are placed on the queue, and remain there until a subsequent queue runner
6187 process encounters them. There are several configuration options (such as
6188 <option>queue_only</option>) that can be used to queue incoming messages under certain
6189 conditions. This option overrides all of them and also <option>-odqs</option>. It always
6190 forces queueing.
6191 </para>
6192 </listitem></varlistentry>
6193 <varlistentry>
6194 <term><option>-odqs</option></term>
6195 <listitem>
6196 <para>
6197 <indexterm role="option">
6198 <primary><option>-odqs</option></primary>
6199 </indexterm>
6200 <indexterm role="concept">
6201 <primary>SMTP</primary>
6202 <secondary>delaying delivery</secondary>
6203 </indexterm>
6204 This option is a hybrid between <option>-odb</option>/<option>-odi</option> and <option>-odq</option>.
6205 However, like <option>-odb</option> and <option>-odi</option>, this option has no effect if
6206 <option>queue_only_override</option> is false and one of the queueing options in the
6207 configuration file is in effect.
6208 </para>
6209 <para>
6210 When <option>-odqs</option> does operate, a delivery process is started for each incoming
6211 message, in the background by default, but in the foreground if <option>-odi</option> is
6212 also present. The recipient addresses are routed, and local deliveries are done
6213 in the normal way. However, if any SMTP deliveries are required, they are not
6214 done at this time, so the message remains on the queue until a subsequent queue
6215 runner process encounters it. Because routing was done, Exim knows which
6216 messages are waiting for which hosts, and so a number of messages for the same
6217 host can be sent in a single SMTP connection. The <option>queue_smtp_domains</option>
6218 configuration option has the same effect for specific domains. See also the
6219 <option>-qq</option> option.
6220 </para>
6221 </listitem></varlistentry>
6222 <varlistentry>
6223 <term><option>-oee</option></term>
6224 <listitem>
6225 <para>
6226 <indexterm role="option">
6227 <primary><option>-oee</option></primary>
6228 </indexterm>
6229 <indexterm role="concept">
6230 <primary>error</primary>
6231 <secondary>reporting</secondary>
6232 </indexterm>
6233 If an error is detected while a non-SMTP message is being received (for
6234 example, a malformed address), the error is reported to the sender in a mail
6235 message.
6236 </para>
6237 <para>
6238 <indexterm role="concept">
6239 <primary>return code</primary>
6240 <secondary>for <option>-oee</option></secondary>
6241 </indexterm>
6242 Provided
6243 this error message is successfully sent, the Exim receiving process
6244 exits with a return code of zero. If not, the return code is 2 if the problem
6245 is that the original message has no recipients, or 1 for any other error.
6246 This is the default <option>-oe</option><emphasis>x</emphasis> option if Exim is called as <emphasis>rmail</emphasis>.
6247 </para>
6248 </listitem></varlistentry>
6249 <varlistentry>
6250 <term><option>-oem</option></term>
6251 <listitem>
6252 <para>
6253 <indexterm role="option">
6254 <primary><option>-oem</option></primary>
6255 </indexterm>
6256 <indexterm role="concept">
6257 <primary>error</primary>
6258 <secondary>reporting</secondary>
6259 </indexterm>
6260 <indexterm role="concept">
6261 <primary>return code</primary>
6262 <secondary>for <option>-oem</option></secondary>
6263 </indexterm>
6264 This is the same as <option>-oee</option>, except that Exim always exits with a non-zero
6265 return code, whether or not the error message was successfully sent.
6266 This is the default <option>-oe</option><emphasis>x</emphasis> option, unless Exim is called as <emphasis>rmail</emphasis>.
6267 </para>
6268 </listitem></varlistentry>
6269 <varlistentry>
6270 <term><option>-oep</option></term>
6271 <listitem>
6272 <para>
6273 <indexterm role="option">
6274 <primary><option>-oep</option></primary>
6275 </indexterm>
6276 <indexterm role="concept">
6277 <primary>error</primary>
6278 <secondary>reporting</secondary>
6279 </indexterm>
6280 If an error is detected while a non-SMTP message is being received, the
6281 error is reported by writing a message to the standard error file (stderr).
6282 <indexterm role="concept">
6283 <primary>return code</primary>
6284 <secondary>for <option>-oep</option></secondary>
6285 </indexterm>
6286 The return code is 1 for all errors.
6287 </para>
6288 </listitem></varlistentry>
6289 <varlistentry>
6290 <term><option>-oeq</option></term>
6291 <listitem>
6292 <para>
6293 <indexterm role="option">
6294 <primary><option>-oeq</option></primary>
6295 </indexterm>
6296 <indexterm role="concept">
6297 <primary>error</primary>
6298 <secondary>reporting</secondary>
6299 </indexterm>
6300 This option is supported for compatibility with Sendmail, but has the same
6301 effect as <option>-oep</option>.
6302 </para>
6303 </listitem></varlistentry>
6304 <varlistentry>
6305 <term><option>-oew</option></term>
6306 <listitem>
6307 <para>
6308 <indexterm role="option">
6309 <primary><option>-oew</option></primary>
6310 </indexterm>
6311 <indexterm role="concept">
6312 <primary>error</primary>
6313 <secondary>reporting</secondary>
6314 </indexterm>
6315 This option is supported for compatibility with Sendmail, but has the same
6316 effect as <option>-oem</option>.
6317 </para>
6318 </listitem></varlistentry>
6319 <varlistentry>
6320 <term><option>-oi</option></term>
6321 <listitem>
6322 <para>
6323 <indexterm role="option">
6324 <primary><option>-oi</option></primary>
6325 </indexterm>
6326 <indexterm role="concept">
6327 <primary>dot</primary>
6328 <secondary>in incoming non-SMTP message</secondary>
6329 </indexterm>
6330 This option, which has the same effect as <option>-i</option>, specifies that a dot on a
6331 line by itself should not terminate an incoming, non-SMTP message. Otherwise, a
6332 single dot does terminate, though Exim does no special processing for other
6333 lines that start with a dot. This option is set by default if Exim is called as
6334 <emphasis>rmail</emphasis>. See also <option>-ti</option>.
6335 </para>
6336 </listitem></varlistentry>
6337 <varlistentry>
6338 <term><option>-oitrue</option></term>
6339 <listitem>
6340 <para>
6341 <indexterm role="option">
6342 <primary><option>-oitrue</option></primary>
6343 </indexterm>
6344 This option is treated as synonymous with <option>-oi</option>.
6345 </para>
6346 </listitem></varlistentry>
6347 <varlistentry>
6348 <term><option>-oMa</option>&nbsp;&lt;<emphasis>host&nbsp;address</emphasis>&gt;</term>
6349 <listitem>
6350 <para>
6351 <indexterm role="option">
6352 <primary><option>-oMa</option></primary>
6353 </indexterm>
6354 <indexterm role="concept">
6355 <primary>sender</primary>
6356 <secondary>host address, specifying for local message</secondary>
6357 </indexterm>
6358 A number of options starting with <option>-oM</option> can be used to set values associated
6359 with remote hosts on locally-submitted messages (that is, messages not received
6360 over TCP/IP). These options can be used by any caller in conjunction with the
6361 <option>-bh</option>, <option>-be</option>, <option>-bf</option>, <option>-bF</option>, <option>-bt</option>, or <option>-bv</option> testing options. In
6362 other circumstances, they are ignored unless the caller is trusted.
6363 </para>
6364 <para>
6365 The <option>-oMa</option> option sets the sender host address. This may include a port
6366 number at the end, after a full stop (period). For example:
6367 </para>
6368 <literallayout class="monospaced">
6369 exim -bs -oMa 10.9.8.7.1234
6370 </literallayout>
6371 <para>
6372 An alternative syntax is to enclose the IP address in square brackets,
6373 followed by a colon and the port number:
6374 </para>
6375 <literallayout class="monospaced">
6376 exim -bs -oMa [10.9.8.7]:1234
6377 </literallayout>
6378 <para>
6379 The IP address is placed in the <varname>$sender_host_address</varname> variable, and the
6380 port, if present, in <varname>$sender_host_port</varname>. If both <option>-oMa</option> and <option>-bh</option>
6381 are present on the command line, the sender host IP address is taken from
6382 whichever one is last.
6383 </para>
6384 </listitem></varlistentry>
6385 <varlistentry>
6386 <term><option>-oMaa</option>&nbsp;&lt;<emphasis>name</emphasis>&gt;</term>
6387 <listitem>
6388 <para>
6389 <indexterm role="option">
6390 <primary><option>-oMaa</option></primary>
6391 </indexterm>
6392 <indexterm role="concept">
6393 <primary>authentication</primary>
6394 <secondary>name, specifying for local message</secondary>
6395 </indexterm>
6396 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMaa</option>
6397 option sets the value of <varname>$sender_host_authenticated</varname> (the authenticator
6398 name). See chapter <xref linkend="CHAPSMTPAUTH"/> for a discussion of SMTP authentication.
6399 This option can be used with <option>-bh</option> and <option>-bs</option> to set up an
6400 authenticated SMTP session without actually using the SMTP AUTH command.
6401 </para>
6402 </listitem></varlistentry>
6403 <varlistentry>
6404 <term><option>-oMai</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6405 <listitem>
6406 <para>
6407 <indexterm role="option">
6408 <primary><option>-oMai</option></primary>
6409 </indexterm>
6410 <indexterm role="concept">
6411 <primary>authentication</primary>
6412 <secondary>id, specifying for local message</secondary>
6413 </indexterm>
6414 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMai</option>
6415 option sets the value of <varname>$authenticated_id</varname> (the id that was authenticated).
6416 This overrides the default value (the caller&#x2019;s login id, except with <option>-bh</option>,
6417 where there is no default) for messages from local sources. See chapter
6418 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated ids.
6419 </para>
6420 </listitem></varlistentry>
6421 <varlistentry>
6422 <term><option>-oMas</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
6423 <listitem>
6424 <para>
6425 <indexterm role="option">
6426 <primary><option>-oMas</option></primary>
6427 </indexterm>
6428 <indexterm role="concept">
6429 <primary>authentication</primary>
6430 <secondary>sender, specifying for local message</secondary>
6431 </indexterm>
6432 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMas</option>
6433 option sets the authenticated sender value in <varname>$authenticated_sender</varname>. It
6434 overrides the sender address that is created from the caller&#x2019;s login id for
6435 messages from local sources, except when <option>-bh</option> is used, when there is no
6436 default. For both <option>-bh</option> and <option>-bs</option>, an authenticated sender that is
6437 specified on a MAIL command overrides this value. See chapter
6438 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated senders.
6439 </para>
6440 </listitem></varlistentry>
6441 <varlistentry>
6442 <term><option>-oMi</option>&nbsp;&lt;<emphasis>interface&nbsp;address</emphasis>&gt;</term>
6443 <listitem>
6444 <para>
6445 <indexterm role="option">
6446 <primary><option>-oMi</option></primary>
6447 </indexterm>
6448 <indexterm role="concept">
6449 <primary>interface</primary>
6450 <secondary>address, specifying for local message</secondary>
6451 </indexterm>
6452 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMi</option>
6453 option sets the IP interface address value. A port number may be included,
6454 using the same syntax as for <option>-oMa</option>. The interface address is placed in
6455 <varname>$received_ip_address</varname> and the port number, if present, in <varname>$received_port</varname>.
6456 </para>
6457 </listitem></varlistentry>
6458 <varlistentry>
6459 <term><option>-oMm</option>&nbsp;&lt;<emphasis>message&nbsp;reference</emphasis>&gt;</term>
6460 <listitem>
6461 <para>
6462 <indexterm role="option">
6463 <primary><option>-oMm</option></primary>
6464 </indexterm>
6465 <indexterm role="concept">
6466 <primary>message reference</primary>
6467 <secondary>message reference, specifying for local message</secondary>
6468 </indexterm>
6469 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMm</option>
6470 option sets the message reference, e.g. message-id, and is logged during
6471 delivery. This is useful when some kind of audit trail is required to tie
6472 messages together. The format of the message reference is checked and will
6473 abort if the format is invalid. The option will only be accepted if exim is
6474 running in trusted mode, not as any regular user.
6475 </para>
6476 <para>
6477 The best example of a message reference is when Exim sends a bounce message.
6478 The message reference is the message-id of the original message for which Exim
6479 is sending the bounce.
6480 </para>
6481 </listitem></varlistentry>
6482 <varlistentry>
6483 <term><option>-oMr</option>&nbsp;&lt;<emphasis>protocol&nbsp;name</emphasis>&gt;</term>
6484 <listitem>
6485 <para>
6486 <indexterm role="option">
6487 <primary><option>-oMr</option></primary>
6488 </indexterm>
6489 <indexterm role="concept">
6490 <primary>protocol, specifying for local message</primary>
6491 </indexterm>
6492 <indexterm role="variable">
6493 <primary><varname>$received_protocol</varname></primary>
6494 </indexterm>
6495 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMr</option>
6496 option sets the received protocol value that is stored in
6497 <varname>$received_protocol</varname>. However, it does not apply (and is ignored) when <option>-bh</option>
6498 or <option>-bs</option> is used. For <option>-bh</option>, the protocol is forced to one of the standard
6499 SMTP protocol names (see the description of <varname>$received_protocol</varname> in section
6500 <xref linkend="SECTexpvar"/>). For <option>-bs</option>, the protocol is always <quote>local-</quote> followed by
6501 one of those same names. For <option>-bS</option> (batched SMTP) however, the protocol can
6502 be set by <option>-oMr</option>. Repeated use of this option is not supported.
6503 </para>
6504 </listitem></varlistentry>
6505 <varlistentry>
6506 <term><option>-oMs</option>&nbsp;&lt;<emphasis>host&nbsp;name</emphasis>&gt;</term>
6507 <listitem>
6508 <para>
6509 <indexterm role="option">
6510 <primary><option>-oMs</option></primary>
6511 </indexterm>
6512 <indexterm role="concept">
6513 <primary>sender</primary>
6514 <secondary>host name, specifying for local message</secondary>
6515 </indexterm>
6516 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMs</option>
6517 option sets the sender host name in <varname>$sender_host_name</varname>. When this option is
6518 present, Exim does not attempt to look up a host name from an IP address; it
6519 uses the name it is given.
6520 </para>
6521 </listitem></varlistentry>
6522 <varlistentry>
6523 <term><option>-oMt</option>&nbsp;&lt;<emphasis>ident&nbsp;string</emphasis>&gt;</term>
6524 <listitem>
6525 <para>
6526 <indexterm role="option">
6527 <primary><option>-oMt</option></primary>
6528 </indexterm>
6529 <indexterm role="concept">
6530 <primary>sender</primary>
6531 <secondary>ident string, specifying for local message</secondary>
6532 </indexterm>
6533 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMt</option>
6534 option sets the sender ident value in <varname>$sender_ident</varname>. The default setting for
6535 local callers is the login id of the calling process, except when <option>-bh</option> is
6536 used, when there is no default.
6537 </para>
6538 </listitem></varlistentry>
6539 <varlistentry>
6540 <term><option>-om</option></term>
6541 <listitem>
6542 <para>
6543 <indexterm role="option">
6544 <primary><option>-om</option></primary>
6545 </indexterm>
6546 <indexterm role="concept">
6547 <primary>Sendmail compatibility</primary>
6548 <secondary><option>-om</option> option ignored</secondary>
6549 </indexterm>
6550 In Sendmail, this option means <quote>me too</quote>, indicating that the sender of a
6551 message should receive a copy of the message if the sender appears in an alias
6552 expansion. Exim always does this, so the option does nothing.
6553 </para>
6554 </listitem></varlistentry>
6555 <varlistentry>
6556 <term><option>-oo</option></term>
6557 <listitem>
6558 <para>
6559 <indexterm role="option">
6560 <primary><option>-oo</option></primary>
6561 </indexterm>
6562 <indexterm role="concept">
6563 <primary>Sendmail compatibility</primary>
6564 <secondary><option>-oo</option> option ignored</secondary>
6565 </indexterm>
6566 This option is ignored. In Sendmail it specifies <quote>old style headers</quote>,
6567 whatever that means.
6568 </para>
6569 </listitem></varlistentry>
6570 <varlistentry>
6571 <term><option>-oP</option>&nbsp;&lt;<emphasis>path</emphasis>&gt;</term>
6572 <listitem>
6573 <para>
6574 <indexterm role="option">
6575 <primary><option>-oP</option></primary>
6576 </indexterm>
6577 <indexterm role="concept">
6578 <primary>pid (process id)</primary>
6579 <secondary>of daemon</secondary>
6580 </indexterm>
6581 <indexterm role="concept">
6582 <primary>daemon</primary>
6583 <secondary>process id (pid)</secondary>
6584 </indexterm>
6585 This option is useful only in conjunction with <option>-bd</option> or <option>-q</option> with a time
6586 value. The option specifies the file to which the process id of the daemon is
6587 written. When <option>-oX</option> is used with <option>-bd</option>, or when <option>-q</option> with a time is used
6588 without <option>-bd</option>, this is the only way of causing Exim to write a pid file,
6589 because in those cases, the normal pid file is not used.
6590 </para>
6591 </listitem></varlistentry>
6592 <varlistentry>
6593 <term><option>-or</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
6594 <listitem>
6595 <para>
6596 <indexterm role="option">
6597 <primary><option>-or</option></primary>
6598 </indexterm>
6599 <indexterm role="concept">
6600 <primary>timeout</primary>
6601 <secondary>for non-SMTP input</secondary>
6602 </indexterm>
6603 This option sets a timeout value for incoming non-SMTP messages. If it is not
6604 set, Exim will wait forever for the standard input. The value can also be set
6605 by the <option>receive_timeout</option> option. The format used for specifying times is
6606 described in section <xref linkend="SECTtimeformat"/>.
6607 </para>
6608 </listitem></varlistentry>
6609 <varlistentry>
6610 <term><option>-os</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
6611 <listitem>
6612 <para>
6613 <indexterm role="option">
6614 <primary><option>-os</option></primary>
6615 </indexterm>
6616 <indexterm role="concept">
6617 <primary>timeout</primary>
6618 <secondary>for SMTP input</secondary>
6619 </indexterm>
6620 <indexterm role="concept">
6621 <primary>SMTP</primary>
6622 <secondary>input timeout</secondary>
6623 </indexterm>
6624 This option sets a timeout value for incoming SMTP messages. The timeout
6625 applies to each SMTP command and block of data. The value can also be set by
6626 the <option>smtp_receive_timeout</option> option; it defaults to 5 minutes. The format used
6627 for specifying times is described in section <xref linkend="SECTtimeformat"/>.
6628 </para>
6629 </listitem></varlistentry>
6630 <varlistentry>
6631 <term><option>-ov</option></term>
6632 <listitem>
6633 <para>
6634 <indexterm role="option">
6635 <primary><option>-ov</option></primary>
6636 </indexterm>
6637 This option has exactly the same effect as <option>-v</option>.
6638 </para>
6639 </listitem></varlistentry>
6640 <varlistentry>
6641 <term><option>-oX</option>&nbsp;&lt;<emphasis>number&nbsp;or&nbsp;string</emphasis>&gt;</term>
6642 <listitem>
6643 <para>
6644 <indexterm role="option">
6645 <primary><option>-oX</option></primary>
6646 </indexterm>
6647 <indexterm role="concept">
6648 <primary>TCP/IP</primary>
6649 <secondary>setting listening ports</secondary>
6650 </indexterm>
6651 <indexterm role="concept">
6652 <primary>TCP/IP</primary>
6653 <secondary>setting listening interfaces</secondary>
6654 </indexterm>
6655 <indexterm role="concept">
6656 <primary>port</primary>
6657 <secondary>receiving TCP/IP</secondary>
6658 </indexterm>
6659 This option is relevant only when the <option>-bd</option> (start listening daemon) option
6660 is also given. It controls which ports and interfaces the daemon uses. Details
6661 of the syntax, and how it interacts with configuration file options, are given
6662 in chapter <xref linkend="CHAPinterfaces"/>. When <option>-oX</option> is used to start a daemon, no pid
6663 file is written unless <option>-oP</option> is also present to specify a pid file name.
6664 </para>
6665 </listitem></varlistentry>
6666 <varlistentry>
6667 <term><option>-pd</option></term>
6668 <listitem>
6669 <para>
6670 <indexterm role="option">
6671 <primary><option>-pd</option></primary>
6672 </indexterm>
6673 <indexterm role="concept">
6674 <primary>Perl</primary>
6675 <secondary>starting the interpreter</secondary>
6676 </indexterm>
6677 This option applies when an embedded Perl interpreter is linked with Exim (see
6678 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
6679 option, forcing the starting of the interpreter to be delayed until it is
6680 needed.
6681 </para>
6682 </listitem></varlistentry>
6683 <varlistentry>
6684 <term><option>-ps</option></term>
6685 <listitem>
6686 <para>
6687 <indexterm role="option">
6688 <primary><option>-ps</option></primary>
6689 </indexterm>
6690 <indexterm role="concept">
6691 <primary>Perl</primary>
6692 <secondary>starting the interpreter</secondary>
6693 </indexterm>
6694 This option applies when an embedded Perl interpreter is linked with Exim (see
6695 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
6696 option, forcing the starting of the interpreter to occur as soon as Exim is
6697 started.
6698 </para>
6699 </listitem></varlistentry>
6700 <varlistentry>
6701 <term><option>-p</option>&lt;<emphasis>rval</emphasis>&gt;:&lt;<emphasis>sval</emphasis>&gt;</term>
6702 <listitem>
6703 <para>
6704 <indexterm role="option">
6705 <primary><option>-p</option></primary>
6706 </indexterm>
6707 For compatibility with Sendmail, this option is equivalent to
6708 </para>
6709 <literallayout>
6710 <literal>-oMr</literal> &lt;<emphasis>rval</emphasis>&gt; <literal>-oMs</literal> &lt;<emphasis>sval</emphasis>&gt;
6711 </literallayout>
6712 <para>
6713 It sets the incoming protocol and host name (for trusted callers). The
6714 host name and its colon can be omitted when only the protocol is to be set.
6715 Note the Exim already has two private options, <option>-pd</option> and <option>-ps</option>, that refer
6716 to embedded Perl. It is therefore impossible to set a protocol value of <literal>d</literal>
6717 or <literal>s</literal> using this option (but that does not seem a real limitation).
6718 Repeated use of this option is not supported.
6719 </para>
6720 </listitem></varlistentry>
6721 <varlistentry>
6722 <term><option>-q</option></term>
6723 <listitem>
6724 <para>
6725 <indexterm role="option">
6726 <primary><option>-q</option></primary>
6727 </indexterm>
6728 <indexterm role="concept">
6729 <primary>queue runner</primary>
6730 <secondary>starting manually</secondary>
6731 </indexterm>
6732 This option is normally restricted to admin users. However, there is a
6733 configuration option called <option>prod_requires_admin</option> which can be set false to
6734 relax this restriction (and also the same requirement for the <option>-M</option>, <option>-R</option>,
6735 and <option>-S</option> options).
6736 </para>
6737 <para>
6738 <indexterm role="concept">
6739 <primary>queue runner</primary>
6740 <secondary>description of operation</secondary>
6741 </indexterm>
6742 If other commandline options do not specify an action,
6743 the <option>-q</option> option starts one queue runner process. This scans the queue of
6744 waiting messages, and runs a delivery process for each one in turn. It waits
6745 for each delivery process to finish before starting the next one. A delivery
6746 process may not actually do any deliveries if the retry times for the addresses
6747 have not been reached. Use <option>-qf</option> (see below) if you want to override this.
6748 </para>
6749 <para>
6750 If
6751 <indexterm role="concept">
6752 <primary>SMTP</primary>
6753 <secondary>passed connection</secondary>
6754 </indexterm>
6755 <indexterm role="concept">
6756 <primary>SMTP</primary>
6757 <secondary>multiple deliveries</secondary>
6758 </indexterm>
6759 <indexterm role="concept">
6760 <primary>multiple SMTP deliveries</primary>
6761 </indexterm>
6762 the delivery process spawns other processes to deliver other messages down
6763 passed SMTP connections, the queue runner waits for these to finish before
6764 proceeding.
6765 </para>
6766 <para>
6767 When all the queued messages have been considered, the original queue runner
6768 process terminates. In other words, a single pass is made over the waiting
6769 mail, one message at a time. Use <option>-q</option> with a time (see below) if you want
6770 this to be repeated periodically.
6771 </para>
6772 <para>
6773 Exim processes the waiting messages in an unpredictable order. It isn&#x2019;t very
6774 random, but it is likely to be different each time, which is all that matters.
6775 If one particular message screws up a remote MTA, other messages to the same
6776 MTA have a chance of getting through if they get tried first.
6777 </para>
6778 <para>
6779 It is possible to cause the messages to be processed in lexical message id
6780 order, which is essentially the order in which they arrived, by setting the
6781 <option>queue_run_in_order</option> option, but this is not recommended for normal use.
6782 </para>
6783 </listitem></varlistentry>
6784 <varlistentry>
6785 <term><option>-q</option>&lt;<emphasis>qflags</emphasis>&gt;</term>
6786 <listitem>
6787 <para>
6788 The <option>-q</option> option may be followed by one or more flag letters that change its
6789 behaviour. They are all optional, but if more than one is present, they must
6790 appear in the correct order. Each flag is described in a separate item below.
6791 </para>
6792 </listitem></varlistentry>
6793 <varlistentry>
6794 <term><option>-qq...</option></term>
6795 <listitem>
6796 <para>
6797 <indexterm role="option">
6798 <primary><option>-qq</option></primary>
6799 </indexterm>
6800 <indexterm role="concept">
6801 <primary>queue</primary>
6802 <secondary>double scanning</secondary>
6803 </indexterm>
6804 <indexterm role="concept">
6805 <primary>queue</primary>
6806 <secondary>routing</secondary>
6807 </indexterm>
6808 <indexterm role="concept">
6809 <primary>routing</primary>
6810 <secondary>whole queue before delivery</secondary>
6811 </indexterm>
6812 An option starting with <option>-qq</option> requests a two-stage queue run. In the first
6813 stage, the queue is scanned as if the <option>queue_smtp_domains</option> option matched
6814 every domain. Addresses are routed, local deliveries happen, but no remote
6815 transports are run.
6816 </para>
6817 <para>
6818 <indexterm role="concept">
6819 <primary>hints database</primary>
6820 <secondary>remembering routing</secondary>
6821 </indexterm>
6822 The hints database that remembers which messages are waiting for specific hosts
6823 is updated, as if delivery to those hosts had been deferred. After this is
6824 complete, a second, normal queue scan happens, with routing and delivery taking
6825 place as normal. Messages that are routed to the same host should mostly be
6826 delivered down a single SMTP
6827 <indexterm role="concept">
6828 <primary>SMTP</primary>
6829 <secondary>passed connection</secondary>
6830 </indexterm>
6831 <indexterm role="concept">
6832 <primary>SMTP</primary>
6833 <secondary>multiple deliveries</secondary>
6834 </indexterm>
6835 <indexterm role="concept">
6836 <primary>multiple SMTP deliveries</primary>
6837 </indexterm>
6838 connection because of the hints that were set up during the first queue scan.
6839 This option may be useful for hosts that are connected to the Internet
6840 intermittently.
6841 </para>
6842 </listitem></varlistentry>
6843 <varlistentry>
6844 <term><option>-q[q]i...</option></term>
6845 <listitem>
6846 <para>
6847 <indexterm role="option">
6848 <primary><option>-qi</option></primary>
6849 </indexterm>
6850 <indexterm role="concept">
6851 <primary>queue</primary>
6852 <secondary>initial delivery</secondary>
6853 </indexterm>
6854 If the <emphasis>i</emphasis> flag is present, the queue runner runs delivery processes only for
6855 those messages that haven&#x2019;t previously been tried. (<emphasis>i</emphasis> stands for <quote>initial
6856 delivery</quote>.) This can be helpful if you are putting messages on the queue using
6857 <option>-odq</option> and want a queue runner just to process the new messages.
6858 </para>
6859 </listitem></varlistentry>
6860 <varlistentry>
6861 <term><option>-q[q][i]f...</option></term>
6862 <listitem>
6863 <para>
6864 <indexterm role="option">
6865 <primary><option>-qf</option></primary>
6866 </indexterm>
6867 <indexterm role="concept">
6868 <primary>queue</primary>
6869 <secondary>forcing delivery</secondary>
6870 </indexterm>
6871 <indexterm role="concept">
6872 <primary>delivery</primary>
6873 <secondary>forcing in queue run</secondary>
6874 </indexterm>
6875 If one <emphasis>f</emphasis> flag is present, a delivery attempt is forced for each non-frozen
6876 message, whereas without <emphasis>f</emphasis> only those non-frozen addresses that have passed
6877 their retry times are tried.
6878 </para>
6879 </listitem></varlistentry>
6880 <varlistentry>
6881 <term><option>-q[q][i]ff...</option></term>
6882 <listitem>
6883 <para>
6884 <indexterm role="option">
6885 <primary><option>-qff</option></primary>
6886 </indexterm>
6887 <indexterm role="concept">
6888 <primary>frozen messages</primary>
6889 <secondary>forcing delivery</secondary>
6890 </indexterm>
6891 If <emphasis>ff</emphasis> is present, a delivery attempt is forced for every message, whether
6892 frozen or not.
6893 </para>
6894 </listitem></varlistentry>
6895 <varlistentry>
6896 <term><option>-q[q][i][f[f]]l</option></term>
6897 <listitem>
6898 <para>
6899 <indexterm role="option">
6900 <primary><option>-ql</option></primary>
6901 </indexterm>
6902 <indexterm role="concept">
6903 <primary>queue</primary>
6904 <secondary>local deliveries only</secondary>
6905 </indexterm>
6906 The <emphasis>l</emphasis> (the letter <quote>ell</quote>) flag specifies that only local deliveries are to
6907 be done. If a message requires any remote deliveries, it remains on the queue
6908 for later delivery.
6909 </para>
6910 </listitem></varlistentry>
6911 <varlistentry>
6912 <term><option>-q[q][i][f[f]][l][G&lt;name&gt;[/&lt;time&gt;]]]</option></term>
6913 <listitem>
6914 <para>
6915 <indexterm role="option">
6916 <primary><option>-qG</option></primary>
6917 </indexterm>
6918 <indexterm role="concept">
6919 <primary>queue</primary>
6920 <secondary>named</secondary>
6921 </indexterm>
6922 <indexterm role="concept">
6923 <primary>named queues</primary>
6924 </indexterm>
6925 <indexterm role="concept">
6926 <primary>queue</primary>
6927 <secondary>delivering specific messages</secondary>
6928 </indexterm>
6929 If the <emphasis>G</emphasis> flag and a name is present, the queue runner operates on the
6930 queue with the given name rather than the default queue.
6931 The name should not contain a <emphasis>/</emphasis> character.
6932 For a periodic queue run (see below)
6933 append to the name a slash and a time value.
6934 </para>
6935 <para>
6936 If other commandline options specify an action, a <emphasis>-qG&lt;name&gt;</emphasis> option
6937 will specify a queue to operate on.
6938 For example:
6939 </para>
6940 <literallayout class="monospaced">
6941 exim -bp -qGquarantine
6942 mailq -qGquarantine
6943 exim -qGoffpeak -Rf @special.domain.example
6944 </literallayout>
6945 </listitem></varlistentry>
6946 <varlistentry>
6947 <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>
6948 <listitem>
6949 <para>
6950 When scanning the queue, Exim can be made to skip over messages whose ids are
6951 lexically less than a given value by following the <option>-q</option> option with a
6952 starting message id. For example:
6953 </para>
6954 <literallayout class="monospaced">
6955 exim -q 0t5C6f-0000c8-00
6956 </literallayout>
6957 <para>
6958 Messages that arrived earlier than <literal>0t5C6f-0000c8-00</literal> are not inspected. If a
6959 second message id is given, messages whose ids are lexically greater than it
6960 are also skipped. If the same id is given twice, for example,
6961 </para>
6962 <literallayout class="monospaced">
6963 exim -q 0t5C6f-0000c8-00 0t5C6f-0000c8-00
6964 </literallayout>
6965 <para>
6966 just one delivery process is started, for that message. This differs from
6967 <option>-M</option> in that retry data is respected, and it also differs from <option>-Mc</option> in
6968 that it counts as a delivery from a queue run. Note that the selection
6969 mechanism does not affect the order in which the messages are scanned. There
6970 are also other ways of selecting specific sets of messages for delivery in a
6971 queue run &ndash; see <option>-R</option> and <option>-S</option>.
6972 </para>
6973 </listitem></varlistentry>
6974 <varlistentry>
6975 <term><option>-q</option>&lt;<emphasis>qflags</emphasis>&gt;&lt;<emphasis>time</emphasis>&gt;</term>
6976 <listitem>
6977 <para>
6978 <indexterm role="concept">
6979 <primary>queue runner</primary>
6980 <secondary>starting periodically</secondary>
6981 </indexterm>
6982 <indexterm role="concept">
6983 <primary>periodic queue running</primary>
6984 </indexterm>
6985 When a time value is present, the <option>-q</option> option causes Exim to run as a daemon,
6986 starting a queue runner process at intervals specified by the given time value
6987 (whose format is described in section <xref linkend="SECTtimeformat"/>). This form of the
6988 <option>-q</option> option is commonly combined with the <option>-bd</option> option, in which case a
6989 single daemon process handles both functions. A common way of starting up a
6990 combined daemon at system boot time is to use a command such as
6991 </para>
6992 <literallayout class="monospaced">
6993 /usr/exim/bin/exim -bd -q30m
6994 </literallayout>
6995 <para>
6996 Such a daemon listens for incoming SMTP calls, and also starts a queue runner
6997 process every 30 minutes.
6998 </para>
6999 <para>
7000 When a daemon is started by <option>-q</option> with a time value, but without <option>-bd</option>, no
7001 pid file is written unless one is explicitly requested by the <option>-oP</option> option.
7002 </para>
7003 </listitem></varlistentry>
7004 <varlistentry>
7005 <term><option>-qR</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
7006 <listitem>
7007 <para>
7008 <indexterm role="option">
7009 <primary><option>-qR</option></primary>
7010 </indexterm>
7011 This option is synonymous with <option>-R</option>. It is provided for Sendmail
7012 compatibility.
7013 </para>
7014 </listitem></varlistentry>
7015 <varlistentry>
7016 <term><option>-qS</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
7017 <listitem>
7018 <para>
7019 <indexterm role="option">
7020 <primary><option>-qS</option></primary>
7021 </indexterm>
7022 This option is synonymous with <option>-S</option>.
7023 </para>
7024 </listitem></varlistentry>
7025 <varlistentry>
7026 <term><option>-R</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
7027 <listitem>
7028 <para>
7029 <indexterm role="option">
7030 <primary><option>-R</option></primary>
7031 </indexterm>
7032 <indexterm role="concept">
7033 <primary>queue runner</primary>
7034 <secondary>for specific recipients</secondary>
7035 </indexterm>
7036 <indexterm role="concept">
7037 <primary>delivery</primary>
7038 <secondary>to given domain</secondary>
7039 </indexterm>
7040 <indexterm role="concept">
7041 <primary>domain</primary>
7042 <secondary>delivery to</secondary>
7043 </indexterm>
7044 The &lt;<emphasis>rsflags</emphasis>&gt; may be empty, in which case the white space before the string
7045 is optional, unless the string is <emphasis>f</emphasis>, <emphasis>ff</emphasis>, <emphasis>r</emphasis>, <emphasis>rf</emphasis>, or <emphasis>rff</emphasis>,
7046 which are the possible values for &lt;<emphasis>rsflags</emphasis>&gt;. White space is required if
7047 &lt;<emphasis>rsflags</emphasis>&gt; is not empty.
7048 </para>
7049 <para>
7050 This option is similar to <option>-q</option> with no time value, that is, it causes Exim to
7051 perform a single queue run, except that, when scanning the messages on the
7052 queue, Exim processes only those that have at least one undelivered recipient
7053 address containing the given string, which is checked in a case-independent
7054 way. If the &lt;<emphasis>rsflags</emphasis>&gt; start with <emphasis>r</emphasis>, &lt;<emphasis>string</emphasis>&gt; is interpreted as a
7055 regular expression; otherwise it is a literal string.
7056 </para>
7057 <para>
7058 If you want to do periodic queue runs for messages with specific recipients,
7059 you can combine <option>-R</option> with <option>-q</option> and a time value. For example:
7060 </para>
7061 <literallayout class="monospaced">
7062 exim -q25m -R @special.domain.example
7063 </literallayout>
7064 <para>
7065 This example does a queue run for messages with recipients in the given domain
7066 every 25 minutes. Any additional flags that are specified with <option>-q</option> are
7067 applied to each queue run.
7068 </para>
7069 <para>
7070 Once a message is selected for delivery by this mechanism, all its addresses
7071 are processed. For the first selected message, Exim overrides any retry
7072 information and forces a delivery attempt for each undelivered address. This
7073 means that if delivery of any address in the first message is successful, any
7074 existing retry information is deleted, and so delivery attempts for that
7075 address in subsequently selected messages (which are processed without forcing)
7076 will run. However, if delivery of any address does not succeed, the retry
7077 information is updated, and in subsequently selected messages, the failing
7078 address will be skipped.
7079 </para>
7080 <para>
7081 <indexterm role="concept">
7082 <primary>frozen messages</primary>
7083 <secondary>forcing delivery</secondary>
7084 </indexterm>
7085 If the &lt;<emphasis>rsflags</emphasis>&gt; contain <emphasis>f</emphasis> or <emphasis>ff</emphasis>, the delivery forcing applies to
7086 all selected messages, not just the first; frozen messages are included when
7087 <emphasis>ff</emphasis> is present.
7088 </para>
7089 <para>
7090 The <option>-R</option> option makes it straightforward to initiate delivery of all messages
7091 to a given domain after a host has been down for some time. When the SMTP
7092 command ETRN is accepted by its ACL (see chapter <xref linkend="CHAPACL"/>), its default
7093 effect is to run Exim with the <option>-R</option> option, but it can be configured to run
7094 an arbitrary command instead.
7095 </para>
7096 </listitem></varlistentry>
7097 <varlistentry>
7098 <term><option>-r</option></term>
7099 <listitem>
7100 <para>
7101 <indexterm role="option">
7102 <primary><option>-r</option></primary>
7103 </indexterm>
7104 This is a documented (for Sendmail) obsolete alternative name for <option>-f</option>.
7105 </para>
7106 </listitem></varlistentry>
7107 <varlistentry>
7108 <term><option>-S</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
7109 <listitem>
7110 <para>
7111 <indexterm role="option">
7112 <primary><option>-S</option></primary>
7113 </indexterm>
7114 <indexterm role="concept">
7115 <primary>delivery</primary>
7116 <secondary>from given sender</secondary>
7117 </indexterm>
7118 <indexterm role="concept">
7119 <primary>queue runner</primary>
7120 <secondary>for specific senders</secondary>
7121 </indexterm>
7122 This option acts like <option>-R</option> except that it checks the string against each
7123 message&#x2019;s sender instead of against the recipients. If <option>-R</option> is also set, both
7124 conditions must be met for a message to be selected. If either of the options
7125 has <emphasis>f</emphasis> or <emphasis>ff</emphasis> in its flags, the associated action is taken.
7126 </para>
7127 </listitem></varlistentry>
7128 <varlistentry>
7129 <term><option>-Tqt</option>&nbsp;&lt;<emphasis>times</emphasis>&gt;</term>
7130 <listitem>
7131 <para>
7132 <indexterm role="option">
7133 <primary><option>-Tqt</option></primary>
7134 </indexterm>
7135 This is an option that is exclusively for use by the Exim testing suite. It is not
7136 recognized when Exim is run normally. It allows for the setting up of explicit
7137 <quote>queue times</quote> so that various warning/retry features can be tested.
7138 </para>
7139 </listitem></varlistentry>
7140 <varlistentry>
7141 <term><option>-t</option></term>
7142 <listitem>
7143 <para>
7144 <indexterm role="option">
7145 <primary><option>-t</option></primary>
7146 </indexterm>
7147 <indexterm role="concept">
7148 <primary>recipient</primary>
7149 <secondary>extracting from header lines</secondary>
7150 </indexterm>
7151 <indexterm role="concept">
7152 <primary><emphasis>Bcc:</emphasis> header line</primary>
7153 </indexterm>
7154 <indexterm role="concept">
7155 <primary><emphasis>Cc:</emphasis> header line</primary>
7156 </indexterm>
7157 <indexterm role="concept">
7158 <primary><emphasis>To:</emphasis> header line</primary>
7159 </indexterm>
7160 When Exim is receiving a locally-generated, non-SMTP message on its standard
7161 input, the <option>-t</option> option causes the recipients of the message to be obtained
7162 from the <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis> header lines in the message instead of
7163 from the command arguments. The addresses are extracted before any rewriting
7164 takes place and the <emphasis>Bcc:</emphasis> header line, if present, is then removed.
7165 </para>
7166 <para>
7167 <indexterm role="concept">
7168 <primary>Sendmail compatibility</primary>
7169 <secondary><option>-t</option> option</secondary>
7170 </indexterm>
7171 If the command has any arguments, they specify addresses to which the message
7172 is <emphasis>not</emphasis> to be delivered. That is, the argument addresses are removed from
7173 the recipients list obtained from the headers. This is compatible with Smail 3
7174 and in accordance with the documented behaviour of several versions of
7175 Sendmail, as described in man pages on a number of operating systems (e.g.
7176 Solaris 8, IRIX 6.5, HP-UX 11). However, some versions of Sendmail <emphasis>add</emphasis>
7177 argument addresses to those obtained from the headers, and the O&#x2019;Reilly
7178 Sendmail book documents it that way. Exim can be made to add argument addresses
7179 instead of subtracting them by setting the option
7180 <option>extract_addresses_remove_arguments</option> false.
7181 </para>
7182 <para>
7183 <indexterm role="concept">
7184 <primary><option>Resent-</option> header lines</primary>
7185 <secondary>with <option>-t</option></secondary>
7186 </indexterm>
7187 If there are any <option>Resent-</option> header lines in the message, Exim extracts
7188 recipients from all <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>, and <emphasis>Resent-Bcc:</emphasis> header
7189 lines instead of from <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis>. This is for compatibility
7190 with Sendmail and other MTAs. (Prior to release 4.20, Exim gave an error if
7191 <option>-t</option> was used in conjunction with <option>Resent-</option> header lines.)
7192 </para>
7193 <para>
7194 RFC 2822 talks about different sets of <option>Resent-</option> header lines (for when a
7195 message is resent several times). The RFC also specifies that they should be
7196 added at the front of the message, and separated by <emphasis>Received:</emphasis> lines. It is
7197 not at all clear how <option>-t</option> should operate in the present of multiple sets,
7198 nor indeed exactly what constitutes a <quote>set</quote>.
7199 In practice, it seems that MUAs do not follow the RFC. The <option>Resent-</option> lines
7200 are often added at the end of the header, and if a message is resent more than
7201 once, it is common for the original set of <option>Resent-</option> headers to be renamed as
7202 <option>X-Resent-</option> when a new set is added. This removes any possible ambiguity.
7203 </para>
7204 </listitem></varlistentry>
7205 <varlistentry>
7206 <term><option>-ti</option></term>
7207 <listitem>
7208 <para>
7209 <indexterm role="option">
7210 <primary><option>-ti</option></primary>
7211 </indexterm>
7212 This option is exactly equivalent to <option>-t</option> <option>-i</option>. It is provided for
7213 compatibility with Sendmail.
7214 </para>
7215 </listitem></varlistentry>
7216 <varlistentry>
7217 <term><option>-tls-on-connect</option></term>
7218 <listitem>
7219 <para>
7220 <indexterm role="option">
7221 <primary><option>-tls-on-connect</option></primary>
7222 </indexterm>
7223 <indexterm role="concept">
7224 <primary>TLS</primary>
7225 <secondary>use without STARTTLS</secondary>
7226 </indexterm>
7227 <indexterm role="concept">
7228 <primary>TLS</primary>
7229 <secondary>automatic start</secondary>
7230 </indexterm>
7231 This option is available when Exim is compiled with TLS support. It forces all
7232 incoming SMTP connections to behave as if the incoming port is listed in the
7233 <option>tls_on_connect_ports</option> option. See section <xref linkend="SECTsupobssmt"/> and chapter
7234 <xref linkend="CHAPTLS"/> for further details.
7235 </para>
7236 </listitem></varlistentry>
7237 <varlistentry>
7238 <term><option>-U</option></term>
7239 <listitem>
7240 <para>
7241 <indexterm role="option">
7242 <primary><option>-U</option></primary>
7243 </indexterm>
7244 <indexterm role="concept">
7245 <primary>Sendmail compatibility</primary>
7246 <secondary><option>-U</option> option ignored</secondary>
7247 </indexterm>
7248 Sendmail uses this option for <quote>initial message submission</quote>, and its
7249 documentation states that in future releases, it may complain about
7250 syntactically invalid messages rather than fixing them when this flag is not
7251 set. Exim ignores this option.
7252 </para>
7253 </listitem></varlistentry>
7254 <varlistentry>
7255 <term><option>-v</option></term>
7256 <listitem>
7257 <para>
7258 <indexterm role="option">
7259 <primary><option>-v</option></primary>
7260 </indexterm>
7261 This option causes Exim to write information to the standard error stream,
7262 describing what it is doing. In particular, it shows the log lines for
7263 receiving and delivering a message, and if an SMTP connection is made, the SMTP
7264 dialogue is shown. Some of the log lines shown may not actually be written to
7265 the log if the setting of <option>log_selector</option> discards them. Any relevant
7266 selectors are shown with each log line. If none are shown, the logging is
7267 unconditional.
7268 </para>
7269 </listitem></varlistentry>
7270 <varlistentry>
7271 <term><option>-x</option></term>
7272 <listitem>
7273 <para>
7274 <indexterm role="option">
7275 <primary><option>-x</option></primary>
7276 </indexterm>
7277 AIX uses <option>-x</option> for a private purpose (<quote>mail from a local mail program has
7278 National Language Support extended characters in the body of the mail item</quote>).
7279 It sets <option>-x</option> when calling the MTA from its <option>mail</option> command. Exim ignores
7280 this option.
7281 </para>
7282 </listitem></varlistentry>
7283 <varlistentry>
7284 <term><option>-X</option>&nbsp;&lt;<emphasis>logfile</emphasis>&gt;</term>
7285 <listitem>
7286 <para>
7287 <indexterm role="option">
7288 <primary><option>-X</option></primary>
7289 </indexterm>
7290 This option is interpreted by Sendmail to cause debug information to be sent
7291 to the named file.  It is ignored by Exim.
7292 </para>
7293 </listitem></varlistentry>
7294 <varlistentry>
7295 <term><option>-z</option>&nbsp;&lt;<emphasis>log-line</emphasis>&gt;</term>
7296 <listitem>
7297 <para>
7298 <indexterm role="option">
7299 <primary><option>-z</option></primary>
7300 </indexterm>
7301 This option writes its argument to Exim&#x2019;s logfile.
7302 Use is restricted to administrators; the intent is for operational notes.
7303 Quotes should be used to maintain a multi-word item as a single argument,
7304 under most shells.
7305 </para>
7306 </listitem></varlistentry>
7307 </variablelist>
7308 <para>
7309 <indexterm role="concept" startref="IIDclo1" class="endofrange"/>
7310 <indexterm role="concept" startref="IIDclo2" class="endofrange"/>
7311 </para>
7312 <!-- === End of command line options === -->
7313 </section>
7314 </chapter>
7315
7316 <chapter id="CHAPconf">
7317 <title>The Exim run time configuration file</title>
7318 <titleabbrev>The runtime configuration file</titleabbrev>
7319 <para>
7320 <indexterm role="concept">
7321 <primary>run time configuration</primary>
7322 </indexterm>
7323 <indexterm role="concept">
7324 <primary>configuration file</primary>
7325 <secondary>general description</secondary>
7326 </indexterm>
7327 <indexterm role="concept">
7328 <primary>CONFIGURE_FILE</primary>
7329 </indexterm>
7330 <indexterm role="concept">
7331 <primary>configuration file</primary>
7332 <secondary>errors in</secondary>
7333 </indexterm>
7334 <indexterm role="concept">
7335 <primary>error</primary>
7336 <secondary>in configuration file</secondary>
7337 </indexterm>
7338 <indexterm role="concept">
7339 <primary>return code</primary>
7340 <secondary>for bad configuration</secondary>
7341 </indexterm>
7342 Exim uses a single run time configuration file that is read whenever an Exim
7343 binary is executed. Note that in normal operation, this happens frequently,
7344 because Exim is designed to operate in a distributed manner, without central
7345 control.
7346 </para>
7347 <para>
7348 If a syntax error is detected while reading the configuration file, Exim
7349 writes a message on the standard error, and exits with a non-zero return code.
7350 The message is also written to the panic log. <emphasis role="bold">Note</emphasis>: Only simple syntax
7351 errors can be detected at this time. The values of any expanded options are
7352 not checked until the expansion happens, even when the expansion does not
7353 actually alter the string.
7354 </para>
7355 <para>
7356 The name of the configuration file is compiled into the binary for security
7357 reasons, and is specified by the CONFIGURE_FILE compilation option. In
7358 most configurations, this specifies a single file. However, it is permitted to
7359 give a colon-separated list of file names, in which case Exim uses the first
7360 existing file in the list.
7361 </para>
7362 <para>
7363 <indexterm role="concept">
7364 <primary>EXIM_USER</primary>
7365 </indexterm>
7366 <indexterm role="concept">
7367 <primary>EXIM_GROUP</primary>
7368 </indexterm>
7369 <indexterm role="concept">
7370 <primary>CONFIGURE_OWNER</primary>
7371 </indexterm>
7372 <indexterm role="concept">
7373 <primary>CONFIGURE_GROUP</primary>
7374 </indexterm>
7375 <indexterm role="concept">
7376 <primary>configuration file</primary>
7377 <secondary>ownership</secondary>
7378 </indexterm>
7379 <indexterm role="concept">
7380 <primary>ownership</primary>
7381 <secondary>configuration file</secondary>
7382 </indexterm>
7383 The run time configuration file must be owned by root or by the user that is
7384 specified at compile time by the CONFIGURE_OWNER option (if set). The
7385 configuration file must not be world-writeable, or group-writeable unless its
7386 group is the root group or the one specified at compile time by the
7387 CONFIGURE_GROUP option.
7388 </para>
7389 <para>
7390 <emphasis role="bold">Warning</emphasis>: In a conventional configuration, where the Exim binary is setuid
7391 to root, anybody who is able to edit the run time configuration file has an
7392 easy way to run commands as root. If you specify a user or group in the
7393 CONFIGURE_OWNER or CONFIGURE_GROUP options, then that user and/or any users
7394 who are members of that group will trivially be able to obtain root privileges.
7395 </para>
7396 <para>
7397 Up to Exim version 4.72, the run time configuration file was also permitted to
7398 be writeable by the Exim user and/or group. That has been changed in Exim 4.73
7399 since it offered a simple privilege escalation for any attacker who managed to
7400 compromise the Exim user account.
7401 </para>
7402 <para>
7403 A default configuration file, which will work correctly in simple situations,
7404 is provided in the file <filename>src/configure.default</filename>. If CONFIGURE_FILE
7405 defines just one file name, the installation process copies the default
7406 configuration to a new file of that name if it did not previously exist. If
7407 CONFIGURE_FILE is a list, no default is automatically installed. Chapter
7408 <xref linkend="CHAPdefconfil"/> is a <quote>walk-through</quote> discussion of the default
7409 configuration.
7410 </para>
7411 <section id="SECID40">
7412 <title>Using a different configuration file</title>
7413 <para>
7414 <indexterm role="concept">
7415 <primary>configuration file</primary>
7416 <secondary>alternate</secondary>
7417 </indexterm>
7418 A one-off alternate configuration can be specified by the <option>-C</option> command line
7419 option, which may specify a single file or a list of files. However, when
7420 <option>-C</option> is used, Exim gives up its root privilege, unless called by root (or
7421 unless the argument for <option>-C</option> is identical to the built-in value from
7422 CONFIGURE_FILE), or is listed in the TRUSTED_CONFIG_LIST file and the caller
7423 is the Exim user or the user specified in the CONFIGURE_OWNER setting. <option>-C</option>
7424 is useful mainly for checking the syntax of configuration files before
7425 installing them. No owner or group checks are done on a configuration file
7426 specified by <option>-C</option>, if root privilege has been dropped.
7427 </para>
7428 <para>
7429 Even the Exim user is not trusted to specify an arbitrary configuration file
7430 with the <option>-C</option> option to be used with root privileges, unless that file is
7431 listed in the TRUSTED_CONFIG_LIST file. This locks out the possibility of
7432 testing a configuration using <option>-C</option> right through message reception and
7433 delivery, even if the caller is root. The reception works, but by that time,
7434 Exim is running as the Exim user, so when it re-execs to regain privilege for
7435 the delivery, the use of <option>-C</option> causes privilege to be lost. However, root
7436 can test reception and delivery using two separate commands (one to put a
7437 message on the queue, using <option>-odq</option>, and another to do the delivery, using
7438 <option>-M</option>).
7439 </para>
7440 <para>
7441 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
7442 prefix string with which any file named in a <option>-C</option> command line option must
7443 start. In addition, the file name must not contain the sequence <quote><literal>/../</literal></quote>.
7444 There is no default setting for ALT_CONFIG_PREFIX; when it is unset, any file
7445 name can be used with <option>-C</option>.
7446 </para>
7447 <para>
7448 One-off changes to a configuration can be specified by the <option>-D</option> command line
7449 option, which defines and overrides values for macros used inside the
7450 configuration file. However, like <option>-C</option>, the use of this option by a
7451 non-privileged user causes Exim to discard its root privilege.
7452 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
7453 completely disabled, and its use causes an immediate error exit.
7454 </para>
7455 <para>
7456 The WHITELIST_D_MACROS option in <filename>Local/Makefile</filename> permits the binary builder
7457 to declare certain macro names trusted, such that root privilege will not
7458 necessarily be discarded.
7459 WHITELIST_D_MACROS defines a colon-separated list of macros which are
7460 considered safe and, if <option>-D</option> only supplies macros from this list, and the
7461 values are acceptable, then Exim will not give up root privilege if the caller
7462 is root, the Exim run-time user, or the CONFIGURE_OWNER, if set.  This is a
7463 transition mechanism and is expected to be removed in the future.  Acceptable
7464 values for the macros satisfy the regexp: <literal>^[A-Za-z0-9_/.-]*$</literal>
7465 </para>
7466 <para>
7467 Some sites may wish to use the same Exim binary on different machines that
7468 share a file system, but to use different configuration files on each machine.
7469 If CONFIGURE_FILE_USE_NODE is defined in <filename>Local/Makefile</filename>, Exim first
7470 looks for a file whose name is the configuration file name followed by a dot
7471 and the machine&#x2019;s node name, as obtained from the <function>uname()</function> function. If this
7472 file does not exist, the standard name is tried. This processing occurs for
7473 each file name in the list given by CONFIGURE_FILE or <option>-C</option>.
7474 </para>
7475 <para>
7476 In some esoteric situations different versions of Exim may be run under
7477 different effective uids and the CONFIGURE_FILE_USE_EUID is defined to
7478 help with this. See the comments in <filename>src/EDITME</filename> for details.
7479 </para>
7480 </section>
7481 <section id="SECTconffilfor">
7482 <title>Configuration file format</title>
7483 <para>
7484 <indexterm role="concept">
7485 <primary>configuration file</primary>
7486 <secondary>format of</secondary>
7487 </indexterm>
7488 <indexterm role="concept">
7489 <primary>format</primary>
7490 <secondary>configuration file</secondary>
7491 </indexterm>
7492 Exim&#x2019;s configuration file is divided into a number of different parts. General
7493 option settings must always appear at the start of the file. The other parts
7494 are all optional, and may appear in any order. Each part other than the first
7495 is introduced by the word <quote>begin</quote> followed by at least one literal
7496 space, and the name of the part. The optional parts are:
7497 </para>
7498 <itemizedlist>
7499 <listitem>
7500 <para>
7501 <emphasis>ACL</emphasis>: Access control lists for controlling incoming SMTP mail (see chapter
7502 <xref linkend="CHAPACL"/>).
7503 </para>
7504 </listitem>
7505 <listitem>
7506 <para>
7507 <indexterm role="concept">
7508 <primary>AUTH</primary>
7509 <secondary>configuration</secondary>
7510 </indexterm>
7511 <emphasis>authenticators</emphasis>: Configuration settings for the authenticator drivers. These
7512 are concerned with the SMTP AUTH command (see chapter <xref linkend="CHAPSMTPAUTH"/>).
7513 </para>
7514 </listitem>
7515 <listitem>
7516 <para>
7517 <emphasis>routers</emphasis>: Configuration settings for the router drivers. Routers process
7518 addresses and determine how the message is to be delivered (see chapters
7519 <xref linkend="CHAProutergeneric"/>&ndash;<xref linkend="CHAPredirect"/>).
7520 </para>
7521 </listitem>
7522 <listitem>
7523 <para>
7524 <emphasis>transports</emphasis>: Configuration settings for the transport drivers. Transports
7525 define mechanisms for copying messages to destinations (see chapters
7526 <xref linkend="CHAPtransportgeneric"/>&ndash;<xref linkend="CHAPsmtptrans"/>).
7527 </para>
7528 </listitem>
7529 <listitem>
7530 <para>
7531 <emphasis>retry</emphasis>: Retry rules, for use when a message cannot be delivered immediately.
7532 If there is no retry section, or if it is empty (that is, no retry rules are
7533 defined), Exim will not retry deliveries. In this situation, temporary errors
7534 are treated the same as permanent errors. Retry rules are discussed in chapter
7535 <xref linkend="CHAPretry"/>.
7536 </para>
7537 </listitem>
7538 <listitem>
7539 <para>
7540 <emphasis>rewrite</emphasis>: Global address rewriting rules, for use when a message arrives and
7541 when new addresses are generated during delivery. Rewriting is discussed in
7542 chapter <xref linkend="CHAPrewrite"/>.
7543 </para>
7544 </listitem>
7545 <listitem>
7546 <para>
7547 <emphasis>local_scan</emphasis>: Private options for the <function>local_scan()</function> function. If you
7548 want to use this feature, you must set
7549 </para>
7550 <literallayout class="monospaced">
7551 LOCAL_SCAN_HAS_OPTIONS=yes
7552 </literallayout>
7553 <para>
7554 in <filename>Local/Makefile</filename> before building Exim. Details of the <function>local_scan()</function>
7555 facility are given in chapter <xref linkend="CHAPlocalscan"/>.
7556 </para>
7557 </listitem>
7558 </itemizedlist>
7559 <para>
7560 <indexterm role="concept">
7561 <primary>configuration file</primary>
7562 <secondary>leading white space in</secondary>
7563 </indexterm>
7564 <indexterm role="concept">
7565 <primary>configuration file</primary>
7566 <secondary>trailing white space in</secondary>
7567 </indexterm>
7568 <indexterm role="concept">
7569 <primary>white space</primary>
7570 <secondary>in configuration file</secondary>
7571 </indexterm>
7572 Leading and trailing white space in configuration lines is always ignored.
7573 </para>
7574 <para>
7575 Blank lines in the file, and lines starting with a # character (ignoring
7576 leading white space) are treated as comments and are ignored. <emphasis role="bold">Note</emphasis>: A
7577 # character other than at the beginning of a line is not treated specially,
7578 and does not introduce a comment.
7579 </para>
7580 <para>
7581 Any non-comment line can be continued by ending it with a backslash. Note that
7582 the general rule for white space means that trailing white space after the
7583 backslash and leading white space at the start of continuation
7584 lines is ignored. Comment lines beginning with # (but not empty lines) may
7585 appear in the middle of a sequence of continuation lines.
7586 </para>
7587 <para>
7588 A convenient way to create a configuration file is to start from the
7589 default, which is supplied in <filename>src/configure.default</filename>, and add, delete, or
7590 change settings as required.
7591 </para>
7592 <para>
7593 The ACLs, retry rules, and rewriting rules have their own syntax which is
7594 described in chapters <xref linkend="CHAPACL"/>, <xref linkend="CHAPretry"/>, and <xref linkend="CHAPrewrite"/>,
7595 respectively. The other parts of the configuration file have some syntactic
7596 items in common, and these are described below, from section <xref linkend="SECTcos"/>
7597 onwards. Before that, the inclusion, macro, and conditional facilities are
7598 described.
7599 </para>
7600 </section>
7601 <section id="SECID41">
7602 <title>File inclusions in the configuration file</title>
7603 <para>
7604 <indexterm role="concept">
7605 <primary>inclusions in configuration file</primary>
7606 </indexterm>
7607 <indexterm role="concept">
7608 <primary>configuration file</primary>
7609 <secondary>including other files</secondary>
7610 </indexterm>
7611 <indexterm role="concept">
7612 <primary><literal>.include</literal> in configuration file</primary>
7613 </indexterm>
7614 <indexterm role="concept">
7615 <primary><literal>.include_if_exists</literal> in configuration file</primary>
7616 </indexterm>
7617 You can include other files inside Exim&#x2019;s run time configuration file by
7618 using this syntax:
7619 </para>
7620 <literallayout>
7621 <literal>.include</literal> &lt;<emphasis>file name</emphasis>&gt;
7622 <literal>.include_if_exists</literal> &lt;<emphasis>file name</emphasis>&gt;
7623 </literallayout>
7624 <para>
7625 on a line by itself. Double quotes round the file name are optional. If you use
7626 the first form, a configuration error occurs if the file does not exist; the
7627 second form does nothing for non-existent files.
7628 The first form allows a relative name. It is resolved relative to
7629 the directory of the including file. For the second form an absolute file
7630 name is required.
7631 </para>
7632 <para>
7633 Includes may be nested to any depth, but remember that Exim reads its
7634 configuration file often, so it is a good idea to keep them to a minimum.
7635 If you change the contents of an included file, you must HUP the daemon,
7636 because an included file is read only when the configuration itself is read.
7637 </para>
7638 <para>
7639 The processing of inclusions happens early, at a physical line level, so, like
7640 comment lines, an inclusion can be used in the middle of an option setting,
7641 for example:
7642 </para>
7643 <literallayout class="monospaced">
7644 hosts_lookup = a.b.c \
7645                .include /some/file
7646 </literallayout>
7647 <para>
7648 Include processing happens after macro processing (see below). Its effect is to
7649 process the lines of the included file as if they occurred inline where the
7650 inclusion appears.
7651 </para>
7652 </section>
7653 <section id="SECTmacrodefs">
7654 <title>Macros in the configuration file</title>
7655 <para>
7656 <indexterm role="concept">
7657 <primary>macro</primary>
7658 <secondary>description of</secondary>
7659 </indexterm>
7660 <indexterm role="concept">
7661 <primary>configuration file</primary>
7662 <secondary>macros</secondary>
7663 </indexterm>
7664 If a line in the main part of the configuration (that is, before the first
7665 <quote>begin</quote> line) begins with an upper case letter, it is taken as a macro
7666 definition, and must be of the form
7667 </para>
7668 <literallayout>
7669 &lt;<emphasis>name</emphasis>&gt; = &lt;<emphasis>rest of line</emphasis>&gt;
7670 </literallayout>
7671 <para>
7672 The name must consist of letters, digits, and underscores, and need not all be
7673 in upper case, though that is recommended. The rest of the line, including any
7674 continuations, is the replacement text, and has leading and trailing white
7675 space removed. Quotes are not removed. The replacement text can never end with
7676 a backslash character, but this doesn&#x2019;t seem to be a serious limitation.
7677 </para>
7678 <para>
7679 Macros may also be defined between router, transport, authenticator, or ACL
7680 definitions. They may not, however, be defined within an individual driver or
7681 ACL, or in the <option>local_scan</option>, retry, or rewrite sections of the configuration.
7682 </para>
7683 </section>
7684 <section id="SECID42">
7685 <title>Macro substitution</title>
7686 <para>
7687 Once a macro is defined, all subsequent lines in the file (and any included
7688 files) are scanned for the macro name; if there are several macros, the line is
7689 scanned for each in turn, in the order in which the macros are defined. The
7690 replacement text is not re-scanned for the current macro, though it is scanned
7691 for subsequently defined macros. For this reason, a macro name may not contain
7692 the name of a previously defined macro as a substring. You could, for example,
7693 define
7694 </para>
7695 <literallayout>
7696 <literal>ABCD_XYZ = </literal>&lt;<emphasis>something</emphasis>&gt;
7697 <literal>ABCD = </literal>&lt;<emphasis>something else</emphasis>&gt;
7698 </literallayout>
7699 <para>
7700 but putting the definitions in the opposite order would provoke a configuration
7701 error. Macro expansion is applied to individual physical lines from the file,
7702 before checking for line continuation or file inclusion (see above). If a line
7703 consists solely of a macro name, and the expansion of the macro is empty, the
7704 line is ignored. A macro at the start of a line may turn the line into a
7705 comment line or a <literal>.include</literal> line.
7706 </para>
7707 </section>
7708 <section id="SECID43">
7709 <title>Redefining macros</title>
7710 <para>
7711 Once defined, the value of a macro can be redefined later in the configuration
7712 (or in an included file). Redefinition is specified by using <emphasis>==</emphasis> instead of
7713 <emphasis>=</emphasis>. For example:
7714 </para>
7715 <literallayout class="monospaced">
7716 MAC =  initial value
7717 ...
7718 MAC == updated value
7719 </literallayout>
7720 <para>
7721 Redefinition does not alter the order in which the macros are applied to the
7722 subsequent lines of the configuration file. It is still the same order in which
7723 the macros were originally defined. All that changes is the macro&#x2019;s value.
7724 Redefinition makes it possible to accumulate values. For example:
7725 </para>
7726 <literallayout class="monospaced">
7727 MAC =  initial value
7728 ...
7729 MAC == MAC and something added
7730 </literallayout>
7731 <para>
7732 This can be helpful in situations where the configuration file is built
7733 from a number of other files.
7734 </para>
7735 </section>
7736 <section id="SECID44">
7737 <title>Overriding macro values</title>
7738 <para>
7739 The values set for macros in the configuration file can be overridden by the
7740 <option>-D</option> command line option, but Exim gives up its root privilege when <option>-D</option> is
7741 used, unless called by root or the Exim user. A definition on the command line
7742 using the <option>-D</option> option causes all definitions and redefinitions within the
7743 file to be ignored.
7744 </para>
7745 </section>
7746 <section id="SECID45">
7747 <title>Example of macro usage</title>
7748 <para>
7749 As an example of macro usage, consider a configuration where aliases are looked
7750 up in a MySQL database. It helps to keep the file less cluttered if long
7751 strings such as SQL statements are defined separately as macros, for example:
7752 </para>
7753 <literallayout class="monospaced">
7754 ALIAS_QUERY = select mailbox from user where \
7755               login='${quote_mysql:$local_part}';
7756 </literallayout>
7757 <para>
7758 This can then be used in a <command>redirect</command> router setting like this:
7759 </para>
7760 <literallayout class="monospaced">
7761 data = ${lookup mysql{ALIAS_QUERY}}
7762 </literallayout>
7763 <para>
7764 In earlier versions of Exim macros were sometimes used for domain, host, or
7765 address lists. In Exim 4 these are handled better by named lists &ndash; see
7766 section <xref linkend="SECTnamedlists"/>.
7767 </para>
7768 </section>
7769 <section id="SECTbuiltinmacros">
7770 <title>Builtin macros</title>
7771 <para>
7772 Exim defines some macros depending on facilities available, which may
7773 differ due to build-time definitions and from one release to another.
7774 All of these macros start with an underscore.
7775 They can be used to conditionally include parts of a configuration
7776 (see below).
7777 </para>
7778 <para>
7779 The following classes of macros are defined:
7780 </para>
7781 <literallayout>
7782 <literal> _HAVE_*                    </literal>  build-time defines
7783 <literal> _DRIVER_ROUTER_*           </literal>  router drivers
7784 <literal> _DRIVER_TRANSPORT_*        </literal>  transport drivers
7785 <literal> _DRIVER_AUTHENTICATOR_*    </literal>  authenticator drivers
7786 <literal> _OPT_MAIN_*                </literal>  main config options
7787 <literal> _OPT_ROUTERS_*             </literal>  generic router options
7788 <literal> _OPT_TRANSPORTS_*          </literal>  generic transport options
7789 <literal> _OPT_AUTHENTICATORS_*      </literal>  generic authenticator options
7790 <literal> _OPT_ROUTER_*_*            </literal>  private router options
7791 <literal> _OPT_TRANSPORT_*_*         </literal>  private transport options
7792 <literal> _OPT_AUTHENTICATOR_*_*     </literal>  private authenticator options
7793 </literallayout>
7794 <para>
7795 Use an <quote>exim -bP macros</quote> command to get the list of macros.
7796 </para>
7797 </section>
7798 <section id="SECID46">
7799 <title>Conditional skips in the configuration file</title>
7800 <para>
7801 <indexterm role="concept">
7802 <primary>configuration file</primary>
7803 <secondary>conditional skips</secondary>
7804 </indexterm>
7805 <indexterm role="concept">
7806 <primary><literal>.ifdef</literal></primary>
7807 </indexterm>
7808 You can use the directives <literal>.ifdef</literal>, <literal>.ifndef</literal>, <literal>.elifdef</literal>,
7809 <literal>.elifndef</literal>, <literal>.else</literal>, and <literal>.endif</literal> to dynamically include or exclude
7810 portions of the configuration file. The processing happens whenever the file is
7811 read (that is, when an Exim binary starts to run).
7812 </para>
7813 <para>
7814 The implementation is very simple. Instances of the first four directives must
7815 be followed by text that includes the names of one or macros. The condition
7816 that is tested is whether or not any macro substitution has taken place in the
7817 line. Thus:
7818 </para>
7819 <literallayout class="monospaced">
7820 .ifdef AAA
7821 message_size_limit = 50M
7822 .else
7823 message_size_limit = 100M
7824 .endif
7825 </literallayout>
7826 <para>
7827 sets a message size limit of 50M if the macro <literal>AAA</literal> is defined
7828 (or <literal>A</literal> or <literal>AA</literal>), and 100M
7829 otherwise. If there is more than one macro named on the line, the condition
7830 is true if any of them are defined. That is, it is an <quote>or</quote> condition. To
7831 obtain an <quote>and</quote> condition, you need to use nested <literal>.ifdef</literal>s.
7832 </para>
7833 <para>
7834 Although you can use a macro expansion to generate one of these directives,
7835 it is not very useful, because the condition <quote>there was a macro substitution
7836 in this line</quote> will always be true.
7837 </para>
7838 <para>
7839 Text following <literal>.else</literal> and <literal>.endif</literal> is ignored, and can be used as comment
7840 to clarify complicated nestings.
7841 </para>
7842 </section>
7843 <section id="SECTcos">
7844 <title>Common option syntax</title>
7845 <para>
7846 <indexterm role="concept">
7847 <primary>common option syntax</primary>
7848 </indexterm>
7849 <indexterm role="concept">
7850 <primary>syntax of common options</primary>
7851 </indexterm>
7852 <indexterm role="concept">
7853 <primary>configuration file</primary>
7854 <secondary>common option syntax</secondary>
7855 </indexterm>
7856 For the main set of options, driver options, and <function>local_scan()</function> options,
7857 each setting is on a line by itself, and starts with a name consisting of
7858 lower-case letters and underscores. Many options require a data value, and in
7859 these cases the name must be followed by an equals sign (with optional white
7860 space) and then the value. For example:
7861 </para>
7862 <literallayout class="monospaced">
7863 qualify_domain = mydomain.example.com
7864 </literallayout>
7865 <para>
7866 <indexterm role="concept">
7867 <primary>hiding configuration option values</primary>
7868 </indexterm>
7869 <indexterm role="concept">
7870 <primary>configuration options</primary>
7871 <secondary>hiding value of</secondary>
7872 </indexterm>
7873 <indexterm role="concept">
7874 <primary>options</primary>
7875 <secondary>hiding value of</secondary>
7876 </indexterm>
7877 Some option settings may contain sensitive data, for example, passwords for
7878 accessing databases. To stop non-admin users from using the <option>-bP</option> command
7879 line option to read these values, you can precede the option settings with the
7880 word <quote>hide</quote>. For example:
7881 </para>
7882 <literallayout class="monospaced">
7883 hide mysql_servers = localhost/users/admin/secret-password
7884 </literallayout>
7885 <para>
7886 For non-admin users, such options are displayed like this:
7887 </para>
7888 <literallayout class="monospaced">
7889 mysql_servers = &lt;value not displayable&gt;
7890 </literallayout>
7891 <para>
7892 If <quote>hide</quote> is used on a driver option, it hides the value of that option on
7893 all instances of the same driver.
7894 </para>
7895 <para>
7896 The following sections describe the syntax used for the different data types
7897 that are found in option settings.
7898 </para>
7899 </section>
7900 <section id="SECID47">
7901 <title>Boolean options</title>
7902 <para>
7903 <indexterm role="concept">
7904 <primary>format</primary>
7905 <secondary>boolean</secondary>
7906 </indexterm>
7907 <indexterm role="concept">
7908 <primary>boolean configuration values</primary>
7909 </indexterm>
7910 <indexterm role="option">
7911 <primary><option>no_</option><emphasis>xxx</emphasis></primary>
7912 </indexterm>
7913 <indexterm role="option">
7914 <primary><option>not_</option><emphasis>xxx</emphasis></primary>
7915 </indexterm>
7916 Options whose type is given as boolean are on/off switches. There are two
7917 different ways of specifying such options: with and without a data value. If
7918 the option name is specified on its own without data, the switch is turned on;
7919 if it is preceded by <quote>no_</quote> or <quote>not_</quote> the switch is turned off. However,
7920 boolean options may be followed by an equals sign and one of the words
7921 <quote>true</quote>, <quote>false</quote>, <quote>yes</quote>, or <quote>no</quote>, as an alternative syntax. For example,
7922 the following two settings have exactly the same effect:
7923 </para>
7924 <literallayout class="monospaced">
7925 queue_only
7926 queue_only = true
7927 </literallayout>
7928 <para>
7929 The following two lines also have the same (opposite) effect:
7930 </para>
7931 <literallayout class="monospaced">
7932 no_queue_only
7933 queue_only = false
7934 </literallayout>
7935 <para>
7936 You can use whichever syntax you prefer.
7937 </para>
7938 </section>
7939 <section id="SECID48">
7940 <title>Integer values</title>
7941 <para>
7942 <indexterm role="concept">
7943 <primary>integer configuration values</primary>
7944 </indexterm>
7945 <indexterm role="concept">
7946 <primary>format</primary>
7947 <secondary>integer</secondary>
7948 </indexterm>
7949 If an option&#x2019;s type is given as <quote>integer</quote>, the value can be given in decimal,
7950 hexadecimal, or octal. If it starts with a digit greater than zero, a decimal
7951 number is assumed. Otherwise, it is treated as an octal number unless it starts
7952 with the characters <quote>0x</quote>, in which case the remainder is interpreted as a
7953 hexadecimal number.
7954 </para>
7955 <para>
7956 If an integer value is followed by the letter K, it is multiplied by 1024; if
7957 it is followed by the letter M, it is multiplied by 1024x1024;
7958 if by the letter G, 1024x1024x1024.
7959 When the values
7960 of integer option settings are output, values which are an exact multiple of
7961 1024 or 1024x1024 are sometimes, but not always, printed using the letters K
7962 and M. The printing style is independent of the actual input format that was
7963 used.
7964 </para>
7965 </section>
7966 <section id="SECID49">
7967 <title>Octal integer values</title>
7968 <para>
7969 <indexterm role="concept">
7970 <primary>integer format</primary>
7971 </indexterm>
7972 <indexterm role="concept">
7973 <primary>format</primary>
7974 <secondary>octal integer</secondary>
7975 </indexterm>
7976 If an option&#x2019;s type is given as <quote>octal integer</quote>, its value is always
7977 interpreted as an octal number, whether or not it starts with the digit zero.
7978 Such options are always output in octal.
7979 </para>
7980 </section>
7981 <section id="SECID50">
7982 <title>Fixed point numbers</title>
7983 <para>
7984 <indexterm role="concept">
7985 <primary>fixed point configuration values</primary>
7986 </indexterm>
7987 <indexterm role="concept">
7988 <primary>format</primary>
7989 <secondary>fixed point</secondary>
7990 </indexterm>
7991 If an option&#x2019;s type is given as <quote>fixed-point</quote>, its value must be a decimal
7992 integer, optionally followed by a decimal point and up to three further digits.
7993 </para>
7994 </section>
7995 <section id="SECTtimeformat">
7996 <title>Time intervals</title>
7997 <para>
7998 <indexterm role="concept">
7999 <primary>time interval</primary>
8000 <secondary>specifying in configuration</secondary>
8001 </indexterm>
8002 <indexterm role="concept">
8003 <primary>format</primary>
8004 <secondary>time interval</secondary>
8005 </indexterm>
8006 A time interval is specified as a sequence of numbers, each followed by one of
8007 the following letters, with no intervening white space:
8008 </para>
8009 <informaltable frame="none">
8010 <tgroup cols="2" colsep="0" rowsep="0">
8011 <colspec colwidth="30pt" align="left"/>
8012 <colspec colwidth="254pt" align="left"/>
8013 <tbody>
8014 <row>
8015 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>s</option></entry>
8016 <entry>seconds</entry>
8017 </row>
8018 <row>
8019 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>m</option></entry>
8020 <entry>minutes</entry>
8021 </row>
8022 <row>
8023 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>h</option></entry>
8024 <entry>hours</entry>
8025 </row>
8026 <row>
8027 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>d</option></entry>
8028 <entry>days</entry>
8029 </row>
8030 <row>
8031 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>w</option></entry>
8032 <entry>weeks</entry>
8033 </row>
8034 </tbody>
8035 </tgroup>
8036 </informaltable>
8037 <para>
8038 For example, <quote>3h50m</quote> specifies 3 hours and 50 minutes. The values of time
8039 intervals are output in the same format. Exim does not restrict the values; it
8040 is perfectly acceptable, for example, to specify <quote>90m</quote> instead of <quote>1h30m</quote>.
8041 </para>
8042 </section>
8043 <section id="SECTstrings">
8044 <title>String values</title>
8045 <para>
8046 <indexterm role="concept">
8047 <primary>string</primary>
8048 <secondary>format of configuration values</secondary>
8049 </indexterm>
8050 <indexterm role="concept">
8051 <primary>format</primary>
8052 <secondary>string</secondary>
8053 </indexterm>
8054 If an option&#x2019;s type is specified as <quote>string</quote>, the value can be specified with
8055 or without double-quotes. If it does not start with a double-quote, the value
8056 consists of the remainder of the line plus any continuation lines, starting at
8057 the first character after any leading white space, with trailing white space
8058 removed, and with no interpretation of the characters in the string. Because
8059 Exim removes comment lines (those beginning with #) at an early stage, they can
8060 appear in the middle of a multi-line string. The following two settings are
8061 therefore equivalent:
8062 </para>
8063 <literallayout class="monospaced">
8064 trusted_users = uucp:mail
8065 trusted_users = uucp:\
8066                 # This comment line is ignored
8067                 mail
8068 </literallayout>
8069 <para>
8070 <indexterm role="concept">
8071 <primary>string</primary>
8072 <secondary>quoted</secondary>
8073 </indexterm>
8074 <indexterm role="concept">
8075 <primary>escape characters in quoted strings</primary>
8076 </indexterm>
8077 If a string does start with a double-quote, it must end with a closing
8078 double-quote, and any backslash characters other than those used for line
8079 continuation are interpreted as escape characters, as follows:
8080 </para>
8081 <informaltable frame="none">
8082 <tgroup cols="2" colsep="0" rowsep="0">
8083 <colspec colwidth="100pt" align="left"/>
8084 <colspec colwidth="254pt" align="left"/>
8085 <tbody>
8086 <row>
8087 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\\</literal></entry>
8088 <entry>single backslash</entry>
8089 </row>
8090 <row>
8091 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\n</literal></entry>
8092 <entry>newline</entry>
8093 </row>
8094 <row>
8095 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\r</literal></entry>
8096 <entry>carriage return</entry>
8097 </row>
8098 <row>
8099 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\t</literal></entry>
8100 <entry>tab</entry>
8101 </row>
8102 <row>
8103 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\</literal>&lt;<emphasis>octal digits</emphasis>&gt;</entry>
8104 <entry>up to 3 octal digits specify one character</entry>
8105 </row>
8106 <row>
8107 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\x</literal>&lt;<emphasis>hex digits</emphasis>&gt;</entry>
8108 <entry>up to 2 hexadecimal digits specify one character</entry>
8109 </row>
8110 </tbody>
8111 </tgroup>
8112 </informaltable>
8113 <para>
8114 If a backslash is followed by some other character, including a double-quote
8115 character, that character replaces the pair.
8116 </para>
8117 <para>
8118 Quoting is necessary only if you want to make use of the backslash escapes to
8119 insert special characters, or if you need to specify a value with leading or
8120 trailing spaces. These cases are rare, so quoting is almost never needed in
8121 current versions of Exim. In versions of Exim before 3.14, quoting was required
8122 in order to continue lines, so you may come across older configuration files
8123 and examples that apparently quote unnecessarily.
8124 </para>
8125 </section>
8126 <section id="SECID51">
8127 <title>Expanded strings</title>
8128 <para>
8129 <indexterm role="concept">
8130 <primary>expansion</primary>
8131 <secondary>definition of</secondary>
8132 </indexterm>
8133 Some strings in the configuration file are subjected to <emphasis>string expansion</emphasis>,
8134 by which means various parts of the string may be changed according to the
8135 circumstances (see chapter <xref linkend="CHAPexpand"/>). The input syntax for such strings
8136 is as just described; in particular, the handling of backslashes in quoted
8137 strings is done as part of the input process, before expansion takes place.
8138 However, backslash is also an escape character for the expander, so any
8139 backslashes that are required for that reason must be doubled if they are
8140 within a quoted configuration string.
8141 </para>
8142 </section>
8143 <section id="SECID52">
8144 <title>User and group names</title>
8145 <para>
8146 <indexterm role="concept">
8147 <primary>user name</primary>
8148 <secondary>format of</secondary>
8149 </indexterm>
8150 <indexterm role="concept">
8151 <primary>format</primary>
8152 <secondary>user name</secondary>
8153 </indexterm>
8154 <indexterm role="concept">
8155 <primary>groups</primary>
8156 <secondary>name format</secondary>
8157 </indexterm>
8158 <indexterm role="concept">
8159 <primary>format</primary>
8160 <secondary>group name</secondary>
8161 </indexterm>
8162 User and group names are specified as strings, using the syntax described
8163 above, but the strings are interpreted specially. A user or group name must
8164 either consist entirely of digits, or be a name that can be looked up using the
8165 <function>getpwnam()</function> or <function>getgrnam()</function> function, as appropriate.
8166 </para>
8167 </section>
8168 <section id="SECTlistconstruct">
8169 <title>List construction</title>
8170 <para>
8171 <indexterm role="concept">
8172 <primary>list</primary>
8173 <secondary>syntax of in configuration</secondary>
8174 </indexterm>
8175 <indexterm role="concept">
8176 <primary>format</primary>
8177 <secondary>list item in configuration</secondary>
8178 </indexterm>
8179 <indexterm role="concept">
8180 <primary>string</primary>
8181 <secondary>list, definition of</secondary>
8182 </indexterm>
8183 The data for some configuration options is a list of items, with colon as the
8184 default separator. Many of these options are shown with type <quote>string list</quote> in
8185 the descriptions later in this document. Others are listed as <quote>domain list</quote>,
8186 <quote>host list</quote>, <quote>address list</quote>, or <quote>local part list</quote>. Syntactically, they
8187 are all the same; however, those other than <quote>string list</quote> are subject to
8188 particular kinds of interpretation, as described in chapter
8189 <xref linkend="CHAPdomhosaddlists"/>.
8190 </para>
8191 <para>
8192 In all these cases, the entire list is treated as a single string as far as the
8193 input syntax is concerned. The <option>trusted_users</option> setting in section
8194 <xref linkend="SECTstrings"/> above is an example. If a colon is actually needed in an item
8195 in a list, it must be entered as two colons. Leading and trailing white space
8196 on each item in a list is ignored. This makes it possible to include items that
8197 start with a colon, and in particular, certain forms of IPv6 address. For
8198 example, the list
8199 </para>
8200 <literallayout class="monospaced">
8201 local_interfaces = 127.0.0.1 : ::::1
8202 </literallayout>
8203 <para>
8204 contains two IP addresses, the IPv4 address 127.0.0.1 and the IPv6 address ::1.
8205 </para>
8206 <para>
8207 <emphasis role="bold">Note</emphasis>: Although leading and trailing white space is ignored in individual
8208 list items, it is not ignored when parsing the list. The space after the first
8209 colon in the example above is necessary. If it were not there, the list would
8210 be interpreted as the two items 127.0.0.1:: and 1.
8211 </para>
8212 </section>
8213 <section id="SECTlistsepchange">
8214 <title>Changing list separators</title>
8215 <para>
8216 <indexterm role="concept">
8217 <primary>list separator</primary>
8218 <secondary>changing</secondary>
8219 </indexterm>
8220 <indexterm role="concept">
8221 <primary>IPv6</primary>
8222 <secondary>addresses in lists</secondary>
8223 </indexterm>
8224 Doubling colons in IPv6 addresses is an unwelcome chore, so a mechanism was
8225 introduced to allow the separator character to be changed. If a list begins
8226 with a left angle bracket, followed by any punctuation character, that
8227 character is used instead of colon as the list separator. For example, the list
8228 above can be rewritten to use a semicolon separator like this:
8229 </para>
8230 <literallayout class="monospaced">
8231 local_interfaces = &lt;; 127.0.0.1 ; ::1
8232 </literallayout>
8233 <para>
8234 This facility applies to all lists, with the exception of the list in
8235 <option>log_file_path</option>. It is recommended that the use of non-colon separators be
8236 confined to circumstances where they really are needed.
8237 </para>
8238 <para>
8239 <indexterm role="concept">
8240 <primary>list separator</primary>
8241 <secondary>newline as</secondary>
8242 </indexterm>
8243 <indexterm role="concept">
8244 <primary>newline</primary>
8245 <secondary>as list separator</secondary>
8246 </indexterm>
8247 It is also possible to use newline and other control characters (those with
8248 code values less than 32, plus DEL) as separators in lists. Such separators
8249 must be provided literally at the time the list is processed. For options that
8250 are string-expanded, you can write the separator using a normal escape
8251 sequence. This will be processed by the expander before the string is
8252 interpreted as a list. For example, if a newline-separated list of domains is
8253 generated by a lookup, you can process it directly by a line such as this:
8254 </para>
8255 <literallayout class="monospaced">
8256 domains = &lt;\n ${lookup mysql{.....}}
8257 </literallayout>
8258 <para>
8259 This avoids having to change the list separator in such data. You are unlikely
8260 to want to use a control character as a separator in an option that is not
8261 expanded, because the value is literal text. However, it can be done by giving
8262 the value in quotes. For example:
8263 </para>
8264 <literallayout class="monospaced">
8265 local_interfaces = "&lt;\n 127.0.0.1 \n ::1"
8266 </literallayout>
8267 <para>
8268 Unlike printing character separators, which can be included in list items by
8269 doubling, it is not possible to include a control character as data when it is
8270 set as the separator. Two such characters in succession are interpreted as
8271 enclosing an empty list item.
8272 </para>
8273 </section>
8274 <section id="SECTempitelis">
8275 <title>Empty items in lists</title>
8276 <para>
8277 <indexterm role="concept">
8278 <primary>list</primary>
8279 <secondary>empty item in</secondary>
8280 </indexterm>
8281 An empty item at the end of a list is always ignored. In other words, trailing
8282 separator characters are ignored. Thus, the list in
8283 </para>
8284 <literallayout class="monospaced">
8285 senders = user@domain :
8286 </literallayout>
8287 <para>
8288 contains only a single item. If you want to include an empty string as one item
8289 in a list, it must not be the last item. For example, this list contains three
8290 items, the second of which is empty:
8291 </para>
8292 <literallayout class="monospaced">
8293 senders = user1@domain : : user2@domain
8294 </literallayout>
8295 <para>
8296 <emphasis role="bold">Note</emphasis>: There must be white space between the two colons, as otherwise they
8297 are interpreted as representing a single colon data character (and the list
8298 would then contain just one item). If you want to specify a list that contains
8299 just one, empty item, you can do it as in this example:
8300 </para>
8301 <literallayout class="monospaced">
8302 senders = :
8303 </literallayout>
8304 <para>
8305 In this case, the first item is empty, and the second is discarded because it
8306 is at the end of the list.
8307 </para>
8308 </section>
8309 <section id="SECTfordricon">
8310 <title>Format of driver configurations</title>
8311 <para>
8312 <indexterm role="concept">
8313 <primary>drivers</primary>
8314 <secondary>configuration format</secondary>
8315 </indexterm>
8316 There are separate parts in the configuration for defining routers, transports,
8317 and authenticators. In each part, you are defining a number of driver
8318 instances, each with its own set of options. Each driver instance is defined by
8319 a sequence of lines like this:
8320 </para>
8321 <literallayout>
8322 &lt;<emphasis>instance name</emphasis>&gt;:
8323   &lt;<emphasis>option</emphasis>&gt;
8324   ...
8325   &lt;<emphasis>option</emphasis>&gt;
8326 </literallayout>
8327 <para>
8328 In the following example, the instance name is <command>localuser</command>, and it is
8329 followed by three options settings:
8330 </para>
8331 <literallayout class="monospaced">
8332 localuser:
8333   driver = accept
8334   check_local_user
8335   transport = local_delivery
8336 </literallayout>
8337 <para>
8338 For each driver instance, you specify which Exim code module it uses &ndash; by the
8339 setting of the <option>driver</option> option &ndash; and (optionally) some configuration
8340 settings. For example, in the case of transports, if you want a transport to
8341 deliver with SMTP you would use the <command>smtp</command> driver; if you want to deliver to
8342 a local file you would use the <command>appendfile</command> driver. Each of the drivers is
8343 described in detail in its own separate chapter later in this manual.
8344 </para>
8345 <para>
8346 You can have several routers, transports, or authenticators that are based on
8347 the same underlying driver (each must have a different instance name).
8348 </para>
8349 <para>
8350 The order in which routers are defined is important, because addresses are
8351 passed to individual routers one by one, in order. The order in which
8352 transports are defined does not matter at all. The order in which
8353 authenticators are defined is used only when Exim, as a client, is searching
8354 them to find one that matches an authentication mechanism offered by the
8355 server.
8356 </para>
8357 <para>
8358 <indexterm role="concept">
8359 <primary>generic options</primary>
8360 </indexterm>
8361 <indexterm role="concept">
8362 <primary>options</primary>
8363 <secondary>generic &ndash; definition of</secondary>
8364 </indexterm>
8365 Within a driver instance definition, there are two kinds of option: <emphasis>generic</emphasis>
8366 and <emphasis>private</emphasis>. The generic options are those that apply to all drivers of the
8367 same type (that is, all routers, all transports or all authenticators). The
8368 <option>driver</option> option is a generic option that must appear in every definition.
8369 <indexterm role="concept">
8370 <primary>private options</primary>
8371 </indexterm>
8372 The private options are special for each driver, and none need appear, because
8373 they all have default values.
8374 </para>
8375 <para>
8376 The options may appear in any order, except that the <option>driver</option> option must
8377 precede any private options, since these depend on the particular driver. For
8378 this reason, it is recommended that <option>driver</option> always be the first option.
8379 </para>
8380 <para>
8381 Driver instance names, which are used for reference in log entries and
8382 elsewhere, can be any sequence of letters, digits, and underscores (starting
8383 with a letter) and must be unique among drivers of the same type. A router and
8384 a transport (for example) can each have the same name, but no two router
8385 instances can have the same name. The name of a driver instance should not be
8386 confused with the name of the underlying driver module. For example, the
8387 configuration lines:
8388 </para>
8389 <literallayout class="monospaced">
8390 remote_smtp:
8391   driver = smtp
8392 </literallayout>
8393 <para>
8394 create an instance of the <command>smtp</command> transport driver whose name is
8395 <command>remote_smtp</command>. The same driver code can be used more than once, with
8396 different instance names and different option settings each time. A second
8397 instance of the <command>smtp</command> transport, with different options, might be defined
8398 thus:
8399 </para>
8400 <literallayout class="monospaced">
8401 special_smtp:
8402   driver = smtp
8403   port = 1234
8404   command_timeout = 10s
8405 </literallayout>
8406 <para>
8407 The names <command>remote_smtp</command> and <command>special_smtp</command> would be used to reference
8408 these transport instances from routers, and these names would appear in log
8409 lines.
8410 </para>
8411 <para>
8412 Comment lines may be present in the middle of driver specifications. The full
8413 list of option settings for any particular driver instance, including all the
8414 defaulted values, can be extracted by making use of the <option>-bP</option> command line
8415 option.
8416 </para>
8417 </section>
8418 </chapter>
8419
8420 <chapter id="CHAPdefconfil">
8421 <title>The default configuration file</title>
8422 <para>
8423 <indexterm role="concept" id="IIDconfiwal" class="startofrange">
8424 <primary>configuration file</primary>
8425 <secondary>default <quote>walk through</quote></secondary>
8426 </indexterm>
8427 <indexterm role="concept">
8428 <primary>default</primary>
8429 <secondary>configuration file <quote>walk through</quote></secondary>
8430 </indexterm>
8431 The default configuration file supplied with Exim as <filename>src/configure.default</filename>
8432 is sufficient for a host with simple mail requirements. As an introduction to
8433 the way Exim is configured, this chapter <quote>walks through</quote> the default
8434 configuration, giving brief explanations of the settings. Detailed descriptions
8435 of the options are given in subsequent chapters. The default configuration file
8436 itself contains extensive comments about ways you might want to modify the
8437 initial settings. However, note that there are many options that are not
8438 mentioned at all in the default configuration.
8439 </para>
8440 <section id="SECTdefconfmain">
8441 <title>Main configuration settings</title>
8442 <para>
8443 The main (global) configuration option settings must always come first in the
8444 file. The first thing you&#x2019;ll see in the file, after some initial comments, is
8445 the line
8446 </para>
8447 <literallayout class="monospaced">
8448 # primary_hostname =
8449 </literallayout>
8450 <para>
8451 This is a commented-out setting of the <option>primary_hostname</option> option. Exim needs
8452 to know the official, fully qualified name of your host, and this is where you
8453 can specify it. However, in most cases you do not need to set this option. When
8454 it is unset, Exim uses the <function>uname()</function> system function to obtain the host name.
8455 </para>
8456 <para>
8457 The first three non-comment configuration lines are as follows:
8458 </para>
8459 <literallayout class="monospaced">
8460 domainlist local_domains    = @
8461 domainlist relay_to_domains =
8462 hostlist   relay_from_hosts = 127.0.0.1
8463 </literallayout>
8464 <para>
8465 These are not, in fact, option settings. They are definitions of two named
8466 domain lists and one named host list. Exim allows you to give names to lists of
8467 domains, hosts, and email addresses, in order to make it easier to manage the
8468 configuration file (see section <xref linkend="SECTnamedlists"/>).
8469 </para>
8470 <para>
8471 The first line defines a domain list called <emphasis>local_domains</emphasis>; this is used
8472 later in the configuration to identify domains that are to be delivered
8473 on the local host.
8474 </para>
8475 <para>
8476 <indexterm role="concept">
8477 <primary>@ in a domain list</primary>
8478 </indexterm>
8479 There is just one item in this list, the string <quote>@</quote>. This is a special form
8480 of entry which means <quote>the name of the local host</quote>. Thus, if the local host is
8481 called <emphasis>a.host.example</emphasis>, mail to <emphasis>any.user@a.host.example</emphasis> is expected to
8482 be delivered locally. Because the local host&#x2019;s name is referenced indirectly,
8483 the same configuration file can be used on different hosts.
8484 </para>
8485 <para>
8486 The second line defines a domain list called <emphasis>relay_to_domains</emphasis>, but the
8487 list itself is empty. Later in the configuration we will come to the part that
8488 controls mail relaying through the local host; it allows relaying to any
8489 domains in this list. By default, therefore, no relaying on the basis of a mail
8490 domain is permitted.
8491 </para>
8492 <para>
8493 The third line defines a host list called <emphasis>relay_from_hosts</emphasis>. This list is
8494 used later in the configuration to permit relaying from any host or IP address
8495 that matches the list. The default contains just the IP address of the IPv4
8496 loopback interface, which means that processes on the local host are able to
8497 submit mail for relaying by sending it over TCP/IP to that interface. No other
8498 hosts are permitted to submit messages for relaying.
8499 </para>
8500 <para>
8501 Just to be sure there&#x2019;s no misunderstanding: at this point in the configuration
8502 we aren&#x2019;t actually setting up any controls. We are just defining some domains
8503 and hosts that will be used in the controls that are specified later.
8504 </para>
8505 <para>
8506 The next two configuration lines are genuine option settings:
8507 </para>
8508 <literallayout class="monospaced">
8509 acl_smtp_rcpt = acl_check_rcpt
8510 acl_smtp_data = acl_check_data
8511 </literallayout>
8512 <para>
8513 These options specify <emphasis>Access Control Lists</emphasis> (ACLs) that are to be used
8514 during an incoming SMTP session for every recipient of a message (every RCPT
8515 command), and after the contents of the message have been received,
8516 respectively. The names of the lists are <emphasis>acl_check_rcpt</emphasis> and
8517 <emphasis>acl_check_data</emphasis>, and we will come to their definitions below, in the ACL
8518 section of the configuration. The RCPT ACL controls which recipients are
8519 accepted for an incoming message &ndash; if a configuration does not provide an ACL
8520 to check recipients, no SMTP mail can be accepted. The DATA ACL allows the
8521 contents of a message to be checked.
8522 </para>
8523 <para>
8524 Two commented-out option settings are next:
8525 </para>
8526 <literallayout class="monospaced">
8527 # av_scanner = clamd:/tmp/clamd
8528 # spamd_address = 127.0.0.1 783
8529 </literallayout>
8530 <para>
8531 These are example settings that can be used when Exim is compiled with the
8532 content-scanning extension. The first specifies the interface to the virus
8533 scanner, and the second specifies the interface to SpamAssassin. Further
8534 details are given in chapter <xref linkend="CHAPexiscan"/>.
8535 </para>
8536 <para>
8537 Three more commented-out option settings follow:
8538 </para>
8539 <literallayout class="monospaced">
8540 # tls_advertise_hosts = *
8541 # tls_certificate = /etc/ssl/exim.crt
8542 # tls_privatekey = /etc/ssl/exim.pem
8543 </literallayout>
8544 <para>
8545 These are example settings that can be used when Exim is compiled with
8546 support for TLS (aka SSL) as described in section <xref linkend="SECTinctlsssl"/>. The
8547 first one specifies the list of clients that are allowed to use TLS when
8548 connecting to this server; in this case the wildcard means all clients. The
8549 other options specify where Exim should find its TLS certificate and private
8550 key, which together prove the server&#x2019;s identity to any clients that connect.
8551 More details are given in chapter <xref linkend="CHAPTLS"/>.
8552 </para>
8553 <para>
8554 Another two commented-out option settings follow:
8555 </para>
8556 <literallayout class="monospaced">
8557 # daemon_smtp_ports = 25 : 465 : 587
8558 # tls_on_connect_ports = 465
8559 </literallayout>
8560 <para>
8561 <indexterm role="concept">
8562 <primary>port</primary>
8563 <secondary>465 and 587</secondary>
8564 </indexterm>
8565 <indexterm role="concept">
8566 <primary>port</primary>
8567 <secondary>for message submission</secondary>
8568 </indexterm>
8569 <indexterm role="concept">
8570 <primary>message</primary>
8571 <secondary>submission, ports for</secondary>
8572 </indexterm>
8573 <indexterm role="concept">
8574 <primary>ssmtp protocol</primary>
8575 </indexterm>
8576 <indexterm role="concept">
8577 <primary>smtps protocol</primary>
8578 </indexterm>
8579 <indexterm role="concept">
8580 <primary>SMTP</primary>
8581 <secondary>ssmtp protocol</secondary>
8582 </indexterm>
8583 <indexterm role="concept">
8584 <primary>SMTP</primary>
8585 <secondary>smtps protocol</secondary>
8586 </indexterm>
8587 These options provide better support for roaming users who wish to use this
8588 server for message submission. They are not much use unless you have turned on
8589 TLS (as described in the previous paragraph) and authentication (about which
8590 more in section <xref linkend="SECTdefconfauth"/>). The usual SMTP port 25 is often blocked
8591 on end-user networks, so RFC 4409 specifies that message submission should use
8592 port 587 instead. However some software (notably Microsoft Outlook) cannot be
8593 configured to use port 587 correctly, so these settings also enable the
8594 non-standard <quote>smtps</quote> (aka <quote>ssmtp</quote>) port 465 (see section
8595 <xref linkend="SECTsupobssmt"/>).
8596 </para>
8597 <para>
8598 Two more commented-out options settings follow:
8599 </para>
8600 <literallayout class="monospaced">
8601 # qualify_domain =
8602 # qualify_recipient =
8603 </literallayout>
8604 <para>
8605 The first of these specifies a domain that Exim uses when it constructs a
8606 complete email address from a local login name. This is often needed when Exim
8607 receives a message from a local process. If you do not set <option>qualify_domain</option>,
8608 the value of <option>primary_hostname</option> is used. If you set both of these options,
8609 you can have different qualification domains for sender and recipient
8610 addresses. If you set only the first one, its value is used in both cases.
8611 </para>
8612 <para>
8613 <indexterm role="concept">
8614 <primary>domain literal</primary>
8615 <secondary>recognizing format</secondary>
8616 </indexterm>
8617 The following line must be uncommented if you want Exim to recognize
8618 addresses of the form <emphasis>user@[10.11.12.13]</emphasis> that is, with a <quote>domain literal</quote>
8619 (an IP address within square brackets) instead of a named domain.
8620 </para>
8621 <literallayout class="monospaced">
8622 # allow_domain_literals
8623 </literallayout>
8624 <para>
8625 The RFCs still require this form, but many people think that in the modern
8626 Internet it makes little sense to permit mail to be sent to specific hosts by
8627 quoting their IP addresses. This ancient format has been used by people who
8628 try to abuse hosts by using them for unwanted relaying. However, some
8629 people believe there are circumstances (for example, messages addressed to
8630 <emphasis>postmaster</emphasis>) where domain literals are still useful.
8631 </para>
8632 <para>
8633 The next configuration line is a kind of trigger guard:
8634 </para>
8635 <literallayout class="monospaced">
8636 never_users = root
8637 </literallayout>
8638 <para>
8639 It specifies that no delivery must ever be run as the root user. The normal
8640 convention is to set up <emphasis>root</emphasis> as an alias for the system administrator. This
8641 setting is a guard against slips in the configuration.
8642 The list of users specified by <option>never_users</option> is not, however, the complete
8643 list; the build-time configuration in <filename>Local/Makefile</filename> has an option called
8644 FIXED_NEVER_USERS specifying a list that cannot be overridden. The
8645 contents of <option>never_users</option> are added to this list. By default
8646 FIXED_NEVER_USERS also specifies root.
8647 </para>
8648 <para>
8649 When a remote host connects to Exim in order to send mail, the only information
8650 Exim has about the host&#x2019;s identity is its IP address. The next configuration
8651 line,
8652 </para>
8653 <literallayout class="monospaced">
8654 host_lookup = *
8655 </literallayout>
8656 <para>
8657 specifies that Exim should do a reverse DNS lookup on all incoming connections,
8658 in order to get a host name. This improves the quality of the logging
8659 information, but if you feel it is too expensive, you can remove it entirely,
8660 or restrict the lookup to hosts on <quote>nearby</quote> networks.
8661 Note that it is not always possible to find a host name from an IP address,
8662 because not all DNS reverse zones are maintained, and sometimes DNS servers are
8663 unreachable.
8664 </para>
8665 <para>
8666 The next two lines are concerned with <emphasis>ident</emphasis> callbacks, as defined by RFC
8667 1413 (hence their names):
8668 </para>
8669 <literallayout class="monospaced">
8670 rfc1413_hosts = *
8671 rfc1413_query_timeout = 0s
8672 </literallayout>
8673 <para>
8674 These settings cause Exim to avoid ident callbacks for all incoming SMTP calls.
8675 Few hosts offer RFC1413 service these days; calls have to be
8676 terminated by a timeout and this needlessly delays the startup
8677 of an incoming SMTP connection.
8678 If you have hosts for which you trust RFC1413 and need this
8679 information, you can change this.
8680 </para>
8681 <para>
8682 This line enables an efficiency SMTP option.  It is negotiated by clients
8683 and not expected to cause problems but can be disabled if needed.
8684 </para>
8685 <literallayout class="monospaced">
8686 prdr_enable = true
8687 </literallayout>
8688 <para>
8689 When Exim receives messages over SMTP connections, it expects all addresses to
8690 be fully qualified with a domain, as required by the SMTP definition. However,
8691 if you are running a server to which simple clients submit messages, you may
8692 find that they send unqualified addresses. The two commented-out options:
8693 </para>
8694 <literallayout class="monospaced">
8695 # sender_unqualified_hosts =
8696 # recipient_unqualified_hosts =
8697 </literallayout>
8698 <para>
8699 show how you can specify hosts that are permitted to send unqualified sender
8700 and recipient addresses, respectively.
8701 </para>
8702 <para>
8703 The <option>log_selector</option> option is used to increase the detail of logging
8704 over the default:
8705 </para>
8706 <literallayout class="monospaced">
8707 log_selector = +smtp_protocol_error +smtp_syntax_error \
8708                +tls_certificate_verified
8709 </literallayout>
8710 <para>
8711 The <option>percent_hack_domains</option> option is also commented out:
8712 </para>
8713 <literallayout class="monospaced">
8714 # percent_hack_domains =
8715 </literallayout>
8716 <para>
8717 It provides a list of domains for which the <quote>percent hack</quote> is to operate.
8718 This is an almost obsolete form of explicit email routing. If you do not know
8719 anything about it, you can safely ignore this topic.
8720 </para>
8721 <para>
8722 The next two settings in the main part of the default configuration are
8723 concerned with messages that have been <quote>frozen</quote> on Exim&#x2019;s queue. When a
8724 message is frozen, Exim no longer continues to try to deliver it. Freezing
8725 occurs when a bounce message encounters a permanent failure because the sender
8726 address of the original message that caused the bounce is invalid, so the
8727 bounce cannot be delivered. This is probably the most common case, but there
8728 are also other conditions that cause freezing, and frozen messages are not
8729 always bounce messages.
8730 </para>
8731 <literallayout class="monospaced">
8732 ignore_bounce_errors_after = 2d
8733 timeout_frozen_after = 7d
8734 </literallayout>
8735 <para>
8736 The first of these options specifies that failing bounce messages are to be
8737 discarded after 2 days on the queue. The second specifies that any frozen
8738 message (whether a bounce message or not) is to be timed out (and discarded)
8739 after a week. In this configuration, the first setting ensures that no failing
8740 bounce message ever lasts a week.
8741 </para>
8742 <para>
8743 Exim queues it&#x2019;s messages in a spool directory. If you expect to have
8744 large queues, you may consider using this option. It splits the spool
8745 directory into subdirectories to avoid file system degradation from
8746 many files in a single directory, resulting in better performance.
8747 Manual manipulation of queued messages becomes more complex (though fortunately
8748 not often needed).
8749 </para>
8750 <literallayout class="monospaced">
8751 # split_spool_directory = true
8752 </literallayout>
8753 <para>
8754 In an ideal world everybody follows the standards. For non-ASCII
8755 messages RFC 2047 is a standard, allowing a maximum line length of 76
8756 characters. Exim adheres that standard and won&#x2019;t process messages which
8757 violate this standard. (Even ${rfc2047:...} expansions will fail.)
8758 In particular, the Exim maintainers have had multiple reports of
8759 problems from Russian administrators of issues until they disable this
8760 check, because of some popular, yet buggy, mail composition software.
8761 </para>
8762 <literallayout class="monospaced">
8763 # check_rfc2047_length = false
8764 </literallayout>
8765 <para>
8766 If you need to be strictly RFC compliant you may wish to disable the
8767 8BITMIME advertisement. Use this, if you exchange mails with systems
8768 that are not 8-bit clean.
8769 </para>
8770 <literallayout class="monospaced">
8771 # accept_8bitmime = false
8772 </literallayout>
8773 <para>
8774 Libraries you use may depend on specific environment settings.  This
8775 imposes a security risk (e.g. PATH). There are two lists:
8776 <option>keep_environment</option> for the variables to import as they are, and
8777 <option>add_environment</option> for variables we want to set to a fixed value.
8778 Note that TZ is handled separately, by the $%timezone%$ runtime
8779 option and by the TIMEZONE_DEFAULT buildtime option.
8780 </para>
8781 <literallayout class="monospaced">
8782 # keep_environment = ^LDAP
8783 # add_environment = PATH=/usr/bin::/bin
8784 </literallayout>
8785 </section>
8786 <section id="SECID54">
8787 <title>ACL configuration</title>
8788 <para>
8789 <indexterm role="concept">
8790 <primary>default</primary>
8791 <secondary>ACLs</secondary>
8792 </indexterm>
8793 <indexterm role="concept">
8794 <primary>access control lists (ACLs)</primary>
8795 <secondary>default configuration</secondary>
8796 </indexterm>
8797 In the default configuration, the ACL section follows the main configuration.
8798 It starts with the line
8799 </para>
8800 <literallayout class="monospaced">
8801 begin acl
8802 </literallayout>
8803 <para>
8804 and it contains the definitions of two ACLs, called <emphasis>acl_check_rcpt</emphasis> and
8805 <emphasis>acl_check_data</emphasis>, that were referenced in the settings of <option>acl_smtp_rcpt</option>
8806 and <option>acl_smtp_data</option> above.
8807 </para>
8808 <para>
8809 <indexterm role="concept">
8810 <primary>RCPT</primary>
8811 <secondary>ACL for</secondary>
8812 </indexterm>
8813 The first ACL is used for every RCPT command in an incoming SMTP message. Each
8814 RCPT command specifies one of the message&#x2019;s recipients. The ACL statements
8815 are considered in order, until the recipient address is either accepted or
8816 rejected. The RCPT command is then accepted or rejected, according to the
8817 result of the ACL processing.
8818 </para>
8819 <literallayout class="monospaced">
8820 acl_check_rcpt:
8821 </literallayout>
8822 <para>
8823 This line, consisting of a name terminated by a colon, marks the start of the
8824 ACL, and names it.
8825 </para>
8826 <literallayout class="monospaced">
8827 accept  hosts = :
8828 </literallayout>
8829 <para>
8830 This ACL statement accepts the recipient if the sending host matches the list.
8831 But what does that strange list mean? It doesn&#x2019;t actually contain any host
8832 names or IP addresses. The presence of the colon puts an empty item in the
8833 list; Exim matches this only if the incoming message did not come from a remote
8834 host, because in that case, the remote hostname is empty. The colon is
8835 important. Without it, the list itself is empty, and can never match anything.
8836 </para>
8837 <para>
8838 What this statement is doing is to accept unconditionally all recipients in
8839 messages that are submitted by SMTP from local processes using the standard
8840 input and output (that is, not using TCP/IP). A number of MUAs operate in this
8841 manner.
8842 </para>
8843 <literallayout class="monospaced">
8844 deny    message       = Restricted characters in address
8845         domains       = +local_domains
8846         local_parts   = ^[.] : ^.*[@%!/|]
8847
8848 deny    message       = Restricted characters in address
8849         domains       = !+local_domains
8850         local_parts   = ^[./|] : ^.*[@%!] : ^.*/\\.\\./
8851 </literallayout>
8852 <para>
8853 These statements are concerned with local parts that contain any of the
8854 characters <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>, <quote>|</quote>, or dots in unusual places.
8855 Although these characters are entirely legal in local parts (in the case of
8856 <quote>@</quote> and leading dots, only if correctly quoted), they do not commonly occur
8857 in Internet mail addresses.
8858 </para>
8859 <para>
8860 The first three have in the past been associated with explicitly routed
8861 addresses (percent is still sometimes used &ndash; see the <option>percent_hack_domains</option>
8862 option). Addresses containing these characters are regularly tried by spammers
8863 in an attempt to bypass relaying restrictions, and also by open relay testing
8864 programs. Unless you really need them it is safest to reject these characters
8865 at this early stage. This configuration is heavy-handed in rejecting these
8866 characters for all messages it accepts from remote hosts. This is a deliberate
8867 policy of being as safe as possible.
8868 </para>
8869 <para>
8870 The first rule above is stricter, and is applied to messages that are addressed
8871 to one of the local domains handled by this host. This is implemented by the
8872 first condition, which restricts it to domains that are listed in the
8873 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
8874 reference to a named list. In this configuration, there is just one domain in
8875 <emphasis>local_domains</emphasis>, but in general there may be many.
8876 </para>
8877 <para>
8878 The second condition on the first statement uses two regular expressions to
8879 block local parts that begin with a dot or contain <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>,
8880 or <quote>|</quote>. If you have local accounts that include these characters, you will
8881 have to modify this rule.
8882 </para>
8883 <para>
8884 Empty components (two dots in a row) are not valid in RFC 2822, but Exim
8885 allows them because they have been encountered in practice. (Consider the
8886 common convention of local parts constructed as
8887 <quote><emphasis>first-initial.second-initial.family-name</emphasis></quote> when applied to someone like
8888 the author of Exim, who has no second initial.) However, a local part starting
8889 with a dot or containing <quote>/../</quote> can cause trouble if it is used as part of a
8890 file name (for example, for a mailing list). This is also true for local parts
8891 that contain slashes. A pipe symbol can also be troublesome if the local part
8892 is incorporated unthinkingly into a shell command line.
8893 </para>
8894 <para>
8895 The second rule above applies to all other domains, and is less strict. This
8896 allows your own users to send outgoing messages to sites that use slashes
8897 and vertical bars in their local parts. It blocks local parts that begin
8898 with a dot, slash, or vertical bar, but allows these characters within the
8899 local part. However, the sequence <quote>/../</quote> is barred. The use of <quote>@</quote>, <quote>%</quote>,
8900 and <quote>!</quote> is blocked, as before. The motivation here is to prevent your users
8901 (or your users&#x2019; viruses) from mounting certain kinds of attack on remote sites.
8902 </para>
8903 <literallayout class="monospaced">
8904 accept  local_parts   = postmaster
8905         domains       = +local_domains
8906 </literallayout>
8907 <para>
8908 This statement, which has two conditions, accepts an incoming address if the
8909 local part is <emphasis>postmaster</emphasis> and the domain is one of those listed in the
8910 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
8911 reference to a named list. In this configuration, there is just one domain in
8912 <emphasis>local_domains</emphasis>, but in general there may be many.
8913 </para>
8914 <para>
8915 The presence of this statement means that mail to postmaster is never blocked
8916 by any of the subsequent tests. This can be helpful while sorting out problems
8917 in cases where the subsequent tests are incorrectly denying access.
8918 </para>
8919 <literallayout class="monospaced">
8920 require verify        = sender
8921 </literallayout>
8922 <para>
8923 This statement requires the sender address to be verified before any subsequent
8924 ACL statement can be used. If verification fails, the incoming recipient
8925 address is refused. Verification consists of trying to route the address, to
8926 see if a bounce message could be delivered to it. In the case of remote
8927 addresses, basic verification checks only the domain, but <emphasis>callouts</emphasis> can be
8928 used for more verification if required. Section <xref linkend="SECTaddressverification"/>
8929 discusses the details of address verification.
8930 </para>
8931 <literallayout class="monospaced">
8932 accept  hosts         = +relay_from_hosts
8933         control       = submission
8934 </literallayout>
8935 <para>
8936 This statement accepts the address if the message is coming from one of the
8937 hosts that are defined as being allowed to relay through this host. Recipient
8938 verification is omitted here, because in many cases the clients are dumb MUAs
8939 that do not cope well with SMTP error responses. For the same reason, the
8940 second line specifies <quote>submission mode</quote> for messages that are accepted. This
8941 is described in detail in section <xref linkend="SECTsubmodnon"/>; it causes Exim to fix
8942 messages that are deficient in some way, for example, because they lack a
8943 <emphasis>Date:</emphasis> header line. If you are actually relaying out from MTAs, you should
8944 probably add recipient verification here, and disable submission mode.
8945 </para>
8946 <literallayout class="monospaced">
8947 accept  authenticated = *
8948         control       = submission
8949 </literallayout>
8950 <para>
8951 This statement accepts the address if the client host has authenticated itself.
8952 Submission mode is again specified, on the grounds that such messages are most
8953 likely to come from MUAs. The default configuration does not define any
8954 authenticators, though it does include some nearly complete commented-out
8955 examples described in <xref linkend="SECTdefconfauth"/>. This means that no client can in
8956 fact authenticate until you complete the authenticator definitions.
8957 </para>
8958 <literallayout class="monospaced">
8959 require message = relay not permitted
8960         domains = +local_domains : +relay_to_domains
8961 </literallayout>
8962 <para>
8963 This statement rejects the address if its domain is neither a local domain nor
8964 one of the domains for which this host is a relay.
8965 </para>
8966 <literallayout class="monospaced">
8967 require verify = recipient
8968 </literallayout>
8969 <para>
8970 This statement requires the recipient address to be verified; if verification
8971 fails, the address is rejected.
8972 </para>
8973 <literallayout class="monospaced">
8974 # deny    message     = rejected because $sender_host_address \
8975 #                       is in a black list at $dnslist_domain\n\
8976 #                       $dnslist_text
8977 #         dnslists    = black.list.example
8978 #
8979 # warn    dnslists    = black.list.example
8980 #         add_header  = X-Warning: $sender_host_address is in \
8981 #                       a black list at $dnslist_domain
8982 #         log_message = found in $dnslist_domain
8983 </literallayout>
8984 <para>
8985 These commented-out lines are examples of how you could configure Exim to check
8986 sending hosts against a DNS black list. The first statement rejects messages
8987 from blacklisted hosts, whereas the second just inserts a warning header
8988 line.
8989 </para>
8990 <literallayout class="monospaced">
8991 # require verify = csa
8992 </literallayout>
8993 <para>
8994 This commented-out line is an example of how you could turn on client SMTP
8995 authorization (CSA) checking. Such checks do DNS lookups for special SRV
8996 records.
8997 </para>
8998 <literallayout class="monospaced">
8999 accept
9000 </literallayout>
9001 <para>
9002 The final statement in the first ACL unconditionally accepts any recipient
9003 address that has successfully passed all the previous tests.
9004 </para>
9005 <literallayout class="monospaced">
9006 acl_check_data:
9007 </literallayout>
9008 <para>
9009 This line marks the start of the second ACL, and names it. Most of the contents
9010 of this ACL are commented out:
9011 </para>
9012 <literallayout class="monospaced">
9013 # deny    malware   = *
9014 #         message   = This message contains a virus \
9015 #                     ($malware_name).
9016 </literallayout>
9017 <para>
9018 These lines are examples of how to arrange for messages to be scanned for
9019 viruses when Exim has been compiled with the content-scanning extension, and a
9020 suitable virus scanner is installed. If the message is found to contain a
9021 virus, it is rejected with the given custom error message.
9022 </para>
9023 <literallayout class="monospaced">
9024 # warn    spam      = nobody
9025 #         message   = X-Spam_score: $spam_score\n\
9026 #                     X-Spam_score_int: $spam_score_int\n\
9027 #                     X-Spam_bar: $spam_bar\n\
9028 #                     X-Spam_report: $spam_report
9029 </literallayout>
9030 <para>
9031 These lines are an example of how to arrange for messages to be scanned by
9032 SpamAssassin when Exim has been compiled with the content-scanning extension,
9033 and SpamAssassin has been installed. The SpamAssassin check is run with
9034 <literal>nobody</literal> as its user parameter, and the results are added to the message as a
9035 series of extra header line. In this case, the message is not rejected,
9036 whatever the spam score.
9037 </para>
9038 <literallayout class="monospaced">
9039 accept
9040 </literallayout>
9041 <para>
9042 This final line in the DATA ACL accepts the message unconditionally.
9043 </para>
9044 </section>
9045 <section id="SECID55">
9046 <title>Router configuration</title>
9047 <para>
9048 <indexterm role="concept">
9049 <primary>default</primary>
9050 <secondary>routers</secondary>
9051 </indexterm>
9052 <indexterm role="concept">
9053 <primary>routers</primary>
9054 <secondary>default</secondary>
9055 </indexterm>
9056 The router configuration comes next in the default configuration, introduced
9057 by the line
9058 </para>
9059 <literallayout class="monospaced">
9060 begin routers
9061 </literallayout>
9062 <para>
9063 Routers are the modules in Exim that make decisions about where to send
9064 messages. An address is passed to each router in turn, until it is either
9065 accepted, or failed. This means that the order in which you define the routers
9066 matters. Each router is fully described in its own chapter later in this
9067 manual. Here we give only brief overviews.
9068 </para>
9069 <literallayout class="monospaced">
9070 # domain_literal:
9071 #   driver = ipliteral
9072 #   domains = !+local_domains
9073 #   transport = remote_smtp
9074 </literallayout>
9075 <para>
9076 <indexterm role="concept">
9077 <primary>domain literal</primary>
9078 <secondary>default router</secondary>
9079 </indexterm>
9080 This router is commented out because the majority of sites do not want to
9081 support domain literal addresses (those of the form <emphasis>user@[10.9.8.7]</emphasis>). If
9082 you uncomment this router, you also need to uncomment the setting of
9083 <option>allow_domain_literals</option> in the main part of the configuration.
9084 </para>
9085 <literallayout class="monospaced">
9086 dnslookup:
9087   driver = dnslookup
9088   domains = ! +local_domains
9089   transport = remote_smtp
9090   ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
9091   no_more
9092 </literallayout>
9093 <para>
9094 The first uncommented router handles addresses that do not involve any local
9095 domains. This is specified by the line
9096 </para>
9097 <literallayout class="monospaced">
9098 domains = ! +local_domains
9099 </literallayout>
9100 <para>
9101 The <option>domains</option> option lists the domains to which this router applies, but the
9102 exclamation mark is a negation sign, so the router is used only for domains
9103 that are not in the domain list called <emphasis>local_domains</emphasis> (which was defined at
9104 the start of the configuration). The plus sign before <emphasis>local_domains</emphasis>
9105 indicates that it is referring to a named list. Addresses in other domains are
9106 passed on to the following routers.
9107 </para>
9108 <para>
9109 The name of the router driver is <command>dnslookup</command>,
9110 and is specified by the <option>driver</option> option. Do not be confused by the fact that
9111 the name of this router instance is the same as the name of the driver. The
9112 instance name is arbitrary, but the name set in the <option>driver</option> option must be
9113 one of the driver modules that is in the Exim binary.
9114 </para>
9115 <para>
9116 The <command>dnslookup</command> router routes addresses by looking up their domains in the
9117 DNS in order to obtain a list of hosts to which the address is routed. If the
9118 router succeeds, the address is queued for the <command>remote_smtp</command> transport, as
9119 specified by the <option>transport</option> option. If the router does not find the domain
9120 in the DNS, no further routers are tried because of the <option>no_more</option> setting, so
9121 the address fails and is bounced.
9122 </para>
9123 <para>
9124 The <option>ignore_target_hosts</option> option specifies a list of IP addresses that are to
9125 be entirely ignored. This option is present because a number of cases have been
9126 encountered where MX records in the DNS point to host names
9127 whose IP addresses are 0.0.0.0 or are in the 127 subnet (typically 127.0.0.1).
9128 Completely ignoring these IP addresses causes Exim to fail to route the
9129 email address, so it bounces. Otherwise, Exim would log a routing problem, and
9130 continue to try to deliver the message periodically until the address timed
9131 out.
9132 </para>
9133 <literallayout class="monospaced">
9134 system_aliases:
9135   driver = redirect
9136   allow_fail
9137   allow_defer
9138   data = ${lookup{$local_part}lsearch{/etc/aliases}}
9139 # user = exim
9140   file_transport = address_file
9141   pipe_transport = address_pipe
9142 </literallayout>
9143 <para>
9144 Control reaches this and subsequent routers only for addresses in the local
9145 domains. This router checks to see whether the local part is defined as an
9146 alias in the <filename>/etc/aliases</filename> file, and if so, redirects it according to the
9147 data that it looks up from that file. If no data is found for the local part,
9148 the value of the <option>data</option> option is empty, causing the address to be passed to
9149 the next router.
9150 </para>
9151 <para>
9152 <filename>/etc/aliases</filename> is a conventional name for the system aliases file that is
9153 often used. That is why it is referenced by from the default configuration
9154 file. However, you can change this by setting SYSTEM_ALIASES_FILE in
9155 <filename>Local/Makefile</filename> before building Exim.
9156 </para>
9157 <literallayout class="monospaced">
9158 userforward:
9159   driver = redirect
9160   check_local_user
9161 # local_part_suffix = +* : -*
9162 # local_part_suffix_optional
9163   file = $home/.forward
9164 # allow_filter
9165   no_verify
9166   no_expn
9167   check_ancestor
9168   file_transport = address_file
9169   pipe_transport = address_pipe
9170   reply_transport = address_reply
9171 </literallayout>
9172 <para>
9173 This is the most complicated router in the default configuration. It is another
9174 redirection router, but this time it is looking for forwarding data set up by
9175 individual users. The <option>check_local_user</option> setting specifies a check that the
9176 local part of the address is the login name of a local user. If it is not, the
9177 router is skipped. The two commented options that follow <option>check_local_user</option>,
9178 namely:
9179 </para>
9180 <literallayout class="monospaced">
9181 # local_part_suffix = +* : -*
9182 # local_part_suffix_optional
9183 </literallayout>
9184 <para>
9185 <indexterm role="variable">
9186 <primary><varname>$local_part_suffix</varname></primary>
9187 </indexterm>
9188 show how you can specify the recognition of local part suffixes. If the first
9189 is uncommented, a suffix beginning with either a plus or a minus sign, followed
9190 by any sequence of characters, is removed from the local part and placed in the
9191 variable <varname>$local_part_suffix</varname>. The second suffix option specifies that the
9192 presence of a suffix in the local part is optional. When a suffix is present,
9193 the check for a local login uses the local part with the suffix removed.
9194 </para>
9195 <para>
9196 When a local user account is found, the file called <filename>.forward</filename> in the user&#x2019;s
9197 home directory is consulted. If it does not exist, or is empty, the router
9198 declines. Otherwise, the contents of <filename>.forward</filename> are interpreted as
9199 redirection data (see chapter <xref linkend="CHAPredirect"/> for more details).
9200 </para>
9201 <para>
9202 <indexterm role="concept">
9203 <primary>Sieve filter</primary>
9204 <secondary>enabling in default router</secondary>
9205 </indexterm>
9206 Traditional <filename>.forward</filename> files contain just a list of addresses, pipes, or
9207 files. Exim supports this by default. However, if <option>allow_filter</option> is set (it
9208 is commented out by default), the contents of the file are interpreted as a set
9209 of Exim or Sieve filtering instructions, provided the file begins with <quote>#Exim
9210 filter</quote> or <quote>#Sieve filter</quote>, respectively. User filtering is discussed in the
9211 separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>.
9212 </para>
9213 <para>
9214 The <option>no_verify</option> and <option>no_expn</option> options mean that this router is skipped when
9215 verifying addresses, or when running as a consequence of an SMTP EXPN command.
9216 There are two reasons for doing this:
9217 </para>
9218 <orderedlist numeration="arabic">
9219 <listitem>
9220 <para>
9221 Whether or not a local user has a <filename>.forward</filename> file is not really relevant when
9222 checking an address for validity; it makes sense not to waste resources doing
9223 unnecessary work.
9224 </para>
9225 </listitem>
9226 <listitem>
9227 <para>
9228 More importantly, when Exim is verifying addresses or handling an EXPN
9229 command during an SMTP session, it is running as the Exim user, not as root.
9230 The group is the Exim group, and no additional groups are set up.
9231 It may therefore not be possible for Exim to read users&#x2019; <filename>.forward</filename> files at
9232 this time.
9233 </para>
9234 </listitem>
9235 </orderedlist>
9236 <para>
9237 The setting of <option>check_ancestor</option> prevents the router from generating a new
9238 address that is the same as any previous address that was redirected. (This
9239 works round a problem concerning a bad interaction between aliasing and
9240 forwarding &ndash; see section <xref linkend="SECTredlocmai"/>).
9241 </para>
9242 <para>
9243 The final three option settings specify the transports that are to be used when
9244 forwarding generates a direct delivery to a file, or to a pipe, or sets up an
9245 auto-reply, respectively. For example, if a <filename>.forward</filename> file contains
9246 </para>
9247 <literallayout class="monospaced">
9248 a.nother@elsewhere.example, /home/spqr/archive
9249 </literallayout>
9250 <para>
9251 the delivery to <filename>/home/spqr/archive</filename> is done by running the <option>address_file</option>
9252 transport.
9253 </para>
9254 <literallayout class="monospaced">
9255 localuser:
9256   driver = accept
9257   check_local_user
9258 # local_part_suffix = +* : -*
9259 # local_part_suffix_optional
9260   transport = local_delivery
9261 </literallayout>
9262 <para>
9263 The final router sets up delivery into local mailboxes, provided that the local
9264 part is the name of a local login, by accepting the address and assigning it to
9265 the <command>local_delivery</command> transport. Otherwise, we have reached the end of the
9266 routers, so the address is bounced. The commented suffix settings fulfil the
9267 same purpose as they do for the <command>userforward</command> router.
9268 </para>
9269 </section>
9270 <section id="SECID56">
9271 <title>Transport configuration</title>
9272 <para>
9273 <indexterm role="concept">
9274 <primary>default</primary>
9275 <secondary>transports</secondary>
9276 </indexterm>
9277 <indexterm role="concept">
9278 <primary>transports</primary>
9279 <secondary>default</secondary>
9280 </indexterm>
9281 Transports define mechanisms for actually delivering messages. They operate
9282 only when referenced from routers, so the order in which they are defined does
9283 not matter. The transports section of the configuration starts with
9284 </para>
9285 <literallayout class="monospaced">
9286 begin transports
9287 </literallayout>
9288 <para>
9289 One remote transport and four local transports are defined.
9290 </para>
9291 <literallayout class="monospaced">
9292 remote_smtp:
9293   driver = smtp
9294   hosts_try_prdr = *
9295 </literallayout>
9296 <para>
9297 This transport is used for delivering messages over SMTP connections.
9298 The list of remote hosts comes from the router.
9299 The <option>hosts_try_prdr</option> option enables an efficiency SMTP option.
9300 It is negotiated between client and server
9301 and not expected to cause problems but can be disabled if needed.
9302 All other options are defaulted.
9303 </para>
9304 <literallayout class="monospaced">
9305 local_delivery:
9306   driver = appendfile
9307   file = /var/mail/$local_part
9308   delivery_date_add
9309   envelope_to_add
9310   return_path_add
9311 # group = mail
9312 # mode = 0660
9313 </literallayout>
9314 <para>
9315 This <command>appendfile</command> transport is used for local delivery to user mailboxes in
9316 traditional BSD mailbox format. By default it runs under the uid and gid of the
9317 local user, which requires the sticky bit to be set on the <filename>/var/mail</filename>
9318 directory. Some systems use the alternative approach of running mail deliveries
9319 under a particular group instead of using the sticky bit. The commented options
9320 show how this can be done.
9321 </para>
9322 <para>
9323 Exim adds three headers to the message as it delivers it: <emphasis>Delivery-date:</emphasis>,
9324 <emphasis>Envelope-to:</emphasis> and <emphasis>Return-path:</emphasis>. This action is requested by the three
9325 similarly-named options above.
9326 </para>
9327 <literallayout class="monospaced">
9328 address_pipe:
9329   driver = pipe
9330   return_output
9331 </literallayout>
9332 <para>
9333 This transport is used for handling deliveries to pipes that are generated by
9334 redirection (aliasing or users&#x2019; <filename>.forward</filename> files). The <option>return_output</option>
9335 option specifies that any output on stdout or stderr generated by the pipe is to
9336 be returned to the sender.
9337 </para>
9338 <literallayout class="monospaced">
9339 address_file:
9340   driver = appendfile
9341   delivery_date_add
9342   envelope_to_add
9343   return_path_add
9344 </literallayout>
9345 <para>
9346 This transport is used for handling deliveries to files that are generated by
9347 redirection. The name of the file is not specified in this instance of
9348 <command>appendfile</command>, because it comes from the <command>redirect</command> router.
9349 </para>
9350 <literallayout class="monospaced">
9351 address_reply:
9352   driver = autoreply
9353 </literallayout>
9354 <para>
9355 This transport is used for handling automatic replies generated by users&#x2019;
9356 filter files.
9357 </para>
9358 </section>
9359 <section id="SECID57">
9360 <title>Default retry rule</title>
9361 <para>
9362 <indexterm role="concept">
9363 <primary>retry</primary>
9364 <secondary>default rule</secondary>
9365 </indexterm>
9366 <indexterm role="concept">
9367 <primary>default</primary>
9368 <secondary>retry rule</secondary>
9369 </indexterm>
9370 The retry section of the configuration file contains rules which affect the way
9371 Exim retries deliveries that cannot be completed at the first attempt. It is
9372 introduced by the line
9373 </para>
9374 <literallayout class="monospaced">
9375 begin retry
9376 </literallayout>
9377 <para>
9378 In the default configuration, there is just one rule, which applies to all
9379 errors:
9380 </para>
9381 <literallayout class="monospaced">
9382 *   *   F,2h,15m; G,16h,1h,1.5; F,4d,6h
9383 </literallayout>
9384 <para>
9385 This causes any temporarily failing address to be retried every 15 minutes for
9386 2 hours, then at intervals starting at one hour and increasing by a factor of
9387 1.5 until 16 hours have passed, then every 6 hours up to 4 days. If an address
9388 is not delivered after 4 days of temporary failure, it is bounced. The time is
9389 measured from first failure, not from the time the message was received.
9390 </para>
9391 <para>
9392 If the retry section is removed from the configuration, or is empty (that is,
9393 if no retry rules are defined), Exim will not retry deliveries. This turns
9394 temporary errors into permanent errors.
9395 </para>
9396 </section>
9397 <section id="SECID58">
9398 <title>Rewriting configuration</title>
9399 <para>
9400 The rewriting section of the configuration, introduced by
9401 </para>
9402 <literallayout class="monospaced">
9403 begin rewrite
9404 </literallayout>
9405 <para>
9406 contains rules for rewriting addresses in messages as they arrive. There are no
9407 rewriting rules in the default configuration file.
9408 </para>
9409 </section>
9410 <section id="SECTdefconfauth">
9411 <title>Authenticators configuration</title>
9412 <para>
9413 <indexterm role="concept">
9414 <primary>AUTH</primary>
9415 <secondary>configuration</secondary>
9416 </indexterm>
9417 The authenticators section of the configuration, introduced by
9418 </para>
9419 <literallayout class="monospaced">
9420 begin authenticators
9421 </literallayout>
9422 <para>
9423 defines mechanisms for the use of the SMTP AUTH command. The default
9424 configuration file contains two commented-out example authenticators
9425 which support plaintext username/password authentication using the
9426 standard PLAIN mechanism and the traditional but non-standard LOGIN
9427 mechanism, with Exim acting as the server. PLAIN and LOGIN are enough
9428 to support most MUA software.
9429 </para>
9430 <para>
9431 The example PLAIN authenticator looks like this:
9432 </para>
9433 <literallayout class="monospaced">
9434 #PLAIN:
9435 #  driver                  = plaintext
9436 #  server_set_id           = $auth2
9437 #  server_prompts          = :
9438 #  server_condition        = Authentication is not yet configured
9439 #  server_advertise_condition = ${if def:tls_in_cipher }
9440 </literallayout>
9441 <para>
9442 And the example LOGIN authenticator looks like this:
9443 </para>
9444 <literallayout class="monospaced">
9445 #LOGIN:
9446 #  driver                  = plaintext
9447 #  server_set_id           = $auth1
9448 #  server_prompts          = &lt;| Username: | Password:
9449 #  server_condition        = Authentication is not yet configured
9450 #  server_advertise_condition = ${if def:tls_in_cipher }
9451 </literallayout>
9452 <para>
9453 The <option>server_set_id</option> option makes Exim remember the authenticated username
9454 in <varname>$authenticated_id</varname>, which can be used later in ACLs or routers. The
9455 <option>server_prompts</option> option configures the <command>plaintext</command> authenticator so
9456 that it implements the details of the specific authentication mechanism,
9457 i.e. PLAIN or LOGIN. The <option>server_advertise_condition</option> setting controls
9458 when Exim offers authentication to clients; in the examples, this is only
9459 when TLS or SSL has been started, so to enable the authenticators you also
9460 need to add support for TLS as described in section <xref linkend="SECTdefconfmain"/>.
9461 </para>
9462 <para>
9463 The <option>server_condition</option> setting defines how to verify that the username and
9464 password are correct. In the examples it just produces an error message.
9465 To make the authenticators work, you can use a string expansion
9466 expression like one of the examples in chapter <xref linkend="CHAPplaintext"/>.
9467 </para>
9468 <para>
9469 Beware that the sequence of the parameters to PLAIN and LOGIN differ; the
9470 usercode and password are in different positions.
9471 Chapter <xref linkend="CHAPplaintext"/> covers both.
9472 </para>
9473 <para>
9474 <indexterm role="concept" startref="IIDconfiwal" class="endofrange"/>
9475 </para>
9476 </section>
9477 </chapter>
9478
9479 <chapter id="CHAPregexp">
9480 <title>Regular expressions</title>
9481 <para>
9482 <indexterm role="concept">
9483 <primary>regular expressions</primary>
9484 <secondary>library</secondary>
9485 </indexterm>
9486 <indexterm role="concept">
9487 <primary>PCRE</primary>
9488 </indexterm>
9489 Exim supports the use of regular expressions in many of its options. It
9490 uses the PCRE regular expression library; this provides regular expression
9491 matching that is compatible with Perl 5. The syntax and semantics of
9492 regular expressions is discussed in
9493 online Perl manpages, in
9494 many Perl reference books, and also in
9495 Jeffrey Friedl&#x2019;s <emphasis>Mastering Regular Expressions</emphasis>, which is published by
9496 O&#x2019;Reilly (see <emphasis role="bold"><ulink url="http://www.oreilly.com/catalog/regex2/">http://www.oreilly.com/catalog/regex2/</ulink></emphasis>).
9497 </para>
9498 <para>
9499 The documentation for the syntax and semantics of the regular expressions that
9500 are supported by PCRE is included in the PCRE distribution, and no further
9501 description is included here. The PCRE functions are called from Exim using
9502 the default option settings (that is, with no PCRE options set), except that
9503 the PCRE_CASELESS option is set when the matching is required to be
9504 case-insensitive.
9505 </para>
9506 <para>
9507 In most cases, when a regular expression is required in an Exim configuration,
9508 it has to start with a circumflex, in order to distinguish it from plain text
9509 or an <quote>ends with</quote> wildcard. In this example of a configuration setting, the
9510 second item in the colon-separated list is a regular expression.
9511 </para>
9512 <literallayout class="monospaced">
9513 domains = a.b.c : ^\\d{3} : *.y.z : ...
9514 </literallayout>
9515 <para>
9516 The doubling of the backslash is required because of string expansion that
9517 precedes interpretation &ndash; see section <xref linkend="SECTlittext"/> for more discussion
9518 of this issue, and a way of avoiding the need for doubling backslashes. The
9519 regular expression that is eventually used in this example contains just one
9520 backslash. The circumflex is included in the regular expression, and has the
9521 normal effect of <quote>anchoring</quote> it to the start of the string that is being
9522 matched.
9523 </para>
9524 <para>
9525 There are, however, two cases where a circumflex is not required for the
9526 recognition of a regular expression: these are the <option>match</option> condition in a
9527 string expansion, and the <option>matches</option> condition in an Exim filter file. In
9528 these cases, the relevant string is always treated as a regular expression; if
9529 it does not start with a circumflex, the expression is not anchored, and can
9530 match anywhere in the subject string.
9531 </para>
9532 <para>
9533 In all cases, if you want a regular expression to match at the end of a string,
9534 you must code the $ metacharacter to indicate this. For example:
9535 </para>
9536 <literallayout class="monospaced">
9537 domains = ^\\d{3}\\.example
9538 </literallayout>
9539 <para>
9540 matches the domain <emphasis>123.example</emphasis>, but it also matches <emphasis>123.example.com</emphasis>.
9541 You need to use:
9542 </para>
9543 <literallayout class="monospaced">
9544 domains = ^\\d{3}\\.example\$
9545 </literallayout>
9546 <para>
9547 if you want <emphasis>example</emphasis> to be the top-level domain. The backslash before the
9548 $ is needed because string expansion also interprets dollar characters.
9549 </para>
9550 </chapter>
9551
9552 <chapter id="CHAPfdlookup">
9553 <title>File and database lookups</title>
9554 <para>
9555 <indexterm role="concept" id="IIDfidalo1" class="startofrange">
9556 <primary>file</primary>
9557 <secondary>lookups</secondary>
9558 </indexterm>
9559 <indexterm role="concept" id="IIDfidalo2" class="startofrange">
9560 <primary>database</primary>
9561 <secondary>lookups</secondary>
9562 </indexterm>
9563 <indexterm role="concept">
9564 <primary>lookup</primary>
9565 <secondary>description of</secondary>
9566 </indexterm>
9567 Exim can be configured to look up data in files or databases as it processes
9568 messages. Two different kinds of syntax are used:
9569 </para>
9570 <orderedlist numeration="arabic">
9571 <listitem>
9572 <para>
9573 A string that is to be expanded may contain explicit lookup requests. These
9574 cause parts of the string to be replaced by data that is obtained from the
9575 lookup. Lookups of this type are conditional expansion items. Different results
9576 can be defined for the cases of lookup success and failure. See chapter
9577 <xref linkend="CHAPexpand"/>, where string expansions are described in detail.
9578 The key for the lookup is specified as part of the string expansion.
9579 </para>
9580 </listitem>
9581 <listitem>
9582 <para>
9583 Lists of domains, hosts, and email addresses can contain lookup requests as a
9584 way of avoiding excessively long linear lists. In this case, the data that is
9585 returned by the lookup is often (but not always) discarded; whether the lookup
9586 succeeds or fails is what really counts. These kinds of list are described in
9587 chapter <xref linkend="CHAPdomhosaddlists"/>.
9588 The key for the lookup is given by the context in which the list is expanded.
9589 </para>
9590 </listitem>
9591 </orderedlist>
9592 <para>
9593 String expansions, lists, and lookups interact with each other in such a way
9594 that there is no order in which to describe any one of them that does not
9595 involve references to the others. Each of these three chapters makes more sense
9596 if you have read the other two first. If you are reading this for the first
9597 time, be aware that some of it will make a lot more sense after you have read
9598 chapters <xref linkend="CHAPdomhosaddlists"/> and <xref linkend="CHAPexpand"/>.
9599 </para>
9600 <section id="SECID60">
9601 <title>Examples of different lookup syntax</title>
9602 <para>
9603 It is easy to confuse the two different kinds of lookup, especially as the
9604 lists that may contain the second kind are always expanded before being
9605 processed as lists. Therefore, they may also contain lookups of the first kind.
9606 Be careful to distinguish between the following two examples:
9607 </para>
9608 <literallayout class="monospaced">
9609 domains = ${lookup{$sender_host_address}lsearch{/some/file}}
9610 domains = lsearch;/some/file
9611 </literallayout>
9612 <para>
9613 The first uses a string expansion, the result of which must be a domain list.
9614 No strings have been specified for a successful or a failing lookup; the
9615 defaults in this case are the looked-up data and an empty string, respectively.
9616 The expansion takes place before the string is processed as a list, and the
9617 file that is searched could contain lines like this:
9618 </para>
9619 <literallayout class="monospaced">
9620 192.168.3.4: domain1:domain2:...
9621 192.168.1.9: domain3:domain4:...
9622 </literallayout>
9623 <para>
9624 When the lookup succeeds, the result of the expansion is a list of domains (and
9625 possibly other types of item that are allowed in domain lists).
9626 </para>
9627 <para>
9628 In the second example, the lookup is a single item in a domain list. It causes
9629 Exim to use a lookup to see if the domain that is being processed can be found
9630 in the file. The file could contains lines like this:
9631 </para>
9632 <literallayout class="monospaced">
9633 domain1:
9634 domain2:
9635 </literallayout>
9636 <para>
9637 Any data that follows the keys is not relevant when checking that the domain
9638 matches the list item.
9639 </para>
9640 <para>
9641 It is possible, though no doubt confusing, to use both kinds of lookup at once.
9642 Consider a file containing lines like this:
9643 </para>
9644 <literallayout class="monospaced">
9645 192.168.5.6: lsearch;/another/file
9646 </literallayout>
9647 <para>
9648 If the value of <varname>$sender_host_address</varname> is 192.168.5.6, expansion of the
9649 first <option>domains</option> setting above generates the second setting, which therefore
9650 causes a second lookup to occur.
9651 </para>
9652 <para>
9653 The rest of this chapter describes the different lookup types that are
9654 available. Any of them can be used in any part of the configuration where a
9655 lookup is permitted.
9656 </para>
9657 </section>
9658 <section id="SECID61">
9659 <title>Lookup types</title>
9660 <para>
9661 <indexterm role="concept">
9662 <primary>lookup</primary>
9663 <secondary>types of</secondary>
9664 </indexterm>
9665 <indexterm role="concept">
9666 <primary>single-key lookup</primary>
9667 <secondary>definition of</secondary>
9668 </indexterm>
9669 Two different types of data lookup are implemented:
9670 </para>
9671 <itemizedlist>
9672 <listitem>
9673 <para>
9674 The <emphasis>single-key</emphasis> type requires the specification of a file in which to look,
9675 and a single key to search for. The key must be a non-empty string for the
9676 lookup to succeed. The lookup type determines how the file is searched.
9677 </para>
9678 </listitem>
9679 <listitem>
9680 <para>
9681 <indexterm role="concept">
9682 <primary>query-style lookup</primary>
9683 <secondary>definition of</secondary>
9684 </indexterm>
9685 The <emphasis>query-style</emphasis> type accepts a generalized database query. No particular
9686 key value is assumed by Exim for query-style lookups. You can use whichever
9687 Exim variables you need to construct the database query.
9688 </para>
9689 </listitem>
9690 </itemizedlist>
9691 <para>
9692 The code for each lookup type is in a separate source file that is included in
9693 the binary of Exim only if the corresponding compile-time option is set. The
9694 default settings in <filename>src/EDITME</filename> are:
9695 </para>
9696 <literallayout class="monospaced">
9697 LOOKUP_DBM=yes
9698 LOOKUP_LSEARCH=yes
9699 </literallayout>
9700 <para>
9701 which means that only linear searching and DBM lookups are included by default.
9702 For some types of lookup (e.g. SQL databases), you need to install appropriate
9703 libraries and header files before building Exim.
9704 </para>
9705 </section>
9706 <section id="SECTsinglekeylookups">
9707 <title>Single-key lookup types</title>
9708 <para>
9709 <indexterm role="concept">
9710 <primary>lookup</primary>
9711 <secondary>single-key types</secondary>
9712 </indexterm>
9713 <indexterm role="concept">
9714 <primary>single-key lookup</primary>
9715 <secondary>list of types</secondary>
9716 </indexterm>
9717 The following single-key lookup types are implemented:
9718 </para>
9719 <itemizedlist>
9720 <listitem>
9721 <para>
9722 <indexterm role="concept">
9723 <primary>cdb</primary>
9724 <secondary>description of</secondary>
9725 </indexterm>
9726 <indexterm role="concept">
9727 <primary>lookup</primary>
9728 <secondary>cdb</secondary>
9729 </indexterm>
9730 <indexterm role="concept">
9731 <primary>binary zero</primary>
9732 <secondary>in lookup key</secondary>
9733 </indexterm>
9734 <command>cdb</command>: The given file is searched as a Constant DataBase file, using the key
9735 string without a terminating binary zero. The cdb format is designed for
9736 indexed files that are read frequently and never updated, except by total
9737 re-creation. As such, it is particularly suitable for large files containing
9738 aliases or other indexed data referenced by an MTA. Information about cdb can
9739 be found in several places:
9740 </para>
9741 <literallayout>
9742 <emphasis role="bold"><ulink url="http://www.pobox.com/~djb/cdb.html">http://www.pobox.com/~djb/cdb.html</ulink></emphasis>
9743 <emphasis role="bold"><ulink url="ftp://ftp.corpit.ru/pub/tinycdb/">ftp://ftp.corpit.ru/pub/tinycdb/</ulink></emphasis>
9744 <emphasis role="bold"><ulink url="http://packages.debian.org/stable/utils/freecdb.html">http://packages.debian.org/stable/utils/freecdb.html</ulink></emphasis>
9745 </literallayout>
9746 <para>
9747 A cdb distribution is not needed in order to build Exim with cdb support,
9748 because the code for reading cdb files is included directly in Exim itself.
9749 However, no means of building or testing cdb files is provided with Exim, so
9750 you need to obtain a cdb distribution in order to do this.
9751 </para>
9752 </listitem>
9753 <listitem>
9754 <para>
9755 <indexterm role="concept">
9756 <primary>DBM</primary>
9757 <secondary>lookup type</secondary>
9758 </indexterm>
9759 <indexterm role="concept">
9760 <primary>lookup</primary>
9761 <secondary>dbm</secondary>
9762 </indexterm>
9763 <indexterm role="concept">
9764 <primary>binary zero</primary>
9765 <secondary>in lookup key</secondary>
9766 </indexterm>
9767 <command>dbm</command>: Calls to DBM library functions are used to extract data from the given
9768 DBM file by looking up the record with the given key. A terminating binary
9769 zero is included in the key that is passed to the DBM library. See section
9770 <xref linkend="SECTdb"/> for a discussion of DBM libraries.
9771 </para>
9772 <para>
9773 <indexterm role="concept">
9774 <primary>Berkeley DB library</primary>
9775 <secondary>file format</secondary>
9776 </indexterm>
9777 For all versions of Berkeley DB, Exim uses the DB_HASH style of database
9778 when building DBM files using the <option>exim_dbmbuild</option> utility. However, when
9779 using Berkeley DB versions 3 or 4, it opens existing databases for reading with
9780 the DB_UNKNOWN option. This enables it to handle any of the types of database
9781 that the library supports, and can be useful for accessing DBM files created by
9782 other applications. (For earlier DB versions, DB_HASH is always used.)
9783 </para>
9784 </listitem>
9785 <listitem>
9786 <para>
9787 <indexterm role="concept">
9788 <primary>lookup</primary>
9789 <secondary>dbmjz</secondary>
9790 </indexterm>
9791 <indexterm role="concept">
9792 <primary>lookup</primary>
9793 <secondary>dbm &ndash; embedded NULs</secondary>
9794 </indexterm>
9795 <indexterm role="concept">
9796 <primary>sasldb2</primary>
9797 </indexterm>
9798 <indexterm role="concept">
9799 <primary>dbmjz lookup type</primary>
9800 </indexterm>
9801 <command>dbmjz</command>: This is the same as <command>dbm</command>, except that the lookup key is
9802 interpreted as an Exim list; the elements of the list are joined together with
9803 ASCII NUL characters to form the lookup key.  An example usage would be to
9804 authenticate incoming SMTP calls using the passwords from Cyrus SASL&#x2019;s
9805 <filename>/etc/sasldb2</filename> file with the <command>gsasl</command> authenticator or Exim&#x2019;s own
9806 <command>cram_md5</command> authenticator.
9807 </para>
9808 </listitem>
9809 <listitem>
9810 <para>
9811 <indexterm role="concept">
9812 <primary>lookup</primary>
9813 <secondary>dbmnz</secondary>
9814 </indexterm>
9815 <indexterm role="concept">
9816 <primary>lookup</primary>
9817 <secondary>dbm &ndash; terminating zero</secondary>
9818 </indexterm>
9819 <indexterm role="concept">
9820 <primary>binary zero</primary>
9821 <secondary>in lookup key</secondary>
9822 </indexterm>
9823 <indexterm role="concept">
9824 <primary>Courier</primary>
9825 </indexterm>
9826 <indexterm role="concept">
9827 <primary><filename>/etc/userdbshadow.dat</filename></primary>
9828 </indexterm>
9829 <indexterm role="concept">
9830 <primary>dbmnz lookup type</primary>
9831 </indexterm>
9832 <command>dbmnz</command>: This is the same as <command>dbm</command>, except that a terminating binary zero
9833 is not included in the key that is passed to the DBM library. You may need this
9834 if you want to look up data in files that are created by or shared with some
9835 other application that does not use terminating zeros. For example, you need to
9836 use <command>dbmnz</command> rather than <command>dbm</command> if you want to authenticate incoming SMTP
9837 calls using the passwords from Courier&#x2019;s <filename>/etc/userdbshadow.dat</filename> file. Exim&#x2019;s
9838 utility program for creating DBM files (<emphasis>exim_dbmbuild</emphasis>) includes the zeros
9839 by default, but has an option to omit them (see section <xref linkend="SECTdbmbuild"/>).
9840 </para>
9841 </listitem>
9842 <listitem>
9843 <para>
9844 <indexterm role="concept">
9845 <primary>lookup</primary>
9846 <secondary>dsearch</secondary>
9847 </indexterm>
9848 <indexterm role="concept">
9849 <primary>dsearch lookup type</primary>
9850 </indexterm>
9851 <command>dsearch</command>: The given file must be a directory; this is searched for an entry
9852 whose name is the key by calling the <function>lstat()</function> function. The key may not
9853 contain any forward slash characters. If <function>lstat()</function> succeeds, the result of
9854 the lookup is the name of the entry, which may be a file, directory,
9855 symbolic link, or any other kind of directory entry. An example of how this
9856 lookup can be used to support virtual domains is given in section
9857 <xref linkend="SECTvirtualdomains"/>.
9858 </para>
9859 </listitem>
9860 <listitem>
9861 <para>
9862 <indexterm role="concept">
9863 <primary>lookup</primary>
9864 <secondary>iplsearch</secondary>
9865 </indexterm>
9866 <indexterm role="concept">
9867 <primary>iplsearch lookup type</primary>
9868 </indexterm>
9869 <command>iplsearch</command>: The given file is a text file containing keys and data. A key is
9870 terminated by a colon or white space or the end of the line. The keys in the
9871 file must be IP addresses, or IP addresses with CIDR masks. Keys that involve
9872 IPv6 addresses must be enclosed in quotes to prevent the first internal colon
9873 being interpreted as a key terminator. For example:
9874 </para>
9875 <literallayout class="monospaced">
9876 1.2.3.4:           data for 1.2.3.4
9877 192.168.0.0/16:    data for 192.168.0.0/16
9878 "abcd::cdab":      data for abcd::cdab
9879 "abcd:abcd::/32"   data for abcd:abcd::/32
9880 </literallayout>
9881 <para>
9882 The key for an <command>iplsearch</command> lookup must be an IP address (without a mask). The
9883 file is searched linearly, using the CIDR masks where present, until a matching
9884 key is found. The first key that matches is used; there is no attempt to find a
9885 <quote>best</quote> match. Apart from the way the keys are matched, the processing for
9886 <command>iplsearch</command> is the same as for <command>lsearch</command>.
9887 </para>
9888 <para>
9889 <emphasis role="bold">Warning 1</emphasis>: Unlike most other single-key lookup types, a file of data for
9890 <command>iplsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
9891 lookup types support only literal keys.
9892 </para>
9893 <para>
9894 <emphasis role="bold">Warning 2</emphasis>: In a host list, you must always use <command>net-iplsearch</command> so that
9895 the implicit key is the host&#x2019;s IP address rather than its name (see section
9896 <xref linkend="SECThoslispatsikey"/>).
9897 </para>
9898 </listitem>
9899 <listitem>
9900 <para>
9901 <indexterm role="concept">
9902 <primary>linear search</primary>
9903 </indexterm>
9904 <indexterm role="concept">
9905 <primary>lookup</primary>
9906 <secondary>lsearch</secondary>
9907 </indexterm>
9908 <indexterm role="concept">
9909 <primary>lsearch lookup type</primary>
9910 </indexterm>
9911 <indexterm role="concept">
9912 <primary>case sensitivity</primary>
9913 <secondary>in lsearch lookup</secondary>
9914 </indexterm>
9915 <command>lsearch</command>: The given file is a text file that is searched linearly for a
9916 line beginning with the search key, terminated by a colon or white space or the
9917 end of the line. The search is case-insensitive; that is, upper and lower case
9918 letters are treated as the same. The first occurrence of the key that is found
9919 in the file is used.
9920 </para>
9921 <para>
9922 White space between the key and the colon is permitted. The remainder of the
9923 line, with leading and trailing white space removed, is the data. This can be
9924 continued onto subsequent lines by starting them with any amount of white
9925 space, but only a single space character is included in the data at such a
9926 junction. If the data begins with a colon, the key must be terminated by a
9927 colon, for example:
9928 </para>
9929 <literallayout class="monospaced">
9930 baduser:  :fail:
9931 </literallayout>
9932 <para>
9933 Empty lines and lines beginning with # are ignored, even if they occur in the
9934 middle of an item. This is the traditional textual format of alias files. Note
9935 that the keys in an <command>lsearch</command> file are literal strings. There is no
9936 wildcarding of any kind.
9937 </para>
9938 <para>
9939 <indexterm role="concept">
9940 <primary>lookup</primary>
9941 <secondary>lsearch &ndash; colons in keys</secondary>
9942 </indexterm>
9943 <indexterm role="concept">
9944 <primary>white space</primary>
9945 <secondary>in lsearch key</secondary>
9946 </indexterm>
9947 In most <command>lsearch</command> files, keys are not required to contain colons or #
9948 characters, or white space. However, if you need this feature, it is available.
9949 If a key begins with a doublequote character, it is terminated only by a
9950 matching quote (or end of line), and the normal escaping rules apply to its
9951 contents (see section <xref linkend="SECTstrings"/>). An optional colon is permitted after
9952 quoted keys (exactly as for unquoted keys). There is no special handling of
9953 quotes for the data part of an <command>lsearch</command> line.
9954 </para>
9955 </listitem>
9956 <listitem>
9957 <para>
9958 <indexterm role="concept">
9959 <primary>NIS lookup type</primary>
9960 </indexterm>
9961 <indexterm role="concept">
9962 <primary>lookup</primary>
9963 <secondary>NIS</secondary>
9964 </indexterm>
9965 <indexterm role="concept">
9966 <primary>binary zero</primary>
9967 <secondary>in lookup key</secondary>
9968 </indexterm>
9969 <command>nis</command>: The given file is the name of a NIS map, and a NIS lookup is done with
9970 the given key, without a terminating binary zero. There is a variant called
9971 <command>nis0</command> which does include the terminating binary zero in the key. This is
9972 reportedly needed for Sun-style alias files. Exim does not recognize NIS
9973 aliases; the full map names must be used.
9974 </para>
9975 </listitem>
9976 <listitem>
9977 <para>
9978 <indexterm role="concept">
9979 <primary>wildlsearch lookup type</primary>
9980 </indexterm>
9981 <indexterm role="concept">
9982 <primary>lookup</primary>
9983 <secondary>wildlsearch</secondary>
9984 </indexterm>
9985 <indexterm role="concept">
9986 <primary>nwildlsearch lookup type</primary>
9987 </indexterm>
9988 <indexterm role="concept">
9989 <primary>lookup</primary>
9990 <secondary>nwildlsearch</secondary>
9991 </indexterm>
9992 <command>wildlsearch</command> or <command>nwildlsearch</command>: These search a file linearly, like
9993 <command>lsearch</command>, but instead of being interpreted as a literal string, each key in
9994 the file may be wildcarded. The difference between these two lookup types is
9995 that for <command>wildlsearch</command>, each key in the file is string-expanded before being
9996 used, whereas for <command>nwildlsearch</command>, no expansion takes place.
9997 </para>
9998 <para>
9999 <indexterm role="concept">
10000 <primary>case sensitivity</primary>
10001 <secondary>in (n)wildlsearch lookup</secondary>
10002 </indexterm>
10003 Like <command>lsearch</command>, the testing is done case-insensitively. However, keys in the
10004 file that are regular expressions can be made case-sensitive by the use of
10005 <literal>(-i)</literal> within the pattern. The following forms of wildcard are recognized:
10006 </para>
10007 <orderedlist numeration="arabic">
10008 <listitem>
10009 <para>
10010 The string may begin with an asterisk to mean <quote>ends with</quote>. For example:
10011 </para>
10012 <literallayout class="monospaced">
10013     *.a.b.c       data for anything.a.b.c
10014     *fish         data for anythingfish
10015 </literallayout>
10016 </listitem>
10017 <listitem>
10018 <para>
10019 The string may begin with a circumflex to indicate a regular expression. For
10020 example, for <command>wildlsearch</command>:
10021 </para>
10022 <literallayout class="monospaced">
10023     ^\N\d+\.a\.b\N    data for &lt;digits&gt;.a.b
10024 </literallayout>
10025 <para>
10026 Note the use of <literal>\N</literal> to disable expansion of the contents of the regular
10027 expression. If you are using <command>nwildlsearch</command>, where the keys are not
10028 string-expanded, the equivalent entry is:
10029 </para>
10030 <literallayout class="monospaced">
10031     ^\d+\.a\.b        data for &lt;digits&gt;.a.b
10032 </literallayout>
10033 <para>
10034 The case-insensitive flag is set at the start of compiling the regular
10035 expression, but it can be turned off by using <literal>(-i)</literal> at an appropriate point.
10036 For example, to make the entire pattern case-sensitive:
10037 </para>
10038 <literallayout class="monospaced">
10039     ^(?-i)\d+\.a\.b        data for &lt;digits&gt;.a.b
10040 </literallayout>
10041 <para>
10042 If the regular expression contains white space or colon characters, you must
10043 either quote it (see <command>lsearch</command> above), or represent these characters in other
10044 ways. For example, <literal>\s</literal> can be used for white space and <literal>\x3A</literal> for a
10045 colon. This may be easier than quoting, because if you quote, you have to
10046 escape all the backslashes inside the quotes.
10047 </para>
10048 <para>
10049 <emphasis role="bold">Note</emphasis>: It is not possible to capture substrings in a regular expression
10050 match for later use, because the results of all lookups are cached. If a lookup
10051 is repeated, the result is taken from the cache, and no actual pattern matching
10052 takes place. The values of all the numeric variables are unset after a
10053 <command>(n)wildlsearch</command> match.
10054 </para>
10055 </listitem>
10056 <listitem>
10057 <para>
10058 Although I cannot see it being of much use, the general matching function that
10059 is used to implement <command>(n)wildlsearch</command> means that the string may begin with a
10060 lookup name terminated by a semicolon, and followed by lookup data. For
10061 example:
10062 </para>
10063 <literallayout class="monospaced">
10064     cdb;/some/file  data for keys that match the file
10065 </literallayout>
10066 <para>
10067 The data that is obtained from the nested lookup is discarded.
10068 </para>
10069 </listitem>
10070 </orderedlist>
10071 <para>
10072 Keys that do not match any of these patterns are interpreted literally. The
10073 continuation rules for the data are the same as for <command>lsearch</command>, and keys may
10074 be followed by optional colons.
10075 </para>
10076 <para>
10077 <emphasis role="bold">Warning</emphasis>: Unlike most other single-key lookup types, a file of data for
10078 <command>(n)wildlsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
10079 lookup types support only literal keys.
10080 </para>
10081 </listitem>
10082 </itemizedlist>
10083 </section>
10084 <section id="SECTquerystylelookups">
10085 <title>Query-style lookup types</title>
10086 <para>
10087 <indexterm role="concept">
10088 <primary>lookup</primary>
10089 <secondary>query-style types</secondary>
10090 </indexterm>
10091 <indexterm role="concept">
10092 <primary>query-style lookup</primary>
10093 <secondary>list of types</secondary>
10094 </indexterm>
10095 The supported query-style lookup types are listed below. Further details about
10096 many of them are given in later sections.
10097 </para>
10098 <itemizedlist>
10099 <listitem>
10100 <para>
10101 <indexterm role="concept">
10102 <primary>DNS</primary>
10103 <secondary>as a lookup type</secondary>
10104 </indexterm>
10105 <indexterm role="concept">
10106 <primary>lookup</primary>
10107 <secondary>DNS</secondary>
10108 </indexterm>
10109 <command>dnsdb</command>: This does a DNS search for one or more records whose domain names
10110 are given in the supplied query. The resulting data is the contents of the
10111 records. See section <xref linkend="SECTdnsdb"/>.
10112 </para>
10113 </listitem>
10114 <listitem>
10115 <para>
10116 <indexterm role="concept">
10117 <primary>InterBase lookup type</primary>
10118 </indexterm>
10119 <indexterm role="concept">
10120 <primary>lookup</primary>
10121 <secondary>InterBase</secondary>
10122 </indexterm>
10123 <command>ibase</command>: This does a lookup in an InterBase database.
10124 </para>
10125 </listitem>
10126 <listitem>
10127 <para>
10128 <indexterm role="concept">
10129 <primary>LDAP</primary>
10130 <secondary>lookup type</secondary>
10131 </indexterm>
10132 <indexterm role="concept">
10133 <primary>lookup</primary>
10134 <secondary>LDAP</secondary>
10135 </indexterm>
10136 <command>ldap</command>: This does an LDAP lookup using a query in the form of a URL, and
10137 returns attributes from a single entry. There is a variant called <command>ldapm</command>
10138 that permits values from multiple entries to be returned. A third variant
10139 called <command>ldapdn</command> returns the Distinguished Name of a single entry instead of
10140 any attribute values. See section <xref linkend="SECTldap"/>.
10141 </para>
10142 </listitem>
10143 <listitem>
10144 <para>
10145 <indexterm role="concept">
10146 <primary>MySQL</primary>
10147 <secondary>lookup type</secondary>
10148 </indexterm>
10149 <indexterm role="concept">
10150 <primary>lookup</primary>
10151 <secondary>MySQL</secondary>
10152 </indexterm>
10153 <command>mysql</command>: The format of the query is an SQL statement that is passed to a
10154 MySQL database. See section <xref linkend="SECTsql"/>.
10155 </para>
10156 </listitem>
10157 <listitem>
10158 <para>
10159 <indexterm role="concept">
10160 <primary>NIS+ lookup type</primary>
10161 </indexterm>
10162 <indexterm role="concept">
10163 <primary>lookup</primary>
10164 <secondary>NIS+</secondary>
10165 </indexterm>
10166 <command>nisplus</command>: This does a NIS+ lookup using a query that can specify the name of
10167 the field to be returned. See section <xref linkend="SECTnisplus"/>.
10168 </para>
10169 </listitem>
10170 <listitem>
10171 <para>
10172 <indexterm role="concept">
10173 <primary>Oracle</primary>
10174 <secondary>lookup type</secondary>
10175 </indexterm>
10176 <indexterm role="concept">
10177 <primary>lookup</primary>
10178 <secondary>Oracle</secondary>
10179 </indexterm>
10180 <command>oracle</command>: The format of the query is an SQL statement that is passed to an
10181 Oracle database. See section <xref linkend="SECTsql"/>.
10182 </para>
10183 </listitem>
10184 <listitem>
10185 <para>
10186 <indexterm role="concept">
10187 <primary>lookup</primary>
10188 <secondary>passwd</secondary>
10189 </indexterm>
10190 <indexterm role="concept">
10191 <primary>passwd lookup type</primary>
10192 </indexterm>
10193 <indexterm role="concept">
10194 <primary><filename>/etc/passwd</filename></primary>
10195 </indexterm>
10196 <command>passwd</command> is a query-style lookup with queries that are just user names. The
10197 lookup calls <function>getpwnam()</function> to interrogate the system password data, and on
10198 success, the result string is the same as you would get from an <command>lsearch</command>
10199 lookup on a traditional <filename>/etc/passwd file</filename>, though with <literal>*</literal> for the
10200 password value. For example:
10201 </para>
10202 <literallayout class="monospaced">
10203 *:42:42:King Rat:/home/kr:/bin/bash
10204 </literallayout>
10205 </listitem>
10206 <listitem>
10207 <para>
10208 <indexterm role="concept">
10209 <primary>PostgreSQL lookup type</primary>
10210 </indexterm>
10211 <indexterm role="concept">
10212 <primary>lookup</primary>
10213 <secondary>PostgreSQL</secondary>
10214 </indexterm>
10215 <command>pgsql</command>: The format of the query is an SQL statement that is passed to a
10216 PostgreSQL database. See section <xref linkend="SECTsql"/>.
10217 </para>
10218 </listitem>
10219 <listitem>
10220 <para>
10221 <indexterm role="concept">
10222 <primary>Redis lookup type</primary>
10223 </indexterm>
10224 <indexterm role="concept">
10225 <primary>lookup</primary>
10226 <secondary>Redis</secondary>
10227 </indexterm>
10228 <command>redis</command>: The format of the query is either a simple get or simple set,
10229 passed to a Redis database. See section <xref linkend="SECTsql"/>.
10230 </para>
10231 </listitem>
10232 <listitem>
10233 <para>
10234 <indexterm role="concept">
10235 <primary>sqlite lookup type</primary>
10236 </indexterm>
10237 <indexterm role="concept">
10238 <primary>lookup</primary>
10239 <secondary>sqlite</secondary>
10240 </indexterm>
10241 <command>sqlite</command>: The format of the query is a file name followed by an SQL statement
10242 that is passed to an SQLite database. See section <xref linkend="SECTsqlite"/>.
10243 </para>
10244 </listitem>
10245 <listitem>
10246 <para>
10247 <command>testdb</command>: This is a lookup type that is used for testing Exim. It is
10248 not likely to be useful in normal operation.
10249 </para>
10250 </listitem>
10251 <listitem>
10252 <para>
10253 <indexterm role="concept">
10254 <primary>whoson lookup type</primary>
10255 </indexterm>
10256 <indexterm role="concept">
10257 <primary>lookup</primary>
10258 <secondary>whoson</secondary>
10259 </indexterm>
10260 <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
10261 allows a server to check whether a particular (dynamically allocated) IP
10262 address is currently allocated to a known (trusted) user and, optionally, to
10263 obtain the identity of the said user. For SMTP servers, <emphasis>Whoson</emphasis> was popular
10264 at one time for <quote>POP before SMTP</quote> authentication, but that approach has been
10265 superseded by SMTP authentication. In Exim, <emphasis>Whoson</emphasis> can be used to implement
10266 <quote>POP before SMTP</quote> checking using ACL statements such as
10267 </para>
10268 <literallayout class="monospaced">
10269 require condition = \
10270   ${lookup whoson {$sender_host_address}{yes}{no}}
10271 </literallayout>
10272 <para>
10273 The query consists of a single IP address. The value returned is the name of
10274 the authenticated user, which is stored in the variable <varname>$value</varname>. However, in
10275 this example, the data in <varname>$value</varname> is not used; the result of the lookup is
10276 one of the fixed strings <quote>yes</quote> or <quote>no</quote>.
10277 </para>
10278 </listitem>
10279 </itemizedlist>
10280 </section>
10281 <section id="SECID63">
10282 <title>Temporary errors in lookups</title>
10283 <para>
10284 <indexterm role="concept">
10285 <primary>lookup</primary>
10286 <secondary>temporary error in</secondary>
10287 </indexterm>
10288 Lookup functions can return temporary error codes if the lookup cannot be
10289 completed. For example, an SQL or LDAP database might be unavailable. For this
10290 reason, it is not advisable to use a lookup that might do this for critical
10291 options such as a list of local domains.
10292 </para>
10293 <para>
10294 When a lookup cannot be completed in a router or transport, delivery
10295 of the message (to the relevant address) is deferred, as for any other
10296 temporary error. In other circumstances Exim may assume the lookup has failed,
10297 or may give up altogether.
10298 </para>
10299 </section>
10300 <section id="SECTdefaultvaluelookups">
10301 <title>Default values in single-key lookups</title>
10302 <para>
10303 <indexterm role="concept">
10304 <primary>wildcard lookups</primary>
10305 </indexterm>
10306 <indexterm role="concept">
10307 <primary>lookup</primary>
10308 <secondary>default values</secondary>
10309 </indexterm>
10310 <indexterm role="concept">
10311 <primary>lookup</primary>
10312 <secondary>wildcard</secondary>
10313 </indexterm>
10314 <indexterm role="concept">
10315 <primary>lookup</primary>
10316 <secondary>* added to type</secondary>
10317 </indexterm>
10318 <indexterm role="concept">
10319 <primary>default</primary>
10320 <secondary>in single-key lookups</secondary>
10321 </indexterm>
10322 In this context, a <quote>default value</quote> is a value specified by the administrator
10323 that is to be used if a lookup fails.
10324 </para>
10325 <para>
10326 <emphasis role="bold">Note:</emphasis> This section applies only to single-key lookups. For query-style
10327 lookups, the facilities of the query language must be used. An attempt to
10328 specify a default for a query-style lookup provokes an error.
10329 </para>
10330 <para>
10331 If <quote>*</quote> is added to a single-key lookup type (for example, <option>lsearch*</option>)
10332 and the initial lookup fails, the key <quote>*</quote> is looked up in the file to
10333 provide a default value. See also the section on partial matching below.
10334 </para>
10335 <para>
10336 <indexterm role="concept">
10337 <primary>*@ with single-key lookup</primary>
10338 </indexterm>
10339 <indexterm role="concept">
10340 <primary>lookup</primary>
10341 <secondary>*@ added to type</secondary>
10342 </indexterm>
10343 <indexterm role="concept">
10344 <primary>alias file</primary>
10345 <secondary>per-domain default</secondary>
10346 </indexterm>
10347 Alternatively, if <quote>*@</quote> is added to a single-key lookup type (for example
10348 <option>dbm*@</option>) then, if the initial lookup fails and the key contains an @
10349 character, a second lookup is done with everything before the last @ replaced
10350 by *. This makes it possible to provide per-domain defaults in alias files
10351 that include the domains in the keys. If the second lookup fails (or doesn&#x2019;t
10352 take place because there is no @ in the key), <quote>*</quote> is looked up.
10353 For example, a <command>redirect</command> router might contain:
10354 </para>
10355 <literallayout class="monospaced">
10356 data = ${lookup{$local_part@$domain}lsearch*@{/etc/mix-aliases}}
10357 </literallayout>
10358 <para>
10359 Suppose the address that is being processed is <emphasis>jane@eyre.example</emphasis>. Exim
10360 looks up these keys, in this order:
10361 </para>
10362 <literallayout class="monospaced">
10363 jane@eyre.example
10364 *@eyre.example
10365 *
10366 </literallayout>
10367 <para>
10368 The data is taken from whichever key it finds first. <emphasis role="bold">Note</emphasis>: In an
10369 <command>lsearch</command> file, this does not mean the first of these keys in the file. A
10370 complete scan is done for each key, and only if it is not found at all does
10371 Exim move on to try the next key.
10372 </para>
10373 </section>
10374 <section id="SECTpartiallookup">
10375 <title>Partial matching in single-key lookups</title>
10376 <para>
10377 <indexterm role="concept">
10378 <primary>partial matching</primary>
10379 </indexterm>
10380 <indexterm role="concept">
10381 <primary>wildcard lookups</primary>
10382 </indexterm>
10383 <indexterm role="concept">
10384 <primary>lookup</primary>
10385 <secondary>partial matching</secondary>
10386 </indexterm>
10387 <indexterm role="concept">
10388 <primary>lookup</primary>
10389 <secondary>wildcard</secondary>
10390 </indexterm>
10391 <indexterm role="concept">
10392 <primary>asterisk</primary>
10393 <secondary>in search type</secondary>
10394 </indexterm>
10395 The normal operation of a single-key lookup is to search the file for an exact
10396 match with the given key. However, in a number of situations where domains are
10397 being looked up, it is useful to be able to do partial matching. In this case,
10398 information in the file that has a key starting with <quote>*.</quote> is matched by any
10399 domain that ends with the components that follow the full stop. For example, if
10400 a key in a DBM file is
10401 </para>
10402 <literallayout class="monospaced">
10403 *.dates.fict.example
10404 </literallayout>
10405 <para>
10406 then when partial matching is enabled this is matched by (amongst others)
10407 <emphasis>2001.dates.fict.example</emphasis> and <emphasis>1984.dates.fict.example</emphasis>. It is also matched
10408 by <emphasis>dates.fict.example</emphasis>, if that does not appear as a separate key in the
10409 file.
10410 </para>
10411 <para>
10412 <emphasis role="bold">Note</emphasis>: Partial matching is not available for query-style lookups. It is
10413 also not available for any lookup items in address lists (see section
10414 <xref linkend="SECTaddresslist"/>).
10415 </para>
10416 <para>
10417 Partial matching is implemented by doing a series of separate lookups using
10418 keys constructed by modifying the original subject key. This means that it can
10419 be used with any of the single-key lookup types, provided that
10420 partial matching keys
10421 beginning with a special prefix (default <quote>*.</quote>) are included in the data file.
10422 Keys in the file that do not begin with the prefix are matched only by
10423 unmodified subject keys when partial matching is in use.
10424 </para>
10425 <para>
10426 Partial matching is requested by adding the string <quote>partial-</quote> to the front of
10427 the name of a single-key lookup type, for example, <option>partial-dbm</option>. When this
10428 is done, the subject key is first looked up unmodified; if that fails, <quote>*.</quote>
10429 is added at the start of the subject key, and it is looked up again. If that
10430 fails, further lookups are tried with dot-separated components removed from the
10431 start of the subject key, one-by-one, and <quote>*.</quote> added on the front of what
10432 remains.
10433 </para>
10434 <para>
10435 A minimum number of two non-* components are required. This can be adjusted
10436 by including a number before the hyphen in the search type. For example,
10437 <option>partial3-lsearch</option> specifies a minimum of three non-* components in the
10438 modified keys. Omitting the number is equivalent to <quote>partial2-</quote>. If the
10439 subject key is <emphasis>2250.dates.fict.example</emphasis> then the following keys are looked
10440 up when the minimum number of non-* components is two:
10441 </para>
10442 <literallayout class="monospaced">
10443 2250.dates.fict.example
10444 *.2250.dates.fict.example
10445 *.dates.fict.example
10446 *.fict.example
10447 </literallayout>
10448 <para>
10449 As soon as one key in the sequence is successfully looked up, the lookup
10450 finishes.
10451 </para>
10452 <para>
10453 <indexterm role="concept">
10454 <primary>lookup</primary>
10455 <secondary>partial matching &ndash; changing prefix</secondary>
10456 </indexterm>
10457 <indexterm role="concept">
10458 <primary>prefix</primary>
10459 <secondary>for partial matching</secondary>
10460 </indexterm>
10461 The use of <quote>*.</quote> as the partial matching prefix is a default that can be
10462 changed. The motivation for this feature is to allow Exim to operate with file
10463 formats that are used by other MTAs. A different prefix can be supplied in
10464 parentheses instead of the hyphen after <quote>partial</quote>. For example:
10465 </para>
10466 <literallayout class="monospaced">
10467 domains = partial(.)lsearch;/some/file
10468 </literallayout>
10469 <para>
10470 In this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
10471 <literal>a.b.c</literal>, <literal>.a.b.c</literal>, and <literal>.b.c</literal> (the default minimum of 2 non-wild
10472 components is unchanged). The prefix may consist of any punctuation characters
10473 other than a closing parenthesis. It may be empty, for example:
10474 </para>
10475 <literallayout class="monospaced">
10476 domains = partial1()cdb;/some/file
10477 </literallayout>
10478 <para>
10479 For this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
10480 <literal>a.b.c</literal>, <literal>b.c</literal>, and <literal>c</literal>.
10481 </para>
10482 <para>
10483 If <quote>partial0</quote> is specified, what happens at the end (when the lookup with
10484 just one non-wild component has failed, and the original key is shortened right
10485 down to the null string) depends on the prefix:
10486 </para>
10487 <itemizedlist>
10488 <listitem>
10489 <para>
10490 If the prefix has zero length, the whole lookup fails.
10491 </para>
10492 </listitem>
10493 <listitem>
10494 <para>
10495 If the prefix has length 1, a lookup for just the prefix is done. For
10496 example, the final lookup for <quote>partial0(.)</quote> is for <literal>.</literal> alone.
10497 </para>
10498 </listitem>
10499 <listitem>
10500 <para>
10501 Otherwise, if the prefix ends in a dot, the dot is removed, and the
10502 remainder is looked up. With the default prefix, therefore, the final lookup is
10503 for <quote>*</quote> on its own.
10504 </para>
10505 </listitem>
10506 <listitem>
10507 <para>
10508 Otherwise, the whole prefix is looked up.
10509 </para>
10510 </listitem>
10511 </itemizedlist>
10512 <para>
10513 If the search type ends in <quote>*</quote> or <quote>*@</quote> (see section
10514 <xref linkend="SECTdefaultvaluelookups"/> above), the search for an ultimate default that
10515 this implies happens after all partial lookups have failed. If <quote>partial0</quote> is
10516 specified, adding <quote>*</quote> to the search type has no effect with the default
10517 prefix, because the <quote>*</quote> key is already included in the sequence of partial
10518 lookups. However, there might be a use for lookup types such as
10519 <quote>partial0(.)lsearch*</quote>.
10520 </para>
10521 <para>
10522 The use of <quote>*</quote> in lookup partial matching differs from its use as a wildcard
10523 in domain lists and the like. Partial matching works only in terms of
10524 dot-separated components; a key such as <literal>*fict.example</literal>
10525 in a database file is useless, because the asterisk in a partial matching
10526 subject key is always followed by a dot.
10527 </para>
10528 </section>
10529 <section id="SECID64">
10530 <title>Lookup caching</title>
10531 <para>
10532 <indexterm role="concept">
10533 <primary>lookup</primary>
10534 <secondary>caching</secondary>
10535 </indexterm>
10536 <indexterm role="concept">
10537 <primary>caching</primary>
10538 <secondary>lookup data</secondary>
10539 </indexterm>
10540 Exim caches all lookup results in order to avoid needless repetition of
10541 lookups. However, because (apart from the daemon) Exim operates as a collection
10542 of independent, short-lived processes, this caching applies only within a
10543 single Exim process. There is no inter-process lookup caching facility.
10544 </para>
10545 <para>
10546 For single-key lookups, Exim keeps the relevant files open in case there is
10547 another lookup that needs them. In some types of configuration this can lead to
10548 many files being kept open for messages with many recipients. To avoid hitting
10549 the operating system limit on the number of simultaneously open files, Exim
10550 closes the least recently used file when it needs to open more files than its
10551 own internal limit, which can be changed via the <option>lookup_open_max</option> option.
10552 </para>
10553 <para>
10554 The single-key lookup files are closed and the lookup caches are flushed at
10555 strategic points during delivery &ndash; for example, after all routing is
10556 complete.
10557 </para>
10558 </section>
10559 <section id="SECID65">
10560 <title>Quoting lookup data</title>
10561 <para>
10562 <indexterm role="concept">
10563 <primary>lookup</primary>
10564 <secondary>quoting</secondary>
10565 </indexterm>
10566 <indexterm role="concept">
10567 <primary>quoting</primary>
10568 <secondary>in lookups</secondary>
10569 </indexterm>
10570 When data from an incoming message is included in a query-style lookup, there
10571 is the possibility of special characters in the data messing up the syntax of
10572 the query. For example, a NIS+ query that contains
10573 </para>
10574 <literallayout class="monospaced">
10575 [name=$local_part]
10576 </literallayout>
10577 <para>
10578 will be broken if the local part happens to contain a closing square bracket.
10579 For NIS+, data can be enclosed in double quotes like this:
10580 </para>
10581 <literallayout class="monospaced">
10582 [name="$local_part"]
10583 </literallayout>
10584 <para>
10585 but this still leaves the problem of a double quote in the data. The rule for
10586 NIS+ is that double quotes must be doubled. Other lookup types have different
10587 rules, and to cope with the differing requirements, an expansion operator
10588 of the following form is provided:
10589 </para>
10590 <literallayout class="monospaced">
10591 ${quote_&lt;lookup-type&gt;:&lt;string&gt;}
10592 </literallayout>
10593 <para>
10594 For example, the safest way to write the NIS+ query is
10595 </para>
10596 <literallayout class="monospaced">
10597 [name="${quote_nisplus:$local_part}"]
10598 </literallayout>
10599 <para>
10600 See chapter <xref linkend="CHAPexpand"/> for full coverage of string expansions. The quote
10601 operator can be used for all lookup types, but has no effect for single-key
10602 lookups, since no quoting is ever needed in their key strings.
10603 </para>
10604 </section>
10605 <section id="SECTdnsdb">
10606 <title>More about dnsdb</title>
10607 <para>
10608 <indexterm role="concept">
10609 <primary>dnsdb lookup</primary>
10610 </indexterm>
10611 <indexterm role="concept">
10612 <primary>lookup</primary>
10613 <secondary>dnsdb</secondary>
10614 </indexterm>
10615 <indexterm role="concept">
10616 <primary>DNS</primary>
10617 <secondary>as a lookup type</secondary>
10618 </indexterm>
10619 The <command>dnsdb</command> lookup type uses the DNS as its database. A simple query consists
10620 of a record type and a domain name, separated by an equals sign. For example,
10621 an expansion string could contain:
10622 </para>
10623 <literallayout class="monospaced">
10624 ${lookup dnsdb{mx=a.b.example}{$value}fail}
10625 </literallayout>
10626 <para>
10627 If the lookup succeeds, the result is placed in <varname>$value</varname>, which in this case
10628 is used on its own as the result. If the lookup does not succeed, the
10629 <literal>fail</literal> keyword causes a <emphasis>forced expansion failure</emphasis> &ndash; see section
10630 <xref linkend="SECTforexpfai"/> for an explanation of what this means.
10631 </para>
10632 <para>
10633 The supported DNS record types are A, CNAME, MX, NS, PTR, SOA, SPF, SRV, TLSA
10634 and TXT, and, when Exim is compiled with IPv6 support, AAAA.
10635 If no type is given, TXT is assumed.
10636 </para>
10637 <para>
10638 For any record type, if multiple records are found, the data is returned as a
10639 concatenation, with newline as the default separator. The order, of course,
10640 depends on the DNS resolver. You can specify a different separator character
10641 between multiple records by putting a right angle-bracket followed immediately
10642 by the new separator at the start of the query. For example:
10643 </para>
10644 <literallayout class="monospaced">
10645 ${lookup dnsdb{&gt;: a=host1.example}}
10646 </literallayout>
10647 <para>
10648 It is permitted to specify a space as the separator character. Further
10649 white space is ignored.
10650 For lookup types that return multiple fields per record,
10651 an alternate field separator can be specified using a comma after the main
10652 separator character, followed immediately by the field separator.
10653 </para>
10654 <para>
10655 <indexterm role="concept">
10656 <primary>PTR record</primary>
10657 <secondary>in <command>dnsdb</command> lookup</secondary>
10658 </indexterm>
10659 When the type is PTR,
10660 the data can be an IP address, written as normal; inversion and the addition of
10661 <option>in-addr.arpa</option> or <option>ip6.arpa</option> happens automatically. For example:
10662 </para>
10663 <literallayout class="monospaced">
10664 ${lookup dnsdb{ptr=192.168.4.5}{$value}fail}
10665 </literallayout>
10666 <para>
10667 If the data for a PTR record is not a syntactically valid IP address, it is not
10668 altered and nothing is added.
10669 </para>
10670 <para>
10671 <indexterm role="concept">
10672 <primary>MX record</primary>
10673 <secondary>in <command>dnsdb</command> lookup</secondary>
10674 </indexterm>
10675 <indexterm role="concept">
10676 <primary>SRV record</primary>
10677 <secondary>in <command>dnsdb</command> lookup</secondary>
10678 </indexterm>
10679 For an MX lookup, both the preference value and the host name are returned for
10680 each record, separated by a space. For an SRV lookup, the priority, weight,
10681 port, and host name are returned for each record, separated by spaces.
10682 The field separator can be modified as above.
10683 </para>
10684 <para>
10685 <indexterm role="concept">
10686 <primary>TXT record</primary>
10687 <secondary>in <command>dnsdb</command> lookup</secondary>
10688 </indexterm>
10689 <indexterm role="concept">
10690 <primary>SPF record</primary>
10691 <secondary>in <command>dnsdb</command> lookup</secondary>
10692 </indexterm>
10693 For TXT records with multiple items of data, only the first item is returned,
10694 unless a field separator is specified.
10695 To concatenate items without a separator, use a semicolon instead.
10696 For SPF records the
10697 default behaviour is to concatenate multiple items without using a separator.
10698 </para>
10699 <literallayout class="monospaced">
10700 ${lookup dnsdb{&gt;\n,: txt=a.b.example}}
10701 ${lookup dnsdb{&gt;\n; txt=a.b.example}}
10702 ${lookup dnsdb{spf=example.org}}
10703 </literallayout>
10704 <para>
10705 It is permitted to specify a space as the separator character. Further
10706 white space is ignored.
10707 </para>
10708 <para>
10709 <indexterm role="concept">
10710 <primary>SOA record</primary>
10711 <secondary>in <command>dnsdb</command> lookup</secondary>
10712 </indexterm>
10713 For an SOA lookup, while no result is obtained the lookup is redone with
10714 successively more leading components dropped from the given domain.
10715 Only the primary-nameserver field is returned unless a field separator is
10716 specified.
10717 </para>
10718 <literallayout class="monospaced">
10719 ${lookup dnsdb{&gt;:,; soa=a.b.example.com}}
10720 </literallayout>
10721 </section>
10722 <section id="SECTdnsdb_mod">
10723 <title>Dnsdb lookup modifiers</title>
10724 <para>
10725 <indexterm role="concept">
10726 <primary>dnsdb modifiers</primary>
10727 </indexterm>
10728 <indexterm role="concept">
10729 <primary>modifiers</primary>
10730 <secondary>dnsdb</secondary>
10731 </indexterm>
10732 <indexterm role="concept">
10733 <primary>options</primary>
10734 <secondary>dnsdb</secondary>
10735 </indexterm>
10736 Modifiers for <command>dnsdb</command> lookups are given by optional keywords,
10737 each followed by a comma,
10738 that may appear before the record type.
10739 </para>
10740 <para>
10741 The <command>dnsdb</command> lookup fails only if all the DNS lookups fail. If there is a
10742 temporary DNS error for any of them, the behaviour is controlled by
10743 a defer-option modifier.
10744 The possible keywords are
10745 <quote>defer_strict</quote>, <quote>defer_never</quote>, and <quote>defer_lax</quote>.
10746 With <quote>strict</quote> behaviour, any temporary DNS error causes the
10747 whole lookup to defer. With <quote>never</quote> behaviour, a temporary DNS error is
10748 ignored, and the behaviour is as if the DNS lookup failed to find anything.
10749 With <quote>lax</quote> behaviour, all the queries are attempted, but a temporary DNS
10750 error causes the whole lookup to defer only if none of the other lookups
10751 succeed. The default is <quote>lax</quote>, so the following lookups are equivalent:
10752 </para>
10753 <literallayout class="monospaced">
10754 ${lookup dnsdb{defer_lax,a=one.host.com:two.host.com}}
10755 ${lookup dnsdb{a=one.host.com:two.host.com}}
10756 </literallayout>
10757 <para>
10758 Thus, in the default case, as long as at least one of the DNS lookups
10759 yields some data, the lookup succeeds.
10760 </para>
10761 <para>
10762 <indexterm role="concept">
10763 <primary>DNSSEC</primary>
10764 <secondary>dns lookup</secondary>
10765 </indexterm>
10766 Use of <command>DNSSEC</command> is controlled by a dnssec modifier.
10767 The possible keywords are
10768 <quote>dnssec_strict</quote>, <quote>dnssec_lax</quote>, and <quote>dnssec_never</quote>.
10769 With <quote>strict</quote> or <quote>lax</quote> DNSSEC information is requested
10770 with the lookup.
10771 With <quote>strict</quote> a response from the DNS resolver that
10772 is not labelled as authenticated data
10773 is treated as equivalent to a temporary DNS error.
10774 The default is <quote>never</quote>.
10775 </para>
10776 <para>
10777 See also the <varname>$lookup_dnssec_authenticated</varname> variable.
10778 </para>
10779 <para>
10780 <indexterm role="concept">
10781 <primary>timeout</primary>
10782 <secondary>dns lookup</secondary>
10783 </indexterm>
10784 <indexterm role="concept">
10785 <primary>DNS</primary>
10786 <secondary>timeout</secondary>
10787 </indexterm>
10788 Timeout for the dnsdb lookup can be controlled by a retrans modifier.
10789 The form is <quote>retrans_VAL</quote> where VAL is an Exim time specification
10790 (e.g. <quote>5s</quote>).
10791 The default value is set by the main configuration option <option>dns_retrans</option>.
10792 </para>
10793 <para>
10794 Retries for the dnsdb lookup can be controlled by a retry modifier.
10795 The form if <quote>retry_VAL</quote> where VAL is an integer.
10796 The default count is set by the main configuration option <option>dns_retry</option>.
10797 </para>
10798 <para>
10799 <indexterm role="concept">
10800 <primary>caching</primary>
10801 <secondary>of dns lookup</secondary>
10802 </indexterm>
10803 <indexterm role="concept">
10804 <primary>TTL</primary>
10805 <secondary>of dns lookup</secondary>
10806 </indexterm>
10807 <indexterm role="concept">
10808 <primary>DNS</primary>
10809 <secondary>TTL</secondary>
10810 </indexterm>
10811 Dnsdb lookup results are cached within a single process (and its children).
10812 The cache entry lifetime is limited to the smallest time-to-live (TTL)
10813 value of the set of returned DNS records.
10814 </para>
10815 </section>
10816 <section id="SECID66">
10817 <title>Pseudo dnsdb record types</title>
10818 <para>
10819 <indexterm role="concept">
10820 <primary>MX record</primary>
10821 <secondary>in <command>dnsdb</command> lookup</secondary>
10822 </indexterm>
10823 By default, both the preference value and the host name are returned for
10824 each MX record, separated by a space. If you want only host names, you can use
10825 the pseudo-type MXH:
10826 </para>
10827 <literallayout class="monospaced">
10828 ${lookup dnsdb{mxh=a.b.example}}
10829 </literallayout>
10830 <para>
10831 In this case, the preference values are omitted, and just the host names are
10832 returned.
10833 </para>
10834 <para>
10835 <indexterm role="concept">
10836 <primary>name server for enclosing domain</primary>
10837 </indexterm>
10838 Another pseudo-type is ZNS (for <quote>zone NS</quote>). It performs a lookup for NS
10839 records on the given domain, but if none are found, it removes the first
10840 component of the domain name, and tries again. This process continues until NS
10841 records are found or there are no more components left (or there is a DNS
10842 error). In other words, it may return the name servers for a top-level domain,
10843 but it never returns the root name servers. If there are no NS records for the
10844 top-level domain, the lookup fails. Consider these examples:
10845 </para>
10846 <literallayout class="monospaced">
10847 ${lookup dnsdb{zns=xxx.quercite.com}}
10848 ${lookup dnsdb{zns=xxx.edu}}
10849 </literallayout>
10850 <para>
10851 Assuming that in each case there are no NS records for the full domain name,
10852 the first returns the name servers for <option>quercite.com</option>, and the second returns
10853 the name servers for <option>edu</option>.
10854 </para>
10855 <para>
10856 You should be careful about how you use this lookup because, unless the
10857 top-level domain does not exist, the lookup always returns some host names. The
10858 sort of use to which this might be put is for seeing if the name servers for a
10859 given domain are on a blacklist. You can probably assume that the name servers
10860 for the high-level domains such as <option>com</option> or <option>co.uk</option> are not going to be on
10861 such a list.
10862 </para>
10863 <para>
10864 <indexterm role="concept">
10865 <primary>CSA</primary>
10866 <secondary>in <command>dnsdb</command> lookup</secondary>
10867 </indexterm>
10868 A third pseudo-type is CSA (Client SMTP Authorization). This looks up SRV
10869 records according to the CSA rules, which are described in section
10870 <xref linkend="SECTverifyCSA"/>. Although <command>dnsdb</command> supports SRV lookups directly, this is
10871 not sufficient because of the extra parent domain search behaviour of CSA. The
10872 result of a successful lookup such as:
10873 </para>
10874 <literallayout class="monospaced">
10875 ${lookup dnsdb {csa=$sender_helo_name}}
10876 </literallayout>
10877 <para>
10878 has two space-separated fields: an authorization code and a target host name.
10879 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
10880 authorization required but absent, or <quote>?</quote> for unknown.
10881 </para>
10882 <para>
10883 <indexterm role="concept">
10884 <primary>A+</primary>
10885 <secondary>in <command>dnsdb</command> lookup</secondary>
10886 </indexterm>
10887 The pseudo-type A+ performs an AAAA
10888 and then an A lookup.  All results are returned; defer processing
10889 (see below) is handled separately for each lookup.  Example:
10890 </para>
10891 <literallayout class="monospaced">
10892 ${lookup dnsdb {&gt;; a+=$sender_helo_name}}
10893 </literallayout>
10894 </section>
10895 <section id="SECID67">
10896 <title>Multiple dnsdb lookups</title>
10897 <para>
10898 In the previous sections, <command>dnsdb</command> lookups for a single domain are described.
10899 However, you can specify a list of domains or IP addresses in a single
10900 <command>dnsdb</command> lookup. The list is specified in the normal Exim way, with colon as
10901 the default separator, but with the ability to change this. For example:
10902 </para>
10903 <literallayout class="monospaced">
10904 ${lookup dnsdb{one.domain.com:two.domain.com}}
10905 ${lookup dnsdb{a=one.host.com:two.host.com}}
10906 ${lookup dnsdb{ptr = &lt;; 1.2.3.4 ; 4.5.6.8}}
10907 </literallayout>
10908 <para>
10909 In order to retain backwards compatibility, there is one special case: if
10910 the lookup type is PTR and no change of separator is specified, Exim looks
10911 to see if the rest of the string is precisely one IPv6 address. In this
10912 case, it does not treat it as a list.
10913 </para>
10914 <para>
10915 The data from each lookup is concatenated, with newline separators by default,
10916 in the same way that multiple DNS records for a single item are handled. A
10917 different separator can be specified, as described above.
10918 </para>
10919 </section>
10920 <section id="SECTldap">
10921 <title>More about LDAP</title>
10922 <para>
10923 <indexterm role="concept">
10924 <primary>LDAP</primary>
10925 <secondary>lookup, more about</secondary>
10926 </indexterm>
10927 <indexterm role="concept">
10928 <primary>lookup</primary>
10929 <secondary>LDAP</secondary>
10930 </indexterm>
10931 <indexterm role="concept">
10932 <primary>Solaris</primary>
10933 <secondary>LDAP</secondary>
10934 </indexterm>
10935 The original LDAP implementation came from the University of Michigan; this has
10936 become <quote>Open LDAP</quote>, and there are now two different releases. Another
10937 implementation comes from Netscape, and Solaris 7 and subsequent releases
10938 contain inbuilt LDAP support. Unfortunately, though these are all compatible at
10939 the lookup function level, their error handling is different. For this reason
10940 it is necessary to set a compile-time variable when building Exim with LDAP, to
10941 indicate which LDAP library is in use. One of the following should appear in
10942 your <filename>Local/Makefile</filename>:
10943 </para>
10944 <literallayout class="monospaced">
10945 LDAP_LIB_TYPE=UMICHIGAN
10946 LDAP_LIB_TYPE=OPENLDAP1
10947 LDAP_LIB_TYPE=OPENLDAP2
10948 LDAP_LIB_TYPE=NETSCAPE
10949 LDAP_LIB_TYPE=SOLARIS
10950 </literallayout>
10951 <para>
10952 If LDAP_LIB_TYPE is not set, Exim assumes <literal>OPENLDAP1</literal>, which has the
10953 same interface as the University of Michigan version.
10954 </para>
10955 <para>
10956 There are three LDAP lookup types in Exim. These behave slightly differently in
10957 the way they handle the results of a query:
10958 </para>
10959 <itemizedlist>
10960 <listitem>
10961 <para>
10962 <command>ldap</command> requires the result to contain just one entry; if there are more, it
10963 gives an error.
10964 </para>
10965 </listitem>
10966 <listitem>
10967 <para>
10968 <command>ldapdn</command> also requires the result to contain just one entry, but it is the
10969 Distinguished Name that is returned rather than any attribute values.
10970 </para>
10971 </listitem>
10972 <listitem>
10973 <para>
10974 <command>ldapm</command> permits the result to contain more than one entry; the attributes
10975 from all of them are returned.
10976 </para>
10977 </listitem>
10978 </itemizedlist>
10979 <para>
10980 For <command>ldap</command> and <command>ldapm</command>, if a query finds only entries with no attributes,
10981 Exim behaves as if the entry did not exist, and the lookup fails. The format of
10982 the data returned by a successful lookup is described in the next section.
10983 First we explain how LDAP queries are coded.
10984 </para>
10985 </section>
10986 <section id="SECTforldaque">
10987 <title>Format of LDAP queries</title>
10988 <para>
10989 <indexterm role="concept">
10990 <primary>LDAP</primary>
10991 <secondary>query format</secondary>
10992 </indexterm>
10993 An LDAP query takes the form of a URL as defined in RFC 2255. For example, in
10994 the configuration of a <command>redirect</command> router one might have this setting:
10995 </para>
10996 <literallayout class="monospaced">
10997 data = ${lookup ldap \
10998   {ldap:///cn=$local_part,o=University%20of%20Cambridge,\
10999   c=UK?mailbox?base?}}
11000 </literallayout>
11001 <para>
11002 <indexterm role="concept">
11003 <primary>LDAP</primary>
11004 <secondary>with TLS</secondary>
11005 </indexterm>
11006 The URL may begin with <literal>ldap</literal> or <literal>ldaps</literal> if your LDAP library supports
11007 secure (encrypted) LDAP connections. The second of these ensures that an
11008 encrypted TLS connection is used.
11009 </para>
11010 <para>
11011 With sufficiently modern LDAP libraries, Exim supports forcing TLS over regular
11012 LDAP connections, rather than the SSL-on-connect <literal>ldaps</literal>.
11013 See the <option>ldap_start_tls</option> option.
11014 </para>
11015 <para>
11016 Starting with Exim 4.83, the initialization of LDAP with TLS is more tightly
11017 controlled. Every part of the TLS configuration can be configured by settings in
11018 <filename>exim.conf</filename>. Depending on the version of the client libraries installed on
11019 your system, some of the initialization may have required setting options in
11020 <filename>/etc/ldap.conf</filename> or <filename>~/.ldaprc</filename> to get TLS working with self-signed
11021 certificates. This revealed a nuance where the current UID that exim was
11022 running as could affect which config files it read. With Exim 4.83, these
11023 methods become optional, only taking effect if not specifically set in
11024 <filename>exim.conf</filename>.
11025 </para>
11026 </section>
11027 <section id="SECID68">
11028 <title>LDAP quoting</title>
11029 <para>
11030 <indexterm role="concept">
11031 <primary>LDAP</primary>
11032 <secondary>quoting</secondary>
11033 </indexterm>
11034 Two levels of quoting are required in LDAP queries, the first for LDAP itself
11035 and the second because the LDAP query is represented as a URL. Furthermore,
11036 within an LDAP query, two different kinds of quoting are required. For this
11037 reason, there are two different LDAP-specific quoting operators.
11038 </para>
11039 <para>
11040 The <option>quote_ldap</option> operator is designed for use on strings that are part of
11041 filter specifications. Conceptually, it first does the following conversions on
11042 the string:
11043 </para>
11044 <literallayout class="monospaced">
11045 *   =&gt;   \2A
11046 (   =&gt;   \28
11047 )   =&gt;   \29
11048 \   =&gt;   \5C
11049 </literallayout>
11050 <para>
11051 in accordance with RFC 2254. The resulting string is then quoted according
11052 to the rules for URLs, that is, all non-alphanumeric characters except
11053 </para>
11054 <literallayout class="monospaced">
11055 ! $ ' - . _ ( ) * +
11056 </literallayout>
11057 <para>
11058 are converted to their hex values, preceded by a percent sign. For example:
11059 </para>
11060 <literallayout class="monospaced">
11061 ${quote_ldap: a(bc)*, a&lt;yz&gt;; }
11062 </literallayout>
11063 <para>
11064 yields
11065 </para>
11066 <literallayout class="monospaced">
11067 %20a%5C28bc%5C29%5C2A%2C%20a%3Cyz%3E%3B%20
11068 </literallayout>
11069 <para>
11070 Removing the URL quoting, this is (with a leading and a trailing space):
11071 </para>
11072 <literallayout class="monospaced">
11073 a\28bc\29\2A, a&lt;yz&gt;;
11074 </literallayout>
11075 <para>
11076 The <option>quote_ldap_dn</option> operator is designed for use on strings that are part of
11077 base DN specifications in queries. Conceptually, it first converts the string
11078 by inserting a backslash in front of any of the following characters:
11079 </para>
11080 <literallayout class="monospaced">
11081 , + " \ &lt; &gt; ;
11082 </literallayout>
11083 <para>
11084 It also inserts a backslash before any leading spaces or # characters, and
11085 before any trailing spaces. (These rules are in RFC 2253.) The resulting string
11086 is then quoted according to the rules for URLs. For example:
11087 </para>
11088 <literallayout class="monospaced">
11089 ${quote_ldap_dn: a(bc)*, a&lt;yz&gt;; }
11090 </literallayout>
11091 <para>
11092 yields
11093 </para>
11094 <literallayout class="monospaced">
11095 %5C%20a(bc)*%5C%2C%20a%5C%3Cyz%5C%3E%5C%3B%5C%20
11096 </literallayout>
11097 <para>
11098 Removing the URL quoting, this is (with a trailing space):
11099 </para>
11100 <literallayout class="monospaced">
11101 \ a(bc)*\, a\&lt;yz\&gt;\;\
11102 </literallayout>
11103 <para>
11104 There are some further comments about quoting in the section on LDAP
11105 authentication below.
11106 </para>
11107 </section>
11108 <section id="SECID69">
11109 <title>LDAP connections</title>
11110 <para>
11111 <indexterm role="concept">
11112 <primary>LDAP</primary>
11113 <secondary>connections</secondary>
11114 </indexterm>
11115 The connection to an LDAP server may either be over TCP/IP, or, when OpenLDAP
11116 is in use, via a Unix domain socket. The example given above does not specify
11117 an LDAP server. A server that is reached by TCP/IP can be specified in a query
11118 by starting it with
11119 </para>
11120 <literallayout class="monospaced">
11121 ldap://&lt;hostname&gt;:&lt;port&gt;/...
11122 </literallayout>
11123 <para>
11124 If the port (and preceding colon) are omitted, the standard LDAP port (389) is
11125 used. When no server is specified in a query, a list of default servers is
11126 taken from the <option>ldap_default_servers</option> configuration option. This supplies a
11127 colon-separated list of servers which are tried in turn until one successfully
11128 handles a query, or there is a serious error. Successful handling either
11129 returns the requested data, or indicates that it does not exist. Serious errors
11130 are syntactical, or multiple values when only a single value is expected.
11131 Errors which cause the next server to be tried are connection failures, bind
11132 failures, and timeouts.
11133 </para>
11134 <para>
11135 For each server name in the list, a port number can be given. The standard way
11136 of specifying a host and port is to use a colon separator (RFC 1738). Because
11137 <option>ldap_default_servers</option> is a colon-separated list, such colons have to be
11138 doubled. For example
11139 </para>
11140 <literallayout class="monospaced">
11141 ldap_default_servers = ldap1.example.com::145:ldap2.example.com
11142 </literallayout>
11143 <para>
11144 If <option>ldap_default_servers</option> is unset, a URL with no server name is passed
11145 to the LDAP library with no server name, and the library&#x2019;s default (normally
11146 the local host) is used.
11147 </para>
11148 <para>
11149 If you are using the OpenLDAP library, you can connect to an LDAP server using
11150 a Unix domain socket instead of a TCP/IP connection. This is specified by using
11151 <literal>ldapi</literal> instead of <literal>ldap</literal> in LDAP queries. What follows here applies only
11152 to OpenLDAP. If Exim is compiled with a different LDAP library, this feature is
11153 not available.
11154 </para>
11155 <para>
11156 For this type of connection, instead of a host name for the server, a pathname
11157 for the socket is required, and the port number is not relevant. The pathname
11158 can be specified either as an item in <option>ldap_default_servers</option>, or inline in
11159 the query. In the former case, you can have settings such as
11160 </para>
11161 <literallayout class="monospaced">
11162 ldap_default_servers = /tmp/ldap.sock : backup.ldap.your.domain
11163 </literallayout>
11164 <para>
11165 When the pathname is given in the query, you have to escape the slashes as
11166 <literal>%2F</literal> to fit in with the LDAP URL syntax. For example:
11167 </para>
11168 <literallayout class="monospaced">
11169 ${lookup ldap {ldapi://%2Ftmp%2Fldap.sock/o=...
11170 </literallayout>
11171 <para>
11172 When Exim processes an LDAP lookup and finds that the <quote>hostname</quote> is really
11173 a pathname, it uses the Unix domain socket code, even if the query actually
11174 specifies <literal>ldap</literal> or <literal>ldaps</literal>. In particular, no encryption is used for a
11175 socket connection. This behaviour means that you can use a setting of
11176 <option>ldap_default_servers</option> such as in the example above with traditional <literal>ldap</literal>
11177 or <literal>ldaps</literal> queries, and it will work. First, Exim tries a connection via
11178 the Unix domain socket; if that fails, it tries a TCP/IP connection to the
11179 backup host.
11180 </para>
11181 <para>
11182 If an explicit <literal>ldapi</literal> type is given in a query when a host name is
11183 specified, an error is diagnosed. However, if there are more items in
11184 <option>ldap_default_servers</option>, they are tried. In other words:
11185 </para>
11186 <itemizedlist>
11187 <listitem>
11188 <para>
11189 Using a pathname with <literal>ldap</literal> or <literal>ldaps</literal> forces the use of the Unix domain
11190 interface.
11191 </para>
11192 </listitem>
11193 <listitem>
11194 <para>
11195 Using <literal>ldapi</literal> with a host name causes an error.
11196 </para>
11197 </listitem>
11198 </itemizedlist>
11199 <para>
11200 Using <literal>ldapi</literal> with no host or path in the query, and no setting of
11201 <option>ldap_default_servers</option>, does whatever the library does by default.
11202 </para>
11203 </section>
11204 <section id="SECID70">
11205 <title>LDAP authentication and control information</title>
11206 <para>
11207 <indexterm role="concept">
11208 <primary>LDAP</primary>
11209 <secondary>authentication</secondary>
11210 </indexterm>
11211 The LDAP URL syntax provides no way of passing authentication and other control
11212 information to the server. To make this possible, the URL in an LDAP query may
11213 be preceded by any number of &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt; settings, separated by
11214 spaces. If a value contains spaces it must be enclosed in double quotes, and
11215 when double quotes are used, backslash is interpreted in the usual way inside
11216 them. The following names are recognized:
11217 </para>
11218 <literallayout>
11219 <literal>DEREFERENCE</literal>  set the dereferencing parameter
11220 <literal>NETTIME    </literal>  set a timeout for a network operation
11221 <literal>USER       </literal>  set the DN, for authenticating the LDAP bind
11222 <literal>PASS       </literal>  set the password, likewise
11223 <literal>REFERRALS  </literal>  set the referrals parameter
11224 <literal>SERVERS    </literal>  set alternate server list for this query only
11225 <literal>SIZE       </literal>  set the limit for the number of entries returned
11226 <literal>TIME       </literal>  set the maximum waiting time for a query
11227 </literallayout>
11228 <para>
11229 The value of the DEREFERENCE parameter must be one of the words <quote>never</quote>,
11230 <quote>searching</quote>, <quote>finding</quote>, or <quote>always</quote>. The value of the REFERRALS parameter
11231 must be <quote>follow</quote> (the default) or <quote>nofollow</quote>. The latter stops the LDAP
11232 library from trying to follow referrals issued by the LDAP server.
11233 </para>
11234 <para>
11235 <indexterm role="concept">
11236 <primary>LDAP</primary>
11237 <secondary>timeout</secondary>
11238 </indexterm>
11239 <indexterm role="concept">
11240 <primary>timeout</primary>
11241 <secondary>LDAP lookup</secondary>
11242 </indexterm>
11243 The name CONNECT is an obsolete name for NETTIME, retained for
11244 backwards compatibility. This timeout (specified as a number of seconds) is
11245 enforced from the client end for operations that can be carried out over a
11246 network. Specifically, it applies to network connections and calls to the
11247 <emphasis>ldap_result()</emphasis> function. If the value is greater than zero, it is used if
11248 LDAP_OPT_NETWORK_TIMEOUT is defined in the LDAP headers (OpenLDAP), or
11249 if LDAP_X_OPT_CONNECT_TIMEOUT is defined in the LDAP headers (Netscape
11250 SDK 4.1). A value of zero forces an explicit setting of <quote>no timeout</quote> for
11251 Netscape SDK; for OpenLDAP no action is taken.
11252 </para>
11253 <para>
11254 The TIME parameter (also a number of seconds) is passed to the server to
11255 set a server-side limit on the time taken to complete a search.
11256 </para>
11257 <para>
11258 The SERVERS parameter allows you to specify an alternate list of ldap servers
11259 to use for an individual lookup.  The global <option>ldap_default_servers</option> option provides a
11260 default list of ldap servers, and a single lookup can specify a single ldap
11261 server to use.  But when you need to do a lookup with a list of servers that is
11262 different than the default list (maybe different order, maybe a completely
11263 different set of servers), the SERVERS parameter allows you to specify this
11264 alternate list (colon-separated).
11265 </para>
11266 <para>
11267 Here is an example of an LDAP query in an Exim lookup that uses some of these
11268 values. This is a single line, folded to fit on the page:
11269 </para>
11270 <literallayout class="monospaced">
11271 ${lookup ldap
11272   {user="cn=manager,o=University of Cambridge,c=UK" pass=secret
11273   ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=foo)}
11274   {$value}fail}
11275 </literallayout>
11276 <para>
11277 The encoding of spaces as <literal>%20</literal> is a URL thing which should not be done for
11278 any of the auxiliary data. Exim configuration settings that include lookups
11279 which contain password information should be preceded by <quote>hide</quote> to prevent
11280 non-admin users from using the <option>-bP</option> option to see their values.
11281 </para>
11282 <para>
11283 The auxiliary data items may be given in any order. The default is no
11284 connection timeout (the system timeout is used), no user or password, no limit
11285 on the number of entries returned, and no time limit on queries.
11286 </para>
11287 <para>
11288 When a DN is quoted in the USER= setting for LDAP authentication, Exim
11289 removes any URL quoting that it may contain before passing it LDAP. Apparently
11290 some libraries do this for themselves, but some do not. Removing the URL
11291 quoting has two advantages:
11292 </para>
11293 <itemizedlist>
11294 <listitem>
11295 <para>
11296 It makes it possible to use the same <option>quote_ldap_dn</option> expansion for USER=
11297 DNs as with DNs inside actual queries.
11298 </para>
11299 </listitem>
11300 <listitem>
11301 <para>
11302 It permits spaces inside USER= DNs.
11303 </para>
11304 </listitem>
11305 </itemizedlist>
11306 <para>
11307 For example, a setting such as
11308 </para>
11309 <literallayout class="monospaced">
11310 USER=cn=${quote_ldap_dn:$1}
11311 </literallayout>
11312 <para>
11313 should work even if <varname>$1</varname> contains spaces.
11314 </para>
11315 <para>
11316 Expanded data for the PASS= value should be quoted using the <option>quote</option>
11317 expansion operator, rather than the LDAP quote operators. The only reason this
11318 field needs quoting is to ensure that it conforms to the Exim syntax, which
11319 does not allow unquoted spaces. For example:
11320 </para>
11321 <literallayout class="monospaced">
11322 PASS=${quote:$3}
11323 </literallayout>
11324 <para>
11325 The LDAP authentication mechanism can be used to check passwords as part of
11326 SMTP authentication. See the <option>ldapauth</option> expansion string condition in chapter
11327 <xref linkend="CHAPexpand"/>.
11328 </para>
11329 </section>
11330 <section id="SECID71">
11331 <title>Format of data returned by LDAP</title>
11332 <para>
11333 <indexterm role="concept">
11334 <primary>LDAP</primary>
11335 <secondary>returned data formats</secondary>
11336 </indexterm>
11337 The <command>ldapdn</command> lookup type returns the Distinguished Name from a single entry
11338 as a sequence of values, for example
11339 </para>
11340 <literallayout class="monospaced">
11341 cn=manager,o=University of Cambridge,c=UK
11342 </literallayout>
11343 <para>
11344 The <command>ldap</command> lookup type generates an error if more than one entry matches the
11345 search filter, whereas <command>ldapm</command> permits this case, and inserts a newline in
11346 the result between the data from different entries. It is possible for multiple
11347 values to be returned for both <command>ldap</command> and <command>ldapm</command>, but in the former case
11348 you know that whatever values are returned all came from a single entry in the
11349 directory.
11350 </para>
11351 <para>
11352 In the common case where you specify a single attribute in your LDAP query, the
11353 result is not quoted, and does not contain the attribute name. If the attribute
11354 has multiple values, they are separated by commas. Any comma that is
11355 part of an attribute&#x2019;s value is doubled.
11356 </para>
11357 <para>
11358 If you specify multiple attributes, the result contains space-separated, quoted
11359 strings, each preceded by the attribute name and an equals sign. Within the
11360 quotes, the quote character, backslash, and newline are escaped with
11361 backslashes, and commas are used to separate multiple values for the attribute.
11362 Any commas in attribute values are doubled
11363 (permitting treatment of the values as a comma-separated list).
11364 Apart from the escaping, the string within quotes takes the same form as the
11365 output when a single attribute is requested. Specifying no attributes is the
11366 same as specifying all of an entry&#x2019;s attributes.
11367 </para>
11368 <para>
11369 Here are some examples of the output format. The first line of each pair is an
11370 LDAP query, and the second is the data that is returned. The attribute called
11371 <option>attr1</option> has two values, one of them with an embedded comma, whereas
11372 <option>attr2</option> has only one value. Both attributes are derived from <option>attr</option>
11373 (they have SUP <option>attr</option> in their schema definitions).
11374 </para>
11375 <literallayout class="monospaced">
11376 ldap:///o=base?attr1?sub?(uid=fred)
11377 value1.1,value1,,2
11378
11379 ldap:///o=base?attr2?sub?(uid=fred)
11380 value two
11381
11382 ldap:///o=base?attr?sub?(uid=fred)
11383 value1.1,value1,,2,value two
11384
11385 ldap:///o=base?attr1,attr2?sub?(uid=fred)
11386 attr1="value1.1,value1,,2" attr2="value two"
11387
11388 ldap:///o=base??sub?(uid=fred)
11389 objectClass="top" attr1="value1.1,value1,,2" attr2="value two"
11390 </literallayout>
11391 <para>
11392 You can
11393 make use of Exim&#x2019;s <option>-be</option> option to run expansion tests and thereby check the
11394 results of LDAP lookups.
11395 The <option>extract</option> operator in string expansions can be used to pick out
11396 individual fields from data that consists of <emphasis>key</emphasis>=<emphasis>value</emphasis> pairs.
11397 The <option>listextract</option> operator should be used to pick out individual values
11398 of attributes, even when only a single value is expected.
11399 The doubling of embedded commas allows you to use the returned data as a
11400 comma separated list (using the "&lt;," syntax for changing the input list separator).
11401 </para>
11402 </section>
11403 <section id="SECTnisplus">
11404 <title>More about NIS+</title>
11405 <para>
11406 <indexterm role="concept">
11407 <primary>NIS+ lookup type</primary>
11408 </indexterm>
11409 <indexterm role="concept">
11410 <primary>lookup</primary>
11411 <secondary>NIS+</secondary>
11412 </indexterm>
11413 NIS+ queries consist of a NIS+ <emphasis>indexed name</emphasis> followed by an optional colon
11414 and field name. If this is given, the result of a successful query is the
11415 contents of the named field; otherwise the result consists of a concatenation
11416 of <emphasis>field-name=field-value</emphasis> pairs, separated by spaces. Empty values and
11417 values containing spaces are quoted. For example, the query
11418 </para>
11419 <literallayout class="monospaced">
11420 [name=mg1456],passwd.org_dir
11421 </literallayout>
11422 <para>
11423 might return the string
11424 </para>
11425 <literallayout class="monospaced">
11426 name=mg1456 passwd="" uid=999 gid=999 gcos="Martin Guerre"
11427 home=/home/mg1456 shell=/bin/bash shadow=""
11428 </literallayout>
11429 <para>
11430 (split over two lines here to fit on the page), whereas
11431 </para>
11432 <literallayout class="monospaced">
11433 [name=mg1456],passwd.org_dir:gcos
11434 </literallayout>
11435 <para>
11436 would just return
11437 </para>
11438 <literallayout class="monospaced">
11439 Martin Guerre
11440 </literallayout>
11441 <para>
11442 with no quotes. A NIS+ lookup fails if NIS+ returns more than one table entry
11443 for the given indexed key. The effect of the <option>quote_nisplus</option> expansion
11444 operator is to double any quote characters within the text.
11445 </para>
11446 </section>
11447 <section id="SECTsql">
11448 <title>SQL lookups</title>
11449 <para>
11450 <indexterm role="concept">
11451 <primary>SQL lookup types</primary>
11452 </indexterm>
11453 <indexterm role="concept">
11454 <primary>MySQL</primary>
11455 <secondary>lookup type</secondary>
11456 </indexterm>
11457 <indexterm role="concept">
11458 <primary>PostgreSQL lookup type</primary>
11459 </indexterm>
11460 <indexterm role="concept">
11461 <primary>lookup</primary>
11462 <secondary>MySQL</secondary>
11463 </indexterm>
11464 <indexterm role="concept">
11465 <primary>lookup</primary>
11466 <secondary>PostgreSQL</secondary>
11467 </indexterm>
11468 <indexterm role="concept">
11469 <primary>Oracle</primary>
11470 <secondary>lookup type</secondary>
11471 </indexterm>
11472 <indexterm role="concept">
11473 <primary>lookup</primary>
11474 <secondary>Oracle</secondary>
11475 </indexterm>
11476 <indexterm role="concept">
11477 <primary>InterBase lookup type</primary>
11478 </indexterm>
11479 <indexterm role="concept">
11480 <primary>lookup</primary>
11481 <secondary>InterBase</secondary>
11482 </indexterm>
11483 <indexterm role="concept">
11484 <primary>Redis lookup type</primary>
11485 </indexterm>
11486 <indexterm role="concept">
11487 <primary>lookup</primary>
11488 <secondary>Redis</secondary>
11489 </indexterm>
11490 Exim can support lookups in InterBase, MySQL, Oracle, PostgreSQL, Redis,
11491 and SQLite
11492 databases. Queries for these databases contain SQL statements, so an example
11493 might be
11494 </para>
11495 <literallayout class="monospaced">
11496 ${lookup mysql{select mailbox from users where id='userx'}\
11497   {$value}fail}
11498 </literallayout>
11499 <para>
11500 If the result of the query contains more than one field, the data for each
11501 field in the row is returned, preceded by its name, so the result of
11502 </para>
11503 <literallayout class="monospaced">
11504 ${lookup pgsql{select home,name from users where id='userx'}\
11505   {$value}}
11506 </literallayout>
11507 <para>
11508 might be
11509 </para>
11510 <literallayout class="monospaced">
11511 home=/home/userx name="Mister X"
11512 </literallayout>
11513 <para>
11514 Empty values and values containing spaces are double quoted, with embedded
11515 quotes escaped by a backslash. If the result of the query contains just one
11516 field, the value is passed back verbatim, without a field name, for example:
11517 </para>
11518 <literallayout class="monospaced">
11519 Mister X
11520 </literallayout>
11521 <para>
11522 If the result of the query yields more than one row, it is all concatenated,
11523 with a newline between the data for each row.
11524 </para>
11525 </section>
11526 <section id="SECID72">
11527 <title>More about MySQL, PostgreSQL, Oracle, InterBase, and Redis</title>
11528 <para>
11529 <indexterm role="concept">
11530 <primary>MySQL</primary>
11531 <secondary>lookup type</secondary>
11532 </indexterm>
11533 <indexterm role="concept">
11534 <primary>PostgreSQL lookup type</primary>
11535 </indexterm>
11536 <indexterm role="concept">
11537 <primary>lookup</primary>
11538 <secondary>MySQL</secondary>
11539 </indexterm>
11540 <indexterm role="concept">
11541 <primary>lookup</primary>
11542 <secondary>PostgreSQL</secondary>
11543 </indexterm>
11544 <indexterm role="concept">
11545 <primary>Oracle</primary>
11546 <secondary>lookup type</secondary>
11547 </indexterm>
11548 <indexterm role="concept">
11549 <primary>lookup</primary>
11550 <secondary>Oracle</secondary>
11551 </indexterm>
11552 <indexterm role="concept">
11553 <primary>InterBase lookup type</primary>
11554 </indexterm>
11555 <indexterm role="concept">
11556 <primary>lookup</primary>
11557 <secondary>InterBase</secondary>
11558 </indexterm>
11559 <indexterm role="concept">
11560 <primary>Redis lookup type</primary>
11561 </indexterm>
11562 <indexterm role="concept">
11563 <primary>lookup</primary>
11564 <secondary>Redis</secondary>
11565 </indexterm>
11566 If any MySQL, PostgreSQL, Oracle, InterBase or Redis lookups are used, the
11567 <option>mysql_servers</option>, <option>pgsql_servers</option>, <option>oracle_servers</option>, <option>ibase_servers</option>,
11568 or <option>redis_servers</option>
11569 option (as appropriate) must be set to a colon-separated list of server
11570 information.
11571 (For MySQL and PostgreSQL, the global option need not be set if all
11572 queries contain their own server information &ndash; see section
11573 <xref linkend="SECTspeserque"/>.)
11574 For all but Redis
11575 each item in the list is a slash-separated list of four
11576 items: host name, database name, user name, and password. In the case of
11577 Oracle, the host name field is used for the <quote>service name</quote>, and the database
11578 name field is not used and should be empty. For example:
11579 </para>
11580 <literallayout class="monospaced">
11581 hide oracle_servers = oracle.plc.example//userx/abcdwxyz
11582 </literallayout>
11583 <para>
11584 Because password data is sensitive, you should always precede the setting with
11585 <quote>hide</quote>, to prevent non-admin users from obtaining the setting via the <option>-bP</option>
11586 option. Here is an example where two MySQL servers are listed:
11587 </para>
11588 <literallayout class="monospaced">
11589 hide mysql_servers = localhost/users/root/secret:\
11590                      otherhost/users/root/othersecret
11591 </literallayout>
11592 <para>
11593 For MySQL and PostgreSQL, a host may be specified as &lt;<emphasis>name</emphasis>&gt;:&lt;<emphasis>port</emphasis>&gt; but
11594 because this is a colon-separated list, the colon has to be doubled. For each
11595 query, these parameter groups are tried in order until a connection is made and
11596 a query is successfully processed. The result of a query may be that no data is
11597 found, but that is still a successful query. In other words, the list of
11598 servers provides a backup facility, not a list of different places to look.
11599 </para>
11600 <para>
11601 For Redis the global option need not be specified if all queries contain their
11602 own server information &ndash; see section <xref linkend="SECTspeserque"/>.
11603 If specified, the option must be set to a colon-separated list of server
11604 information.
11605 Each item in the list is a slash-separated list of three items:
11606 host, database number, and password.
11607 </para>
11608 <orderedlist numeration="arabic">
11609 <listitem>
11610 <para>
11611 The host is required and may be either an IPv4 address and optional
11612 port number (separated by a colon, which needs doubling due to the
11613 higher-level list), or a Unix socket pathname enclosed in parentheses
11614 </para>
11615 </listitem>
11616 <listitem>
11617 <para>
11618 The database number is optional; if present that number is selected in the backend
11619 </para>
11620 </listitem>
11621 <listitem>
11622 <para>
11623 The password is optional; if present it is used to authenticate to the backend
11624 </para>
11625 </listitem>
11626 </orderedlist>
11627 <para>
11628 The <option>quote_mysql</option>, <option>quote_pgsql</option>, and <option>quote_oracle</option> expansion operators
11629 convert newline, tab, carriage return, and backspace to \n, \t, \r, and \b
11630 respectively, and the characters single-quote, double-quote, and backslash
11631 itself are escaped with backslashes.
11632 </para>
11633 <para>
11634 The <option>quote_redis</option> expansion operator
11635 escapes whitespace and backslash characters with a backslash.
11636 </para>
11637 </section>
11638 <section id="SECTspeserque">
11639 <title>Specifying the server in the query</title>
11640 <para>
11641 For MySQL, PostgreSQL and Redis lookups (but not currently for Oracle and InterBase),
11642 it is possible to specify a list of servers with an individual query. This is
11643 done by starting the query with
11644 </para>
11645 <literallayout>
11646 <literal>servers=</literal><emphasis>server1:server2:server3:...</emphasis><literal>;</literal>
11647 </literallayout>
11648 <para>
11649 Each item in the list may take one of two forms:
11650 </para>
11651 <orderedlist numeration="arabic">
11652 <listitem>
11653 <para>
11654 If it contains no slashes it is assumed to be just a host name. The appropriate
11655 global option (<option>mysql_servers</option> or <option>pgsql_servers</option>) is searched for a host
11656 of the same name, and the remaining parameters (database, user, password) are
11657 taken from there.
11658 </para>
11659 </listitem>
11660 <listitem>
11661 <para>
11662 If it contains any slashes, it is taken as a complete parameter set.
11663 </para>
11664 </listitem>
11665 </orderedlist>
11666 <para>
11667 The list of servers is used in exactly the same way as the global list.
11668 Once a connection to a server has happened and a query has been
11669 successfully executed, processing of the lookup ceases.
11670 </para>
11671 <para>
11672 This feature is intended for use in master/slave situations where updates
11673 are occurring and you want to update the master rather than a slave. If the
11674 master is in the list as a backup for reading, you might have a global setting
11675 like this:
11676 </para>
11677 <literallayout class="monospaced">
11678 mysql_servers = slave1/db/name/pw:\
11679                 slave2/db/name/pw:\
11680                 master/db/name/pw
11681 </literallayout>
11682 <para>
11683 In an updating lookup, you could then write:
11684 </para>
11685 <literallayout class="monospaced">
11686 ${lookup mysql{servers=master; UPDATE ...} }
11687 </literallayout>
11688 <para>
11689 That query would then be sent only to the master server. If, on the other hand,
11690 the master is not to be used for reading, and so is not present in the global
11691 option, you can still update it by a query of this form:
11692 </para>
11693 <literallayout class="monospaced">
11694 ${lookup pgsql{servers=master/db/name/pw; UPDATE ...} }
11695 </literallayout>
11696 </section>
11697 <section id="SECID73">
11698 <title>Special MySQL features</title>
11699 <para>
11700 For MySQL, an empty host name or the use of <quote>localhost</quote> in <option>mysql_servers</option>
11701 causes a connection to the server on the local host by means of a Unix domain
11702 socket. An alternate socket can be specified in parentheses.
11703 An option group name for MySQL option files can be specified in square brackets;
11704 the default value is <quote>exim</quote>.
11705 The full syntax of each item in <option>mysql_servers</option> is:
11706 </para>
11707 <literallayout>
11708 &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;
11709 </literallayout>
11710 <para>
11711 Any of the four sub-parts of the first field can be omitted. For normal use on
11712 the local host it can be left blank or set to just <quote>localhost</quote>.
11713 </para>
11714 <para>
11715 No database need be supplied &ndash; but if it is absent here, it must be given in
11716 the queries.
11717 </para>
11718 <para>
11719 If a MySQL query is issued that does not request any data (an insert, update,
11720 or delete command), the result of the lookup is the number of rows affected.
11721 </para>
11722 <para>
11723 <emphasis role="bold">Warning</emphasis>: This can be misleading. If an update does not actually change
11724 anything (for example, setting a field to the value it already has), the result
11725 is zero because no rows are affected.
11726 </para>
11727 </section>
11728 <section id="SECID74">
11729 <title>Special PostgreSQL features</title>
11730 <para>
11731 PostgreSQL lookups can also use Unix domain socket connections to the database.
11732 This is usually faster and costs less CPU time than a TCP/IP connection.
11733 However it can be used only if the mail server runs on the same machine as the
11734 database server. A configuration line for PostgreSQL via Unix domain sockets
11735 looks like this:
11736 </para>
11737 <literallayout class="monospaced">
11738 hide pgsql_servers = (/tmp/.s.PGSQL.5432)/db/user/password : ...
11739 </literallayout>
11740 <para>
11741 In other words, instead of supplying a host name, a path to the socket is
11742 given. The path name is enclosed in parentheses so that its slashes aren&#x2019;t
11743 visually confused with the delimiters for the other server parameters.
11744 </para>
11745 <para>
11746 If a PostgreSQL query is issued that does not request any data (an insert,
11747 update, or delete command), the result of the lookup is the number of rows
11748 affected.
11749 </para>
11750 </section>
11751 <section id="SECTsqlite">
11752 <title>More about SQLite</title>
11753 <para>
11754 <indexterm role="concept">
11755 <primary>lookup</primary>
11756 <secondary>SQLite</secondary>
11757 </indexterm>
11758 <indexterm role="concept">
11759 <primary>sqlite lookup type</primary>
11760 </indexterm>
11761 SQLite is different to the other SQL lookups because a file name is required in
11762 addition to the SQL query. An SQLite database is a single file, and there is no
11763 daemon as in the other SQL databases. The interface to Exim requires the name
11764 of the file, as an absolute path, to be given at the start of the query. It is
11765 separated from the query by white space. This means that the path name cannot
11766 contain white space. Here is a lookup expansion example:
11767 </para>
11768 <literallayout class="monospaced">
11769 ${lookup sqlite {/some/thing/sqlitedb \
11770   select name from aliases where id='userx';}}
11771 </literallayout>
11772 <para>
11773 In a list, the syntax is similar. For example:
11774 </para>
11775 <literallayout class="monospaced">
11776 domainlist relay_to_domains = sqlite;/some/thing/sqlitedb \
11777    select * from relays where ip='$sender_host_address';
11778 </literallayout>
11779 <para>
11780 The only character affected by the <option>quote_sqlite</option> operator is a single
11781 quote, which it doubles.
11782 </para>
11783 <para>
11784 <indexterm role="concept">
11785 <primary>timeout</primary>
11786 <secondary>SQLite</secondary>
11787 </indexterm>
11788 <indexterm role="concept">
11789 <primary>sqlite</primary>
11790 <secondary>lookup timeout</secondary>
11791 </indexterm>
11792 The SQLite library handles multiple simultaneous accesses to the database
11793 internally. Multiple readers are permitted, but only one process can
11794 update at once. Attempts to access the database while it is being updated
11795 are rejected after a timeout period, during which the SQLite library
11796 waits for the lock to be released. In Exim, the default timeout is set
11797 to 5 seconds, but it can be changed by means of the <option>sqlite_lock_timeout</option>
11798 option.
11799 </para>
11800 </section>
11801 <section id="SECTredis">
11802 <title>More about Redis</title>
11803 <para>
11804 <indexterm role="concept">
11805 <primary>lookup</primary>
11806 <secondary>Redis</secondary>
11807 </indexterm>
11808 <indexterm role="concept">
11809 <primary>redis lookup type</primary>
11810 </indexterm>
11811 Redis is a non-SQL database. Commands are simple get and set.
11812 Examples:
11813 </para>
11814 <literallayout class="monospaced">
11815 ${lookup redis{set keyname ${quote_redis:objvalue plus}}}
11816 ${lookup redis{get keyname}}
11817 </literallayout>
11818 <para>
11819 <indexterm role="concept" startref="IIDfidalo1" class="endofrange"/>
11820 <indexterm role="concept" startref="IIDfidalo2" class="endofrange"/>
11821 </para>
11822 </section>
11823 </chapter>
11824
11825 <chapter id="CHAPdomhosaddlists">
11826 <title>Domain, host, address, and local part lists</title>
11827 <titleabbrev>Domain, host, and address lists</titleabbrev>
11828 <para>
11829 <indexterm role="concept" id="IIDdohoadli" class="startofrange">
11830 <primary>lists of domains; hosts; etc.</primary>
11831 </indexterm>
11832 A number of Exim configuration options contain lists of domains, hosts,
11833 email addresses, or local parts. For example, the <option>hold_domains</option> option
11834 contains a list of domains whose delivery is currently suspended. These lists
11835 are also used as data in ACL statements (see chapter <xref linkend="CHAPACL"/>), and as
11836 arguments to expansion conditions such as <option>match_domain</option>.
11837 </para>
11838 <para>
11839 Each item in one of these lists is a pattern to be matched against a domain,
11840 host, email address, or local part, respectively. In the sections below, the
11841 different types of pattern for each case are described, but first we cover some
11842 general facilities that apply to all four kinds of list.
11843 </para>
11844 <para>
11845 Note that other parts of Exim use a <emphasis>string list</emphasis> which does not
11846 support all the complexity available in
11847 domain, host, address and local part lists.
11848 </para>
11849 <section id="SECTlistexpand">
11850 <title>Expansion of lists</title>
11851 <para>
11852 <indexterm role="concept">
11853 <primary>expansion</primary>
11854 <secondary>of lists</secondary>
11855 </indexterm>
11856 Each list is expanded as a single string before it is used.
11857 </para>
11858 <para>
11859 <emphasis>Exception: the router headers_remove option, where list-item
11860 splitting is done before string-expansion.</emphasis>
11861 </para>
11862 <para>
11863 The result of
11864 expansion must be a list, possibly containing empty items, which is split up
11865 into separate items for matching. By default, colon is the separator character,
11866 but this can be varied if necessary. See sections <xref linkend="SECTlistconstruct"/> and
11867 <xref linkend="SECTempitelis"/> for details of the list syntax; the second of these
11868 discusses the way to specify empty list items.
11869 </para>
11870 <para>
11871 If the string expansion is forced to fail, Exim behaves as if the item it is
11872 testing (domain, host, address, or local part) is not in the list. Other
11873 expansion failures cause temporary errors.
11874 </para>
11875 <para>
11876 If an item in a list is a regular expression, backslashes, dollars and possibly
11877 other special characters in the expression must be protected against
11878 misinterpretation by the string expander. The easiest way to do this is to use
11879 the <literal>\N</literal> expansion feature to indicate that the contents of the regular
11880 expression should not be expanded. For example, in an ACL you might have:
11881 </para>
11882 <literallayout class="monospaced">
11883 deny senders = \N^\d{8}\w@.*\.baddomain\.example$\N : \
11884                ${lookup{$domain}lsearch{/badsenders/bydomain}}
11885 </literallayout>
11886 <para>
11887 The first item is a regular expression that is protected from expansion by
11888 <literal>\N</literal>, whereas the second uses the expansion to obtain a list of unwanted
11889 senders based on the receiving domain.
11890 </para>
11891 </section>
11892 <section id="SECID76">
11893 <title>Negated items in lists</title>
11894 <para>
11895 <indexterm role="concept">
11896 <primary>list</primary>
11897 <secondary>negation</secondary>
11898 </indexterm>
11899 <indexterm role="concept">
11900 <primary>negation</primary>
11901 <secondary>in lists</secondary>
11902 </indexterm>
11903 Items in a list may be positive or negative. Negative items are indicated by a
11904 leading exclamation mark, which may be followed by optional white space. A list
11905 defines a set of items (domains, etc). When Exim processes one of these lists,
11906 it is trying to find out whether a domain, host, address, or local part
11907 (respectively) is in the set that is defined by the list. It works like this:
11908 </para>
11909 <para>
11910 The list is scanned from left to right. If a positive item is matched, the
11911 subject that is being checked is in the set; if a negative item is matched, the
11912 subject is not in the set. If the end of the list is reached without the
11913 subject having matched any of the patterns, it is in the set if the last item
11914 was a negative one, but not if it was a positive one. For example, the list in
11915 </para>
11916 <literallayout class="monospaced">
11917 domainlist relay_to_domains = !a.b.c : *.b.c
11918 </literallayout>
11919 <para>
11920 matches any domain ending in <emphasis>.b.c</emphasis> except for <emphasis>a.b.c</emphasis>. Domains that match
11921 neither <emphasis>a.b.c</emphasis> nor <emphasis>*.b.c</emphasis> do not match, because the last item in the
11922 list is positive. However, if the setting were
11923 </para>
11924 <literallayout class="monospaced">
11925 domainlist relay_to_domains = !a.b.c
11926 </literallayout>
11927 <para>
11928 then all domains other than <emphasis>a.b.c</emphasis> would match because the last item in the
11929 list is negative. In other words, a list that ends with a negative item behaves
11930 as if it had an extra item <literal>:*</literal> on the end.
11931 </para>
11932 <para>
11933 Another way of thinking about positive and negative items in lists is to read
11934 the connector as <quote>or</quote> after a positive item and as <quote>and</quote> after a negative
11935 item.
11936 </para>
11937 </section>
11938 <section id="SECTfilnamlis">
11939 <title>File names in lists</title>
11940 <para>
11941 <indexterm role="concept">
11942 <primary>list</primary>
11943 <secondary>file name in</secondary>
11944 </indexterm>
11945 If an item in a domain, host, address, or local part list is an absolute file
11946 name (beginning with a slash character), each line of the file is read and
11947 processed as if it were an independent item in the list, except that further
11948 file names are not allowed,
11949 and no expansion of the data from the file takes place.
11950 Empty lines in the file are ignored, and the file may also contain comment
11951 lines:
11952 </para>
11953 <itemizedlist>
11954 <listitem>
11955 <para>
11956 For domain and host lists, if a # character appears anywhere in a line of the
11957 file, it and all following characters are ignored.
11958 </para>
11959 </listitem>
11960 <listitem>
11961 <para>
11962 Because local parts may legitimately contain # characters, a comment in an
11963 address list or local part list file is recognized only if # is preceded by
11964 white space or the start of the line. For example:
11965 </para>
11966 <literallayout class="monospaced">
11967 not#comment@x.y.z   # but this is a comment
11968 </literallayout>
11969 </listitem>
11970 </itemizedlist>
11971 <para>
11972 Putting a file name in a list has the same effect as inserting each line of the
11973 file as an item in the list (blank lines and comments excepted). However, there
11974 is one important difference: the file is read each time the list is processed,
11975 so if its contents vary over time, Exim&#x2019;s behaviour changes.
11976 </para>
11977 <para>
11978 If a file name is preceded by an exclamation mark, the sense of any match
11979 within the file is inverted. For example, if
11980 </para>
11981 <literallayout class="monospaced">
11982 hold_domains = !/etc/nohold-domains
11983 </literallayout>
11984 <para>
11985 and the file contains the lines
11986 </para>
11987 <literallayout class="monospaced">
11988 !a.b.c
11989 *.b.c
11990 </literallayout>
11991 <para>
11992 then <emphasis>a.b.c</emphasis> is in the set of domains defined by <option>hold_domains</option>, whereas
11993 any domain matching <literal>*.b.c</literal> is not.
11994 </para>
11995 </section>
11996 <section id="SECID77">
11997 <title>An lsearch file is not an out-of-line list</title>
11998 <para>
11999 As will be described in the sections that follow, lookups can be used in lists
12000 to provide indexed methods of checking list membership. There has been some
12001 confusion about the way <command>lsearch</command> lookups work in lists. Because
12002 an <command>lsearch</command> file contains plain text and is scanned sequentially, it is
12003 sometimes thought that it is allowed to contain wild cards and other kinds of
12004 non-constant pattern. This is not the case. The keys in an <command>lsearch</command> file are
12005 always fixed strings, just as for any other single-key lookup type.
12006 </para>
12007 <para>
12008 If you want to use a file to contain wild-card patterns that form part of a
12009 list, just give the file name on its own, without a search type, as described
12010 in the previous section. You could also use the <command>wildlsearch</command> or
12011 <command>nwildlsearch</command>, but there is no advantage in doing this.
12012 </para>
12013 </section>
12014 <section id="SECTnamedlists">
12015 <title>Named lists</title>
12016 <para>
12017 <indexterm role="concept">
12018 <primary>named lists</primary>
12019 </indexterm>
12020 <indexterm role="concept">
12021 <primary>list</primary>
12022 <secondary>named</secondary>
12023 </indexterm>
12024 A list of domains, hosts, email addresses, or local parts can be given a name
12025 which is then used to refer to the list elsewhere in the configuration. This is
12026 particularly convenient if the same list is required in several different
12027 places. It also allows lists to be given meaningful names, which can improve
12028 the readability of the configuration. For example, it is conventional to define
12029 a domain list called <emphasis>local_domains</emphasis> for all the domains that are handled
12030 locally on a host, using a configuration line such as
12031 </para>
12032 <literallayout class="monospaced">
12033 domainlist local_domains = localhost:my.dom.example
12034 </literallayout>
12035 <para>
12036 Named lists are referenced by giving their name preceded by a plus sign, so,
12037 for example, a router that is intended to handle local domains would be
12038 configured with the line
12039 </para>
12040 <literallayout class="monospaced">
12041 domains = +local_domains
12042 </literallayout>
12043 <para>
12044 The first router in a configuration is often one that handles all domains
12045 except the local ones, using a configuration with a negated item like this:
12046 </para>
12047 <literallayout class="monospaced">
12048 dnslookup:
12049   driver = dnslookup
12050   domains = ! +local_domains
12051   transport = remote_smtp
12052   no_more
12053 </literallayout>
12054 <para>
12055 The four kinds of named list are created by configuration lines starting with
12056 the words <option>domainlist</option>, <option>hostlist</option>, <option>addresslist</option>, or <option>localpartlist</option>,
12057 respectively. Then there follows the name that you are defining, followed by an
12058 equals sign and the list itself. For example:
12059 </para>
12060 <literallayout class="monospaced">
12061 hostlist    relay_from_hosts = 192.168.23.0/24 : my.friend.example
12062 addresslist bad_senders = cdb;/etc/badsenders
12063 </literallayout>
12064 <para>
12065 A named list may refer to other named lists:
12066 </para>
12067 <literallayout class="monospaced">
12068 domainlist  dom1 = first.example : second.example
12069 domainlist  dom2 = +dom1 : third.example
12070 domainlist  dom3 = fourth.example : +dom2 : fifth.example
12071 </literallayout>
12072 <para>
12073 <emphasis role="bold">Warning</emphasis>: If the last item in a referenced list is a negative one, the
12074 effect may not be what you intended, because the negation does not propagate
12075 out to the higher level. For example, consider:
12076 </para>
12077 <literallayout class="monospaced">
12078 domainlist  dom1 = !a.b
12079 domainlist  dom2 = +dom1 : *.b
12080 </literallayout>
12081 <para>
12082 The second list specifies <quote>either in the <option>dom1</option> list or <emphasis>*.b</emphasis></quote>. The first
12083 list specifies just <quote>not <emphasis>a.b</emphasis></quote>, so the domain <emphasis>x.y</emphasis> matches it. That
12084 means it matches the second list as well. The effect is not the same as
12085 </para>
12086 <literallayout class="monospaced">
12087 domainlist  dom2 = !a.b : *.b
12088 </literallayout>
12089 <para>
12090 where <emphasis>x.y</emphasis> does not match. It&#x2019;s best to avoid negation altogether in
12091 referenced lists if you can.
12092 </para>
12093 <para>
12094 Named lists may have a performance advantage. When Exim is routing an
12095 address or checking an incoming message, it caches the result of tests on named
12096 lists. So, if you have a setting such as
12097 </para>
12098 <literallayout class="monospaced">
12099 domains = +local_domains
12100 </literallayout>
12101 <para>
12102 on several of your routers
12103 or in several ACL statements,
12104 the actual test is done only for the first one. However, the caching works only
12105 if there are no expansions within the list itself or any sublists that it
12106 references. In other words, caching happens only for lists that are known to be
12107 the same each time they are referenced.
12108 </para>
12109 <para>
12110 By default, there may be up to 16 named lists of each type. This limit can be
12111 extended by changing a compile-time variable. The use of domain and host lists
12112 is recommended for concepts such as local domains, relay domains, and relay
12113 hosts. The default configuration is set up like this.
12114 </para>
12115 </section>
12116 <section id="SECID78">
12117 <title>Named lists compared with macros</title>
12118 <para>
12119 <indexterm role="concept">
12120 <primary>list</primary>
12121 <secondary>named compared with macro</secondary>
12122 </indexterm>
12123 <indexterm role="concept">
12124 <primary>macro</primary>
12125 <secondary>compared with named list</secondary>
12126 </indexterm>
12127 At first sight, named lists might seem to be no different from macros in the
12128 configuration file. However, macros are just textual substitutions. If you
12129 write
12130 </para>
12131 <literallayout class="monospaced">
12132 ALIST = host1 : host2
12133 auth_advertise_hosts = !ALIST
12134 </literallayout>
12135 <para>
12136 it probably won&#x2019;t do what you want, because that is exactly the same as
12137 </para>
12138 <literallayout class="monospaced">
12139 auth_advertise_hosts = !host1 : host2
12140 </literallayout>
12141 <para>
12142 Notice that the second host name is not negated. However, if you use a host
12143 list, and write
12144 </para>
12145 <literallayout class="monospaced">
12146 hostlist alist = host1 : host2
12147 auth_advertise_hosts = ! +alist
12148 </literallayout>
12149 <para>
12150 the negation applies to the whole list, and so that is equivalent to
12151 </para>
12152 <literallayout class="monospaced">
12153 auth_advertise_hosts = !host1 : !host2
12154 </literallayout>
12155 </section>
12156 <section id="SECID79">
12157 <title>Named list caching</title>
12158 <para>
12159 <indexterm role="concept">
12160 <primary>list</primary>
12161 <secondary>caching of named</secondary>
12162 </indexterm>
12163 <indexterm role="concept">
12164 <primary>caching</primary>
12165 <secondary>named lists</secondary>
12166 </indexterm>
12167 While processing a message, Exim caches the result of checking a named list if
12168 it is sure that the list is the same each time. In practice, this means that
12169 the cache operates only if the list contains no $ characters, which guarantees
12170 that it will not change when it is expanded. Sometimes, however, you may have
12171 an expanded list that you know will be the same each time within a given
12172 message. For example:
12173 </para>
12174 <literallayout class="monospaced">
12175 domainlist special_domains = \
12176            ${lookup{$sender_host_address}cdb{/some/file}}
12177 </literallayout>
12178 <para>
12179 This provides a list of domains that depends only on the sending host&#x2019;s IP
12180 address. If this domain list is referenced a number of times (for example,
12181 in several ACL lines, or in several routers) the result of the check is not
12182 cached by default, because Exim does not know that it is going to be the
12183 same list each time.
12184 </para>
12185 <para>
12186 By appending <literal>_cache</literal> to <literal>domainlist</literal> you can tell Exim to go ahead and
12187 cache the result anyway. For example:
12188 </para>
12189 <literallayout class="monospaced">
12190 domainlist_cache special_domains = ${lookup{...
12191 </literallayout>
12192 <para>
12193 If you do this, you should be absolutely sure that caching is going to do
12194 the right thing in all cases. When in doubt, leave it out.
12195 </para>
12196 </section>
12197 <section id="SECTdomainlist">
12198 <title>Domain lists</title>
12199 <para>
12200 <indexterm role="concept">
12201 <primary>domain list</primary>
12202 <secondary>patterns for</secondary>
12203 </indexterm>
12204 <indexterm role="concept">
12205 <primary>list</primary>
12206 <secondary>domain list</secondary>
12207 </indexterm>
12208 Domain lists contain patterns that are to be matched against a mail domain.
12209 The following types of item may appear in domain lists:
12210 </para>
12211 <itemizedlist>
12212 <listitem>
12213 <para>
12214 <indexterm role="concept">
12215 <primary>primary host name</primary>
12216 </indexterm>
12217 <indexterm role="concept">
12218 <primary>host name</primary>
12219 <secondary>matched in domain list</secondary>
12220 </indexterm>
12221 <indexterm role="option">
12222 <primary><option>primary_hostname</option></primary>
12223 </indexterm>
12224 <indexterm role="concept">
12225 <primary>domain list</primary>
12226 <secondary>matching primary host name</secondary>
12227 </indexterm>
12228 <indexterm role="concept">
12229 <primary>@ in a domain list</primary>
12230 </indexterm>
12231 If a pattern consists of a single @ character, it matches the local host name,
12232 as set by the <option>primary_hostname</option> option (or defaulted). This makes it
12233 possible to use the same configuration file on several different hosts that
12234 differ only in their names.
12235 </para>
12236 </listitem>
12237 <listitem>
12238 <para>
12239 <indexterm role="concept">
12240 <primary>@[] in a domain list</primary>
12241 </indexterm>
12242 <indexterm role="concept">
12243 <primary>domain list</primary>
12244 <secondary>matching local IP interfaces</secondary>
12245 </indexterm>
12246 <indexterm role="concept">
12247 <primary>domain literal</primary>
12248 </indexterm>
12249 If a pattern consists of the string <literal>@[]</literal> it matches an IP address enclosed
12250 in square brackets (as in an email address that contains a domain literal), but
12251 only if that IP address is recognized as local for email routing purposes. The
12252 <option>local_interfaces</option> and <option>extra_local_interfaces</option> options can be used to
12253 control which of a host&#x2019;s several IP addresses are treated as local.
12254 In today&#x2019;s Internet, the use of domain literals is controversial.
12255 </para>
12256 </listitem>
12257 <listitem>
12258 <para>
12259 <indexterm role="concept">
12260 <primary>@mx_any</primary>
12261 </indexterm>
12262 <indexterm role="concept">
12263 <primary>@mx_primary</primary>
12264 </indexterm>
12265 <indexterm role="concept">
12266 <primary>@mx_secondary</primary>
12267 </indexterm>
12268 <indexterm role="concept">
12269 <primary>domain list</primary>
12270 <secondary>matching MX pointers to local host</secondary>
12271 </indexterm>
12272 If a pattern consists of the string <literal>@mx_any</literal> it matches any domain that
12273 has an MX record pointing to the local host or to any host that is listed in
12274 <indexterm role="option">
12275 <primary><option>hosts_treat_as_local</option></primary>
12276 </indexterm>
12277 <option>hosts_treat_as_local</option>. The items <literal>@mx_primary</literal> and <literal>@mx_secondary</literal>
12278 are similar, except that the first matches only when a primary MX target is the
12279 local host, and the second only when no primary MX target is the local host,
12280 but a secondary MX target is. <quote>Primary</quote> means an MX record with the lowest
12281 preference value &ndash; there may of course be more than one of them.
12282 </para>
12283 <para>
12284 The MX lookup that takes place when matching a pattern of this type is
12285 performed with the resolver options for widening names turned off. Thus, for
12286 example, a single-component domain will <emphasis>not</emphasis> be expanded by adding the
12287 resolver&#x2019;s default domain. See the <option>qualify_single</option> and <option>search_parents</option>
12288 options of the <command>dnslookup</command> router for a discussion of domain widening.
12289 </para>
12290 <para>
12291 Sometimes you may want to ignore certain IP addresses when using one of these
12292 patterns. You can specify this by following the pattern with <literal>/ignore=</literal>&lt;<emphasis>ip
12293 list</emphasis>&gt;, where &lt;<emphasis>ip list</emphasis>&gt; is a list of IP addresses. These addresses are
12294 ignored when processing the pattern (compare the <option>ignore_target_hosts</option> option
12295 on a router). For example:
12296 </para>
12297 <literallayout class="monospaced">
12298 domains = @mx_any/ignore=127.0.0.1
12299 </literallayout>
12300 <para>
12301 This example matches any domain that has an MX record pointing to one of
12302 the local host&#x2019;s IP addresses other than 127.0.0.1.
12303 </para>
12304 <para>
12305 The list of IP addresses is in fact processed by the same code that processes
12306 host lists, so it may contain CIDR-coded network specifications and it may also
12307 contain negative items.
12308 </para>
12309 <para>
12310 Because the list of IP addresses is a sublist within a domain list, you have to
12311 be careful about delimiters if there is more than one address. Like any other
12312 list, the default delimiter can be changed. Thus, you might have:
12313 </para>
12314 <literallayout class="monospaced">
12315 domains = @mx_any/ignore=&lt;;127.0.0.1;0.0.0.0 : \
12316           an.other.domain : ...
12317 </literallayout>
12318 <para>
12319 so that the sublist uses semicolons for delimiters. When IPv6 addresses are
12320 involved, it is easiest to change the delimiter for the main list as well:
12321 </para>
12322 <literallayout class="monospaced">
12323 domains = &lt;? @mx_any/ignore=&lt;;127.0.0.1;::1 ? \
12324           an.other.domain ? ...
12325 </literallayout>
12326 </listitem>
12327 <listitem>
12328 <para>
12329 <indexterm role="concept">
12330 <primary>asterisk</primary>
12331 <secondary>in domain list</secondary>
12332 </indexterm>
12333 <indexterm role="concept">
12334 <primary>domain list</primary>
12335 <secondary>asterisk in</secondary>
12336 </indexterm>
12337 <indexterm role="concept">
12338 <primary>domain list</primary>
12339 <secondary>matching <quote>ends with</quote></secondary>
12340 </indexterm>
12341 If a pattern starts with an asterisk, the remaining characters of the pattern
12342 are compared with the terminating characters of the domain. The use of <quote>*</quote> in
12343 domain lists differs from its use in partial matching lookups. In a domain
12344 list, the character following the asterisk need not be a dot, whereas partial
12345 matching works only in terms of dot-separated components. For example, a domain
12346 list item such as <literal>*key.ex</literal> matches <emphasis>donkey.ex</emphasis> as well as
12347 <emphasis>cipher.key.ex</emphasis>.
12348 </para>
12349 </listitem>
12350 <listitem>
12351 <para>
12352 <indexterm role="concept">
12353 <primary>regular expressions</primary>
12354 <secondary>in domain list</secondary>
12355 </indexterm>
12356 <indexterm role="concept">
12357 <primary>domain list</primary>
12358 <secondary>matching regular expression</secondary>
12359 </indexterm>
12360 If a pattern starts with a circumflex character, it is treated as a regular
12361 expression, and matched against the domain using a regular expression matching
12362 function. The circumflex is treated as part of the regular expression.
12363 Email domains are case-independent, so this regular expression match is by
12364 default case-independent, but you can make it case-dependent by starting it
12365 with <literal>(?-i)</literal>. References to descriptions of the syntax of regular expressions
12366 are given in chapter <xref linkend="CHAPregexp"/>.
12367 </para>
12368 <para>
12369 <emphasis role="bold">Warning</emphasis>: Because domain lists are expanded before being processed, you
12370 must escape any backslash and dollar characters in the regular expression, or
12371 use the special <literal>\N</literal> sequence (see chapter <xref linkend="CHAPexpand"/>) to specify that
12372 it is not to be expanded (unless you really do want to build a regular
12373 expression by expansion, of course).
12374 </para>
12375 </listitem>
12376 <listitem>
12377 <para>
12378 <indexterm role="concept">
12379 <primary>lookup</primary>
12380 <secondary>in domain list</secondary>
12381 </indexterm>
12382 <indexterm role="concept">
12383 <primary>domain list</primary>
12384 <secondary>matching by lookup</secondary>
12385 </indexterm>
12386 If a pattern starts with the name of a single-key lookup type followed by a
12387 semicolon (for example, <quote>dbm;</quote> or <quote>lsearch;</quote>), the remainder of the pattern
12388 must be a file name in a suitable format for the lookup type. For example, for
12389 <quote>cdb;</quote> it must be an absolute path:
12390 </para>
12391 <literallayout class="monospaced">
12392 domains = cdb;/etc/mail/local_domains.cdb
12393 </literallayout>
12394 <para>
12395 The appropriate type of lookup is done on the file using the domain name as the
12396 key. In most cases, the data that is looked up is not used; Exim is interested
12397 only in whether or not the key is present in the file. However, when a lookup
12398 is used for the <option>domains</option> option on a router
12399 or a <option>domains</option> condition in an ACL statement, the data is preserved in the
12400 <varname>$domain_data</varname> variable and can be referred to in other router options or
12401 other statements in the same ACL.
12402 </para>
12403 </listitem>
12404 <listitem>
12405 <para>
12406 Any of the single-key lookup type names may be preceded by
12407 <literal>partial</literal>&lt;<emphasis>n</emphasis>&gt;<literal>-</literal>, where the &lt;<emphasis>n</emphasis>&gt; is optional, for example,
12408 </para>
12409 <literallayout class="monospaced">
12410 domains = partial-dbm;/partial/domains
12411 </literallayout>
12412 <para>
12413 This causes partial matching logic to be invoked; a description of how this
12414 works is given in section <xref linkend="SECTpartiallookup"/>.
12415 </para>
12416 </listitem>
12417 <listitem>
12418 <para>
12419 <indexterm role="concept">
12420 <primary>asterisk</primary>
12421 <secondary>in lookup type</secondary>
12422 </indexterm>
12423 Any of the single-key lookup types may be followed by an asterisk. This causes
12424 a default lookup for a key consisting of a single asterisk to be done if the
12425 original lookup fails. This is not a useful feature when using a domain list to
12426 select particular domains (because any domain would match), but it might have
12427 value if the result of the lookup is being used via the <varname>$domain_data</varname>
12428 expansion variable.
12429 </para>
12430 </listitem>
12431 <listitem>
12432 <para>
12433 If the pattern starts with the name of a query-style lookup type followed by a
12434 semicolon (for example, <quote>nisplus;</quote> or <quote>ldap;</quote>), the remainder of the
12435 pattern must be an appropriate query for the lookup type, as described in
12436 chapter <xref linkend="CHAPfdlookup"/>. For example:
12437 </para>
12438 <literallayout class="monospaced">
12439 hold_domains = mysql;select domain from holdlist \
12440   where domain = '${quote_mysql:$domain}';
12441 </literallayout>
12442 <para>
12443 In most cases, the data that is looked up is not used (so for an SQL query, for
12444 example, it doesn&#x2019;t matter what field you select). Exim is interested only in
12445 whether or not the query succeeds. However, when a lookup is used for the
12446 <option>domains</option> option on a router, the data is preserved in the <varname>$domain_data</varname>
12447 variable and can be referred to in other options.
12448 </para>
12449 </listitem>
12450 <listitem>
12451 <para>
12452 <indexterm role="concept">
12453 <primary>domain list</primary>
12454 <secondary>matching literal domain name</secondary>
12455 </indexterm>
12456 If none of the above cases apply, a caseless textual comparison is made
12457 between the pattern and the domain.
12458 </para>
12459 </listitem>
12460 </itemizedlist>
12461 <para>
12462 Here is an example that uses several different kinds of pattern:
12463 </para>
12464 <literallayout class="monospaced">
12465 domainlist funny_domains = \
12466   @ : \
12467   lib.unseen.edu : \
12468   *.foundation.fict.example : \
12469   \N^[1-2]\d{3}\.fict\.example$\N : \
12470   partial-dbm;/opt/data/penguin/book : \
12471   nis;domains.byname : \
12472   nisplus;[name=$domain,status=local],domains.org_dir
12473 </literallayout>
12474 <para>
12475 There are obvious processing trade-offs among the various matching modes. Using
12476 an asterisk is faster than a regular expression, and listing a few names
12477 explicitly probably is too. The use of a file or database lookup is expensive,
12478 but may be the only option if hundreds of names are required. Because the
12479 patterns are tested in order, it makes sense to put the most commonly matched
12480 patterns earlier.
12481 </para>
12482 </section>
12483 <section id="SECThostlist">
12484 <title>Host lists</title>
12485 <para>
12486 <indexterm role="concept">
12487 <primary>host list</primary>
12488 <secondary>patterns in</secondary>
12489 </indexterm>
12490 <indexterm role="concept">
12491 <primary>list</primary>
12492 <secondary>host list</secondary>
12493 </indexterm>
12494 Host lists are used to control what remote hosts are allowed to do. For
12495 example, some hosts may be allowed to use the local host as a relay, and some
12496 may be permitted to use the SMTP ETRN command. Hosts can be identified in
12497 two different ways, by name or by IP address. In a host list, some types of
12498 pattern are matched to a host name, and some are matched to an IP address.
12499 You need to be particularly careful with this when single-key lookups are
12500 involved, to ensure that the right value is being used as the key.
12501 </para>
12502 </section>
12503 <section id="SECID80">
12504 <title>Special host list patterns</title>
12505 <para>
12506 <indexterm role="concept">
12507 <primary>empty item in hosts list</primary>
12508 </indexterm>
12509 <indexterm role="concept">
12510 <primary>host list</primary>
12511 <secondary>empty string in</secondary>
12512 </indexterm>
12513 If a host list item is the empty string, it matches only when no remote host is
12514 involved. This is the case when a message is being received from a local
12515 process using SMTP on the standard input, that is, when a TCP/IP connection is
12516 not used.
12517 </para>
12518 <para>
12519 <indexterm role="concept">
12520 <primary>asterisk</primary>
12521 <secondary>in host list</secondary>
12522 </indexterm>
12523 The special pattern <quote>*</quote> in a host list matches any host or no host. Neither
12524 the IP address nor the name is actually inspected.
12525 </para>
12526 </section>
12527 <section id="SECThoslispatip">
12528 <title>Host list patterns that match by IP address</title>
12529 <para>
12530 <indexterm role="concept">
12531 <primary>host list</primary>
12532 <secondary>matching IP addresses</secondary>
12533 </indexterm>
12534 If an IPv4 host calls an IPv6 host and the call is accepted on an IPv6 socket,
12535 the incoming address actually appears in the IPv6 host as
12536 <literal>::ffff:</literal>&lt;<emphasis>v4address</emphasis>&gt;. When such an address is tested against a host
12537 list, it is converted into a traditional IPv4 address first. (Not all operating
12538 systems accept IPv4 calls on IPv6 sockets, as there have been some security
12539 concerns.)
12540 </para>
12541 <para>
12542 The following types of pattern in a host list check the remote host by
12543 inspecting its IP address:
12544 </para>
12545 <itemizedlist>
12546 <listitem>
12547 <para>
12548 If the pattern is a plain domain name (not a regular expression, not starting
12549 with *, not a lookup of any kind), Exim calls the operating system function
12550 to find the associated IP address(es). Exim uses the newer
12551 <function>getipnodebyname()</function> function when available, otherwise <function>gethostbyname()</function>.
12552 This typically causes a forward DNS lookup of the name. The result is compared
12553 with the IP address of the subject host.
12554 </para>
12555 <para>
12556 If there is a temporary problem (such as a DNS timeout) with the host name
12557 lookup, a temporary error occurs. For example, if the list is being used in an
12558 ACL condition, the ACL gives a <quote>defer</quote> response, usually leading to a
12559 temporary SMTP error code. If no IP address can be found for the host name,
12560 what happens is described in section <xref linkend="SECTbehipnot"/> below.
12561 </para>
12562 </listitem>
12563 <listitem>
12564 <para>
12565 <indexterm role="concept">
12566 <primary>@ in a host list</primary>
12567 </indexterm>
12568 If the pattern is <quote>@</quote>, the primary host name is substituted and used as a
12569 domain name, as just described.
12570 </para>
12571 </listitem>
12572 <listitem>
12573 <para>
12574 If the pattern is an IP address, it is matched against the IP address of the
12575 subject host. IPv4 addresses are given in the normal <quote>dotted-quad</quote> notation.
12576 IPv6 addresses can be given in colon-separated format, but the colons have to
12577 be doubled so as not to be taken as item separators when the default list
12578 separator is used. IPv6 addresses are recognized even when Exim is compiled
12579 without IPv6 support. This means that if they appear in a host list on an
12580 IPv4-only host, Exim will not treat them as host names. They are just addresses
12581 that can never match a client host.
12582 </para>
12583 </listitem>
12584 <listitem>
12585 <para>
12586 <indexterm role="concept">
12587 <primary>@[] in a host list</primary>
12588 </indexterm>
12589 If the pattern is <quote>@[]</quote>, it matches the IP address of any IP interface on
12590 the local host. For example, if the local host is an IPv4 host with one
12591 interface address 10.45.23.56, these two ACL statements have the same effect:
12592 </para>
12593 <literallayout class="monospaced">
12594 accept hosts = 127.0.0.1 : 10.45.23.56
12595 accept hosts = @[]
12596 </literallayout>
12597 </listitem>
12598 <listitem>
12599 <para>
12600 <indexterm role="concept">
12601 <primary>CIDR notation</primary>
12602 </indexterm>
12603 If the pattern is an IP address followed by a slash and a mask length (for
12604 example 10.11.42.0/24), it is matched against the IP address of the subject
12605 host under the given mask. This allows, an entire network of hosts to be
12606 included (or excluded) by a single item. The mask uses CIDR notation; it
12607 specifies the number of address bits that must match, starting from the most
12608 significant end of the address.
12609 </para>
12610 <para>
12611 <emphasis role="bold">Note</emphasis>: The mask is <emphasis>not</emphasis> a count of addresses, nor is it the high number
12612 of a range of addresses. It is the number of bits in the network portion of the
12613 address. The above example specifies a 24-bit netmask, so it matches all 256
12614 addresses in the 10.11.42.0 network. An item such as
12615 </para>
12616 <literallayout class="monospaced">
12617 192.168.23.236/31
12618 </literallayout>
12619 <para>
12620 matches just two addresses, 192.168.23.236 and 192.168.23.237. A mask value of
12621 32 for an IPv4 address is the same as no mask at all; just a single address
12622 matches.
12623 </para>
12624 <para>
12625 Here is another example which shows an IPv4 and an IPv6 network:
12626 </para>
12627 <literallayout class="monospaced">
12628 recipient_unqualified_hosts = 192.168.0.0/16: \
12629                               3ffe::ffff::836f::::/48
12630 </literallayout>
12631 <para>
12632 The doubling of list separator characters applies only when these items
12633 appear inline in a host list. It is not required when indirecting via a file.
12634 For example:
12635 </para>
12636 <literallayout class="monospaced">
12637 recipient_unqualified_hosts = /opt/exim/unqualnets
12638 </literallayout>
12639 <para>
12640 could make use of a file containing
12641 </para>
12642 <literallayout class="monospaced">
12643 172.16.0.0/12
12644 3ffe:ffff:836f::/48
12645 </literallayout>
12646 <para>
12647 to have exactly the same effect as the previous example. When listing IPv6
12648 addresses inline, it is usually more convenient to use the facility for
12649 changing separator characters. This list contains the same two networks:
12650 </para>
12651 <literallayout class="monospaced">
12652 recipient_unqualified_hosts = &lt;; 172.16.0.0/12; \
12653                                  3ffe:ffff:836f::/48
12654 </literallayout>
12655 <para>
12656 The separator is changed to semicolon by the leading <quote>&lt;;</quote> at the start of the
12657 list.
12658 </para>
12659 </listitem>
12660 </itemizedlist>
12661 </section>
12662 <section id="SECThoslispatsikey">
12663 <title>Host list patterns for single-key lookups by host address</title>
12664 <para>
12665 <indexterm role="concept">
12666 <primary>host list</primary>
12667 <secondary>lookup of IP address</secondary>
12668 </indexterm>
12669 When a host is to be identified by a single-key lookup of its complete IP
12670 address, the pattern takes this form:
12671 </para>
12672 <literallayout>
12673 <literal>net-&lt;</literal><emphasis>single-key-search-type</emphasis><literal>&gt;;&lt;</literal><emphasis>search-data</emphasis><literal>&gt;</literal>
12674 </literallayout>
12675 <para>
12676 For example:
12677 </para>
12678 <literallayout class="monospaced">
12679 hosts_lookup = net-cdb;/hosts-by-ip.db
12680 </literallayout>
12681 <para>
12682 The text form of the IP address of the subject host is used as the lookup key.
12683 IPv6 addresses are converted to an unabbreviated form, using lower case
12684 letters, with dots as separators because colon is the key terminator in
12685 <command>lsearch</command> files. [Colons can in fact be used in keys in <command>lsearch</command> files by
12686 quoting the keys, but this is a facility that was added later.] The data
12687 returned by the lookup is not used.
12688 </para>
12689 <para>
12690 <indexterm role="concept">
12691 <primary>IP address</primary>
12692 <secondary>masking</secondary>
12693 </indexterm>
12694 <indexterm role="concept">
12695 <primary>host list</primary>
12696 <secondary>masked IP address</secondary>
12697 </indexterm>
12698 Single-key lookups can also be performed using masked IP addresses, using
12699 patterns of this form:
12700 </para>
12701 <literallayout>
12702 <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>
12703 </literallayout>
12704 <para>
12705 For example:
12706 </para>
12707 <literallayout class="monospaced">
12708 net24-dbm;/networks.db
12709 </literallayout>
12710 <para>
12711 The IP address of the subject host is masked using &lt;<emphasis>number</emphasis>&gt; as the mask
12712 length. A textual string is constructed from the masked value, followed by the
12713 mask, and this is used as the lookup key. For example, if the host&#x2019;s IP address
12714 is 192.168.34.6, the key that is looked up for the above example is
12715 <quote>192.168.34.0/24</quote>.
12716 </para>
12717 <para>
12718 When an IPv6 address is converted to a string, dots are normally used instead
12719 of colons, so that keys in <command>lsearch</command> files need not contain colons (which
12720 terminate <command>lsearch</command> keys). This was implemented some time before the ability
12721 to quote keys was made available in <command>lsearch</command> files. However, the more
12722 recently implemented <command>iplsearch</command> files do require colons in IPv6 keys
12723 (notated using the quoting facility) so as to distinguish them from IPv4 keys.
12724 For this reason, when the lookup type is <command>iplsearch</command>, IPv6 addresses are
12725 converted using colons and not dots. In all cases, full, unabbreviated IPv6
12726 addresses are always used.
12727 </para>
12728 <para>
12729 Ideally, it would be nice to tidy up this anomalous situation by changing to
12730 colons in all cases, given that quoting is now available for <command>lsearch</command>.
12731 However, this would be an incompatible change that might break some existing
12732 configurations.
12733 </para>
12734 <para>
12735 <emphasis role="bold">Warning</emphasis>: Specifying <option>net32-</option> (for an IPv4 address) or <option>net128-</option> (for an
12736 IPv6 address) is not the same as specifying just <option>net-</option> without a number. In
12737 the former case the key strings include the mask value, whereas in the latter
12738 case the IP address is used on its own.
12739 </para>
12740 </section>
12741 <section id="SECThoslispatnam">
12742 <title>Host list patterns that match by host name</title>
12743 <para>
12744 <indexterm role="concept">
12745 <primary>host</primary>
12746 <secondary>lookup failures</secondary>
12747 </indexterm>
12748 <indexterm role="concept">
12749 <primary>unknown host name</primary>
12750 </indexterm>
12751 <indexterm role="concept">
12752 <primary>host list</primary>
12753 <secondary>matching host name</secondary>
12754 </indexterm>
12755 There are several types of pattern that require Exim to know the name of the
12756 remote host. These are either wildcard patterns or lookups by name. (If a
12757 complete hostname is given without any wildcarding, it is used to find an IP
12758 address to match against, as described in section <xref linkend="SECThoslispatip"/>
12759 above.)
12760 </para>
12761 <para>
12762 If the remote host name is not already known when Exim encounters one of these
12763 patterns, it has to be found from the IP address.
12764 Although many sites on the Internet are conscientious about maintaining reverse
12765 DNS data for their hosts, there are also many that do not do this.
12766 Consequently, a name cannot always be found, and this may lead to unwanted
12767 effects. Take care when configuring host lists with wildcarded name patterns.
12768 Consider what will happen if a name cannot be found.
12769 </para>
12770 <para>
12771 Because of the problems of determining host names from IP addresses, matching
12772 against host names is not as common as matching against IP addresses.
12773 </para>
12774 <para>
12775 By default, in order to find a host name, Exim first does a reverse DNS lookup;
12776 if no name is found in the DNS, the system function (<function>gethostbyaddr()</function> or
12777 <function>getipnodebyaddr()</function> if available) is tried. The order in which these lookups
12778 are done can be changed by setting the <option>host_lookup_order</option> option. For
12779 security, once Exim has found one or more names, it looks up the IP addresses
12780 for these names and compares them with the IP address that it started with.
12781 Only those names whose IP addresses match are accepted. Any other names are
12782 discarded. If no names are left, Exim behaves as if the host name cannot be
12783 found. In the most common case there is only one name and one IP address.
12784 </para>
12785 <para>
12786 There are some options that control what happens if a host name cannot be
12787 found. These are described in section <xref linkend="SECTbehipnot"/> below.
12788 </para>
12789 <para>
12790 <indexterm role="concept">
12791 <primary>host</primary>
12792 <secondary>alias for</secondary>
12793 </indexterm>
12794 <indexterm role="concept">
12795 <primary>alias for host</primary>
12796 </indexterm>
12797 As a result of aliasing, hosts may have more than one name. When processing any
12798 of the following types of pattern, all the host&#x2019;s names are checked:
12799 </para>
12800 <itemizedlist>
12801 <listitem>
12802 <para>
12803 <indexterm role="concept">
12804 <primary>asterisk</primary>
12805 <secondary>in host list</secondary>
12806 </indexterm>
12807 If a pattern starts with <quote>*</quote> the remainder of the item must match the end of
12808 the host name. For example, <literal>*.b.c</literal> matches all hosts whose names end in
12809 <emphasis>.b.c</emphasis>. This special simple form is provided because this is a very common
12810 requirement. Other kinds of wildcarding require the use of a regular
12811 expression.
12812 </para>
12813 </listitem>
12814 <listitem>
12815 <para>
12816 <indexterm role="concept">
12817 <primary>regular expressions</primary>
12818 <secondary>in host list</secondary>
12819 </indexterm>
12820 <indexterm role="concept">
12821 <primary>host list</primary>
12822 <secondary>regular expression in</secondary>
12823 </indexterm>
12824 If the item starts with <quote>^</quote> it is taken to be a regular expression which is
12825 matched against the host name. Host names are case-independent, so this regular
12826 expression match is by default case-independent, but you can make it
12827 case-dependent by starting it with <literal>(?-i)</literal>. References to descriptions of the
12828 syntax of regular expressions are given in chapter <xref linkend="CHAPregexp"/>. For
12829 example,
12830 </para>
12831 <literallayout class="monospaced">
12832 ^(a|b)\.c\.d$
12833 </literallayout>
12834 <para>
12835 is a regular expression that matches either of the two hosts <emphasis>a.c.d</emphasis> or
12836 <emphasis>b.c.d</emphasis>. When a regular expression is used in a host list, you must take care
12837 that backslash and dollar characters are not misinterpreted as part of the
12838 string expansion. The simplest way to do this is to use <literal>\N</literal> to mark that
12839 part of the string as non-expandable. For example:
12840 </para>
12841 <literallayout class="monospaced">
12842 sender_unqualified_hosts = \N^(a|b)\.c\.d$\N : ....
12843 </literallayout>
12844 <para>
12845 <emphasis role="bold">Warning</emphasis>: If you want to match a complete host name, you must include the
12846 <literal>$</literal> terminating metacharacter in the regular expression, as in the above
12847 example. Without it, a match at the start of the host name is all that is
12848 required.
12849 </para>
12850 </listitem>
12851 </itemizedlist>
12852 </section>
12853 <section id="SECTbehipnot">
12854 <title>Behaviour when an IP address or name cannot be found</title>
12855 <para>
12856 <indexterm role="concept">
12857 <primary>host</primary>
12858 <secondary>lookup failures, permanent</secondary>
12859 </indexterm>
12860 While processing a host list, Exim may need to look up an IP address from a
12861 name (see section <xref linkend="SECThoslispatip"/>), or it may need to look up a host name
12862 from an IP address (see section <xref linkend="SECThoslispatnam"/>). In either case, the
12863 behaviour when it fails to find the information it is seeking is the same.
12864 </para>
12865 <para>
12866 <emphasis role="bold">Note</emphasis>: This section applies to permanent lookup failures. It does <emphasis>not</emphasis>
12867 apply to temporary DNS errors, whose handling is described in the next section.
12868 </para>
12869 <para>
12870 <indexterm role="concept">
12871 <primary><literal>+include_unknown</literal></primary>
12872 </indexterm>
12873 <indexterm role="concept">
12874 <primary><literal>+ignore_unknown</literal></primary>
12875 </indexterm>
12876 Exim parses a host list from left to right. If it encounters a permanent
12877 lookup failure in any item in the host list before it has found a match,
12878 Exim treats it as a failure and the default behavior is as if the host
12879 does not match the list. This may not always be what you want to happen.
12880 To change Exim&#x2019;s behaviour, the special items <literal>+include_unknown</literal> or
12881 <literal>+ignore_unknown</literal> may appear in the list (at top level &ndash; they are
12882 not recognized in an indirected file).
12883 </para>
12884 <itemizedlist>
12885 <listitem>
12886 <para>
12887 If any item that follows <literal>+include_unknown</literal> requires information that
12888 cannot found, Exim behaves as if the host does match the list. For example,
12889 </para>
12890 <literallayout class="monospaced">
12891 host_reject_connection = +include_unknown:*.enemy.ex
12892 </literallayout>
12893 <para>
12894 rejects connections from any host whose name matches <literal>*.enemy.ex</literal>, and also
12895 any hosts whose name it cannot find.
12896 </para>
12897 </listitem>
12898 <listitem>
12899 <para>
12900 If any item that follows <literal>+ignore_unknown</literal> requires information that cannot
12901 be found, Exim ignores that item and proceeds to the rest of the list. For
12902 example:
12903 </para>
12904 <literallayout class="monospaced">
12905 accept hosts = +ignore_unknown : friend.example : \
12906                192.168.4.5
12907 </literallayout>
12908 <para>
12909 accepts from any host whose name is <emphasis>friend.example</emphasis> and from 192.168.4.5,
12910 whether or not its host name can be found. Without <literal>+ignore_unknown</literal>, if no
12911 name can be found for 192.168.4.5, it is rejected.
12912 </para>
12913 </listitem>
12914 </itemizedlist>
12915 <para>
12916 Both <literal>+include_unknown</literal> and <literal>+ignore_unknown</literal> may appear in the same
12917 list. The effect of each one lasts until the next, or until the end of the
12918 list.
12919 </para>
12920 </section>
12921 <section id="SECTmixwilhos">
12922 <title>Mixing wildcarded host names and addresses in host lists</title>
12923 <para>
12924 <indexterm role="concept">
12925 <primary>host list</primary>
12926 <secondary>mixing names and addresses in</secondary>
12927 </indexterm>
12928 </para>
12929 <para>
12930 This section explains the host/ip processing logic with the same concepts
12931 as the previous section, but specifically addresses what happens when a
12932 wildcarded hostname is one of the items in the hostlist.
12933 </para>
12934 <itemizedlist>
12935 <listitem>
12936 <para>
12937 If you have name lookups or wildcarded host names and
12938 IP addresses in the same host list, you should normally put the IP
12939 addresses first. For example, in an ACL you could have:
12940 </para>
12941 <literallayout class="monospaced">
12942 accept hosts = 10.9.8.7 : *.friend.example
12943 </literallayout>
12944 <para>
12945 The reason you normally would order it this way lies in the
12946 left-to-right way that Exim processes lists.  It can test IP addresses
12947 without doing any DNS lookups, but when it reaches an item that requires
12948 a host name, it fails if it cannot find a host name to compare with the
12949 pattern. If the above list is given in the opposite order, the
12950 <option>accept</option> statement fails for a host whose name cannot be found, even
12951 if its IP address is 10.9.8.7.
12952 </para>
12953 </listitem>
12954 <listitem>
12955 <para>
12956 If you really do want to do the name check first, and still recognize the IP
12957 address, you can rewrite the ACL like this:
12958 </para>
12959 <literallayout class="monospaced">
12960 accept hosts = *.friend.example
12961 accept hosts = 10.9.8.7
12962 </literallayout>
12963 <para>
12964 If the first <option>accept</option> fails, Exim goes on to try the second one. See chapter
12965 <xref linkend="CHAPACL"/> for details of ACLs. Alternatively, you can use
12966 <literal>+ignore_unknown</literal>, which was discussed in depth in the first example in
12967 this section.
12968 </para>
12969 </listitem>
12970 </itemizedlist>
12971 </section>
12972 <section id="SECTtemdnserr">
12973 <title>Temporary DNS errors when looking up host information</title>
12974 <para>
12975 <indexterm role="concept">
12976 <primary>host</primary>
12977 <secondary>lookup failures, temporary</secondary>
12978 </indexterm>
12979 <indexterm role="concept">
12980 <primary><literal>+include_defer</literal></primary>
12981 </indexterm>
12982 <indexterm role="concept">
12983 <primary><literal>+ignore_defer</literal></primary>
12984 </indexterm>
12985 A temporary DNS lookup failure normally causes a defer action (except when
12986 <option>dns_again_means_nonexist</option> converts it into a permanent error). However,
12987 host lists can include <literal>+ignore_defer</literal> and <literal>+include_defer</literal>, analogous to
12988 <literal>+ignore_unknown</literal> and <literal>+include_unknown</literal>, as described in the previous
12989 section. These options should be used with care, probably only in non-critical
12990 host lists such as whitelists.
12991 </para>
12992 </section>
12993 <section id="SECThoslispatnamsk">
12994 <title>Host list patterns for single-key lookups by host name</title>
12995 <para>
12996 <indexterm role="concept">
12997 <primary>unknown host name</primary>
12998 </indexterm>
12999 <indexterm role="concept">
13000 <primary>host list</primary>
13001 <secondary>matching host name</secondary>
13002 </indexterm>
13003 If a pattern is of the form
13004 </para>
13005 <literallayout>
13006 &lt;<emphasis>single-key-search-type</emphasis>&gt;;&lt;<emphasis>search-data</emphasis>&gt;
13007 </literallayout>
13008 <para>
13009 for example
13010 </para>
13011 <literallayout class="monospaced">
13012 dbm;/host/accept/list
13013 </literallayout>
13014 <para>
13015 a single-key lookup is performed, using the host name as its key. If the
13016 lookup succeeds, the host matches the item. The actual data that is looked up
13017 is not used.
13018 </para>
13019 <para>
13020 <emphasis role="bold">Reminder</emphasis>: With this kind of pattern, you must have host <emphasis>names</emphasis> as
13021 keys in the file, not IP addresses. If you want to do lookups based on IP
13022 addresses, you must precede the search type with <quote>net-</quote> (see section
13023 <xref linkend="SECThoslispatsikey"/>). There is, however, no reason why you could not use
13024 two items in the same list, one doing an address lookup and one doing a name
13025 lookup, both using the same file.
13026 </para>
13027 </section>
13028 <section id="SECID81">
13029 <title>Host list patterns for query-style lookups</title>
13030 <para>
13031 If a pattern is of the form
13032 </para>
13033 <literallayout>
13034 &lt;<emphasis>query-style-search-type</emphasis>&gt;;&lt;<emphasis>query</emphasis>&gt;
13035 </literallayout>
13036 <para>
13037 the query is obeyed, and if it succeeds, the host matches the item. The actual
13038 data that is looked up is not used. The variables <varname>$sender_host_address</varname> and
13039 <varname>$sender_host_name</varname> can be used in the query. For example:
13040 </para>
13041 <literallayout class="monospaced">
13042 hosts_lookup = pgsql;\
13043   select ip from hostlist where ip='$sender_host_address'
13044 </literallayout>
13045 <para>
13046 The value of <varname>$sender_host_address</varname> for an IPv6 address contains colons. You
13047 can use the <option>sg</option> expansion item to change this if you need to. If you want to
13048 use masked IP addresses in database queries, you can use the <option>mask</option> expansion
13049 operator.
13050 </para>
13051 <para>
13052 If the query contains a reference to <varname>$sender_host_name</varname>, Exim automatically
13053 looks up the host name if it has not already done so. (See section
13054 <xref linkend="SECThoslispatnam"/> for comments on finding host names.)
13055 </para>
13056 <para>
13057 Historical note: prior to release 4.30, Exim would always attempt to find a
13058 host name before running the query, unless the search type was preceded by
13059 <literal>net-</literal>. This is no longer the case. For backwards compatibility, <literal>net-</literal> is
13060 still recognized for query-style lookups, but its presence or absence has no
13061 effect. (Of course, for single-key lookups, <literal>net-</literal> <emphasis>is</emphasis> important.
13062 See section <xref linkend="SECThoslispatsikey"/>.)
13063 </para>
13064 </section>
13065 <section id="SECTaddresslist">
13066 <title>Address lists</title>
13067 <para>
13068 <indexterm role="concept">
13069 <primary>list</primary>
13070 <secondary>address list</secondary>
13071 </indexterm>
13072 <indexterm role="concept">
13073 <primary>address list</primary>
13074 <secondary>empty item</secondary>
13075 </indexterm>
13076 <indexterm role="concept">
13077 <primary>address list</primary>
13078 <secondary>patterns</secondary>
13079 </indexterm>
13080 Address lists contain patterns that are matched against mail addresses. There
13081 is one special case to be considered: the sender address of a bounce message is
13082 always empty. You can test for this by providing an empty item in an address
13083 list. For example, you can set up a router to process bounce messages by
13084 using this option setting:
13085 </para>
13086 <literallayout class="monospaced">
13087 senders = :
13088 </literallayout>
13089 <para>
13090 The presence of the colon creates an empty item. If you do not provide any
13091 data, the list is empty and matches nothing. The empty sender can also be
13092 detected by a regular expression that matches an empty string,
13093 and by a query-style lookup that succeeds when <varname>$sender_address</varname> is empty.
13094 </para>
13095 <para>
13096 Non-empty items in an address list can be straightforward email addresses. For
13097 example:
13098 </para>
13099 <literallayout class="monospaced">
13100 senders = jbc@askone.example : hs@anacreon.example
13101 </literallayout>
13102 <para>
13103 A certain amount of wildcarding is permitted. If a pattern contains an @
13104 character, but is not a regular expression and does not begin with a
13105 semicolon-terminated lookup type (described below), the local part of the
13106 subject address is compared with the local part of the pattern, which may start
13107 with an asterisk. If the local parts match, the domain is checked in exactly
13108 the same way as for a pattern in a domain list. For example, the domain can be
13109 wildcarded, refer to a named list, or be a lookup:
13110 </para>
13111 <literallayout class="monospaced">
13112 deny senders = *@*.spamming.site:\
13113                *@+hostile_domains:\
13114                bozo@partial-lsearch;/list/of/dodgy/sites:\
13115                *@dbm;/bad/domains.db
13116 </literallayout>
13117 <para>
13118 <indexterm role="concept">
13119 <primary>local part</primary>
13120 <secondary>starting with !</secondary>
13121 </indexterm>
13122 <indexterm role="concept">
13123 <primary>address list</primary>
13124 <secondary>local part starting with !</secondary>
13125 </indexterm>
13126 If a local part that begins with an exclamation mark is required, it has to be
13127 specified using a regular expression, because otherwise the exclamation mark is
13128 treated as a sign of negation, as is standard in lists.
13129 </para>
13130 <para>
13131 If a non-empty pattern that is not a regular expression or a lookup does not
13132 contain an @ character, it is matched against the domain part of the subject
13133 address. The only two formats that are recognized this way are a literal
13134 domain, or a domain pattern that starts with *. In both these cases, the effect
13135 is the same as if <literal>*@</literal> preceded the pattern. For example:
13136 </para>
13137 <literallayout class="monospaced">
13138 deny senders = enemy.domain : *.enemy.domain
13139 </literallayout>
13140 <para>
13141 The following kinds of more complicated address list pattern can match any
13142 address, including the empty address that is characteristic of bounce message
13143 senders:
13144 </para>
13145 <itemizedlist>
13146 <listitem>
13147 <para>
13148 <indexterm role="concept">
13149 <primary>regular expressions</primary>
13150 <secondary>in address list</secondary>
13151 </indexterm>
13152 <indexterm role="concept">
13153 <primary>address list</primary>
13154 <secondary>regular expression in</secondary>
13155 </indexterm>
13156 If (after expansion) a pattern starts with <quote>^</quote>, a regular expression match is
13157 done against the complete address, with the pattern as the regular expression.
13158 You must take care that backslash and dollar characters are not misinterpreted
13159 as part of the string expansion. The simplest way to do this is to use <literal>\N</literal>
13160 to mark that part of the string as non-expandable. For example:
13161 </para>
13162 <literallayout class="monospaced">
13163 deny senders = \N^.*this.*@example\.com$\N : \
13164                \N^\d{8}.+@spamhaus.example$\N : ...
13165 </literallayout>
13166 <para>
13167 The <literal>\N</literal> sequences are removed by the expansion, so these items do indeed
13168 start with <quote>^</quote> by the time they are being interpreted as address patterns.
13169 </para>
13170 </listitem>
13171 <listitem>
13172 <para>
13173 <indexterm role="concept">
13174 <primary>address list</primary>
13175 <secondary>lookup for complete address</secondary>
13176 </indexterm>
13177 Complete addresses can be looked up by using a pattern that starts with a
13178 lookup type terminated by a semicolon, followed by the data for the lookup. For
13179 example:
13180 </para>
13181 <literallayout class="monospaced">
13182 deny senders = cdb;/etc/blocked.senders : \
13183   mysql;select address from blocked where \
13184   address='${quote_mysql:$sender_address}'
13185 </literallayout>
13186 <para>
13187 Both query-style and single-key lookup types can be used. For a single-key
13188 lookup type, Exim uses the complete address as the key. However, empty keys are
13189 not supported for single-key lookups, so a match against the empty address
13190 always fails. This restriction does not apply to query-style lookups.
13191 </para>
13192 <para>
13193 Partial matching for single-key lookups (section <xref linkend="SECTpartiallookup"/>)
13194 cannot be used, and is ignored if specified, with an entry being written to the
13195 panic log.
13196 <indexterm role="concept">
13197 <primary>*@ with single-key lookup</primary>
13198 </indexterm>
13199 However, you can configure lookup defaults, as described in section
13200 <xref linkend="SECTdefaultvaluelookups"/>, but this is useful only for the <quote>*@</quote> type of
13201 default. For example, with this lookup:
13202 </para>
13203 <literallayout class="monospaced">
13204 accept senders = lsearch*@;/some/file
13205 </literallayout>
13206 <para>
13207 the file could contains lines like this:
13208 </para>
13209 <literallayout class="monospaced">
13210 user1@domain1.example
13211 *@domain2.example
13212 </literallayout>
13213 <para>
13214 and for the sender address <emphasis>nimrod@jaeger.example</emphasis>, the sequence of keys
13215 that are tried is:
13216 </para>
13217 <literallayout class="monospaced">
13218 nimrod@jaeger.example
13219 *@jaeger.example
13220 *
13221 </literallayout>
13222 <para>
13223 <emphasis role="bold">Warning 1</emphasis>: Do not include a line keyed by <quote>*</quote> in the file, because that
13224 would mean that every address matches, thus rendering the test useless.
13225 </para>
13226 <para>
13227 <emphasis role="bold">Warning 2</emphasis>: Do not confuse these two kinds of item:
13228 </para>
13229 <literallayout class="monospaced">
13230 deny recipients = dbm*@;/some/file
13231 deny recipients = *@dbm;/some/file
13232 </literallayout>
13233 <para>
13234 The first does a whole address lookup, with defaulting, as just described,
13235 because it starts with a lookup type. The second matches the local part and
13236 domain independently, as described in a bullet point below.
13237 </para>
13238 </listitem>
13239 </itemizedlist>
13240 <para>
13241 The following kinds of address list pattern can match only non-empty addresses.
13242 If the subject address is empty, a match against any of these pattern types
13243 always fails.
13244 </para>
13245 <itemizedlist>
13246 <listitem>
13247 <para>
13248 <indexterm role="concept">
13249 <primary>@@ with single-key lookup</primary>
13250 </indexterm>
13251 <indexterm role="concept">
13252 <primary>address list</primary>
13253 <secondary>@@ lookup type</secondary>
13254 </indexterm>
13255 <indexterm role="concept">
13256 <primary>address list</primary>
13257 <secondary>split local part and domain</secondary>
13258 </indexterm>
13259 If a pattern starts with <quote>@@</quote> followed by a single-key lookup item
13260 (for example, <literal>@@lsearch;/some/file</literal>), the address that is being checked is
13261 split into a local part and a domain. The domain is looked up in the file. If
13262 it is not found, there is no match. If it is found, the data that is looked up
13263 from the file is treated as a colon-separated list of local part patterns, each
13264 of which is matched against the subject local part in turn.
13265 </para>
13266 <para>
13267 <indexterm role="concept">
13268 <primary>asterisk</primary>
13269 <secondary>in address list</secondary>
13270 </indexterm>
13271 The lookup may be a partial one, and/or one involving a search for a default
13272 keyed by <quote>*</quote> (see section <xref linkend="SECTdefaultvaluelookups"/>). The local part
13273 patterns that are looked up can be regular expressions or begin with <quote>*</quote>, or
13274 even be further lookups. They may also be independently negated. For example,
13275 with
13276 </para>
13277 <literallayout class="monospaced">
13278 deny senders = @@dbm;/etc/reject-by-domain
13279 </literallayout>
13280 <para>
13281 the data from which the DBM file is built could contain lines like
13282 </para>
13283 <literallayout class="monospaced">
13284 baddomain.com:  !postmaster : *
13285 </literallayout>
13286 <para>
13287 to reject all senders except <option>postmaster</option> from that domain.
13288 </para>
13289 <para>
13290 <indexterm role="concept">
13291 <primary>local part</primary>
13292 <secondary>starting with !</secondary>
13293 </indexterm>
13294 If a local part that actually begins with an exclamation mark is required, it
13295 has to be specified using a regular expression. In <command>lsearch</command> files, an entry
13296 may be split over several lines by indenting the second and subsequent lines,
13297 but the separating colon must still be included at line breaks. White space
13298 surrounding the colons is ignored. For example:
13299 </para>
13300 <literallayout class="monospaced">
13301 aol.com:  spammer1 : spammer2 : ^[0-9]+$ :
13302   spammer3 : spammer4
13303 </literallayout>
13304 <para>
13305 As in all colon-separated lists in Exim, a colon can be included in an item by
13306 doubling.
13307 </para>
13308 <para>
13309 If the last item in the list starts with a right angle-bracket, the remainder
13310 of the item is taken as a new key to look up in order to obtain a continuation
13311 list of local parts. The new key can be any sequence of characters. Thus one
13312 might have entries like
13313 </para>
13314 <literallayout class="monospaced">
13315 aol.com: spammer1 : spammer 2 : &gt;*
13316 xyz.com: spammer3 : &gt;*
13317 *:       ^\d{8}$
13318 </literallayout>
13319 <para>
13320 in a file that was searched with <option>@@dbm*</option>, to specify a match for 8-digit
13321 local parts for all domains, in addition to the specific local parts listed for
13322 each domain. Of course, using this feature costs another lookup each time a
13323 chain is followed, but the effort needed to maintain the data is reduced.
13324 </para>
13325 <para>
13326 <indexterm role="concept">
13327 <primary>loop</primary>
13328 <secondary>in lookups</secondary>
13329 </indexterm>
13330 It is possible to construct loops using this facility, and in order to catch
13331 them, the chains may be no more than fifty items long.
13332 </para>
13333 </listitem>
13334 <listitem>
13335 <para>
13336 The @@&lt;<emphasis>lookup</emphasis>&gt; style of item can also be used with a query-style
13337 lookup, but in this case, the chaining facility is not available. The lookup
13338 can only return a single list of local parts.
13339 </para>
13340 </listitem>
13341 </itemizedlist>
13342 <para>
13343 <emphasis role="bold">Warning</emphasis>: There is an important difference between the address list items
13344 in these two examples:
13345 </para>
13346 <literallayout class="monospaced">
13347 senders = +my_list
13348 senders = *@+my_list
13349 </literallayout>
13350 <para>
13351 In the first one, <literal>my_list</literal> is a named address list, whereas in the second
13352 example it is a named domain list.
13353 </para>
13354 </section>
13355 <section id="SECTcasletadd">
13356 <title>Case of letters in address lists</title>
13357 <para>
13358 <indexterm role="concept">
13359 <primary>case of local parts</primary>
13360 </indexterm>
13361 <indexterm role="concept">
13362 <primary>address list</primary>
13363 <secondary>case forcing</secondary>
13364 </indexterm>
13365 <indexterm role="concept">
13366 <primary>case forcing in address lists</primary>
13367 </indexterm>
13368 Domains in email addresses are always handled caselessly, but for local parts
13369 case may be significant on some systems (see <option>caseful_local_part</option> for how
13370 Exim deals with this when routing addresses). However, RFC 2505 (<emphasis>Anti-Spam
13371 Recommendations for SMTP MTAs</emphasis>) suggests that matching of addresses to
13372 blocking lists should be done in a case-independent manner. Since most address
13373 lists in Exim are used for this kind of control, Exim attempts to do this by
13374 default.
13375 </para>
13376 <para>
13377 The domain portion of an address is always lowercased before matching it to an
13378 address list. The local part is lowercased by default, and any string
13379 comparisons that take place are done caselessly. This means that the data in
13380 the address list itself, in files included as plain file names, and in any file
13381 that is looked up using the <quote>@@</quote> mechanism, can be in any case. However, the
13382 keys in files that are looked up by a search type other than <command>lsearch</command> (which
13383 works caselessly) must be in lower case, because these lookups are not
13384 case-independent.
13385 </para>
13386 <para>
13387 <indexterm role="concept">
13388 <primary><literal>+caseful</literal></primary>
13389 </indexterm>
13390 To allow for the possibility of caseful address list matching, if an item in
13391 an address list is the string <quote>+caseful</quote>, the original case of the local
13392 part is restored for any comparisons that follow, and string comparisons are no
13393 longer case-independent. This does not affect the domain, which remains in
13394 lower case. However, although independent matches on the domain alone are still
13395 performed caselessly, regular expressions that match against an entire address
13396 become case-sensitive after <quote>+caseful</quote> has been seen.
13397 </para>
13398 </section>
13399 <section id="SECTlocparlis">
13400 <title>Local part lists</title>
13401 <para>
13402 <indexterm role="concept">
13403 <primary>list</primary>
13404 <secondary>local part list</secondary>
13405 </indexterm>
13406 <indexterm role="concept">
13407 <primary>local part</primary>
13408 <secondary>list</secondary>
13409 </indexterm>
13410 Case-sensitivity in local part lists is handled in the same way as for address
13411 lists, as just described. The <quote>+caseful</quote> item can be used if required. In a
13412 setting of the <option>local_parts</option> option in a router with <option>caseful_local_part</option>
13413 set false, the subject is lowercased and the matching is initially
13414 case-insensitive. In this case, <quote>+caseful</quote> will restore case-sensitive
13415 matching in the local part list, but not elsewhere in the router. If
13416 <option>caseful_local_part</option> is set true in a router, matching in the <option>local_parts</option>
13417 option is case-sensitive from the start.
13418 </para>
13419 <para>
13420 If a local part list is indirected to a file (see section <xref linkend="SECTfilnamlis"/>),
13421 comments are handled in the same way as address lists &ndash; they are recognized
13422 only if the # is preceded by white space or the start of the line.
13423 Otherwise, local part lists are matched in the same way as domain lists, except
13424 that the special items that refer to the local host (<literal>@</literal>, <literal>@[]</literal>,
13425 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal>) are not recognized.
13426 Refer to section <xref linkend="SECTdomainlist"/> for details of the other available item
13427 types.
13428 <indexterm role="concept" startref="IIDdohoadli" class="endofrange"/>
13429 </para>
13430 </section>
13431 </chapter>
13432
13433 <chapter id="CHAPexpand">
13434 <title>String expansions</title>
13435 <para>
13436 <indexterm role="concept" id="IIDstrexp" class="startofrange">
13437 <primary>expansion</primary>
13438 <secondary>of strings</secondary>
13439 </indexterm>
13440 Many strings in Exim&#x2019;s run time configuration are expanded before use. Some of
13441 them are expanded every time they are used; others are expanded only once.
13442 </para>
13443 <para>
13444 When a string is being expanded it is copied verbatim from left to right except
13445 when a dollar or backslash character is encountered. A dollar specifies the
13446 start of a portion of the string that is interpreted and replaced as described
13447 below in section <xref linkend="SECTexpansionitems"/> onwards. Backslash is used as an
13448 escape character, as described in the following section.
13449 </para>
13450 <para>
13451 Whether a string is expanded depends upon the context.  Usually this is solely
13452 dependent upon the option for which a value is sought; in this documentation,
13453 options for which string expansion is performed are marked with &dagger; after
13454 the data type.  ACL rules always expand strings.  A couple of expansion
13455 conditions do not expand some of the brace-delimited branches, for security
13456 reasons.
13457 </para>
13458 <section id="SECTlittext">
13459 <title>Literal text in expanded strings</title>
13460 <para>
13461 <indexterm role="concept">
13462 <primary>expansion</primary>
13463 <secondary>including literal text</secondary>
13464 </indexterm>
13465 An uninterpreted dollar can be included in an expanded string by putting a
13466 backslash in front of it. A backslash can be used to prevent any special
13467 character being treated specially in an expansion, including backslash itself.
13468 If the string appears in quotes in the configuration file, two backslashes are
13469 required because the quotes themselves cause interpretation of backslashes when
13470 the string is read in (see section <xref linkend="SECTstrings"/>).
13471 </para>
13472 <para>
13473 <indexterm role="concept">
13474 <primary>expansion</primary>
13475 <secondary>non-expandable substrings</secondary>
13476 </indexterm>
13477 A portion of the string can specified as non-expandable by placing it between
13478 two occurrences of <literal>\N</literal>. This is particularly useful for protecting regular
13479 expressions, which often contain backslashes and dollar signs. For example:
13480 </para>
13481 <literallayout class="monospaced">
13482 deny senders = \N^\d{8}[a-z]@some\.site\.example$\N
13483 </literallayout>
13484 <para>
13485 On encountering the first <literal>\N</literal>, the expander copies subsequent characters
13486 without interpretation until it reaches the next <literal>\N</literal> or the end of the
13487 string.
13488 </para>
13489 </section>
13490 <section id="SECID82">
13491 <title>Character escape sequences in expanded strings</title>
13492 <para>
13493 <indexterm role="concept">
13494 <primary>expansion</primary>
13495 <secondary>escape sequences</secondary>
13496 </indexterm>
13497 A backslash followed by one of the letters <quote>n</quote>, <quote>r</quote>, or <quote>t</quote> in an
13498 expanded string is recognized as an escape sequence for the character newline,
13499 carriage return, or tab, respectively. A backslash followed by up to three
13500 octal digits is recognized as an octal encoding for a single character, and a
13501 backslash followed by <quote>x</quote> and up to two hexadecimal digits is a hexadecimal
13502 encoding.
13503 </para>
13504 <para>
13505 These escape sequences are also recognized in quoted strings when they are read
13506 in. Their interpretation in expansions as well is useful for unquoted strings,
13507 and for other cases such as looked-up strings that are then expanded.
13508 </para>
13509 </section>
13510 <section id="SECID83">
13511 <title>Testing string expansions</title>
13512 <para>
13513 <indexterm role="concept">
13514 <primary>expansion</primary>
13515 <secondary>testing</secondary>
13516 </indexterm>
13517 <indexterm role="concept">
13518 <primary>testing</primary>
13519 <secondary>string expansion</secondary>
13520 </indexterm>
13521 <indexterm role="option">
13522 <primary><option>-be</option></primary>
13523 </indexterm>
13524 Many expansions can be tested by calling Exim with the <option>-be</option> option. This
13525 takes the command arguments, or lines from the standard input if there are no
13526 arguments, runs them through the string expansion code, and writes the results
13527 to the standard output. Variables based on configuration values are set up, but
13528 since no message is being processed, variables such as <varname>$local_part</varname> have no
13529 value. Nevertheless the <option>-be</option> option can be useful for checking out file and
13530 database lookups, and the use of expansion operators such as <option>sg</option>, <option>substr</option>
13531 and <option>nhash</option>.
13532 </para>
13533 <para>
13534 Exim gives up its root privilege when it is called with the <option>-be</option> option, and
13535 instead runs under the uid and gid it was called with, to prevent users from
13536 using <option>-be</option> for reading files to which they do not have access.
13537 </para>
13538 <para>
13539 <indexterm role="option">
13540 <primary><option>-bem</option></primary>
13541 </indexterm>
13542 If you want to test expansions that include variables whose values are taken
13543 from a message, there are two other options that can be used. The <option>-bem</option>
13544 option is like <option>-be</option> except that it is followed by a file name. The file is
13545 read as a message before doing the test expansions. For example:
13546 </para>
13547 <literallayout class="monospaced">
13548 exim -bem /tmp/test.message '$h_subject:'
13549 </literallayout>
13550 <para>
13551 The <option>-Mset</option> option is used in conjunction with <option>-be</option> and is followed by an
13552 Exim message identifier. For example:
13553 </para>
13554 <literallayout class="monospaced">
13555 exim -be -Mset 1GrA8W-0004WS-LQ '$recipients'
13556 </literallayout>
13557 <para>
13558 This loads the message from Exim&#x2019;s spool before doing the test expansions, and
13559 is therefore restricted to admin users.
13560 </para>
13561 </section>
13562 <section id="SECTforexpfai">
13563 <title>Forced expansion failure</title>
13564 <para>
13565 <indexterm role="concept">
13566 <primary>expansion</primary>
13567 <secondary>forced failure</secondary>
13568 </indexterm>
13569 A number of expansions that are described in the following section have
13570 alternative <quote>true</quote> and <quote>false</quote> substrings, enclosed in brace characters
13571 (which are sometimes called <quote>curly brackets</quote>). Which of the two strings is
13572 used depends on some condition that is evaluated as part of the expansion. If,
13573 instead of a <quote>false</quote> substring, the word <quote>fail</quote> is used (not in braces),
13574 the entire string expansion fails in a way that can be detected by the code
13575 that requested the expansion. This is called <quote>forced expansion failure</quote>, and
13576 its consequences depend on the circumstances. In some cases it is no different
13577 from any other expansion failure, but in others a different action may be
13578 taken. Such variations are mentioned in the documentation of the option that is
13579 being expanded.
13580 </para>
13581 </section>
13582 <section id="SECTexpansionitems">
13583 <title>Expansion items</title>
13584 <para>
13585 The following items are recognized in expanded strings. White space may be used
13586 between sub-items that are keywords or substrings enclosed in braces inside an
13587 outer set of braces, to improve readability. <emphasis role="bold">Warning</emphasis>: Within braces,
13588 white space is significant.
13589 </para>
13590 <variablelist>
13591 <varlistentry>
13592 <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>
13593 <listitem>
13594 <para>
13595 <indexterm role="concept">
13596 <primary>expansion</primary>
13597 <secondary>variables</secondary>
13598 </indexterm>
13599 Substitute the contents of the named variable, for example:
13600 </para>
13601 <literallayout class="monospaced">
13602 $local_part
13603 ${domain}
13604 </literallayout>
13605 <para>
13606 The second form can be used to separate the name from subsequent alphanumeric
13607 characters. This form (using braces) is available only for variables; it does
13608 <emphasis>not</emphasis> apply to message headers. The names of the variables are given in
13609 section <xref linkend="SECTexpvar"/> below. If the name of a non-existent variable is
13610 given, the expansion fails.
13611 </para>
13612 </listitem></varlistentry>
13613 <varlistentry>
13614 <term><emphasis role="bold">${</emphasis>&lt;<emphasis>op</emphasis>&gt;<emphasis role="bold">:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13615 <listitem>
13616 <para>
13617 <indexterm role="concept">
13618 <primary>expansion</primary>
13619 <secondary>operators</secondary>
13620 </indexterm>
13621 The string is first itself expanded, and then the operation specified by
13622 &lt;<emphasis>op</emphasis>&gt; is applied to it. For example:
13623 </para>
13624 <literallayout class="monospaced">
13625 ${lc:$local_part}
13626 </literallayout>
13627 <para>
13628 The string starts with the first character after the colon, which may be
13629 leading white space. A list of operators is given in section <xref linkend="SECTexpop"/>
13630 below. The operator notation is used for simple expansion items that have just
13631 one argument, because it reduces the number of braces and therefore makes the
13632 string easier to understand.
13633 </para>
13634 </listitem></varlistentry>
13635 <varlistentry>
13636 <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>
13637 <listitem>
13638 <para>
13639 This item inserts <quote>basic</quote> header lines. It is described with the <option>header</option>
13640 expansion item below.
13641 </para>
13642 </listitem></varlistentry>
13643 <varlistentry>
13644 <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>
13645 <listitem>
13646 <para>
13647 <indexterm role="concept">
13648 <primary>expansion</primary>
13649 <secondary>calling an acl</secondary>
13650 </indexterm>
13651 <indexterm role="concept">
13652 <primary><option>acl</option></primary>
13653 <secondary>call from expansion</secondary>
13654 </indexterm>
13655 The name and zero to nine argument strings are first expanded separately.  The expanded
13656 arguments are assigned to the variables <varname>$acl_arg1</varname> to <varname>$acl_arg9</varname> in order.
13657 Any unused are made empty.  The variable <varname>$acl_narg</varname> is set to the number of
13658 arguments.  The named ACL (see chapter <xref linkend="CHAPACL"/>) is called
13659 and may use the variables; if another acl expansion is used the values
13660 are restored after it returns.  If the ACL sets
13661 a value using a "message =" modifier and returns accept or deny, the value becomes
13662 the result of the expansion.
13663 If no message is set and the ACL returns accept or deny
13664 the expansion result is an empty string.
13665 If the ACL returns defer the result is a forced-fail.  Otherwise the expansion fails.
13666 </para>
13667 </listitem></varlistentry>
13668 <varlistentry>
13669 <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>
13670 <listitem>
13671 <para>
13672 <indexterm role="concept">
13673 <primary>expansion</primary>
13674 <secondary>extracting certificate fields</secondary>
13675 </indexterm>
13676 <indexterm role="concept">
13677 <primary><option>certextract</option></primary>
13678 <secondary>certificate fields</secondary>
13679 </indexterm>
13680 <indexterm role="concept">
13681 <primary>certificate</primary>
13682 <secondary>extracting fields</secondary>
13683 </indexterm>
13684 The &lt;<emphasis>certificate</emphasis>&gt; must be a variable of type certificate.
13685 The field name is expanded and used to retrieve the relevant field from
13686 the certificate.  Supported fields are:
13687 </para>
13688 <literallayout>
13689 <literal>version        </literal>
13690 <literal>serial_number  </literal>
13691 <literal>subject        </literal> RFC4514 DN
13692 <literal>issuer         </literal> RFC4514 DN
13693 <literal>notbefore      </literal> time
13694 <literal>notafter       </literal> time
13695 <literal>sig_algorithm  </literal>
13696 <literal>signature      </literal>
13697 <literal>subj_altname   </literal> tagged list
13698 <literal>ocsp_uri       </literal> list
13699 <literal>crl_uri        </literal> list
13700 </literallayout>
13701 <para>
13702 If the field is found,
13703 &lt;<emphasis>string2</emphasis>&gt; is expanded, and replaces the whole item;
13704 otherwise &lt;<emphasis>string3</emphasis>&gt; is used. During the expansion of &lt;<emphasis>string2</emphasis>&gt; the
13705 variable <varname>$value</varname> contains the value that has been extracted. Afterwards, it
13706 is restored to any previous value it might have had.
13707 </para>
13708 <para>
13709 If {&lt;<emphasis>string3</emphasis>&gt;} is omitted, the item is replaced by an empty string if the
13710 key is not found. If {&lt;<emphasis>string2</emphasis>&gt;} is also omitted, the value that was
13711 extracted is used.
13712 </para>
13713 <para>
13714 Some field names take optional modifiers, appended and separated by commas.
13715 </para>
13716 <para>
13717 The field selectors marked as "RFC4514" above
13718 output a Distinguished Name string which is
13719 not quite
13720 parseable by Exim as a comma-separated tagged list
13721 (the exceptions being elements containing commas).
13722 RDN elements of a single type may be selected by
13723 a modifier of the type label; if so the expansion
13724 result is a list (newline-separated by default).
13725 The separator may be changed by another modifier of
13726 a right angle-bracket followed immediately by the new separator.
13727 Recognised RDN type labels include "CN", "O", "OU" and "DC".
13728 </para>
13729 <para>
13730 The field selectors marked as "time" above
13731 take an optional modifier of "int"
13732 for which the result is the number of seconds since epoch.
13733 Otherwise the result is a human-readable string
13734 in the timezone selected by the main "timezone" option.
13735 </para>
13736 <para>
13737 The field selectors marked as "list" above return a list,
13738 newline-separated by default,
13739 (embedded separator characters in elements are doubled).
13740 The separator may be changed by a modifier of
13741 a right angle-bracket followed immediately by the new separator.
13742 </para>
13743 <para>
13744 The field selectors marked as "tagged" above
13745 prefix each list element with a type string and an equals sign.
13746 Elements of only one type may be selected by a modifier
13747 which is one of "dns", "uri" or "mail";
13748 if so the element tags are omitted.
13749 </para>
13750 <para>
13751 If not otherwise noted field values are presented in human-readable form.
13752 </para>
13753 </listitem></varlistentry>
13754 <varlistentry>
13755 <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>
13756 <listitem>
13757 <para>
13758 <indexterm role="concept">
13759 <primary><option>dlfunc</option></primary>
13760 </indexterm>
13761 This expansion dynamically loads and then calls a locally-written C function.
13762 This functionality is available only if Exim is compiled with
13763 </para>
13764 <literallayout class="monospaced">
13765 EXPAND_DLFUNC=yes
13766 </literallayout>
13767 <para>
13768 set in <filename>Local/Makefile</filename>. Once loaded, Exim remembers the dynamically loaded
13769 object so that it doesn&#x2019;t reload the same object file in the same Exim process
13770 (but of course Exim does start new processes frequently).
13771 </para>
13772 <para>
13773 There may be from zero to eight arguments to the function. When compiling
13774 a local function that is to be called in this way, <filename>local_scan.h</filename> should be
13775 included. The Exim variables and functions that are defined by that API
13776 are also available for dynamically loaded functions. The function itself
13777 must have the following type:
13778 </para>
13779 <literallayout class="monospaced">
13780 int dlfunction(uschar **yield, int argc, uschar *argv[])
13781 </literallayout>
13782 <para>
13783 Where <literal>uschar</literal> is a typedef for <literal>unsigned char</literal> in <filename>local_scan.h</filename>. The
13784 function should return one of the following values:
13785 </para>
13786 <para>
13787 <literal>OK</literal>: Success. The string that is placed in the variable <emphasis>yield</emphasis> is put
13788 into the expanded string that is being built.
13789 </para>
13790 <para>
13791 <literal>FAIL</literal>: A non-forced expansion failure occurs, with the error message taken
13792 from <emphasis>yield</emphasis>, if it is set.
13793 </para>
13794 <para>
13795 <literal>FAIL_FORCED</literal>: A forced expansion failure occurs, with the error message
13796 taken from <emphasis>yield</emphasis> if it is set.
13797 </para>
13798 <para>
13799 <literal>ERROR</literal>: Same as <literal>FAIL</literal>, except that a panic log entry is written.
13800 </para>
13801 <para>
13802 When compiling a function that is to be used in this way with gcc,
13803 you need to add <option>-shared</option> to the gcc command. Also, in the Exim build-time
13804 configuration, you must add <option>-export-dynamic</option> to EXTRALIBS.
13805 </para>
13806 </listitem></varlistentry>
13807 <varlistentry>
13808 <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>
13809 <listitem>
13810 <para>
13811 <indexterm role="concept">
13812 <primary>expansion</primary>
13813 <secondary>extracting value from environment</secondary>
13814 </indexterm>
13815 <indexterm role="concept">
13816 <primary>environment</primary>
13817 <secondary>values from</secondary>
13818 </indexterm>
13819 The key is first expanded separately, and leading and trailing white space
13820 removed.
13821 This is then searched for as a name in the environment.
13822 If a variable is found then its value is placed in <varname>$value</varname>
13823 and &lt;<emphasis>string1</emphasis>&gt; is expanded, otherwise &lt;<emphasis>string2</emphasis>&gt; is expanded.
13824 </para>
13825 <para>
13826 Instead of {&lt;<emphasis>string2</emphasis>&gt;} the word <quote>fail</quote> (not in curly brackets) can
13827 appear, for example:
13828 </para>
13829 <literallayout class="monospaced">
13830 ${env{USER}{$value} fail }
13831 </literallayout>
13832 <para>
13833 This forces an expansion failure (see section <xref linkend="SECTforexpfai"/>);
13834 {&lt;<emphasis>string1</emphasis>&gt;} must be present for <quote>fail</quote> to be recognized.
13835 </para>
13836 <para>
13837 If {&lt;<emphasis>string2</emphasis>&gt;} is omitted an empty string is substituted on
13838 search failure.
13839 If {&lt;<emphasis>string1</emphasis>&gt;} is omitted the search result is substituted on
13840 search success.
13841 </para>
13842 <para>
13843 The environment is adjusted by the <option>keep_environment</option> and
13844 <option>add_environment</option> main section options.
13845 </para>
13846 </listitem></varlistentry>
13847 <varlistentry>
13848 <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>
13849 <listitem>
13850 <para>
13851 <indexterm role="concept">
13852 <primary>expansion</primary>
13853 <secondary>extracting substrings by key</secondary>
13854 </indexterm>
13855 <indexterm role="concept">
13856 <primary><option>extract</option></primary>
13857 <secondary>substrings by key</secondary>
13858 </indexterm>
13859 The key and &lt;<emphasis>string1</emphasis>&gt; are first expanded separately. Leading and trailing
13860 white space is removed from the key (but not from any of the strings). The key
13861 must not be empty and must not consist entirely of digits.
13862 The expanded &lt;<emphasis>string1</emphasis>&gt; must be of the form:
13863 </para>
13864 <literallayout>
13865 &lt;<emphasis>key1</emphasis>&gt; = &lt;<emphasis>value1</emphasis>&gt;  &lt;<emphasis>key2</emphasis>&gt; = &lt;<emphasis>value2</emphasis>&gt; ...
13866 </literallayout>
13867 <para>
13868 <indexterm role="variable">
13869 <primary><varname>$value</varname></primary>
13870 </indexterm>
13871 where the equals signs and spaces (but not both) are optional. If any of the
13872 values contain white space, they must be enclosed in double quotes, and any
13873 values that are enclosed in double quotes are subject to escape processing as
13874 described in section <xref linkend="SECTstrings"/>. The expanded &lt;<emphasis>string1</emphasis>&gt; is searched
13875 for the value that corresponds to the key. The search is case-insensitive. If
13876 the key is found, &lt;<emphasis>string2</emphasis>&gt; is expanded, and replaces the whole item;
13877 otherwise &lt;<emphasis>string3</emphasis>&gt; is used. During the expansion of &lt;<emphasis>string2</emphasis>&gt; the
13878 variable <varname>$value</varname> contains the value that has been extracted. Afterwards, it
13879 is restored to any previous value it might have had.
13880 </para>
13881 <para>
13882 If {&lt;<emphasis>string3</emphasis>&gt;} is omitted, the item is replaced by an empty string if the
13883 key is not found. If {&lt;<emphasis>string2</emphasis>&gt;} is also omitted, the value that was
13884 extracted is used. Thus, for example, these two expansions are identical, and
13885 yield <quote>2001</quote>:
13886 </para>
13887 <literallayout class="monospaced">
13888 ${extract{gid}{uid=1984 gid=2001}}
13889 ${extract{gid}{uid=1984 gid=2001}{$value}}
13890 </literallayout>
13891 <para>
13892 Instead of {&lt;<emphasis>string3</emphasis>&gt;} the word <quote>fail</quote> (not in curly brackets) can
13893 appear, for example:
13894 </para>
13895 <literallayout class="monospaced">
13896 ${extract{Z}{A=... B=...}{$value} fail }
13897 </literallayout>
13898 <para>
13899 This forces an expansion failure (see section <xref linkend="SECTforexpfai"/>);
13900 {&lt;<emphasis>string2</emphasis>&gt;} must be present for <quote>fail</quote> to be recognized.
13901 </para>
13902 </listitem></varlistentry>
13903 <varlistentry>
13904 <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>
13905 <listitem>
13906 <para>
13907 <indexterm role="concept">
13908 <primary>expansion</primary>
13909 <secondary>extracting substrings by number</secondary>
13910 </indexterm>
13911 <indexterm role="concept">
13912 <primary><option>extract</option></primary>
13913 <secondary>substrings by number</secondary>
13914 </indexterm>
13915 The &lt;<emphasis>number</emphasis>&gt; argument must consist entirely of decimal digits,
13916 apart from leading and trailing white space, which is ignored.
13917 This is what distinguishes this form of <option>extract</option> from the previous kind. It
13918 behaves in the same way, except that, instead of extracting a named field, it
13919 extracts from &lt;<emphasis>string1</emphasis>&gt; the field whose number is given as the first
13920 argument. You can use <varname>$value</varname> in &lt;<emphasis>string2</emphasis>&gt; or <literal>fail</literal> instead of
13921 &lt;<emphasis>string3</emphasis>&gt; as before.
13922 </para>
13923 <para>
13924 The fields in the string are separated by any one of the characters in the
13925 separator string. These may include space or tab characters.
13926 The first field is numbered one. If the number is negative, the fields are
13927 counted from the end of the string, with the rightmost one numbered -1. If the
13928 number given is zero, the entire string is returned. If the modulus of the
13929 number is greater than the number of fields in the string, the result is the
13930 expansion of &lt;<emphasis>string3</emphasis>&gt;, or the empty string if &lt;<emphasis>string3</emphasis>&gt; is not
13931 provided. For example:
13932 </para>
13933 <literallayout class="monospaced">
13934 ${extract{2}{:}{x:42:99:&amp; Mailer::/bin/bash}}
13935 </literallayout>
13936 <para>
13937 yields <quote>42</quote>, and
13938 </para>
13939 <literallayout class="monospaced">
13940 ${extract{-4}{:}{x:42:99:&amp; Mailer::/bin/bash}}
13941 </literallayout>
13942 <para>
13943 yields <quote>99</quote>. Two successive separators mean that the field between them is
13944 empty (for example, the fifth field above).
13945 </para>
13946 </listitem></varlistentry>
13947 <varlistentry>
13948 <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>
13949 <listitem>
13950 <para>
13951 <indexterm role="concept">
13952 <primary>list</primary>
13953 <secondary>selecting by condition</secondary>
13954 </indexterm>
13955 <indexterm role="concept">
13956 <primary>expansion</primary>
13957 <secondary>selecting from list by condition</secondary>
13958 </indexterm>
13959 <indexterm role="variable">
13960 <primary><varname>$item</varname></primary>
13961 </indexterm>
13962 After expansion, &lt;<emphasis>string</emphasis>&gt; is interpreted as a list, colon-separated by
13963 default, but the separator can be changed in the usual way. For each item
13964 in this list, its value is place in <varname>$item</varname>, and then the condition is
13965 evaluated. If the condition is true, <varname>$item</varname> is added to the output as an
13966 item in a new list; if the condition is false, the item is discarded. The
13967 separator used for the output list is the same as the one used for the
13968 input, but a separator setting is not included in the output. For example:
13969 </para>
13970 <literallayout class="monospaced">
13971 ${filter{a:b:c}{!eq{$item}{b}}
13972 </literallayout>
13973 <para>
13974 yields <literal>a:c</literal>. At the end of the expansion, the value of <varname>$item</varname> is restored
13975 to what it was before. See also the <emphasis role="bold">map</emphasis> and <emphasis role="bold">reduce</emphasis> expansion items.
13976 </para>
13977 </listitem></varlistentry>
13978 <varlistentry>
13979 <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>
13980 <listitem>
13981 <para>
13982 <indexterm role="concept">
13983 <primary>hash function</primary>
13984 <secondary>textual</secondary>
13985 </indexterm>
13986 <indexterm role="concept">
13987 <primary>expansion</primary>
13988 <secondary>textual hash</secondary>
13989 </indexterm>
13990 This is a textual hashing function, and was the first to be implemented in
13991 early versions of Exim. In current releases, there are other hashing functions
13992 (numeric, MD5, and SHA-1), which are described below.
13993 </para>
13994 <para>
13995 The first two strings, after expansion, must be numbers. Call them &lt;<emphasis>m</emphasis>&gt; and
13996 &lt;<emphasis>n</emphasis>&gt;. If you are using fixed values for these numbers, that is, if
13997 &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you can
13998 use the simpler operator notation that avoids some of the braces:
13999 </para>
14000 <literallayout class="monospaced">
14001 ${hash_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
14002 </literallayout>
14003 <para>
14004 The second number is optional (in both notations). If &lt;<emphasis>n</emphasis>&gt; is greater than
14005 or equal to the length of the string, the expansion item returns the string.
14006 Otherwise it computes a new string of length &lt;<emphasis>n</emphasis>&gt; by applying a hashing
14007 function to the string. The new string consists of characters taken from the
14008 first &lt;<emphasis>m</emphasis>&gt; characters of the string
14009 </para>
14010 <literallayout class="monospaced">
14011 abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQWRSTUVWXYZ0123456789
14012 </literallayout>
14013 <para>
14014 If &lt;<emphasis>m</emphasis>&gt; is not present the value 26 is used, so that only lower case
14015 letters appear. For example:
14016 </para>
14017 <literallayout>
14018 <literal>$hash{3}{monty}}           </literal>   yields  <literal>jmg</literal>
14019 <literal>$hash{5}{monty}}           </literal>   yields  <literal>monty</literal>
14020 <literal>$hash{4}{62}{monty python}}</literal>   yields  <literal>fbWx</literal>
14021 </literallayout>
14022 </listitem></varlistentry>
14023 <varlistentry>
14024 <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>
14025 <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>
14026 <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>
14027 <listitem>
14028 <para>
14029 <indexterm role="concept">
14030 <primary>expansion</primary>
14031 <secondary>header insertion</secondary>
14032 </indexterm>
14033 <indexterm role="variable">
14034 <primary><varname>$header_</varname></primary>
14035 </indexterm>
14036 <indexterm role="variable">
14037 <primary><varname>$bheader_</varname></primary>
14038 </indexterm>
14039 <indexterm role="variable">
14040 <primary><varname>$rheader_</varname></primary>
14041 </indexterm>
14042 <indexterm role="concept">
14043 <primary>header lines</primary>
14044 <secondary>in expansion strings</secondary>
14045 </indexterm>
14046 <indexterm role="concept">
14047 <primary>header lines</primary>
14048 <secondary>character sets</secondary>
14049 </indexterm>
14050 <indexterm role="concept">
14051 <primary>header lines</primary>
14052 <secondary>decoding</secondary>
14053 </indexterm>
14054 Substitute the contents of the named message header line, for example
14055 </para>
14056 <literallayout class="monospaced">
14057 $header_reply-to:
14058 </literallayout>
14059 <para>
14060 The newline that terminates a header line is not included in the expansion, but
14061 internal newlines (caused by splitting the header line over several physical
14062 lines) may be present.
14063 </para>
14064 <para>
14065 The difference between <option>rheader</option>, <option>bheader</option>, and <option>header</option> is in the way
14066 the data in the header line is interpreted.
14067 </para>
14068 <itemizedlist>
14069 <listitem>
14070 <para>
14071 <indexterm role="concept">
14072 <primary>white space</primary>
14073 <secondary>in header lines</secondary>
14074 </indexterm>
14075 <option>rheader</option> gives the original <quote>raw</quote> content of the header line, with no
14076 processing at all, and without the removal of leading and trailing white space.
14077 </para>
14078 </listitem>
14079 <listitem>
14080 <para>
14081 <indexterm role="concept">
14082 <primary>base64 encoding</primary>
14083 <secondary>in header lines</secondary>
14084 </indexterm>
14085 <option>bheader</option> removes leading and trailing white space, and then decodes base64
14086 or quoted-printable MIME <quote>words</quote> within the header text, but does no
14087 character set translation. If decoding of what looks superficially like a MIME
14088 <quote>word</quote> fails, the raw string is returned. If decoding
14089 <indexterm role="concept">
14090 <primary>binary zero</primary>
14091 <secondary>in header line</secondary>
14092 </indexterm>
14093 produces a binary zero character, it is replaced by a question mark &ndash; this is
14094 what Exim does for binary zeros that are actually received in header lines.
14095 </para>
14096 </listitem>
14097 <listitem>
14098 <para>
14099 <option>header</option> tries to translate the string as decoded by <option>bheader</option> to a
14100 standard character set. This is an attempt to produce the same string as would
14101 be displayed on a user&#x2019;s MUA. If translation fails, the <option>bheader</option> string is
14102 returned. Translation is attempted only on operating systems that support the
14103 <function>iconv()</function> function. This is indicated by the compile-time macro HAVE_ICONV in
14104 a system Makefile or in <filename>Local/Makefile</filename>.
14105 </para>
14106 </listitem>
14107 </itemizedlist>
14108 <para>
14109 In a filter file, the target character set for <option>header</option> can be specified by a
14110 command of the following form:
14111 </para>
14112 <literallayout class="monospaced">
14113 headers charset "UTF-8"
14114 </literallayout>
14115 <para>
14116 This command affects all references to <varname>$h_</varname> (or <varname>$header_</varname>) expansions in
14117 subsequently obeyed filter commands. In the absence of this command, the target
14118 character set in a filter is taken from the setting of the <option>headers_charset</option>
14119 option in the runtime configuration. The value of this option defaults to the
14120 value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The ultimate default is
14121 ISO-8859-1.
14122 </para>
14123 <para>
14124 Header names follow the syntax of RFC 2822, which states that they may contain
14125 any printing characters except space and colon. Consequently, curly brackets
14126 <emphasis>do not</emphasis> terminate header names, and should not be used to enclose them as
14127 if they were variables. Attempting to do so causes a syntax error.
14128 </para>
14129 <para>
14130 Only header lines that are common to all copies of a message are visible to
14131 this mechanism. These are the original header lines that are received with the
14132 message, and any that are added by an ACL statement or by a system
14133 filter. Header lines that are added to a particular copy of a message by a
14134 router or transport are not accessible.
14135 </para>
14136 <para>
14137 For incoming SMTP messages, no header lines are visible in
14138 ACLs that are obeyed before the data phase completes,
14139 because the header structure is not set up until the message is received.
14140 They are visible in DKIM, PRDR and DATA ACLs.
14141 Header lines that are added in a RCPT ACL (for example)
14142 are saved until the message&#x2019;s incoming header lines are available, at which
14143 point they are added.
14144 When any of the above ACLs ar
14145 running, however, header lines added by earlier ACLs are visible.
14146 </para>
14147 <para>
14148 Upper case and lower case letters are synonymous in header names. If the
14149 following character is white space, the terminating colon may be omitted, but
14150 this is not recommended, because you may then forget it when it is needed. When
14151 white space terminates the header name, this white space is included in the
14152 expanded string.  If the message does not contain the given header, the
14153 expansion item is replaced by an empty string. (See the <option>def</option> condition in
14154 section <xref linkend="SECTexpcond"/> for a means of testing for the existence of a
14155 header.)
14156 </para>
14157 <para>
14158 If there is more than one header with the same name, they are all concatenated
14159 to form the substitution string, up to a maximum length of 64K. Unless
14160 <option>rheader</option> is being used, leading and trailing white space is removed from
14161 each header before concatenation, and a completely empty header is ignored. A
14162 newline character is then inserted between non-empty headers, but there is no
14163 newline at the very end. For the <option>header</option> and <option>bheader</option> expansion, for
14164 those headers that contain lists of addresses, a comma is also inserted at the
14165 junctions between headers. This does not happen for the <option>rheader</option> expansion.
14166 </para>
14167 </listitem></varlistentry>
14168 <varlistentry>
14169 <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>
14170 <listitem>
14171 <para>
14172 <indexterm role="concept">
14173 <primary>expansion</primary>
14174 <secondary>hmac hashing</secondary>
14175 </indexterm>
14176 <indexterm role="concept">
14177 <primary><option>hmac</option></primary>
14178 </indexterm>
14179 This function uses cryptographic hashing (either MD5 or SHA-1) to convert a
14180 shared secret and some text into a message authentication code, as specified in
14181 RFC 2104. This differs from <literal>${md5:secret_text...}</literal> or
14182 <literal>${sha1:secret_text...}</literal> in that the hmac step adds a signature to the
14183 cryptographic hash, allowing for authentication that is not possible with MD5
14184 or SHA-1 alone. The hash name must expand to either <literal>md5</literal> or <literal>sha1</literal> at
14185 present. For example:
14186 </para>
14187 <literallayout class="monospaced">
14188 ${hmac{md5}{somesecret}{$primary_hostname $tod_log}}
14189 </literallayout>
14190 <para>
14191 For the hostname <emphasis>mail.example.com</emphasis> and time 2002-10-17 11:30:59, this
14192 produces:
14193 </para>
14194 <literallayout class="monospaced">
14195 dd97e3ba5d1a61b5006108f8c8252953
14196 </literallayout>
14197 <para>
14198 As an example of how this might be used, you might put in the main part of
14199 an Exim configuration:
14200 </para>
14201 <literallayout class="monospaced">
14202 SPAMSCAN_SECRET=cohgheeLei2thahw
14203 </literallayout>
14204 <para>
14205 In a router or a transport you could then have:
14206 </para>
14207 <literallayout class="monospaced">
14208 headers_add = \
14209   X-Spam-Scanned: ${primary_hostname} ${message_exim_id} \
14210   ${hmac{md5}{SPAMSCAN_SECRET}\
14211   {${primary_hostname},${message_exim_id},$h_message-id:}}
14212 </literallayout>
14213 <para>
14214 Then given a message, you can check where it was scanned by looking at the
14215 <emphasis>X-Spam-Scanned:</emphasis> header line. If you know the secret, you can check that
14216 this header line is authentic by recomputing the authentication code from the
14217 host name, message ID and the <emphasis>Message-id:</emphasis> header line. This can be done
14218 using Exim&#x2019;s <option>-be</option> option, or by other means, for example by using the
14219 <emphasis>hmac_md5_hex()</emphasis> function in Perl.
14220 </para>
14221 </listitem></varlistentry>
14222 <varlistentry>
14223 <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>
14224 <listitem>
14225 <para>
14226 <indexterm role="concept">
14227 <primary>expansion</primary>
14228 <secondary>conditional</secondary>
14229 </indexterm>
14230 <indexterm role="concept">
14231 <primary><option>if</option>, expansion item</primary>
14232 </indexterm>
14233 If &lt;<emphasis>condition</emphasis>&gt; is true, &lt;<emphasis>string1</emphasis>&gt; is expanded and replaces the whole
14234 item; otherwise &lt;<emphasis>string2</emphasis>&gt; is used. The available conditions are described
14235 in section <xref linkend="SECTexpcond"/> below. For example:
14236 </para>
14237 <literallayout class="monospaced">
14238 ${if eq {$local_part}{postmaster} {yes}{no} }
14239 </literallayout>
14240 <para>
14241 The second string need not be present; if it is not and the condition is not
14242 true, the item is replaced with nothing. Alternatively, the word <quote>fail</quote> may
14243 be present instead of the second string (without any curly brackets). In this
14244 case, the expansion is forced to fail if the condition is not true (see section
14245 <xref linkend="SECTforexpfai"/>).
14246 </para>
14247 <para>
14248 If both strings are omitted, the result is the string <literal>true</literal> if the condition
14249 is true, and the empty string if the condition is false. This makes it less
14250 cumbersome to write custom ACL and router conditions. For example, instead of
14251 </para>
14252 <literallayout class="monospaced">
14253 condition = ${if &gt;{$acl_m4}{3}{true}{false}}
14254 </literallayout>
14255 <para>
14256 you can use
14257 </para>
14258 <literallayout class="monospaced">
14259 condition = ${if &gt;{$acl_m4}{3}}
14260 </literallayout>
14261 </listitem></varlistentry>
14262 <varlistentry>
14263 <term><emphasis role="bold">${imapfolder{</emphasis>&lt;<emphasis>foldername</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
14264 <listitem>
14265 <para>
14266 <indexterm role="concept">
14267 <primary>expansion</primary>
14268 <secondary>imap folder</secondary>
14269 </indexterm>
14270 <indexterm role="concept">
14271 <primary><option>imapfolder</option> expansion item</primary>
14272 </indexterm>
14273 This item converts a (possibly multilevel, or with non-ASCII characters)
14274 folder specification to a Maildir name for filesystem use.
14275 For information on internationalisation support see <xref linkend="SECTi18nMDA"/>.
14276 </para>
14277 </listitem></varlistentry>
14278 <varlistentry>
14279 <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>
14280 <listitem>
14281 <para>
14282 <indexterm role="concept">
14283 <primary>expansion</primary>
14284 <secondary>string truncation</secondary>
14285 </indexterm>
14286 <indexterm role="concept">
14287 <primary><option>length</option> expansion item</primary>
14288 </indexterm>
14289 The <option>length</option> item is used to extract the initial portion of a string. Both
14290 strings are expanded, and the first one must yield a number, &lt;<emphasis>n</emphasis>&gt;, say. If
14291 you are using a fixed value for the number, that is, if &lt;<emphasis>string1</emphasis>&gt; does not
14292 change when expanded, you can use the simpler operator notation that avoids
14293 some of the braces:
14294 </para>
14295 <literallayout class="monospaced">
14296 ${length_&lt;n&gt;:&lt;string&gt;}
14297 </literallayout>
14298 <para>
14299 The result of this item is either the first &lt;<emphasis>n</emphasis>&gt; characters or the whole
14300 of &lt;<emphasis>string2</emphasis>&gt;, whichever is the shorter. Do not confuse <option>length</option> with
14301 <option>strlen</option>, which gives the length of a string.
14302 </para>
14303 </listitem></varlistentry>
14304 <varlistentry>
14305 <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>
14306 <listitem>
14307 <para>
14308 <indexterm role="concept">
14309 <primary>expansion</primary>
14310 <secondary>extracting list elements by number</secondary>
14311 </indexterm>
14312 <indexterm role="concept">
14313 <primary><option>listextract</option></primary>
14314 <secondary>extract list elements by number</secondary>
14315 </indexterm>
14316 <indexterm role="concept">
14317 <primary>list</primary>
14318 <secondary>extracting elements by number</secondary>
14319 </indexterm>
14320 The &lt;<emphasis>number</emphasis>&gt; argument must consist entirely of decimal digits,
14321 apart from an optional leading minus,
14322 and leading and trailing white space (which is ignored).
14323 </para>
14324 <para>
14325 After expansion, &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by
14326 default, but the separator can be changed in the usual way.
14327 </para>
14328 <para>
14329 The first field of the list is numbered one.
14330 If the number is negative, the fields are
14331 counted from the end of the list, with the rightmost one numbered -1.
14332 The numbered element of the list is extracted and placed in <varname>$value</varname>,
14333 then &lt;<emphasis>string2</emphasis>&gt; is expanded as the result.
14334 </para>
14335 <para>
14336 If the modulus of the
14337 number is zero or greater than the number of fields in the string,
14338 the result is the expansion of &lt;<emphasis>string3</emphasis>&gt;.
14339 </para>
14340 <para>
14341 For example:
14342 </para>
14343 <literallayout class="monospaced">
14344 ${listextract{2}{x:42:99}}
14345 </literallayout>
14346 <para>
14347 yields <quote>42</quote>, and
14348 </para>
14349 <literallayout class="monospaced">
14350 ${listextract{-3}{&lt;, x,42,99,&amp; Mailer,,/bin/bash}{result: $value}}
14351 </literallayout>
14352 <para>
14353 yields <quote>result: 42</quote>.
14354 </para>
14355 <para>
14356 If {&lt;<emphasis>string3</emphasis>&gt;} is omitted, an empty string is used for string3.
14357 If {&lt;<emphasis>string2</emphasis>&gt;} is also omitted, the value that was
14358 extracted is used.
14359 You can use <literal>fail</literal> instead of {&lt;<emphasis>string3</emphasis>&gt;} as in a string extract.
14360 </para>
14361 </listitem></varlistentry>
14362 <varlistentry>
14363 <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>
14364 <listitem>
14365 <para>
14366 This is the first of one of two different types of lookup item, which are both
14367 described in the next item.
14368 </para>
14369 </listitem></varlistentry>
14370 <varlistentry>
14371 <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>
14372 <listitem>
14373 <para>
14374 <indexterm role="concept">
14375 <primary>expansion</primary>
14376 <secondary>lookup in</secondary>
14377 </indexterm>
14378 <indexterm role="concept">
14379 <primary>file</primary>
14380 <secondary>lookups</secondary>
14381 </indexterm>
14382 <indexterm role="concept">
14383 <primary>lookup</primary>
14384 <secondary>in expanded string</secondary>
14385 </indexterm>
14386 The two forms of lookup item specify data lookups in files and databases, as
14387 discussed in chapter <xref linkend="CHAPfdlookup"/>. The first form is used for single-key
14388 lookups, and the second is used for query-style lookups. The &lt;<emphasis>key</emphasis>&gt;,
14389 &lt;<emphasis>file</emphasis>&gt;, and &lt;<emphasis>query</emphasis>&gt; strings are expanded before use.
14390 </para>
14391 <para>
14392 If there is any white space in a lookup item which is part of a filter command,
14393 a retry or rewrite rule, a routing rule for the <command>manualroute</command> router, or any
14394 other place where white space is significant, the lookup item must be enclosed
14395 in double quotes. The use of data lookups in users&#x2019; filter files may be locked
14396 out by the system administrator.
14397 </para>
14398 <para>
14399 <indexterm role="variable">
14400 <primary><varname>$value</varname></primary>
14401 </indexterm>
14402 If the lookup succeeds, &lt;<emphasis>string1</emphasis>&gt; is expanded and replaces the entire item.
14403 During its expansion, the variable <varname>$value</varname> contains the data returned by the
14404 lookup. Afterwards it reverts to the value it had previously (at the outer
14405 level it is empty). If the lookup fails, &lt;<emphasis>string2</emphasis>&gt; is expanded and replaces
14406 the entire item. If {&lt;<emphasis>string2</emphasis>&gt;} is omitted, the replacement is the empty
14407 string on failure. If &lt;<emphasis>string2</emphasis>&gt; is provided, it can itself be a nested
14408 lookup, thus providing a mechanism for looking up a default value when the
14409 original lookup fails.
14410 </para>
14411 <para>
14412 If a nested lookup is used as part of &lt;<emphasis>string1</emphasis>&gt;, <varname>$value</varname> contains the
14413 data for the outer lookup while the parameters of the second lookup are
14414 expanded, and also while &lt;<emphasis>string2</emphasis>&gt; of the second lookup is expanded, should
14415 the second lookup fail. Instead of {&lt;<emphasis>string2</emphasis>&gt;} the word <quote>fail</quote> can
14416 appear, and in this case, if the lookup fails, the entire expansion is forced
14417 to fail (see section <xref linkend="SECTforexpfai"/>). If both {&lt;<emphasis>string1</emphasis>&gt;} and
14418 {&lt;<emphasis>string2</emphasis>&gt;} are omitted, the result is the looked up value in the case of a
14419 successful lookup, and nothing in the case of failure.
14420 </para>
14421 <para>
14422 For single-key lookups, the string <quote>partial</quote> is permitted to precede the
14423 search type in order to do partial matching, and * or *@ may follow a search
14424 type to request default lookups if the key does not match (see sections
14425 <xref linkend="SECTdefaultvaluelookups"/> and <xref linkend="SECTpartiallookup"/> for details).
14426 </para>
14427 <para>
14428 <indexterm role="concept">
14429 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
14430 <secondary>in lookup expansion</secondary>
14431 </indexterm>
14432 If a partial search is used, the variables <varname>$1</varname> and <varname>$2</varname> contain the wild
14433 and non-wild parts of the key during the expansion of the replacement text.
14434 They return to their previous values at the end of the lookup item.
14435 </para>
14436 <para>
14437 This example looks up the postmaster alias in the conventional alias file:
14438 </para>
14439 <literallayout class="monospaced">
14440 ${lookup {postmaster} lsearch {/etc/aliases} {$value}}
14441 </literallayout>
14442 <para>
14443 This example uses NIS+ to look up the full name of the user corresponding to
14444 the local part of an address, forcing the expansion to fail if it is not found:
14445 </para>
14446 <literallayout class="monospaced">
14447 ${lookup nisplus {[name=$local_part],passwd.org_dir:gcos} \
14448   {$value}fail}
14449 </literallayout>
14450 </listitem></varlistentry>
14451 <varlistentry>
14452 <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>
14453 <listitem>
14454 <para>
14455 <indexterm role="concept">
14456 <primary>expansion</primary>
14457 <secondary>list creation</secondary>
14458 </indexterm>
14459 <indexterm role="variable">
14460 <primary><varname>$item</varname></primary>
14461 </indexterm>
14462 After expansion, &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by
14463 default, but the separator can be changed in the usual way. For each item
14464 in this list, its value is place in <varname>$item</varname>, and then &lt;<emphasis>string2</emphasis>&gt; is
14465 expanded and added to the output as an item in a new list. The separator used
14466 for the output list is the same as the one used for the input, but a separator
14467 setting is not included in the output. For example:
14468 </para>
14469 <literallayout class="monospaced">
14470 ${map{a:b:c}{[$item]}} ${map{&lt;- x-y-z}{($item)}}
14471 </literallayout>
14472 <para>
14473 expands to <literal>[a]:[b]:[c] (x)-(y)-(z)</literal>. At the end of the expansion, the
14474 value of <varname>$item</varname> is restored to what it was before. See also the <emphasis role="bold">filter</emphasis>
14475 and <emphasis role="bold">reduce</emphasis> expansion items.
14476 </para>
14477 </listitem></varlistentry>
14478 <varlistentry>
14479 <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>
14480 <listitem>
14481 <para>
14482 <indexterm role="concept">
14483 <primary>expansion</primary>
14484 <secondary>numeric hash</secondary>
14485 </indexterm>
14486 <indexterm role="concept">
14487 <primary>hash function</primary>
14488 <secondary>numeric</secondary>
14489 </indexterm>
14490 The three strings are expanded; the first two must yield numbers. Call them
14491 &lt;<emphasis>n</emphasis>&gt; and &lt;<emphasis>m</emphasis>&gt;. If you are using fixed values for these numbers, that is,
14492 if &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you
14493 can use the simpler operator notation that avoids some of the braces:
14494 </para>
14495 <literallayout class="monospaced">
14496 ${nhash_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
14497 </literallayout>
14498 <para>
14499 The second number is optional (in both notations). If there is only one number,
14500 the result is a number in the range 0&ndash;&lt;<emphasis>n</emphasis>&gt;-1. Otherwise, the string is
14501 processed by a div/mod hash function that returns two numbers, separated by a
14502 slash, in the ranges 0 to &lt;<emphasis>n</emphasis>&gt;-1 and 0 to &lt;<emphasis>m</emphasis>&gt;-1, respectively. For
14503 example,
14504 </para>
14505 <literallayout class="monospaced">
14506 ${nhash{8}{64}{supercalifragilisticexpialidocious}}
14507 </literallayout>
14508 <para>
14509 returns the string <quote>6/33</quote>.
14510 </para>
14511 </listitem></varlistentry>
14512 <varlistentry>
14513 <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>
14514 <listitem>
14515 <para>
14516 <indexterm role="concept">
14517 <primary>Perl</primary>
14518 <secondary>use in expanded string</secondary>
14519 </indexterm>
14520 <indexterm role="concept">
14521 <primary>expansion</primary>
14522 <secondary>calling Perl from</secondary>
14523 </indexterm>
14524 This item is available only if Exim has been built to include an embedded Perl
14525 interpreter. The subroutine name and the arguments are first separately
14526 expanded, and then the Perl subroutine is called with those arguments. No
14527 additional arguments need be given; the maximum number permitted, including the
14528 name of the subroutine, is nine.
14529 </para>
14530 <para>
14531 The return value of the subroutine is inserted into the expanded string, unless
14532 the return value is <option>undef</option>. In that case, the expansion fails in the same
14533 way as an explicit <quote>fail</quote> on a lookup item. The return value is a scalar.
14534 Whatever you return is evaluated in a scalar context. For example, if you
14535 return the name of a Perl vector, the return value is the size of the vector,
14536 not its contents.
14537 </para>
14538 <para>
14539 If the subroutine exits by calling Perl&#x2019;s <option>die</option> function, the expansion fails
14540 with the error message that was passed to <option>die</option>. More details of the embedded
14541 Perl facility are given in chapter <xref linkend="CHAPperl"/>.
14542 </para>
14543 <para>
14544 The <command>redirect</command> router has an option called <option>forbid_filter_perl</option> which locks
14545 out the use of this expansion item in filter files.
14546 </para>
14547 </listitem></varlistentry>
14548 <varlistentry>
14549 <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>
14550 <listitem>
14551 <para>
14552 <indexterm role="concept">
14553 <primary><option>prvs</option> expansion item</primary>
14554 </indexterm>
14555 The first argument is a complete email address and the second is secret
14556 keystring. The third argument, specifying a key number, is optional. If absent,
14557 it defaults to 0. The result of the expansion is a prvs-signed email address,
14558 to be typically used with the <option>return_path</option> option on an <command>smtp</command> transport
14559 as part of a bounce address tag validation (BATV) scheme. For more discussion
14560 and an example, see section <xref linkend="SECTverifyPRVS"/>.
14561 </para>
14562 </listitem></varlistentry>
14563 <varlistentry>
14564 <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>
14565 <listitem>
14566 <para>
14567 <indexterm role="concept">
14568 <primary><option>prvscheck</option> expansion item</primary>
14569 </indexterm>
14570 This expansion item is the complement of the <option>prvs</option> item. It is used for
14571 checking prvs-signed addresses. If the expansion of the first argument does not
14572 yield a syntactically valid prvs-signed address, the whole item expands to the
14573 empty string. When the first argument does expand to a syntactically valid
14574 prvs-signed address, the second argument is expanded, with the prvs-decoded
14575 version of the address and the key number extracted from the address in the
14576 variables <varname>$prvscheck_address</varname> and <varname>$prvscheck_keynum</varname>, respectively.
14577 </para>
14578 <para>
14579 These two variables can be used in the expansion of the second argument to
14580 retrieve the secret. The validity of the prvs-signed address is then checked
14581 against the secret. The result is stored in the variable <varname>$prvscheck_result</varname>,
14582 which is empty for failure or <quote>1</quote> for success.
14583 </para>
14584 <para>
14585 The third argument is optional; if it is missing, it defaults to an empty
14586 string. This argument is now expanded. If the result is an empty string, the
14587 result of the expansion is the decoded version of the address. This is the case
14588 whether or not the signature was valid. Otherwise, the result of the expansion
14589 is the expansion of the third argument.
14590 </para>
14591 <para>
14592 All three variables can be used in the expansion of the third argument.
14593 However, once the expansion is complete, only <varname>$prvscheck_result</varname> remains set.
14594 For more discussion and an example, see section <xref linkend="SECTverifyPRVS"/>.
14595 </para>
14596 </listitem></varlistentry>
14597 <varlistentry>
14598 <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>
14599 <listitem>
14600 <para>
14601 <indexterm role="concept">
14602 <primary>expansion</primary>
14603 <secondary>inserting an entire file</secondary>
14604 </indexterm>
14605 <indexterm role="concept">
14606 <primary>file</primary>
14607 <secondary>inserting into expansion</secondary>
14608 </indexterm>
14609 <indexterm role="concept">
14610 <primary><option>readfile</option> expansion item</primary>
14611 </indexterm>
14612 The file name and end-of-line string are first expanded separately. The file is
14613 then read, and its contents replace the entire item. All newline characters in
14614 the file are replaced by the end-of-line string if it is present. Otherwise,
14615 newlines are left in the string.
14616 String expansion is not applied to the contents of the file. If you want this,
14617 you must wrap the item in an <option>expand</option> operator. If the file cannot be read,
14618 the string expansion fails.
14619 </para>
14620 <para>
14621 The <command>redirect</command> router has an option called <option>forbid_filter_readfile</option> which
14622 locks out the use of this expansion item in filter files.
14623 </para>
14624 </listitem></varlistentry>
14625 <varlistentry>
14626 <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>
14627 <listitem>
14628 <para>
14629 <indexterm role="concept">
14630 <primary>expansion</primary>
14631 <secondary>inserting from a socket</secondary>
14632 </indexterm>
14633 <indexterm role="concept">
14634 <primary>socket, use of in expansion</primary>
14635 </indexterm>
14636 <indexterm role="concept">
14637 <primary><option>readsocket</option> expansion item</primary>
14638 </indexterm>
14639 This item inserts data from a Unix domain or TCP socket into the expanded
14640 string. The minimal way of using it uses just two arguments, as in these
14641 examples:
14642 </para>
14643 <literallayout class="monospaced">
14644 ${readsocket{/socket/name}{request string}}
14645 ${readsocket{inet:some.host:1234}{request string}}
14646 </literallayout>
14647 <para>
14648 For a Unix domain socket, the first substring must be the path to the socket.
14649 For an Internet socket, the first substring must contain <literal>inet:</literal> followed by
14650 a host name or IP address, followed by a colon and a port, which can be a
14651 number or the name of a TCP port in <filename>/etc/services</filename>. An IP address may
14652 optionally be enclosed in square brackets. This is best for IPv6 addresses. For
14653 example:
14654 </para>
14655 <literallayout class="monospaced">
14656 ${readsocket{inet:[::1]:1234}{request string}}
14657 </literallayout>
14658 <para>
14659 Only a single host name may be given, but if looking it up yields more than
14660 one IP address, they are each tried in turn until a connection is made. For
14661 both kinds of socket, Exim makes a connection, writes the request string
14662 unless it is an empty string; and no terminating NUL is ever sent)
14663 and reads from the socket until an end-of-file
14664 is read. A timeout of 5 seconds is applied. Additional, optional arguments
14665 extend what can be done. Firstly, you can vary the timeout. For example:
14666 </para>
14667 <literallayout class="monospaced">
14668 ${readsocket{/socket/name}{request string}{3s}}
14669 </literallayout>
14670 <para>
14671 The third argument is a list of options, of which the first element is the timeout
14672 and must be present if the argument is given.
14673 Further elements are options of form <emphasis>name=value</emphasis>.
14674 One option type is currently recognised, defining whether (the default)
14675 or not a shutdown is done on the connection after sending the request.
14676 Example, to not do so (preferred, eg. by some webservers):
14677 </para>
14678 <literallayout class="monospaced">
14679 ${readsocket{/socket/name}{request string}{3s:shutdown=no}}
14680 </literallayout>
14681 <para>
14682 A fourth argument allows you to change any newlines that are in the data
14683 that is read, in the same way as for <option>readfile</option> (see above). This example
14684 turns them into spaces:
14685 </para>
14686 <literallayout class="monospaced">
14687 ${readsocket{inet:127.0.0.1:3294}{request string}{3s}{ }}
14688 </literallayout>
14689 <para>
14690 As with all expansions, the substrings are expanded before the processing
14691 happens. Errors in these sub-expansions cause the expansion to fail. In
14692 addition, the following errors can occur:
14693 </para>
14694 <itemizedlist>
14695 <listitem>
14696 <para>
14697 Failure to create a socket file descriptor;
14698 </para>
14699 </listitem>
14700 <listitem>
14701 <para>
14702 Failure to connect the socket;
14703 </para>
14704 </listitem>
14705 <listitem>
14706 <para>
14707 Failure to write the request string;
14708 </para>
14709 </listitem>
14710 <listitem>
14711 <para>
14712 Timeout on reading from the socket.
14713 </para>
14714 </listitem>
14715 </itemizedlist>
14716 <para>
14717 By default, any of these errors causes the expansion to fail. However, if
14718 you supply a fifth substring, it is expanded and used when any of the above
14719 errors occurs. For example:
14720 </para>
14721 <literallayout class="monospaced">
14722 ${readsocket{/socket/name}{request string}{3s}{\n}\
14723   {socket failure}}
14724 </literallayout>
14725 <para>
14726 You can test for the existence of a Unix domain socket by wrapping this
14727 expansion in <literal>${if exists</literal>, but there is a race condition between that test
14728 and the actual opening of the socket, so it is safer to use the fifth argument
14729 if you want to be absolutely sure of avoiding an expansion error for a
14730 non-existent Unix domain socket, or a failure to connect to an Internet socket.
14731 </para>
14732 <para>
14733 The <command>redirect</command> router has an option called <option>forbid_filter_readsocket</option> which
14734 locks out the use of this expansion item in filter files.
14735 </para>
14736 </listitem></varlistentry>
14737 <varlistentry>
14738 <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>
14739 <listitem>
14740 <para>
14741 <indexterm role="concept">
14742 <primary>expansion</primary>
14743 <secondary>reducing a list to a scalar</secondary>
14744 </indexterm>
14745 <indexterm role="concept">
14746 <primary>list</primary>
14747 <secondary>reducing to a scalar</secondary>
14748 </indexterm>
14749 <indexterm role="variable">
14750 <primary><varname>$value</varname></primary>
14751 </indexterm>
14752 <indexterm role="variable">
14753 <primary><varname>$item</varname></primary>
14754 </indexterm>
14755 This operation reduces a list to a single, scalar string. After expansion,
14756 &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by default, but the
14757 separator can be changed in the usual way. Then &lt;<emphasis>string2</emphasis>&gt; is expanded and
14758 assigned to the <varname>$value</varname> variable. After this, each item in the &lt;<emphasis>string1</emphasis>&gt;
14759 list is assigned to <varname>$item</varname> in turn, and &lt;<emphasis>string3</emphasis>&gt; is expanded for each of
14760 them. The result of that expansion is assigned to <varname>$value</varname> before the next
14761 iteration. When the end of the list is reached, the final value of <varname>$value</varname> is
14762 added to the expansion output. The <emphasis role="bold">reduce</emphasis> expansion item can be used in a
14763 number of ways. For example, to add up a list of numbers:
14764 </para>
14765 <literallayout class="monospaced">
14766 ${reduce {&lt;, 1,2,3}{0}{${eval:$value+$item}}}
14767 </literallayout>
14768 <para>
14769 The result of that expansion would be <literal>6</literal>. The maximum of a list of numbers
14770 can be found:
14771 </para>
14772 <literallayout class="monospaced">
14773 ${reduce {3:0:9:4:6}{0}{${if &gt;{$item}{$value}{$item}{$value}}}}
14774 </literallayout>
14775 <para>
14776 At the end of a <emphasis role="bold">reduce</emphasis> expansion, the values of <varname>$item</varname> and <varname>$value</varname> are
14777 restored to what they were before. See also the <emphasis role="bold">filter</emphasis> and <emphasis role="bold">map</emphasis>
14778 expansion items.
14779 </para>
14780 </listitem></varlistentry>
14781 <varlistentry>
14782 <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>
14783 <listitem>
14784 <para>
14785 This item inserts <quote>raw</quote> header lines. It is described with the <option>header</option>
14786 expansion item above.
14787 </para>
14788 </listitem></varlistentry>
14789 <varlistentry>
14790 <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>
14791 <listitem>
14792 <para>
14793 <indexterm role="concept">
14794 <primary>expansion</primary>
14795 <secondary>running a command</secondary>
14796 </indexterm>
14797 <indexterm role="concept">
14798 <primary><option>run</option> expansion item</primary>
14799 </indexterm>
14800 The command and its arguments are first expanded as one string. The string is
14801 split apart into individual arguments by spaces, and then the command is run
14802 in a separate process, but under the same uid and gid.  As in other command
14803 executions from Exim, a shell is not used by default. If the command requires
14804 a shell, you must explicitly code it.
14805 </para>
14806 <para>
14807 Since the arguments are split by spaces, when there is a variable expansion
14808 which has an empty result, it will cause the situation that the argument will
14809 simply be omitted when the program is actually executed by Exim. If the
14810 script/program requires a specific number of arguments and the expanded
14811 variable could possibly result in this empty expansion, the variable must be
14812 quoted. This is more difficult if the expanded variable itself could result
14813 in a string containing quotes, because it would interfere with the quotes
14814 around the command arguments. A possible guard against this is to wrap the
14815 variable in the <option>sg</option> operator to change any quote marks to some other
14816 character.
14817 </para>
14818 <para>
14819 The standard input for the command exists, but is empty. The standard output
14820 and standard error are set to the same file descriptor.
14821 <indexterm role="concept">
14822 <primary>return code</primary>
14823 <secondary>from <option>run</option> expansion</secondary>
14824 </indexterm>
14825 <indexterm role="variable">
14826 <primary><varname>$value</varname></primary>
14827 </indexterm>
14828 If the command succeeds (gives a zero return code) &lt;<emphasis>string1</emphasis>&gt; is expanded
14829 and replaces the entire item; during this expansion, the standard output/error
14830 from the command is in the variable <varname>$value</varname>. If the command fails,
14831 &lt;<emphasis>string2</emphasis>&gt;, if present, is expanded and used. Once again, during the
14832 expansion, the standard output/error from the command is in the variable
14833 <varname>$value</varname>.
14834 </para>
14835 <para>
14836 If &lt;<emphasis>string2</emphasis>&gt; is absent, the result is empty. Alternatively, &lt;<emphasis>string2</emphasis>&gt;
14837 can be the word <quote>fail</quote> (not in braces) to force expansion failure if the
14838 command does not succeed. If both strings are omitted, the result is contents
14839 of the standard output/error on success, and nothing on failure.
14840 </para>
14841 <para>
14842 <indexterm role="variable">
14843 <primary><varname>$run_in_acl</varname></primary>
14844 </indexterm>
14845 The standard output/error of the command is put in the variable <varname>$value</varname>.
14846 In this ACL example, the output of a command is logged for the admin to
14847 troubleshoot:
14848 </para>
14849 <literallayout class="monospaced">
14850 warn  condition    = ${run{/usr/bin/id}{yes}{no}}
14851       log_message  = Output of id: $value
14852 </literallayout>
14853 <para>
14854 If the command requires shell idioms, such as the &gt; redirect operator, the
14855 shell must be invoked directly, such as with:
14856 </para>
14857 <literallayout class="monospaced">
14858 ${run{/bin/bash -c "/usr/bin/id &gt;/tmp/id"}{yes}{yes}}
14859 </literallayout>
14860 <para>
14861 <indexterm role="variable">
14862 <primary><varname>$runrc</varname></primary>
14863 </indexterm>
14864 The return code from the command is put in the variable <varname>$runrc</varname>, and this
14865 remains set afterwards, so in a filter file you can do things like this:
14866 </para>
14867 <literallayout class="monospaced">
14868 if "${run{x y z}{}}$runrc" is 1 then ...
14869   elif $runrc is 2 then ...
14870   ...
14871 endif
14872 </literallayout>
14873 <para>
14874 If execution of the command fails (for example, the command does not exist),
14875 the return code is 127 &ndash; the same code that shells use for non-existent
14876 commands.
14877 </para>
14878 <para>
14879 <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot assume the order in which
14880 option values are expanded, except for those preconditions whose order of
14881 testing is documented. Therefore, you cannot reliably expect to set <varname>$runrc</varname>
14882 by the expansion of one option, and use it in another.
14883 </para>
14884 <para>
14885 The <command>redirect</command> router has an option called <option>forbid_filter_run</option> which locks
14886 out the use of this expansion item in filter files.
14887 </para>
14888 </listitem></varlistentry>
14889 <varlistentry>
14890 <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>
14891 <listitem>
14892 <para>
14893 <indexterm role="concept">
14894 <primary>expansion</primary>
14895 <secondary>string substitution</secondary>
14896 </indexterm>
14897 <indexterm role="concept">
14898 <primary><option>sg</option> expansion item</primary>
14899 </indexterm>
14900 This item works like Perl&#x2019;s substitution operator (s) with the global (/g)
14901 option; hence its name. However, unlike the Perl equivalent, Exim does not
14902 modify the subject string; instead it returns the modified string for insertion
14903 into the overall expansion. The item takes three arguments: the subject string,
14904 a regular expression, and a substitution string. For example:
14905 </para>
14906 <literallayout class="monospaced">
14907 ${sg{abcdefabcdef}{abc}{xyz}}
14908 </literallayout>
14909 <para>
14910 yields <quote>xyzdefxyzdef</quote>. Because all three arguments are expanded before use,
14911 if any $, } or \ characters are required in the regular expression or in the
14912 substitution string, they have to be escaped. For example:
14913 </para>
14914 <literallayout class="monospaced">
14915 ${sg{abcdef}{^(...)(...)\$}{\$2\$1}}
14916 </literallayout>
14917 <para>
14918 yields <quote>defabc</quote>, and
14919 </para>
14920 <literallayout class="monospaced">
14921 ${sg{1=A 4=D 3=C}{\N(\d+)=\N}{K\$1=}}
14922 </literallayout>
14923 <para>
14924 yields <quote>K1=A K4=D K3=C</quote>. Note the use of <literal>\N</literal> to protect the contents of
14925 the regular expression from string expansion.
14926 </para>
14927 </listitem></varlistentry>
14928 <varlistentry>
14929 <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>
14930 <listitem>
14931 <para>
14932 <indexterm role="concept">
14933 <primary>sorting</primary>
14934 <secondary>a list</secondary>
14935 </indexterm>
14936 <indexterm role="concept">
14937 <primary>list</primary>
14938 <secondary>sorting</secondary>
14939 </indexterm>
14940 <indexterm role="concept">
14941 <primary>expansion</primary>
14942 <secondary>list sorting</secondary>
14943 </indexterm>
14944 After expansion, &lt;<emphasis>string</emphasis>&gt; is interpreted as a list, colon-separated by
14945 default, but the separator can be changed in the usual way.
14946 The &lt;<emphasis>comparator</emphasis>&gt; argument is interpreted as the operator
14947 of a two-argument expansion condition.
14948 The numeric operators plus ge, gt, le, lt (and ~i variants) are supported.
14949 The comparison should return true when applied to two values
14950 if the first value should sort before the second value.
14951 The &lt;<emphasis>extractor</emphasis>&gt; expansion is applied repeatedly to elements of the list,
14952 the element being placed in <varname>$item</varname>,
14953 to give values for comparison.
14954 </para>
14955 <para>
14956 The item result is a sorted list,
14957 with the original list separator,
14958 of the list elements (in full) of the original.
14959 </para>
14960 <para>
14961 Examples:
14962 </para>
14963 <literallayout class="monospaced">
14964 ${sort{3:2:1:4}{&lt;}{$item}}
14965 </literallayout>
14966 <para>
14967 sorts a list of numbers, and
14968 </para>
14969 <literallayout class="monospaced">
14970 ${sort {${lookup dnsdb{&gt;:,,mx=example.com}}} {&lt;} {${listextract{1}{&lt;,$item}}}}
14971 </literallayout>
14972 <para>
14973 will sort an MX lookup into priority order.
14974 </para>
14975 </listitem></varlistentry>
14976 <varlistentry>
14977 <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>
14978 <listitem>
14979 <para>
14980 <indexterm role="concept">
14981 <primary><option>substr</option> expansion item</primary>
14982 </indexterm>
14983 <indexterm role="concept">
14984 <primary>substring extraction</primary>
14985 </indexterm>
14986 <indexterm role="concept">
14987 <primary>expansion</primary>
14988 <secondary>substring extraction</secondary>
14989 </indexterm>
14990 The three strings are expanded; the first two must yield numbers. Call them
14991 &lt;<emphasis>n</emphasis>&gt; and &lt;<emphasis>m</emphasis>&gt;. If you are using fixed values for these numbers, that is,
14992 if &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you
14993 can use the simpler operator notation that avoids some of the braces:
14994 </para>
14995 <literallayout class="monospaced">
14996 ${substr_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
14997 </literallayout>
14998 <para>
14999 The second number is optional (in both notations).
15000 If it is absent in the simpler format, the preceding underscore must also be
15001 omitted.
15002 </para>
15003 <para>
15004 The <option>substr</option> item can be used to extract more general substrings than
15005 <option>length</option>. The first number, &lt;<emphasis>n</emphasis>&gt;, is a starting offset, and &lt;<emphasis>m</emphasis>&gt; is the
15006 length required. For example
15007 </para>
15008 <literallayout class="monospaced">
15009 ${substr{3}{2}{$local_part}}
15010 </literallayout>
15011 <para>
15012 If the starting offset is greater than the string length the result is the
15013 null string; if the length plus starting offset is greater than the string
15014 length, the result is the right-hand part of the string, starting from the
15015 given offset. The first character in the string has offset zero.
15016 </para>
15017 <para>
15018 The <option>substr</option> expansion item can take negative offset values to count
15019 from the right-hand end of its operand. The last character is offset -1, the
15020 second-last is offset -2, and so on. Thus, for example,
15021 </para>
15022 <literallayout class="monospaced">
15023 ${substr{-5}{2}{1234567}}
15024 </literallayout>
15025 <para>
15026 yields <quote>34</quote>. If the absolute value of a negative offset is greater than the
15027 length of the string, the substring starts at the beginning of the string, and
15028 the length is reduced by the amount of overshoot. Thus, for example,
15029 </para>
15030 <literallayout class="monospaced">
15031 ${substr{-5}{2}{12}}
15032 </literallayout>
15033 <para>
15034 yields an empty string, but
15035 </para>
15036 <literallayout class="monospaced">
15037 ${substr{-3}{2}{12}}
15038 </literallayout>
15039 <para>
15040 yields <quote>1</quote>.
15041 </para>
15042 <para>
15043 When the second number is omitted from <option>substr</option>, the remainder of the string
15044 is taken if the offset is positive. If it is negative, all characters in the
15045 string preceding the offset point are taken. For example, an offset of -1 and
15046 no length, as in these semantically identical examples:
15047 </para>
15048 <literallayout class="monospaced">
15049 ${substr_-1:abcde}
15050 ${substr{-1}{abcde}}
15051 </literallayout>
15052 <para>
15053 yields all but the last character of the string, that is, <quote>abcd</quote>.
15054 </para>
15055 </listitem></varlistentry>
15056 <varlistentry>
15057 <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>
15058 <listitem>
15059 <para>
15060 <indexterm role="concept">
15061 <primary>expansion</primary>
15062 <secondary>character translation</secondary>
15063 </indexterm>
15064 <indexterm role="concept">
15065 <primary><option>tr</option> expansion item</primary>
15066 </indexterm>
15067 This item does single-character translation on its subject string. The second
15068 argument is a list of characters to be translated in the subject string. Each
15069 matching character is replaced by the corresponding character from the
15070 replacement list. For example
15071 </para>
15072 <literallayout class="monospaced">
15073 ${tr{abcdea}{ac}{13}}
15074 </literallayout>
15075 <para>
15076 yields <literal>1b3de1</literal>. If there are duplicates in the second character string, the
15077 last occurrence is used. If the third string is shorter than the second, its
15078 last character is replicated. However, if it is empty, no translation takes
15079 place.
15080 </para>
15081 </listitem></varlistentry>
15082 </variablelist>
15083 </section>
15084 <section id="SECTexpop">
15085 <title>Expansion operators</title>
15086 <para>
15087 <indexterm role="concept">
15088 <primary>expansion</primary>
15089 <secondary>operators</secondary>
15090 </indexterm>
15091 For expansion items that perform transformations on a single argument string,
15092 the <quote>operator</quote> notation is used because it is simpler and uses fewer braces.
15093 The substring is first expanded before the operation is applied to it. The
15094 following operations can be performed:
15095 </para>
15096 <variablelist>
15097 <varlistentry>
15098 <term><emphasis role="bold">${address:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15099 <listitem>
15100 <para>
15101 <indexterm role="concept">
15102 <primary>expansion</primary>
15103 <secondary>RFC 2822 address handling</secondary>
15104 </indexterm>
15105 <indexterm role="concept">
15106 <primary><option>address</option> expansion item</primary>
15107 </indexterm>
15108 The string is interpreted as an RFC 2822 address, as it might appear in a
15109 header line, and the effective address is extracted from it. If the string does
15110 not parse successfully, the result is empty.
15111 </para>
15112 </listitem></varlistentry>
15113 <varlistentry>
15114 <term><emphasis role="bold">${addresses:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15115 <listitem>
15116 <para>
15117 <indexterm role="concept">
15118 <primary>expansion</primary>
15119 <secondary>RFC 2822 address handling</secondary>
15120 </indexterm>
15121 <indexterm role="concept">
15122 <primary><option>addresses</option> expansion item</primary>
15123 </indexterm>
15124 The string (after expansion) is interpreted as a list of addresses in RFC
15125 2822 format, such as can be found in a <emphasis>To:</emphasis> or <emphasis>Cc:</emphasis> header line. The
15126 operative address (<emphasis>local-part@domain</emphasis>) is extracted from each item, and the
15127 result of the expansion is a colon-separated list, with appropriate
15128 doubling of colons should any happen to be present in the email addresses.
15129 Syntactically invalid RFC2822 address items are omitted from the output.
15130 </para>
15131 <para>
15132 It is possible to specify a character other than colon for the output
15133 separator by starting the string with &gt; followed by the new separator
15134 character. For example:
15135 </para>
15136 <literallayout class="monospaced">
15137 ${addresses:&gt;&amp; Chief &lt;ceo@up.stairs&gt;, sec@base.ment (dogsbody)}
15138 </literallayout>
15139 <para>
15140 expands to <literal>ceo@up.stairs&amp;sec@base.ment</literal>. The string is expanded
15141 first, so if the expanded string starts with &gt;, it may change the output
15142 separator unintentionally. This can be avoided by setting the output
15143 separator explicitly:
15144 </para>
15145 <literallayout class="monospaced">
15146 ${addresses:&gt;:$h_from:}
15147 </literallayout>
15148 <para>
15149 Compare the <emphasis role="bold">address</emphasis> (singular)
15150 expansion item, which extracts the working address from a single RFC2822
15151 address. See the <emphasis role="bold">filter</emphasis>, <emphasis role="bold">map</emphasis>, and <emphasis role="bold">reduce</emphasis> items for ways of
15152 processing lists.
15153 </para>
15154 <para>
15155 To clarify "list of addresses in RFC 2822 format" mentioned above, Exim follows
15156 a strict interpretation of header line formatting.  Exim parses the bare,
15157 unquoted portion of an email address and if it finds a comma, treats it as an
15158 email address separator. For the example header line:
15159 </para>
15160 <literallayout class="monospaced">
15161 From: =?iso-8859-2?Q?Last=2C_First?= &lt;user@example.com&gt;
15162 </literallayout>
15163 <para>
15164 The first example below demonstrates that Q-encoded email addresses are parsed
15165 properly if it is given the raw header (in this example, <literal>$rheader_from:</literal>).
15166 It does not see the comma because it&#x2019;s still encoded as "=2C".  The second
15167 example below is passed the contents of <literal>$header_from:</literal>, meaning it gets
15168 de-mimed. Exim sees the decoded "," so it treats it as <emphasis role="bold">two</emphasis> email addresses.
15169 The third example shows that the presence of a comma is skipped when it is
15170 quoted.
15171 </para>
15172 <literallayout class="monospaced">
15173 # exim -be '${addresses:From: \
15174 =?iso-8859-2?Q?Last=2C_First?= &lt;user@example.com&gt;}'
15175 user@example.com
15176 # exim -be '${addresses:From: Last, First &lt;user@example.com&gt;}'
15177 Last:user@example.com
15178 # exim -be '${addresses:From: "Last, First" &lt;user@example.com&gt;}'
15179 user@example.com
15180 </literallayout>
15181 </listitem></varlistentry>
15182 <varlistentry>
15183 <term><emphasis role="bold">${base32:</emphasis>&lt;<emphasis>digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15184 <listitem>
15185 <para>
15186 <indexterm role="concept">
15187 <primary><option>base32</option> expansion item</primary>
15188 </indexterm>
15189 <indexterm role="concept">
15190 <primary>expansion</primary>
15191 <secondary>conversion to base 32</secondary>
15192 </indexterm>
15193 The string must consist entirely of decimal digits. The number is converted to
15194 base 32 and output as a (empty, for zero) string of characters.
15195 Only lowercase letters are used.
15196 </para>
15197 </listitem></varlistentry>
15198 <varlistentry>
15199 <term><emphasis role="bold">${base32d:</emphasis>&lt;<emphasis>base-32&nbsp;digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15200 <listitem>
15201 <para>
15202 <indexterm role="concept">
15203 <primary><option>base32d</option> expansion item</primary>
15204 </indexterm>
15205 <indexterm role="concept">
15206 <primary>expansion</primary>
15207 <secondary>conversion to base 32</secondary>
15208 </indexterm>
15209 The string must consist entirely of base-32 digits.
15210 The number is converted to decimal and output as a string.
15211 </para>
15212 </listitem></varlistentry>
15213 <varlistentry>
15214 <term><emphasis role="bold">${base62:</emphasis>&lt;<emphasis>digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15215 <listitem>
15216 <para>
15217 <indexterm role="concept">
15218 <primary><option>base62</option> expansion item</primary>
15219 </indexterm>
15220 <indexterm role="concept">
15221 <primary>expansion</primary>
15222 <secondary>conversion to base 62</secondary>
15223 </indexterm>
15224 The string must consist entirely of decimal digits. The number is converted to
15225 base 62 and output as a string of six characters, including leading zeros. In
15226 the few operating environments where Exim uses base 36 instead of base 62 for
15227 its message identifiers (because those systems do not have case-sensitive file
15228 names), base 36 is used by this operator, despite its name. <emphasis role="bold">Note</emphasis>: Just to
15229 be absolutely clear: this is <emphasis>not</emphasis> base64 encoding.
15230 </para>
15231 </listitem></varlistentry>
15232 <varlistentry>
15233 <term><emphasis role="bold">${base62d:</emphasis>&lt;<emphasis>base-62&nbsp;digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15234 <listitem>
15235 <para>
15236 <indexterm role="concept">
15237 <primary><option>base62d</option> expansion item</primary>
15238 </indexterm>
15239 <indexterm role="concept">
15240 <primary>expansion</primary>
15241 <secondary>conversion to base 62</secondary>
15242 </indexterm>
15243 The string must consist entirely of base-62 digits, or, in operating
15244 environments where Exim uses base 36 instead of base 62 for its message
15245 identifiers, base-36 digits. The number is converted to decimal and output as a
15246 string.
15247 </para>
15248 </listitem></varlistentry>
15249 <varlistentry>
15250 <term><emphasis role="bold">${base64:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15251 <listitem>
15252 <para>
15253 <indexterm role="concept">
15254 <primary>expansion</primary>
15255 <secondary>base64 encoding</secondary>
15256 </indexterm>
15257 <indexterm role="concept">
15258 <primary>base64 encoding</primary>
15259 <secondary>in string expansion</secondary>
15260 </indexterm>
15261 <indexterm role="concept">
15262 <primary><option>base64</option> expansion item</primary>
15263 </indexterm>
15264 <indexterm role="concept">
15265 <primary>certificate</primary>
15266 <secondary>base64 of DER</secondary>
15267 </indexterm>
15268 This operator converts a string into one that is base64 encoded.
15269 </para>
15270 <para>
15271 If the string is a single variable of type certificate,
15272 returns the base64 encoding of the DER form of the certificate.
15273 </para>
15274 </listitem></varlistentry>
15275 <varlistentry>
15276 <term><emphasis role="bold">${base64d:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15277 <listitem>
15278 <para>
15279 <indexterm role="concept">
15280 <primary>expansion</primary>
15281 <secondary>base64 decoding</secondary>
15282 </indexterm>
15283 <indexterm role="concept">
15284 <primary>base64 decoding</primary>
15285 <secondary>in string expansion</secondary>
15286 </indexterm>
15287 <indexterm role="concept">
15288 <primary><option>base64d</option> expansion item</primary>
15289 </indexterm>
15290 This operator converts a base64-encoded string into the un-coded form.
15291 </para>
15292 </listitem></varlistentry>
15293 <varlistentry>
15294 <term><emphasis role="bold">${domain:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15295 <listitem>
15296 <para>
15297 <indexterm role="concept">
15298 <primary>domain</primary>
15299 <secondary>extraction</secondary>
15300 </indexterm>
15301 <indexterm role="concept">
15302 <primary>expansion</primary>
15303 <secondary>domain extraction</secondary>
15304 </indexterm>
15305 The string is interpreted as an RFC 2822 address and the domain is extracted
15306 from it. If the string does not parse successfully, the result is empty.
15307 </para>
15308 </listitem></varlistentry>
15309 <varlistentry>
15310 <term><emphasis role="bold">${escape:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15311 <listitem>
15312 <para>
15313 <indexterm role="concept">
15314 <primary>expansion</primary>
15315 <secondary>escaping non-printing characters</secondary>
15316 </indexterm>
15317 <indexterm role="concept">
15318 <primary><option>escape</option> expansion item</primary>
15319 </indexterm>
15320 If the string contains any non-printing characters, they are converted to
15321 escape sequences starting with a backslash. Whether characters with the most
15322 significant bit set (so-called <quote>8-bit characters</quote>) count as printing or not
15323 is controlled by the <option>print_topbitchars</option> option.
15324 </para>
15325 </listitem></varlistentry>
15326 <varlistentry>
15327 <term><emphasis role="bold">${escape8bit:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15328 <listitem>
15329 <para>
15330 <indexterm role="concept">
15331 <primary>expansion</primary>
15332 <secondary>escaping 8-bit characters</secondary>
15333 </indexterm>
15334 <indexterm role="concept">
15335 <primary><option>escape8bit</option> expansion item</primary>
15336 </indexterm>
15337 If the string contains and characters with the most significant bit set,
15338 they are converted to escape sequences starting with a backslash.
15339 Backslashes and DEL characters are also converted.
15340 </para>
15341 </listitem></varlistentry>
15342 <varlistentry>
15343 <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>
15344 <listitem>
15345 <para>
15346 <indexterm role="concept">
15347 <primary>expansion</primary>
15348 <secondary>expression evaluation</secondary>
15349 </indexterm>
15350 <indexterm role="concept">
15351 <primary>expansion</primary>
15352 <secondary>arithmetic expression</secondary>
15353 </indexterm>
15354 <indexterm role="concept">
15355 <primary><option>eval</option> expansion item</primary>
15356 </indexterm>
15357 These items supports simple arithmetic and bitwise logical operations in
15358 expansion strings. The string (after expansion) must be a conventional
15359 arithmetic expression, but it is limited to basic arithmetic operators, bitwise
15360 logical operators, and parentheses. All operations are carried out using
15361 integer arithmetic. The operator priorities are as follows (the same as in the
15362 C programming language):
15363 </para>
15364 <informaltable frame="none">
15365 <tgroup cols="2" colsep="0" rowsep="0">
15366 <colspec colwidth="70pt" align="left"/>
15367 <colspec colwidth="300pt" align="left"/>
15368 <tbody>
15369 <row>
15370 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>highest:</emphasis></entry>
15371 <entry>not (~), negate (-)</entry>
15372 </row>
15373 <row>
15374 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
15375 <entry>multiply (*), divide (/), remainder (%)</entry>
15376 </row>
15377 <row>
15378 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
15379 <entry>plus (+), minus (-)</entry>
15380 </row>
15381 <row>
15382 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
15383 <entry>shift-left (&lt;&lt;), shift-right (&gt;&gt;)</entry>
15384 </row>
15385 <row>
15386 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
15387 <entry>and (&amp;)</entry>
15388 </row>
15389 <row>
15390 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
15391 <entry>xor (^)</entry>
15392 </row>
15393 <row>
15394 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>lowest:</emphasis></entry>
15395 <entry>or (|)</entry>
15396 </row>
15397 </tbody>
15398 </tgroup>
15399 </informaltable>
15400 <para>
15401 Binary operators with the same priority are evaluated from left to right. White
15402 space is permitted before or after operators.
15403 </para>
15404 <para>
15405 For <option>eval</option>, numbers may be decimal, octal (starting with <quote>0</quote>) or
15406 hexadecimal (starting with <quote>0x</quote>). For <option>eval10</option>, all numbers are taken as
15407 decimal, even if they start with a leading zero; hexadecimal numbers are not
15408 permitted. This can be useful when processing numbers extracted from dates or
15409 times, which often do have leading zeros.
15410 </para>
15411 <para>
15412 A number may be followed by <quote>K</quote>, <quote>M</quote> or <quote>G</quote> to multiply it by 1024, 1024*1024
15413 or 1024*1024*1024,
15414 respectively. Negative numbers are supported. The result of the computation is
15415 a decimal representation of the answer (without <quote>K</quote>, <quote>M</quote> or <quote>G</quote>). For example:
15416 </para>
15417 <literallayout>
15418 <literal>${eval:1+1}            </literal>  yields 2
15419 <literal>${eval:1+2*3}          </literal>  yields 7
15420 <literal>${eval:(1+2)*3}        </literal>  yields 9
15421 <literal>${eval:2+42%5}         </literal>  yields 4
15422 <literal>${eval:0xc&amp;5}          </literal>  yields 4
15423 <literal>${eval:0xc|5}          </literal>  yields 13
15424 <literal>${eval:0xc^5}          </literal>  yields 9
15425 <literal>${eval:0xc&gt;&gt;1}         </literal>  yields 6
15426 <literal>${eval:0xc&lt;&lt;1}         </literal>  yields 24
15427 <literal>${eval:~255&amp;0x1234}    </literal>  yields 4608
15428 <literal>${eval:-(~255&amp;0x1234)} </literal>  yields -4608
15429 </literallayout>
15430 <para>
15431 As a more realistic example, in an ACL you might have
15432 </para>
15433 <literallayout class="monospaced">
15434 deny   message = Too many bad recipients
15435        condition =                    \
15436          ${if and {                   \
15437            {&gt;{$rcpt_count}{10}}       \
15438            {                          \
15439            &lt;                          \
15440              {$recipients_count}      \
15441              {${eval:$rcpt_count/2}}  \
15442            }                          \
15443          }{yes}{no}}
15444 </literallayout>
15445 <para>
15446 The condition is true if there have been more than 10 RCPT commands and
15447 fewer than half of them have resulted in a valid recipient.
15448 </para>
15449 </listitem></varlistentry>
15450 <varlistentry>
15451 <term><emphasis role="bold">${expand:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15452 <listitem>
15453 <para>
15454 <indexterm role="concept">
15455 <primary>expansion</primary>
15456 <secondary>re-expansion of substring</secondary>
15457 </indexterm>
15458 The <option>expand</option> operator causes a string to be expanded for a second time. For
15459 example,
15460 </para>
15461 <literallayout class="monospaced">
15462 ${expand:${lookup{$domain}dbm{/some/file}{$value}}}
15463 </literallayout>
15464 <para>
15465 first looks up a string in a file while expanding the operand for <option>expand</option>,
15466 and then re-expands what it has found.
15467 </para>
15468 </listitem></varlistentry>
15469 <varlistentry>
15470 <term><emphasis role="bold">${from_utf8:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15471 <listitem>
15472 <para>
15473 <indexterm role="concept">
15474 <primary>Unicode</primary>
15475 </indexterm>
15476 <indexterm role="concept">
15477 <primary>UTF-8</primary>
15478 <secondary>conversion from</secondary>
15479 </indexterm>
15480 <indexterm role="concept">
15481 <primary>expansion</primary>
15482 <secondary>UTF-8 conversion</secondary>
15483 </indexterm>
15484 <indexterm role="concept">
15485 <primary><option>from_utf8</option> expansion item</primary>
15486 </indexterm>
15487 The world is slowly moving towards Unicode, although there are no standards for
15488 email yet. However, other applications (including some databases) are starting
15489 to store data in Unicode, using UTF-8 encoding. This operator converts from a
15490 UTF-8 string to an ISO-8859-1 string. UTF-8 code values greater than 255 are
15491 converted to underscores. The input must be a valid UTF-8 string. If it is not,
15492 the result is an undefined sequence of bytes.
15493 </para>
15494 <para>
15495 Unicode code points with values less than 256 are compatible with ASCII and
15496 ISO-8859-1 (also known as Latin-1).
15497 For example, character 169 is the copyright symbol in both cases, though the
15498 way it is encoded is different. In UTF-8, more than one byte is needed for
15499 characters with code values greater than 127, whereas ISO-8859-1 is a
15500 single-byte encoding (but thereby limited to 256 characters). This makes
15501 translation from UTF-8 to ISO-8859-1 straightforward.
15502 </para>
15503 </listitem></varlistentry>
15504 <varlistentry>
15505 <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>
15506 <listitem>
15507 <para>
15508 <indexterm role="concept">
15509 <primary>hash function</primary>
15510 <secondary>textual</secondary>
15511 </indexterm>
15512 <indexterm role="concept">
15513 <primary>expansion</primary>
15514 <secondary>textual hash</secondary>
15515 </indexterm>
15516 The <option>hash</option> operator is a simpler interface to the hashing function that can
15517 be used when the two parameters are fixed numbers (as opposed to strings that
15518 change when expanded). The effect is the same as
15519 </para>
15520 <literallayout class="monospaced">
15521 ${hash{&lt;n&gt;}{&lt;m&gt;}{&lt;string&gt;}}
15522 </literallayout>
15523 <para>
15524 See the description of the general <option>hash</option> item above for details. The
15525 abbreviation <option>h</option> can be used when <option>hash</option> is used as an operator.
15526 </para>
15527 </listitem></varlistentry>
15528 <varlistentry>
15529 <term><emphasis role="bold">${hex2b64:</emphasis>&lt;<emphasis>hexstring</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15530 <listitem>
15531 <para>
15532 <indexterm role="concept">
15533 <primary>base64 encoding</primary>
15534 <secondary>conversion from hex</secondary>
15535 </indexterm>
15536 <indexterm role="concept">
15537 <primary>expansion</primary>
15538 <secondary>hex to base64</secondary>
15539 </indexterm>
15540 <indexterm role="concept">
15541 <primary><option>hex2b64</option> expansion item</primary>
15542 </indexterm>
15543 This operator converts a hex string into one that is base64 encoded. This can
15544 be useful for processing the output of the MD5 and SHA-1 hashing functions.
15545 </para>
15546 </listitem></varlistentry>
15547 <varlistentry>
15548 <term><emphasis role="bold">${hexquote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15549 <listitem>
15550 <para>
15551 <indexterm role="concept">
15552 <primary>quoting</primary>
15553 <secondary>hex-encoded unprintable characters</secondary>
15554 </indexterm>
15555 <indexterm role="concept">
15556 <primary><option>hexquote</option> expansion item</primary>
15557 </indexterm>
15558 This operator converts non-printable characters in a string into a hex
15559 escape form. Byte values between 33 (!) and 126 (~) inclusive are left
15560 as is, and other byte values are converted to <literal>\xNN</literal>, for example a
15561 byte value 127 is converted to <literal>\x7f</literal>.
15562 </para>
15563 </listitem></varlistentry>
15564 <varlistentry>
15565 <term><emphasis role="bold">${ipv6denorm:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15566 <listitem>
15567 <para>
15568 <indexterm role="concept">
15569 <primary><option>ipv6denorm</option> expansion item</primary>
15570 </indexterm>
15571 <indexterm role="concept">
15572 <primary>IP address</primary>
15573 <secondary>normalisation</secondary>
15574 </indexterm>
15575 This expands an IPv6 address to a full eight-element colon-separated set
15576 of hex digits including leading zeroes.
15577 A trailing ipv4-style dotted-decimal set is converted to hex.
15578 Pure IPv4 addresses are converted to IPv4-mapped IPv6.
15579 </para>
15580 </listitem></varlistentry>
15581 <varlistentry>
15582 <term><emphasis role="bold">${ipv6norm:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15583 <listitem>
15584 <para>
15585 <indexterm role="concept">
15586 <primary><option>ipv6norm</option> expansion item</primary>
15587 </indexterm>
15588 <indexterm role="concept">
15589 <primary>IP address</primary>
15590 <secondary>normalisation</secondary>
15591 </indexterm>
15592 <indexterm role="concept">
15593 <primary>IP address</primary>
15594 <secondary>canonical form</secondary>
15595 </indexterm>
15596 This converts an IPv6 address to canonical form.
15597 Leading zeroes of groups are omitted, and the longest
15598 set of zero-valued groups is replaced with a double colon.
15599 A trailing ipv4-style dotted-decimal set is converted to hex.
15600 Pure IPv4 addresses are converted to IPv4-mapped IPv6.
15601 </para>
15602 </listitem></varlistentry>
15603 <varlistentry>
15604 <term><emphasis role="bold">${lc:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15605 <listitem>
15606 <para>
15607 <indexterm role="concept">
15608 <primary>case forcing in strings</primary>
15609 </indexterm>
15610 <indexterm role="concept">
15611 <primary>string</primary>
15612 <secondary>case forcing</secondary>
15613 </indexterm>
15614 <indexterm role="concept">
15615 <primary>lower casing</primary>
15616 </indexterm>
15617 <indexterm role="concept">
15618 <primary>expansion</primary>
15619 <secondary>case forcing</secondary>
15620 </indexterm>
15621 <indexterm role="concept">
15622 <primary><option>lc</option> expansion item</primary>
15623 </indexterm>
15624 This forces the letters in the string into lower-case, for example:
15625 </para>
15626 <literallayout class="monospaced">
15627 ${lc:$local_part}
15628 </literallayout>
15629 </listitem></varlistentry>
15630 <varlistentry>
15631 <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>
15632 <listitem>
15633 <para>
15634 <indexterm role="concept">
15635 <primary>expansion</primary>
15636 <secondary>string truncation</secondary>
15637 </indexterm>
15638 <indexterm role="concept">
15639 <primary><option>length</option> expansion item</primary>
15640 </indexterm>
15641 The <option>length</option> operator is a simpler interface to the <option>length</option> function that
15642 can be used when the parameter is a fixed number (as opposed to a string that
15643 changes when expanded). The effect is the same as
15644 </para>
15645 <literallayout class="monospaced">
15646 ${length{&lt;number&gt;}{&lt;string&gt;}}
15647 </literallayout>
15648 <para>
15649 See the description of the general <option>length</option> item above for details. Note that
15650 <option>length</option> is not the same as <option>strlen</option>. The abbreviation <option>l</option> can be used
15651 when <option>length</option> is used as an operator.
15652 </para>
15653 </listitem></varlistentry>
15654 <varlistentry>
15655 <term><emphasis role="bold">${listcount:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15656 <listitem>
15657 <para>
15658 <indexterm role="concept">
15659 <primary>expansion</primary>
15660 <secondary>list item count</secondary>
15661 </indexterm>
15662 <indexterm role="concept">
15663 <primary>list</primary>
15664 <secondary>item count</secondary>
15665 </indexterm>
15666 <indexterm role="concept">
15667 <primary>list</primary>
15668 <secondary>count of items</secondary>
15669 </indexterm>
15670 <indexterm role="concept">
15671 <primary><option>listcount</option> expansion item</primary>
15672 </indexterm>
15673 The string is interpreted as a list and the number of items is returned.
15674 </para>
15675 </listitem></varlistentry>
15676 <varlistentry>
15677 <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>
15678 <listitem>
15679 <para>
15680 <indexterm role="concept">
15681 <primary>expansion</primary>
15682 <secondary>named list</secondary>
15683 </indexterm>
15684 <indexterm role="concept">
15685 <primary><option>listnamed</option> expansion item</primary>
15686 </indexterm>
15687 The name is interpreted as a named list and the content of the list is returned,
15688 expanding any referenced lists, re-quoting as needed for colon-separation.
15689 If the optional type is given it must be one of "a", "d", "h" or "l"
15690 and selects address-, domain-, host- or localpart- lists to search among respectively.
15691 Otherwise all types are searched in an undefined order and the first
15692 matching list is returned.
15693 </para>
15694 </listitem></varlistentry>
15695 <varlistentry>
15696 <term><emphasis role="bold">${local_part:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15697 <listitem>
15698 <para>
15699 <indexterm role="concept">
15700 <primary>expansion</primary>
15701 <secondary>local part extraction</secondary>
15702 </indexterm>
15703 <indexterm role="concept">
15704 <primary><option>local_part</option> expansion item</primary>
15705 </indexterm>
15706 The string is interpreted as an RFC 2822 address and the local part is
15707 extracted from it. If the string does not parse successfully, the result is
15708 empty.
15709 </para>
15710 </listitem></varlistentry>
15711 <varlistentry>
15712 <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>
15713 <listitem>
15714 <para>
15715 <indexterm role="concept">
15716 <primary>masked IP address</primary>
15717 </indexterm>
15718 <indexterm role="concept">
15719 <primary>IP address</primary>
15720 <secondary>masking</secondary>
15721 </indexterm>
15722 <indexterm role="concept">
15723 <primary>CIDR notation</primary>
15724 </indexterm>
15725 <indexterm role="concept">
15726 <primary>expansion</primary>
15727 <secondary>IP address masking</secondary>
15728 </indexterm>
15729 <indexterm role="concept">
15730 <primary><option>mask</option> expansion item</primary>
15731 </indexterm>
15732 If the form of the string to be operated on is not an IP address followed by a
15733 slash and an integer (that is, a network address in CIDR notation), the
15734 expansion fails. Otherwise, this operator converts the IP address to binary,
15735 masks off the least significant bits according to the bit count, and converts
15736 the result back to text, with mask appended. For example,
15737 </para>
15738 <literallayout class="monospaced">
15739 ${mask:10.111.131.206/28}
15740 </literallayout>
15741 <para>
15742 returns the string <quote>10.111.131.192/28</quote>. Since this operation is expected to
15743 be mostly used for looking up masked addresses in files, the result for an IPv6
15744 address uses dots to separate components instead of colons, because colon
15745 terminates a key string in lsearch files. So, for example,
15746 </para>
15747 <literallayout class="monospaced">
15748 ${mask:3ffe:ffff:836f:0a00:000a:0800:200a:c031/99}
15749 </literallayout>
15750 <para>
15751 returns the string
15752 </para>
15753 <literallayout class="monospaced">
15754 3ffe.ffff.836f.0a00.000a.0800.2000.0000/99
15755 </literallayout>
15756 <para>
15757 Letters in IPv6 addresses are always output in lower case.
15758 </para>
15759 </listitem></varlistentry>
15760 <varlistentry>
15761 <term><emphasis role="bold">${md5:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15762 <listitem>
15763 <para>
15764 <indexterm role="concept">
15765 <primary>MD5 hash</primary>
15766 </indexterm>
15767 <indexterm role="concept">
15768 <primary>expansion</primary>
15769 <secondary>MD5 hash</secondary>
15770 </indexterm>
15771 <indexterm role="concept">
15772 <primary>certificate</primary>
15773 <secondary>fingerprint</secondary>
15774 </indexterm>
15775 <indexterm role="concept">
15776 <primary><option>md5</option> expansion item</primary>
15777 </indexterm>
15778 The <option>md5</option> operator computes the MD5 hash value of the string, and returns it
15779 as a 32-digit hexadecimal number, in which any letters are in lower case.
15780 </para>
15781 <para>
15782 If the string is a single variable of type certificate,
15783 returns the MD5 hash fingerprint of the certificate.
15784 </para>
15785 </listitem></varlistentry>
15786 <varlistentry>
15787 <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>
15788 <listitem>
15789 <para>
15790 <indexterm role="concept">
15791 <primary>expansion</primary>
15792 <secondary>numeric hash</secondary>
15793 </indexterm>
15794 <indexterm role="concept">
15795 <primary>hash function</primary>
15796 <secondary>numeric</secondary>
15797 </indexterm>
15798 The <option>nhash</option> operator is a simpler interface to the numeric hashing function
15799 that can be used when the two parameters are fixed numbers (as opposed to
15800 strings that change when expanded). The effect is the same as
15801 </para>
15802 <literallayout class="monospaced">
15803 ${nhash{&lt;n&gt;}{&lt;m&gt;}{&lt;string&gt;}}
15804 </literallayout>
15805 <para>
15806 See the description of the general <option>nhash</option> item above for details.
15807 </para>
15808 </listitem></varlistentry>
15809 <varlistentry>
15810 <term><emphasis role="bold">${quote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15811 <listitem>
15812 <para>
15813 <indexterm role="concept">
15814 <primary>quoting</primary>
15815 <secondary>in string expansions</secondary>
15816 </indexterm>
15817 <indexterm role="concept">
15818 <primary>expansion</primary>
15819 <secondary>quoting</secondary>
15820 </indexterm>
15821 <indexterm role="concept">
15822 <primary><option>quote</option> expansion item</primary>
15823 </indexterm>
15824 The <option>quote</option> operator puts its argument into double quotes if it
15825 is an empty string or
15826 contains anything other than letters, digits, underscores, dots, and hyphens.
15827 Any occurrences of double quotes and backslashes are escaped with a backslash.
15828 Newlines and carriage returns are converted to <literal>\n</literal> and <literal>\r</literal>,
15829 respectively For example,
15830 </para>
15831 <literallayout class="monospaced">
15832 ${quote:ab"*"cd}
15833 </literallayout>
15834 <para>
15835 becomes
15836 </para>
15837 <literallayout class="monospaced">
15838 "ab\"*\"cd"
15839 </literallayout>
15840 <para>
15841 The place where this is useful is when the argument is a substitution from a
15842 variable or a message header.
15843 </para>
15844 </listitem></varlistentry>
15845 <varlistentry>
15846 <term><emphasis role="bold">${quote_local_part:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15847 <listitem>
15848 <para>
15849 <indexterm role="concept">
15850 <primary><option>quote_local_part</option> expansion item</primary>
15851 </indexterm>
15852 This operator is like <option>quote</option>, except that it quotes the string only if
15853 required to do so by the rules of RFC 2822 for quoting local parts. For
15854 example, a plus sign would not cause quoting (but it would for <option>quote</option>).
15855 If you are creating a new email address from the contents of <varname>$local_part</varname>
15856 (or any other unknown data), you should always use this operator.
15857 </para>
15858 </listitem></varlistentry>
15859 <varlistentry>
15860 <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>
15861 <listitem>
15862 <para>
15863 <indexterm role="concept">
15864 <primary>quoting</primary>
15865 <secondary>lookup-specific</secondary>
15866 </indexterm>
15867 This operator applies lookup-specific quoting rules to the string. Each
15868 query-style lookup type has its own quoting rules which are described with
15869 the lookups in chapter <xref linkend="CHAPfdlookup"/>. For example,
15870 </para>
15871 <literallayout class="monospaced">
15872 ${quote_ldap:two * two}
15873 </literallayout>
15874 <para>
15875 returns
15876 </para>
15877 <literallayout class="monospaced">
15878 two%20%5C2A%20two
15879 </literallayout>
15880 <para>
15881 For single-key lookup types, no quoting is ever necessary and this operator
15882 yields an unchanged string.
15883 </para>
15884 </listitem></varlistentry>
15885 <varlistentry>
15886 <term><emphasis role="bold">${randint:</emphasis>&lt;<emphasis>n</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15887 <listitem>
15888 <para>
15889 <indexterm role="concept">
15890 <primary>random number</primary>
15891 </indexterm>
15892 This operator returns a somewhat random number which is less than the
15893 supplied number and is at least 0.  The quality of this randomness depends
15894 on how Exim was built; the values are not suitable for keying material.
15895 If Exim is linked against OpenSSL then RAND_pseudo_bytes() is used.
15896 If Exim is linked against GnuTLS then gnutls_rnd(GNUTLS_RND_NONCE) is used,
15897 for versions of GnuTLS with that function.
15898 Otherwise, the implementation may be arc4random(), random() seeded by
15899 srandomdev() or srandom(), or a custom implementation even weaker than
15900 random().
15901 </para>
15902 </listitem></varlistentry>
15903 <varlistentry>
15904 <term><emphasis role="bold">${reverse_ip:</emphasis>&lt;<emphasis>ipaddr</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15905 <listitem>
15906 <para>
15907 <indexterm role="concept">
15908 <primary>expansion</primary>
15909 <secondary>IP address</secondary>
15910 </indexterm>
15911 This operator reverses an IP address; for IPv4 addresses, the result is in
15912 dotted-quad decimal form, while for IPv6 addresses the result is in
15913 dotted-nibble hexadecimal form.  In both cases, this is the "natural" form
15914 for DNS.  For example,
15915 </para>
15916 <literallayout class="monospaced">
15917 ${reverse_ip:192.0.2.4}
15918 ${reverse_ip:2001:0db8:c42:9:1:abcd:192.0.2.127}
15919 </literallayout>
15920 <para>
15921 returns
15922 </para>
15923 <literallayout class="monospaced">
15924 4.2.0.192
15925 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
15926 </literallayout>
15927 </listitem></varlistentry>
15928 <varlistentry>
15929 <term><emphasis role="bold">${rfc2047:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15930 <listitem>
15931 <para>
15932 <indexterm role="concept">
15933 <primary>expansion</primary>
15934 <secondary>RFC 2047</secondary>
15935 </indexterm>
15936 <indexterm role="concept">
15937 <primary>RFC 2047</primary>
15938 <secondary>expansion operator</secondary>
15939 </indexterm>
15940 <indexterm role="concept">
15941 <primary><option>rfc2047</option> expansion item</primary>
15942 </indexterm>
15943 This operator encodes text according to the rules of RFC 2047. This is an
15944 encoding that is used in header lines to encode non-ASCII characters. It is
15945 assumed that the input string is in the encoding specified by the
15946 <option>headers_charset</option> option, which gets its default at build time. If the string
15947 contains only characters in the range 33&ndash;126, and no instances of the
15948 characters
15949 </para>
15950 <literallayout class="monospaced">
15951 ? = ( ) &lt; &gt; @ , ; : \ " . [ ] _
15952 </literallayout>
15953 <para>
15954 it is not modified. Otherwise, the result is the RFC 2047 encoding of the
15955 string, using as many <quote>encoded words</quote> as necessary to encode all the
15956 characters.
15957 </para>
15958 </listitem></varlistentry>
15959 <varlistentry>
15960 <term><emphasis role="bold">${rfc2047d:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15961 <listitem>
15962 <para>
15963 <indexterm role="concept">
15964 <primary>expansion</primary>
15965 <secondary>RFC 2047</secondary>
15966 </indexterm>
15967 <indexterm role="concept">
15968 <primary>RFC 2047</primary>
15969 <secondary>decoding</secondary>
15970 </indexterm>
15971 <indexterm role="concept">
15972 <primary><option>rfc2047d</option> expansion item</primary>
15973 </indexterm>
15974 This operator decodes strings that are encoded as per RFC 2047. Binary zero
15975 bytes are replaced by question marks. Characters are converted into the
15976 character set defined by <option>headers_charset</option>. Overlong RFC 2047 <quote>words</quote> are
15977 not recognized unless <option>check_rfc2047_length</option> is set false.
15978 </para>
15979 <para>
15980 <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
15981 access a header line, RFC 2047 decoding is done automatically. You do not need
15982 to use this operator as well.
15983 </para>
15984 </listitem></varlistentry>
15985 <varlistentry>
15986 <term><emphasis role="bold">${rxquote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15987 <listitem>
15988 <para>
15989 <indexterm role="concept">
15990 <primary>quoting</primary>
15991 <secondary>in regular expressions</secondary>
15992 </indexterm>
15993 <indexterm role="concept">
15994 <primary>regular expressions</primary>
15995 <secondary>quoting</secondary>
15996 </indexterm>
15997 <indexterm role="concept">
15998 <primary><option>rxquote</option> expansion item</primary>
15999 </indexterm>
16000 The <option>rxquote</option> operator inserts a backslash before any non-alphanumeric
16001 characters in its argument. This is useful when substituting the values of
16002 variables or headers inside regular expressions.
16003 </para>
16004 </listitem></varlistentry>
16005 <varlistentry>
16006 <term><emphasis role="bold">${sha1:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16007 <listitem>
16008 <para>
16009 <indexterm role="concept">
16010 <primary>SHA-1 hash</primary>
16011 </indexterm>
16012 <indexterm role="concept">
16013 <primary>expansion</primary>
16014 <secondary>SHA-1 hashing</secondary>
16015 </indexterm>
16016 <indexterm role="concept">
16017 <primary>certificate</primary>
16018 <secondary>fingerprint</secondary>
16019 </indexterm>
16020 <indexterm role="concept">
16021 <primary><option>sha1</option> expansion item</primary>
16022 </indexterm>
16023 The <option>sha1</option> operator computes the SHA-1 hash value of the string, and returns
16024 it as a 40-digit hexadecimal number, in which any letters are in upper case.
16025 </para>
16026 <para>
16027 If the string is a single variable of type certificate,
16028 returns the SHA-1 hash fingerprint of the certificate.
16029 </para>
16030 </listitem></varlistentry>
16031 <varlistentry>
16032 <term><emphasis role="bold">${sha256:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16033 <listitem>
16034 <para>
16035 <indexterm role="concept">
16036 <primary>SHA-256 hash</primary>
16037 </indexterm>
16038 <indexterm role="concept">
16039 <primary>certificate</primary>
16040 <secondary>fingerprint</secondary>
16041 </indexterm>
16042 <indexterm role="concept">
16043 <primary>expansion</primary>
16044 <secondary>SHA-256 hashing</secondary>
16045 </indexterm>
16046 <indexterm role="concept">
16047 <primary><option>sha256</option> expansion item</primary>
16048 </indexterm>
16049 The <option>sha256</option> operator computes the SHA-256 hash value of the string
16050 and returns
16051 it as a 64-digit hexadecimal number, in which any letters are in upper case.
16052 </para>
16053 <para>
16054 If the string is a single variable of type certificate,
16055 returns the SHA-256 hash fingerprint of the certificate.
16056 </para>
16057 </listitem></varlistentry>
16058 <varlistentry>
16059 <term><emphasis role="bold">${sha3:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16060 <term><emphasis role="bold">${sha3_&lt;n&gt;:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16061 <listitem>
16062 <para>
16063 <indexterm role="concept">
16064 <primary>SHA3 hash</primary>
16065 </indexterm>
16066 <indexterm role="concept">
16067 <primary>expansion</primary>
16068 <secondary>SHA3 hashing</secondary>
16069 </indexterm>
16070 <indexterm role="concept">
16071 <primary><option>sha3</option> expansion item</primary>
16072 </indexterm>
16073 The <option>sha3</option> operator computes the SHA3-256 hash value of the string
16074 and returns
16075 it as a 64-digit hexadecimal number, in which any letters are in upper case.
16076 </para>
16077 <para>
16078 If a number is appended, separated by an underbar, it specifies
16079 the output length.  Values of 224, 256, 384 and 512 are accepted;
16080 with 256 being the default.
16081 </para>
16082 <para>
16083 The <option>sha3</option> expansion item is only supported if Exim has been
16084 compiled with GnuTLS 3.5.0 or later.
16085 </para>
16086 </listitem></varlistentry>
16087 <varlistentry>
16088 <term><emphasis role="bold">${stat:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16089 <listitem>
16090 <para>
16091 <indexterm role="concept">
16092 <primary>expansion</primary>
16093 <secondary>statting a file</secondary>
16094 </indexterm>
16095 <indexterm role="concept">
16096 <primary>file</primary>
16097 <secondary>extracting characteristics</secondary>
16098 </indexterm>
16099 <indexterm role="concept">
16100 <primary><option>stat</option> expansion item</primary>
16101 </indexterm>
16102 The string, after expansion, must be a file path. A call to the <function>stat()</function>
16103 function is made for this path. If <function>stat()</function> fails, an error occurs and the
16104 expansion fails. If it succeeds, the data from the stat replaces the item, as a
16105 series of &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt; pairs, where the values are all numerical,
16106 except for the value of <quote>smode</quote>. The names are: <quote>mode</quote> (giving the mode as
16107 a 4-digit octal number), <quote>smode</quote> (giving the mode in symbolic format as a
16108 10-character string, as for the <emphasis>ls</emphasis> command), <quote>inode</quote>, <quote>device</quote>,
16109 <quote>links</quote>, <quote>uid</quote>, <quote>gid</quote>, <quote>size</quote>, <quote>atime</quote>, <quote>mtime</quote>, and <quote>ctime</quote>. You
16110 can extract individual fields using the <option>extract</option> expansion item.
16111 </para>
16112 <para>
16113 The use of the <option>stat</option> expansion in users&#x2019; filter files can be locked out by
16114 the system administrator. <emphasis role="bold">Warning</emphasis>: The file size may be incorrect on 32-bit
16115 systems for files larger than 2GB.
16116 </para>
16117 </listitem></varlistentry>
16118 <varlistentry>
16119 <term><emphasis role="bold">${str2b64:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16120 <listitem>
16121 <para>
16122 <indexterm role="concept">
16123 <primary><option>str2b64</option> expansion item</primary>
16124 </indexterm>
16125 Now deprecated, a synonym for the <option>base64</option> expansion operator.
16126 </para>
16127 </listitem></varlistentry>
16128 <varlistentry>
16129 <term><emphasis role="bold">${strlen:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16130 <listitem>
16131 <para>
16132 <indexterm role="concept">
16133 <primary>expansion</primary>
16134 <secondary>string length</secondary>
16135 </indexterm>
16136 <indexterm role="concept">
16137 <primary>string</primary>
16138 <secondary>length in expansion</secondary>
16139 </indexterm>
16140 <indexterm role="concept">
16141 <primary><option>strlen</option> expansion item</primary>
16142 </indexterm>
16143 The item is replace by the length of the expanded string, expressed as a
16144 decimal number. <emphasis role="bold">Note</emphasis>: Do not confuse <option>strlen</option> with <option>length</option>.
16145 </para>
16146 </listitem></varlistentry>
16147 <varlistentry>
16148 <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>
16149 <listitem>
16150 <para>
16151 <indexterm role="concept">
16152 <primary><option>substr</option> expansion item</primary>
16153 </indexterm>
16154 <indexterm role="concept">
16155 <primary>substring extraction</primary>
16156 </indexterm>
16157 <indexterm role="concept">
16158 <primary>expansion</primary>
16159 <secondary>substring expansion</secondary>
16160 </indexterm>
16161 The <option>substr</option> operator is a simpler interface to the <option>substr</option> function that
16162 can be used when the two parameters are fixed numbers (as opposed to strings
16163 that change when expanded). The effect is the same as
16164 </para>
16165 <literallayout class="monospaced">
16166 ${substr{&lt;start&gt;}{&lt;length&gt;}{&lt;string&gt;}}
16167 </literallayout>
16168 <para>
16169 See the description of the general <option>substr</option> item above for details. The
16170 abbreviation <option>s</option> can be used when <option>substr</option> is used as an operator.
16171 </para>
16172 </listitem></varlistentry>
16173 <varlistentry>
16174 <term><emphasis role="bold">${time_eval:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16175 <listitem>
16176 <para>
16177 <indexterm role="concept">
16178 <primary><option>time_eval</option> expansion item</primary>
16179 </indexterm>
16180 <indexterm role="concept">
16181 <primary>time interval</primary>
16182 <secondary>decoding</secondary>
16183 </indexterm>
16184 This item converts an Exim time interval such as <literal>2d4h5m</literal> into a number of
16185 seconds.
16186 </para>
16187 </listitem></varlistentry>
16188 <varlistentry>
16189 <term><emphasis role="bold">${time_interval:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16190 <listitem>
16191 <para>
16192 <indexterm role="concept">
16193 <primary><option>time_interval</option> expansion item</primary>
16194 </indexterm>
16195 <indexterm role="concept">
16196 <primary>time interval</primary>
16197 <secondary>formatting</secondary>
16198 </indexterm>
16199 The argument (after sub-expansion) must be a sequence of decimal digits that
16200 represents an interval of time as a number of seconds. It is converted into a
16201 number of larger units and output in Exim&#x2019;s normal time format, for example,
16202 <literal>1w3d4h2m6s</literal>.
16203 </para>
16204 </listitem></varlistentry>
16205 <varlistentry>
16206 <term><emphasis role="bold">${uc:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16207 <listitem>
16208 <para>
16209 <indexterm role="concept">
16210 <primary>case forcing in strings</primary>
16211 </indexterm>
16212 <indexterm role="concept">
16213 <primary>string</primary>
16214 <secondary>case forcing</secondary>
16215 </indexterm>
16216 <indexterm role="concept">
16217 <primary>upper casing</primary>
16218 </indexterm>
16219 <indexterm role="concept">
16220 <primary>expansion</primary>
16221 <secondary>case forcing</secondary>
16222 </indexterm>
16223 <indexterm role="concept">
16224 <primary><option>uc</option> expansion item</primary>
16225 </indexterm>
16226 This forces the letters in the string into upper-case.
16227 </para>
16228 </listitem></varlistentry>
16229 <varlistentry>
16230 <term><emphasis role="bold">${utf8clean:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16231 <listitem>
16232 <para>
16233 <indexterm role="concept">
16234 <primary>correction of invalid utf-8 sequences in strings</primary>
16235 </indexterm>
16236 <indexterm role="concept">
16237 <primary>utf-8</primary>
16238 <secondary>utf-8 sequences</secondary>
16239 </indexterm>
16240 <indexterm role="concept">
16241 <primary>incorrect utf-8</primary>
16242 </indexterm>
16243 <indexterm role="concept">
16244 <primary>expansion</primary>
16245 <secondary>utf-8 forcing</secondary>
16246 </indexterm>
16247 <indexterm role="concept">
16248 <primary><option>utf8clean</option> expansion item</primary>
16249 </indexterm>
16250 This replaces any invalid utf-8 sequence in the string by the character <literal>?</literal>.
16251 </para>
16252 </listitem></varlistentry>
16253 <varlistentry>
16254 <term><emphasis role="bold">${utf8_domain_to_alabel:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16255 <term><emphasis role="bold">${utf8_domain_from_alabel:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16256 <term><emphasis role="bold">${utf8_localpart_to_alabel:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16257 <term><emphasis role="bold">${utf8_localpart_from_alabel:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16258 <listitem>
16259 <para>
16260 <indexterm role="concept">
16261 <primary>expansion</primary>
16262 <secondary>UTF-8</secondary>
16263 </indexterm>
16264 <indexterm role="concept">
16265 <primary>UTF-8</primary>
16266 <secondary>expansion</secondary>
16267 </indexterm>
16268 <indexterm role="concept">
16269 <primary>EAI</primary>
16270 </indexterm>
16271 <indexterm role="concept">
16272 <primary>internationalisation</primary>
16273 </indexterm>
16274 <indexterm role="concept">
16275 <primary><option>utf8_domain_to_alabel</option> expansion item</primary>
16276 </indexterm>
16277 <indexterm role="concept">
16278 <primary><option>utf8_domain_from_alabel</option> expansion item</primary>
16279 </indexterm>
16280 <indexterm role="concept">
16281 <primary><option>utf8_localpart_to_alabel</option> expansion item</primary>
16282 </indexterm>
16283 <indexterm role="concept">
16284 <primary><option>utf8_localpart_from_alabel</option> expansion item</primary>
16285 </indexterm>
16286 These convert EAI mail name components between UTF-8 and a-label forms.
16287 For information on internationalisation support see <xref linkend="SECTi18nMTA"/>.
16288 </para>
16289 </listitem></varlistentry>
16290 </variablelist>
16291 </section>
16292 <section id="SECTexpcond">
16293 <title>Expansion conditions</title>
16294 <para>
16295 <indexterm role="concept" id="IIDexpcond" class="startofrange">
16296 <primary>expansion</primary>
16297 <secondary>conditions</secondary>
16298 </indexterm>
16299 The following conditions are available for testing by the <option>${if</option> construct
16300 while expanding strings:
16301 </para>
16302 <variablelist>
16303 <varlistentry>
16304 <term><emphasis role="bold">!</emphasis>&lt;<emphasis>condition</emphasis>&gt;</term>
16305 <listitem>
16306 <para>
16307 <indexterm role="concept">
16308 <primary>expansion</primary>
16309 <secondary>negating a condition</secondary>
16310 </indexterm>
16311 <indexterm role="concept">
16312 <primary>negation</primary>
16313 <secondary>in expansion condition</secondary>
16314 </indexterm>
16315 Preceding any condition with an exclamation mark negates the result of the
16316 condition.
16317 </para>
16318 </listitem></varlistentry>
16319 <varlistentry>
16320 <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>
16321 <listitem>
16322 <para>
16323 <indexterm role="concept">
16324 <primary>numeric comparison</primary>
16325 </indexterm>
16326 <indexterm role="concept">
16327 <primary>expansion</primary>
16328 <secondary>numeric comparison</secondary>
16329 </indexterm>
16330 There are a number of symbolic operators for doing numeric comparisons. They
16331 are:
16332 </para>
16333 <literallayout>
16334 <literal>=   </literal>   equal
16335 <literal>==  </literal>   equal
16336 <literal>&gt;   </literal>   greater
16337 <literal>&gt;=  </literal>   greater or equal
16338 <literal>&lt;   </literal>   less
16339 <literal>&lt;=  </literal>   less or equal
16340 </literallayout>
16341 <para>
16342 For example:
16343 </para>
16344 <literallayout class="monospaced">
16345 ${if &gt;{$message_size}{10M} ...
16346 </literallayout>
16347 <para>
16348 Note that the general negation operator provides for inequality testing. The
16349 two strings must take the form of optionally signed decimal integers,
16350 optionally followed by one of the letters <quote>K</quote>, <quote>M</quote> or <quote>G</quote> (in either upper or
16351 lower case), signifying multiplication by 1024, 1024*1024 or 1024*1024*1024, respectively.
16352 As a special case, the numerical value of an empty string is taken as
16353 zero.
16354 </para>
16355 <para>
16356 In all cases, a relative comparator OP is testing if &lt;<emphasis>string1</emphasis>&gt; OP
16357 &lt;<emphasis>string2</emphasis>&gt;; the above example is checking if <varname>$message_size</varname> is larger than
16358 10M, not if 10M is larger than <varname>$message_size</varname>.
16359 </para>
16360 </listitem></varlistentry>
16361 <varlistentry>
16362 <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>
16363 <listitem>
16364 <para>
16365 <indexterm role="concept">
16366 <primary>expansion</primary>
16367 <secondary>calling an acl</secondary>
16368 </indexterm>
16369 <indexterm role="concept">
16370 <primary><option>acl</option></primary>
16371 <secondary>expansion condition</secondary>
16372 </indexterm>
16373 The name and zero to nine argument strings are first expanded separately.  The expanded
16374 arguments are assigned to the variables <varname>$acl_arg1</varname> to <varname>$acl_arg9</varname> in order.
16375 Any unused are made empty.  The variable <varname>$acl_narg</varname> is set to the number of
16376 arguments.  The named ACL (see chapter <xref linkend="CHAPACL"/>) is called
16377 and may use the variables; if another acl expansion is used the values
16378 are restored after it returns.  If the ACL sets
16379 a value using a "message =" modifier the variable $value becomes
16380 the result of the expansion, otherwise it is empty.
16381 If the ACL returns accept the condition is true; if deny, false.
16382 If the ACL returns defer the result is a forced-fail.
16383 </para>
16384 </listitem></varlistentry>
16385 <varlistentry>
16386 <term><emphasis role="bold">bool&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16387 <listitem>
16388 <para>
16389 <indexterm role="concept">
16390 <primary>expansion</primary>
16391 <secondary>boolean parsing</secondary>
16392 </indexterm>
16393 <indexterm role="concept">
16394 <primary><option>bool</option> expansion condition</primary>
16395 </indexterm>
16396 This condition turns a string holding a true or false representation into
16397 a boolean state.  It parses <quote>true</quote>, <quote>false</quote>, <quote>yes</quote> and <quote>no</quote>
16398 (case-insensitively); also integer numbers map to true if non-zero,
16399 false if zero.
16400 An empty string is treated as false.
16401 Leading and trailing whitespace is ignored;
16402 thus a string consisting only of whitespace is false.
16403 All other string values will result in expansion failure.
16404 </para>
16405 <para>
16406 When combined with ACL variables, this expansion condition will let you
16407 make decisions in one place and act on those decisions in another place.
16408 For example:
16409 </para>
16410 <literallayout class="monospaced">
16411 ${if bool{$acl_m_privileged_sender} ...
16412 </literallayout>
16413 </listitem></varlistentry>
16414 <varlistentry>
16415 <term><emphasis role="bold">bool_lax&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16416 <listitem>
16417 <para>
16418 <indexterm role="concept">
16419 <primary>expansion</primary>
16420 <secondary>boolean parsing</secondary>
16421 </indexterm>
16422 <indexterm role="concept">
16423 <primary><option>bool_lax</option> expansion condition</primary>
16424 </indexterm>
16425 Like <option>bool</option>, this condition turns a string into a boolean state.  But
16426 where <option>bool</option> accepts a strict set of strings, <option>bool_lax</option> uses the same
16427 loose definition that the Router <option>condition</option> option uses.  The empty string
16428 and the values <quote>false</quote>, <quote>no</quote> and <quote>0</quote> map to false, all others map to
16429 true.  Leading and trailing whitespace is ignored.
16430 </para>
16431 <para>
16432 Note that where <quote>bool{00}</quote> is false, <quote>bool_lax{00}</quote> is true.
16433 </para>
16434 </listitem></varlistentry>
16435 <varlistentry>
16436 <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>
16437 <listitem>
16438 <para>
16439 <indexterm role="concept">
16440 <primary>expansion</primary>
16441 <secondary>encrypted comparison</secondary>
16442 </indexterm>
16443 <indexterm role="concept">
16444 <primary>encrypted strings, comparing</primary>
16445 </indexterm>
16446 <indexterm role="concept">
16447 <primary><option>crypteq</option> expansion condition</primary>
16448 </indexterm>
16449 This condition is included in the Exim binary if it is built to support any
16450 authentication mechanisms (see chapter <xref linkend="CHAPSMTPAUTH"/>). Otherwise, it is
16451 necessary to define SUPPORT_CRYPTEQ in <filename>Local/Makefile</filename> to get <option>crypteq</option>
16452 included in the binary.
16453 </para>
16454 <para>
16455 The <option>crypteq</option> condition has two arguments. The first is encrypted and
16456 compared against the second, which is already encrypted. The second string may
16457 be in the LDAP form for storing encrypted strings, which starts with the
16458 encryption type in curly brackets, followed by the data. If the second string
16459 does not begin with <quote>{</quote> it is assumed to be encrypted with <function>crypt()</function> or
16460 <function>crypt16()</function> (see below), since such strings cannot begin with <quote>{</quote>.
16461 Typically this will be a field from a password file. An example of an encrypted
16462 string in LDAP form is:
16463 </para>
16464 <literallayout class="monospaced">
16465 {md5}CY9rzUYh03PK3k6DJie09g==
16466 </literallayout>
16467 <para>
16468 If such a string appears directly in an expansion, the curly brackets have to
16469 be quoted, because they are part of the expansion syntax. For example:
16470 </para>
16471 <literallayout class="monospaced">
16472 ${if crypteq {test}{\{md5\}CY9rzUYh03PK3k6DJie09g==}{yes}{no}}
16473 </literallayout>
16474 <para>
16475 The following encryption types (whose names are matched case-independently) are
16476 supported:
16477 </para>
16478 <itemizedlist>
16479 <listitem>
16480 <para>
16481 <indexterm role="concept">
16482 <primary>MD5 hash</primary>
16483 </indexterm>
16484 <indexterm role="concept">
16485 <primary>base64 encoding</primary>
16486 <secondary>in encrypted password</secondary>
16487 </indexterm>
16488 <option>{md5}</option> computes the MD5 digest of the first string, and expresses this as
16489 printable characters to compare with the remainder of the second string. If the
16490 length of the comparison string is 24, Exim assumes that it is base64 encoded
16491 (as in the above example). If the length is 32, Exim assumes that it is a
16492 hexadecimal encoding of the MD5 digest. If the length not 24 or 32, the
16493 comparison fails.
16494 </para>
16495 </listitem>
16496 <listitem>
16497 <para>
16498 <indexterm role="concept">
16499 <primary>SHA-1 hash</primary>
16500 </indexterm>
16501 <option>{sha1}</option> computes the SHA-1 digest of the first string, and expresses this as
16502 printable characters to compare with the remainder of the second string. If the
16503 length of the comparison string is 28, Exim assumes that it is base64 encoded.
16504 If the length is 40, Exim assumes that it is a hexadecimal encoding of the
16505 SHA-1 digest. If the length is not 28 or 40, the comparison fails.
16506 </para>
16507 </listitem>
16508 <listitem>
16509 <para>
16510 <indexterm role="concept">
16511 <primary><function>crypt()</function></primary>
16512 </indexterm>
16513 <option>{crypt}</option> calls the <function>crypt()</function> function, which traditionally used to use
16514 only the first eight characters of the password. However, in modern operating
16515 systems this is no longer true, and in many cases the entire password is used,
16516 whatever its length.
16517 </para>
16518 </listitem>
16519 <listitem>
16520 <para>
16521 <indexterm role="concept">
16522 <primary><function>crypt16()</function></primary>
16523 </indexterm>
16524 <option>{crypt16}</option> calls the <function>crypt16()</function> function, which was originally created to
16525 use up to 16 characters of the password in some operating systems. Again, in
16526 modern operating systems, more characters may be used.
16527 </para>
16528 </listitem>
16529 </itemizedlist>
16530 <para>
16531 Exim has its own version of <function>crypt16()</function>, which is just a double call to
16532 <function>crypt()</function>. For operating systems that have their own version, setting
16533 HAVE_CRYPT16 in <filename>Local/Makefile</filename> when building Exim causes it to use the
16534 operating system version instead of its own. This option is set by default in
16535 the OS-dependent <filename>Makefile</filename> for those operating systems that are known to
16536 support <function>crypt16()</function>.
16537 </para>
16538 <para>
16539 Some years after Exim&#x2019;s <function>crypt16()</function> was implemented, a user discovered that
16540 it was not using the same algorithm as some operating systems&#x2019; versions. It
16541 turns out that as well as <function>crypt16()</function> there is a function called
16542 <function>bigcrypt()</function> in some operating systems. This may or may not use the same
16543 algorithm, and both of them may be different to Exim&#x2019;s built-in <function>crypt16()</function>.
16544 </para>
16545 <para>
16546 However, since there is now a move away from the traditional <function>crypt()</function>
16547 functions towards using SHA1 and other algorithms, tidying up this area of
16548 Exim is seen as very low priority.
16549 </para>
16550 <para>
16551 If you do not put a encryption type (in curly brackets) in a <option>crypteq</option>
16552 comparison, the default is usually either <literal>{crypt}</literal> or <literal>{crypt16}</literal>, as
16553 determined by the setting of DEFAULT_CRYPT in <filename>Local/Makefile</filename>. The default
16554 default is <literal>{crypt}</literal>. Whatever the default, you can always use either
16555 function by specifying it explicitly in curly brackets.
16556 </para>
16557 </listitem></varlistentry>
16558 <varlistentry>
16559 <term><emphasis role="bold">def:</emphasis>&lt;<emphasis>variable&nbsp;name</emphasis>&gt;</term>
16560 <listitem>
16561 <para>
16562 <indexterm role="concept">
16563 <primary>expansion</primary>
16564 <secondary>checking for empty variable</secondary>
16565 </indexterm>
16566 <indexterm role="concept">
16567 <primary><option>def</option> expansion condition</primary>
16568 </indexterm>
16569 The <option>def</option> condition must be followed by the name of one of the expansion
16570 variables defined in section <xref linkend="SECTexpvar"/>. The condition is true if the
16571 variable does not contain the empty string. For example:
16572 </para>
16573 <literallayout class="monospaced">
16574 ${if def:sender_ident {from $sender_ident}}
16575 </literallayout>
16576 <para>
16577 Note that the variable name is given without a leading <option>$</option> character. If the
16578 variable does not exist, the expansion fails.
16579 </para>
16580 </listitem></varlistentry>
16581 <varlistentry>
16582 <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>
16583 <listitem>
16584 <para>
16585 <indexterm role="concept">
16586 <primary>expansion</primary>
16587 <secondary>checking header line existence</secondary>
16588 </indexterm>
16589 This condition is true if a message is being processed and the named header
16590 exists in the message. For example,
16591 </para>
16592 <literallayout class="monospaced">
16593 ${if def:header_reply-to:{$h_reply-to:}{$h_from:}}
16594 </literallayout>
16595 <para>
16596 <emphasis role="bold">Note</emphasis>: No <option>$</option> appears before <option>header_</option> or <option>h_</option> in the condition, and
16597 the header name must be terminated by a colon if white space does not follow.
16598 </para>
16599 </listitem></varlistentry>
16600 <varlistentry>
16601 <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>
16602 <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>
16603 <listitem>
16604 <para>
16605 <indexterm role="concept">
16606 <primary>string</primary>
16607 <secondary>comparison</secondary>
16608 </indexterm>
16609 <indexterm role="concept">
16610 <primary>expansion</primary>
16611 <secondary>string comparison</secondary>
16612 </indexterm>
16613 <indexterm role="concept">
16614 <primary><option>eq</option> expansion condition</primary>
16615 </indexterm>
16616 <indexterm role="concept">
16617 <primary><option>eqi</option> expansion condition</primary>
16618 </indexterm>
16619 The two substrings are first expanded. The condition is true if the two
16620 resulting strings are identical. For <option>eq</option> the comparison includes the case of
16621 letters, whereas for <option>eqi</option> the comparison is case-independent.
16622 </para>
16623 </listitem></varlistentry>
16624 <varlistentry>
16625 <term><emphasis role="bold">exists&nbsp;{</emphasis>&lt;<emphasis>file&nbsp;name</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16626 <listitem>
16627 <para>
16628 <indexterm role="concept">
16629 <primary>expansion</primary>
16630 <secondary>file existence test</secondary>
16631 </indexterm>
16632 <indexterm role="concept">
16633 <primary>file</primary>
16634 <secondary>existence test</secondary>
16635 </indexterm>
16636 <indexterm role="concept">
16637 <primary><option>exists</option>, expansion condition</primary>
16638 </indexterm>
16639 The substring is first expanded and then interpreted as an absolute path. The
16640 condition is true if the named file (or directory) exists. The existence test
16641 is done by calling the <function>stat()</function> function. The use of the <option>exists</option> test in
16642 users&#x2019; filter files may be locked out by the system administrator.
16643 </para>
16644 </listitem></varlistentry>
16645 <varlistentry>
16646 <term><emphasis role="bold">first_delivery</emphasis></term>
16647 <listitem>
16648 <para>
16649 <indexterm role="concept">
16650 <primary>delivery</primary>
16651 <secondary>first</secondary>
16652 </indexterm>
16653 <indexterm role="concept">
16654 <primary>first delivery</primary>
16655 </indexterm>
16656 <indexterm role="concept">
16657 <primary>expansion</primary>
16658 <secondary>first delivery test</secondary>
16659 </indexterm>
16660 <indexterm role="concept">
16661 <primary><option>first_delivery</option> expansion condition</primary>
16662 </indexterm>
16663 This condition, which has no data, is true during a message&#x2019;s first delivery
16664 attempt. It is false during any subsequent delivery attempts.
16665 </para>
16666 </listitem></varlistentry>
16667 <varlistentry>
16668 <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>
16669 <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>
16670 <listitem>
16671 <para>
16672 <indexterm role="concept">
16673 <primary>list</primary>
16674 <secondary>iterative conditions</secondary>
16675 </indexterm>
16676 <indexterm role="concept">
16677 <primary>expansion</primary>
16678 <secondary><emphasis role="bold">forall</emphasis> condition</secondary>
16679 </indexterm>
16680 <indexterm role="concept">
16681 <primary>expansion</primary>
16682 <secondary><emphasis role="bold">forany</emphasis> condition</secondary>
16683 </indexterm>
16684 <indexterm role="variable">
16685 <primary><varname>$item</varname></primary>
16686 </indexterm>
16687 These conditions iterate over a list. The first argument is expanded to form
16688 the list. By default, the list separator is a colon, but it can be changed by
16689 the normal method. The second argument is interpreted as a condition that is to
16690 be applied to each item in the list in turn. During the interpretation of the
16691 condition, the current list item is placed in a variable called <varname>$item</varname>.
16692 </para>
16693 <itemizedlist>
16694 <listitem>
16695 <para>
16696 For <emphasis role="bold">forany</emphasis>, interpretation stops if the condition is true for any item, and
16697 the result of the whole condition is true. If the condition is false for all
16698 items in the list, the overall condition is false.
16699 </para>
16700 </listitem>
16701 <listitem>
16702 <para>
16703 For <emphasis role="bold">forall</emphasis>, interpretation stops if the condition is false for any item,
16704 and the result of the whole condition is false. If the condition is true for
16705 all items in the list, the overall condition is true.
16706 </para>
16707 </listitem>
16708 </itemizedlist>
16709 <para>
16710 Note that negation of <emphasis role="bold">forany</emphasis> means that the condition must be false for all
16711 items for the overall condition to succeed, and negation of <emphasis role="bold">forall</emphasis> means
16712 that the condition must be false for at least one item. In this example, the
16713 list separator is changed to a comma:
16714 </para>
16715 <literallayout class="monospaced">
16716 ${if forany{&lt;, $recipients}{match{$item}{^user3@}}{yes}{no}}
16717 </literallayout>
16718 <para>
16719 The value of <varname>$item</varname> is saved and restored while <emphasis role="bold">forany</emphasis> or <emphasis role="bold">forall</emphasis> is
16720 being processed, to enable these expansion items to be nested.
16721 </para>
16722 <para>
16723 To scan a named list, expand it with the <emphasis role="bold">listnamed</emphasis> operator.
16724 </para>
16725 </listitem></varlistentry>
16726 <varlistentry>
16727 <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>
16728 <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>
16729 <listitem>
16730 <para>
16731 <indexterm role="concept">
16732 <primary>string</primary>
16733 <secondary>comparison</secondary>
16734 </indexterm>
16735 <indexterm role="concept">
16736 <primary>expansion</primary>
16737 <secondary>string comparison</secondary>
16738 </indexterm>
16739 <indexterm role="concept">
16740 <primary><option>ge</option> expansion condition</primary>
16741 </indexterm>
16742 <indexterm role="concept">
16743 <primary><option>gei</option> expansion condition</primary>
16744 </indexterm>
16745 The two substrings are first expanded. The condition is true if the first
16746 string is lexically greater than or equal to the second string. For <option>ge</option> the
16747 comparison includes the case of letters, whereas for <option>gei</option> the comparison is
16748 case-independent.
16749 </para>
16750 </listitem></varlistentry>
16751 <varlistentry>
16752 <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>
16753 <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>
16754 <listitem>
16755 <para>
16756 <indexterm role="concept">
16757 <primary>string</primary>
16758 <secondary>comparison</secondary>
16759 </indexterm>
16760 <indexterm role="concept">
16761 <primary>expansion</primary>
16762 <secondary>string comparison</secondary>
16763 </indexterm>
16764 <indexterm role="concept">
16765 <primary><option>gt</option> expansion condition</primary>
16766 </indexterm>
16767 <indexterm role="concept">
16768 <primary><option>gti</option> expansion condition</primary>
16769 </indexterm>
16770 The two substrings are first expanded. The condition is true if the first
16771 string is lexically greater than the second string. For <option>gt</option> the comparison
16772 includes the case of letters, whereas for <option>gti</option> the comparison is
16773 case-independent.
16774 </para>
16775 </listitem></varlistentry>
16776 <varlistentry>
16777 <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>
16778 <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>
16779 <listitem>
16780 <para>
16781 <indexterm role="concept">
16782 <primary>string</primary>
16783 <secondary>comparison</secondary>
16784 </indexterm>
16785 <indexterm role="concept">
16786 <primary>list</primary>
16787 <secondary>iterative conditions</secondary>
16788 </indexterm>
16789 Both strings are expanded; the second string is treated as a list of simple
16790 strings; if the first string is a member of the second, then the condition
16791 is true.
16792 </para>
16793 <para>
16794 These are simpler to use versions of the more powerful <emphasis role="bold">forany</emphasis> condition.
16795 Examples, and the <emphasis role="bold">forany</emphasis> equivalents:
16796 </para>
16797 <literallayout class="monospaced">
16798 ${if inlist{needle}{foo:needle:bar}}
16799   ${if forany{foo:needle:bar}{eq{$item}{needle}}}
16800 ${if inlisti{Needle}{fOo:NeeDLE:bAr}}
16801   ${if forany{fOo:NeeDLE:bAr}{eqi{$item}{Needle}}}
16802 </literallayout>
16803 </listitem></varlistentry>
16804 <varlistentry>
16805 <term><emphasis role="bold">isip&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16806 <term><emphasis role="bold">isip4&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16807 <term><emphasis role="bold">isip6&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16808 <listitem>
16809 <para>
16810 <indexterm role="concept">
16811 <primary>IP address</primary>
16812 <secondary>testing string format</secondary>
16813 </indexterm>
16814 <indexterm role="concept">
16815 <primary>string</primary>
16816 <secondary>testing for IP address</secondary>
16817 </indexterm>
16818 <indexterm role="concept">
16819 <primary><option>isip</option> expansion condition</primary>
16820 </indexterm>
16821 <indexterm role="concept">
16822 <primary><option>isip4</option> expansion condition</primary>
16823 </indexterm>
16824 <indexterm role="concept">
16825 <primary><option>isip6</option> expansion condition</primary>
16826 </indexterm>
16827 The substring is first expanded, and then tested to see if it has the form of
16828 an IP address. Both IPv4 and IPv6 addresses are valid for <option>isip</option>, whereas
16829 <option>isip4</option> and <option>isip6</option> test specifically for IPv4 or IPv6 addresses.
16830 </para>
16831 <para>
16832 For an IPv4 address, the test is for four dot-separated components, each of
16833 which consists of from one to three digits. For an IPv6 address, up to eight
16834 colon-separated components are permitted, each containing from one to four
16835 hexadecimal digits. There may be fewer than eight components if an empty
16836 component (adjacent colons) is present. Only one empty component is permitted.
16837 </para>
16838 <para revisionflag="changed">
16839 <emphasis role="bold">Note</emphasis>: The checks used to be just on the form of the address; actual numerical
16840 values were not considered. Thus, for example, 999.999.999.999 passed the IPv4
16841 check.
16842 This is no longer the case.
16843 </para>
16844 <para>
16845 The main use of these tests is to distinguish between IP addresses and
16846 host names, or between IPv4 and IPv6 addresses. For example, you could use
16847 </para>
16848 <literallayout class="monospaced">
16849 ${if isip4{$sender_host_address}...
16850 </literallayout>
16851 <para>
16852 to test which IP version an incoming SMTP connection is using.
16853 </para>
16854 </listitem></varlistentry>
16855 <varlistentry>
16856 <term><emphasis role="bold">ldapauth&nbsp;{</emphasis>&lt;<emphasis>ldap&nbsp;query</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16857 <listitem>
16858 <para>
16859 <indexterm role="concept">
16860 <primary>LDAP</primary>
16861 <secondary>use for authentication</secondary>
16862 </indexterm>
16863 <indexterm role="concept">
16864 <primary>expansion</primary>
16865 <secondary>LDAP authentication test</secondary>
16866 </indexterm>
16867 <indexterm role="concept">
16868 <primary><option>ldapauth</option> expansion condition</primary>
16869 </indexterm>
16870 This condition supports user authentication using LDAP. See section
16871 <xref linkend="SECTldap"/> for details of how to use LDAP in lookups and the syntax of
16872 queries. For this use, the query must contain a user name and password. The
16873 query itself is not used, and can be empty. The condition is true if the
16874 password is not empty, and the user name and password are accepted by the LDAP
16875 server. An empty password is rejected without calling LDAP because LDAP binds
16876 with an empty password are considered anonymous regardless of the username, and
16877 will succeed in most configurations. See chapter <xref linkend="CHAPSMTPAUTH"/> for details
16878 of SMTP authentication, and chapter <xref linkend="CHAPplaintext"/> for an example of how
16879 this can be used.
16880 </para>
16881 </listitem></varlistentry>
16882 <varlistentry>
16883 <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>
16884 <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>
16885 <listitem>
16886 <para>
16887 <indexterm role="concept">
16888 <primary>string</primary>
16889 <secondary>comparison</secondary>
16890 </indexterm>
16891 <indexterm role="concept">
16892 <primary>expansion</primary>
16893 <secondary>string comparison</secondary>
16894 </indexterm>
16895 <indexterm role="concept">
16896 <primary><option>le</option> expansion condition</primary>
16897 </indexterm>
16898 <indexterm role="concept">
16899 <primary><option>lei</option> expansion condition</primary>
16900 </indexterm>
16901 The two substrings are first expanded. The condition is true if the first
16902 string is lexically less than or equal to the second string. For <option>le</option> the
16903 comparison includes the case of letters, whereas for <option>lei</option> the comparison is
16904 case-independent.
16905 </para>
16906 </listitem></varlistentry>
16907 <varlistentry>
16908 <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>
16909 <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>
16910 <listitem>
16911 <para>
16912 <indexterm role="concept">
16913 <primary>string</primary>
16914 <secondary>comparison</secondary>
16915 </indexterm>
16916 <indexterm role="concept">
16917 <primary>expansion</primary>
16918 <secondary>string comparison</secondary>
16919 </indexterm>
16920 <indexterm role="concept">
16921 <primary><option>lt</option> expansion condition</primary>
16922 </indexterm>
16923 <indexterm role="concept">
16924 <primary><option>lti</option> expansion condition</primary>
16925 </indexterm>
16926 The two substrings are first expanded. The condition is true if the first
16927 string is lexically less than the second string. For <option>lt</option> the comparison
16928 includes the case of letters, whereas for <option>lti</option> the comparison is
16929 case-independent.
16930 </para>
16931 </listitem></varlistentry>
16932 <varlistentry>
16933 <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>
16934 <listitem>
16935 <para>
16936 <indexterm role="concept">
16937 <primary>expansion</primary>
16938 <secondary>regular expression comparison</secondary>
16939 </indexterm>
16940 <indexterm role="concept">
16941 <primary>regular expressions</primary>
16942 <secondary>match in expanded string</secondary>
16943 </indexterm>
16944 <indexterm role="concept">
16945 <primary><option>match</option> expansion condition</primary>
16946 </indexterm>
16947 The two substrings are first expanded. The second is then treated as a regular
16948 expression and applied to the first. Because of the pre-expansion, if the
16949 regular expression contains dollar, or backslash characters, they must be
16950 escaped. Care must also be taken if the regular expression contains braces
16951 (curly brackets). A closing brace must be escaped so that it is not taken as a
16952 premature termination of &lt;<emphasis>string2</emphasis>&gt;. The easiest approach is to use the
16953 <literal>\N</literal> feature to disable expansion of the regular expression.
16954 For example,
16955 </para>
16956 <literallayout class="monospaced">
16957 ${if match {$local_part}{\N^\d{3}\N} ...
16958 </literallayout>
16959 <para>
16960 If the whole expansion string is in double quotes, further escaping of
16961 backslashes is also required.
16962 </para>
16963 <para>
16964 The condition is true if the regular expression match succeeds.
16965 The regular expression is not required to begin with a circumflex
16966 metacharacter, but if there is no circumflex, the expression is not anchored,
16967 and it may match anywhere in the subject, not just at the start. If you want
16968 the pattern to match at the end of the subject, you must include the <literal>$</literal>
16969 metacharacter at an appropriate point.
16970 </para>
16971 <para>
16972 <indexterm role="concept">
16973 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
16974 <secondary>in <option>if</option> expansion</secondary>
16975 </indexterm>
16976 At the start of an <option>if</option> expansion the values of the numeric variable
16977 substitutions <varname>$1</varname> etc. are remembered. Obeying a <option>match</option> condition that
16978 succeeds causes them to be reset to the substrings of that condition and they
16979 will have these values during the expansion of the success string. At the end
16980 of the <option>if</option> expansion, the previous values are restored. After testing a
16981 combination of conditions using <option>or</option>, the subsequent values of the numeric
16982 variables are those of the condition that succeeded.
16983 </para>
16984 </listitem></varlistentry>
16985 <varlistentry>
16986 <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>
16987 <listitem>
16988 <para>
16989 <indexterm role="concept">
16990 <primary><option>match_address</option> expansion condition</primary>
16991 </indexterm>
16992 See <emphasis role="bold">match_local_part</emphasis>.
16993 </para>
16994 </listitem></varlistentry>
16995 <varlistentry>
16996 <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>
16997 <listitem>
16998 <para>
16999 <indexterm role="concept">
17000 <primary><option>match_domain</option> expansion condition</primary>
17001 </indexterm>
17002 See <emphasis role="bold">match_local_part</emphasis>.
17003 </para>
17004 </listitem></varlistentry>
17005 <varlistentry>
17006 <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>
17007 <listitem>
17008 <para>
17009 <indexterm role="concept">
17010 <primary><option>match_ip</option> expansion condition</primary>
17011 </indexterm>
17012 This condition matches an IP address to a list of IP address patterns. It must
17013 be followed by two argument strings. The first (after expansion) must be an IP
17014 address or an empty string. The second (not expanded) is a restricted host
17015 list that can match only an IP address, not a host name. For example:
17016 </para>
17017 <literallayout class="monospaced">
17018 ${if match_ip{$sender_host_address}{1.2.3.4:5.6.7.8}{...}{...}}
17019 </literallayout>
17020 <para>
17021 The specific types of host list item that are permitted in the list are:
17022 </para>
17023 <itemizedlist>
17024 <listitem>
17025 <para>
17026 An IP address, optionally with a CIDR mask.
17027 </para>
17028 </listitem>
17029 <listitem>
17030 <para>
17031 A single asterisk, which matches any IP address.
17032 </para>
17033 </listitem>
17034 <listitem>
17035 <para>
17036 An empty item, which matches only if the IP address is empty. This could be
17037 useful for testing for a locally submitted message or one from specific hosts
17038 in a single test such as
17039 </para>
17040 <literallayout class="monospaced">
17041   ${if match_ip{$sender_host_address}{:4.3.2.1:...}{...}{...}}
17042 </literallayout>
17043 <para>
17044 where the first item in the list is the empty string.
17045 </para>
17046 </listitem>
17047 <listitem>
17048 <para>
17049 The item @[] matches any of the local host&#x2019;s interface addresses.
17050 </para>
17051 </listitem>
17052 <listitem>
17053 <para>
17054 Single-key lookups are assumed to be like <quote>net-</quote> style lookups in host lists,
17055 even if <literal>net-</literal> is not specified. There is never any attempt to turn the IP
17056 address into a host name. The most common type of linear search for
17057 <emphasis role="bold">match_ip</emphasis> is likely to be <emphasis role="bold">iplsearch</emphasis>, in which the file can contain CIDR
17058 masks. For example:
17059 </para>
17060 <literallayout class="monospaced">
17061   ${if match_ip{$sender_host_address}{iplsearch;/some/file}...
17062 </literallayout>
17063 <para>
17064 It is of course possible to use other kinds of lookup, and in such a case, you
17065 do need to specify the <literal>net-</literal> prefix if you want to specify a specific
17066 address mask, for example:
17067 </para>
17068 <literallayout class="monospaced">
17069   ${if match_ip{$sender_host_address}{net24-dbm;/some/file}...
17070 </literallayout>
17071 <para>
17072 However, unless you are combining a <option>match_ip</option> condition with others, it is
17073 just as easy to use the fact that a lookup is itself a condition, and write:
17074 </para>
17075 <literallayout class="monospaced">
17076   ${lookup{${mask:$sender_host_address/24}}dbm{/a/file}...
17077 </literallayout>
17078 </listitem>
17079 </itemizedlist>
17080 <para>
17081 Note that &lt;<emphasis>string2</emphasis>&gt; is not itself subject to string expansion, unless
17082 Exim was built with the EXPAND_LISTMATCH_RHS option.
17083 </para>
17084 <para>
17085 Consult section <xref linkend="SECThoslispatip"/> for further details of these patterns.
17086 </para>
17087 </listitem></varlistentry>
17088 <varlistentry>
17089 <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>
17090 <listitem>
17091 <para>
17092 <indexterm role="concept">
17093 <primary>domain list</primary>
17094 <secondary>in expansion condition</secondary>
17095 </indexterm>
17096 <indexterm role="concept">
17097 <primary>address list</primary>
17098 <secondary>in expansion condition</secondary>
17099 </indexterm>
17100 <indexterm role="concept">
17101 <primary>local part</primary>
17102 <secondary>list, in expansion condition</secondary>
17103 </indexterm>
17104 <indexterm role="concept">
17105 <primary><option>match_local_part</option> expansion condition</primary>
17106 </indexterm>
17107 This condition, together with <option>match_address</option> and <option>match_domain</option>, make it
17108 possible to test domain, address, and local part lists within expansions. Each
17109 condition requires two arguments: an item and a list to match. A trivial
17110 example is:
17111 </para>
17112 <literallayout class="monospaced">
17113 ${if match_domain{a.b.c}{x.y.z:a.b.c:p.q.r}{yes}{no}}
17114 </literallayout>
17115 <para>
17116 In each case, the second argument may contain any of the allowable items for a
17117 list of the appropriate type. Also, because the second argument
17118 is a standard form of list, it is possible to refer to a named list.
17119 Thus, you can use conditions like this:
17120 </para>
17121 <literallayout class="monospaced">
17122 ${if match_domain{$domain}{+local_domains}{...
17123 </literallayout>
17124 <para>
17125 <indexterm role="concept">
17126 <primary><literal>+caseful</literal></primary>
17127 </indexterm>
17128 For address lists, the matching starts off caselessly, but the <literal>+caseful</literal>
17129 item can be used, as in all address lists, to cause subsequent items to
17130 have their local parts matched casefully. Domains are always matched
17131 caselessly.
17132 </para>
17133 <para>
17134 Note that &lt;<emphasis>string2</emphasis>&gt; is not itself subject to string expansion, unless
17135 Exim was built with the EXPAND_LISTMATCH_RHS option.
17136 </para>
17137 <para>
17138 <emphasis role="bold">Note</emphasis>: Host lists are <emphasis>not</emphasis> supported in this way. This is because
17139 hosts have two identities: a name and an IP address, and it is not clear
17140 how to specify cleanly how such a test would work. However, IP addresses can be
17141 matched using <option>match_ip</option>.
17142 </para>
17143 </listitem></varlistentry>
17144 <varlistentry>
17145 <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>
17146 <listitem>
17147 <para>
17148 <indexterm role="concept">
17149 <primary>PAM authentication</primary>
17150 </indexterm>
17151 <indexterm role="concept">
17152 <primary>AUTH</primary>
17153 <secondary>with PAM</secondary>
17154 </indexterm>
17155 <indexterm role="concept">
17156 <primary>Solaris</primary>
17157 <secondary>PAM support</secondary>
17158 </indexterm>
17159 <indexterm role="concept">
17160 <primary>expansion</primary>
17161 <secondary>PAM authentication test</secondary>
17162 </indexterm>
17163 <indexterm role="concept">
17164 <primary><option>pam</option> expansion condition</primary>
17165 </indexterm>
17166 <emphasis>Pluggable Authentication Modules</emphasis>
17167 (<emphasis role="bold"><ulink url="http://www.kernel.org/pub/linux/libs/pam/">http://www.kernel.org/pub/linux/libs/pam/</ulink></emphasis>) are a facility that is
17168 available in the latest releases of Solaris and in some GNU/Linux
17169 distributions. The Exim support, which is intended for use in conjunction with
17170 the SMTP AUTH command, is available only if Exim is compiled with
17171 </para>
17172 <literallayout class="monospaced">
17173 SUPPORT_PAM=yes
17174 </literallayout>
17175 <para>
17176 in <filename>Local/Makefile</filename>. You probably need to add <option>-lpam</option> to EXTRALIBS, and
17177 in some releases of GNU/Linux <option>-ldl</option> is also needed.
17178 </para>
17179 <para>
17180 The argument string is first expanded, and the result must be a
17181 colon-separated list of strings. Leading and trailing white space is ignored.
17182 The PAM module is initialized with the service name <quote>exim</quote> and the user name
17183 taken from the first item in the colon-separated data string (&lt;<emphasis>string1</emphasis>&gt;).
17184 The remaining items in the data string are passed over in response to requests
17185 from the authentication function. In the simple case there will only be one
17186 request, for a password, so the data consists of just two strings.
17187 </para>
17188 <para>
17189 There can be problems if any of the strings are permitted to contain colon
17190 characters. In the usual way, these have to be doubled to avoid being taken as
17191 separators. If the data is being inserted from a variable, the <option>sg</option> expansion
17192 item can be used to double any existing colons. For example, the configuration
17193 of a LOGIN authenticator might contain this setting:
17194 </para>
17195 <literallayout class="monospaced">
17196 server_condition = ${if pam{$auth1:${sg{$auth2}{:}{::}}}}
17197 </literallayout>
17198 <para>
17199 For a PLAIN authenticator you could use:
17200 </para>
17201 <literallayout class="monospaced">
17202 server_condition = ${if pam{$auth2:${sg{$auth3}{:}{::}}}}
17203 </literallayout>
17204 <para>
17205 In some operating systems, PAM authentication can be done only from a process
17206 running as root. Since Exim is running as the Exim user when receiving
17207 messages, this means that PAM cannot be used directly in those systems.
17208 A patched version of the <emphasis>pam_unix</emphasis> module that comes with the
17209 Linux PAM package is available from <emphasis role="bold"><ulink url="http://www.e-admin.de/pam_exim/">http://www.e-admin.de/pam_exim/</ulink></emphasis>.
17210 The patched module allows one special uid/gid combination, in addition to root,
17211 to authenticate. If you build the patched module to allow the Exim user and
17212 group, PAM can then be used from an Exim authenticator.
17213 </para>
17214 </listitem></varlistentry>
17215 <varlistentry>
17216 <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>
17217 <listitem>
17218 <para>
17219 <indexterm role="concept">
17220 <primary><emphasis>pwcheck</emphasis> daemon</primary>
17221 </indexterm>
17222 <indexterm role="concept">
17223 <primary>Cyrus</primary>
17224 </indexterm>
17225 <indexterm role="concept">
17226 <primary>expansion</primary>
17227 <secondary><emphasis>pwcheck</emphasis> authentication test</secondary>
17228 </indexterm>
17229 <indexterm role="concept">
17230 <primary><option>pwcheck</option> expansion condition</primary>
17231 </indexterm>
17232 This condition supports user authentication using the Cyrus <emphasis>pwcheck</emphasis> daemon.
17233 This is one way of making it possible for passwords to be checked by a process
17234 that is not running as root. <emphasis role="bold">Note</emphasis>: The use of <emphasis>pwcheck</emphasis> is now
17235 deprecated. Its replacement is <emphasis>saslauthd</emphasis> (see below).
17236 </para>
17237 <para>
17238 The pwcheck support is not included in Exim by default. You need to specify
17239 the location of the pwcheck daemon&#x2019;s socket in <filename>Local/Makefile</filename> before
17240 building Exim. For example:
17241 </para>
17242 <literallayout class="monospaced">
17243 CYRUS_PWCHECK_SOCKET=/var/pwcheck/pwcheck
17244 </literallayout>
17245 <para>
17246 You do not need to install the full Cyrus software suite in order to use
17247 the pwcheck daemon. You can compile and install just the daemon alone
17248 from the Cyrus SASL library. Ensure that <emphasis>exim</emphasis> is the only user that has
17249 access to the <filename>/var/pwcheck</filename> directory.
17250 </para>
17251 <para>
17252 The <option>pwcheck</option> condition takes one argument, which must be the user name and
17253 password, separated by a colon. For example, in a LOGIN authenticator
17254 configuration, you might have this:
17255 </para>
17256 <literallayout class="monospaced">
17257 server_condition = ${if pwcheck{$auth1:$auth2}}
17258 </literallayout>
17259 <para>
17260 Again, for a PLAIN authenticator configuration, this would be:
17261 </para>
17262 <literallayout class="monospaced">
17263 server_condition = ${if pwcheck{$auth2:$auth3}}
17264 </literallayout>
17265 </listitem></varlistentry>
17266 <varlistentry>
17267 <term><emphasis role="bold">queue_running</emphasis></term>
17268 <listitem>
17269 <para>
17270 <indexterm role="concept">
17271 <primary>queue runner</primary>
17272 <secondary>detecting when delivering from</secondary>
17273 </indexterm>
17274 <indexterm role="concept">
17275 <primary>expansion</primary>
17276 <secondary>queue runner test</secondary>
17277 </indexterm>
17278 <indexterm role="concept">
17279 <primary><option>queue_running</option> expansion condition</primary>
17280 </indexterm>
17281 This condition, which has no data, is true during delivery attempts that are
17282 initiated by queue runner processes, and false otherwise.
17283 </para>
17284 </listitem></varlistentry>
17285 <varlistentry>
17286 <term><emphasis role="bold">radius&nbsp;{</emphasis>&lt;<emphasis>authentication&nbsp;string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17287 <listitem>
17288 <para>
17289 <indexterm role="concept">
17290 <primary>Radius</primary>
17291 </indexterm>
17292 <indexterm role="concept">
17293 <primary>expansion</primary>
17294 <secondary>Radius authentication</secondary>
17295 </indexterm>
17296 <indexterm role="concept">
17297 <primary><option>radius</option> expansion condition</primary>
17298 </indexterm>
17299 Radius authentication (RFC 2865) is supported in a similar way to PAM. You must
17300 set RADIUS_CONFIG_FILE in <filename>Local/Makefile</filename> to specify the location of
17301 the Radius client configuration file in order to build Exim with Radius
17302 support.
17303 </para>
17304 <para>
17305 With just that one setting, Exim expects to be linked with the <option>radiusclient</option>
17306 library, using the original API. If you are using release 0.4.0 or later of
17307 this library, you need to set
17308 </para>
17309 <literallayout class="monospaced">
17310 RADIUS_LIB_TYPE=RADIUSCLIENTNEW
17311 </literallayout>
17312 <para>
17313 in <filename>Local/Makefile</filename> when building Exim. You can also link Exim with the
17314 <option>libradius</option> library that comes with FreeBSD. To do this, set
17315 </para>
17316 <literallayout class="monospaced">
17317 RADIUS_LIB_TYPE=RADLIB
17318 </literallayout>
17319 <para>
17320 in <filename>Local/Makefile</filename>, in addition to setting RADIUS_CONFIGURE_FILE.
17321 You may also have to supply a suitable setting in EXTRALIBS so that the
17322 Radius library can be found when Exim is linked.
17323 </para>
17324 <para>
17325 The string specified by RADIUS_CONFIG_FILE is expanded and passed to the
17326 Radius client library, which calls the Radius server. The condition is true if
17327 the authentication is successful. For example:
17328 </para>
17329 <literallayout class="monospaced">
17330 server_condition = ${if radius{&lt;arguments&gt;}}
17331 </literallayout>
17332 </listitem></varlistentry>
17333 <varlistentry>
17334 <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>
17335 <listitem>
17336 <para>
17337 <indexterm role="concept">
17338 <primary><emphasis>saslauthd</emphasis> daemon</primary>
17339 </indexterm>
17340 <indexterm role="concept">
17341 <primary>Cyrus</primary>
17342 </indexterm>
17343 <indexterm role="concept">
17344 <primary>expansion</primary>
17345 <secondary><emphasis>saslauthd</emphasis> authentication test</secondary>
17346 </indexterm>
17347 <indexterm role="concept">
17348 <primary><option>saslauthd</option> expansion condition</primary>
17349 </indexterm>
17350 This condition supports user authentication using the Cyrus <emphasis>saslauthd</emphasis>
17351 daemon. This replaces the older <emphasis>pwcheck</emphasis> daemon, which is now deprecated.
17352 Using this daemon is one way of making it possible for passwords to be checked
17353 by a process that is not running as root.
17354 </para>
17355 <para>
17356 The saslauthd support is not included in Exim by default. You need to specify
17357 the location of the saslauthd daemon&#x2019;s socket in <filename>Local/Makefile</filename> before
17358 building Exim. For example:
17359 </para>
17360 <literallayout class="monospaced">
17361 CYRUS_SASLAUTHD_SOCKET=/var/state/saslauthd/mux
17362 </literallayout>
17363 <para>
17364 You do not need to install the full Cyrus software suite in order to use
17365 the saslauthd daemon. You can compile and install just the daemon alone
17366 from the Cyrus SASL library.
17367 </para>
17368 <para>
17369 Up to four arguments can be supplied to the <option>saslauthd</option> condition, but only
17370 two are mandatory. For example:
17371 </para>
17372 <literallayout class="monospaced">
17373 server_condition = ${if saslauthd{{$auth1}{$auth2}}}
17374 </literallayout>
17375 <para>
17376 The service and the realm are optional (which is why the arguments are enclosed
17377 in their own set of braces). For details of the meaning of the service and
17378 realm, and how to run the daemon, consult the Cyrus documentation.
17379 </para>
17380 </listitem></varlistentry>
17381 </variablelist>
17382 </section>
17383 <section id="SECID84">
17384 <title>Combining expansion conditions</title>
17385 <para>
17386 <indexterm role="concept">
17387 <primary>expansion</primary>
17388 <secondary>combining conditions</secondary>
17389 </indexterm>
17390 Several conditions can be tested at once by combining them using the <option>and</option>
17391 and <option>or</option> combination conditions. Note that <option>and</option> and <option>or</option> are complete
17392 conditions on their own, and precede their lists of sub-conditions. Each
17393 sub-condition must be enclosed in braces within the overall braces that contain
17394 the list. No repetition of <option>if</option> is used.
17395 </para>
17396 <variablelist>
17397 <varlistentry>
17398 <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>
17399 <listitem>
17400 <para>
17401 <indexterm role="concept">
17402 <primary><quote>or</quote> expansion condition</primary>
17403 </indexterm>
17404 <indexterm role="concept">
17405 <primary>expansion</primary>
17406 <secondary><quote>or</quote> of conditions</secondary>
17407 </indexterm>
17408 The sub-conditions are evaluated from left to right. The condition is true if
17409 any one of the sub-conditions is true.
17410 For example,
17411 </para>
17412 <literallayout class="monospaced">
17413 ${if or {{eq{$local_part}{spqr}}{eq{$domain}{testing.com}}}...
17414 </literallayout>
17415 <para>
17416 When a true sub-condition is found, the following ones are parsed but not
17417 evaluated. If there are several <quote>match</quote> sub-conditions the values of the
17418 numeric variables afterwards are taken from the first one that succeeds.
17419 </para>
17420 </listitem></varlistentry>
17421 <varlistentry>
17422 <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>
17423 <listitem>
17424 <para>
17425 <indexterm role="concept">
17426 <primary><quote>and</quote> expansion condition</primary>
17427 </indexterm>
17428 <indexterm role="concept">
17429 <primary>expansion</primary>
17430 <secondary><quote>and</quote> of conditions</secondary>
17431 </indexterm>
17432 The sub-conditions are evaluated from left to right. The condition is true if
17433 all of the sub-conditions are true. If there are several <quote>match</quote>
17434 sub-conditions, the values of the numeric variables afterwards are taken from
17435 the last one. When a false sub-condition is found, the following ones are
17436 parsed but not evaluated.
17437 </para>
17438 </listitem></varlistentry>
17439 </variablelist>
17440 <para>
17441 <indexterm role="concept" startref="IIDexpcond" class="endofrange"/>
17442 </para>
17443 </section>
17444 <section id="SECTexpvar">
17445 <title>Expansion variables</title>
17446 <para>
17447 <indexterm role="concept">
17448 <primary>expansion</primary>
17449 <secondary>variables, list of</secondary>
17450 </indexterm>
17451 This section contains an alphabetical list of all the expansion variables. Some
17452 of them are available only when Exim is compiled with specific options such as
17453 support for TLS or the content scanning extension.
17454 </para>
17455 <variablelist>
17456 <varlistentry>
17457 <term><varname>$0</varname>, <varname>$1</varname>, etc</term>
17458 <listitem>
17459 <para>
17460 <indexterm role="concept">
17461 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
17462 </indexterm>
17463 When a <option>match</option> expansion condition succeeds, these variables contain the
17464 captured substrings identified by the regular expression during subsequent
17465 processing of the success string of the containing <option>if</option> expansion item.
17466 In the expansion condition case
17467 they do not retain their values afterwards; in fact, their previous
17468 values are restored at the end of processing an <option>if</option> item. The numerical
17469 variables may also be set externally by some other matching process which
17470 precedes the expansion of the string. For example, the commands available in
17471 Exim filter files include an <option>if</option> command with its own regular expression
17472 matching condition.
17473 </para>
17474 </listitem></varlistentry>
17475 <varlistentry>
17476 <term><varname>$acl_arg1</varname>, <varname>$acl_arg2</varname>, etc</term>
17477 <listitem>
17478 <para>
17479 Within an acl condition, expansion condition or expansion item
17480 any arguments are copied to these variables,
17481 any unused variables being made empty.
17482 </para>
17483 </listitem></varlistentry>
17484 <varlistentry>
17485 <term><varname>$acl_c...</varname></term>
17486 <listitem>
17487 <para>
17488 Values can be placed in these variables by the <option>set</option> modifier in an ACL. They
17489 can be given any name that starts with <varname>$acl_c</varname> and is at least six characters
17490 long, but the sixth character must be either a digit or an underscore. For
17491 example: <varname>$acl_c5</varname>, <varname>$acl_c_mycount</varname>. The values of the <varname>$acl_c...</varname>
17492 variables persist throughout the lifetime of an SMTP connection. They can be
17493 used to pass information between ACLs and between different invocations of the
17494 same ACL. When a message is received, the values of these variables are saved
17495 with the message, and can be accessed by filters, routers, and transports
17496 during subsequent delivery.
17497 </para>
17498 </listitem></varlistentry>
17499 <varlistentry>
17500 <term><varname>$acl_m...</varname></term>
17501 <listitem>
17502 <para>
17503 These variables are like the <varname>$acl_c...</varname> variables, except that their values
17504 are reset after a message has been received. Thus, if several messages are
17505 received in one SMTP connection, <varname>$acl_m...</varname> values are not passed on from one
17506 message to the next, as <varname>$acl_c...</varname> values are. The <varname>$acl_m...</varname> variables are
17507 also reset by MAIL, RSET, EHLO, HELO, and after starting a TLS session. When a
17508 message is received, the values of these variables are saved with the message,
17509 and can be accessed by filters, routers, and transports during subsequent
17510 delivery.
17511 </para>
17512 </listitem></varlistentry>
17513 <varlistentry>
17514 <term><varname>$acl_narg</varname></term>
17515 <listitem>
17516 <para>
17517 Within an acl condition, expansion condition or expansion item
17518 this variable has the number of arguments.
17519 </para>
17520 </listitem></varlistentry>
17521 <varlistentry>
17522 <term><varname>$acl_verify_message</varname></term>
17523 <listitem>
17524 <para>
17525 <indexterm role="variable">
17526 <primary><varname>$acl_verify_message</varname></primary>
17527 </indexterm>
17528 After an address verification has failed, this variable contains the failure
17529 message. It retains its value for use in subsequent modifiers. The message can
17530 be preserved by coding like this:
17531 </para>
17532 <literallayout class="monospaced">
17533 warn !verify = sender
17534      set acl_m0 = $acl_verify_message
17535 </literallayout>
17536 <para>
17537 You can use <varname>$acl_verify_message</varname> during the expansion of the <option>message</option> or
17538 <option>log_message</option> modifiers, to include information about the verification
17539 failure.
17540 </para>
17541 </listitem></varlistentry>
17542 <varlistentry>
17543 <term><varname>$address_data</varname></term>
17544 <listitem>
17545 <para>
17546 <indexterm role="variable">
17547 <primary><varname>$address_data</varname></primary>
17548 </indexterm>
17549 This variable is set by means of the <option>address_data</option> option in routers. The
17550 value then remains with the address while it is processed by subsequent routers
17551 and eventually a transport. If the transport is handling multiple addresses,
17552 the value from the first address is used. See chapter <xref linkend="CHAProutergeneric"/>
17553 for more details. <emphasis role="bold">Note</emphasis>: The contents of <varname>$address_data</varname> are visible in
17554 user filter files.
17555 </para>
17556 <para>
17557 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify
17558 a recipient address, the final value is still in the variable for subsequent
17559 conditions and modifiers of the ACL statement. If routing the address caused it
17560 to be redirected to just one address, the child address is also routed as part
17561 of the verification, and in this case the final value of <varname>$address_data</varname> is
17562 from the child&#x2019;s routing.
17563 </para>
17564 <para>
17565 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
17566 sender address, the final value is also preserved, but this time in
17567 <varname>$sender_address_data</varname>, to distinguish it from data from a recipient
17568 address.
17569 </para>
17570 <para>
17571 In both cases (recipient and sender verification), the value does not persist
17572 after the end of the current ACL statement. If you want to preserve
17573 these values for longer, you can save them in ACL variables.
17574 </para>
17575 </listitem></varlistentry>
17576 <varlistentry>
17577 <term><varname>$address_file</varname></term>
17578 <listitem>
17579 <para>
17580 <indexterm role="variable">
17581 <primary><varname>$address_file</varname></primary>
17582 </indexterm>
17583 When, as a result of aliasing, forwarding, or filtering, a message is directed
17584 to a specific file, this variable holds the name of the file when the transport
17585 is running. At other times, the variable is empty. For example, using the
17586 default configuration, if user <option>r2d2</option> has a <filename>.forward</filename> file containing
17587 </para>
17588 <literallayout class="monospaced">
17589 /home/r2d2/savemail
17590 </literallayout>
17591 <para>
17592 then when the <command>address_file</command> transport is running, <varname>$address_file</varname>
17593 contains the text string <literal>/home/r2d2/savemail</literal>.
17594 <indexterm role="concept">
17595 <primary>Sieve filter</primary>
17596 <secondary>value of <varname>$address_file</varname></secondary>
17597 </indexterm>
17598 For Sieve filters, the value may be <quote>inbox</quote> or a relative folder name. It is
17599 then up to the transport configuration to generate an appropriate absolute path
17600 to the relevant file.
17601 </para>
17602 </listitem></varlistentry>
17603 <varlistentry>
17604 <term><varname>$address_pipe</varname></term>
17605 <listitem>
17606 <para>
17607 <indexterm role="variable">
17608 <primary><varname>$address_pipe</varname></primary>
17609 </indexterm>
17610 When, as a result of aliasing or forwarding, a message is directed to a pipe,
17611 this variable holds the pipe command when the transport is running.
17612 </para>
17613 </listitem></varlistentry>
17614 <varlistentry>
17615 <term><varname>$auth1</varname> &ndash; <varname>$auth3</varname></term>
17616 <listitem>
17617 <para>
17618 <indexterm role="variable">
17619 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
17620 </indexterm>
17621 These variables are used in SMTP authenticators (see chapters
17622 <xref linkend="CHAPplaintext"/>&ndash;<xref linkend="CHAPtlsauth"/>). Elsewhere, they are empty.
17623 </para>
17624 </listitem></varlistentry>
17625 <varlistentry>
17626 <term><varname>$authenticated_id</varname></term>
17627 <listitem>
17628 <para>
17629 <indexterm role="concept">
17630 <primary>authentication</primary>
17631 <secondary>id</secondary>
17632 </indexterm>
17633 <indexterm role="variable">
17634 <primary><varname>$authenticated_id</varname></primary>
17635 </indexterm>
17636 When a server successfully authenticates a client it may be configured to
17637 preserve some of the authentication information in the variable
17638 <varname>$authenticated_id</varname> (see chapter <xref linkend="CHAPSMTPAUTH"/>). For example, a
17639 user/password authenticator configuration might preserve the user name for use
17640 in the routers. Note that this is not the same information that is saved in
17641 <varname>$sender_host_authenticated</varname>.
17642 When a message is submitted locally (that is, not over a TCP connection)
17643 the value of <varname>$authenticated_id</varname> is normally the login name of the calling
17644 process. However, a trusted user can override this by means of the <option>-oMai</option>
17645 command line option.
17646 </para>
17647 </listitem></varlistentry>
17648 <varlistentry>
17649 <term><varname>$authenticated_fail_id</varname></term>
17650 <listitem>
17651 <para>
17652 <indexterm role="concept">
17653 <primary>authentication</primary>
17654 <secondary>fail</secondary>
17655 </indexterm>
17656 <indexterm role="variable">
17657 <primary><varname>$authenticated_fail_id</varname></primary>
17658 </indexterm>
17659 When an authentication attempt fails, the variable <varname>$authenticated_fail_id</varname>
17660 will contain the failed authentication id. If more than one authentication
17661 id is attempted, it will contain only the last one. The variable is
17662 available for processing in the ACL&#x2019;s, generally the quit or notquit ACL.
17663 A message to a local recipient could still be accepted without requiring
17664 authentication, which means this variable could also be visible in all of
17665 the ACL&#x2019;s as well.
17666 </para>
17667 </listitem></varlistentry>
17668 <varlistentry>
17669 <term><varname>$authenticated_sender</varname></term>
17670 <listitem>
17671 <para>
17672 <indexterm role="concept">
17673 <primary>sender</primary>
17674 <secondary>authenticated</secondary>
17675 </indexterm>
17676 <indexterm role="concept">
17677 <primary>authentication</primary>
17678 <secondary>sender</secondary>
17679 </indexterm>
17680 <indexterm role="concept">
17681 <primary>AUTH</primary>
17682 <secondary>on MAIL command</secondary>
17683 </indexterm>
17684 <indexterm role="variable">
17685 <primary><varname>$authenticated_sender</varname></primary>
17686 </indexterm>
17687 When acting as a server, Exim takes note of the AUTH= parameter on an incoming
17688 SMTP MAIL command if it believes the sender is sufficiently trusted, as
17689 described in section <xref linkend="SECTauthparamail"/>. Unless the data is the string
17690 <quote>&lt;&gt;</quote>, it is set as the authenticated sender of the message, and the value is
17691 available during delivery in the <varname>$authenticated_sender</varname> variable. If the
17692 sender is not trusted, Exim accepts the syntax of AUTH=, but ignores the data.
17693 </para>
17694 <para>
17695 <indexterm role="variable">
17696 <primary><varname>$qualify_domain</varname></primary>
17697 </indexterm>
17698 When a message is submitted locally (that is, not over a TCP connection), the
17699 value of <varname>$authenticated_sender</varname> is an address constructed from the login
17700 name of the calling process and <varname>$qualify_domain</varname>, except that a trusted user
17701 can override this by means of the <option>-oMas</option> command line option.
17702 </para>
17703 </listitem></varlistentry>
17704 <varlistentry>
17705 <term><varname>$authentication_failed</varname></term>
17706 <listitem>
17707 <para>
17708 <indexterm role="concept">
17709 <primary>authentication</primary>
17710 <secondary>failure</secondary>
17711 </indexterm>
17712 <indexterm role="variable">
17713 <primary><varname>$authentication_failed</varname></primary>
17714 </indexterm>
17715 This variable is set to <quote>1</quote> in an Exim server if a client issues an AUTH
17716 command that does not succeed. Otherwise it is set to <quote>0</quote>. This makes it
17717 possible to distinguish between <quote>did not try to authenticate</quote>
17718 (<varname>$sender_host_authenticated</varname> is empty and <varname>$authentication_failed</varname> is set to
17719 <quote>0</quote>) and <quote>tried to authenticate but failed</quote> (<varname>$sender_host_authenticated</varname>
17720 is empty and <varname>$authentication_failed</varname> is set to <quote>1</quote>). Failure includes any
17721 negative response to an AUTH command, including (for example) an attempt to use
17722 an undefined mechanism.
17723 </para>
17724 </listitem></varlistentry>
17725 <varlistentry>
17726 <term><varname>$av_failed</varname></term>
17727 <listitem>
17728 <para>
17729 <indexterm role="concept">
17730 <primary>content scanning</primary>
17731 <secondary>AV scanner failure</secondary>
17732 </indexterm>
17733 This variable is available when Exim is compiled with the content-scanning
17734 extension. It is set to <quote>0</quote> by default, but will be set to <quote>1</quote> if any
17735 problem occurs with the virus scanner (specified by <option>av_scanner</option>) during
17736 the ACL malware condition.
17737 </para>
17738 </listitem></varlistentry>
17739 <varlistentry>
17740 <term><varname>$body_linecount</varname></term>
17741 <listitem>
17742 <para>
17743 <indexterm role="concept">
17744 <primary>message body</primary>
17745 <secondary>line count</secondary>
17746 </indexterm>
17747 <indexterm role="concept">
17748 <primary>body of message</primary>
17749 <secondary>line count</secondary>
17750 </indexterm>
17751 <indexterm role="variable">
17752 <primary><varname>$body_linecount</varname></primary>
17753 </indexterm>
17754 When a message is being received or delivered, this variable contains the
17755 number of lines in the message&#x2019;s body. See also <varname>$message_linecount</varname>.
17756 </para>
17757 </listitem></varlistentry>
17758 <varlistentry>
17759 <term><varname>$body_zerocount</varname></term>
17760 <listitem>
17761 <para>
17762 <indexterm role="concept">
17763 <primary>message body</primary>
17764 <secondary>binary zero count</secondary>
17765 </indexterm>
17766 <indexterm role="concept">
17767 <primary>body of message</primary>
17768 <secondary>binary zero count</secondary>
17769 </indexterm>
17770 <indexterm role="concept">
17771 <primary>binary zero</primary>
17772 <secondary>in message body</secondary>
17773 </indexterm>
17774 <indexterm role="variable">
17775 <primary><varname>$body_zerocount</varname></primary>
17776 </indexterm>
17777 When a message is being received or delivered, this variable contains the
17778 number of binary zero bytes (ASCII NULs) in the message&#x2019;s body.
17779 </para>
17780 </listitem></varlistentry>
17781 <varlistentry>
17782 <term><varname>$bounce_recipient</varname></term>
17783 <listitem>
17784 <para>
17785 <indexterm role="variable">
17786 <primary><varname>$bounce_recipient</varname></primary>
17787 </indexterm>
17788 This is set to the recipient address of a bounce message while Exim is creating
17789 it. It is useful if a customized bounce message text file is in use (see
17790 chapter <xref linkend="CHAPemsgcust"/>).
17791 </para>
17792 </listitem></varlistentry>
17793 <varlistentry>
17794 <term><varname>$bounce_return_size_limit</varname></term>
17795 <listitem>
17796 <para>
17797 <indexterm role="variable">
17798 <primary><varname>$bounce_return_size_limit</varname></primary>
17799 </indexterm>
17800 This contains the value set in the <option>bounce_return_size_limit</option> option, rounded
17801 up to a multiple of 1000. It is useful when a customized error message text
17802 file is in use (see chapter <xref linkend="CHAPemsgcust"/>).
17803 </para>
17804 </listitem></varlistentry>
17805 <varlistentry>
17806 <term><varname>$caller_gid</varname></term>
17807 <listitem>
17808 <para>
17809 <indexterm role="concept">
17810 <primary>gid (group id)</primary>
17811 <secondary>caller</secondary>
17812 </indexterm>
17813 <indexterm role="variable">
17814 <primary><varname>$caller_gid</varname></primary>
17815 </indexterm>
17816 The real group id under which the process that called Exim was running. This is
17817 not the same as the group id of the originator of a message (see
17818 <varname>$originator_gid</varname>). If Exim re-execs itself, this variable in the new
17819 incarnation normally contains the Exim gid.
17820 </para>
17821 </listitem></varlistentry>
17822 <varlistentry>
17823 <term><varname>$caller_uid</varname></term>
17824 <listitem>
17825 <para>
17826 <indexterm role="concept">
17827 <primary>uid (user id)</primary>
17828 <secondary>caller</secondary>
17829 </indexterm>
17830 <indexterm role="variable">
17831 <primary><varname>$caller_uid</varname></primary>
17832 </indexterm>
17833 The real user id under which the process that called Exim was running. This is
17834 not the same as the user id of the originator of a message (see
17835 <varname>$originator_uid</varname>). If Exim re-execs itself, this variable in the new
17836 incarnation normally contains the Exim uid.
17837 </para>
17838 </listitem></varlistentry>
17839 <varlistentry>
17840 <term><varname>$callout_address</varname></term>
17841 <listitem>
17842 <para>
17843 <indexterm role="variable">
17844 <primary><varname>$callout_address</varname></primary>
17845 </indexterm>
17846 After a callout for verification, spamd or malware daemon service, the
17847 address that was connected to.
17848 </para>
17849 </listitem></varlistentry>
17850 <varlistentry>
17851 <term><varname>$compile_number</varname></term>
17852 <listitem>
17853 <para>
17854 <indexterm role="variable">
17855 <primary><varname>$compile_number</varname></primary>
17856 </indexterm>
17857 The building process for Exim keeps a count of the number
17858 of times it has been compiled. This serves to distinguish different
17859 compilations of the same version of the program.
17860 </para>
17861 </listitem></varlistentry>
17862 <varlistentry>
17863 <term><varname>$config_dir</varname></term>
17864 <listitem>
17865 <para>
17866 <indexterm role="variable">
17867 <primary><varname>$config_dir</varname></primary>
17868 </indexterm>
17869 The directory name of the main configuration file. That is, the content of
17870 <varname>$config_file</varname> with the last component stripped. The value does not
17871 contain the trailing slash. If <varname>$config_file</varname> does not contain a slash,
17872 <varname>$config_dir</varname> is ".".
17873 </para>
17874 </listitem></varlistentry>
17875 <varlistentry>
17876 <term><varname>$config_file</varname></term>
17877 <listitem>
17878 <para>
17879 <indexterm role="variable">
17880 <primary><varname>$config_file</varname></primary>
17881 </indexterm>
17882 The name of the main configuration file Exim is using.
17883 </para>
17884 </listitem></varlistentry>
17885 <varlistentry>
17886 <term><varname>$dkim_verify_status</varname></term>
17887 <term>Results</term>
17888 <term>of</term>
17889 <term>DKIM</term>
17890 <term>verification.</term>
17891 <listitem>
17892 <para>
17893 For details see chapter <xref linkend="CHAPdkim"/>.
17894 </para>
17895 </listitem></varlistentry>
17896 <varlistentry>
17897 <term><varname>$dkim_cur_signer</varname></term>
17898 <term><varname>$dkim_verify_reason</varname></term>
17899 <term><varname>$dkim_domain</varname></term>
17900 <term><varname>$dkim_identity</varname></term>
17901 <term><varname>$dkim_selector</varname></term>
17902 <term><varname>$dkim_algo</varname></term>
17903 <term><varname>$dkim_canon_body</varname></term>
17904 <term><varname>$dkim_canon_headers</varname></term>
17905 <term><varname>$dkim_copiedheaders</varname></term>
17906 <term><varname>$dkim_bodylength</varname></term>
17907 <term><varname>$dkim_created</varname></term>
17908 <term><varname>$dkim_expires</varname></term>
17909 <term><varname>$dkim_headernames</varname></term>
17910 <term><varname>$dkim_key_testing</varname></term>
17911 <term><varname>$dkim_key_nosubdomains</varname></term>
17912 <term><varname>$dkim_key_srvtype</varname></term>
17913 <term><varname>$dkim_key_granularity</varname></term>
17914 <term><varname>$dkim_key_notes</varname></term>
17915 <term><varname>$dkim_key_length</varname></term>
17916 <listitem>
17917 <para>
17918 These variables are only available within the DKIM ACL.
17919 For details see chapter <xref linkend="CHAPdkim"/>.
17920 </para>
17921 </listitem></varlistentry>
17922 <varlistentry>
17923 <term><varname>$dkim_signers</varname></term>
17924 <listitem>
17925 <para>
17926 <indexterm role="variable">
17927 <primary><varname>$dkim_signers</varname></primary>
17928 </indexterm>
17929 When a message has been received this variable contains
17930 a colon-separated list of signer domains and identities for the message.
17931 For details see chapter <xref linkend="CHAPdkim"/>.
17932 </para>
17933 </listitem></varlistentry>
17934 <varlistentry>
17935 <term><varname>$dnslist_domain</varname></term>
17936 <term><varname>$dnslist_matched</varname></term>
17937 <term><varname>$dnslist_text</varname></term>
17938 <term><varname>$dnslist_value</varname></term>
17939 <listitem>
17940 <para>
17941 <indexterm role="variable">
17942 <primary><varname>$dnslist_domain</varname></primary>
17943 </indexterm>
17944 <indexterm role="variable">
17945 <primary><varname>$dnslist_matched</varname></primary>
17946 </indexterm>
17947 <indexterm role="variable">
17948 <primary><varname>$dnslist_text</varname></primary>
17949 </indexterm>
17950 <indexterm role="variable">
17951 <primary><varname>$dnslist_value</varname></primary>
17952 </indexterm>
17953 <indexterm role="concept">
17954 <primary>black list (DNS)</primary>
17955 </indexterm>
17956 When a DNS (black) list lookup succeeds, these variables are set to contain
17957 the following data from the lookup: the list&#x2019;s domain name, the key that was
17958 looked up, the contents of any associated TXT record, and the value from the
17959 main A record. See section <xref linkend="SECID204"/> for more details.
17960 </para>
17961 </listitem></varlistentry>
17962 <varlistentry>
17963 <term><varname>$domain</varname></term>
17964 <listitem>
17965 <para>
17966 <indexterm role="variable">
17967 <primary><varname>$domain</varname></primary>
17968 </indexterm>
17969 When an address is being routed, or delivered on its own, this variable
17970 contains the domain. Uppercase letters in the domain are converted into lower
17971 case for <varname>$domain</varname>.
17972 </para>
17973 <para>
17974 Global address rewriting happens when a message is received, so the value of
17975 <varname>$domain</varname> during routing and delivery is the value after rewriting. <varname>$domain</varname>
17976 is set during user filtering, but not during system filtering, because a
17977 message may have many recipients and the system filter is called just once.
17978 </para>
17979 <para>
17980 When more than one address is being delivered at once (for example, several
17981 RCPT commands in one SMTP delivery), <varname>$domain</varname> is set only if they all
17982 have the same domain. Transports can be restricted to handling only one domain
17983 at a time if the value of <varname>$domain</varname> is required at transport time &ndash; this is
17984 the default for local transports. For further details of the environment in
17985 which local transports are run, see chapter <xref linkend="CHAPenvironment"/>.
17986 </para>
17987 <para>
17988 <indexterm role="option">
17989 <primary><option>delay_warning_condition</option></primary>
17990 </indexterm>
17991 At the end of a delivery, if all deferred addresses have the same domain, it is
17992 set in <varname>$domain</varname> during the expansion of <option>delay_warning_condition</option>.
17993 </para>
17994 <para>
17995 The <varname>$domain</varname> variable is also used in some other circumstances:
17996 </para>
17997 <itemizedlist>
17998 <listitem>
17999 <para>
18000 When an ACL is running for a RCPT command, <varname>$domain</varname> contains the domain of
18001 the recipient address. The domain of the <emphasis>sender</emphasis> address is in
18002 <varname>$sender_address_domain</varname> at both MAIL time and at RCPT time. <varname>$domain</varname> is not
18003 normally set during the running of the MAIL ACL. However, if the sender address
18004 is verified with a callout during the MAIL ACL, the sender domain is placed in
18005 <varname>$domain</varname> during the expansions of <option>hosts</option>, <option>interface</option>, and <option>port</option> in
18006 the <command>smtp</command> transport.
18007 </para>
18008 </listitem>
18009 <listitem>
18010 <para>
18011 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
18012 <varname>$domain</varname> contains the domain portion of the address that is being rewritten;
18013 it can be used in the expansion of the replacement address, for example, to
18014 rewrite domains by file lookup.
18015 </para>
18016 </listitem>
18017 <listitem>
18018 <para>
18019 With one important exception, whenever a domain list is being scanned,
18020 <varname>$domain</varname> contains the subject domain. <emphasis role="bold">Exception</emphasis>: When a domain list in
18021 a <option>sender_domains</option> condition in an ACL is being processed, the subject domain
18022 is in <varname>$sender_address_domain</varname> and not in <varname>$domain</varname>. It works this way so
18023 that, in a RCPT ACL, the sender domain list can be dependent on the
18024 recipient domain (which is what is in <varname>$domain</varname> at this time).
18025 </para>
18026 </listitem>
18027 <listitem>
18028 <para>
18029 <indexterm role="concept">
18030 <primary>ETRN</primary>
18031 <secondary>value of <varname>$domain</varname></secondary>
18032 </indexterm>
18033 <indexterm role="option">
18034 <primary><option>smtp_etrn_command</option></primary>
18035 </indexterm>
18036 When the <option>smtp_etrn_command</option> option is being expanded, <varname>$domain</varname> contains
18037 the complete argument of the ETRN command (see section <xref linkend="SECTETRN"/>).
18038 </para>
18039 </listitem>
18040 </itemizedlist>
18041 </listitem></varlistentry>
18042 <varlistentry>
18043 <term><varname>$domain_data</varname></term>
18044 <listitem>
18045 <para>
18046 <indexterm role="variable">
18047 <primary><varname>$domain_data</varname></primary>
18048 </indexterm>
18049 When the <option>domains</option> option on a router matches a domain by
18050 means of a lookup, the data read by the lookup is available during the running
18051 of the router as <varname>$domain_data</varname>. In addition, if the driver routes the
18052 address to a transport, the value is available in that transport. If the
18053 transport is handling multiple addresses, the value from the first address is
18054 used.
18055 </para>
18056 <para>
18057 <varname>$domain_data</varname> is also set when the <option>domains</option> condition in an ACL matches a
18058 domain by means of a lookup. The data read by the lookup is available during
18059 the rest of the ACL statement. In all other situations, this variable expands
18060 to nothing.
18061 </para>
18062 </listitem></varlistentry>
18063 <varlistentry>
18064 <term><varname>$exim_gid</varname></term>
18065 <listitem>
18066 <para>
18067 <indexterm role="variable">
18068 <primary><varname>$exim_gid</varname></primary>
18069 </indexterm>
18070 This variable contains the numerical value of the Exim group id.
18071 </para>
18072 </listitem></varlistentry>
18073 <varlistentry>
18074 <term><varname>$exim_path</varname></term>
18075 <listitem>
18076 <para>
18077 <indexterm role="variable">
18078 <primary><varname>$exim_path</varname></primary>
18079 </indexterm>
18080 This variable contains the path to the Exim binary.
18081 </para>
18082 </listitem></varlistentry>
18083 <varlistentry>
18084 <term><varname>$exim_uid</varname></term>
18085 <listitem>
18086 <para>
18087 <indexterm role="variable">
18088 <primary><varname>$exim_uid</varname></primary>
18089 </indexterm>
18090 This variable contains the numerical value of the Exim user id.
18091 </para>
18092 </listitem></varlistentry>
18093 <varlistentry>
18094 <term><varname>$exim_version</varname></term>
18095 <listitem>
18096 <para>
18097 <indexterm role="variable">
18098 <primary><varname>$exim_version</varname></primary>
18099 </indexterm>
18100 This variable contains the version string of the Exim build.
18101 The first character is a major version number, currently 4.
18102 Then after a dot, the next group of digits is a minor version number.
18103 There may be other characters following the minor version.
18104 </para>
18105 </listitem></varlistentry>
18106 <varlistentry>
18107 <term><varname>$header_</varname>&lt;<emphasis>name</emphasis>&gt;</term>
18108 <listitem>
18109 <para>
18110 This is not strictly an expansion variable. It is expansion syntax for
18111 inserting the message header line with the given name. Note that the name must
18112 be terminated by colon or white space, because it may contain a wide variety of
18113 characters. Note also that braces must <emphasis>not</emphasis> be used.
18114 </para>
18115 </listitem></varlistentry>
18116 <varlistentry>
18117 <term><varname>$headers_added</varname></term>
18118 <listitem>
18119 <para>
18120 <indexterm role="variable">
18121 <primary><varname>$headers_added</varname></primary>
18122 </indexterm>
18123 Within an ACL this variable contains the headers added so far by
18124 the ACL modifier add_header (section <xref linkend="SECTaddheadacl"/>).
18125 The headers are a newline-separated list.
18126 </para>
18127 </listitem></varlistentry>
18128 <varlistentry>
18129 <term><varname>$home</varname></term>
18130 <listitem>
18131 <para>
18132 <indexterm role="variable">
18133 <primary><varname>$home</varname></primary>
18134 </indexterm>
18135 When the <option>check_local_user</option> option is set for a router, the user&#x2019;s home
18136 directory is placed in <varname>$home</varname> when the check succeeds. In particular, this
18137 means it is set during the running of users&#x2019; filter files. A router may also
18138 explicitly set a home directory for use by a transport; this can be overridden
18139 by a setting on the transport itself.
18140 </para>
18141 <para>
18142 When running a filter test via the <option>-bf</option> option, <varname>$home</varname> is set to the value
18143 of the environment variable HOME, which is subject to the
18144 <option>keep_environment</option> and <option>add_environment</option> main config options.
18145 </para>
18146 </listitem></varlistentry>
18147 <varlistentry>
18148 <term><varname>$host</varname></term>
18149 <listitem>
18150 <para>
18151 <indexterm role="variable">
18152 <primary><varname>$host</varname></primary>
18153 </indexterm>
18154 If a router assigns an address to a transport (any transport), and passes a
18155 list of hosts with the address, the value of <varname>$host</varname> when the transport starts
18156 to run is the name of the first host on the list. Note that this applies both
18157 to local and remote transports.
18158 </para>
18159 <para>
18160 <indexterm role="concept">
18161 <primary>transport</primary>
18162 <secondary>filter</secondary>
18163 </indexterm>
18164 <indexterm role="concept">
18165 <primary>filter</primary>
18166 <secondary>transport filter</secondary>
18167 </indexterm>
18168 For the <command>smtp</command> transport, if there is more than one host, the value of
18169 <varname>$host</varname> changes as the transport works its way through the list. In
18170 particular, when the <command>smtp</command> transport is expanding its options for encryption
18171 using TLS, or for specifying a transport filter (see chapter
18172 <xref linkend="CHAPtransportgeneric"/>), <varname>$host</varname> contains the name of the host to which it
18173 is connected.
18174 </para>
18175 <para>
18176 When used in the client part of an authenticator configuration (see chapter
18177 <xref linkend="CHAPSMTPAUTH"/>), <varname>$host</varname> contains the name of the server to which the
18178 client is connected.
18179 </para>
18180 </listitem></varlistentry>
18181 <varlistentry>
18182 <term><varname>$host_address</varname></term>
18183 <listitem>
18184 <para>
18185 <indexterm role="variable">
18186 <primary><varname>$host_address</varname></primary>
18187 </indexterm>
18188 This variable is set to the remote host&#x2019;s IP address whenever <varname>$host</varname> is set
18189 for a remote connection. It is also set to the IP address that is being checked
18190 when the <option>ignore_target_hosts</option> option is being processed.
18191 </para>
18192 </listitem></varlistentry>
18193 <varlistentry>
18194 <term><varname>$host_data</varname></term>
18195 <listitem>
18196 <para>
18197 <indexterm role="variable">
18198 <primary><varname>$host_data</varname></primary>
18199 </indexterm>
18200 If a <option>hosts</option> condition in an ACL is satisfied by means of a lookup, the
18201 result of the lookup is made available in the <varname>$host_data</varname> variable. This
18202 allows you, for example, to do things like this:
18203 </para>
18204 <literallayout class="monospaced">
18205 deny  hosts = net-lsearch;/some/file
18206 message = $host_data
18207 </literallayout>
18208 </listitem></varlistentry>
18209 <varlistentry>
18210 <term><varname>$host_lookup_deferred</varname></term>
18211 <listitem>
18212 <para>
18213 <indexterm role="concept">
18214 <primary>host name</primary>
18215 <secondary>lookup, failure of</secondary>
18216 </indexterm>
18217 <indexterm role="variable">
18218 <primary><varname>$host_lookup_deferred</varname></primary>
18219 </indexterm>
18220 This variable normally contains <quote>0</quote>, as does <varname>$host_lookup_failed</varname>. When a
18221 message comes from a remote host and there is an attempt to look up the host&#x2019;s
18222 name from its IP address, and the attempt is not successful, one of these
18223 variables is set to <quote>1</quote>.
18224 </para>
18225 <itemizedlist>
18226 <listitem>
18227 <para>
18228 If the lookup receives a definite negative response (for example, a DNS lookup
18229 succeeded, but no records were found), <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
18230 </para>
18231 </listitem>
18232 <listitem>
18233 <para>
18234 If there is any kind of problem during the lookup, such that Exim cannot
18235 tell whether or not the host name is defined (for example, a timeout for a DNS
18236 lookup), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>.
18237 </para>
18238 </listitem>
18239 </itemizedlist>
18240 <para>
18241 Looking up a host&#x2019;s name from its IP address consists of more than just a
18242 single reverse lookup. Exim checks that a forward lookup of at least one of the
18243 names it receives from a reverse lookup yields the original IP address. If this
18244 is not the case, Exim does not accept the looked up name(s), and
18245 <varname>$host_lookup_failed</varname> is set to <quote>1</quote>. Thus, being able to find a name from an
18246 IP address (for example, the existence of a PTR record in the DNS) is not
18247 sufficient on its own for the success of a host name lookup. If the reverse
18248 lookup succeeds, but there is a lookup problem such as a timeout when checking
18249 the result, the name is not accepted, and <varname>$host_lookup_deferred</varname> is set to
18250 <quote>1</quote>. See also <varname>$sender_host_name</varname>.
18251 </para>
18252 </listitem></varlistentry>
18253 <varlistentry>
18254 <term><varname>$host_lookup_failed</varname></term>
18255 <listitem>
18256 <para>
18257 <indexterm role="variable">
18258 <primary><varname>$host_lookup_failed</varname></primary>
18259 </indexterm>
18260 See <varname>$host_lookup_deferred</varname>.
18261 </para>
18262 </listitem></varlistentry>
18263 <varlistentry>
18264 <term><varname>$host_port</varname></term>
18265 <listitem>
18266 <para>
18267 <indexterm role="variable">
18268 <primary><varname>$host_port</varname></primary>
18269 </indexterm>
18270 This variable is set to the remote host&#x2019;s TCP port whenever <varname>$host</varname> is set
18271 for an outbound connection.
18272 </para>
18273 </listitem></varlistentry>
18274 <varlistentry>
18275 <term><varname>$initial_cwd</varname></term>
18276 <listitem>
18277 <para>
18278 <indexterm role="variable">
18279 <primary><varname>$initial_cwd</varname></primary>
18280 </indexterm>
18281 This variable contains the full path name of the initial working
18282 directory of the current Exim process. This may differ from the current
18283 working directory, as Exim changes this to "/" during early startup, and
18284 to <varname>$spool_directory</varname> later.
18285 </para>
18286 </listitem></varlistentry>
18287 <varlistentry>
18288 <term><varname>$inode</varname></term>
18289 <listitem>
18290 <para>
18291 <indexterm role="variable">
18292 <primary><varname>$inode</varname></primary>
18293 </indexterm>
18294 The only time this variable is set is while expanding the <option>directory_file</option>
18295 option in the <command>appendfile</command> transport. The variable contains the inode number
18296 of the temporary file which is about to be renamed. It can be used to construct
18297 a unique name for the file.
18298 </para>
18299 </listitem></varlistentry>
18300 <varlistentry>
18301 <term><varname>$interface_address</varname></term>
18302 <listitem>
18303 <para>
18304 <indexterm role="variable">
18305 <primary><varname>$interface_address</varname></primary>
18306 </indexterm>
18307 This is an obsolete name for <varname>$received_ip_address</varname>.
18308 </para>
18309 </listitem></varlistentry>
18310 <varlistentry>
18311 <term><varname>$interface_port</varname></term>
18312 <listitem>
18313 <para>
18314 <indexterm role="variable">
18315 <primary><varname>$interface_port</varname></primary>
18316 </indexterm>
18317 This is an obsolete name for <varname>$received_port</varname>.
18318 </para>
18319 </listitem></varlistentry>
18320 <varlistentry>
18321 <term><varname>$item</varname></term>
18322 <listitem>
18323 <para>
18324 <indexterm role="variable">
18325 <primary><varname>$item</varname></primary>
18326 </indexterm>
18327 This variable is used during the expansion of <emphasis role="bold">forall</emphasis> and <emphasis role="bold">forany</emphasis>
18328 conditions (see section <xref linkend="SECTexpcond"/>), and <emphasis role="bold">filter</emphasis>, <emphasis role="bold">map</emphasis>, and
18329 <emphasis role="bold">reduce</emphasis> items (see section <xref linkend="SECTexpcond"/>). In other circumstances, it is
18330 empty.
18331 </para>
18332 </listitem></varlistentry>
18333 <varlistentry>
18334 <term><varname>$ldap_dn</varname></term>
18335 <listitem>
18336 <para>
18337 <indexterm role="variable">
18338 <primary><varname>$ldap_dn</varname></primary>
18339 </indexterm>
18340 This variable, which is available only when Exim is compiled with LDAP support,
18341 contains the DN from the last entry in the most recently successful LDAP
18342 lookup.
18343 </para>
18344 </listitem></varlistentry>
18345 <varlistentry>
18346 <term><varname>$load_average</varname></term>
18347 <listitem>
18348 <para>
18349 <indexterm role="variable">
18350 <primary><varname>$load_average</varname></primary>
18351 </indexterm>
18352 This variable contains the system load average, multiplied by 1000 so that it
18353 is an integer. For example, if the load average is 0.21, the value of the
18354 variable is 210. The value is recomputed every time the variable is referenced.
18355 </para>
18356 </listitem></varlistentry>
18357 <varlistentry>
18358 <term><varname>$local_part</varname></term>
18359 <listitem>
18360 <para>
18361 <indexterm role="variable">
18362 <primary><varname>$local_part</varname></primary>
18363 </indexterm>
18364 When an address is being routed, or delivered on its own, this
18365 variable contains the local part. When a number of addresses are being
18366 delivered together (for example, multiple RCPT commands in an SMTP
18367 session), <varname>$local_part</varname> is not set.
18368 </para>
18369 <para>
18370 Global address rewriting happens when a message is received, so the value of
18371 <varname>$local_part</varname> during routing and delivery is the value after rewriting.
18372 <varname>$local_part</varname> is set during user filtering, but not during system filtering,
18373 because a message may have many recipients and the system filter is called just
18374 once.
18375 </para>
18376 <para>
18377 <indexterm role="variable">
18378 <primary><varname>$local_part_prefix</varname></primary>
18379 </indexterm>
18380 <indexterm role="variable">
18381 <primary><varname>$local_part_suffix</varname></primary>
18382 </indexterm>
18383 If a local part prefix or suffix has been recognized, it is not included in the
18384 value of <varname>$local_part</varname> during routing and subsequent delivery. The values of
18385 any prefix or suffix are in <varname>$local_part_prefix</varname> and
18386 <varname>$local_part_suffix</varname>, respectively.
18387 </para>
18388 <para>
18389 When a message is being delivered to a file, pipe, or autoreply transport as a
18390 result of aliasing or forwarding, <varname>$local_part</varname> is set to the local part of
18391 the parent address, not to the file name or command (see <varname>$address_file</varname> and
18392 <varname>$address_pipe</varname>).
18393 </para>
18394 <para>
18395 When an ACL is running for a RCPT command, <varname>$local_part</varname> contains the
18396 local part of the recipient address.
18397 </para>
18398 <para>
18399 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
18400 <varname>$local_part</varname> contains the local part of the address that is being rewritten;
18401 it can be used in the expansion of the replacement address, for example.
18402 </para>
18403 <para>
18404 In all cases, all quoting is removed from the local part. For example, for both
18405 the addresses
18406 </para>
18407 <literallayout class="monospaced">
18408 "abc:xyz"@test.example
18409 abc\:xyz@test.example
18410 </literallayout>
18411 <para>
18412 the value of <varname>$local_part</varname> is
18413 </para>
18414 <literallayout class="monospaced">
18415 abc:xyz
18416 </literallayout>
18417 <para>
18418 If you use <varname>$local_part</varname> to create another address, you should always wrap it
18419 inside a quoting operator. For example, in a <command>redirect</command> router you could
18420 have:
18421 </para>
18422 <literallayout class="monospaced">
18423 data = ${quote_local_part:$local_part}@new.domain.example
18424 </literallayout>
18425 <para>
18426 <emphasis role="bold">Note</emphasis>: The value of <varname>$local_part</varname> is normally lower cased. If you want
18427 to process local parts in a case-dependent manner in a router, you can set the
18428 <option>caseful_local_part</option> option (see chapter <xref linkend="CHAProutergeneric"/>).
18429 </para>
18430 </listitem></varlistentry>
18431 <varlistentry>
18432 <term><varname>$local_part_data</varname></term>
18433 <listitem>
18434 <para>
18435 <indexterm role="variable">
18436 <primary><varname>$local_part_data</varname></primary>
18437 </indexterm>
18438 When the <option>local_parts</option> option on a router matches a local part by means of a
18439 lookup, the data read by the lookup is available during the running of the
18440 router as <varname>$local_part_data</varname>. In addition, if the driver routes the address
18441 to a transport, the value is available in that transport. If the transport is
18442 handling multiple addresses, the value from the first address is used.
18443 </para>
18444 <para>
18445 <varname>$local_part_data</varname> is also set when the <option>local_parts</option> condition in an ACL
18446 matches a local part by means of a lookup. The data read by the lookup is
18447 available during the rest of the ACL statement. In all other situations, this
18448 variable expands to nothing.
18449 </para>
18450 </listitem></varlistentry>
18451 <varlistentry>
18452 <term><varname>$local_part_prefix</varname></term>
18453 <listitem>
18454 <para>
18455 <indexterm role="variable">
18456 <primary><varname>$local_part_prefix</varname></primary>
18457 </indexterm>
18458 When an address is being routed or delivered, and a
18459 specific prefix for the local part was recognized, it is available in this
18460 variable, having been removed from <varname>$local_part</varname>.
18461 </para>
18462 </listitem></varlistentry>
18463 <varlistentry>
18464 <term><varname>$local_part_suffix</varname></term>
18465 <listitem>
18466 <para>
18467 <indexterm role="variable">
18468 <primary><varname>$local_part_suffix</varname></primary>
18469 </indexterm>
18470 When an address is being routed or delivered, and a
18471 specific suffix for the local part was recognized, it is available in this
18472 variable, having been removed from <varname>$local_part</varname>.
18473 </para>
18474 </listitem></varlistentry>
18475 <varlistentry>
18476 <term><varname>$local_scan_data</varname></term>
18477 <listitem>
18478 <para>
18479 <indexterm role="variable">
18480 <primary><varname>$local_scan_data</varname></primary>
18481 </indexterm>
18482 This variable contains the text returned by the <function>local_scan()</function> function when
18483 a message is received. See chapter <xref linkend="CHAPlocalscan"/> for more details.
18484 </para>
18485 </listitem></varlistentry>
18486 <varlistentry>
18487 <term><varname>$local_user_gid</varname></term>
18488 <listitem>
18489 <para>
18490 <indexterm role="variable">
18491 <primary><varname>$local_user_gid</varname></primary>
18492 </indexterm>
18493 See <varname>$local_user_uid</varname>.
18494 </para>
18495 </listitem></varlistentry>
18496 <varlistentry>
18497 <term><varname>$local_user_uid</varname></term>
18498 <listitem>
18499 <para>
18500 <indexterm role="variable">
18501 <primary><varname>$local_user_uid</varname></primary>
18502 </indexterm>
18503 This variable and <varname>$local_user_gid</varname> are set to the uid and gid after the
18504 <option>check_local_user</option> router precondition succeeds. This means that their values
18505 are available for the remaining preconditions (<option>senders</option>, <option>require_files</option>,
18506 and <option>condition</option>), for the <option>address_data</option> expansion, and for any
18507 router-specific expansions. At all other times, the values in these variables
18508 are <literal>(uid_t)(-1)</literal> and <literal>(gid_t)(-1)</literal>, respectively.
18509 </para>
18510 </listitem></varlistentry>
18511 <varlistentry>
18512 <term><varname>$localhost_number</varname></term>
18513 <listitem>
18514 <para>
18515 <indexterm role="variable">
18516 <primary><varname>$localhost_number</varname></primary>
18517 </indexterm>
18518 This contains the expanded value of the
18519 <option>localhost_number</option> option. The expansion happens after the main options have
18520 been read.
18521 </para>
18522 </listitem></varlistentry>
18523 <varlistentry>
18524 <term><varname>$log_inodes</varname></term>
18525 <listitem>
18526 <para>
18527 <indexterm role="variable">
18528 <primary><varname>$log_inodes</varname></primary>
18529 </indexterm>
18530 The number of free inodes in the disk partition where Exim&#x2019;s
18531 log files are being written. The value is recalculated whenever the variable is
18532 referenced. If the relevant file system does not have the concept of inodes,
18533 the value of is -1. See also the <option>check_log_inodes</option> option.
18534 </para>
18535 </listitem></varlistentry>
18536 <varlistentry>
18537 <term><varname>$log_space</varname></term>
18538 <listitem>
18539 <para>
18540 <indexterm role="variable">
18541 <primary><varname>$log_space</varname></primary>
18542 </indexterm>
18543 The amount of free space (as a number of kilobytes) in the disk
18544 partition where Exim&#x2019;s log files are being written. The value is recalculated
18545 whenever the variable is referenced. If the operating system does not have the
18546 ability to find the amount of free space (only true for experimental systems),
18547 the space value is -1. See also the <option>check_log_space</option> option.
18548 </para>
18549 </listitem></varlistentry>
18550 <varlistentry>
18551 <term><varname>$lookup_dnssec_authenticated</varname></term>
18552 <listitem>
18553 <para>
18554 <indexterm role="variable">
18555 <primary><varname>$lookup_dnssec_authenticated</varname></primary>
18556 </indexterm>
18557 This variable is set after a DNS lookup done by
18558 a dnsdb lookup expansion, dnslookup router or smtp transport.
18559 <indexterm role="concept">
18560 <primary>DNS</primary>
18561 <secondary>DNSSEC</secondary>
18562 </indexterm>
18563 It will be empty if <command>DNSSEC</command> was not requested,
18564 <quote>no</quote> if the result was not labelled as authenticated data
18565 and <quote>yes</quote> if it was.
18566 Results that are labelled as authoritative answer that match
18567 the <option>dns_trust_aa</option> configuration variable count also
18568 as authenticated data.
18569 </para>
18570 </listitem></varlistentry>
18571 <varlistentry>
18572 <term><varname>$mailstore_basename</varname></term>
18573 <listitem>
18574 <para>
18575 <indexterm role="variable">
18576 <primary><varname>$mailstore_basename</varname></primary>
18577 </indexterm>
18578 This variable is set only when doing deliveries in <quote>mailstore</quote> format in the
18579 <command>appendfile</command> transport. During the expansion of the <option>mailstore_prefix</option>,
18580 <option>mailstore_suffix</option>, <option>message_prefix</option>, and <option>message_suffix</option> options, it
18581 contains the basename of the files that are being written, that is, the name
18582 without the <quote>.tmp</quote>, <quote>.env</quote>, or <quote>.msg</quote> suffix. At all other times, this
18583 variable is empty.
18584 </para>
18585 </listitem></varlistentry>
18586 <varlistentry>
18587 <term><varname>$malware_name</varname></term>
18588 <listitem>
18589 <para>
18590 <indexterm role="variable">
18591 <primary><varname>$malware_name</varname></primary>
18592 </indexterm>
18593 This variable is available when Exim is compiled with the
18594 content-scanning extension. It is set to the name of the virus that was found
18595 when the ACL <option>malware</option> condition is true (see section <xref linkend="SECTscanvirus"/>).
18596 </para>
18597 </listitem></varlistentry>
18598 <varlistentry>
18599 <term><varname>$max_received_linelength</varname></term>
18600 <listitem>
18601 <para>
18602 <indexterm role="variable">
18603 <primary><varname>$max_received_linelength</varname></primary>
18604 </indexterm>
18605 <indexterm role="concept">
18606 <primary>maximum</primary>
18607 <secondary>line length</secondary>
18608 </indexterm>
18609 <indexterm role="concept">
18610 <primary>line length</primary>
18611 <secondary>maximum</secondary>
18612 </indexterm>
18613 This variable contains the number of bytes in the longest line that was
18614 received as part of the message, not counting the line termination
18615 character(s).
18616 </para>
18617 <para revisionflag="changed">
18618 It is not valid if the <option>spool_files_wireformat</option> option is used.
18619 </para>
18620 </listitem></varlistentry>
18621 <varlistentry>
18622 <term><varname>$message_age</varname></term>
18623 <listitem>
18624 <para>
18625 <indexterm role="concept">
18626 <primary>message</primary>
18627 <secondary>age of</secondary>
18628 </indexterm>
18629 <indexterm role="variable">
18630 <primary><varname>$message_age</varname></primary>
18631 </indexterm>
18632 This variable is set at the start of a delivery attempt to contain the number
18633 of seconds since the message was received. It does not change during a single
18634 delivery attempt.
18635 </para>
18636 </listitem></varlistentry>
18637 <varlistentry>
18638 <term><varname>$message_body</varname></term>
18639 <listitem>
18640 <para>
18641 <indexterm role="concept">
18642 <primary>body of message</primary>
18643 <secondary>expansion variable</secondary>
18644 </indexterm>
18645 <indexterm role="concept">
18646 <primary>message body</primary>
18647 <secondary>in expansion</secondary>
18648 </indexterm>
18649 <indexterm role="concept">
18650 <primary>binary zero</primary>
18651 <secondary>in message body</secondary>
18652 </indexterm>
18653 <indexterm role="variable">
18654 <primary><varname>$message_body</varname></primary>
18655 </indexterm>
18656 <indexterm role="option">
18657 <primary><option>message_body_visible</option></primary>
18658 </indexterm>
18659 This variable contains the initial portion of a message&#x2019;s body while it is
18660 being delivered, and is intended mainly for use in filter files. The maximum
18661 number of characters of the body that are put into the variable is set by the
18662 <option>message_body_visible</option> configuration option; the default is 500.
18663 </para>
18664 <para>
18665 <indexterm role="option">
18666 <primary><option>message_body_newlines</option></primary>
18667 </indexterm>
18668 By default, newlines are converted into spaces in <varname>$message_body</varname>, to make it
18669 easier to search for phrases that might be split over a line break. However,
18670 this can be disabled by setting <option>message_body_newlines</option> to be true. Binary
18671 zeros are always converted into spaces.
18672 </para>
18673 </listitem></varlistentry>
18674 <varlistentry>
18675 <term><varname>$message_body_end</varname></term>
18676 <listitem>
18677 <para>
18678 <indexterm role="concept">
18679 <primary>body of message</primary>
18680 <secondary>expansion variable</secondary>
18681 </indexterm>
18682 <indexterm role="concept">
18683 <primary>message body</primary>
18684 <secondary>in expansion</secondary>
18685 </indexterm>
18686 <indexterm role="variable">
18687 <primary><varname>$message_body_end</varname></primary>
18688 </indexterm>
18689 This variable contains the final portion of a message&#x2019;s
18690 body while it is being delivered. The format and maximum size are as for
18691 <varname>$message_body</varname>.
18692 </para>
18693 </listitem></varlistentry>
18694 <varlistentry>
18695 <term><varname>$message_body_size</varname></term>
18696 <listitem>
18697 <para>
18698 <indexterm role="concept">
18699 <primary>body of message</primary>
18700 <secondary>size</secondary>
18701 </indexterm>
18702 <indexterm role="concept">
18703 <primary>message body</primary>
18704 <secondary>size</secondary>
18705 </indexterm>
18706 <indexterm role="variable">
18707 <primary><varname>$message_body_size</varname></primary>
18708 </indexterm>
18709 When a message is being delivered, this variable contains the size of the body
18710 in bytes. The count starts from the character after the blank line that
18711 separates the body from the header. Newlines are included in the count. See
18712 also <varname>$message_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
18713 </para>
18714 <para revisionflag="changed">
18715 If the spool file is wireformat
18716 (see the <option>spool_files_wireformat</option> main option)
18717 the CRLF line-terminators are included in the count.
18718 </para>
18719 </listitem></varlistentry>
18720 <varlistentry>
18721 <term><varname>$message_exim_id</varname></term>
18722 <listitem>
18723 <para>
18724 <indexterm role="variable">
18725 <primary><varname>$message_exim_id</varname></primary>
18726 </indexterm>
18727 When a message is being received or delivered, this variable contains the
18728 unique message id that is generated and used by Exim to identify the message.
18729 An id is not created for a message until after its header has been successfully
18730 received. <emphasis role="bold">Note</emphasis>: This is <emphasis>not</emphasis> the contents of the <emphasis>Message-ID:</emphasis> header
18731 line; it is the local id that Exim assigns to the message, for example:
18732 <literal>1BXTIK-0001yO-VA</literal>.
18733 </para>
18734 </listitem></varlistentry>
18735 <varlistentry>
18736 <term><varname>$message_headers</varname></term>
18737 <listitem>
18738 <para>
18739 <indexterm role="variable">
18740 <primary><varname>$message_headers</varname></primary>
18741 </indexterm>
18742 This variable contains a concatenation of all the header lines when a message
18743 is being processed, except for lines added by routers or transports. The header
18744 lines are separated by newline characters. Their contents are decoded in the
18745 same way as a header line that is inserted by <option>bheader</option>.
18746 </para>
18747 </listitem></varlistentry>
18748 <varlistentry>
18749 <term><varname>$message_headers_raw</varname></term>
18750 <listitem>
18751 <para>
18752 <indexterm role="variable">
18753 <primary><varname>$message_headers_raw</varname></primary>
18754 </indexterm>
18755 This variable is like <varname>$message_headers</varname> except that no processing of the
18756 contents of header lines is done.
18757 </para>
18758 </listitem></varlistentry>
18759 <varlistentry>
18760 <term><varname>$message_id</varname></term>
18761 <listitem>
18762 <para>
18763 This is an old name for <varname>$message_exim_id</varname>. It is now deprecated.
18764 </para>
18765 </listitem></varlistentry>
18766 <varlistentry>
18767 <term><varname>$message_linecount</varname></term>
18768 <listitem>
18769 <para>
18770 <indexterm role="variable">
18771 <primary><varname>$message_linecount</varname></primary>
18772 </indexterm>
18773 This variable contains the total number of lines in the header and body of the
18774 message. Compare <varname>$body_linecount</varname>, which is the count for the body only.
18775 During the DATA and content-scanning ACLs, <varname>$message_linecount</varname> contains the
18776 number of lines received. Before delivery happens (that is, before filters,
18777 routers, and transports run) the count is increased to include the
18778 <emphasis>Received:</emphasis> header line that Exim standardly adds, and also any other header
18779 lines that are added by ACLs. The blank line that separates the message header
18780 from the body is not counted.
18781 </para>
18782 <para>
18783 As with the special case of <varname>$message_size</varname>, during the expansion of the
18784 appendfile transport&#x2019;s maildir_tag option in maildir format, the value of
18785 <varname>$message_linecount</varname> is the precise size of the number of newlines in the
18786 file that has been written (minus one for the blank line between the
18787 header and the body).
18788 </para>
18789 <para>
18790 Here is an example of the use of this variable in a DATA ACL:
18791 </para>
18792 <literallayout class="monospaced">
18793 deny message   = Too many lines in message header
18794      condition = \
18795       ${if &lt;{250}{${eval:$message_linecount - $body_linecount}}}
18796 </literallayout>
18797 <para>
18798 In the MAIL and RCPT ACLs, the value is zero because at that stage the
18799 message has not yet been received.
18800 </para>
18801 <para revisionflag="changed">
18802 This variable is not valid if the <option>spool_files_wireformat</option> option is used.
18803 </para>
18804 </listitem></varlistentry>
18805 <varlistentry>
18806 <term><varname>$message_size</varname></term>
18807 <listitem>
18808 <para>
18809 <indexterm role="concept">
18810 <primary>size</primary>
18811 <secondary>of message</secondary>
18812 </indexterm>
18813 <indexterm role="concept">
18814 <primary>message</primary>
18815 <secondary>size</secondary>
18816 </indexterm>
18817 <indexterm role="variable">
18818 <primary><varname>$message_size</varname></primary>
18819 </indexterm>
18820 When a message is being processed, this variable contains its size in bytes. In
18821 most cases, the size includes those headers that were received with the
18822 message, but not those (such as <emphasis>Envelope-to:</emphasis>) that are added to individual
18823 deliveries as they are written. However, there is one special case: during the
18824 expansion of the <option>maildir_tag</option> option in the <command>appendfile</command> transport while
18825 doing a delivery in maildir format, the value of <varname>$message_size</varname> is the
18826 precise size of the file that has been written. See also
18827 <varname>$message_body_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
18828 </para>
18829 <para>
18830 <indexterm role="concept">
18831 <primary>RCPT</primary>
18832 <secondary>value of <varname>$message_size</varname></secondary>
18833 </indexterm>
18834 While running a per message ACL (mail/rcpt/predata), <varname>$message_size</varname>
18835 contains the size supplied on the MAIL command, or -1 if no size was given. The
18836 value may not, of course, be truthful.
18837 </para>
18838 </listitem></varlistentry>
18839 <varlistentry>
18840 <term><varname>$mime_</varname><emphasis>xxx</emphasis></term>
18841 <listitem>
18842 <para>
18843 A number of variables whose names start with <varname>$mime</varname> are
18844 available when Exim is compiled with the content-scanning extension. For
18845 details, see section <xref linkend="SECTscanmimepart"/>.
18846 </para>
18847 </listitem></varlistentry>
18848 <varlistentry>
18849 <term><varname>$n0</varname> &ndash; <varname>$n9</varname></term>
18850 <listitem>
18851 <para>
18852 These variables are counters that can be incremented by means
18853 of the <option>add</option> command in filter files.
18854 </para>
18855 </listitem></varlistentry>
18856 <varlistentry>
18857 <term><varname>$original_domain</varname></term>
18858 <listitem>
18859 <para>
18860 <indexterm role="variable">
18861 <primary><varname>$domain</varname></primary>
18862 </indexterm>
18863 <indexterm role="variable">
18864 <primary><varname>$original_domain</varname></primary>
18865 </indexterm>
18866 When a top-level address is being processed for delivery, this contains the
18867 same value as <varname>$domain</varname>. However, if a <quote>child</quote> address (for example,
18868 generated by an alias, forward, or filter file) is being processed, this
18869 variable contains the domain of the original address (lower cased). This
18870 differs from <varname>$parent_domain</varname> only when there is more than one level of
18871 aliasing or forwarding. When more than one address is being delivered in a
18872 single transport run, <varname>$original_domain</varname> is not set.
18873 </para>
18874 <para>
18875 If a new address is created by means of a <option>deliver</option> command in a system
18876 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
18877 part <emphasis>system-filter</emphasis> and the default qualify domain.
18878 </para>
18879 </listitem></varlistentry>
18880 <varlistentry>
18881 <term><varname>$original_local_part</varname></term>
18882 <listitem>
18883 <para>
18884 <indexterm role="variable">
18885 <primary><varname>$local_part</varname></primary>
18886 </indexterm>
18887 <indexterm role="variable">
18888 <primary><varname>$original_local_part</varname></primary>
18889 </indexterm>
18890 When a top-level address is being processed for delivery, this contains the
18891 same value as <varname>$local_part</varname>, unless a prefix or suffix was removed from the
18892 local part, because <varname>$original_local_part</varname> always contains the full local
18893 part. When a <quote>child</quote> address (for example, generated by an alias, forward, or
18894 filter file) is being processed, this variable contains the full local part of
18895 the original address.
18896 </para>
18897 <para>
18898 If the router that did the redirection processed the local part
18899 case-insensitively, the value in <varname>$original_local_part</varname> is in lower case.
18900 This variable differs from <varname>$parent_local_part</varname> only when there is more than
18901 one level of aliasing or forwarding. When more than one address is being
18902 delivered in a single transport run, <varname>$original_local_part</varname> is not set.
18903 </para>
18904 <para>
18905 If a new address is created by means of a <option>deliver</option> command in a system
18906 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
18907 part <emphasis>system-filter</emphasis> and the default qualify domain.
18908 </para>
18909 </listitem></varlistentry>
18910 <varlistentry>
18911 <term><varname>$originator_gid</varname></term>
18912 <listitem>
18913 <para>
18914 <indexterm role="concept">
18915 <primary>gid (group id)</primary>
18916 <secondary>of originating user</secondary>
18917 </indexterm>
18918 <indexterm role="concept">
18919 <primary>sender</primary>
18920 <secondary>gid</secondary>
18921 </indexterm>
18922 <indexterm role="variable">
18923 <primary><varname>$caller_gid</varname></primary>
18924 </indexterm>
18925 <indexterm role="variable">
18926 <primary><varname>$originator_gid</varname></primary>
18927 </indexterm>
18928 This variable contains the value of <varname>$caller_gid</varname> that was set when the
18929 message was received. For messages received via the command line, this is the
18930 gid of the sending user. For messages received by SMTP over TCP/IP, this is
18931 normally the gid of the Exim user.
18932 </para>
18933 </listitem></varlistentry>
18934 <varlistentry>
18935 <term><varname>$originator_uid</varname></term>
18936 <listitem>
18937 <para>
18938 <indexterm role="concept">
18939 <primary>uid (user id)</primary>
18940 <secondary>of originating user</secondary>
18941 </indexterm>
18942 <indexterm role="concept">
18943 <primary>sender</primary>
18944 <secondary>uid</secondary>
18945 </indexterm>
18946 <indexterm role="variable">
18947 <primary><varname>$caller_uid</varname></primary>
18948 </indexterm>
18949 <indexterm role="variable">
18950 <primary><varname>$originator_uid</varname></primary>
18951 </indexterm>
18952 The value of <varname>$caller_uid</varname> that was set when the message was received. For
18953 messages received via the command line, this is the uid of the sending user.
18954 For messages received by SMTP over TCP/IP, this is normally the uid of the Exim
18955 user.
18956 </para>
18957 </listitem></varlistentry>
18958 <varlistentry>
18959 <term><varname>$parent_domain</varname></term>
18960 <listitem>
18961 <para>
18962 <indexterm role="variable">
18963 <primary><varname>$parent_domain</varname></primary>
18964 </indexterm>
18965 This variable is similar to <varname>$original_domain</varname> (see
18966 above), except that it refers to the immediately preceding parent address.
18967 </para>
18968 </listitem></varlistentry>
18969 <varlistentry>
18970 <term><varname>$parent_local_part</varname></term>
18971 <listitem>
18972 <para>
18973 <indexterm role="variable">
18974 <primary><varname>$parent_local_part</varname></primary>
18975 </indexterm>
18976 This variable is similar to <varname>$original_local_part</varname>
18977 (see above), except that it refers to the immediately preceding parent address.
18978 </para>
18979 </listitem></varlistentry>
18980 <varlistentry>
18981 <term><varname>$pid</varname></term>
18982 <listitem>
18983 <para>
18984 <indexterm role="concept">
18985 <primary>pid (process id)</primary>
18986 <secondary>of current process</secondary>
18987 </indexterm>
18988 <indexterm role="variable">
18989 <primary><varname>$pid</varname></primary>
18990 </indexterm>
18991 This variable contains the current process id.
18992 </para>
18993 </listitem></varlistentry>
18994 <varlistentry>
18995 <term><varname>$pipe_addresses</varname></term>
18996 <listitem>
18997 <para>
18998 <indexterm role="concept">
18999 <primary>filter</primary>
19000 <secondary>transport filter</secondary>
19001 </indexterm>
19002 <indexterm role="concept">
19003 <primary>transport</primary>
19004 <secondary>filter</secondary>
19005 </indexterm>
19006 <indexterm role="variable">
19007 <primary><varname>$pipe_addresses</varname></primary>
19008 </indexterm>
19009 This is not an expansion variable, but is mentioned here because the string
19010 <literal>$pipe_addresses</literal> is handled specially in the command specification for the
19011 <command>pipe</command> transport (chapter <xref linkend="CHAPpipetransport"/>) and in transport filters
19012 (described under <option>transport_filter</option> in chapter <xref linkend="CHAPtransportgeneric"/>).
19013 It cannot be used in general expansion strings, and provokes an <quote>unknown
19014 variable</quote> error if encountered.
19015 </para>
19016 </listitem></varlistentry>
19017 <varlistentry>
19018 <term><varname>$primary_hostname</varname></term>
19019 <listitem>
19020 <para>
19021 <indexterm role="variable">
19022 <primary><varname>$primary_hostname</varname></primary>
19023 </indexterm>
19024 This variable contains the value set by <option>primary_hostname</option> in the
19025 configuration file, or read by the <function>uname()</function> function. If <function>uname()</function> returns
19026 a single-component name, Exim calls <function>gethostbyname()</function> (or
19027 <function>getipnodebyname()</function> where available) in an attempt to acquire a fully
19028 qualified host name. See also <varname>$smtp_active_hostname</varname>.
19029 </para>
19030 </listitem></varlistentry>
19031 <varlistentry>
19032 <term><varname>$proxy_external_address</varname></term>
19033 <term><varname>$proxy_external_port</varname></term>
19034 <term><varname>$proxy_local_address</varname></term>
19035 <term><varname>$proxy_local_port</varname></term>
19036 <term><varname>$proxy_session</varname></term>
19037 <listitem>
19038 <para>
19039 These variables are only available when built with Proxy Protocol
19040 or SOCKS5 support.
19041 For details see chapter <xref linkend="SECTproxyInbound"/>.
19042 </para>
19043 </listitem></varlistentry>
19044 <varlistentry>
19045 <term><varname>$prdr_requested</varname></term>
19046 <listitem>
19047 <para>
19048 <indexterm role="concept">
19049 <primary>PRDR</primary>
19050 <secondary>variable for</secondary>
19051 </indexterm>
19052 This variable is set to <quote>yes</quote> if PRDR was requested by the client for the
19053 current message, otherwise <quote>no</quote>.
19054 </para>
19055 </listitem></varlistentry>
19056 <varlistentry>
19057 <term><varname>$prvscheck_address</varname></term>
19058 <listitem>
19059 <para>
19060 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
19061 which is described in sections <xref linkend="SECTexpansionitems"/> and
19062 <xref linkend="SECTverifyPRVS"/>.
19063 </para>
19064 </listitem></varlistentry>
19065 <varlistentry>
19066 <term><varname>$prvscheck_keynum</varname></term>
19067 <listitem>
19068 <para>
19069 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
19070 which is described in sections <xref linkend="SECTexpansionitems"/> and
19071 <xref linkend="SECTverifyPRVS"/>.
19072 </para>
19073 </listitem></varlistentry>
19074 <varlistentry>
19075 <term><varname>$prvscheck_result</varname></term>
19076 <listitem>
19077 <para>
19078 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
19079 which is described in sections <xref linkend="SECTexpansionitems"/> and
19080 <xref linkend="SECTverifyPRVS"/>.
19081 </para>
19082 </listitem></varlistentry>
19083 <varlistentry>
19084 <term><varname>$qualify_domain</varname></term>
19085 <listitem>
19086 <para>
19087 <indexterm role="variable">
19088 <primary><varname>$qualify_domain</varname></primary>
19089 </indexterm>
19090 The value set for the <option>qualify_domain</option> option in the configuration file.
19091 </para>
19092 </listitem></varlistentry>
19093 <varlistentry>
19094 <term><varname>$qualify_recipient</varname></term>
19095 <listitem>
19096 <para>
19097 <indexterm role="variable">
19098 <primary><varname>$qualify_recipient</varname></primary>
19099 </indexterm>
19100 The value set for the <option>qualify_recipient</option> option in the configuration file,
19101 or if not set, the value of <varname>$qualify_domain</varname>.
19102 </para>
19103 </listitem></varlistentry>
19104 <varlistentry>
19105 <term><varname>$queue_name</varname></term>
19106 <listitem>
19107 <para>
19108 <indexterm role="variable">
19109 <primary><varname>$queue_name</varname></primary>
19110 </indexterm>
19111 <indexterm role="concept">
19112 <primary>named queues</primary>
19113 </indexterm>
19114 <indexterm role="concept">
19115 <primary>queues</primary>
19116 <secondary>named</secondary>
19117 </indexterm>
19118 The name of the spool queue in use; empty for the default queue.
19119 </para>
19120 </listitem></varlistentry>
19121 <varlistentry>
19122 <term><varname>$rcpt_count</varname></term>
19123 <listitem>
19124 <para>
19125 <indexterm role="variable">
19126 <primary><varname>$rcpt_count</varname></primary>
19127 </indexterm>
19128 When a message is being received by SMTP, this variable contains the number of
19129 RCPT commands received for the current message. If this variable is used in a
19130 RCPT ACL, its value includes the current command.
19131 </para>
19132 </listitem></varlistentry>
19133 <varlistentry>
19134 <term><varname>$rcpt_defer_count</varname></term>
19135 <listitem>
19136 <para>
19137 <indexterm role="variable">
19138 <primary><varname>$rcpt_defer_count</varname></primary>
19139 </indexterm>
19140 <indexterm role="concept">
19141 <primary>4<emphasis>xx</emphasis> responses</primary>
19142 <secondary>count of</secondary>
19143 </indexterm>
19144 When a message is being received by SMTP, this variable contains the number of
19145 RCPT commands in the current message that have previously been rejected with a
19146 temporary (4<emphasis>xx</emphasis>) response.
19147 </para>
19148 </listitem></varlistentry>
19149 <varlistentry>
19150 <term><varname>$rcpt_fail_count</varname></term>
19151 <listitem>
19152 <para>
19153 <indexterm role="variable">
19154 <primary><varname>$rcpt_fail_count</varname></primary>
19155 </indexterm>
19156 When a message is being received by SMTP, this variable contains the number of
19157 RCPT commands in the current message that have previously been rejected with a
19158 permanent (5<emphasis>xx</emphasis>) response.
19159 </para>
19160 </listitem></varlistentry>
19161 <varlistentry>
19162 <term><varname>$received_count</varname></term>
19163 <listitem>
19164 <para>
19165 <indexterm role="variable">
19166 <primary><varname>$received_count</varname></primary>
19167 </indexterm>
19168 This variable contains the number of <emphasis>Received:</emphasis> header lines in the message,
19169 including the one added by Exim (so its value is always greater than zero). It
19170 is available in the DATA ACL, the non-SMTP ACL, and while routing and
19171 delivering.
19172 </para>
19173 </listitem></varlistentry>
19174 <varlistentry>
19175 <term><varname>$received_for</varname></term>
19176 <listitem>
19177 <para>
19178 <indexterm role="variable">
19179 <primary><varname>$received_for</varname></primary>
19180 </indexterm>
19181 If there is only a single recipient address in an incoming message, this
19182 variable contains that address when the <emphasis>Received:</emphasis> header line is being
19183 built. The value is copied after recipient rewriting has happened, but before
19184 the <function>local_scan()</function> function is run.
19185 </para>
19186 </listitem></varlistentry>
19187 <varlistentry>
19188 <term><varname>$received_ip_address</varname></term>
19189 <listitem>
19190 <para>
19191 <indexterm role="variable">
19192 <primary><varname>$received_ip_address</varname></primary>
19193 </indexterm>
19194 As soon as an Exim server starts processing an incoming TCP/IP connection, this
19195 variable is set to the address of the local IP interface, and <varname>$received_port</varname>
19196 is set to the local port number. (The remote IP address and port are in
19197 <varname>$sender_host_address</varname> and <varname>$sender_host_port</varname>.) When testing with <option>-bh</option>,
19198 the port value is -1 unless it has been set using the <option>-oMi</option> command line
19199 option.
19200 </para>
19201 <para>
19202 As well as being useful in ACLs (including the <quote>connect</quote> ACL), these variable
19203 could be used, for example, to make the file name for a TLS certificate depend
19204 on which interface and/or port is being used for the incoming connection. The
19205 values of <varname>$received_ip_address</varname> and <varname>$received_port</varname> are saved with any
19206 messages that are received, thus making these variables available at delivery
19207 time.
19208 For outbound connections see <varname>$sending_ip_address</varname>.
19209 </para>
19210 </listitem></varlistentry>
19211 <varlistentry>
19212 <term><varname>$received_port</varname></term>
19213 <listitem>
19214 <para>
19215 <indexterm role="variable">
19216 <primary><varname>$received_port</varname></primary>
19217 </indexterm>
19218 See <varname>$received_ip_address</varname>.
19219 </para>
19220 </listitem></varlistentry>
19221 <varlistentry>
19222 <term><varname>$received_protocol</varname></term>
19223 <listitem>
19224 <para>
19225 <indexterm role="variable">
19226 <primary><varname>$received_protocol</varname></primary>
19227 </indexterm>
19228 When a message is being processed, this variable contains the name of the
19229 protocol by which it was received. Most of the names used by Exim are defined
19230 by RFCs 821, 2821, and 3848. They start with <quote>smtp</quote> (the client used HELO) or
19231 <quote>esmtp</quote> (the client used EHLO). This can be followed by <quote>s</quote> for secure
19232 (encrypted) and/or <quote>a</quote> for authenticated. Thus, for example, if the protocol
19233 is set to <quote>esmtpsa</quote>, the message was received over an encrypted SMTP
19234 connection and the client was successfully authenticated.
19235 </para>
19236 <para>
19237 Exim uses the protocol name <quote>smtps</quote> for the case when encryption is
19238 automatically set up on connection without the use of STARTTLS (see
19239 <option>tls_on_connect_ports</option>), and the client uses HELO to initiate the
19240 encrypted SMTP session. The name <quote>smtps</quote> is also used for the rare situation
19241 where the client initially uses EHLO, sets up an encrypted connection using
19242 STARTTLS, and then uses HELO afterwards.
19243 </para>
19244 <para>
19245 The <option>-oMr</option> option provides a way of specifying a custom protocol name for
19246 messages that are injected locally by trusted callers. This is commonly used to
19247 identify messages that are being re-injected after some kind of scanning.
19248 </para>
19249 </listitem></varlistentry>
19250 <varlistentry>
19251 <term><varname>$received_time</varname></term>
19252 <listitem>
19253 <para>
19254 <indexterm role="variable">
19255 <primary><varname>$received_time</varname></primary>
19256 </indexterm>
19257 This variable contains the date and time when the current message was received,
19258 as a number of seconds since the start of the Unix epoch.
19259 </para>
19260 </listitem></varlistentry>
19261 <varlistentry>
19262 <term><varname>$recipient_data</varname></term>
19263 <listitem>
19264 <para>
19265 <indexterm role="variable">
19266 <primary><varname>$recipient_data</varname></primary>
19267 </indexterm>
19268 This variable is set after an indexing lookup success in an ACL <option>recipients</option>
19269 condition. It contains the data from the lookup, and the value remains set
19270 until the next <option>recipients</option> test. Thus, you can do things like this:
19271 </para>
19272 <literallayout>
19273 <literal>require recipients  = cdb*@;/some/file</literal>
19274 <literal>deny    </literal><emphasis>some further test involving</emphasis> <literal>$recipient_data</literal>
19275 </literallayout>
19276 <para>
19277 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
19278 method in the address list, using the semicolon syntax as in the example above.
19279 The variable is not set for a lookup that is used as part of the string
19280 expansion that all such lists undergo before being interpreted.
19281 </para>
19282 </listitem></varlistentry>
19283 <varlistentry>
19284 <term><varname>$recipient_verify_failure</varname></term>
19285 <listitem>
19286 <para>
19287 <indexterm role="variable">
19288 <primary><varname>$recipient_verify_failure</varname></primary>
19289 </indexterm>
19290 In an ACL, when a recipient verification fails, this variable contains
19291 information about the failure. It is set to one of the following words:
19292 </para>
19293 <itemizedlist>
19294 <listitem>
19295 <para>
19296 <quote>qualify</quote>: The address was unqualified (no domain), and the message
19297 was neither local nor came from an exempted host.
19298 </para>
19299 </listitem>
19300 <listitem>
19301 <para>
19302 <quote>route</quote>: Routing failed.
19303 </para>
19304 </listitem>
19305 <listitem>
19306 <para>
19307 <quote>mail</quote>: Routing succeeded, and a callout was attempted; rejection occurred at
19308 or before the MAIL command (that is, on initial connection, HELO, or
19309 MAIL).
19310 </para>
19311 </listitem>
19312 <listitem>
19313 <para>
19314 <quote>recipient</quote>: The RCPT command in a callout was rejected.
19315 </para>
19316 </listitem>
19317 <listitem>
19318 <para>
19319 <quote>postmaster</quote>: The postmaster check in a callout was rejected.
19320 </para>
19321 </listitem>
19322 </itemizedlist>
19323 <para>
19324 The main use of this variable is expected to be to distinguish between
19325 rejections of MAIL and rejections of RCPT.
19326 </para>
19327 </listitem></varlistentry>
19328 <varlistentry>
19329 <term><varname>$recipients</varname></term>
19330 <listitem>
19331 <para>
19332 <indexterm role="variable">
19333 <primary><varname>$recipients</varname></primary>
19334 </indexterm>
19335 This variable contains a list of envelope recipients for a message. A comma and
19336 a space separate the addresses in the replacement text. However, the variable
19337 is not generally available, to prevent exposure of Bcc recipients in
19338 unprivileged users&#x2019; filter files. You can use <varname>$recipients</varname> only in these
19339 cases:
19340 </para>
19341 <orderedlist numeration="arabic">
19342 <listitem>
19343 <para>
19344 In a system filter file.
19345 </para>
19346 </listitem>
19347 <listitem>
19348 <para>
19349 In the ACLs associated with the DATA command and with non-SMTP messages, that
19350 is, the ACLs defined by <option>acl_smtp_predata</option>, <option>acl_smtp_data</option>,
19351 <option>acl_smtp_mime</option>, <option>acl_not_smtp_start</option>, <option>acl_not_smtp</option>, and
19352 <option>acl_not_smtp_mime</option>.
19353 </para>
19354 </listitem>
19355 <listitem>
19356 <para>
19357 From within a <function>local_scan()</function> function.
19358 </para>
19359 </listitem>
19360 </orderedlist>
19361 </listitem></varlistentry>
19362 <varlistentry>
19363 <term><varname>$recipients_count</varname></term>
19364 <listitem>
19365 <para>
19366 <indexterm role="variable">
19367 <primary><varname>$recipients_count</varname></primary>
19368 </indexterm>
19369 When a message is being processed, this variable contains the number of
19370 envelope recipients that came with the message. Duplicates are not excluded
19371 from the count. While a message is being received over SMTP, the number
19372 increases for each accepted recipient. It can be referenced in an ACL.
19373 </para>
19374 </listitem></varlistentry>
19375 <varlistentry>
19376 <term><varname>$regex_match_string</varname></term>
19377 <listitem>
19378 <para>
19379 <indexterm role="variable">
19380 <primary><varname>$regex_match_string</varname></primary>
19381 </indexterm>
19382 This variable is set to contain the matching regular expression after a
19383 <option>regex</option> ACL condition has matched (see section <xref linkend="SECTscanregex"/>).
19384 </para>
19385 </listitem></varlistentry>
19386 <varlistentry>
19387 <term><varname>$regex1</varname>, <varname>$regex2</varname>, etc</term>
19388 <listitem>
19389 <para>
19390 <indexterm role="concept">
19391 <primary>regex submatch variables (<varname>$1regex</varname> <varname>$2regex</varname> etc)</primary>
19392 </indexterm>
19393 When a <option>regex</option> or <option>mime_regex</option> ACL condition succeeds,
19394 these variables contain the
19395 captured substrings identified by the regular expression.
19396 </para>
19397 </listitem></varlistentry>
19398 <varlistentry>
19399 <term><varname>$reply_address</varname></term>
19400 <listitem>
19401 <para>
19402 <indexterm role="variable">
19403 <primary><varname>$reply_address</varname></primary>
19404 </indexterm>
19405 When a message is being processed, this variable contains the contents of the
19406 <emphasis>Reply-To:</emphasis> header line if one exists and it is not empty, or otherwise the
19407 contents of the <emphasis>From:</emphasis> header line. Apart from the removal of leading
19408 white space, the value is not processed in any way. In particular, no RFC 2047
19409 decoding or character code translation takes place.
19410 </para>
19411 </listitem></varlistentry>
19412 <varlistentry>
19413 <term><varname>$return_path</varname></term>
19414 <listitem>
19415 <para>
19416 <indexterm role="variable">
19417 <primary><varname>$return_path</varname></primary>
19418 </indexterm>
19419 When a message is being delivered, this variable contains the return path &ndash;
19420 the sender field that will be sent as part of the envelope. It is not enclosed
19421 in &lt;&gt; characters. At the start of routing an address, <varname>$return_path</varname> has the
19422 same value as <varname>$sender_address</varname>, but if, for example, an incoming message to a
19423 mailing list has been expanded by a router which specifies a different address
19424 for bounce messages, <varname>$return_path</varname> subsequently contains the new bounce
19425 address, whereas <varname>$sender_address</varname> always contains the original sender address
19426 that was received with the message. In other words, <varname>$sender_address</varname> contains
19427 the incoming envelope sender, and <varname>$return_path</varname> contains the outgoing
19428 envelope sender.
19429 </para>
19430 </listitem></varlistentry>
19431 <varlistentry>
19432 <term><varname>$return_size_limit</varname></term>
19433 <listitem>
19434 <para>
19435 <indexterm role="variable">
19436 <primary><varname>$return_size_limit</varname></primary>
19437 </indexterm>
19438 This is an obsolete name for <varname>$bounce_return_size_limit</varname>.
19439 </para>
19440 </listitem></varlistentry>
19441 <varlistentry>
19442 <term><varname>$router_name</varname></term>
19443 <listitem>
19444 <para>
19445 <indexterm role="concept">
19446 <primary>router</primary>
19447 <secondary>name</secondary>
19448 </indexterm>
19449 <indexterm role="concept">
19450 <primary>name</primary>
19451 <secondary>of router</secondary>
19452 </indexterm>
19453 <indexterm role="variable">
19454 <primary><varname>$router_name</varname></primary>
19455 </indexterm>
19456 During the running of a router this variable contains its name.
19457 </para>
19458 </listitem></varlistentry>
19459 <varlistentry>
19460 <term><varname>$runrc</varname></term>
19461 <listitem>
19462 <para>
19463 <indexterm role="concept">
19464 <primary>return code</primary>
19465 <secondary>from <option>run</option> expansion</secondary>
19466 </indexterm>
19467 <indexterm role="variable">
19468 <primary><varname>$runrc</varname></primary>
19469 </indexterm>
19470 This variable contains the return code from a command that is run by the
19471 <option>${run...}</option> expansion item. <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot
19472 assume the order in which option values are expanded, except for those
19473 preconditions whose order of testing is documented. Therefore, you cannot
19474 reliably expect to set <varname>$runrc</varname> by the expansion of one option, and use it in
19475 another.
19476 </para>
19477 </listitem></varlistentry>
19478 <varlistentry>
19479 <term><varname>$self_hostname</varname></term>
19480 <listitem>
19481 <para>
19482 <indexterm role="option">
19483 <primary><option>self</option></primary>
19484 <secondary>value of host name</secondary>
19485 </indexterm>
19486 <indexterm role="variable">
19487 <primary><varname>$self_hostname</varname></primary>
19488 </indexterm>
19489 When an address is routed to a supposedly remote host that turns out to be the
19490 local host, what happens is controlled by the <option>self</option> generic router option.
19491 One of its values causes the address to be passed to another router. When this
19492 happens, <varname>$self_hostname</varname> is set to the name of the local host that the
19493 original router encountered. In other circumstances its contents are null.
19494 </para>
19495 </listitem></varlistentry>
19496 <varlistentry>
19497 <term><varname>$sender_address</varname></term>
19498 <listitem>
19499 <para>
19500 <indexterm role="variable">
19501 <primary><varname>$sender_address</varname></primary>
19502 </indexterm>
19503 When a message is being processed, this variable contains the sender&#x2019;s address
19504 that was received in the message&#x2019;s envelope. The case of letters in the address
19505 is retained, in both the local part and the domain. For bounce messages, the
19506 value of this variable is the empty string. See also <varname>$return_path</varname>.
19507 </para>
19508 </listitem></varlistentry>
19509 <varlistentry>
19510 <term><varname>$sender_address_data</varname></term>
19511 <listitem>
19512 <para>
19513 <indexterm role="variable">
19514 <primary><varname>$address_data</varname></primary>
19515 </indexterm>
19516 <indexterm role="variable">
19517 <primary><varname>$sender_address_data</varname></primary>
19518 </indexterm>
19519 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
19520 sender address, the final value is preserved in <varname>$sender_address_data</varname>, to
19521 distinguish it from data from a recipient address. The value does not persist
19522 after the end of the current ACL statement. If you want to preserve it for
19523 longer, you can save it in an ACL variable.
19524 </para>
19525 </listitem></varlistentry>
19526 <varlistentry>
19527 <term><varname>$sender_address_domain</varname></term>
19528 <listitem>
19529 <para>
19530 <indexterm role="variable">
19531 <primary><varname>$sender_address_domain</varname></primary>
19532 </indexterm>
19533 The domain portion of <varname>$sender_address</varname>.
19534 </para>
19535 </listitem></varlistentry>
19536 <varlistentry>
19537 <term><varname>$sender_address_local_part</varname></term>
19538 <listitem>
19539 <para>
19540 <indexterm role="variable">
19541 <primary><varname>$sender_address_local_part</varname></primary>
19542 </indexterm>
19543 The local part portion of <varname>$sender_address</varname>.
19544 </para>
19545 </listitem></varlistentry>
19546 <varlistentry>
19547 <term><varname>$sender_data</varname></term>
19548 <listitem>
19549 <para>
19550 <indexterm role="variable">
19551 <primary><varname>$sender_data</varname></primary>
19552 </indexterm>
19553 This variable is set after a lookup success in an ACL <option>senders</option> condition or
19554 in a router <option>senders</option> option. It contains the data from the lookup, and the
19555 value remains set until the next <option>senders</option> test. Thus, you can do things like
19556 this:
19557 </para>
19558 <literallayout>
19559 <literal>require senders      = cdb*@;/some/file</literal>
19560 <literal>deny    </literal><emphasis>some further test involving</emphasis> <literal>$sender_data</literal>
19561 </literallayout>
19562 <para>
19563 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
19564 method in the address list, using the semicolon syntax as in the example above.
19565 The variable is not set for a lookup that is used as part of the string
19566 expansion that all such lists undergo before being interpreted.
19567 </para>
19568 </listitem></varlistentry>
19569 <varlistentry>
19570 <term><varname>$sender_fullhost</varname></term>
19571 <listitem>
19572 <para>
19573 <indexterm role="variable">
19574 <primary><varname>$sender_fullhost</varname></primary>
19575 </indexterm>
19576 When a message is received from a remote host, this variable contains the host
19577 name and IP address in a single string. It ends with the IP address in square
19578 brackets, followed by a colon and a port number if the logging of ports is
19579 enabled. The format of the rest of the string depends on whether the host
19580 issued a HELO or EHLO SMTP command, and whether the host name was verified by
19581 looking up its IP address. (Looking up the IP address can be forced by the
19582 <option>host_lookup</option> option, independent of verification.) A plain host name at the
19583 start of the string is a verified host name; if this is not present,
19584 verification either failed or was not requested. A host name in parentheses is
19585 the argument of a HELO or EHLO command. This is omitted if it is identical to
19586 the verified host name or to the host&#x2019;s IP address in square brackets.
19587 </para>
19588 </listitem></varlistentry>
19589 <varlistentry>
19590 <term><varname>$sender_helo_dnssec</varname></term>
19591 <listitem>
19592 <para>
19593 <indexterm role="variable">
19594 <primary><varname>$sender_helo_dnssec</varname></primary>
19595 </indexterm>
19596 This boolean variable is true if a successful HELO verification was
19597 <indexterm role="concept">
19598 <primary>DNS</primary>
19599 <secondary>DNSSEC</secondary>
19600 </indexterm>
19601 done using DNS information the resolver library stated was authenticated data.
19602 </para>
19603 </listitem></varlistentry>
19604 <varlistentry>
19605 <term><varname>$sender_helo_name</varname></term>
19606 <listitem>
19607 <para>
19608 <indexterm role="variable">
19609 <primary><varname>$sender_helo_name</varname></primary>
19610 </indexterm>
19611 When a message is received from a remote host that has issued a HELO or EHLO
19612 command, the argument of that command is placed in this variable. It is also
19613 set if HELO or EHLO is used when a message is received using SMTP locally via
19614 the <option>-bs</option> or <option>-bS</option> options.
19615 </para>
19616 </listitem></varlistentry>
19617 <varlistentry>
19618 <term><varname>$sender_host_address</varname></term>
19619 <listitem>
19620 <para>
19621 <indexterm role="variable">
19622 <primary><varname>$sender_host_address</varname></primary>
19623 </indexterm>
19624 When a message is received from a remote host using SMTP,
19625 this variable contains that
19626 host&#x2019;s IP address. For locally non-SMTP submitted messages, it is empty.
19627 </para>
19628 </listitem></varlistentry>
19629 <varlistentry>
19630 <term><varname>$sender_host_authenticated</varname></term>
19631 <listitem>
19632 <para>
19633 <indexterm role="variable">
19634 <primary><varname>$sender_host_authenticated</varname></primary>
19635 </indexterm>
19636 This variable contains the name (not the public name) of the authenticator
19637 driver that successfully authenticated the client from which the message was
19638 received. It is empty if there was no successful authentication. See also
19639 <varname>$authenticated_id</varname>.
19640 </para>
19641 </listitem></varlistentry>
19642 <varlistentry>
19643 <term><varname>$sender_host_dnssec</varname></term>
19644 <listitem>
19645 <para>
19646 <indexterm role="variable">
19647 <primary><varname>$sender_host_dnssec</varname></primary>
19648 </indexterm>
19649 If an attempt to populate <varname>$sender_host_name</varname> has been made
19650 (by reference, <option>hosts_lookup</option> or
19651 otherwise) then this boolean will have been set true if, and only if, the
19652 resolver library states that both
19653 the reverse and forward DNS were authenticated data.  At all
19654 other times, this variable is false.
19655 </para>
19656 <para>
19657 <indexterm role="concept">
19658 <primary>DNS</primary>
19659 <secondary>DNSSEC</secondary>
19660 </indexterm>
19661 It is likely that you will need to coerce DNSSEC support on in the resolver
19662 library, by setting:
19663 </para>
19664 <literallayout class="monospaced">
19665 dns_dnssec_ok = 1
19666 </literallayout>
19667 <para>
19668 Exim does not perform DNSSEC validation itself, instead leaving that to a
19669 validating resolver (e.g. unbound, or bind with suitable configuration).
19670 </para>
19671 <para>
19672 If you have changed <option>host_lookup_order</option> so that <literal>bydns</literal> is not the first
19673 mechanism in the list, then this variable will be false.
19674 </para>
19675 <para>
19676 This requires that your system resolver library support EDNS0 (and that
19677 DNSSEC flags exist in the system headers).  If the resolver silently drops
19678 all EDNS0 options, then this will have no effect.  OpenBSD&#x2019;s asr resolver
19679 is known to currently ignore EDNS0, documented in CAVEATS of asr_run(3).
19680 </para>
19681 </listitem></varlistentry>
19682 <varlistentry>
19683 <term><varname>$sender_host_name</varname></term>
19684 <listitem>
19685 <para>
19686 <indexterm role="variable">
19687 <primary><varname>$sender_host_name</varname></primary>
19688 </indexterm>
19689 When a message is received from a remote host, this variable contains the
19690 host&#x2019;s name as obtained by looking up its IP address. For messages received by
19691 other means, this variable is empty.
19692 </para>
19693 <para>
19694 <indexterm role="variable">
19695 <primary><varname>$host_lookup_failed</varname></primary>
19696 </indexterm>
19697 If the host name has not previously been looked up, a reference to
19698 <varname>$sender_host_name</varname> triggers a lookup (for messages from remote hosts).
19699 A looked up name is accepted only if it leads back to the original IP address
19700 via a forward lookup. If either the reverse or the forward lookup fails to find
19701 any data, or if the forward lookup does not yield the original IP address,
19702 <varname>$sender_host_name</varname> remains empty, and <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
19703 </para>
19704 <para>
19705 <indexterm role="variable">
19706 <primary><varname>$host_lookup_deferred</varname></primary>
19707 </indexterm>
19708 However, if either of the lookups cannot be completed (for example, there is a
19709 DNS timeout), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>, and
19710 <varname>$host_lookup_failed</varname> remains set to <quote>0</quote>.
19711 </para>
19712 <para>
19713 Once <varname>$host_lookup_failed</varname> is set to <quote>1</quote>, Exim does not try to look up the
19714 host name again if there is a subsequent reference to <varname>$sender_host_name</varname>
19715 in the same Exim process, but it does try again if <varname>$host_lookup_deferred</varname>
19716 is set to <quote>1</quote>.
19717 </para>
19718 <para>
19719 Exim does not automatically look up every calling host&#x2019;s name. If you want
19720 maximum efficiency, you should arrange your configuration so that it avoids
19721 these lookups altogether. The lookup happens only if one or more of the
19722 following are true:
19723 </para>
19724 <itemizedlist>
19725 <listitem>
19726 <para>
19727 A string containing <varname>$sender_host_name</varname> is expanded.
19728 </para>
19729 </listitem>
19730 <listitem>
19731 <para>
19732 The calling host matches the list in <option>host_lookup</option>. In the default
19733 configuration, this option is set to *, so it must be changed if lookups are
19734 to be avoided. (In the code, the default for <option>host_lookup</option> is unset.)
19735 </para>
19736 </listitem>
19737 <listitem>
19738 <para>
19739 Exim needs the host name in order to test an item in a host list. The items
19740 that require this are described in sections <xref linkend="SECThoslispatnam"/> and
19741 <xref linkend="SECThoslispatnamsk"/>.
19742 </para>
19743 </listitem>
19744 <listitem>
19745 <para>
19746 The calling host matches <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>.
19747 In this case, the host name is required to compare with the name quoted in any
19748 EHLO or HELO commands that the client issues.
19749 </para>
19750 </listitem>
19751 <listitem>
19752 <para>
19753 The remote host issues a EHLO or HELO command that quotes one of the
19754 domains in <option>helo_lookup_domains</option>. The default value of this option is
19755 </para>
19756 <literallayout class="monospaced">
19757   helo_lookup_domains = @ : @[]
19758 </literallayout>
19759 <para>
19760 which causes a lookup if a remote host (incorrectly) gives the server&#x2019;s name or
19761 IP address in an EHLO or HELO command.
19762 </para>
19763 </listitem>
19764 </itemizedlist>
19765 </listitem></varlistentry>
19766 <varlistentry>
19767 <term><varname>$sender_host_port</varname></term>
19768 <listitem>
19769 <para>
19770 <indexterm role="variable">
19771 <primary><varname>$sender_host_port</varname></primary>
19772 </indexterm>
19773 When a message is received from a remote host, this variable contains the port
19774 number that was used on the remote host.
19775 </para>
19776 </listitem></varlistentry>
19777 <varlistentry>
19778 <term><varname>$sender_ident</varname></term>
19779 <listitem>
19780 <para>
19781 <indexterm role="variable">
19782 <primary><varname>$sender_ident</varname></primary>
19783 </indexterm>
19784 When a message is received from a remote host, this variable contains the
19785 identification received in response to an RFC 1413 request. When a message has
19786 been received locally, this variable contains the login name of the user that
19787 called Exim.
19788 </para>
19789 </listitem></varlistentry>
19790 <varlistentry>
19791 <term><varname>$sender_rate_</varname><emphasis>xxx</emphasis></term>
19792 <listitem>
19793 <para>
19794 A number of variables whose names begin <varname>$sender_rate_</varname> are set as part of the
19795 <option>ratelimit</option> ACL condition. Details are given in section
19796 <xref linkend="SECTratelimiting"/>.
19797 </para>
19798 </listitem></varlistentry>
19799 <varlistentry>
19800 <term><varname>$sender_rcvhost</varname></term>
19801 <listitem>
19802 <para>
19803 <indexterm role="concept">
19804 <primary>DNS</primary>
19805 <secondary>reverse lookup</secondary>
19806 </indexterm>
19807 <indexterm role="concept">
19808 <primary>reverse DNS lookup</primary>
19809 </indexterm>
19810 <indexterm role="variable">
19811 <primary><varname>$sender_rcvhost</varname></primary>
19812 </indexterm>
19813 This is provided specifically for use in <emphasis>Received:</emphasis> headers. It starts with
19814 either the verified host name (as obtained from a reverse DNS lookup) or, if
19815 there is no verified host name, the IP address in square brackets. After that
19816 there may be text in parentheses. When the first item is a verified host name,
19817 the first thing in the parentheses is the IP address in square brackets,
19818 followed by a colon and a port number if port logging is enabled. When the
19819 first item is an IP address, the port is recorded as <quote>port=<emphasis>xxxx</emphasis></quote> inside
19820 the parentheses.
19821 </para>
19822 <para>
19823 There may also be items of the form <quote>helo=<emphasis>xxxx</emphasis></quote> if HELO or EHLO
19824 was used and its argument was not identical to the real host name or IP
19825 address, and <quote>ident=<emphasis>xxxx</emphasis></quote> if an RFC 1413 ident string is available. If
19826 all three items are present in the parentheses, a newline and tab are inserted
19827 into the string, to improve the formatting of the <emphasis>Received:</emphasis> header.
19828 </para>
19829 </listitem></varlistentry>
19830 <varlistentry>
19831 <term><varname>$sender_verify_failure</varname></term>
19832 <listitem>
19833 <para>
19834 <indexterm role="variable">
19835 <primary><varname>$sender_verify_failure</varname></primary>
19836 </indexterm>
19837 In an ACL, when a sender verification fails, this variable contains information
19838 about the failure. The details are the same as for
19839 <varname>$recipient_verify_failure</varname>.
19840 </para>
19841 </listitem></varlistentry>
19842 <varlistentry>
19843 <term><varname>$sending_ip_address</varname></term>
19844 <listitem>
19845 <para>
19846 <indexterm role="variable">
19847 <primary><varname>$sending_ip_address</varname></primary>
19848 </indexterm>
19849 This variable is set whenever an outgoing SMTP connection to another host has
19850 been set up. It contains the IP address of the local interface that is being
19851 used. This is useful if a host that has more than one IP address wants to take
19852 on different personalities depending on which one is being used. For incoming
19853 connections, see <varname>$received_ip_address</varname>.
19854 </para>
19855 </listitem></varlistentry>
19856 <varlistentry>
19857 <term><varname>$sending_port</varname></term>
19858 <listitem>
19859 <para>
19860 <indexterm role="variable">
19861 <primary><varname>$sending_port</varname></primary>
19862 </indexterm>
19863 This variable is set whenever an outgoing SMTP connection to another host has
19864 been set up. It contains the local port that is being used. For incoming
19865 connections, see <varname>$received_port</varname>.
19866 </para>
19867 </listitem></varlistentry>
19868 <varlistentry>
19869 <term><varname>$smtp_active_hostname</varname></term>
19870 <listitem>
19871 <para>
19872 <indexterm role="variable">
19873 <primary><varname>$smtp_active_hostname</varname></primary>
19874 </indexterm>
19875 During an incoming SMTP session, this variable contains the value of the active
19876 host name, as specified by the <option>smtp_active_hostname</option> option. The value of
19877 <varname>$smtp_active_hostname</varname> is saved with any message that is received, so its
19878 value can be consulted during routing and delivery.
19879 </para>
19880 </listitem></varlistentry>
19881 <varlistentry>
19882 <term><varname>$smtp_command</varname></term>
19883 <listitem>
19884 <para>
19885 <indexterm role="variable">
19886 <primary><varname>$smtp_command</varname></primary>
19887 </indexterm>
19888 During the processing of an incoming SMTP command, this variable contains the
19889 entire command. This makes it possible to distinguish between HELO and EHLO in
19890 the HELO ACL, and also to distinguish between commands such as these:
19891 </para>
19892 <literallayout class="monospaced">
19893 MAIL FROM:&lt;&gt;
19894 MAIL FROM: &lt;&gt;
19895 </literallayout>
19896 <para>
19897 For a MAIL command, extra parameters such as SIZE can be inspected. For a RCPT
19898 command, the address in <varname>$smtp_command</varname> is the original address before any
19899 rewriting, whereas the values in <varname>$local_part</varname> and <varname>$domain</varname> are taken from
19900 the address after SMTP-time rewriting.
19901 </para>
19902 </listitem></varlistentry>
19903 <varlistentry>
19904 <term><varname>$smtp_command_argument</varname></term>
19905 <listitem>
19906 <para>
19907 <indexterm role="concept">
19908 <primary>SMTP</primary>
19909 <secondary>command, argument for</secondary>
19910 </indexterm>
19911 <indexterm role="variable">
19912 <primary><varname>$smtp_command_argument</varname></primary>
19913 </indexterm>
19914 While an ACL is running to check an SMTP command, this variable contains the
19915 argument, that is, the text that follows the command name, with leading white
19916 space removed. Following the introduction of <varname>$smtp_command</varname>, this variable is
19917 somewhat redundant, but is retained for backwards compatibility.
19918 </para>
19919 </listitem></varlistentry>
19920 <varlistentry revisionflag="changed">
19921 <term><varname>$smtp_command_history</varname></term>
19922 <listitem>
19923 <para revisionflag="changed">
19924 <indexterm role="concept">
19925 <primary>SMTP</primary>
19926 <secondary>command history</secondary>
19927 </indexterm>
19928 <indexterm role="variable">
19929 <primary><varname>$smtp_command_history</varname></primary>
19930 </indexterm>
19931 A comma-separated list (with no whitespace) of the most-recent SMTP commands
19932 received, in time-order left to right.  Only a limited number of commands
19933 are remembered.
19934 </para>
19935 </listitem></varlistentry>
19936 <varlistentry>
19937 <term><varname>$smtp_count_at_connection_start</varname></term>
19938 <listitem>
19939 <para>
19940 <indexterm role="variable">
19941 <primary><varname>$smtp_count_at_connection_start</varname></primary>
19942 </indexterm>
19943 This variable is set greater than zero only in processes spawned by the Exim
19944 daemon for handling incoming SMTP connections. The name is deliberately long,
19945 in order to emphasize what the contents are. When the daemon accepts a new
19946 connection, it increments this variable. A copy of the variable is passed to
19947 the child process that handles the connection, but its value is fixed, and
19948 never changes. It is only an approximation of how many incoming connections
19949 there actually are, because many other connections may come and go while a
19950 single connection is being processed. When a child process terminates, the
19951 daemon decrements its copy of the variable.
19952 </para>
19953 </listitem></varlistentry>
19954 <varlistentry>
19955 <term><varname>$sn0</varname> &ndash; <varname>$sn9</varname></term>
19956 <listitem>
19957 <para>
19958 These variables are copies of the values of the <varname>$n0</varname> &ndash; <varname>$n9</varname> accumulators
19959 that were current at the end of the system filter file. This allows a system
19960 filter file to set values that can be tested in users&#x2019; filter files. For
19961 example, a system filter could set a value indicating how likely it is that a
19962 message is junk mail.
19963 </para>
19964 </listitem></varlistentry>
19965 <varlistentry>
19966 <term><varname>$spam_</varname><emphasis>xxx</emphasis></term>
19967 <listitem>
19968 <para>
19969 A number of variables whose names start with <varname>$spam</varname> are available when Exim
19970 is compiled with the content-scanning extension. For details, see section
19971 <xref linkend="SECTscanspamass"/>.
19972 </para>
19973 </listitem></varlistentry>
19974 <varlistentry>
19975 <term><varname>$spool_directory</varname></term>
19976 <listitem>
19977 <para>
19978 <indexterm role="variable">
19979 <primary><varname>$spool_directory</varname></primary>
19980 </indexterm>
19981 The name of Exim&#x2019;s spool directory.
19982 </para>
19983 </listitem></varlistentry>
19984 <varlistentry>
19985 <term><varname>$spool_inodes</varname></term>
19986 <listitem>
19987 <para>
19988 <indexterm role="variable">
19989 <primary><varname>$spool_inodes</varname></primary>
19990 </indexterm>
19991 The number of free inodes in the disk partition where Exim&#x2019;s spool files are
19992 being written. The value is recalculated whenever the variable is referenced.
19993 If the relevant file system does not have the concept of inodes, the value of
19994 is -1. See also the <option>check_spool_inodes</option> option.
19995 </para>
19996 </listitem></varlistentry>
19997 <varlistentry>
19998 <term><varname>$spool_space</varname></term>
19999 <listitem>
20000 <para>
20001 <indexterm role="variable">
20002 <primary><varname>$spool_space</varname></primary>
20003 </indexterm>
20004 The amount of free space (as a number of kilobytes) in the disk partition where
20005 Exim&#x2019;s spool files are being written. The value is recalculated whenever the
20006 variable is referenced. If the operating system does not have the ability to
20007 find the amount of free space (only true for experimental systems), the space
20008 value is -1. For example, to check in an ACL that there is at least 50
20009 megabytes free on the spool, you could write:
20010 </para>
20011 <literallayout class="monospaced">
20012 condition = ${if &gt; {$spool_space}{50000}}
20013 </literallayout>
20014 <para>
20015 See also the <option>check_spool_space</option> option.
20016 </para>
20017 </listitem></varlistentry>
20018 <varlistentry>
20019 <term><varname>$thisaddress</varname></term>
20020 <listitem>
20021 <para>
20022 <indexterm role="variable">
20023 <primary><varname>$thisaddress</varname></primary>
20024 </indexterm>
20025 This variable is set only during the processing of the <option>foranyaddress</option>
20026 command in a filter file. Its use is explained in the description of that
20027 command, which can be found in the separate document entitled <emphasis>Exim&#x2019;s
20028 interfaces to mail filtering</emphasis>.
20029 </para>
20030 </listitem></varlistentry>
20031 <varlistentry>
20032 <term><varname>$tls_in_bits</varname></term>
20033 <listitem>
20034 <para>
20035 <indexterm role="variable">
20036 <primary><varname>$tls_in_bits</varname></primary>
20037 </indexterm>
20038 Contains an approximation of the TLS cipher&#x2019;s bit-strength
20039 on the inbound connection; the meaning of
20040 this depends upon the TLS implementation used.
20041 If TLS has not been negotiated, the value will be 0.
20042 The value of this is automatically fed into the Cyrus SASL authenticator
20043 when acting as a server, to specify the "external SSF" (a SASL term).
20044 </para>
20045 <para>
20046 The deprecated <varname>$tls_bits</varname> variable refers to the inbound side
20047 except when used in the context of an outbound SMTP delivery, when it refers to
20048 the outbound.
20049 </para>
20050 </listitem></varlistentry>
20051 <varlistentry>
20052 <term><varname>$tls_out_bits</varname></term>
20053 <listitem>
20054 <para>
20055 <indexterm role="variable">
20056 <primary><varname>$tls_out_bits</varname></primary>
20057 </indexterm>
20058 Contains an approximation of the TLS cipher&#x2019;s bit-strength
20059 on an outbound SMTP connection; the meaning of
20060 this depends upon the TLS implementation used.
20061 If TLS has not been negotiated, the value will be 0.
20062 </para>
20063 </listitem></varlistentry>
20064 <varlistentry>
20065 <term><varname>$tls_in_ourcert</varname></term>
20066 <listitem>
20067 <para>
20068 <indexterm role="variable">
20069 <primary><varname>$tls_in_ourcert</varname></primary>
20070 </indexterm>
20071 <indexterm role="concept">
20072 <primary>certificate</primary>
20073 <secondary>variables</secondary>
20074 </indexterm>
20075 This variable refers to the certificate presented to the peer of an
20076 inbound connection when the message was received.
20077 It is only useful as the argument of a
20078 <option>certextract</option> expansion item, <option>md5</option>, <option>sha1</option> or <option>sha256</option> operator,
20079 or a <option>def</option> condition.
20080 </para>
20081 <para revisionflag="changed">
20082 <emphasis role="bold">Note</emphasis>: Under current versions of OpenSSL, when a list of more than one
20083 file is used for <option>tls_certificate</option>, this variable is not reliable.
20084 </para>
20085 </listitem></varlistentry>
20086 <varlistentry>
20087 <term><varname>$tls_in_peercert</varname></term>
20088 <listitem>
20089 <para>
20090 <indexterm role="variable">
20091 <primary><varname>$tls_in_peercert</varname></primary>
20092 </indexterm>
20093 This variable refers to the certificate presented by the peer of an
20094 inbound connection when the message was received.
20095 It is only useful as the argument of a
20096 <option>certextract</option> expansion item, <option>md5</option>, <option>sha1</option> or <option>sha256</option> operator,
20097 or a <option>def</option> condition.
20098 If certificate verification fails it may refer to a failing chain element
20099 which is not the leaf.
20100 </para>
20101 </listitem></varlistentry>
20102 <varlistentry>
20103 <term><varname>$tls_out_ourcert</varname></term>
20104 <listitem>
20105 <para>
20106 <indexterm role="variable">
20107 <primary><varname>$tls_out_ourcert</varname></primary>
20108 </indexterm>
20109 This variable refers to the certificate presented to the peer of an
20110 outbound connection.  It is only useful as the argument of a
20111 <option>certextract</option> expansion item, <option>md5</option>, <option>sha1</option> or <option>sha256</option> operator,
20112 or a <option>def</option> condition.
20113 </para>
20114 </listitem></varlistentry>
20115 <varlistentry>
20116 <term><varname>$tls_out_peercert</varname></term>
20117 <listitem>
20118 <para>
20119 <indexterm role="variable">
20120 <primary><varname>$tls_out_peercert</varname></primary>
20121 </indexterm>
20122 This variable refers to the certificate presented by the peer of an
20123 outbound connection.  It is only useful as the argument of a
20124 <option>certextract</option> expansion item, <option>md5</option>, <option>sha1</option> or <option>sha256</option> operator,
20125 or a <option>def</option> condition.
20126 If certificate verification fails it may refer to a failing chain element
20127 which is not the leaf.
20128 </para>
20129 </listitem></varlistentry>
20130 <varlistentry>
20131 <term><varname>$tls_in_certificate_verified</varname></term>
20132 <listitem>
20133 <para>
20134 <indexterm role="variable">
20135 <primary><varname>$tls_in_certificate_verified</varname></primary>
20136 </indexterm>
20137 This variable is set to <quote>1</quote> if a TLS certificate was verified when the
20138 message was received, and <quote>0</quote> otherwise.
20139 </para>
20140 <para>
20141 The deprecated <varname>$tls_certificate_verified</varname> variable refers to the inbound side
20142 except when used in the context of an outbound SMTP delivery, when it refers to
20143 the outbound.
20144 </para>
20145 </listitem></varlistentry>
20146 <varlistentry>
20147 <term><varname>$tls_out_certificate_verified</varname></term>
20148 <listitem>
20149 <para>
20150 <indexterm role="variable">
20151 <primary><varname>$tls_out_certificate_verified</varname></primary>
20152 </indexterm>
20153 This variable is set to <quote>1</quote> if a TLS certificate was verified when an
20154 outbound SMTP connection was made,
20155 and <quote>0</quote> otherwise.
20156 </para>
20157 </listitem></varlistentry>
20158 <varlistentry>
20159 <term><varname>$tls_in_cipher</varname></term>
20160 <listitem>
20161 <para>
20162 <indexterm role="variable">
20163 <primary><varname>$tls_in_cipher</varname></primary>
20164 </indexterm>
20165 <indexterm role="variable">
20166 <primary><varname>$tls_cipher</varname></primary>
20167 </indexterm>
20168 When a message is received from a remote host over an encrypted SMTP
20169 connection, this variable is set to the cipher suite that was negotiated, for
20170 example DES-CBC3-SHA. In other circumstances, in particular, for message
20171 received over unencrypted connections, the variable is empty. Testing
20172 <varname>$tls_in_cipher</varname> for emptiness is one way of distinguishing between encrypted and
20173 non-encrypted connections during ACL processing.
20174 </para>
20175 <para>
20176 The deprecated <varname>$tls_cipher</varname> variable is the same as <varname>$tls_in_cipher</varname> during message reception,
20177 but in the context of an outward SMTP delivery taking place via the <command>smtp</command> transport
20178 becomes the same as <varname>$tls_out_cipher</varname>.
20179 </para>
20180 </listitem></varlistentry>
20181 <varlistentry>
20182 <term><varname>$tls_out_cipher</varname></term>
20183 <listitem>
20184 <para>
20185 <indexterm role="variable">
20186 <primary><varname>$tls_out_cipher</varname></primary>
20187 </indexterm>
20188 This variable is
20189 cleared before any outgoing SMTP connection is made,
20190 and then set to the outgoing cipher suite if one is negotiated. See chapter
20191 <xref linkend="CHAPTLS"/> for details of TLS support and chapter <xref linkend="CHAPsmtptrans"/> for
20192 details of the <command>smtp</command> transport.
20193 </para>
20194 </listitem></varlistentry>
20195 <varlistentry>
20196 <term><varname>$tls_in_ocsp</varname></term>
20197 <listitem>
20198 <para>
20199 <indexterm role="variable">
20200 <primary><varname>$tls_in_ocsp</varname></primary>
20201 </indexterm>
20202 When a message is received from a remote client connection
20203 the result of any OCSP request from the client is encoded in this variable:
20204 </para>
20205 <literallayout class="monospaced">
20206 0 OCSP proof was not requested (default value)
20207 1 No response to request
20208 2 Response not verified
20209 3 Verification failed
20210 4 Verification succeeded
20211 </literallayout>
20212 </listitem></varlistentry>
20213 <varlistentry>
20214 <term><varname>$tls_out_ocsp</varname></term>
20215 <listitem>
20216 <para>
20217 <indexterm role="variable">
20218 <primary><varname>$tls_out_ocsp</varname></primary>
20219 </indexterm>
20220 When a message is sent to a remote host connection
20221 the result of any OCSP request made is encoded in this variable.
20222 See <varname>$tls_in_ocsp</varname> for values.
20223 </para>
20224 </listitem></varlistentry>
20225 <varlistentry>
20226 <term><varname>$tls_in_peerdn</varname></term>
20227 <listitem>
20228 <para>
20229 <indexterm role="variable">
20230 <primary><varname>$tls_in_peerdn</varname></primary>
20231 </indexterm>
20232 <indexterm role="variable">
20233 <primary><varname>$tls_peerdn</varname></primary>
20234 </indexterm>
20235 <indexterm role="concept">
20236 <primary>certificate</primary>
20237 <secondary>extracting fields</secondary>
20238 </indexterm>
20239 When a message is received from a remote host over an encrypted SMTP
20240 connection, and Exim is configured to request a certificate from the client,
20241 the value of the Distinguished Name of the certificate is made available in the
20242 <varname>$tls_in_peerdn</varname> during subsequent processing.
20243 If certificate verification fails it may refer to a failing chain element
20244 which is not the leaf.
20245 </para>
20246 <para>
20247 The deprecated <varname>$tls_peerdn</varname> variable refers to the inbound side
20248 except when used in the context of an outbound SMTP delivery, when it refers to
20249 the outbound.
20250 </para>
20251 </listitem></varlistentry>
20252 <varlistentry>
20253 <term><varname>$tls_out_peerdn</varname></term>
20254 <listitem>
20255 <para>
20256 <indexterm role="variable">
20257 <primary><varname>$tls_out_peerdn</varname></primary>
20258 </indexterm>
20259 When a message is being delivered to a remote host over an encrypted SMTP
20260 connection, and Exim is configured to request a certificate from the server,
20261 the value of the Distinguished Name of the certificate is made available in the
20262 <varname>$tls_out_peerdn</varname> during subsequent processing.
20263 If certificate verification fails it may refer to a failing chain element
20264 which is not the leaf.
20265 </para>
20266 </listitem></varlistentry>
20267 <varlistentry>
20268 <term><varname>$tls_in_sni</varname></term>
20269 <listitem>
20270 <para>
20271 <indexterm role="variable">
20272 <primary><varname>$tls_in_sni</varname></primary>
20273 </indexterm>
20274 <indexterm role="variable">
20275 <primary><varname>$tls_sni</varname></primary>
20276 </indexterm>
20277 <indexterm role="concept">
20278 <primary>TLS</primary>
20279 <secondary>Server Name Indication</secondary>
20280 </indexterm>
20281 When a TLS session is being established, if the client sends the Server
20282 Name Indication extension, the value will be placed in this variable.
20283 If the variable appears in <option>tls_certificate</option> then this option and
20284 some others, described in <xref linkend="SECTtlssni"/>,
20285 will be re-expanded early in the TLS session, to permit
20286 a different certificate to be presented (and optionally a different key to be
20287 used) to the client, based upon the value of the SNI extension.
20288 </para>
20289 <para>
20290 The deprecated <varname>$tls_sni</varname> variable refers to the inbound side
20291 except when used in the context of an outbound SMTP delivery, when it refers to
20292 the outbound.
20293 </para>
20294 </listitem></varlistentry>
20295 <varlistentry>
20296 <term><varname>$tls_out_sni</varname></term>
20297 <listitem>
20298 <para>
20299 <indexterm role="variable">
20300 <primary><varname>$tls_out_sni</varname></primary>
20301 </indexterm>
20302 <indexterm role="concept">
20303 <primary>TLS</primary>
20304 <secondary>Server Name Indication</secondary>
20305 </indexterm>
20306 During outbound
20307 SMTP deliveries, this variable reflects the value of the <option>tls_sni</option> option on
20308 the transport.
20309 </para>
20310 </listitem></varlistentry>
20311 <varlistentry>
20312 <term><varname>$tod_bsdinbox</varname></term>
20313 <listitem>
20314 <para>
20315 <indexterm role="variable">
20316 <primary><varname>$tod_bsdinbox</varname></primary>
20317 </indexterm>
20318 The time of day and the date, in the format required for BSD-style mailbox
20319 files, for example: Thu Oct 17 17:14:09 1995.
20320 </para>
20321 </listitem></varlistentry>
20322 <varlistentry>
20323 <term><varname>$tod_epoch</varname></term>
20324 <listitem>
20325 <para>
20326 <indexterm role="variable">
20327 <primary><varname>$tod_epoch</varname></primary>
20328 </indexterm>
20329 The time and date as a number of seconds since the start of the Unix epoch.
20330 </para>
20331 </listitem></varlistentry>
20332 <varlistentry>
20333 <term><varname>$tod_epoch_l</varname></term>
20334 <listitem>
20335 <para>
20336 <indexterm role="variable">
20337 <primary><varname>$tod_epoch_l</varname></primary>
20338 </indexterm>
20339 The time and date as a number of microseconds since the start of the Unix epoch.
20340 </para>
20341 </listitem></varlistentry>
20342 <varlistentry>
20343 <term><varname>$tod_full</varname></term>
20344 <listitem>
20345 <para>
20346 <indexterm role="variable">
20347 <primary><varname>$tod_full</varname></primary>
20348 </indexterm>
20349 A full version of the time and date, for example: Wed, 16 Oct 1995 09:51:40
20350 +0100. The timezone is always given as a numerical offset from UTC, with
20351 positive values used for timezones that are ahead (east) of UTC, and negative
20352 values for those that are behind (west).
20353 </para>
20354 </listitem></varlistentry>
20355 <varlistentry>
20356 <term><varname>$tod_log</varname></term>
20357 <listitem>
20358 <para>
20359 <indexterm role="variable">
20360 <primary><varname>$tod_log</varname></primary>
20361 </indexterm>
20362 The time and date in the format used for writing Exim&#x2019;s log files, for example:
20363 1995-10-12 15:32:29, but without a timezone.
20364 </para>
20365 </listitem></varlistentry>
20366 <varlistentry>
20367 <term><varname>$tod_logfile</varname></term>
20368 <listitem>
20369 <para>
20370 <indexterm role="variable">
20371 <primary><varname>$tod_logfile</varname></primary>
20372 </indexterm>
20373 This variable contains the date in the format yyyymmdd. This is the format that
20374 is used for datestamping log files when <option>log_file_path</option> contains the <literal>%D</literal>
20375 flag.
20376 </para>
20377 </listitem></varlistentry>
20378 <varlistentry>
20379 <term><varname>$tod_zone</varname></term>
20380 <listitem>
20381 <para>
20382 <indexterm role="variable">
20383 <primary><varname>$tod_zone</varname></primary>
20384 </indexterm>
20385 This variable contains the numerical value of the local timezone, for example:
20386 -0500.
20387 </para>
20388 </listitem></varlistentry>
20389 <varlistentry>
20390 <term><varname>$tod_zulu</varname></term>
20391 <listitem>
20392 <para>
20393 <indexterm role="variable">
20394 <primary><varname>$tod_zulu</varname></primary>
20395 </indexterm>
20396 This variable contains the UTC date and time in <quote>Zulu</quote> format, as specified
20397 by ISO 8601, for example: 20030221154023Z.
20398 </para>
20399 </listitem></varlistentry>
20400 <varlistentry>
20401 <term><varname>$transport_name</varname></term>
20402 <listitem>
20403 <para>
20404 <indexterm role="concept">
20405 <primary>transport</primary>
20406 <secondary>name</secondary>
20407 </indexterm>
20408 <indexterm role="concept">
20409 <primary>name</primary>
20410 <secondary>of transport</secondary>
20411 </indexterm>
20412 <indexterm role="variable">
20413 <primary><varname>$transport_name</varname></primary>
20414 </indexterm>
20415 During the running of a transport, this variable contains its name.
20416 </para>
20417 </listitem></varlistentry>
20418 <varlistentry>
20419 <term><varname>$value</varname></term>
20420 <listitem>
20421 <para>
20422 <indexterm role="variable">
20423 <primary><varname>$value</varname></primary>
20424 </indexterm>
20425 This variable contains the result of an expansion lookup, extraction operation,
20426 or external command, as described above. It is also used during a
20427 <emphasis role="bold">reduce</emphasis> expansion.
20428 </para>
20429 </listitem></varlistentry>
20430 <varlistentry>
20431 <term><varname>$verify_mode</varname></term>
20432 <listitem>
20433 <para>
20434 <indexterm role="variable">
20435 <primary><varname>$verify_mode</varname></primary>
20436 </indexterm>
20437 While a router or transport is being run in verify mode or for cutthrough delivery,
20438 contains "S" for sender-verification or "R" for recipient-verification.
20439 Otherwise, empty.
20440 </para>
20441 </listitem></varlistentry>
20442 <varlistentry>
20443 <term><varname>$version_number</varname></term>
20444 <listitem>
20445 <para>
20446 <indexterm role="variable">
20447 <primary><varname>$version_number</varname></primary>
20448 </indexterm>
20449 The version number of Exim.
20450 </para>
20451 </listitem></varlistentry>
20452 <varlistentry>
20453 <term><varname>$warn_message_delay</varname></term>
20454 <listitem>
20455 <para>
20456 <indexterm role="variable">
20457 <primary><varname>$warn_message_delay</varname></primary>
20458 </indexterm>
20459 This variable is set only during the creation of a message warning about a
20460 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
20461 </para>
20462 </listitem></varlistentry>
20463 <varlistentry>
20464 <term><varname>$warn_message_recipients</varname></term>
20465 <listitem>
20466 <para>
20467 <indexterm role="variable">
20468 <primary><varname>$warn_message_recipients</varname></primary>
20469 </indexterm>
20470 This variable is set only during the creation of a message warning about a
20471 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
20472 </para>
20473 </listitem></varlistentry>
20474 </variablelist>
20475 <para>
20476 <indexterm role="concept" startref="IIDstrexp" class="endofrange"/>
20477 </para>
20478 </section>
20479 </chapter>
20480
20481 <chapter id="CHAPperl">
20482 <title>Embedded Perl</title>
20483 <para>
20484 <indexterm role="concept" id="IIDperl" class="startofrange">
20485 <primary>Perl</primary>
20486 <secondary>calling from Exim</secondary>
20487 </indexterm>
20488 Exim can be built to include an embedded Perl interpreter. When this is done,
20489 Perl subroutines can be called as part of the string expansion process. To make
20490 use of the Perl support, you need version 5.004 or later of Perl installed on
20491 your system. To include the embedded interpreter in the Exim binary, include
20492 the line
20493 </para>
20494 <literallayout class="monospaced">
20495 EXIM_PERL = perl.o
20496 </literallayout>
20497 <para>
20498 in your <filename>Local/Makefile</filename> and then build Exim in the normal way.
20499 </para>
20500 <section id="SECID85">
20501 <title>Setting up so Perl can be used</title>
20502 <para>
20503 <indexterm role="option">
20504 <primary><option>perl_startup</option></primary>
20505 </indexterm>
20506 Access to Perl subroutines is via a global configuration option called
20507 <option>perl_startup</option> and an expansion string operator <option>${perl ...}</option>. If there is
20508 no <option>perl_startup</option> option in the Exim configuration file then no Perl
20509 interpreter is started and there is almost no overhead for Exim (since none of
20510 the Perl library will be paged in unless used). If there is a <option>perl_startup</option>
20511 option then the associated value is taken to be Perl code which is executed in
20512 a newly created Perl interpreter.
20513 </para>
20514 <para>
20515 The value of <option>perl_startup</option> is not expanded in the Exim sense, so you do not
20516 need backslashes before any characters to escape special meanings. The option
20517 should usually be something like
20518 </para>
20519 <literallayout class="monospaced">
20520 perl_startup = do '/etc/exim.pl'
20521 </literallayout>
20522 <para>
20523 where <filename>/etc/exim.pl</filename> is Perl code which defines any subroutines you want to
20524 use from Exim. Exim can be configured either to start up a Perl interpreter as
20525 soon as it is entered, or to wait until the first time it is needed. Starting
20526 the interpreter at the beginning ensures that it is done while Exim still has
20527 its setuid privilege, but can impose an unnecessary overhead if Perl is not in
20528 fact used in a particular run. Also, note that this does not mean that Exim is
20529 necessarily running as root when Perl is called at a later time. By default,
20530 the interpreter is started only when it is needed, but this can be changed in
20531 two ways:
20532 </para>
20533 <itemizedlist>
20534 <listitem>
20535 <para>
20536 <indexterm role="option">
20537 <primary><option>perl_at_start</option></primary>
20538 </indexterm>
20539 Setting <option>perl_at_start</option> (a boolean option) in the configuration requests
20540 a startup when Exim is entered.
20541 </para>
20542 </listitem>
20543 <listitem>
20544 <para>
20545 The command line option <option>-ps</option> also requests a startup when Exim is entered,
20546 overriding the setting of <option>perl_at_start</option>.
20547 </para>
20548 </listitem>
20549 </itemizedlist>
20550 <para>
20551 There is also a command line option <option>-pd</option> (for delay) which suppresses the
20552 initial startup, even if <option>perl_at_start</option> is set.
20553 </para>
20554 <itemizedlist>
20555 <listitem>
20556 <para>
20557 <indexterm role="option">
20558 <primary><option>perl_taintmode</option></primary>
20559 </indexterm>
20560 <indexterm role="concept">
20561 <primary>Perl</primary>
20562 <secondary>taintmode</secondary>
20563 </indexterm>
20564 To provide more security executing Perl code via the embedded Perl
20565 interpreter, the <option>perl_taintmode</option> option can be set. This enables the
20566 taint mode of the Perl interpreter. You are encouraged to set this
20567 option to a true value. To avoid breaking existing installations, it
20568 defaults to false.
20569 </para>
20570 </listitem>
20571 </itemizedlist>
20572 </section>
20573 <section id="SECID86">
20574 <title>Calling Perl subroutines</title>
20575 <para>
20576 When the configuration file includes a <option>perl_startup</option> option you can make use
20577 of the string expansion item to call the Perl subroutines that are defined
20578 by the <option>perl_startup</option> code. The operator is used in any of the following
20579 forms:
20580 </para>
20581 <literallayout class="monospaced">
20582 ${perl{foo}}
20583 ${perl{foo}{argument}}
20584 ${perl{foo}{argument1}{argument2} ... }
20585 </literallayout>
20586 <para>
20587 which calls the subroutine <option>foo</option> with the given arguments. A maximum of eight
20588 arguments may be passed. Passing more than this results in an expansion failure
20589 with an error message of the form
20590 </para>
20591 <literallayout class="monospaced">
20592 Too many arguments passed to Perl subroutine "foo" (max is 8)
20593 </literallayout>
20594 <para>
20595 The return value of the Perl subroutine is evaluated in a scalar context before
20596 it is passed back to Exim to be inserted into the expanded string. If the
20597 return value is <emphasis>undef</emphasis>, the expansion is forced to fail in the same way as
20598 an explicit <quote>fail</quote> on an <option>if</option> or <option>lookup</option> item. If the subroutine aborts
20599 by obeying Perl&#x2019;s <option>die</option> function, the expansion fails with the error message
20600 that was passed to <option>die</option>.
20601 </para>
20602 </section>
20603 <section id="SECID87">
20604 <title>Calling Exim functions from Perl</title>
20605 <para>
20606 Within any Perl code called from Exim, the function <emphasis>Exim::expand_string()</emphasis>
20607 is available to call back into Exim&#x2019;s string expansion function. For example,
20608 the Perl code
20609 </para>
20610 <literallayout class="monospaced">
20611 my $lp = Exim::expand_string('$local_part');
20612 </literallayout>
20613 <para>
20614 makes the current Exim <varname>$local_part</varname> available in the Perl variable <varname>$lp</varname>.
20615 Note those are single quotes and not double quotes to protect against
20616 <varname>$local_part</varname> being interpolated as a Perl variable.
20617 </para>
20618 <para>
20619 If the string expansion is forced to fail by a <quote>fail</quote> item, the result of
20620 <emphasis>Exim::expand_string()</emphasis> is <option>undef</option>. If there is a syntax error in the
20621 expansion string, the Perl call from the original expansion string fails with
20622 an appropriate error message, in the same way as if <option>die</option> were used.
20623 </para>
20624 <para>
20625 <indexterm role="concept">
20626 <primary>debugging</primary>
20627 <secondary>from embedded Perl</secondary>
20628 </indexterm>
20629 <indexterm role="concept">
20630 <primary>log</primary>
20631 <secondary>writing from embedded Perl</secondary>
20632 </indexterm>
20633 Two other Exim functions are available for use from within Perl code.
20634 <emphasis>Exim::debug_write()</emphasis> writes a string to the standard error stream if Exim&#x2019;s
20635 debugging is enabled. If you want a newline at the end, you must supply it.
20636 <emphasis>Exim::log_write()</emphasis> writes a string to Exim&#x2019;s main log, adding a leading
20637 timestamp. In this case, you should not supply a terminating newline.
20638 </para>
20639 </section>
20640 <section id="SECID88">
20641 <title>Use of standard output and error by Perl</title>
20642 <para>
20643 <indexterm role="concept">
20644 <primary>Perl</primary>
20645 <secondary>standard output and error</secondary>
20646 </indexterm>
20647 You should not write to the standard error or output streams from within your
20648 Perl code, as it is not defined how these are set up. In versions of Exim
20649 before 4.50, it is possible for the standard output or error to refer to the
20650 SMTP connection during message reception via the daemon. Writing to this stream
20651 is certain to cause chaos. From Exim 4.50 onwards, the standard output and
20652 error streams are connected to <filename>/dev/null</filename> in the daemon. The chaos is
20653 avoided, but the output is lost.
20654 </para>
20655 <para>
20656 <indexterm role="concept">
20657 <primary>Perl</primary>
20658 <secondary>use of <option>warn</option></secondary>
20659 </indexterm>
20660 The Perl <option>warn</option> statement writes to the standard error stream by default.
20661 Calls to <option>warn</option> may be embedded in Perl modules that you use, but over which
20662 you have no control. When Exim starts up the Perl interpreter, it arranges for
20663 output from the <option>warn</option> statement to be written to the Exim main log. You can
20664 change this by including appropriate Perl magic somewhere in your Perl code.
20665 For example, to discard <option>warn</option> output completely, you need this:
20666 </para>
20667 <literallayout class="monospaced">
20668 $SIG{__WARN__} = sub { };
20669 </literallayout>
20670 <para>
20671 Whenever a <option>warn</option> is obeyed, the anonymous subroutine is called. In this
20672 example, the code for the subroutine is empty, so it does nothing, but you can
20673 include any Perl code that you like. The text of the <option>warn</option> message is passed
20674 as the first subroutine argument.
20675 <indexterm role="concept" startref="IIDperl" class="endofrange"/>
20676 </para>
20677 </section>
20678 </chapter>
20679
20680 <chapter id="CHAPinterfaces">
20681 <title>Starting the daemon and the use of network interfaces</title>
20682 <titleabbrev>Starting the daemon</titleabbrev>
20683 <para>
20684 <indexterm role="concept">
20685 <primary>daemon</primary>
20686 <secondary>starting</secondary>
20687 </indexterm>
20688 <indexterm role="concept">
20689 <primary>interface</primary>
20690 <secondary>listening</secondary>
20691 </indexterm>
20692 <indexterm role="concept">
20693 <primary>network interface</primary>
20694 </indexterm>
20695 <indexterm role="concept">
20696 <primary>interface</primary>
20697 <secondary>network</secondary>
20698 </indexterm>
20699 <indexterm role="concept">
20700 <primary>IP address</primary>
20701 <secondary>for listening</secondary>
20702 </indexterm>
20703 <indexterm role="concept">
20704 <primary>daemon</primary>
20705 <secondary>listening IP addresses</secondary>
20706 </indexterm>
20707 <indexterm role="concept">
20708 <primary>TCP/IP</primary>
20709 <secondary>setting listening interfaces</secondary>
20710 </indexterm>
20711 <indexterm role="concept">
20712 <primary>TCP/IP</primary>
20713 <secondary>setting listening ports</secondary>
20714 </indexterm>
20715 A host that is connected to a TCP/IP network may have one or more physical
20716 hardware network interfaces. Each of these interfaces may be configured as one
20717 or more <quote>logical</quote> interfaces, which are the entities that a program actually
20718 works with. Each of these logical interfaces is associated with an IP address.
20719 In addition, TCP/IP software supports <quote>loopback</quote> interfaces (127.0.0.1 in
20720 IPv4 and ::1 in IPv6), which do not use any physical hardware. Exim requires
20721 knowledge about the host&#x2019;s interfaces for use in three different circumstances:
20722 </para>
20723 <orderedlist numeration="arabic">
20724 <listitem>
20725 <para>
20726 When a listening daemon is started, Exim needs to know which interfaces
20727 and ports to listen on.
20728 </para>
20729 </listitem>
20730 <listitem>
20731 <para>
20732 When Exim is routing an address, it needs to know which IP addresses
20733 are associated with local interfaces. This is required for the correct
20734 processing of MX lists by removing the local host and others with the
20735 same or higher priority values. Also, Exim needs to detect cases
20736 when an address is routed to an IP address that in fact belongs to the
20737 local host. Unless the <option>self</option> router option or the <option>allow_localhost</option>
20738 option of the smtp transport is set (as appropriate), this is treated
20739 as an error situation.
20740 </para>
20741 </listitem>
20742 <listitem>
20743 <para>
20744 When Exim connects to a remote host, it may need to know which interface to use
20745 for the outgoing connection.
20746 </para>
20747 </listitem>
20748 </orderedlist>
20749 <para>
20750 Exim&#x2019;s default behaviour is likely to be appropriate in the vast majority
20751 of cases. If your host has only one interface, and you want all its IP
20752 addresses to be treated in the same way, and you are using only the
20753 standard SMTP port, you should not need to take any special action. The
20754 rest of this chapter does not apply to you.
20755 </para>
20756 <para>
20757 In a more complicated situation you may want to listen only on certain
20758 interfaces, or on different ports, and for this reason there are a number of
20759 options that can be used to influence Exim&#x2019;s behaviour. The rest of this
20760 chapter describes how they operate.
20761 </para>
20762 <para>
20763 When a message is received over TCP/IP, the interface and port that were
20764 actually used are set in <varname>$received_ip_address</varname> and <varname>$received_port</varname>.
20765 </para>
20766 <section id="SECID89">
20767 <title>Starting a listening daemon</title>
20768 <para>
20769 When a listening daemon is started (by means of the <option>-bd</option> command line
20770 option), the interfaces and ports on which it listens are controlled by the
20771 following options:
20772 </para>
20773 <itemizedlist>
20774 <listitem>
20775 <para>
20776 <option>daemon_smtp_ports</option> contains a list of default ports
20777 or service names.
20778 (For backward compatibility, this option can also be specified in the singular.)
20779 </para>
20780 </listitem>
20781 <listitem>
20782 <para>
20783 <option>local_interfaces</option> contains list of interface IP addresses on which to
20784 listen. Each item may optionally also specify a port.
20785 </para>
20786 </listitem>
20787 </itemizedlist>
20788 <para>
20789 The default list separator in both cases is a colon, but this can be changed as
20790 described in section <xref linkend="SECTlistconstruct"/>. When IPv6 addresses are involved,
20791 it is usually best to change the separator to avoid having to double all the
20792 colons. For example:
20793 </para>
20794 <literallayout class="monospaced">
20795 local_interfaces = &lt;; 127.0.0.1 ; \
20796                       192.168.23.65 ; \
20797                       ::1 ; \
20798                       3ffe:ffff:836f::fe86:a061
20799 </literallayout>
20800 <para>
20801 There are two different formats for specifying a port along with an IP address
20802 in <option>local_interfaces</option>:
20803 </para>
20804 <orderedlist numeration="arabic">
20805 <listitem>
20806 <para>
20807 The port is added onto the address with a dot separator. For example, to listen
20808 on port 1234 on two different IP addresses:
20809 </para>
20810 <literallayout class="monospaced">
20811 local_interfaces = &lt;; 192.168.23.65.1234 ; \
20812                       3ffe:ffff:836f::fe86:a061.1234
20813 </literallayout>
20814 </listitem>
20815 <listitem>
20816 <para>
20817 The IP address is enclosed in square brackets, and the port is added
20818 with a colon separator, for example:
20819 </para>
20820 <literallayout class="monospaced">
20821 local_interfaces = &lt;; [192.168.23.65]:1234 ; \
20822                       [3ffe:ffff:836f::fe86:a061]:1234
20823 </literallayout>
20824 </listitem>
20825 </orderedlist>
20826 <para>
20827 When a port is not specified, the value of <option>daemon_smtp_ports</option> is used. The
20828 default setting contains just one port:
20829 </para>
20830 <literallayout class="monospaced">
20831 daemon_smtp_ports = smtp
20832 </literallayout>
20833 <para>
20834 If more than one port is listed, each interface that does not have its own port
20835 specified listens on all of them. Ports that are listed in
20836 <option>daemon_smtp_ports</option> can be identified either by name (defined in
20837 <filename>/etc/services</filename>) or by number. However, when ports are given with individual
20838 IP addresses in <option>local_interfaces</option>, only numbers (not names) can be used.
20839 </para>
20840 </section>
20841 <section id="SECID90">
20842 <title>Special IP listening addresses</title>
20843 <para>
20844 The addresses 0.0.0.0 and ::0 are treated specially. They are interpreted
20845 as <quote>all IPv4 interfaces</quote> and <quote>all IPv6 interfaces</quote>, respectively. In each
20846 case, Exim tells the TCP/IP stack to <quote>listen on all IPv<emphasis>x</emphasis> interfaces</quote>
20847 instead of setting up separate listening sockets for each interface. The
20848 default value of <option>local_interfaces</option> is
20849 </para>
20850 <literallayout class="monospaced">
20851 local_interfaces = 0.0.0.0
20852 </literallayout>
20853 <para>
20854 when Exim is built without IPv6 support; otherwise it is:
20855 </para>
20856 <literallayout class="monospaced">
20857 local_interfaces = &lt;; ::0 ; 0.0.0.0
20858 </literallayout>
20859 <para>
20860 Thus, by default, Exim listens on all available interfaces, on the SMTP port.
20861 </para>
20862 </section>
20863 <section id="SECID91">
20864 <title>Overriding local_interfaces and daemon_smtp_ports</title>
20865 <para>
20866 The <option>-oX</option> command line option can be used to override the values of
20867 <option>daemon_smtp_ports</option> and/or <option>local_interfaces</option> for a particular daemon
20868 instance. Another way of doing this would be to use macros and the <option>-D</option>
20869 option. However, <option>-oX</option> can be used by any admin user, whereas modification of
20870 the runtime configuration by <option>-D</option> is allowed only when the caller is root or
20871 exim.
20872 </para>
20873 <para>
20874 The value of <option>-oX</option> is a list of items. The default colon separator can be
20875 changed in the usual way if required. If there are any items that do not
20876 contain dots or colons (that is, are not IP addresses), the value of
20877 <option>daemon_smtp_ports</option> is replaced by the list of those items. If there are any
20878 items that do contain dots or colons, the value of <option>local_interfaces</option> is
20879 replaced by those items. Thus, for example,
20880 </para>
20881 <literallayout class="monospaced">
20882 -oX 1225
20883 </literallayout>
20884 <para>
20885 overrides <option>daemon_smtp_ports</option>, but leaves <option>local_interfaces</option> unchanged,
20886 whereas
20887 </para>
20888 <literallayout class="monospaced">
20889 -oX 192.168.34.5.1125
20890 </literallayout>
20891 <para>
20892 overrides <option>local_interfaces</option>, leaving <option>daemon_smtp_ports</option> unchanged.
20893 (However, since <option>local_interfaces</option> now contains no items without ports, the
20894 value of <option>daemon_smtp_ports</option> is no longer relevant in this example.)
20895 </para>
20896 </section>
20897 <section id="SECTsupobssmt">
20898 <title>Support for the obsolete SSMTP (or SMTPS) protocol</title>
20899 <para>
20900 <indexterm role="concept">
20901 <primary>ssmtp protocol</primary>
20902 </indexterm>
20903 <indexterm role="concept">
20904 <primary>smtps protocol</primary>
20905 </indexterm>
20906 <indexterm role="concept">
20907 <primary>SMTP</primary>
20908 <secondary>ssmtp protocol</secondary>
20909 </indexterm>
20910 <indexterm role="concept">
20911 <primary>SMTP</primary>
20912 <secondary>smtps protocol</secondary>
20913 </indexterm>
20914 Exim supports the obsolete SSMTP protocol (also known as SMTPS) that was used
20915 before the STARTTLS command was standardized for SMTP. Some legacy clients
20916 still use this protocol. If the <option>tls_on_connect_ports</option> option is set to a
20917 list of port numbers or service names,
20918 connections to those ports must use SSMTP. The most
20919 common use of this option is expected to be
20920 </para>
20921 <literallayout class="monospaced">
20922 tls_on_connect_ports = 465
20923 </literallayout>
20924 <para>
20925 because 465 is the usual port number used by the legacy clients. There is also
20926 a command line option <option>-tls-on-connect</option>, which forces all ports to behave in
20927 this way when a daemon is started.
20928 </para>
20929 <para>
20930 <emphasis role="bold">Warning</emphasis>: Setting <option>tls_on_connect_ports</option> does not of itself cause the
20931 daemon to listen on those ports. You must still specify them in
20932 <option>daemon_smtp_ports</option>, <option>local_interfaces</option>, or the <option>-oX</option> option. (This is
20933 because <option>tls_on_connect_ports</option> applies to <option>inetd</option> connections as well as to
20934 connections via the daemon.)
20935 </para>
20936 </section>
20937 <section id="SECID92">
20938 <title>IPv6 address scopes</title>
20939 <para>
20940 <indexterm role="concept">
20941 <primary>IPv6</primary>
20942 <secondary>address scopes</secondary>
20943 </indexterm>
20944 IPv6 addresses have <quote>scopes</quote>, and a host with multiple hardware interfaces
20945 can, in principle, have the same link-local IPv6 address on different
20946 interfaces. Thus, additional information is needed, over and above the IP
20947 address, to distinguish individual interfaces. A convention of using a
20948 percent sign followed by something (often the interface name) has been
20949 adopted in some cases, leading to addresses like this:
20950 </para>
20951 <literallayout class="monospaced">
20952 fe80::202:b3ff:fe03:45c1%eth0
20953 </literallayout>
20954 <para>
20955 To accommodate this usage, a percent sign followed by an arbitrary string is
20956 allowed at the end of an IPv6 address. By default, Exim calls <function>getaddrinfo()</function>
20957 to convert a textual IPv6 address for actual use. This function recognizes the
20958 percent convention in operating systems that support it, and it processes the
20959 address appropriately. Unfortunately, some older libraries have problems with
20960 <function>getaddrinfo()</function>. If
20961 </para>
20962 <literallayout class="monospaced">
20963 IPV6_USE_INET_PTON=yes
20964 </literallayout>
20965 <para>
20966 is set in <filename>Local/Makefile</filename> (or an OS-dependent Makefile) when Exim is built,
20967 Exim uses <emphasis>inet_pton()</emphasis> to convert a textual IPv6 address for actual use,
20968 instead of <function>getaddrinfo()</function>. (Before version 4.14, it always used this
20969 function.) Of course, this means that the additional functionality of
20970 <function>getaddrinfo()</function> &ndash; recognizing scoped addresses &ndash; is lost.
20971 </para>
20972 </section>
20973 <section id="SECID93">
20974 <title>Disabling IPv6</title>
20975 <para>
20976 <indexterm role="concept">
20977 <primary>IPv6</primary>
20978 <secondary>disabling</secondary>
20979 </indexterm>
20980 Sometimes it happens that an Exim binary that was compiled with IPv6 support is
20981 run on a host whose kernel does not support IPv6. The binary will fall back to
20982 using IPv4, but it may waste resources looking up AAAA records, and trying to
20983 connect to IPv6 addresses, causing delays to mail delivery. If you set the
20984 <indexterm role="option">
20985 <primary><option>disable_ipv6</option></primary>
20986 </indexterm>
20987 <option>disable_ipv6</option> option true, even if the Exim binary has IPv6 support, no IPv6
20988 activities take place. AAAA records are never looked up, and any IPv6 addresses
20989 that are listed in <option>local_interfaces</option>, data for the <command>manualroute</command> router,
20990 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
20991 to handle IPv6 literal addresses.
20992 </para>
20993 <para>
20994 On the other hand, when IPv6 is in use, there may be times when you want to
20995 disable it for certain hosts or domains. You can use the <option>dns_ipv4_lookup</option>
20996 option to globally suppress the lookup of AAAA records for specified domains,
20997 and you can use the <option>ignore_target_hosts</option> generic router option to ignore
20998 IPv6 addresses in an individual router.
20999 </para>
21000 </section>
21001 <section id="SECID94">
21002 <title>Examples of starting a listening daemon</title>
21003 <para>
21004 The default case in an IPv6 environment is
21005 </para>
21006 <literallayout class="monospaced">
21007 daemon_smtp_ports = smtp
21008 local_interfaces = &lt;; ::0 ; 0.0.0.0
21009 </literallayout>
21010 <para>
21011 This specifies listening on the smtp port on all IPv6 and IPv4 interfaces.
21012 Either one or two sockets may be used, depending on the characteristics of
21013 the TCP/IP stack. (This is complicated and messy; for more information,
21014 read the comments in the <filename>daemon.c</filename> source file.)
21015 </para>
21016 <para>
21017 To specify listening on ports 25 and 26 on all interfaces:
21018 </para>
21019 <literallayout class="monospaced">
21020 daemon_smtp_ports = 25 : 26
21021 </literallayout>
21022 <para>
21023 (leaving <option>local_interfaces</option> at the default setting) or, more explicitly:
21024 </para>
21025 <literallayout class="monospaced">
21026 local_interfaces = &lt;; ::0.25     ; ::0.26 \
21027                       0.0.0.0.25 ; 0.0.0.0.26
21028 </literallayout>
21029 <para>
21030 To listen on the default port on all IPv4 interfaces, and on port 26 on the
21031 IPv4 loopback address only:
21032 </para>
21033 <literallayout class="monospaced">
21034 local_interfaces = 0.0.0.0 : 127.0.0.1.26
21035 </literallayout>
21036 <para>
21037 To specify listening on the default port on specific interfaces only:
21038 </para>
21039 <literallayout class="monospaced">
21040 local_interfaces = 10.0.0.67 : 192.168.34.67
21041 </literallayout>
21042 <para>
21043 <emphasis role="bold">Warning</emphasis>: Such a setting excludes listening on the loopback interfaces.
21044 </para>
21045 </section>
21046 <section id="SECTreclocipadd">
21047 <title>Recognizing the local host</title>
21048 <para>
21049 The <option>local_interfaces</option> option is also used when Exim needs to determine
21050 whether or not an IP address refers to the local host. That is, the IP
21051 addresses of all the interfaces on which a daemon is listening are always
21052 treated as local.
21053 </para>
21054 <para>
21055 For this usage, port numbers in <option>local_interfaces</option> are ignored. If either of
21056 the items 0.0.0.0 or ::0 are encountered, Exim gets a complete list of
21057 available interfaces from the operating system, and extracts the relevant
21058 (that is, IPv4 or IPv6) addresses to use for checking.
21059 </para>
21060 <para>
21061 Some systems set up large numbers of virtual interfaces in order to provide
21062 many virtual web servers. In this situation, you may want to listen for
21063 email on only a few of the available interfaces, but nevertheless treat all
21064 interfaces as local when routing. You can do this by setting
21065 <option>extra_local_interfaces</option> to a list of IP addresses, possibly including the
21066 <quote>all</quote> wildcard values. These addresses are recognized as local, but are not
21067 used for listening. Consider this example:
21068 </para>
21069 <literallayout class="monospaced">
21070 local_interfaces = &lt;; 127.0.0.1 ; ::1 ; \
21071                       192.168.53.235 ; \
21072                       3ffe:2101:12:1:a00:20ff:fe86:a061
21073
21074 extra_local_interfaces = &lt;; ::0 ; 0.0.0.0
21075 </literallayout>
21076 <para>
21077 The daemon listens on the loopback interfaces and just one IPv4 and one IPv6
21078 address, but all available interface addresses are treated as local when
21079 Exim is routing.
21080 </para>
21081 <para>
21082 In some environments the local host name may be in an MX list, but with an IP
21083 address that is not assigned to any local interface. In other cases it may be
21084 desirable to treat other host names as if they referred to the local host. Both
21085 these cases can be handled by setting the <option>hosts_treat_as_local</option> option.
21086 This contains host names rather than IP addresses. When a host is referenced
21087 during routing, either via an MX record or directly, it is treated as the local
21088 host if its name matches <option>hosts_treat_as_local</option>, or if any of its IP
21089 addresses match <option>local_interfaces</option> or <option>extra_local_interfaces</option>.
21090 </para>
21091 </section>
21092 <section id="SECID95">
21093 <title>Delivering to a remote host</title>
21094 <para>
21095 Delivery to a remote host is handled by the smtp transport. By default, it
21096 allows the system&#x2019;s TCP/IP functions to choose which interface to use (if
21097 there is more than one) when connecting to a remote host. However, the
21098 <option>interface</option> option can be set to specify which interface is used. See the
21099 description of the smtp transport in chapter <xref linkend="CHAPsmtptrans"/> for more
21100 details.
21101 </para>
21102 </section>
21103 </chapter>
21104
21105 <chapter id="CHAPmainconfig">
21106 <title>Main configuration</title>
21107 <para>
21108 <indexterm role="concept" id="IIDconfima" class="startofrange">
21109 <primary>configuration file</primary>
21110 <secondary>main section</secondary>
21111 </indexterm>
21112 <indexterm role="concept" id="IIDmaiconf" class="startofrange">
21113 <primary>main configuration</primary>
21114 </indexterm>
21115 The first part of the run time configuration file contains three types of item:
21116 </para>
21117 <itemizedlist>
21118 <listitem>
21119 <para>
21120 Macro definitions: These lines start with an upper case letter. See section
21121 <xref linkend="SECTmacrodefs"/> for details of macro processing.
21122 </para>
21123 </listitem>
21124 <listitem>
21125 <para>
21126 Named list definitions: These lines start with one of the words <quote>domainlist</quote>,
21127 <quote>hostlist</quote>, <quote>addresslist</quote>, or <quote>localpartlist</quote>. Their use is described in
21128 section <xref linkend="SECTnamedlists"/>.
21129 </para>
21130 </listitem>
21131 <listitem>
21132 <para>
21133 Main configuration settings: Each setting occupies one line of the file
21134 (with possible continuations). If any setting is preceded by the word
21135 <quote>hide</quote>, the <option>-bP</option> command line option displays its value to admin users
21136 only. See section <xref linkend="SECTcos"/> for a description of the syntax of these option
21137 settings.
21138 </para>
21139 </listitem>
21140 </itemizedlist>
21141 <para>
21142 This chapter specifies all the main configuration options, along with their
21143 types and default values. For ease of finding a particular option, they appear
21144 in alphabetical order in section <xref linkend="SECTalomo"/> below. However, because there
21145 are now so many options, they are first listed briefly in functional groups, as
21146 an aid to finding the name of the option you are looking for. Some options are
21147 listed in more than one group.
21148 </para>
21149 <section id="SECID96">
21150 <title>Miscellaneous</title>
21151 <informaltable frame="none">
21152 <tgroup cols="2" colsep="0" rowsep="0">
21153 <colspec colwidth="196pt" align="left"/>
21154 <colspec colwidth="254pt" align="left"/>
21155 <tbody>
21156 <row>
21157 <entry><option>bi_command</option></entry>
21158 <entry>to run for <option>-bi</option> command line option</entry>
21159 </row>
21160 <row>
21161 <entry><option>debug_store</option></entry>
21162 <entry>do extra internal checks</entry>
21163 </row>
21164 <row>
21165 <entry><option>disable_ipv6</option></entry>
21166 <entry>do no IPv6 processing</entry>
21167 </row>
21168 <row>
21169 <entry><option>keep_malformed</option></entry>
21170 <entry>for broken files &ndash; should not happen</entry>
21171 </row>
21172 <row>
21173 <entry><option>localhost_number</option></entry>
21174 <entry>for unique message ids in clusters</entry>
21175 </row>
21176 <row>
21177 <entry><option>message_body_newlines</option></entry>
21178 <entry>retain newlines in <varname>$message_body</varname></entry>
21179 </row>
21180 <row>
21181 <entry><option>message_body_visible</option></entry>
21182 <entry>how much to show in <varname>$message_body</varname></entry>
21183 </row>
21184 <row>
21185 <entry><option>mua_wrapper</option></entry>
21186 <entry>run in <quote>MUA wrapper</quote> mode</entry>
21187 </row>
21188 <row>
21189 <entry><option>print_topbitchars</option></entry>
21190 <entry>top-bit characters are printing</entry>
21191 </row>
21192 <row>
21193 <entry><option>spool_wireformat</option></entry>
21194 <entry>use wire-format spool data files when possible</entry>
21195 </row>
21196 <row>
21197 <entry><option>timezone</option></entry>
21198 <entry>force time zone</entry>
21199 </row>
21200 </tbody>
21201 </tgroup>
21202 </informaltable>
21203 </section>
21204 <section id="SECID97">
21205 <title>Exim parameters</title>
21206 <informaltable frame="none">
21207 <tgroup cols="2" colsep="0" rowsep="0">
21208 <colspec colwidth="196pt" align="left"/>
21209 <colspec colwidth="254pt" align="left"/>
21210 <tbody>
21211 <row>
21212 <entry><option>exim_group</option></entry>
21213 <entry>override compiled-in value</entry>
21214 </row>
21215 <row>
21216 <entry><option>exim_path</option></entry>
21217 <entry>override compiled-in value</entry>
21218 </row>
21219 <row>
21220 <entry><option>exim_user</option></entry>
21221 <entry>override compiled-in value</entry>
21222 </row>
21223 <row>
21224 <entry><option>primary_hostname</option></entry>
21225 <entry>default from <function>uname()</function></entry>
21226 </row>
21227 <row>
21228 <entry><option>split_spool_directory</option></entry>
21229 <entry>use multiple directories</entry>
21230 </row>
21231 <row>
21232 <entry><option>spool_directory</option></entry>
21233 <entry>override compiled-in value</entry>
21234 </row>
21235 </tbody>
21236 </tgroup>
21237 </informaltable>
21238 </section>
21239 <section id="SECID98">
21240 <title>Privilege controls</title>
21241 <informaltable frame="none">
21242 <tgroup cols="2" colsep="0" rowsep="0">
21243 <colspec colwidth="196pt" align="left"/>
21244 <colspec colwidth="254pt" align="left"/>
21245 <tbody>
21246 <row>
21247 <entry><option>admin_groups</option></entry>
21248 <entry>groups that are Exim admin users</entry>
21249 </row>
21250 <row>
21251 <entry><option>commandline_checks_require_admin</option></entry>
21252 <entry>require admin for various checks</entry>
21253 </row>
21254 <row>
21255 <entry><option>deliver_drop_privilege</option></entry>
21256 <entry>drop root for delivery processes</entry>
21257 </row>
21258 <row>
21259 <entry><option>local_from_check</option></entry>
21260 <entry>insert <emphasis>Sender:</emphasis> if necessary</entry>
21261 </row>
21262 <row>
21263 <entry><option>local_from_prefix</option></entry>
21264 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
21265 </row>
21266 <row>
21267 <entry><option>local_from_suffix</option></entry>
21268 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
21269 </row>
21270 <row>
21271 <entry><option>local_sender_retain</option></entry>
21272 <entry>keep <emphasis>Sender:</emphasis> from untrusted user</entry>
21273 </row>
21274 <row>
21275 <entry><option>never_users</option></entry>
21276 <entry>do not run deliveries as these</entry>
21277 </row>
21278 <row>
21279 <entry><option>prod_requires_admin</option></entry>
21280 <entry>forced delivery requires admin user</entry>
21281 </row>
21282 <row>
21283 <entry><option>queue_list_requires_admin</option></entry>
21284 <entry>queue listing requires admin user</entry>
21285 </row>
21286 <row>
21287 <entry><option>trusted_groups</option></entry>
21288 <entry>groups that are trusted</entry>
21289 </row>
21290 <row>
21291 <entry><option>trusted_users</option></entry>
21292 <entry>users that are trusted</entry>
21293 </row>
21294 </tbody>
21295 </tgroup>
21296 </informaltable>
21297 </section>
21298 <section id="SECID99">
21299 <title>Logging</title>
21300 <informaltable frame="none">
21301 <tgroup cols="2" colsep="0" rowsep="0">
21302 <colspec colwidth="196pt" align="left"/>
21303 <colspec colwidth="254pt" align="left"/>
21304 <tbody>
21305 <row>
21306 <entry><option>event_action</option></entry>
21307 <entry>custom logging</entry>
21308 </row>
21309 <row>
21310 <entry><option>hosts_connection_nolog</option></entry>
21311 <entry>exemption from connect logging</entry>
21312 </row>
21313 <row>
21314 <entry><option>log_file_path</option></entry>
21315 <entry>override compiled-in value</entry>
21316 </row>
21317 <row>
21318 <entry><option>log_selector</option></entry>
21319 <entry>set/unset optional logging</entry>
21320 </row>
21321 <row>
21322 <entry><option>log_timezone</option></entry>
21323 <entry>add timezone to log lines</entry>
21324 </row>
21325 <row>
21326 <entry><option>message_logs</option></entry>
21327 <entry>create per-message logs</entry>
21328 </row>
21329 <row>
21330 <entry><option>preserve_message_logs</option></entry>
21331 <entry>after message completion</entry>
21332 </row>
21333 <row>
21334 <entry><option>process_log_path</option></entry>
21335 <entry>for SIGUSR1 and <emphasis>exiwhat</emphasis></entry>
21336 </row>
21337 <row>
21338 <entry><option>slow_lookup_log</option></entry>
21339 <entry>control logging of slow DNS lookups</entry>
21340 </row>
21341 <row>
21342 <entry><option>syslog_duplication</option></entry>
21343 <entry>controls duplicate log lines on syslog</entry>
21344 </row>
21345 <row>
21346 <entry><option>syslog_facility</option></entry>
21347 <entry>set syslog <quote>facility</quote> field</entry>
21348 </row>
21349 <row>
21350 <entry><option>syslog_pid</option></entry>
21351 <entry>pid in syslog lines</entry>
21352 </row>
21353 <row>
21354 <entry><option>syslog_processname</option></entry>
21355 <entry>set syslog <quote>ident</quote> field</entry>
21356 </row>
21357 <row>
21358 <entry><option>syslog_timestamp</option></entry>
21359 <entry>timestamp syslog lines</entry>
21360 </row>
21361 <row>
21362 <entry><option>write_rejectlog</option></entry>
21363 <entry>control use of message log</entry>
21364 </row>
21365 </tbody>
21366 </tgroup>
21367 </informaltable>
21368 </section>
21369 <section id="SECID100">
21370 <title>Frozen messages</title>
21371 <informaltable frame="none">
21372 <tgroup cols="2" colsep="0" rowsep="0">
21373 <colspec colwidth="196pt" align="left"/>
21374 <colspec colwidth="254pt" align="left"/>
21375 <tbody>
21376 <row>
21377 <entry><option>auto_thaw</option></entry>
21378 <entry>sets time for retrying frozen messages</entry>
21379 </row>
21380 <row>
21381 <entry><option>freeze_tell</option></entry>
21382 <entry>send message when freezing</entry>
21383 </row>
21384 <row>
21385 <entry><option>move_frozen_messages</option></entry>
21386 <entry>to another directory</entry>
21387 </row>
21388 <row>
21389 <entry><option>timeout_frozen_after</option></entry>
21390 <entry>keep frozen messages only so long</entry>
21391 </row>
21392 </tbody>
21393 </tgroup>
21394 </informaltable>
21395 </section>
21396 <section id="SECID101">
21397 <title>Data lookups</title>
21398 <informaltable frame="none">
21399 <tgroup cols="2" colsep="0" rowsep="0">
21400 <colspec colwidth="196pt" align="left"/>
21401 <colspec colwidth="254pt" align="left"/>
21402 <tbody>
21403 <row>
21404 <entry><option>ibase_servers</option></entry>
21405 <entry>InterBase servers</entry>
21406 </row>
21407 <row>
21408 <entry><option>ldap_ca_cert_dir</option></entry>
21409 <entry>dir of CA certs to verify LDAP server&#x2019;s</entry>
21410 </row>
21411 <row>
21412 <entry><option>ldap_ca_cert_file</option></entry>
21413 <entry>file of CA certs to verify LDAP server&#x2019;s</entry>
21414 </row>
21415 <row>
21416 <entry><option>ldap_cert_file</option></entry>
21417 <entry>client cert file for LDAP</entry>
21418 </row>
21419 <row>
21420 <entry><option>ldap_cert_key</option></entry>
21421 <entry>client key file for LDAP</entry>
21422 </row>
21423 <row>
21424 <entry><option>ldap_cipher_suite</option></entry>
21425 <entry>TLS negotiation preference control</entry>
21426 </row>
21427 <row>
21428 <entry><option>ldap_default_servers</option></entry>
21429 <entry>used if no server in query</entry>
21430 </row>
21431 <row>
21432 <entry><option>ldap_require_cert</option></entry>
21433 <entry>action to take without LDAP server cert</entry>
21434 </row>
21435 <row>
21436 <entry><option>ldap_start_tls</option></entry>
21437 <entry>require TLS within LDAP</entry>
21438 </row>
21439 <row>
21440 <entry><option>ldap_version</option></entry>
21441 <entry>set protocol version</entry>
21442 </row>
21443 <row>
21444 <entry><option>lookup_open_max</option></entry>
21445 <entry>lookup files held open</entry>
21446 </row>
21447 <row>
21448 <entry><option>mysql_servers</option></entry>
21449 <entry>default MySQL servers</entry>
21450 </row>
21451 <row>
21452 <entry><option>oracle_servers</option></entry>
21453 <entry>Oracle servers</entry>
21454 </row>
21455 <row>
21456 <entry><option>pgsql_servers</option></entry>
21457 <entry>default PostgreSQL servers</entry>
21458 </row>
21459 <row>
21460 <entry><option>sqlite_lock_timeout</option></entry>
21461 <entry>as it says</entry>
21462 </row>
21463 </tbody>
21464 </tgroup>
21465 </informaltable>
21466 </section>
21467 <section id="SECID102">
21468 <title>Message ids</title>
21469 <informaltable frame="none">
21470 <tgroup cols="2" colsep="0" rowsep="0">
21471 <colspec colwidth="196pt" align="left"/>
21472 <colspec colwidth="254pt" align="left"/>
21473 <tbody>
21474 <row>
21475 <entry><option>message_id_header_domain</option></entry>
21476 <entry>used to build <emphasis>Message-ID:</emphasis> header</entry>
21477 </row>
21478 <row>
21479 <entry><option>message_id_header_text</option></entry>
21480 <entry>ditto</entry>
21481 </row>
21482 </tbody>
21483 </tgroup>
21484 </informaltable>
21485 </section>
21486 <section id="SECID103">
21487 <title>Embedded Perl Startup</title>
21488 <informaltable frame="none">
21489 <tgroup cols="2" colsep="0" rowsep="0">
21490 <colspec colwidth="196pt" align="left"/>
21491 <colspec colwidth="254pt" align="left"/>
21492 <tbody>
21493 <row>
21494 <entry><option>perl_at_start</option></entry>
21495 <entry>always start the interpreter</entry>
21496 </row>
21497 <row>
21498 <entry><option>perl_startup</option></entry>
21499 <entry>code to obey when starting Perl</entry>
21500 </row>
21501 <row>
21502 <entry><option>perl_taintmode</option></entry>
21503 <entry>enable taint mode in Perl</entry>
21504 </row>
21505 </tbody>
21506 </tgroup>
21507 </informaltable>
21508 </section>
21509 <section id="SECID104">
21510 <title>Daemon</title>
21511 <informaltable frame="none">
21512 <tgroup cols="2" colsep="0" rowsep="0">
21513 <colspec colwidth="196pt" align="left"/>
21514 <colspec colwidth="254pt" align="left"/>
21515 <tbody>
21516 <row>
21517 <entry><option>daemon_smtp_ports</option></entry>
21518 <entry>default ports</entry>
21519 </row>
21520 <row>
21521 <entry><option>daemon_startup_retries</option></entry>
21522 <entry>number of times to retry</entry>
21523 </row>
21524 <row>
21525 <entry><option>daemon_startup_sleep</option></entry>
21526 <entry>time to sleep between tries</entry>
21527 </row>
21528 <row>
21529 <entry><option>extra_local_interfaces</option></entry>
21530 <entry>not necessarily listened on</entry>
21531 </row>
21532 <row>
21533 <entry><option>local_interfaces</option></entry>
21534 <entry>on which to listen, with optional ports</entry>
21535 </row>
21536 <row>
21537 <entry><option>pid_file_path</option></entry>
21538 <entry>override compiled-in value</entry>
21539 </row>
21540 <row>
21541 <entry><option>queue_run_max</option></entry>
21542 <entry>maximum simultaneous queue runners</entry>
21543 </row>
21544 </tbody>
21545 </tgroup>
21546 </informaltable>
21547 </section>
21548 <section id="SECID105">
21549 <title>Resource control</title>
21550 <informaltable frame="none">
21551 <tgroup cols="2" colsep="0" rowsep="0">
21552 <colspec colwidth="196pt" align="left"/>
21553 <colspec colwidth="254pt" align="left"/>
21554 <tbody>
21555 <row>
21556 <entry><option>check_log_inodes</option></entry>
21557 <entry>before accepting a message</entry>
21558 </row>
21559 <row>
21560 <entry><option>check_log_space</option></entry>
21561 <entry>before accepting a message</entry>
21562 </row>
21563 <row>
21564 <entry><option>check_spool_inodes</option></entry>
21565 <entry>before accepting a message</entry>
21566 </row>
21567 <row>
21568 <entry><option>check_spool_space</option></entry>
21569 <entry>before accepting a message</entry>
21570 </row>
21571 <row>
21572 <entry><option>deliver_queue_load_max</option></entry>
21573 <entry>no queue deliveries if load high</entry>
21574 </row>
21575 <row>
21576 <entry><option>queue_only_load</option></entry>
21577 <entry>queue incoming if load high</entry>
21578 </row>
21579 <row>
21580 <entry><option>queue_only_load_latch</option></entry>
21581 <entry>don&#x2019;t re-evaluate load for each message</entry>
21582 </row>
21583 <row>
21584 <entry><option>queue_run_max</option></entry>
21585 <entry>maximum simultaneous queue runners</entry>
21586 </row>
21587 <row>
21588 <entry><option>remote_max_parallel</option></entry>
21589 <entry>parallel SMTP delivery per message</entry>
21590 </row>
21591 <row>
21592 <entry><option>smtp_accept_max</option></entry>
21593 <entry>simultaneous incoming connections</entry>
21594 </row>
21595 <row>
21596 <entry><option>smtp_accept_max_nonmail</option></entry>
21597 <entry>non-mail commands</entry>
21598 </row>
21599 <row>
21600 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
21601 <entry>hosts to which the limit applies</entry>
21602 </row>
21603 <row>
21604 <entry><option>smtp_accept_max_per_connection</option></entry>
21605 <entry>messages per connection</entry>
21606 </row>
21607 <row>
21608 <entry><option>smtp_accept_max_per_host</option></entry>
21609 <entry>connections from one host</entry>
21610 </row>
21611 <row>
21612 <entry><option>smtp_accept_queue</option></entry>
21613 <entry>queue mail if more connections</entry>
21614 </row>
21615 <row>
21616 <entry><option>smtp_accept_queue_per_connection</option></entry>
21617 <entry>queue if more messages per connection</entry>
21618 </row>
21619 <row>
21620 <entry><option>smtp_accept_reserve</option></entry>
21621 <entry>only reserve hosts if more connections</entry>
21622 </row>
21623 <row>
21624 <entry><option>smtp_check_spool_space</option></entry>
21625 <entry>from SIZE on MAIL command</entry>
21626 </row>
21627 <row>
21628 <entry><option>smtp_connect_backlog</option></entry>
21629 <entry>passed to TCP/IP stack</entry>
21630 </row>
21631 <row>
21632 <entry><option>smtp_load_reserve</option></entry>
21633 <entry>SMTP from reserved hosts if load high</entry>
21634 </row>
21635 <row>
21636 <entry><option>smtp_reserve_hosts</option></entry>
21637 <entry>these are the reserve hosts</entry>
21638 </row>
21639 </tbody>
21640 </tgroup>
21641 </informaltable>
21642 </section>
21643 <section id="SECID106">
21644 <title>Policy controls</title>
21645 <informaltable frame="none">
21646 <tgroup cols="2" colsep="0" rowsep="0">
21647 <colspec colwidth="196pt" align="left"/>
21648 <colspec colwidth="254pt" align="left"/>
21649 <tbody>
21650 <row>
21651 <entry><option>acl_not_smtp</option></entry>
21652 <entry>ACL for non-SMTP messages</entry>
21653 </row>
21654 <row>
21655 <entry><option>acl_not_smtp_mime</option></entry>
21656 <entry>ACL for non-SMTP MIME parts</entry>
21657 </row>
21658 <row>
21659 <entry><option>acl_not_smtp_start</option></entry>
21660 <entry>ACL for start of non-SMTP message</entry>
21661 </row>
21662 <row>
21663 <entry><option>acl_smtp_auth</option></entry>
21664 <entry>ACL for AUTH</entry>
21665 </row>
21666 <row>
21667 <entry><option>acl_smtp_connect</option></entry>
21668 <entry>ACL for connection</entry>
21669 </row>
21670 <row>
21671 <entry><option>acl_smtp_data</option></entry>
21672 <entry>ACL for DATA</entry>
21673 </row>
21674 <row>
21675 <entry><option>acl_smtp_data_prdr</option></entry>
21676 <entry>ACL for DATA, per-recipient</entry>
21677 </row>
21678 <row>
21679 <entry><option>acl_smtp_dkim</option></entry>
21680 <entry>ACL for DKIM verification</entry>
21681 </row>
21682 <row>
21683 <entry><option>acl_smtp_etrn</option></entry>
21684 <entry>ACL for ETRN</entry>
21685 </row>
21686 <row>
21687 <entry><option>acl_smtp_expn</option></entry>
21688 <entry>ACL for EXPN</entry>
21689 </row>
21690 <row>
21691 <entry><option>acl_smtp_helo</option></entry>
21692 <entry>ACL for EHLO or HELO</entry>
21693 </row>
21694 <row>
21695 <entry><option>acl_smtp_mail</option></entry>
21696 <entry>ACL for MAIL</entry>
21697 </row>
21698 <row>
21699 <entry><option>acl_smtp_mailauth</option></entry>
21700 <entry>ACL for AUTH on MAIL command</entry>
21701 </row>
21702 <row>
21703 <entry><option>acl_smtp_mime</option></entry>
21704 <entry>ACL for MIME parts</entry>
21705 </row>
21706 <row>
21707 <entry><option>acl_smtp_notquit</option></entry>
21708 <entry>ACL for non-QUIT terminations</entry>
21709 </row>
21710 <row>
21711 <entry><option>acl_smtp_predata</option></entry>
21712 <entry>ACL for start of data</entry>
21713 </row>
21714 <row>
21715 <entry><option>acl_smtp_quit</option></entry>
21716 <entry>ACL for QUIT</entry>
21717 </row>
21718 <row>
21719 <entry><option>acl_smtp_rcpt</option></entry>
21720 <entry>ACL for RCPT</entry>
21721 </row>
21722 <row>
21723 <entry><option>acl_smtp_starttls</option></entry>
21724 <entry>ACL for STARTTLS</entry>
21725 </row>
21726 <row>
21727 <entry><option>acl_smtp_vrfy</option></entry>
21728 <entry>ACL for VRFY</entry>
21729 </row>
21730 <row>
21731 <entry><option>av_scanner</option></entry>
21732 <entry>specify virus scanner</entry>
21733 </row>
21734 <row>
21735 <entry><option>check_rfc2047_length</option></entry>
21736 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
21737 </row>
21738 <row>
21739 <entry><option>dns_csa_search_limit</option></entry>
21740 <entry>control CSA parent search depth</entry>
21741 </row>
21742 <row>
21743 <entry><option>dns_csa_use_reverse</option></entry>
21744 <entry>en/disable CSA IP reverse search</entry>
21745 </row>
21746 <row>
21747 <entry><option>header_maxsize</option></entry>
21748 <entry>total size of message header</entry>
21749 </row>
21750 <row>
21751 <entry><option>header_line_maxsize</option></entry>
21752 <entry>individual header line limit</entry>
21753 </row>
21754 <row>
21755 <entry><option>helo_accept_junk_hosts</option></entry>
21756 <entry>allow syntactic junk from these hosts</entry>
21757 </row>
21758 <row>
21759 <entry><option>helo_allow_chars</option></entry>
21760 <entry>allow illegal chars in HELO names</entry>
21761 </row>
21762 <row>
21763 <entry><option>helo_lookup_domains</option></entry>
21764 <entry>lookup hostname for these HELO names</entry>
21765 </row>
21766 <row>
21767 <entry><option>helo_try_verify_hosts</option></entry>
21768 <entry>HELO soft-checked for these hosts</entry>
21769 </row>
21770 <row>
21771 <entry><option>helo_verify_hosts</option></entry>
21772 <entry>HELO hard-checked for these hosts</entry>
21773 </row>
21774 <row>
21775 <entry><option>host_lookup</option></entry>
21776 <entry>host name looked up for these hosts</entry>
21777 </row>
21778 <row>
21779 <entry><option>host_lookup_order</option></entry>
21780 <entry>order of DNS and local name lookups</entry>
21781 </row>
21782 <row>
21783 <entry><option>hosts_proxy</option></entry>
21784 <entry>use proxy protocol for these hosts</entry>
21785 </row>
21786 <row>
21787 <entry><option>host_reject_connection</option></entry>
21788 <entry>reject connection from these hosts</entry>
21789 </row>
21790 <row>
21791 <entry><option>hosts_treat_as_local</option></entry>
21792 <entry>useful in some cluster configurations</entry>
21793 </row>
21794 <row>
21795 <entry><option>local_scan_timeout</option></entry>
21796 <entry>timeout for <function>local_scan()</function></entry>
21797 </row>
21798 <row>
21799 <entry><option>message_size_limit</option></entry>
21800 <entry>for all messages</entry>
21801 </row>
21802 <row>
21803 <entry><option>percent_hack_domains</option></entry>
21804 <entry>recognize %-hack for these domains</entry>
21805 </row>
21806 <row>
21807 <entry><option>spamd_address</option></entry>
21808 <entry>set interface to SpamAssassin</entry>
21809 </row>
21810 <row>
21811 <entry><option>strict_acl_vars</option></entry>
21812 <entry>object to unset ACL variables</entry>
21813 </row>
21814 </tbody>
21815 </tgroup>
21816 </informaltable>
21817 </section>
21818 <section id="SECID107">
21819 <title>Callout cache</title>
21820 <informaltable frame="none">
21821 <tgroup cols="2" colsep="0" rowsep="0">
21822 <colspec colwidth="196pt" align="left"/>
21823 <colspec colwidth="254pt" align="left"/>
21824 <tbody>
21825 <row>
21826 <entry><option>callout_domain_negative_expire</option></entry>
21827 <entry>timeout for negative domain cache item</entry>
21828 </row>
21829 <row>
21830 <entry><option>callout_domain_positive_expire</option></entry>
21831 <entry>timeout for positive domain cache item</entry>
21832 </row>
21833 <row>
21834 <entry><option>callout_negative_expire</option></entry>
21835 <entry>timeout for negative address cache item</entry>
21836 </row>
21837 <row>
21838 <entry><option>callout_positive_expire</option></entry>
21839 <entry>timeout for positive address cache item</entry>
21840 </row>
21841 <row>
21842 <entry><option>callout_random_local_part</option></entry>
21843 <entry>string to use for <quote>random</quote> testing</entry>
21844 </row>
21845 </tbody>
21846 </tgroup>
21847 </informaltable>
21848 </section>
21849 <section id="SECID108">
21850 <title>TLS</title>
21851 <informaltable frame="none">
21852 <tgroup cols="2" colsep="0" rowsep="0">
21853 <colspec colwidth="196pt" align="left"/>
21854 <colspec colwidth="254pt" align="left"/>
21855 <tbody>
21856 <row>
21857 <entry><option>gnutls_compat_mode</option></entry>
21858 <entry>use GnuTLS compatibility mode</entry>
21859 </row>
21860 <row>
21861 <entry><option>gnutls_allow_auto_pkcs11</option></entry>
21862 <entry>allow GnuTLS to autoload PKCS11 modules</entry>
21863 </row>
21864 <row>
21865 <entry><option>openssl_options</option></entry>
21866 <entry>adjust OpenSSL compatibility options</entry>
21867 </row>
21868 <row>
21869 <entry><option>tls_advertise_hosts</option></entry>
21870 <entry>advertise TLS to these hosts</entry>
21871 </row>
21872 <row>
21873 <entry><option>tls_certificate</option></entry>
21874 <entry>location of server certificate</entry>
21875 </row>
21876 <row>
21877 <entry><option>tls_crl</option></entry>
21878 <entry>certificate revocation list</entry>
21879 </row>
21880 <row>
21881 <entry><option>tls_dh_max_bits</option></entry>
21882 <entry>clamp D-H bit count suggestion</entry>
21883 </row>
21884 <row>
21885 <entry><option>tls_dhparam</option></entry>
21886 <entry>DH parameters for server</entry>
21887 </row>
21888 <row>
21889 <entry><option>tls_eccurve</option></entry>
21890 <entry>EC curve selection for server</entry>
21891 </row>
21892 <row>
21893 <entry><option>tls_ocsp_file</option></entry>
21894 <entry>location of server certificate status proof</entry>
21895 </row>
21896 <row>
21897 <entry><option>tls_on_connect_ports</option></entry>
21898 <entry>specify SSMTP (SMTPS) ports</entry>
21899 </row>
21900 <row>
21901 <entry><option>tls_privatekey</option></entry>
21902 <entry>location of server private key</entry>
21903 </row>
21904 <row>
21905 <entry><option>tls_remember_esmtp</option></entry>
21906 <entry>don&#x2019;t reset after starting TLS</entry>
21907 </row>
21908 <row>
21909 <entry><option>tls_require_ciphers</option></entry>
21910 <entry>specify acceptable ciphers</entry>
21911 </row>
21912 <row>
21913 <entry><option>tls_try_verify_hosts</option></entry>
21914 <entry>try to verify client certificate</entry>
21915 </row>
21916 <row>
21917 <entry><option>tls_verify_certificates</option></entry>
21918 <entry>expected client certificates</entry>
21919 </row>
21920 <row>
21921 <entry><option>tls_verify_hosts</option></entry>
21922 <entry>insist on client certificate verify</entry>
21923 </row>
21924 </tbody>
21925 </tgroup>
21926 </informaltable>
21927 </section>
21928 <section id="SECID109">
21929 <title>Local user handling</title>
21930 <informaltable frame="none">
21931 <tgroup cols="2" colsep="0" rowsep="0">
21932 <colspec colwidth="196pt" align="left"/>
21933 <colspec colwidth="254pt" align="left"/>
21934 <tbody>
21935 <row>
21936 <entry><option>finduser_retries</option></entry>
21937 <entry>useful in NIS environments</entry>
21938 </row>
21939 <row>
21940 <entry><option>gecos_name</option></entry>
21941 <entry>used when creating <emphasis>Sender:</emphasis></entry>
21942 </row>
21943 <row>
21944 <entry><option>gecos_pattern</option></entry>
21945 <entry>ditto</entry>
21946 </row>
21947 <row>
21948 <entry><option>max_username_length</option></entry>
21949 <entry>for systems that truncate</entry>
21950 </row>
21951 <row>
21952 <entry><option>unknown_login</option></entry>
21953 <entry>used when no login name found</entry>
21954 </row>
21955 <row>
21956 <entry><option>unknown_username</option></entry>
21957 <entry>ditto</entry>
21958 </row>
21959 <row>
21960 <entry><option>uucp_from_pattern</option></entry>
21961 <entry>for recognizing <quote>From </quote> lines</entry>
21962 </row>
21963 <row>
21964 <entry><option>uucp_from_sender</option></entry>
21965 <entry>ditto</entry>
21966 </row>
21967 </tbody>
21968 </tgroup>
21969 </informaltable>
21970 </section>
21971 <section id="SECID110">
21972 <title>All incoming messages (SMTP and non-SMTP)</title>
21973 <informaltable frame="none">
21974 <tgroup cols="2" colsep="0" rowsep="0">
21975 <colspec colwidth="196pt" align="left"/>
21976 <colspec colwidth="254pt" align="left"/>
21977 <tbody>
21978 <row>
21979 <entry><option>header_maxsize</option></entry>
21980 <entry>total size of message header</entry>
21981 </row>
21982 <row>
21983 <entry><option>header_line_maxsize</option></entry>
21984 <entry>individual header line limit</entry>
21985 </row>
21986 <row>
21987 <entry><option>message_size_limit</option></entry>
21988 <entry>applies to all messages</entry>
21989 </row>
21990 <row>
21991 <entry><option>percent_hack_domains</option></entry>
21992 <entry>recognize %-hack for these domains</entry>
21993 </row>
21994 <row>
21995 <entry><option>received_header_text</option></entry>
21996 <entry>expanded to make <emphasis>Received:</emphasis></entry>
21997 </row>
21998 <row>
21999 <entry><option>received_headers_max</option></entry>
22000 <entry>for mail loop detection</entry>
22001 </row>
22002 <row>
22003 <entry><option>recipients_max</option></entry>
22004 <entry>limit per message</entry>
22005 </row>
22006 <row>
22007 <entry><option>recipients_max_reject</option></entry>
22008 <entry>permanently reject excess recipients</entry>
22009 </row>
22010 </tbody>
22011 </tgroup>
22012 </informaltable>
22013 </section>
22014 <section id="SECID111">
22015 <title>Non-SMTP incoming messages</title>
22016 <informaltable frame="none">
22017 <tgroup cols="2" colsep="0" rowsep="0">
22018 <colspec colwidth="196pt" align="left"/>
22019 <colspec colwidth="254pt" align="left"/>
22020 <tbody>
22021 <row>
22022 <entry><option>receive_timeout</option></entry>
22023 <entry>for non-SMTP messages</entry>
22024 </row>
22025 </tbody>
22026 </tgroup>
22027 </informaltable>
22028 </section>
22029 <section id="SECID112">
22030 <title>Incoming SMTP messages</title>
22031 <para>
22032 See also the <emphasis>Policy controls</emphasis> section above.
22033 </para>
22034 <informaltable frame="none">
22035 <tgroup cols="2" colsep="0" rowsep="0">
22036 <colspec colwidth="196pt" align="left"/>
22037 <colspec colwidth="254pt" align="left"/>
22038 <tbody>
22039 <row>
22040 <entry><option>dkim_verify_signers</option></entry>
22041 <entry>DKIM domain for which DKIM ACL is run</entry>
22042 </row>
22043 <row>
22044 <entry><option>host_lookup</option></entry>
22045 <entry>host name looked up for these hosts</entry>
22046 </row>
22047 <row>
22048 <entry><option>host_lookup_order</option></entry>
22049 <entry>order of DNS and local name lookups</entry>
22050 </row>
22051 <row>
22052 <entry><option>recipient_unqualified_hosts</option></entry>
22053 <entry>may send unqualified recipients</entry>
22054 </row>
22055 <row>
22056 <entry><option>rfc1413_hosts</option></entry>
22057 <entry>make ident calls to these hosts</entry>
22058 </row>
22059 <row>
22060 <entry><option>rfc1413_query_timeout</option></entry>
22061 <entry>zero disables ident calls</entry>
22062 </row>
22063 <row>
22064 <entry><option>sender_unqualified_hosts</option></entry>
22065 <entry>may send unqualified senders</entry>
22066 </row>
22067 <row>
22068 <entry><option>smtp_accept_keepalive</option></entry>
22069 <entry>some TCP/IP magic</entry>
22070 </row>
22071 <row>
22072 <entry><option>smtp_accept_max</option></entry>
22073 <entry>simultaneous incoming connections</entry>
22074 </row>
22075 <row>
22076 <entry><option>smtp_accept_max_nonmail</option></entry>
22077 <entry>non-mail commands</entry>
22078 </row>
22079 <row>
22080 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
22081 <entry>hosts to which the limit applies</entry>
22082 </row>
22083 <row>
22084 <entry><option>smtp_accept_max_per_connection</option></entry>
22085 <entry>messages per connection</entry>
22086 </row>
22087 <row>
22088 <entry><option>smtp_accept_max_per_host</option></entry>
22089 <entry>connections from one host</entry>
22090 </row>
22091 <row>
22092 <entry><option>smtp_accept_queue</option></entry>
22093 <entry>queue mail if more connections</entry>
22094 </row>
22095 <row>
22096 <entry><option>smtp_accept_queue_per_connection</option></entry>
22097 <entry>queue if more messages per connection</entry>
22098 </row>
22099 <row>
22100 <entry><option>smtp_accept_reserve</option></entry>
22101 <entry>only reserve hosts if more connections</entry>
22102 </row>
22103 <row>
22104 <entry><option>smtp_active_hostname</option></entry>
22105 <entry>host name to use in messages</entry>
22106 </row>
22107 <row>
22108 <entry><option>smtp_banner</option></entry>
22109 <entry>text for welcome banner</entry>
22110 </row>
22111 <row>
22112 <entry><option>smtp_check_spool_space</option></entry>
22113 <entry>from SIZE on MAIL command</entry>
22114 </row>
22115 <row>
22116 <entry><option>smtp_connect_backlog</option></entry>
22117 <entry>passed to TCP/IP stack</entry>
22118 </row>
22119 <row>
22120 <entry><option>smtp_enforce_sync</option></entry>
22121 <entry>of SMTP command/responses</entry>
22122 </row>
22123 <row>
22124 <entry><option>smtp_etrn_command</option></entry>
22125 <entry>what to run for ETRN</entry>
22126 </row>
22127 <row>
22128 <entry><option>smtp_etrn_serialize</option></entry>
22129 <entry>only one at once</entry>
22130 </row>
22131 <row>
22132 <entry><option>smtp_load_reserve</option></entry>
22133 <entry>only reserve hosts if this load</entry>
22134 </row>
22135 <row>
22136 <entry><option>smtp_max_unknown_commands</option></entry>
22137 <entry>before dropping connection</entry>
22138 </row>
22139 <row>
22140 <entry><option>smtp_ratelimit_hosts</option></entry>
22141 <entry>apply ratelimiting to these hosts</entry>
22142 </row>
22143 <row>
22144 <entry><option>smtp_ratelimit_mail</option></entry>
22145 <entry>ratelimit for MAIL commands</entry>
22146 </row>
22147 <row>
22148 <entry><option>smtp_ratelimit_rcpt</option></entry>
22149 <entry>ratelimit for RCPT commands</entry>
22150 </row>
22151 <row>
22152 <entry><option>smtp_receive_timeout</option></entry>
22153 <entry>per command or data line</entry>
22154 </row>
22155 <row>
22156 <entry><option>smtp_reserve_hosts</option></entry>
22157 <entry>these are the reserve hosts</entry>
22158 </row>
22159 <row>
22160 <entry><option>smtp_return_error_details</option></entry>
22161 <entry>give detail on rejections</entry>
22162 </row>
22163 </tbody>
22164 </tgroup>
22165 </informaltable>
22166 </section>
22167 <section id="SECID113">
22168 <title>SMTP extensions</title>
22169 <informaltable frame="none">
22170 <tgroup cols="2" colsep="0" rowsep="0">
22171 <colspec colwidth="196pt" align="left"/>
22172 <colspec colwidth="254pt" align="left"/>
22173 <tbody>
22174 <row>
22175 <entry><option>accept_8bitmime</option></entry>
22176 <entry>advertise 8BITMIME</entry>
22177 </row>
22178 <row>
22179 <entry><option>auth_advertise_hosts</option></entry>
22180 <entry>advertise AUTH to these hosts</entry>
22181 </row>
22182 <row>
22183 <entry><option>chunking_advertise_hosts</option></entry>
22184 <entry>advertise CHUNKING to these hosts</entry>
22185 </row>
22186 <row>
22187 <entry><option>dsn_advertise_hosts</option></entry>
22188 <entry>advertise DSN extensions to these hosts</entry>
22189 </row>
22190 <row>
22191 <entry><option>ignore_fromline_hosts</option></entry>
22192 <entry>allow <quote>From </quote> from these hosts</entry>
22193 </row>
22194 <row>
22195 <entry><option>ignore_fromline_local</option></entry>
22196 <entry>allow <quote>From </quote> from local SMTP</entry>
22197 </row>
22198 <row>
22199 <entry><option>pipelining_advertise_hosts</option></entry>
22200 <entry>advertise pipelining to these hosts</entry>
22201 </row>
22202 <row>
22203 <entry><option>prdr_enable</option></entry>
22204 <entry>advertise PRDR to all hosts</entry>
22205 </row>
22206 <row>
22207 <entry><option>smtputf8_advertise_hosts</option></entry>
22208 <entry>advertise SMTPUTF8 to these hosts</entry>
22209 </row>
22210 <row>
22211 <entry><option>tls_advertise_hosts</option></entry>
22212 <entry>advertise TLS to these hosts</entry>
22213 </row>
22214 </tbody>
22215 </tgroup>
22216 </informaltable>
22217 </section>
22218 <section id="SECID114">
22219 <title>Processing messages</title>
22220 <informaltable frame="none">
22221 <tgroup cols="2" colsep="0" rowsep="0">
22222 <colspec colwidth="196pt" align="left"/>
22223 <colspec colwidth="254pt" align="left"/>
22224 <tbody>
22225 <row>
22226 <entry><option>allow_domain_literals</option></entry>
22227 <entry>recognize domain literal syntax</entry>
22228 </row>
22229 <row>
22230 <entry><option>allow_mx_to_ip</option></entry>
22231 <entry>allow MX to point to IP address</entry>
22232 </row>
22233 <row>
22234 <entry><option>allow_utf8_domains</option></entry>
22235 <entry>in addresses</entry>
22236 </row>
22237 <row>
22238 <entry><option>check_rfc2047_length</option></entry>
22239 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
22240 </row>
22241 <row>
22242 <entry><option>delivery_date_remove</option></entry>
22243 <entry>from incoming messages</entry>
22244 </row>
22245 <row>
22246 <entry><option>envelope_to_remove</option></entry>
22247 <entry>from incoming messages</entry>
22248 </row>
22249 <row>
22250 <entry><option>extract_addresses_remove_arguments</option></entry>
22251 <entry>affects <option>-t</option> processing</entry>
22252 </row>
22253 <row>
22254 <entry><option>headers_charset</option></entry>
22255 <entry>default for translations</entry>
22256 </row>
22257 <row>
22258 <entry><option>qualify_domain</option></entry>
22259 <entry>default for senders</entry>
22260 </row>
22261 <row>
22262 <entry><option>qualify_recipient</option></entry>
22263 <entry>default for recipients</entry>
22264 </row>
22265 <row>
22266 <entry><option>return_path_remove</option></entry>
22267 <entry>from incoming messages</entry>
22268 </row>
22269 <row>
22270 <entry><option>strip_excess_angle_brackets</option></entry>
22271 <entry>in addresses</entry>
22272 </row>
22273 <row>
22274 <entry><option>strip_trailing_dot</option></entry>
22275 <entry>at end of addresses</entry>
22276 </row>
22277 <row>
22278 <entry><option>untrusted_set_sender</option></entry>
22279 <entry>untrusted can set envelope sender</entry>
22280 </row>
22281 </tbody>
22282 </tgroup>
22283 </informaltable>
22284 </section>
22285 <section id="SECID115">
22286 <title>System filter</title>
22287 <informaltable frame="none">
22288 <tgroup cols="2" colsep="0" rowsep="0">
22289 <colspec colwidth="196pt" align="left"/>
22290 <colspec colwidth="254pt" align="left"/>
22291 <tbody>
22292 <row>
22293 <entry><option>system_filter</option></entry>
22294 <entry>locate system filter</entry>
22295 </row>
22296 <row>
22297 <entry><option>system_filter_directory_transport</option></entry>
22298 <entry>transport for delivery to a directory</entry>
22299 </row>
22300 <row>
22301 <entry><option>system_filter_file_transport</option></entry>
22302 <entry>transport for delivery to a file</entry>
22303 </row>
22304 <row>
22305 <entry><option>system_filter_group</option></entry>
22306 <entry>group for filter running</entry>
22307 </row>
22308 <row>
22309 <entry><option>system_filter_pipe_transport</option></entry>
22310 <entry>transport for delivery to a pipe</entry>
22311 </row>
22312 <row>
22313 <entry><option>system_filter_reply_transport</option></entry>
22314 <entry>transport for autoreply delivery</entry>
22315 </row>
22316 <row>
22317 <entry><option>system_filter_user</option></entry>
22318 <entry>user for filter running</entry>
22319 </row>
22320 </tbody>
22321 </tgroup>
22322 </informaltable>
22323 </section>
22324 <section id="SECID116">
22325 <title>Routing and delivery</title>
22326 <informaltable frame="none">
22327 <tgroup cols="2" colsep="0" rowsep="0">
22328 <colspec colwidth="196pt" align="left"/>
22329 <colspec colwidth="254pt" align="left"/>
22330 <tbody>
22331 <row>
22332 <entry><option>disable_ipv6</option></entry>
22333 <entry>do no IPv6 processing</entry>
22334 </row>
22335 <row>
22336 <entry><option>dns_again_means_nonexist</option></entry>
22337 <entry>for broken domains</entry>
22338 </row>
22339 <row>
22340 <entry><option>dns_check_names_pattern</option></entry>
22341 <entry>pre-DNS syntax check</entry>
22342 </row>
22343 <row>
22344 <entry><option>dns_dnssec_ok</option></entry>
22345 <entry>parameter for resolver</entry>
22346 </row>
22347 <row>
22348 <entry><option>dns_ipv4_lookup</option></entry>
22349 <entry>only v4 lookup for these domains</entry>
22350 </row>
22351 <row>
22352 <entry><option>dns_retrans</option></entry>
22353 <entry>parameter for resolver</entry>
22354 </row>
22355 <row>
22356 <entry><option>dns_retry</option></entry>
22357 <entry>parameter for resolver</entry>
22358 </row>
22359 <row>
22360 <entry><option>dns_trust_aa</option></entry>
22361 <entry>DNS zones trusted as authentic</entry>
22362 </row>
22363 <row>
22364 <entry><option>dns_use_edns0</option></entry>
22365 <entry>parameter for resolver</entry>
22366 </row>
22367 <row>
22368 <entry><option>hold_domains</option></entry>
22369 <entry>hold delivery for these domains</entry>
22370 </row>
22371 <row>
22372 <entry><option>local_interfaces</option></entry>
22373 <entry>for routing checks</entry>
22374 </row>
22375 <row>
22376 <entry><option>queue_domains</option></entry>
22377 <entry>no immediate delivery for these</entry>
22378 </row>
22379 <row>
22380 <entry><option>queue_only</option></entry>
22381 <entry>no immediate delivery at all</entry>
22382 </row>
22383 <row>
22384 <entry><option>queue_only_file</option></entry>
22385 <entry>no immediate delivery if file exists</entry>
22386 </row>
22387 <row>
22388 <entry><option>queue_only_load</option></entry>
22389 <entry>no immediate delivery if load is high</entry>
22390 </row>
22391 <row>
22392 <entry><option>queue_only_load_latch</option></entry>
22393 <entry>don&#x2019;t re-evaluate load for each message</entry>
22394 </row>
22395 <row>
22396 <entry><option>queue_only_override</option></entry>
22397 <entry>allow command line to override</entry>
22398 </row>
22399 <row>
22400 <entry><option>queue_run_in_order</option></entry>
22401 <entry>order of arrival</entry>
22402 </row>
22403 <row>
22404 <entry><option>queue_run_max</option></entry>
22405 <entry>of simultaneous queue runners</entry>
22406 </row>
22407 <row>
22408 <entry><option>queue_smtp_domains</option></entry>
22409 <entry>no immediate SMTP delivery for these</entry>
22410 </row>
22411 <row>
22412 <entry><option>remote_max_parallel</option></entry>
22413 <entry>parallel SMTP delivery per message</entry>
22414 </row>
22415 <row>
22416 <entry><option>remote_sort_domains</option></entry>
22417 <entry>order of remote deliveries</entry>
22418 </row>
22419 <row>
22420 <entry><option>retry_data_expire</option></entry>
22421 <entry>timeout for retry data</entry>
22422 </row>
22423 <row>
22424 <entry><option>retry_interval_max</option></entry>
22425 <entry>safety net for retry rules</entry>
22426 </row>
22427 </tbody>
22428 </tgroup>
22429 </informaltable>
22430 </section>
22431 <section id="SECID117">
22432 <title>Bounce and warning messages</title>
22433 <informaltable frame="none">
22434 <tgroup cols="2" colsep="0" rowsep="0">
22435 <colspec colwidth="196pt" align="left"/>
22436 <colspec colwidth="254pt" align="left"/>
22437 <tbody>
22438 <row>
22439 <entry><option>bounce_message_file</option></entry>
22440 <entry>content of bounce</entry>
22441 </row>
22442 <row>
22443 <entry><option>bounce_message_text</option></entry>
22444 <entry>content of bounce</entry>
22445 </row>
22446 <row>
22447 <entry><option>bounce_return_body</option></entry>
22448 <entry>include body if returning message</entry>
22449 </row>
22450 <row>
22451 <entry><option>bounce_return_linesize_limit</option></entry>
22452 <entry>limit on returned message line length</entry>
22453 </row>
22454 <row>
22455 <entry><option>bounce_return_message</option></entry>
22456 <entry>include original message in bounce</entry>
22457 </row>
22458 <row>
22459 <entry><option>bounce_return_size_limit</option></entry>
22460 <entry>limit on returned message</entry>
22461 </row>
22462 <row>
22463 <entry><option>bounce_sender_authentication</option></entry>
22464 <entry>send authenticated sender with bounce</entry>
22465 </row>
22466 <row>
22467 <entry><option>dsn_from</option></entry>
22468 <entry>set <emphasis>From:</emphasis> contents in bounces</entry>
22469 </row>
22470 <row>
22471 <entry><option>errors_copy</option></entry>
22472 <entry>copy bounce messages</entry>
22473 </row>
22474 <row>
22475 <entry><option>errors_reply_to</option></entry>
22476 <entry><emphasis>Reply-to:</emphasis> in bounces</entry>
22477 </row>
22478 <row>
22479 <entry><option>delay_warning</option></entry>
22480 <entry>time schedule</entry>
22481 </row>
22482 <row>
22483 <entry><option>delay_warning_condition</option></entry>
22484 <entry>condition for warning messages</entry>
22485 </row>
22486 <row>
22487 <entry><option>ignore_bounce_errors_after</option></entry>
22488 <entry>discard undeliverable bounces</entry>
22489 </row>
22490 <row>
22491 <entry><option>smtp_return_error_details</option></entry>
22492 <entry>give detail on rejections</entry>
22493 </row>
22494 <row>
22495 <entry><option>warn_message_file</option></entry>
22496 <entry>content of warning message</entry>
22497 </row>
22498 </tbody>
22499 </tgroup>
22500 </informaltable>
22501 </section>
22502 <section id="SECTalomo">
22503 <title>Alphabetical list of main options</title>
22504 <para>
22505 Those options that undergo string expansion before use are marked with
22506 &dagger;.
22507 </para>
22508 <para>
22509 <indexterm role="option">
22510 <primary><option>accept_8bitmime</option></primary>
22511 </indexterm>
22512 </para>
22513 <informaltable frame="all">
22514 <tgroup cols="4" colsep="0" rowsep="0">
22515 <colspec colwidth="8*" align="left"/>
22516 <colspec colwidth="6*" align="center"/>
22517 <colspec colwidth="6*" align="center"/>
22518 <colspec colwidth="6*" align="right"/>
22519 <tbody>
22520 <row>
22521 <entry><option>accept_8bitmime</option></entry>
22522 <entry>Use: <emphasis>main</emphasis></entry>
22523 <entry>Type: <emphasis>boolean</emphasis></entry>
22524 <entry>Default: <emphasis>true</emphasis></entry>
22525 </row>
22526 </tbody>
22527 </tgroup>
22528 </informaltable>
22529 <para>
22530 <indexterm role="concept">
22531 <primary>8BITMIME</primary>
22532 </indexterm>
22533 <indexterm role="concept">
22534 <primary>8-bit characters</primary>
22535 </indexterm>
22536 <indexterm role="concept">
22537 <primary>log</primary>
22538 <secondary>selectors</secondary>
22539 </indexterm>
22540 <indexterm role="concept">
22541 <primary>log</primary>
22542 <secondary>8BITMIME</secondary>
22543 </indexterm>
22544 This option causes Exim to send 8BITMIME in its response to an SMTP
22545 EHLO command, and to accept the BODY= parameter on MAIL commands.
22546 However, though Exim is 8-bit clean, it is not a protocol converter, and it
22547 takes no steps to do anything special with messages received by this route.
22548 </para>
22549 <para>
22550 Historically Exim kept this option off by default, but the maintainers
22551 feel that in today&#x2019;s Internet, this causes more problems than it solves.
22552 It now defaults to true.
22553 A more detailed analysis of the issues is provided by Dan Bernstein:
22554 </para>
22555 <literallayout>
22556 <emphasis role="bold"><ulink url="http://cr.yp.to/smtp/8bitmime.html">http://cr.yp.to/smtp/8bitmime.html</ulink></emphasis>
22557 </literallayout>
22558 <para>
22559 To log received 8BITMIME status use
22560 </para>
22561 <literallayout class="monospaced">
22562 log_selector = +8bitmime
22563 </literallayout>
22564 <para>
22565 <indexterm role="option">
22566 <primary><option>acl_not_smtp</option></primary>
22567 </indexterm>
22568 </para>
22569 <informaltable frame="all">
22570 <tgroup cols="4" colsep="0" rowsep="0">
22571 <colspec colwidth="8*" align="left"/>
22572 <colspec colwidth="6*" align="center"/>
22573 <colspec colwidth="6*" align="center"/>
22574 <colspec colwidth="6*" align="right"/>
22575 <tbody>
22576 <row>
22577 <entry><option>acl_not_smtp</option></entry>
22578 <entry>Use: <emphasis>main</emphasis></entry>
22579 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22580 <entry>Default: <emphasis>unset</emphasis></entry>
22581 </row>
22582 </tbody>
22583 </tgroup>
22584 </informaltable>
22585 <para>
22586 <indexterm role="concept">
22587 <primary>access control lists (ACLs)</primary>
22588 <secondary>for non-SMTP messages</secondary>
22589 </indexterm>
22590 <indexterm role="concept">
22591 <primary>non-SMTP messages</primary>
22592 <secondary>ACLs for</secondary>
22593 </indexterm>
22594 This option defines the ACL that is run when a non-SMTP message has been
22595 read and is on the point of being accepted. See chapter <xref linkend="CHAPACL"/> for
22596 further details.
22597 </para>
22598 <para>
22599 <indexterm role="option">
22600 <primary><option>acl_not_smtp_mime</option></primary>
22601 </indexterm>
22602 </para>
22603 <informaltable frame="all">
22604 <tgroup cols="4" colsep="0" rowsep="0">
22605 <colspec colwidth="8*" align="left"/>
22606 <colspec colwidth="6*" align="center"/>
22607 <colspec colwidth="6*" align="center"/>
22608 <colspec colwidth="6*" align="right"/>
22609 <tbody>
22610 <row>
22611 <entry><option>acl_not_smtp_mime</option></entry>
22612 <entry>Use: <emphasis>main</emphasis></entry>
22613 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22614 <entry>Default: <emphasis>unset</emphasis></entry>
22615 </row>
22616 </tbody>
22617 </tgroup>
22618 </informaltable>
22619 <para>
22620 This option defines the ACL that is run for individual MIME parts of non-SMTP
22621 messages. It operates in exactly the same way as <option>acl_smtp_mime</option> operates for
22622 SMTP messages.
22623 </para>
22624 <para>
22625 <indexterm role="option">
22626 <primary><option>acl_not_smtp_start</option></primary>
22627 </indexterm>
22628 </para>
22629 <informaltable frame="all">
22630 <tgroup cols="4" colsep="0" rowsep="0">
22631 <colspec colwidth="8*" align="left"/>
22632 <colspec colwidth="6*" align="center"/>
22633 <colspec colwidth="6*" align="center"/>
22634 <colspec colwidth="6*" align="right"/>
22635 <tbody>
22636 <row>
22637 <entry><option>acl_not_smtp_start</option></entry>
22638 <entry>Use: <emphasis>main</emphasis></entry>
22639 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22640 <entry>Default: <emphasis>unset</emphasis></entry>
22641 </row>
22642 </tbody>
22643 </tgroup>
22644 </informaltable>
22645 <para>
22646 <indexterm role="concept">
22647 <primary>access control lists (ACLs)</primary>
22648 <secondary>at start of non-SMTP message</secondary>
22649 </indexterm>
22650 <indexterm role="concept">
22651 <primary>non-SMTP messages</primary>
22652 <secondary>ACLs for</secondary>
22653 </indexterm>
22654 This option defines the ACL that is run before Exim starts reading a
22655 non-SMTP message. See chapter <xref linkend="CHAPACL"/> for further details.
22656 </para>
22657 <para>
22658 <indexterm role="option">
22659 <primary><option>acl_smtp_auth</option></primary>
22660 </indexterm>
22661 </para>
22662 <informaltable frame="all">
22663 <tgroup cols="4" colsep="0" rowsep="0">
22664 <colspec colwidth="8*" align="left"/>
22665 <colspec colwidth="6*" align="center"/>
22666 <colspec colwidth="6*" align="center"/>
22667 <colspec colwidth="6*" align="right"/>
22668 <tbody>
22669 <row>
22670 <entry><option>acl_smtp_auth</option></entry>
22671 <entry>Use: <emphasis>main</emphasis></entry>
22672 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22673 <entry>Default: <emphasis>unset</emphasis></entry>
22674 </row>
22675 </tbody>
22676 </tgroup>
22677 </informaltable>
22678 <para>
22679 <indexterm role="concept">
22680 <primary>access control lists (ACLs)</primary>
22681 <secondary>setting up for SMTP commands</secondary>
22682 </indexterm>
22683 <indexterm role="concept">
22684 <primary>AUTH</primary>
22685 <secondary>ACL for</secondary>
22686 </indexterm>
22687 This option defines the ACL that is run when an SMTP AUTH command is
22688 received. See chapter <xref linkend="CHAPACL"/> for further details.
22689 </para>
22690 <para>
22691 <indexterm role="option">
22692 <primary><option>acl_smtp_connect</option></primary>
22693 </indexterm>
22694 </para>
22695 <informaltable frame="all">
22696 <tgroup cols="4" colsep="0" rowsep="0">
22697 <colspec colwidth="8*" align="left"/>
22698 <colspec colwidth="6*" align="center"/>
22699 <colspec colwidth="6*" align="center"/>
22700 <colspec colwidth="6*" align="right"/>
22701 <tbody>
22702 <row>
22703 <entry><option>acl_smtp_connect</option></entry>
22704 <entry>Use: <emphasis>main</emphasis></entry>
22705 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22706 <entry>Default: <emphasis>unset</emphasis></entry>
22707 </row>
22708 </tbody>
22709 </tgroup>
22710 </informaltable>
22711 <para>
22712 <indexterm role="concept">
22713 <primary>access control lists (ACLs)</primary>
22714 <secondary>on SMTP connection</secondary>
22715 </indexterm>
22716 This option defines the ACL that is run when an SMTP connection is received.
22717 See chapter <xref linkend="CHAPACL"/> for further details.
22718 </para>
22719 <para>
22720 <indexterm role="option">
22721 <primary><option>acl_smtp_data</option></primary>
22722 </indexterm>
22723 </para>
22724 <informaltable frame="all">
22725 <tgroup cols="4" colsep="0" rowsep="0">
22726 <colspec colwidth="8*" align="left"/>
22727 <colspec colwidth="6*" align="center"/>
22728 <colspec colwidth="6*" align="center"/>
22729 <colspec colwidth="6*" align="right"/>
22730 <tbody>
22731 <row>
22732 <entry><option>acl_smtp_data</option></entry>
22733 <entry>Use: <emphasis>main</emphasis></entry>
22734 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22735 <entry>Default: <emphasis>unset</emphasis></entry>
22736 </row>
22737 </tbody>
22738 </tgroup>
22739 </informaltable>
22740 <para>
22741 <indexterm role="concept">
22742 <primary>DATA</primary>
22743 <secondary>ACL for</secondary>
22744 </indexterm>
22745 This option defines the ACL that is run after an SMTP DATA command has been
22746 processed and the message itself has been received, but before the final
22747 acknowledgment is sent. See chapter <xref linkend="CHAPACL"/> for further details.
22748 </para>
22749 <para>
22750 <indexterm role="option">
22751 <primary><option>acl_smtp_data_prdr</option></primary>
22752 </indexterm>
22753 </para>
22754 <informaltable frame="all">
22755 <tgroup cols="4" colsep="0" rowsep="0">
22756 <colspec colwidth="8*" align="left"/>
22757 <colspec colwidth="6*" align="center"/>
22758 <colspec colwidth="6*" align="center"/>
22759 <colspec colwidth="6*" align="right"/>
22760 <tbody>
22761 <row>
22762 <entry><option>acl_smtp_data_prdr</option></entry>
22763 <entry>Use: <emphasis>main</emphasis></entry>
22764 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22765 <entry>Default: <emphasis>accept</emphasis></entry>
22766 </row>
22767 </tbody>
22768 </tgroup>
22769 </informaltable>
22770 <para>
22771 <indexterm role="concept">
22772 <primary>PRDR</primary>
22773 <secondary>ACL for</secondary>
22774 </indexterm>
22775 <indexterm role="concept">
22776 <primary>DATA</primary>
22777 <secondary>PRDR ACL for</secondary>
22778 </indexterm>
22779 <indexterm role="concept">
22780 <primary>access control lists (ACLs)</primary>
22781 <secondary>PRDR-related</secondary>
22782 </indexterm>
22783 <indexterm role="concept">
22784 <primary>access control lists (ACLs)</primary>
22785 <secondary>per-user data processing</secondary>
22786 </indexterm>
22787 This option defines the ACL that,
22788 if the PRDR feature has been negotiated,
22789 is run for each recipient after an SMTP DATA command has been
22790 processed and the message itself has been received, but before the
22791 acknowledgment is sent. See chapter <xref linkend="CHAPACL"/> for further details.
22792 </para>
22793 <para>
22794 <indexterm role="option">
22795 <primary><option>acl_smtp_dkim</option></primary>
22796 </indexterm>
22797 </para>
22798 <informaltable frame="all">
22799 <tgroup cols="4" colsep="0" rowsep="0">
22800 <colspec colwidth="8*" align="left"/>
22801 <colspec colwidth="6*" align="center"/>
22802 <colspec colwidth="6*" align="center"/>
22803 <colspec colwidth="6*" align="right"/>
22804 <tbody>
22805 <row>
22806 <entry><option>acl_smtp_dkim</option></entry>
22807 <entry>Use: <emphasis>main</emphasis></entry>
22808 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22809 <entry>Default: <emphasis>unset</emphasis></entry>
22810 </row>
22811 </tbody>
22812 </tgroup>
22813 </informaltable>
22814 <para>
22815 <indexterm role="concept">
22816 <primary>DKIM</primary>
22817 <secondary>ACL for</secondary>
22818 </indexterm>
22819 This option defines the ACL that is run for each DKIM signature
22820 (by default, or as specified in the dkim_verify_signers option)
22821 of a received message.
22822 See chapter <xref linkend="CHAPdkim"/> for further details.
22823 </para>
22824 <para>
22825 <indexterm role="option">
22826 <primary><option>acl_smtp_etrn</option></primary>
22827 </indexterm>
22828 </para>
22829 <informaltable frame="all">
22830 <tgroup cols="4" colsep="0" rowsep="0">
22831 <colspec colwidth="8*" align="left"/>
22832 <colspec colwidth="6*" align="center"/>
22833 <colspec colwidth="6*" align="center"/>
22834 <colspec colwidth="6*" align="right"/>
22835 <tbody>
22836 <row>
22837 <entry><option>acl_smtp_etrn</option></entry>
22838 <entry>Use: <emphasis>main</emphasis></entry>
22839 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22840 <entry>Default: <emphasis>unset</emphasis></entry>
22841 </row>
22842 </tbody>
22843 </tgroup>
22844 </informaltable>
22845 <para>
22846 <indexterm role="concept">
22847 <primary>ETRN</primary>
22848 <secondary>ACL for</secondary>
22849 </indexterm>
22850 This option defines the ACL that is run when an SMTP ETRN command is
22851 received. See chapter <xref linkend="CHAPACL"/> for further details.
22852 </para>
22853 <para>
22854 <indexterm role="option">
22855 <primary><option>acl_smtp_expn</option></primary>
22856 </indexterm>
22857 </para>
22858 <informaltable frame="all">
22859 <tgroup cols="4" colsep="0" rowsep="0">
22860 <colspec colwidth="8*" align="left"/>
22861 <colspec colwidth="6*" align="center"/>
22862 <colspec colwidth="6*" align="center"/>
22863 <colspec colwidth="6*" align="right"/>
22864 <tbody>
22865 <row>
22866 <entry><option>acl_smtp_expn</option></entry>
22867 <entry>Use: <emphasis>main</emphasis></entry>
22868 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22869 <entry>Default: <emphasis>unset</emphasis></entry>
22870 </row>
22871 </tbody>
22872 </tgroup>
22873 </informaltable>
22874 <para>
22875 <indexterm role="concept">
22876 <primary>EXPN</primary>
22877 <secondary>ACL for</secondary>
22878 </indexterm>
22879 This option defines the ACL that is run when an SMTP EXPN command is
22880 received. See chapter <xref linkend="CHAPACL"/> for further details.
22881 </para>
22882 <para>
22883 <indexterm role="option">
22884 <primary><option>acl_smtp_helo</option></primary>
22885 </indexterm>
22886 </para>
22887 <informaltable frame="all">
22888 <tgroup cols="4" colsep="0" rowsep="0">
22889 <colspec colwidth="8*" align="left"/>
22890 <colspec colwidth="6*" align="center"/>
22891 <colspec colwidth="6*" align="center"/>
22892 <colspec colwidth="6*" align="right"/>
22893 <tbody>
22894 <row>
22895 <entry><option>acl_smtp_helo</option></entry>
22896 <entry>Use: <emphasis>main</emphasis></entry>
22897 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22898 <entry>Default: <emphasis>unset</emphasis></entry>
22899 </row>
22900 </tbody>
22901 </tgroup>
22902 </informaltable>
22903 <para>
22904 <indexterm role="concept">
22905 <primary>EHLO</primary>
22906 <secondary>ACL for</secondary>
22907 </indexterm>
22908 <indexterm role="concept">
22909 <primary>HELO</primary>
22910 <secondary>ACL for</secondary>
22911 </indexterm>
22912 This option defines the ACL that is run when an SMTP EHLO or HELO
22913 command is received. See chapter <xref linkend="CHAPACL"/> for further details.
22914 </para>
22915 <para>
22916 <indexterm role="option">
22917 <primary><option>acl_smtp_mail</option></primary>
22918 </indexterm>
22919 </para>
22920 <informaltable frame="all">
22921 <tgroup cols="4" colsep="0" rowsep="0">
22922 <colspec colwidth="8*" align="left"/>
22923 <colspec colwidth="6*" align="center"/>
22924 <colspec colwidth="6*" align="center"/>
22925 <colspec colwidth="6*" align="right"/>
22926 <tbody>
22927 <row>
22928 <entry><option>acl_smtp_mail</option></entry>
22929 <entry>Use: <emphasis>main</emphasis></entry>
22930 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22931 <entry>Default: <emphasis>unset</emphasis></entry>
22932 </row>
22933 </tbody>
22934 </tgroup>
22935 </informaltable>
22936 <para>
22937 <indexterm role="concept">
22938 <primary>MAIL</primary>
22939 <secondary>ACL for</secondary>
22940 </indexterm>
22941 This option defines the ACL that is run when an SMTP MAIL command is
22942 received. See chapter <xref linkend="CHAPACL"/> for further details.
22943 </para>
22944 <para>
22945 <indexterm role="option">
22946 <primary><option>acl_smtp_mailauth</option></primary>
22947 </indexterm>
22948 </para>
22949 <informaltable frame="all">
22950 <tgroup cols="4" colsep="0" rowsep="0">
22951 <colspec colwidth="8*" align="left"/>
22952 <colspec colwidth="6*" align="center"/>
22953 <colspec colwidth="6*" align="center"/>
22954 <colspec colwidth="6*" align="right"/>
22955 <tbody>
22956 <row>
22957 <entry><option>acl_smtp_mailauth</option></entry>
22958 <entry>Use: <emphasis>main</emphasis></entry>
22959 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22960 <entry>Default: <emphasis>unset</emphasis></entry>
22961 </row>
22962 </tbody>
22963 </tgroup>
22964 </informaltable>
22965 <para>
22966 <indexterm role="concept">
22967 <primary>AUTH</primary>
22968 <secondary>on MAIL command</secondary>
22969 </indexterm>
22970 This option defines the ACL that is run when there is an AUTH parameter on
22971 a MAIL command. See chapter <xref linkend="CHAPACL"/> for details of ACLs, and chapter
22972 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
22973 </para>
22974 <para>
22975 <indexterm role="option">
22976 <primary><option>acl_smtp_mime</option></primary>
22977 </indexterm>
22978 </para>
22979 <informaltable frame="all">
22980 <tgroup cols="4" colsep="0" rowsep="0">
22981 <colspec colwidth="8*" align="left"/>
22982 <colspec colwidth="6*" align="center"/>
22983 <colspec colwidth="6*" align="center"/>
22984 <colspec colwidth="6*" align="right"/>
22985 <tbody>
22986 <row>
22987 <entry><option>acl_smtp_mime</option></entry>
22988 <entry>Use: <emphasis>main</emphasis></entry>
22989 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22990 <entry>Default: <emphasis>unset</emphasis></entry>
22991 </row>
22992 </tbody>
22993 </tgroup>
22994 </informaltable>
22995 <para>
22996 <indexterm role="concept">
22997 <primary>MIME content scanning</primary>
22998 <secondary>ACL for</secondary>
22999 </indexterm>
23000 This option is available when Exim is built with the content-scanning
23001 extension. It defines the ACL that is run for each MIME part in a message. See
23002 section <xref linkend="SECTscanmimepart"/> for details.
23003 </para>
23004 <para>
23005 <indexterm role="option">
23006 <primary><option>acl_smtp_notquit</option></primary>
23007 </indexterm>
23008 </para>
23009 <informaltable frame="all">
23010 <tgroup cols="4" colsep="0" rowsep="0">
23011 <colspec colwidth="8*" align="left"/>
23012 <colspec colwidth="6*" align="center"/>
23013 <colspec colwidth="6*" align="center"/>
23014 <colspec colwidth="6*" align="right"/>
23015 <tbody>
23016 <row>
23017 <entry><option>acl_smtp_notquit</option></entry>
23018 <entry>Use: <emphasis>main</emphasis></entry>
23019 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23020 <entry>Default: <emphasis>unset</emphasis></entry>
23021 </row>
23022 </tbody>
23023 </tgroup>
23024 </informaltable>
23025 <para>
23026 <indexterm role="concept">
23027 <primary>not-QUIT, ACL for</primary>
23028 </indexterm>
23029 This option defines the ACL that is run when an SMTP session
23030 ends without a QUIT command being received.
23031 See chapter <xref linkend="CHAPACL"/> for further details.
23032 </para>
23033 <para>
23034 <indexterm role="option">
23035 <primary><option>acl_smtp_predata</option></primary>
23036 </indexterm>
23037 </para>
23038 <informaltable frame="all">
23039 <tgroup cols="4" colsep="0" rowsep="0">
23040 <colspec colwidth="8*" align="left"/>
23041 <colspec colwidth="6*" align="center"/>
23042 <colspec colwidth="6*" align="center"/>
23043 <colspec colwidth="6*" align="right"/>
23044 <tbody>
23045 <row>
23046 <entry><option>acl_smtp_predata</option></entry>
23047 <entry>Use: <emphasis>main</emphasis></entry>
23048 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23049 <entry>Default: <emphasis>unset</emphasis></entry>
23050 </row>
23051 </tbody>
23052 </tgroup>
23053 </informaltable>
23054 <para>
23055 This option defines the ACL that is run when an SMTP DATA command is
23056 received, before the message itself is received. See chapter <xref linkend="CHAPACL"/> for
23057 further details.
23058 </para>
23059 <para>
23060 <indexterm role="option">
23061 <primary><option>acl_smtp_quit</option></primary>
23062 </indexterm>
23063 </para>
23064 <informaltable frame="all">
23065 <tgroup cols="4" colsep="0" rowsep="0">
23066 <colspec colwidth="8*" align="left"/>
23067 <colspec colwidth="6*" align="center"/>
23068 <colspec colwidth="6*" align="center"/>
23069 <colspec colwidth="6*" align="right"/>
23070 <tbody>
23071 <row>
23072 <entry><option>acl_smtp_quit</option></entry>
23073 <entry>Use: <emphasis>main</emphasis></entry>
23074 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23075 <entry>Default: <emphasis>unset</emphasis></entry>
23076 </row>
23077 </tbody>
23078 </tgroup>
23079 </informaltable>
23080 <para>
23081 <indexterm role="concept">
23082 <primary>QUIT, ACL for</primary>
23083 </indexterm>
23084 This option defines the ACL that is run when an SMTP QUIT command is
23085 received. See chapter <xref linkend="CHAPACL"/> for further details.
23086 </para>
23087 <para>
23088 <indexterm role="option">
23089 <primary><option>acl_smtp_rcpt</option></primary>
23090 </indexterm>
23091 </para>
23092 <informaltable frame="all">
23093 <tgroup cols="4" colsep="0" rowsep="0">
23094 <colspec colwidth="8*" align="left"/>
23095 <colspec colwidth="6*" align="center"/>
23096 <colspec colwidth="6*" align="center"/>
23097 <colspec colwidth="6*" align="right"/>
23098 <tbody>
23099 <row>
23100 <entry><option>acl_smtp_rcpt</option></entry>
23101 <entry>Use: <emphasis>main</emphasis></entry>
23102 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23103 <entry>Default: <emphasis>unset</emphasis></entry>
23104 </row>
23105 </tbody>
23106 </tgroup>
23107 </informaltable>
23108 <para>
23109 <indexterm role="concept">
23110 <primary>RCPT</primary>
23111 <secondary>ACL for</secondary>
23112 </indexterm>
23113 This option defines the ACL that is run when an SMTP RCPT command is
23114 received. See chapter <xref linkend="CHAPACL"/> for further details.
23115 </para>
23116 <para>
23117 <indexterm role="option">
23118 <primary><option>acl_smtp_starttls</option></primary>
23119 </indexterm>
23120 </para>
23121 <informaltable frame="all">
23122 <tgroup cols="4" colsep="0" rowsep="0">
23123 <colspec colwidth="8*" align="left"/>
23124 <colspec colwidth="6*" align="center"/>
23125 <colspec colwidth="6*" align="center"/>
23126 <colspec colwidth="6*" align="right"/>
23127 <tbody>
23128 <row>
23129 <entry><option>acl_smtp_starttls</option></entry>
23130 <entry>Use: <emphasis>main</emphasis></entry>
23131 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23132 <entry>Default: <emphasis>unset</emphasis></entry>
23133 </row>
23134 </tbody>
23135 </tgroup>
23136 </informaltable>
23137 <para>
23138 <indexterm role="concept">
23139 <primary>STARTTLS, ACL for</primary>
23140 </indexterm>
23141 This option defines the ACL that is run when an SMTP STARTTLS command is
23142 received. See chapter <xref linkend="CHAPACL"/> for further details.
23143 </para>
23144 <para>
23145 <indexterm role="option">
23146 <primary><option>acl_smtp_vrfy</option></primary>
23147 </indexterm>
23148 </para>
23149 <informaltable frame="all">
23150 <tgroup cols="4" colsep="0" rowsep="0">
23151 <colspec colwidth="8*" align="left"/>
23152 <colspec colwidth="6*" align="center"/>
23153 <colspec colwidth="6*" align="center"/>
23154 <colspec colwidth="6*" align="right"/>
23155 <tbody>
23156 <row>
23157 <entry><option>acl_smtp_vrfy</option></entry>
23158 <entry>Use: <emphasis>main</emphasis></entry>
23159 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23160 <entry>Default: <emphasis>unset</emphasis></entry>
23161 </row>
23162 </tbody>
23163 </tgroup>
23164 </informaltable>
23165 <para>
23166 <indexterm role="concept">
23167 <primary>VRFY</primary>
23168 <secondary>ACL for</secondary>
23169 </indexterm>
23170 This option defines the ACL that is run when an SMTP VRFY command is
23171 received. See chapter <xref linkend="CHAPACL"/> for further details.
23172 </para>
23173 <para>
23174 <indexterm role="option">
23175 <primary><option>add_environment</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>add_environment</option></entry>
23187 <entry>Use: <emphasis>main</emphasis></entry>
23188 <entry>Type: <emphasis>string list</emphasis></entry>
23189 <entry>Default: <emphasis>empty</emphasis></entry>
23190 </row>
23191 </tbody>
23192 </tgroup>
23193 </informaltable>
23194 <para>
23195 <indexterm role="concept">
23196 <primary>environment</primary>
23197 <secondary>set values</secondary>
23198 </indexterm>
23199 This option allows to set individual environment variables that the
23200 currently linked libraries and programs in child processes use.
23201 See <xref linkend="SECTpipeenv"/> for the environment of <command>pipe</command> transports.
23202 </para>
23203 <para>
23204 <indexterm role="option">
23205 <primary><option>admin_groups</option></primary>
23206 </indexterm>
23207 </para>
23208 <informaltable frame="all">
23209 <tgroup cols="4" colsep="0" rowsep="0">
23210 <colspec colwidth="8*" align="left"/>
23211 <colspec colwidth="6*" align="center"/>
23212 <colspec colwidth="6*" align="center"/>
23213 <colspec colwidth="6*" align="right"/>
23214 <tbody>
23215 <row>
23216 <entry><option>admin_groups</option></entry>
23217 <entry>Use: <emphasis>main</emphasis></entry>
23218 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
23219 <entry>Default: <emphasis>unset</emphasis></entry>
23220 </row>
23221 </tbody>
23222 </tgroup>
23223 </informaltable>
23224 <para>
23225 <indexterm role="concept">
23226 <primary>admin user</primary>
23227 </indexterm>
23228 This option is expanded just once, at the start of Exim&#x2019;s processing. If the
23229 current group or any of the supplementary groups of an Exim caller is in this
23230 colon-separated list, the caller has admin privileges. If all your system
23231 programmers are in a specific group, for example, you can give them all Exim
23232 admin privileges by putting that group in <option>admin_groups</option>. However, this does
23233 not permit them to read Exim&#x2019;s spool files (whose group owner is the Exim gid).
23234 To permit this, you have to add individuals to the Exim group.
23235 </para>
23236 <para>
23237 <indexterm role="option">
23238 <primary><option>allow_domain_literals</option></primary>
23239 </indexterm>
23240 </para>
23241 <informaltable frame="all">
23242 <tgroup cols="4" colsep="0" rowsep="0">
23243 <colspec colwidth="8*" align="left"/>
23244 <colspec colwidth="6*" align="center"/>
23245 <colspec colwidth="6*" align="center"/>
23246 <colspec colwidth="6*" align="right"/>
23247 <tbody>
23248 <row>
23249 <entry><option>allow_domain_literals</option></entry>
23250 <entry>Use: <emphasis>main</emphasis></entry>
23251 <entry>Type: <emphasis>boolean</emphasis></entry>
23252 <entry>Default: <emphasis>false</emphasis></entry>
23253 </row>
23254 </tbody>
23255 </tgroup>
23256 </informaltable>
23257 <para>
23258 <indexterm role="concept">
23259 <primary>domain literal</primary>
23260 </indexterm>
23261 If this option is set, the RFC 2822 domain literal format is permitted in
23262 email addresses. The option is not set by default, because the domain literal
23263 format is not normally required these days, and few people know about it. It
23264 has, however, been exploited by mail abusers.
23265 </para>
23266 <para>
23267 Unfortunately, it seems that some DNS black list maintainers are using this
23268 format to report black listing to postmasters. If you want to accept messages
23269 addressed to your hosts by IP address, you need to set
23270 <option>allow_domain_literals</option> true, and also to add <literal>@[]</literal> to the list of local
23271 domains (defined in the named domain list <option>local_domains</option> in the default
23272 configuration). This <quote>magic string</quote> matches the domain literal form of all
23273 the local host&#x2019;s IP addresses.
23274 </para>
23275 <para>
23276 <indexterm role="option">
23277 <primary><option>allow_mx_to_ip</option></primary>
23278 </indexterm>
23279 </para>
23280 <informaltable frame="all">
23281 <tgroup cols="4" colsep="0" rowsep="0">
23282 <colspec colwidth="8*" align="left"/>
23283 <colspec colwidth="6*" align="center"/>
23284 <colspec colwidth="6*" align="center"/>
23285 <colspec colwidth="6*" align="right"/>
23286 <tbody>
23287 <row>
23288 <entry><option>allow_mx_to_ip</option></entry>
23289 <entry>Use: <emphasis>main</emphasis></entry>
23290 <entry>Type: <emphasis>boolean</emphasis></entry>
23291 <entry>Default: <emphasis>false</emphasis></entry>
23292 </row>
23293 </tbody>
23294 </tgroup>
23295 </informaltable>
23296 <para>
23297 <indexterm role="concept">
23298 <primary>MX record</primary>
23299 <secondary>pointing to IP address</secondary>
23300 </indexterm>
23301 It appears that more and more DNS zone administrators are breaking the rules
23302 and putting domain names that look like IP addresses on the right hand side of
23303 MX records. Exim follows the rules and rejects this, giving an error message
23304 that explains the misconfiguration. However, some other MTAs support this
23305 practice, so to avoid <quote>Why can&#x2019;t Exim do this?</quote> complaints,
23306 <option>allow_mx_to_ip</option> exists, in order to enable this heinous activity. It is not
23307 recommended, except when you have no other choice.
23308 </para>
23309 <para>
23310 <indexterm role="option">
23311 <primary><option>allow_utf8_domains</option></primary>
23312 </indexterm>
23313 </para>
23314 <informaltable frame="all">
23315 <tgroup cols="4" colsep="0" rowsep="0">
23316 <colspec colwidth="8*" align="left"/>
23317 <colspec colwidth="6*" align="center"/>
23318 <colspec colwidth="6*" align="center"/>
23319 <colspec colwidth="6*" align="right"/>
23320 <tbody>
23321 <row>
23322 <entry><option>allow_utf8_domains</option></entry>
23323 <entry>Use: <emphasis>main</emphasis></entry>
23324 <entry>Type: <emphasis>boolean</emphasis></entry>
23325 <entry>Default: <emphasis>false</emphasis></entry>
23326 </row>
23327 </tbody>
23328 </tgroup>
23329 </informaltable>
23330 <para>
23331 <indexterm role="concept">
23332 <primary>domain</primary>
23333 <secondary>UTF-8 characters in</secondary>
23334 </indexterm>
23335 <indexterm role="concept">
23336 <primary>UTF-8</primary>
23337 <secondary>in domain name</secondary>
23338 </indexterm>
23339 Lots of discussion is going on about internationalized domain names. One
23340 camp is strongly in favour of just using UTF-8 characters, and it seems
23341 that at least two other MTAs permit this. This option allows Exim users to
23342 experiment if they wish.
23343 </para>
23344 <para>
23345 If it is set true, Exim&#x2019;s domain parsing function allows valid
23346 UTF-8 multicharacters to appear in domain name components, in addition to
23347 letters, digits, and hyphens. However, just setting this option is not
23348 enough; if you want to look up these domain names in the DNS, you must also
23349 adjust the value of <option>dns_check_names_pattern</option> to match the extended form. A
23350 suitable setting is:
23351 </para>
23352 <literallayout class="monospaced">
23353 dns_check_names_pattern = (?i)^(?&gt;(?(1)\.|())[a-z0-9\xc0-\xff]\
23354   (?&gt;[-a-z0-9\x80-\xff]*[a-z0-9\x80-\xbf])?)+$
23355 </literallayout>
23356 <para>
23357 Alternatively, you can just disable this feature by setting
23358 </para>
23359 <literallayout class="monospaced">
23360 dns_check_names_pattern =
23361 </literallayout>
23362 <para>
23363 That is, set the option to an empty string so that no check is done.
23364 </para>
23365 <para>
23366 <indexterm role="option">
23367 <primary><option>auth_advertise_hosts</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>auth_advertise_hosts</option></entry>
23379 <entry>Use: <emphasis>main</emphasis></entry>
23380 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
23381 <entry>Default: <emphasis>*</emphasis></entry>
23382 </row>
23383 </tbody>
23384 </tgroup>
23385 </informaltable>
23386 <para>
23387 <indexterm role="concept">
23388 <primary>authentication</primary>
23389 <secondary>advertising</secondary>
23390 </indexterm>
23391 <indexterm role="concept">
23392 <primary>AUTH</primary>
23393 <secondary>advertising</secondary>
23394 </indexterm>
23395 If any server authentication mechanisms are configured, Exim advertises them in
23396 response to an EHLO command only if the calling host matches this list.
23397 Otherwise, Exim does not advertise AUTH.
23398 Exim does not accept AUTH commands from clients to which it has not
23399 advertised the availability of AUTH. The advertising of individual
23400 authentication mechanisms can be controlled by the use of the
23401 <option>server_advertise_condition</option> generic authenticator option on the individual
23402 authenticators. See chapter <xref linkend="CHAPSMTPAUTH"/> for further details.
23403 </para>
23404 <para>
23405 Certain mail clients (for example, Netscape) require the user to provide a name
23406 and password for authentication if AUTH is advertised, even though it may
23407 not be needed (the host may accept messages from hosts on its local LAN without
23408 authentication, for example). The <option>auth_advertise_hosts</option> option can be used
23409 to make these clients more friendly by excluding them from the set of hosts to
23410 which Exim advertises AUTH.
23411 </para>
23412 <para>
23413 <indexterm role="concept">
23414 <primary>AUTH</primary>
23415 <secondary>advertising when encrypted</secondary>
23416 </indexterm>
23417 If you want to advertise the availability of AUTH only when the connection
23418 is encrypted using TLS, you can make use of the fact that the value of this
23419 option is expanded, with a setting like this:
23420 </para>
23421 <literallayout class="monospaced">
23422 auth_advertise_hosts = ${if eq{$tls_in_cipher}{}{}{*}}
23423 </literallayout>
23424 <para>
23425 <indexterm role="variable">
23426 <primary><varname>$tls_in_cipher</varname></primary>
23427 </indexterm>
23428 If <varname>$tls_in_cipher</varname> is empty, the session is not encrypted, and the result of
23429 the expansion is empty, thus matching no hosts. Otherwise, the result of the
23430 expansion is *, which matches all hosts.
23431 </para>
23432 <para>
23433 <indexterm role="option">
23434 <primary><option>auto_thaw</option></primary>
23435 </indexterm>
23436 </para>
23437 <informaltable frame="all">
23438 <tgroup cols="4" colsep="0" rowsep="0">
23439 <colspec colwidth="8*" align="left"/>
23440 <colspec colwidth="6*" align="center"/>
23441 <colspec colwidth="6*" align="center"/>
23442 <colspec colwidth="6*" align="right"/>
23443 <tbody>
23444 <row>
23445 <entry><option>auto_thaw</option></entry>
23446 <entry>Use: <emphasis>main</emphasis></entry>
23447 <entry>Type: <emphasis>time</emphasis></entry>
23448 <entry>Default: <emphasis>0s</emphasis></entry>
23449 </row>
23450 </tbody>
23451 </tgroup>
23452 </informaltable>
23453 <para>
23454 <indexterm role="concept">
23455 <primary>thawing messages</primary>
23456 </indexterm>
23457 <indexterm role="concept">
23458 <primary>unfreezing messages</primary>
23459 </indexterm>
23460 If this option is set to a time greater than zero, a queue runner will try a
23461 new delivery attempt on any frozen message, other than a bounce message, if
23462 this much time has passed since it was frozen. This may result in the message
23463 being re-frozen if nothing has changed since the last attempt. It is a way of
23464 saying <quote>keep on trying, even though there are big problems</quote>.
23465 </para>
23466 <para>
23467 <emphasis role="bold">Note</emphasis>: This is an old option, which predates <option>timeout_frozen_after</option> and
23468 <option>ignore_bounce_errors_after</option>. It is retained for compatibility, but it is not
23469 thought to be very useful any more, and its use should probably be avoided.
23470 </para>
23471 <para>
23472 <indexterm role="option">
23473 <primary><option>av_scanner</option></primary>
23474 </indexterm>
23475 </para>
23476 <informaltable frame="all">
23477 <tgroup cols="4" colsep="0" rowsep="0">
23478 <colspec colwidth="8*" align="left"/>
23479 <colspec colwidth="6*" align="center"/>
23480 <colspec colwidth="6*" align="center"/>
23481 <colspec colwidth="6*" align="right"/>
23482 <tbody>
23483 <row>
23484 <entry><option>av_scanner</option></entry>
23485 <entry>Use: <emphasis>main</emphasis></entry>
23486 <entry>Type: <emphasis>string</emphasis></entry>
23487 <entry>Default: <emphasis>see below</emphasis></entry>
23488 </row>
23489 </tbody>
23490 </tgroup>
23491 </informaltable>
23492 <para>
23493 This option is available if Exim is built with the content-scanning extension.
23494 It specifies which anti-virus scanner to use. The default value is:
23495 </para>
23496 <literallayout class="monospaced">
23497 sophie:/var/run/sophie
23498 </literallayout>
23499 <para>
23500 If the value of <option>av_scanner</option> starts with a dollar character, it is expanded
23501 before use. See section <xref linkend="SECTscanvirus"/> for further details.
23502 </para>
23503 <para>
23504 <indexterm role="option">
23505 <primary><option>bi_command</option></primary>
23506 </indexterm>
23507 </para>
23508 <informaltable frame="all">
23509 <tgroup cols="4" colsep="0" rowsep="0">
23510 <colspec colwidth="8*" align="left"/>
23511 <colspec colwidth="6*" align="center"/>
23512 <colspec colwidth="6*" align="center"/>
23513 <colspec colwidth="6*" align="right"/>
23514 <tbody>
23515 <row>
23516 <entry><option>bi_command</option></entry>
23517 <entry>Use: <emphasis>main</emphasis></entry>
23518 <entry>Type: <emphasis>string</emphasis></entry>
23519 <entry>Default: <emphasis>unset</emphasis></entry>
23520 </row>
23521 </tbody>
23522 </tgroup>
23523 </informaltable>
23524 <para>
23525 <indexterm role="option">
23526 <primary><option>-bi</option></primary>
23527 </indexterm>
23528 This option supplies the name of a command that is run when Exim is called with
23529 the <option>-bi</option> option (see chapter <xref linkend="CHAPcommandline"/>). The string value is
23530 just the command name, it is not a complete command line. If an argument is
23531 required, it must come from the <option>-oA</option> command line option.
23532 </para>
23533 <para>
23534 <indexterm role="option">
23535 <primary><option>bounce_message_file</option></primary>
23536 </indexterm>
23537 </para>
23538 <informaltable frame="all">
23539 <tgroup cols="4" colsep="0" rowsep="0">
23540 <colspec colwidth="8*" align="left"/>
23541 <colspec colwidth="6*" align="center"/>
23542 <colspec colwidth="6*" align="center"/>
23543 <colspec colwidth="6*" align="right"/>
23544 <tbody>
23545 <row>
23546 <entry><option>bounce_message_file</option></entry>
23547 <entry>Use: <emphasis>main</emphasis></entry>
23548 <entry>Type: <emphasis>string</emphasis></entry>
23549 <entry>Default: <emphasis>unset</emphasis></entry>
23550 </row>
23551 </tbody>
23552 </tgroup>
23553 </informaltable>
23554 <para>
23555 <indexterm role="concept">
23556 <primary>bounce message</primary>
23557 <secondary>customizing</secondary>
23558 </indexterm>
23559 <indexterm role="concept">
23560 <primary>customizing</primary>
23561 <secondary>bounce message</secondary>
23562 </indexterm>
23563 This option defines a template file containing paragraphs of text to be used
23564 for constructing bounce messages.  Details of the file&#x2019;s contents are given in
23565 chapter <xref linkend="CHAPemsgcust"/>. See also <option>warn_message_file</option>.
23566 </para>
23567 <para>
23568 <indexterm role="option">
23569 <primary><option>bounce_message_text</option></primary>
23570 </indexterm>
23571 </para>
23572 <informaltable frame="all">
23573 <tgroup cols="4" colsep="0" rowsep="0">
23574 <colspec colwidth="8*" align="left"/>
23575 <colspec colwidth="6*" align="center"/>
23576 <colspec colwidth="6*" align="center"/>
23577 <colspec colwidth="6*" align="right"/>
23578 <tbody>
23579 <row>
23580 <entry><option>bounce_message_text</option></entry>
23581 <entry>Use: <emphasis>main</emphasis></entry>
23582 <entry>Type: <emphasis>string</emphasis></entry>
23583 <entry>Default: <emphasis>unset</emphasis></entry>
23584 </row>
23585 </tbody>
23586 </tgroup>
23587 </informaltable>
23588 <para>
23589 When this option is set, its contents are included in the default bounce
23590 message immediately after <quote>This message was created automatically by mail
23591 delivery software.</quote> It is not used if <option>bounce_message_file</option> is set.
23592 </para>
23593 <para>
23594 <indexterm role="option">
23595 <primary><option>bounce_return_body</option></primary>
23596 </indexterm>
23597 </para>
23598 <informaltable frame="all">
23599 <tgroup cols="4" colsep="0" rowsep="0">
23600 <colspec colwidth="8*" align="left"/>
23601 <colspec colwidth="6*" align="center"/>
23602 <colspec colwidth="6*" align="center"/>
23603 <colspec colwidth="6*" align="right"/>
23604 <tbody>
23605 <row>
23606 <entry><option>bounce_return_body</option></entry>
23607 <entry>Use: <emphasis>main</emphasis></entry>
23608 <entry>Type: <emphasis>boolean</emphasis></entry>
23609 <entry>Default: <emphasis>true</emphasis></entry>
23610 </row>
23611 </tbody>
23612 </tgroup>
23613 </informaltable>
23614 <para>
23615 <indexterm role="concept">
23616 <primary>bounce message</primary>
23617 <secondary>including body</secondary>
23618 </indexterm>
23619 This option controls whether the body of an incoming message is included in a
23620 bounce message when <option>bounce_return_message</option> is true. The default setting
23621 causes the entire message, both header and body, to be returned (subject to the
23622 value of <option>bounce_return_size_limit</option>). If this option is false, only the
23623 message header is included. In the case of a non-SMTP message containing an
23624 error that is detected during reception, only those header lines preceding the
23625 point at which the error was detected are returned.
23626 <indexterm role="concept">
23627 <primary>bounce message</primary>
23628 <secondary>including original</secondary>
23629 </indexterm>
23630 </para>
23631 <para>
23632 <indexterm role="option">
23633 <primary><option>bounce_return_linesize_limit</option></primary>
23634 </indexterm>
23635 </para>
23636 <informaltable frame="all">
23637 <tgroup cols="4" colsep="0" rowsep="0">
23638 <colspec colwidth="8*" align="left"/>
23639 <colspec colwidth="6*" align="center"/>
23640 <colspec colwidth="6*" align="center"/>
23641 <colspec colwidth="6*" align="right"/>
23642 <tbody>
23643 <row>
23644 <entry><option>bounce_return_linesize_limit</option></entry>
23645 <entry>Use: <emphasis>main</emphasis></entry>
23646 <entry>Type: <emphasis>integer</emphasis></entry>
23647 <entry>Default: <emphasis>998</emphasis></entry>
23648 </row>
23649 </tbody>
23650 </tgroup>
23651 </informaltable>
23652 <para>
23653 <indexterm role="concept">
23654 <primary>size</primary>
23655 <secondary>of bounce lines, limit</secondary>
23656 </indexterm>
23657 <indexterm role="concept">
23658 <primary>bounce message</primary>
23659 <secondary>line length limit</secondary>
23660 </indexterm>
23661 <indexterm role="concept">
23662 <primary>limit</primary>
23663 <secondary>bounce message line length</secondary>
23664 </indexterm>
23665 This option sets a limit in bytes on the line length of messages
23666 that are returned to senders due to delivery problems,
23667 when <option>bounce_return_message</option> is true.
23668 The default value corresponds to RFC limits.
23669 If the message being returned has lines longer than this value it is
23670 treated as if the <option>bounce_return_size_limit</option> (below) restriction was exceeded.
23671 </para>
23672 <para>
23673 The option also applies to bounces returned when an error is detected
23674 during reception of a message.
23675 In this case lines from the original are truncated.
23676 </para>
23677 <para>
23678 The option does not apply to messages generated by an <command>autoreply</command> transport.
23679 </para>
23680 <para>
23681 <indexterm role="option">
23682 <primary><option>bounce_return_message</option></primary>
23683 </indexterm>
23684 </para>
23685 <informaltable frame="all">
23686 <tgroup cols="4" colsep="0" rowsep="0">
23687 <colspec colwidth="8*" align="left"/>
23688 <colspec colwidth="6*" align="center"/>
23689 <colspec colwidth="6*" align="center"/>
23690 <colspec colwidth="6*" align="right"/>
23691 <tbody>
23692 <row>
23693 <entry><option>bounce_return_message</option></entry>
23694 <entry>Use: <emphasis>main</emphasis></entry>
23695 <entry>Type: <emphasis>boolean</emphasis></entry>
23696 <entry>Default: <emphasis>true</emphasis></entry>
23697 </row>
23698 </tbody>
23699 </tgroup>
23700 </informaltable>
23701 <para>
23702 If this option is set false, none of the original message is included in
23703 bounce messages generated by Exim. See also <option>bounce_return_size_limit</option> and
23704 <option>bounce_return_body</option>.
23705 </para>
23706 <para>
23707 <indexterm role="option">
23708 <primary><option>bounce_return_size_limit</option></primary>
23709 </indexterm>
23710 </para>
23711 <informaltable frame="all">
23712 <tgroup cols="4" colsep="0" rowsep="0">
23713 <colspec colwidth="8*" align="left"/>
23714 <colspec colwidth="6*" align="center"/>
23715 <colspec colwidth="6*" align="center"/>
23716 <colspec colwidth="6*" align="right"/>
23717 <tbody>
23718 <row>
23719 <entry><option>bounce_return_size_limit</option></entry>
23720 <entry>Use: <emphasis>main</emphasis></entry>
23721 <entry>Type: <emphasis>integer</emphasis></entry>
23722 <entry>Default: <emphasis>100K</emphasis></entry>
23723 </row>
23724 </tbody>
23725 </tgroup>
23726 </informaltable>
23727 <para>
23728 <indexterm role="concept">
23729 <primary>size</primary>
23730 <secondary>of bounce, limit</secondary>
23731 </indexterm>
23732 <indexterm role="concept">
23733 <primary>bounce message</primary>
23734 <secondary>size limit</secondary>
23735 </indexterm>
23736 <indexterm role="concept">
23737 <primary>limit</primary>
23738 <secondary>bounce message size</secondary>
23739 </indexterm>
23740 This option sets a limit in bytes on the size of messages that are returned to
23741 senders as part of bounce messages when <option>bounce_return_message</option> is true. The
23742 limit should be less than the value of the global <option>message_size_limit</option> and of
23743 any <option>message_size_limit</option> settings on transports, to allow for the bounce text
23744 that Exim generates. If this option is set to zero there is no limit.
23745 </para>
23746 <para>
23747 When the body of any message that is to be included in a bounce message is
23748 greater than the limit, it is truncated, and a comment pointing this out is
23749 added at the top. The actual cutoff may be greater than the value given, owing
23750 to the use of buffering for transferring the message in chunks (typically 8K in
23751 size). The idea is to save bandwidth on those undeliverable 15-megabyte
23752 messages.
23753 </para>
23754 <para>
23755 <indexterm role="option">
23756 <primary><option>bounce_sender_authentication</option></primary>
23757 </indexterm>
23758 </para>
23759 <informaltable frame="all">
23760 <tgroup cols="4" colsep="0" rowsep="0">
23761 <colspec colwidth="8*" align="left"/>
23762 <colspec colwidth="6*" align="center"/>
23763 <colspec colwidth="6*" align="center"/>
23764 <colspec colwidth="6*" align="right"/>
23765 <tbody>
23766 <row>
23767 <entry><option>bounce_sender_authentication</option></entry>
23768 <entry>Use: <emphasis>main</emphasis></entry>
23769 <entry>Type: <emphasis>string</emphasis></entry>
23770 <entry>Default: <emphasis>unset</emphasis></entry>
23771 </row>
23772 </tbody>
23773 </tgroup>
23774 </informaltable>
23775 <para>
23776 <indexterm role="concept">
23777 <primary>bounce message</primary>
23778 <secondary>sender authentication</secondary>
23779 </indexterm>
23780 <indexterm role="concept">
23781 <primary>authentication</primary>
23782 <secondary>bounce message</secondary>
23783 </indexterm>
23784 <indexterm role="concept">
23785 <primary>AUTH</primary>
23786 <secondary>on bounce message</secondary>
23787 </indexterm>
23788 This option provides an authenticated sender address that is sent with any
23789 bounce messages generated by Exim that are sent over an authenticated SMTP
23790 connection. A typical setting might be:
23791 </para>
23792 <literallayout class="monospaced">
23793 bounce_sender_authentication = mailer-daemon@my.domain.example
23794 </literallayout>
23795 <para>
23796 which would cause bounce messages to be sent using the SMTP command:
23797 </para>
23798 <literallayout class="monospaced">
23799 MAIL FROM:&lt;&gt; AUTH=mailer-daemon@my.domain.example
23800 </literallayout>
23801 <para>
23802 The value of <option>bounce_sender_authentication</option> must always be a complete email
23803 address.
23804 </para>
23805 <para>
23806 <indexterm role="option">
23807 <primary><option>callout_domain_negative_expire</option></primary>
23808 </indexterm>
23809 </para>
23810 <informaltable frame="all">
23811 <tgroup cols="4" colsep="0" rowsep="0">
23812 <colspec colwidth="8*" align="left"/>
23813 <colspec colwidth="6*" align="center"/>
23814 <colspec colwidth="6*" align="center"/>
23815 <colspec colwidth="6*" align="right"/>
23816 <tbody>
23817 <row>
23818 <entry><option>callout_domain_negative_expire</option></entry>
23819 <entry>Use: <emphasis>main</emphasis></entry>
23820 <entry>Type: <emphasis>time</emphasis></entry>
23821 <entry>Default: <emphasis>3h</emphasis></entry>
23822 </row>
23823 </tbody>
23824 </tgroup>
23825 </informaltable>
23826 <para>
23827 <indexterm role="concept">
23828 <primary>caching</primary>
23829 <secondary>callout timeouts</secondary>
23830 </indexterm>
23831 <indexterm role="concept">
23832 <primary>callout</primary>
23833 <secondary>caching timeouts</secondary>
23834 </indexterm>
23835 This option specifies the expiry time for negative callout cache data for a
23836 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
23837 section <xref linkend="SECTcallvercache"/> for details of the caching.
23838 </para>
23839 <para>
23840 <indexterm role="option">
23841 <primary><option>callout_domain_positive_expire</option></primary>
23842 </indexterm>
23843 </para>
23844 <informaltable frame="all">
23845 <tgroup cols="4" colsep="0" rowsep="0">
23846 <colspec colwidth="8*" align="left"/>
23847 <colspec colwidth="6*" align="center"/>
23848 <colspec colwidth="6*" align="center"/>
23849 <colspec colwidth="6*" align="right"/>
23850 <tbody>
23851 <row>
23852 <entry><option>callout_domain_positive_expire</option></entry>
23853 <entry>Use: <emphasis>main</emphasis></entry>
23854 <entry>Type: <emphasis>time</emphasis></entry>
23855 <entry>Default: <emphasis>7d</emphasis></entry>
23856 </row>
23857 </tbody>
23858 </tgroup>
23859 </informaltable>
23860 <para>
23861 This option specifies the expiry time for positive callout cache data for a
23862 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
23863 section <xref linkend="SECTcallvercache"/> for details of the caching.
23864 </para>
23865 <para>
23866 <indexterm role="option">
23867 <primary><option>callout_negative_expire</option></primary>
23868 </indexterm>
23869 </para>
23870 <informaltable frame="all">
23871 <tgroup cols="4" colsep="0" rowsep="0">
23872 <colspec colwidth="8*" align="left"/>
23873 <colspec colwidth="6*" align="center"/>
23874 <colspec colwidth="6*" align="center"/>
23875 <colspec colwidth="6*" align="right"/>
23876 <tbody>
23877 <row>
23878 <entry><option>callout_negative_expire</option></entry>
23879 <entry>Use: <emphasis>main</emphasis></entry>
23880 <entry>Type: <emphasis>time</emphasis></entry>
23881 <entry>Default: <emphasis>2h</emphasis></entry>
23882 </row>
23883 </tbody>
23884 </tgroup>
23885 </informaltable>
23886 <para>
23887 This option specifies the expiry time for negative callout cache data for an
23888 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
23889 section <xref linkend="SECTcallvercache"/> for details of the caching.
23890 </para>
23891 <para>
23892 <indexterm role="option">
23893 <primary><option>callout_positive_expire</option></primary>
23894 </indexterm>
23895 </para>
23896 <informaltable frame="all">
23897 <tgroup cols="4" colsep="0" rowsep="0">
23898 <colspec colwidth="8*" align="left"/>
23899 <colspec colwidth="6*" align="center"/>
23900 <colspec colwidth="6*" align="center"/>
23901 <colspec colwidth="6*" align="right"/>
23902 <tbody>
23903 <row>
23904 <entry><option>callout_positive_expire</option></entry>
23905 <entry>Use: <emphasis>main</emphasis></entry>
23906 <entry>Type: <emphasis>time</emphasis></entry>
23907 <entry>Default: <emphasis>24h</emphasis></entry>
23908 </row>
23909 </tbody>
23910 </tgroup>
23911 </informaltable>
23912 <para>
23913 This option specifies the expiry time for positive callout cache data for an
23914 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
23915 section <xref linkend="SECTcallvercache"/> for details of the caching.
23916 </para>
23917 <para>
23918 <indexterm role="option">
23919 <primary><option>callout_random_local_part</option></primary>
23920 </indexterm>
23921 </para>
23922 <informaltable frame="all">
23923 <tgroup cols="4" colsep="0" rowsep="0">
23924 <colspec colwidth="8*" align="left"/>
23925 <colspec colwidth="6*" align="center"/>
23926 <colspec colwidth="6*" align="center"/>
23927 <colspec colwidth="6*" align="right"/>
23928 <tbody>
23929 <row>
23930 <entry><option>callout_random_local_part</option></entry>
23931 <entry>Use: <emphasis>main</emphasis></entry>
23932 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23933 <entry>Default: <emphasis>see below</emphasis></entry>
23934 </row>
23935 </tbody>
23936 </tgroup>
23937 </informaltable>
23938 <para>
23939 This option defines the <quote>random</quote> local part that can be used as part of
23940 callout verification. The default value is
23941 </para>
23942 <literallayout class="monospaced">
23943 $primary_hostname-$tod_epoch-testing
23944 </literallayout>
23945 <para>
23946 See section <xref linkend="CALLaddparcall"/> for details of how this value is used.
23947 </para>
23948 <para>
23949 <indexterm role="option">
23950 <primary><option>check_log_inodes</option></primary>
23951 </indexterm>
23952 </para>
23953 <informaltable frame="all">
23954 <tgroup cols="4" colsep="0" rowsep="0">
23955 <colspec colwidth="8*" align="left"/>
23956 <colspec colwidth="6*" align="center"/>
23957 <colspec colwidth="6*" align="center"/>
23958 <colspec colwidth="6*" align="right"/>
23959 <tbody>
23960 <row>
23961 <entry><option>check_log_inodes</option></entry>
23962 <entry>Use: <emphasis>main</emphasis></entry>
23963 <entry>Type: <emphasis>integer</emphasis></entry>
23964 <entry>Default: <emphasis>100</emphasis></entry>
23965 </row>
23966 </tbody>
23967 </tgroup>
23968 </informaltable>
23969 <para>
23970 See <option>check_spool_space</option> below.
23971 </para>
23972 <para>
23973 <indexterm role="option">
23974 <primary><option>check_log_space</option></primary>
23975 </indexterm>
23976 </para>
23977 <informaltable frame="all">
23978 <tgroup cols="4" colsep="0" rowsep="0">
23979 <colspec colwidth="8*" align="left"/>
23980 <colspec colwidth="6*" align="center"/>
23981 <colspec colwidth="6*" align="center"/>
23982 <colspec colwidth="6*" align="right"/>
23983 <tbody>
23984 <row>
23985 <entry><option>check_log_space</option></entry>
23986 <entry>Use: <emphasis>main</emphasis></entry>
23987 <entry>Type: <emphasis>integer</emphasis></entry>
23988 <entry>Default: <emphasis>10M</emphasis></entry>
23989 </row>
23990 </tbody>
23991 </tgroup>
23992 </informaltable>
23993 <para>
23994 See <option>check_spool_space</option> below.
23995 </para>
23996 <para>
23997 <indexterm role="option">
23998 <primary><option>check_rfc2047_length</option></primary>
23999 </indexterm>
24000 <indexterm role="concept">
24001 <primary>RFC 2047</primary>
24002 <secondary>disabling length check</secondary>
24003 </indexterm>
24004 <indexterm role="option">
24005 <primary><option>check_rfc2047_length</option></primary>
24006 </indexterm>
24007 </para>
24008 <informaltable frame="all">
24009 <tgroup cols="4" colsep="0" rowsep="0">
24010 <colspec colwidth="8*" align="left"/>
24011 <colspec colwidth="6*" align="center"/>
24012 <colspec colwidth="6*" align="center"/>
24013 <colspec colwidth="6*" align="right"/>
24014 <tbody>
24015 <row>
24016 <entry><option>check_rfc2047_length</option></entry>
24017 <entry>Use: <emphasis>main</emphasis></entry>
24018 <entry>Type: <emphasis>boolean</emphasis></entry>
24019 <entry>Default: <emphasis>true</emphasis></entry>
24020 </row>
24021 </tbody>
24022 </tgroup>
24023 </informaltable>
24024 <para>
24025 RFC 2047 defines a way of encoding non-ASCII characters in headers using a
24026 system of <quote>encoded words</quote>. The RFC specifies a maximum length for an encoded
24027 word; strings to be encoded that exceed this length are supposed to use
24028 multiple encoded words. By default, Exim does not recognize encoded words that
24029 exceed the maximum length. However, it seems that some software, in violation
24030 of the RFC, generates overlong encoded words. If <option>check_rfc2047_length</option> is
24031 set false, Exim recognizes encoded words of any length.
24032 </para>
24033 <para>
24034 <indexterm role="option">
24035 <primary><option>check_spool_inodes</option></primary>
24036 </indexterm>
24037 </para>
24038 <informaltable frame="all">
24039 <tgroup cols="4" colsep="0" rowsep="0">
24040 <colspec colwidth="8*" align="left"/>
24041 <colspec colwidth="6*" align="center"/>
24042 <colspec colwidth="6*" align="center"/>
24043 <colspec colwidth="6*" align="right"/>
24044 <tbody>
24045 <row>
24046 <entry><option>check_spool_inodes</option></entry>
24047 <entry>Use: <emphasis>main</emphasis></entry>
24048 <entry>Type: <emphasis>integer</emphasis></entry>
24049 <entry>Default: <emphasis>100</emphasis></entry>
24050 </row>
24051 </tbody>
24052 </tgroup>
24053 </informaltable>
24054 <para>
24055 See <option>check_spool_space</option> below.
24056 </para>
24057 <para>
24058 <indexterm role="option">
24059 <primary><option>check_spool_space</option></primary>
24060 </indexterm>
24061 </para>
24062 <informaltable frame="all">
24063 <tgroup cols="4" colsep="0" rowsep="0">
24064 <colspec colwidth="8*" align="left"/>
24065 <colspec colwidth="6*" align="center"/>
24066 <colspec colwidth="6*" align="center"/>
24067 <colspec colwidth="6*" align="right"/>
24068 <tbody>
24069 <row>
24070 <entry><option>check_spool_space</option></entry>
24071 <entry>Use: <emphasis>main</emphasis></entry>
24072 <entry>Type: <emphasis>integer</emphasis></entry>
24073 <entry>Default: <emphasis>10M</emphasis></entry>
24074 </row>
24075 </tbody>
24076 </tgroup>
24077 </informaltable>
24078 <para>
24079 <indexterm role="concept">
24080 <primary>checking disk space</primary>
24081 </indexterm>
24082 <indexterm role="concept">
24083 <primary>disk space, checking</primary>
24084 </indexterm>
24085 <indexterm role="concept">
24086 <primary>spool directory</primary>
24087 <secondary>checking space</secondary>
24088 </indexterm>
24089 The four <option>check_...</option> options allow for checking of disk resources before a
24090 message is accepted.
24091 </para>
24092 <para>
24093 <indexterm role="variable">
24094 <primary><varname>$log_inodes</varname></primary>
24095 </indexterm>
24096 <indexterm role="variable">
24097 <primary><varname>$log_space</varname></primary>
24098 </indexterm>
24099 <indexterm role="variable">
24100 <primary><varname>$spool_inodes</varname></primary>
24101 </indexterm>
24102 <indexterm role="variable">
24103 <primary><varname>$spool_space</varname></primary>
24104 </indexterm>
24105 When any of these options are nonzero, they apply to all incoming messages. If you
24106 want to apply different checks to different kinds of message, you can do so by
24107 testing the variables <varname>$log_inodes</varname>, <varname>$log_space</varname>, <varname>$spool_inodes</varname>, and
24108 <varname>$spool_space</varname> in an ACL with appropriate additional conditions.
24109 </para>
24110 <para>
24111 <option>check_spool_space</option> and <option>check_spool_inodes</option> check the spool partition if
24112 either value is greater than zero, for example:
24113 </para>
24114 <literallayout class="monospaced">
24115 check_spool_space = 100M
24116 check_spool_inodes = 100
24117 </literallayout>
24118 <para>
24119 The spool partition is the one that contains the directory defined by
24120 SPOOL_DIRECTORY in <filename>Local/Makefile</filename>. It is used for holding messages in
24121 transit.
24122 </para>
24123 <para>
24124 <option>check_log_space</option> and <option>check_log_inodes</option>  check the partition in which log
24125 files are written if either is greater than zero. These should be set only if
24126 <option>log_file_path</option> and <option>spool_directory</option> refer to different partitions.
24127 </para>
24128 <para>
24129 If there is less space or fewer inodes than requested, Exim refuses to accept
24130 incoming mail. In the case of SMTP input this is done by giving a 452 temporary
24131 error response to the MAIL command. If ESMTP is in use and there was a
24132 SIZE parameter on the MAIL command, its value is added to the
24133 <option>check_spool_space</option> value, and the check is performed even if
24134 <option>check_spool_space</option> is zero, unless <option>no_smtp_check_spool_space</option> is set.
24135 </para>
24136 <para>
24137 The values for <option>check_spool_space</option> and <option>check_log_space</option> are held as a
24138 number of kilobytes (though specified in bytes).
24139 If a non-multiple of 1024 is specified, it is rounded up.
24140 </para>
24141 <para>
24142 For non-SMTP input and for batched SMTP input, the test is done at start-up; on
24143 failure a message is written to stderr and Exim exits with a non-zero code, as
24144 it obviously cannot send an error message of any kind.
24145 </para>
24146 <para>
24147 There is a slight performance penalty for these checks.
24148 Versions of Exim preceding 4.88 had these disabled by default;
24149 high-rate installations confident they will never run out of resources
24150 may wish to deliberately disable them.
24151 </para>
24152 <para>
24153 <indexterm role="option">
24154 <primary><option>chunking_advertise_hosts</option></primary>
24155 </indexterm>
24156 </para>
24157 <informaltable frame="all">
24158 <tgroup cols="4" colsep="0" rowsep="0">
24159 <colspec colwidth="8*" align="left"/>
24160 <colspec colwidth="6*" align="center"/>
24161 <colspec colwidth="6*" align="center"/>
24162 <colspec colwidth="6*" align="right"/>
24163 <tbody>
24164 <row>
24165 <entry><option>chunking_advertise_hosts</option></entry>
24166 <entry>Use: <emphasis>main</emphasis></entry>
24167 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
24168 <entry>Default: <emphasis>*</emphasis></entry>
24169 </row>
24170 </tbody>
24171 </tgroup>
24172 </informaltable>
24173 <para>
24174 <indexterm role="concept">
24175 <primary>CHUNKING</primary>
24176 <secondary>advertisement</secondary>
24177 </indexterm>
24178 <indexterm role="concept">
24179 <primary>RFC 3030</primary>
24180 <secondary>CHUNKING</secondary>
24181 </indexterm>
24182 The CHUNKING extension (RFC3030) will be advertised in the EHLO message to
24183 these hosts.
24184 Hosts may use the BDAT command as an alternate to DATA.
24185 </para>
24186 <para revisionflag="changed">
24187 <indexterm role="option">
24188 <primary><option>commandline_checks_require_admin</option></primary>
24189 </indexterm>
24190 </para>
24191 <informaltable frame="all" revisionflag="changed">
24192 <tgroup cols="4" colsep="0" rowsep="0">
24193 <colspec colwidth="8*" align="left"/>
24194 <colspec colwidth="6*" align="center"/>
24195 <colspec colwidth="6*" align="center"/>
24196 <colspec colwidth="6*" align="right"/>
24197 <tbody>
24198 <row>
24199 <entry><option>commandline_checks_require_admin</option></entry>
24200 <entry>Use: <emphasis>main</emphasis></entry>
24201 <entry>Type: <emphasis>boolean</emphasis></entry>
24202 <entry>Default: <emphasis><literal>false</literal></emphasis></entry>
24203 </row>
24204 </tbody>
24205 </tgroup>
24206 </informaltable>
24207 <para revisionflag="changed">
24208 <indexterm role="concept">
24209 <primary>restricting access to features</primary>
24210 </indexterm>
24211 This option restricts various basic checking features to require an
24212 administrative user.
24213 This affects most of the <option>-b*</option> options, such as <option>-be</option>.
24214 </para>
24215 <para>
24216 <indexterm role="option">
24217 <primary><option>debug_store</option></primary>
24218 </indexterm>
24219 </para>
24220 <informaltable frame="all">
24221 <tgroup cols="4" colsep="0" rowsep="0">
24222 <colspec colwidth="8*" align="left"/>
24223 <colspec colwidth="6*" align="center"/>
24224 <colspec colwidth="6*" align="center"/>
24225 <colspec colwidth="6*" align="right"/>
24226 <tbody>
24227 <row>
24228 <entry><option>debug_store</option></entry>
24229 <entry>Use: <emphasis>main</emphasis></entry>
24230 <entry>Type: <emphasis>boolean</emphasis></entry>
24231 <entry>Default: <emphasis><literal>false</literal></emphasis></entry>
24232 </row>
24233 </tbody>
24234 </tgroup>
24235 </informaltable>
24236 <para>
24237 <indexterm role="concept">
24238 <primary>debugging</primary>
24239 <secondary>memory corruption</secondary>
24240 </indexterm>
24241 <indexterm role="concept">
24242 <primary>memory</primary>
24243 <secondary>debugging</secondary>
24244 </indexterm>
24245 This option, when true, enables extra checking in Exim&#x2019;s internal memory
24246 management.  For use when a memory corruption issue is being investigated,
24247 it should normally be left as default.
24248 </para>
24249 <para>
24250 <indexterm role="option">
24251 <primary><option>daemon_smtp_ports</option></primary>
24252 </indexterm>
24253 </para>
24254 <informaltable frame="all">
24255 <tgroup cols="4" colsep="0" rowsep="0">
24256 <colspec colwidth="8*" align="left"/>
24257 <colspec colwidth="6*" align="center"/>
24258 <colspec colwidth="6*" align="center"/>
24259 <colspec colwidth="6*" align="right"/>
24260 <tbody>
24261 <row>
24262 <entry><option>daemon_smtp_ports</option></entry>
24263 <entry>Use: <emphasis>main</emphasis></entry>
24264 <entry>Type: <emphasis>string</emphasis></entry>
24265 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
24266 </row>
24267 </tbody>
24268 </tgroup>
24269 </informaltable>
24270 <para>
24271 <indexterm role="concept">
24272 <primary>port</primary>
24273 <secondary>for daemon</secondary>
24274 </indexterm>
24275 <indexterm role="concept">
24276 <primary>TCP/IP</primary>
24277 <secondary>setting listening ports</secondary>
24278 </indexterm>
24279 This option specifies one or more default SMTP ports on which the Exim daemon
24280 listens. See chapter <xref linkend="CHAPinterfaces"/> for details of how it is used. For
24281 backward compatibility, <option>daemon_smtp_port</option> (singular) is a synonym.
24282 </para>
24283 <para>
24284 <indexterm role="option">
24285 <primary><option>daemon_startup_retries</option></primary>
24286 </indexterm>
24287 </para>
24288 <informaltable frame="all">
24289 <tgroup cols="4" colsep="0" rowsep="0">
24290 <colspec colwidth="8*" align="left"/>
24291 <colspec colwidth="6*" align="center"/>
24292 <colspec colwidth="6*" align="center"/>
24293 <colspec colwidth="6*" align="right"/>
24294 <tbody>
24295 <row>
24296 <entry><option>daemon_startup_retries</option></entry>
24297 <entry>Use: <emphasis>main</emphasis></entry>
24298 <entry>Type: <emphasis>integer</emphasis></entry>
24299 <entry>Default: <emphasis>9</emphasis></entry>
24300 </row>
24301 </tbody>
24302 </tgroup>
24303 </informaltable>
24304 <para>
24305 <indexterm role="concept">
24306 <primary>daemon startup, retrying</primary>
24307 </indexterm>
24308 This option, along with <option>daemon_startup_sleep</option>, controls the retrying done by
24309 the daemon at startup when it cannot immediately bind a listening socket
24310 (typically because the socket is already in use): <option>daemon_startup_retries</option>
24311 defines the number of retries after the first failure, and
24312 <option>daemon_startup_sleep</option> defines the length of time to wait between retries.
24313 </para>
24314 <para>
24315 <indexterm role="option">
24316 <primary><option>daemon_startup_sleep</option></primary>
24317 </indexterm>
24318 </para>
24319 <informaltable frame="all">
24320 <tgroup cols="4" colsep="0" rowsep="0">
24321 <colspec colwidth="8*" align="left"/>
24322 <colspec colwidth="6*" align="center"/>
24323 <colspec colwidth="6*" align="center"/>
24324 <colspec colwidth="6*" align="right"/>
24325 <tbody>
24326 <row>
24327 <entry><option>daemon_startup_sleep</option></entry>
24328 <entry>Use: <emphasis>main</emphasis></entry>
24329 <entry>Type: <emphasis>time</emphasis></entry>
24330 <entry>Default: <emphasis>30s</emphasis></entry>
24331 </row>
24332 </tbody>
24333 </tgroup>
24334 </informaltable>
24335 <para>
24336 See <option>daemon_startup_retries</option>.
24337 </para>
24338 <para>
24339 <indexterm role="option">
24340 <primary><option>delay_warning</option></primary>
24341 </indexterm>
24342 </para>
24343 <informaltable frame="all">
24344 <tgroup cols="4" colsep="0" rowsep="0">
24345 <colspec colwidth="8*" align="left"/>
24346 <colspec colwidth="6*" align="center"/>
24347 <colspec colwidth="6*" align="center"/>
24348 <colspec colwidth="6*" align="right"/>
24349 <tbody>
24350 <row>
24351 <entry><option>delay_warning</option></entry>
24352 <entry>Use: <emphasis>main</emphasis></entry>
24353 <entry>Type: <emphasis>time list</emphasis></entry>
24354 <entry>Default: <emphasis>24h</emphasis></entry>
24355 </row>
24356 </tbody>
24357 </tgroup>
24358 </informaltable>
24359 <para>
24360 <indexterm role="concept">
24361 <primary>warning of delay</primary>
24362 </indexterm>
24363 <indexterm role="concept">
24364 <primary>delay warning, specifying</primary>
24365 </indexterm>
24366 <indexterm role="concept">
24367 <primary>queue</primary>
24368 <secondary>delay warning</secondary>
24369 </indexterm>
24370 When a message is delayed, Exim sends a warning message to the sender at
24371 intervals specified by this option. The data is a colon-separated list of times
24372 after which to send warning messages. If the value of the option is an empty
24373 string or a zero time, no warnings are sent. Up to 10 times may be given. If a
24374 message has been on the queue for longer than the last time, the last interval
24375 between the times is used to compute subsequent warning times. For example,
24376 with
24377 </para>
24378 <literallayout class="monospaced">
24379 delay_warning = 4h:8h:24h
24380 </literallayout>
24381 <para>
24382 the first message is sent after 4 hours, the second after 8 hours, and
24383 the third one after 24 hours. After that, messages are sent every 16 hours,
24384 because that is the interval between the last two times on the list. If you set
24385 just one time, it specifies the repeat interval. For example, with:
24386 </para>
24387 <literallayout class="monospaced">
24388 delay_warning = 6h
24389 </literallayout>
24390 <para>
24391 messages are repeated every six hours. To stop warnings after a given time, set
24392 a very large time at the end of the list. For example:
24393 </para>
24394 <literallayout class="monospaced">
24395 delay_warning = 2h:12h:99d
24396 </literallayout>
24397 <para>
24398 Note that the option is only evaluated at the time a delivery attempt fails,
24399 which depends on retry and queue-runner configuration.
24400 Typically retries will be configured more frequently than warning messages.
24401 </para>
24402 <para>
24403 <indexterm role="option">
24404 <primary><option>delay_warning_condition</option></primary>
24405 </indexterm>
24406 </para>
24407 <informaltable frame="all">
24408 <tgroup cols="4" colsep="0" rowsep="0">
24409 <colspec colwidth="8*" align="left"/>
24410 <colspec colwidth="6*" align="center"/>
24411 <colspec colwidth="6*" align="center"/>
24412 <colspec colwidth="6*" align="right"/>
24413 <tbody>
24414 <row>
24415 <entry><option>delay_warning_condition</option></entry>
24416 <entry>Use: <emphasis>main</emphasis></entry>
24417 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24418 <entry>Default: <emphasis>see below</emphasis></entry>
24419 </row>
24420 </tbody>
24421 </tgroup>
24422 </informaltable>
24423 <para>
24424 <indexterm role="variable">
24425 <primary><varname>$domain</varname></primary>
24426 </indexterm>
24427 The string is expanded at the time a warning message might be sent. If all the
24428 deferred addresses have the same domain, it is set in <varname>$domain</varname> during the
24429 expansion. Otherwise <varname>$domain</varname> is empty. If the result of the expansion is a
24430 forced failure, an empty string, or a string matching any of <quote>0</quote>, <quote>no</quote> or
24431 <quote>false</quote> (the comparison being done caselessly) then the warning message is
24432 not sent. The default is:
24433 </para>
24434 <literallayout class="monospaced">
24435 delay_warning_condition = ${if or {\
24436   { !eq{$h_list-id:$h_list-post:$h_list-subscribe:}{} }\
24437   { match{$h_precedence:}{(?i)bulk|list|junk} }\
24438   { match{$h_auto-submitted:}{(?i)auto-generated|auto-replied} }\
24439   } {no}{yes}}
24440 </literallayout>
24441 <para>
24442 This suppresses the sending of warnings for messages that contain <emphasis>List-ID:</emphasis>,
24443 <emphasis>List-Post:</emphasis>, or <emphasis>List-Subscribe:</emphasis> headers, or have <quote>bulk</quote>, <quote>list</quote> or
24444 <quote>junk</quote> in a <emphasis>Precedence:</emphasis> header, or have <quote>auto-generated</quote> or
24445 <quote>auto-replied</quote> in an <emphasis>Auto-Submitted:</emphasis> header.
24446 </para>
24447 <para>
24448 <indexterm role="option">
24449 <primary><option>deliver_drop_privilege</option></primary>
24450 </indexterm>
24451 </para>
24452 <informaltable frame="all">
24453 <tgroup cols="4" colsep="0" rowsep="0">
24454 <colspec colwidth="8*" align="left"/>
24455 <colspec colwidth="6*" align="center"/>
24456 <colspec colwidth="6*" align="center"/>
24457 <colspec colwidth="6*" align="right"/>
24458 <tbody>
24459 <row>
24460 <entry><option>deliver_drop_privilege</option></entry>
24461 <entry>Use: <emphasis>main</emphasis></entry>
24462 <entry>Type: <emphasis>boolean</emphasis></entry>
24463 <entry>Default: <emphasis>false</emphasis></entry>
24464 </row>
24465 </tbody>
24466 </tgroup>
24467 </informaltable>
24468 <para>
24469 <indexterm role="concept">
24470 <primary>unprivileged delivery</primary>
24471 </indexterm>
24472 <indexterm role="concept">
24473 <primary>delivery</primary>
24474 <secondary>unprivileged</secondary>
24475 </indexterm>
24476 If this option is set true, Exim drops its root privilege at the start of a
24477 delivery process, and runs as the Exim user throughout. This severely restricts
24478 the kinds of local delivery that are possible, but is viable in certain types
24479 of configuration. There is a discussion about the use of root privilege in
24480 chapter <xref linkend="CHAPsecurity"/>.
24481 </para>
24482 <para>
24483 <indexterm role="option">
24484 <primary><option>deliver_queue_load_max</option></primary>
24485 </indexterm>
24486 </para>
24487 <informaltable frame="all">
24488 <tgroup cols="4" colsep="0" rowsep="0">
24489 <colspec colwidth="8*" align="left"/>
24490 <colspec colwidth="6*" align="center"/>
24491 <colspec colwidth="6*" align="center"/>
24492 <colspec colwidth="6*" align="right"/>
24493 <tbody>
24494 <row>
24495 <entry><option>deliver_queue_load_max</option></entry>
24496 <entry>Use: <emphasis>main</emphasis></entry>
24497 <entry>Type: <emphasis>fixed-point</emphasis></entry>
24498 <entry>Default: <emphasis>unset</emphasis></entry>
24499 </row>
24500 </tbody>
24501 </tgroup>
24502 </informaltable>
24503 <para>
24504 <indexterm role="concept">
24505 <primary>load average</primary>
24506 </indexterm>
24507 <indexterm role="concept">
24508 <primary>queue runner</primary>
24509 <secondary>abandoning</secondary>
24510 </indexterm>
24511 When this option is set, a queue run is abandoned if the system load average
24512 becomes greater than the value of the option. The option has no effect on
24513 ancient operating systems on which Exim cannot determine the load average.
24514 See also <option>queue_only_load</option> and <option>smtp_load_reserve</option>.
24515 </para>
24516 <para>
24517 <indexterm role="option">
24518 <primary><option>delivery_date_remove</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>delivery_date_remove</option></entry>
24530 <entry>Use: <emphasis>main</emphasis></entry>
24531 <entry>Type: <emphasis>boolean</emphasis></entry>
24532 <entry>Default: <emphasis>true</emphasis></entry>
24533 </row>
24534 </tbody>
24535 </tgroup>
24536 </informaltable>
24537 <para>
24538 <indexterm role="concept">
24539 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
24540 </indexterm>
24541 Exim&#x2019;s transports have an option for adding a <emphasis>Delivery-date:</emphasis> header to a
24542 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
24543 handled. <emphasis>Delivery-date:</emphasis> records the actual time of delivery. Such headers
24544 should not be present in incoming messages, and this option causes them to be
24545 removed at the time the message is received, to avoid any problems that might
24546 occur when a delivered message is subsequently sent on to some other recipient.
24547 </para>
24548 <para>
24549 <indexterm role="option">
24550 <primary><option>disable_fsync</option></primary>
24551 </indexterm>
24552 </para>
24553 <informaltable frame="all">
24554 <tgroup cols="4" colsep="0" rowsep="0">
24555 <colspec colwidth="8*" align="left"/>
24556 <colspec colwidth="6*" align="center"/>
24557 <colspec colwidth="6*" align="center"/>
24558 <colspec colwidth="6*" align="right"/>
24559 <tbody>
24560 <row>
24561 <entry><option>disable_fsync</option></entry>
24562 <entry>Use: <emphasis>main</emphasis></entry>
24563 <entry>Type: <emphasis>boolean</emphasis></entry>
24564 <entry>Default: <emphasis>false</emphasis></entry>
24565 </row>
24566 </tbody>
24567 </tgroup>
24568 </informaltable>
24569 <para>
24570 <indexterm role="concept">
24571 <primary><function>fsync()</function>, disabling</primary>
24572 </indexterm>
24573 This option is available only if Exim was built with the compile-time option
24574 ENABLE_DISABLE_FSYNC. When this is not set, a reference to <option>disable_fsync</option> in
24575 a runtime configuration generates an <quote>unknown option</quote> error. You should not
24576 build Exim with ENABLE_DISABLE_FSYNC or set <option>disable_fsync</option> unless you
24577 really, really, really understand what you are doing. <emphasis>No pre-compiled
24578 distributions of Exim should ever make this option available.</emphasis>
24579 </para>
24580 <para>
24581 When <option>disable_fsync</option> is set true, Exim no longer calls <function>fsync()</function> to force
24582 updated files&#x2019; data to be written to disc before continuing. Unexpected events
24583 such as crashes and power outages may cause data to be lost or scrambled.
24584 Here be Dragons. <emphasis role="bold">Beware.</emphasis>
24585 </para>
24586 <para>
24587 <indexterm role="option">
24588 <primary><option>disable_ipv6</option></primary>
24589 </indexterm>
24590 </para>
24591 <informaltable frame="all">
24592 <tgroup cols="4" colsep="0" rowsep="0">
24593 <colspec colwidth="8*" align="left"/>
24594 <colspec colwidth="6*" align="center"/>
24595 <colspec colwidth="6*" align="center"/>
24596 <colspec colwidth="6*" align="right"/>
24597 <tbody>
24598 <row>
24599 <entry><option>disable_ipv6</option></entry>
24600 <entry>Use: <emphasis>main</emphasis></entry>
24601 <entry>Type: <emphasis>boolean</emphasis></entry>
24602 <entry>Default: <emphasis>false</emphasis></entry>
24603 </row>
24604 </tbody>
24605 </tgroup>
24606 </informaltable>
24607 <para>
24608 <indexterm role="concept">
24609 <primary>IPv6</primary>
24610 <secondary>disabling</secondary>
24611 </indexterm>
24612 If this option is set true, even if the Exim binary has IPv6 support, no IPv6
24613 activities take place. AAAA records are never looked up, and any IPv6 addresses
24614 that are listed in <option>local_interfaces</option>, data for the <option>manualroute</option> router,
24615 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
24616 to handle IPv6 literal addresses.
24617 </para>
24618 <para>
24619 <indexterm role="option">
24620 <primary><option>dkim_verify_signers</option></primary>
24621 </indexterm>
24622 </para>
24623 <informaltable frame="all">
24624 <tgroup cols="4" colsep="0" rowsep="0">
24625 <colspec colwidth="8*" align="left"/>
24626 <colspec colwidth="6*" align="center"/>
24627 <colspec colwidth="6*" align="center"/>
24628 <colspec colwidth="6*" align="right"/>
24629 <tbody>
24630 <row>
24631 <entry><option>dkim_verify_signers</option></entry>
24632 <entry>Use: <emphasis>main</emphasis></entry>
24633 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
24634 <entry>Default: <emphasis>$dkim_signers</emphasis></entry>
24635 </row>
24636 </tbody>
24637 </tgroup>
24638 </informaltable>
24639 <para>
24640 <indexterm role="concept">
24641 <primary>DKIM</primary>
24642 <secondary>controlling calls to the ACL</secondary>
24643 </indexterm>
24644 This option gives a list of DKIM domains for which the DKIM ACL is run.
24645 It is expanded after the message is received; by default it runs
24646 the ACL once for each signature in the message.
24647 See chapter <xref linkend="CHAPdkim"/>.
24648 </para>
24649 <para>
24650 <indexterm role="option">
24651 <primary><option>dns_again_means_nonexist</option></primary>
24652 </indexterm>
24653 </para>
24654 <informaltable frame="all">
24655 <tgroup cols="4" colsep="0" rowsep="0">
24656 <colspec colwidth="8*" align="left"/>
24657 <colspec colwidth="6*" align="center"/>
24658 <colspec colwidth="6*" align="center"/>
24659 <colspec colwidth="6*" align="right"/>
24660 <tbody>
24661 <row>
24662 <entry><option>dns_again_means_nonexist</option></entry>
24663 <entry>Use: <emphasis>main</emphasis></entry>
24664 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
24665 <entry>Default: <emphasis>unset</emphasis></entry>
24666 </row>
24667 </tbody>
24668 </tgroup>
24669 </informaltable>
24670 <para>
24671 <indexterm role="concept">
24672 <primary>DNS</primary>
24673 <secondary><quote>try again</quote> response; overriding</secondary>
24674 </indexterm>
24675 DNS lookups give a <quote>try again</quote> response for the DNS errors
24676 <quote>non-authoritative host not found</quote> and <quote>SERVERFAIL</quote>. This can cause Exim to
24677 keep trying to deliver a message, or to give repeated temporary errors to
24678 incoming mail. Sometimes the effect is caused by a badly set up name server and
24679 may persist for a long time. If a domain which exhibits this problem matches
24680 anything in <option>dns_again_means_nonexist</option>, it is treated as if it did not exist.
24681 This option should be used with care. You can make it apply to reverse lookups
24682 by a setting such as this:
24683 </para>
24684 <literallayout class="monospaced">
24685 dns_again_means_nonexist = *.in-addr.arpa
24686 </literallayout>
24687 <para>
24688 This option applies to all DNS lookups that Exim does. It also applies when the
24689 <function>gethostbyname()</function> or <function>getipnodebyname()</function> functions give temporary errors,
24690 since these are most likely to be caused by DNS lookup problems. The
24691 <command>dnslookup</command> router has some options of its own for controlling what happens
24692 when lookups for MX or SRV records give temporary errors. These more specific
24693 options are applied after this global option.
24694 </para>
24695 <para>
24696 <indexterm role="option">
24697 <primary><option>dns_check_names_pattern</option></primary>
24698 </indexterm>
24699 </para>
24700 <informaltable frame="all">
24701 <tgroup cols="4" colsep="0" rowsep="0">
24702 <colspec colwidth="8*" align="left"/>
24703 <colspec colwidth="6*" align="center"/>
24704 <colspec colwidth="6*" align="center"/>
24705 <colspec colwidth="6*" align="right"/>
24706 <tbody>
24707 <row>
24708 <entry><option>dns_check_names_pattern</option></entry>
24709 <entry>Use: <emphasis>main</emphasis></entry>
24710 <entry>Type: <emphasis>string</emphasis></entry>
24711 <entry>Default: <emphasis>see below</emphasis></entry>
24712 </row>
24713 </tbody>
24714 </tgroup>
24715 </informaltable>
24716 <para>
24717 <indexterm role="concept">
24718 <primary>DNS</primary>
24719 <secondary>pre-check of name syntax</secondary>
24720 </indexterm>
24721 When this option is set to a non-empty string, it causes Exim to check domain
24722 names for characters that are not allowed in host names before handing them to
24723 the DNS resolver, because some resolvers give temporary errors for names that
24724 contain unusual characters. If a domain name contains any unwanted characters,
24725 a <quote>not found</quote> result is forced, and the resolver is not called. The check is
24726 done by matching the domain name against a regular expression, which is the
24727 value of this option. The default pattern is
24728 </para>
24729 <literallayout class="monospaced">
24730 dns_check_names_pattern = \
24731   (?i)^(?&gt;(?(1)\.|())[^\W_](?&gt;[a-z0-9/-]*[^\W_])?)+$
24732 </literallayout>
24733 <para>
24734 which permits only letters, digits, slashes, and hyphens in components, but
24735 they must start and end with a letter or digit. Slashes are not, in fact,
24736 permitted in host names, but they are found in certain NS records (which can be
24737 accessed in Exim by using a <option>dnsdb</option> lookup). If you set
24738 <option>allow_utf8_domains</option>, you must modify this pattern, or set the option to an
24739 empty string.
24740 </para>
24741 <para>
24742 <indexterm role="option">
24743 <primary><option>dns_csa_search_limit</option></primary>
24744 </indexterm>
24745 </para>
24746 <informaltable frame="all">
24747 <tgroup cols="4" colsep="0" rowsep="0">
24748 <colspec colwidth="8*" align="left"/>
24749 <colspec colwidth="6*" align="center"/>
24750 <colspec colwidth="6*" align="center"/>
24751 <colspec colwidth="6*" align="right"/>
24752 <tbody>
24753 <row>
24754 <entry><option>dns_csa_search_limit</option></entry>
24755 <entry>Use: <emphasis>main</emphasis></entry>
24756 <entry>Type: <emphasis>integer</emphasis></entry>
24757 <entry>Default: <emphasis>5</emphasis></entry>
24758 </row>
24759 </tbody>
24760 </tgroup>
24761 </informaltable>
24762 <para>
24763 This option controls the depth of parental searching for CSA SRV records in the
24764 DNS, as described in more detail in section <xref linkend="SECTverifyCSA"/>.
24765 </para>
24766 <para>
24767 <indexterm role="option">
24768 <primary><option>dns_csa_use_reverse</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>dns_csa_use_reverse</option></entry>
24780 <entry>Use: <emphasis>main</emphasis></entry>
24781 <entry>Type: <emphasis>boolean</emphasis></entry>
24782 <entry>Default: <emphasis>true</emphasis></entry>
24783 </row>
24784 </tbody>
24785 </tgroup>
24786 </informaltable>
24787 <para>
24788 This option controls whether or not an IP address, given as a CSA domain, is
24789 reversed and looked up in the reverse DNS, as described in more detail in
24790 section <xref linkend="SECTverifyCSA"/>.
24791 </para>
24792 <para>
24793 <indexterm role="option">
24794 <primary><option>dns_dnssec_ok</option></primary>
24795 </indexterm>
24796 </para>
24797 <informaltable frame="all">
24798 <tgroup cols="4" colsep="0" rowsep="0">
24799 <colspec colwidth="8*" align="left"/>
24800 <colspec colwidth="6*" align="center"/>
24801 <colspec colwidth="6*" align="center"/>
24802 <colspec colwidth="6*" align="right"/>
24803 <tbody>
24804 <row>
24805 <entry><option>dns_dnssec_ok</option></entry>
24806 <entry>Use: <emphasis>main</emphasis></entry>
24807 <entry>Type: <emphasis>integer</emphasis></entry>
24808 <entry>Default: <emphasis>-1</emphasis></entry>
24809 </row>
24810 </tbody>
24811 </tgroup>
24812 </informaltable>
24813 <para>
24814 <indexterm role="concept">
24815 <primary>DNS</primary>
24816 <secondary>resolver options</secondary>
24817 </indexterm>
24818 <indexterm role="concept">
24819 <primary>DNS</primary>
24820 <secondary>DNSSEC</secondary>
24821 </indexterm>
24822 If this option is set to a non-negative number then Exim will initialise the
24823 DNS resolver library to either use or not use DNSSEC, overriding the system
24824 default. A value of 0 coerces DNSSEC off, a value of 1 coerces DNSSEC on.
24825 </para>
24826 <para>
24827 If the resolver library does not support DNSSEC then this option has no effect.
24828 </para>
24829 <para>
24830 <indexterm role="option">
24831 <primary><option>dns_ipv4_lookup</option></primary>
24832 </indexterm>
24833 </para>
24834 <informaltable frame="all">
24835 <tgroup cols="4" colsep="0" rowsep="0">
24836 <colspec colwidth="8*" align="left"/>
24837 <colspec colwidth="6*" align="center"/>
24838 <colspec colwidth="6*" align="center"/>
24839 <colspec colwidth="6*" align="right"/>
24840 <tbody>
24841 <row>
24842 <entry><option>dns_ipv4_lookup</option></entry>
24843 <entry>Use: <emphasis>main</emphasis></entry>
24844 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
24845 <entry>Default: <emphasis>unset</emphasis></entry>
24846 </row>
24847 </tbody>
24848 </tgroup>
24849 </informaltable>
24850 <para>
24851 <indexterm role="concept">
24852 <primary>IPv6</primary>
24853 <secondary>DNS lookup for AAAA records</secondary>
24854 </indexterm>
24855 <indexterm role="concept">
24856 <primary>DNS</primary>
24857 <secondary>IPv6 lookup for AAAA records</secondary>
24858 </indexterm>
24859 When Exim is compiled with IPv6 support and <option>disable_ipv6</option> is not set, it
24860 looks for IPv6 address records (AAAA records) as well as IPv4 address records
24861 (A records) when trying to find IP addresses for hosts, unless the host&#x2019;s
24862 domain matches this list.
24863 </para>
24864 <para>
24865 This is a fudge to help with name servers that give big delays or otherwise do
24866 not work for the AAAA record type. In due course, when the world&#x2019;s name
24867 servers have all been upgraded, there should be no need for this option.
24868 </para>
24869 <para>
24870 <indexterm role="option">
24871 <primary><option>dns_retrans</option></primary>
24872 </indexterm>
24873 </para>
24874 <informaltable frame="all">
24875 <tgroup cols="4" colsep="0" rowsep="0">
24876 <colspec colwidth="8*" align="left"/>
24877 <colspec colwidth="6*" align="center"/>
24878 <colspec colwidth="6*" align="center"/>
24879 <colspec colwidth="6*" align="right"/>
24880 <tbody>
24881 <row>
24882 <entry><option>dns_retrans</option></entry>
24883 <entry>Use: <emphasis>main</emphasis></entry>
24884 <entry>Type: <emphasis>time</emphasis></entry>
24885 <entry>Default: <emphasis>0s</emphasis></entry>
24886 </row>
24887 </tbody>
24888 </tgroup>
24889 </informaltable>
24890 <para>
24891 <indexterm role="concept">
24892 <primary>DNS</primary>
24893 <secondary>resolver options</secondary>
24894 </indexterm>
24895 <indexterm role="concept">
24896 <primary>timeout</primary>
24897 <secondary>dns lookup</secondary>
24898 </indexterm>
24899 <indexterm role="concept">
24900 <primary>DNS</primary>
24901 <secondary>timeout</secondary>
24902 </indexterm>
24903 The options <option>dns_retrans</option> and <option>dns_retry</option> can be used to set the
24904 retransmission and retry parameters for DNS lookups. Values of zero (the
24905 defaults) leave the system default settings unchanged. The first value is the
24906 time between retries, and the second is the number of retries. It isn&#x2019;t
24907 totally clear exactly how these settings affect the total time a DNS lookup may
24908 take. I haven&#x2019;t found any documentation about timeouts on DNS lookups; these
24909 parameter values are available in the external resolver interface structure,
24910 but nowhere does it seem to describe how they are used or what you might want
24911 to set in them.
24912 See also the <option>slow_lookup_log</option> option.
24913 </para>
24914 <para>
24915 <indexterm role="option">
24916 <primary><option>dns_retry</option></primary>
24917 </indexterm>
24918 </para>
24919 <informaltable frame="all">
24920 <tgroup cols="4" colsep="0" rowsep="0">
24921 <colspec colwidth="8*" align="left"/>
24922 <colspec colwidth="6*" align="center"/>
24923 <colspec colwidth="6*" align="center"/>
24924 <colspec colwidth="6*" align="right"/>
24925 <tbody>
24926 <row>
24927 <entry><option>dns_retry</option></entry>
24928 <entry>Use: <emphasis>main</emphasis></entry>
24929 <entry>Type: <emphasis>integer</emphasis></entry>
24930 <entry>Default: <emphasis>0</emphasis></entry>
24931 </row>
24932 </tbody>
24933 </tgroup>
24934 </informaltable>
24935 <para>
24936 See <option>dns_retrans</option> above.
24937 </para>
24938 <para>
24939 <indexterm role="option">
24940 <primary><option>dns_trust_aa</option></primary>
24941 </indexterm>
24942 </para>
24943 <informaltable frame="all">
24944 <tgroup cols="4" colsep="0" rowsep="0">
24945 <colspec colwidth="8*" align="left"/>
24946 <colspec colwidth="6*" align="center"/>
24947 <colspec colwidth="6*" align="center"/>
24948 <colspec colwidth="6*" align="right"/>
24949 <tbody>
24950 <row>
24951 <entry><option>dns_trust_aa</option></entry>
24952 <entry>Use: <emphasis>main</emphasis></entry>
24953 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
24954 <entry>Default: <emphasis>unset</emphasis></entry>
24955 </row>
24956 </tbody>
24957 </tgroup>
24958 </informaltable>
24959 <para>
24960 <indexterm role="concept">
24961 <primary>DNS</primary>
24962 <secondary>resolver options</secondary>
24963 </indexterm>
24964 <indexterm role="concept">
24965 <primary>DNS</primary>
24966 <secondary>DNSSEC</secondary>
24967 </indexterm>
24968 If this option is set then lookup results marked with the AA bit
24969 (Authoritative Answer) are trusted the same way as if they were
24970 DNSSEC-verified. The authority section&#x2019;s name of the answer must
24971 match with this expanded domain list.
24972 </para>
24973 <para>
24974 Use this option only if you talk directly to a resolver that is
24975 authoritative for some zones and does not set the AD (Authentic Data)
24976 bit in the answer. Some DNS servers may have an configuration option to
24977 mark the answers from their own zones as verified (they set the AD bit).
24978 Others do not have this option. It is considered as poor practice using
24979 a resolver that is an authoritative server for some zones.
24980 </para>
24981 <para>
24982 Use this option only if you really have to (e.g. if you want
24983 to use DANE for remote delivery to a server that is listed in the DNS
24984 zones that your resolver is authoritative for).
24985 </para>
24986 <para>
24987 If the DNS answer packet has the AA bit set and contains resource record
24988 in the answer section, the name of the first NS record appearing in the
24989 authority section is compared against the list. If the answer packet is
24990 authoritative but the answer section is empty, the name of the first SOA
24991 record in the authoritative section is used instead.
24992 </para>
24993 <para>
24994 <indexterm role="concept">
24995 <primary>DNS</primary>
24996 <secondary>resolver options</secondary>
24997 </indexterm>
24998 <indexterm role="option">
24999 <primary><option>dns_use_edns0</option></primary>
25000 </indexterm>
25001 </para>
25002 <informaltable frame="all">
25003 <tgroup cols="4" colsep="0" rowsep="0">
25004 <colspec colwidth="8*" align="left"/>
25005 <colspec colwidth="6*" align="center"/>
25006 <colspec colwidth="6*" align="center"/>
25007 <colspec colwidth="6*" align="right"/>
25008 <tbody>
25009 <row>
25010 <entry><option>dns_use_edns0</option></entry>
25011 <entry>Use: <emphasis>main</emphasis></entry>
25012 <entry>Type: <emphasis>integer</emphasis></entry>
25013 <entry>Default: <emphasis>-1</emphasis></entry>
25014 </row>
25015 </tbody>
25016 </tgroup>
25017 </informaltable>
25018 <para>
25019 <indexterm role="concept">
25020 <primary>DNS</primary>
25021 <secondary>resolver options</secondary>
25022 </indexterm>
25023 <indexterm role="concept">
25024 <primary>DNS</primary>
25025 <secondary>EDNS0</secondary>
25026 </indexterm>
25027 <indexterm role="concept">
25028 <primary>DNS</primary>
25029 <secondary>OpenBSD</secondary>
25030 </indexterm>
25031 If this option is set to a non-negative number then Exim will initialise the
25032 DNS resolver library to either use or not use EDNS0 extensions, overriding
25033 the system default. A value of 0 coerces EDNS0 off, a value of 1 coerces EDNS0
25034 on.
25035 </para>
25036 <para>
25037 If the resolver library does not support EDNS0 then this option has no effect.
25038 </para>
25039 <para>
25040 OpenBSD&#x2019;s asr resolver routines are known to ignore the EDNS0 option; this
25041 means that DNSSEC will not work with Exim on that platform either, unless Exim
25042 is linked against an alternative DNS client library.
25043 </para>
25044 <para>
25045 <indexterm role="option">
25046 <primary><option>drop_cr</option></primary>
25047 </indexterm>
25048 </para>
25049 <informaltable frame="all">
25050 <tgroup cols="4" colsep="0" rowsep="0">
25051 <colspec colwidth="8*" align="left"/>
25052 <colspec colwidth="6*" align="center"/>
25053 <colspec colwidth="6*" align="center"/>
25054 <colspec colwidth="6*" align="right"/>
25055 <tbody>
25056 <row>
25057 <entry><option>drop_cr</option></entry>
25058 <entry>Use: <emphasis>main</emphasis></entry>
25059 <entry>Type: <emphasis>boolean</emphasis></entry>
25060 <entry>Default: <emphasis>false</emphasis></entry>
25061 </row>
25062 </tbody>
25063 </tgroup>
25064 </informaltable>
25065 <para>
25066 This is an obsolete option that is now a no-op. It used to affect the way Exim
25067 handled CR and LF characters in incoming messages. What happens now is
25068 described in section <xref linkend="SECTlineendings"/>.
25069 </para>
25070 <para>
25071 <indexterm role="option">
25072 <primary><option>dsn_advertise_hosts</option></primary>
25073 </indexterm>
25074 </para>
25075 <informaltable frame="all">
25076 <tgroup cols="4" colsep="0" rowsep="0">
25077 <colspec colwidth="8*" align="left"/>
25078 <colspec colwidth="6*" align="center"/>
25079 <colspec colwidth="6*" align="center"/>
25080 <colspec colwidth="6*" align="right"/>
25081 <tbody>
25082 <row>
25083 <entry><option>dsn_advertise_hosts</option></entry>
25084 <entry>Use: <emphasis>main</emphasis></entry>
25085 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25086 <entry>Default: <emphasis>unset</emphasis></entry>
25087 </row>
25088 </tbody>
25089 </tgroup>
25090 </informaltable>
25091 <para>
25092 <indexterm role="concept">
25093 <primary>bounce messages</primary>
25094 <secondary>success</secondary>
25095 </indexterm>
25096 <indexterm role="concept">
25097 <primary>DSN</primary>
25098 <secondary>success</secondary>
25099 </indexterm>
25100 <indexterm role="concept">
25101 <primary>Delivery Status Notification</primary>
25102 <secondary>success</secondary>
25103 </indexterm>
25104 DSN extensions (RFC3461) will be advertised in the EHLO message to,
25105 and accepted from, these hosts.
25106 Hosts may use the NOTIFY and ENVID options on RCPT TO commands,
25107 and RET and ORCPT options on MAIL FROM commands.
25108 A NOTIFY=SUCCESS option requests success-DSN messages.
25109 A NOTIFY= option with no argument requests that no delay or failure DSNs
25110 are sent.
25111 </para>
25112 <para>
25113 <indexterm role="option">
25114 <primary><option>dsn_from</option></primary>
25115 </indexterm>
25116 </para>
25117 <informaltable frame="all">
25118 <tgroup cols="4" colsep="0" rowsep="0">
25119 <colspec colwidth="8*" align="left"/>
25120 <colspec colwidth="6*" align="center"/>
25121 <colspec colwidth="6*" align="center"/>
25122 <colspec colwidth="6*" align="right"/>
25123 <tbody>
25124 <row>
25125 <entry><option>dsn_from</option></entry>
25126 <entry>Use: <emphasis>main</emphasis></entry>
25127 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25128 <entry>Default: <emphasis>see below</emphasis></entry>
25129 </row>
25130 </tbody>
25131 </tgroup>
25132 </informaltable>
25133 <para>
25134 <indexterm role="concept">
25135 <primary><emphasis>From:</emphasis> header line</primary>
25136 <secondary>in bounces</secondary>
25137 </indexterm>
25138 <indexterm role="concept">
25139 <primary>bounce messages</primary>
25140 <secondary><emphasis>From:</emphasis> line, specifying</secondary>
25141 </indexterm>
25142 This option can be used to vary the contents of <emphasis>From:</emphasis> header lines in
25143 bounces and other automatically generated messages (<quote>Delivery Status
25144 Notifications</quote> &ndash; hence the name of the option). The default setting is:
25145 </para>
25146 <literallayout class="monospaced">
25147 dsn_from = Mail Delivery System &lt;Mailer-Daemon@$qualify_domain&gt;
25148 </literallayout>
25149 <para>
25150 The value is expanded every time it is needed. If the expansion fails, a
25151 panic is logged, and the default value is used.
25152 </para>
25153 <para>
25154 <indexterm role="option">
25155 <primary><option>envelope_to_remove</option></primary>
25156 </indexterm>
25157 </para>
25158 <informaltable frame="all">
25159 <tgroup cols="4" colsep="0" rowsep="0">
25160 <colspec colwidth="8*" align="left"/>
25161 <colspec colwidth="6*" align="center"/>
25162 <colspec colwidth="6*" align="center"/>
25163 <colspec colwidth="6*" align="right"/>
25164 <tbody>
25165 <row>
25166 <entry><option>envelope_to_remove</option></entry>
25167 <entry>Use: <emphasis>main</emphasis></entry>
25168 <entry>Type: <emphasis>boolean</emphasis></entry>
25169 <entry>Default: <emphasis>true</emphasis></entry>
25170 </row>
25171 </tbody>
25172 </tgroup>
25173 </informaltable>
25174 <para>
25175 <indexterm role="concept">
25176 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
25177 </indexterm>
25178 Exim&#x2019;s transports have an option for adding an <emphasis>Envelope-to:</emphasis> header to a
25179 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
25180 handled. <emphasis>Envelope-to:</emphasis> records the original recipient address from the
25181 message&#x2019;s envelope that caused the delivery to happen. Such headers should not
25182 be present in incoming messages, and this option causes them to be removed at
25183 the time the message is received, to avoid any problems that might occur when a
25184 delivered message is subsequently sent on to some other recipient.
25185 </para>
25186 <para>
25187 <indexterm role="option">
25188 <primary><option>errors_copy</option></primary>
25189 </indexterm>
25190 </para>
25191 <informaltable frame="all">
25192 <tgroup cols="4" colsep="0" rowsep="0">
25193 <colspec colwidth="8*" align="left"/>
25194 <colspec colwidth="6*" align="center"/>
25195 <colspec colwidth="6*" align="center"/>
25196 <colspec colwidth="6*" align="right"/>
25197 <tbody>
25198 <row>
25199 <entry><option>errors_copy</option></entry>
25200 <entry>Use: <emphasis>main</emphasis></entry>
25201 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
25202 <entry>Default: <emphasis>unset</emphasis></entry>
25203 </row>
25204 </tbody>
25205 </tgroup>
25206 </informaltable>
25207 <para>
25208 <indexterm role="concept">
25209 <primary>bounce message</primary>
25210 <secondary>copy to other address</secondary>
25211 </indexterm>
25212 <indexterm role="concept">
25213 <primary>copy of bounce message</primary>
25214 </indexterm>
25215 Setting this option causes Exim to send bcc copies of bounce messages that it
25216 generates to other addresses. <emphasis role="bold">Note</emphasis>: This does not apply to bounce messages
25217 coming from elsewhere. The value of the option is a colon-separated list of
25218 items. Each item consists of a pattern, terminated by white space, followed by
25219 a comma-separated list of email addresses. If a pattern contains spaces, it
25220 must be enclosed in double quotes.
25221 </para>
25222 <para>
25223 Each pattern is processed in the same way as a single item in an address list
25224 (see section <xref linkend="SECTaddresslist"/>). When a pattern matches the recipient of
25225 the bounce message, the message is copied to the addresses on the list. The
25226 items are scanned in order, and once a matching one is found, no further items
25227 are examined. For example:
25228 </para>
25229 <literallayout class="monospaced">
25230 errors_copy = spqr@mydomain   postmaster@mydomain.example :\
25231               rqps@mydomain   hostmaster@mydomain.example,\
25232                               postmaster@mydomain.example
25233 </literallayout>
25234 <para>
25235 <indexterm role="variable">
25236 <primary><varname>$domain</varname></primary>
25237 </indexterm>
25238 <indexterm role="variable">
25239 <primary><varname>$local_part</varname></primary>
25240 </indexterm>
25241 The address list is expanded before use. The expansion variables <varname>$local_part</varname>
25242 and <varname>$domain</varname> are set from the original recipient of the error message, and if
25243 there was any wildcard matching in the pattern, the expansion
25244 <indexterm role="concept">
25245 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
25246 <secondary>in <option>errors_copy</option></secondary>
25247 </indexterm>
25248 variables <varname>$0</varname>, <varname>$1</varname>, etc. are set in the normal way.
25249 </para>
25250 <para>
25251 <indexterm role="option">
25252 <primary><option>errors_reply_to</option></primary>
25253 </indexterm>
25254 </para>
25255 <informaltable frame="all">
25256 <tgroup cols="4" colsep="0" rowsep="0">
25257 <colspec colwidth="8*" align="left"/>
25258 <colspec colwidth="6*" align="center"/>
25259 <colspec colwidth="6*" align="center"/>
25260 <colspec colwidth="6*" align="right"/>
25261 <tbody>
25262 <row>
25263 <entry><option>errors_reply_to</option></entry>
25264 <entry>Use: <emphasis>main</emphasis></entry>
25265 <entry>Type: <emphasis>string</emphasis></entry>
25266 <entry>Default: <emphasis>unset</emphasis></entry>
25267 </row>
25268 </tbody>
25269 </tgroup>
25270 </informaltable>
25271 <para>
25272 <indexterm role="concept">
25273 <primary>bounce message</primary>
25274 <secondary><emphasis>Reply-to:</emphasis> in</secondary>
25275 </indexterm>
25276 By default, Exim&#x2019;s bounce and delivery warning messages contain the header line
25277 </para>
25278 <literallayout>
25279 <literal>From: Mail Delivery System &lt;Mailer-Daemon@</literal><emphasis>qualify-domain</emphasis><literal>&gt;</literal>
25280 </literallayout>
25281 <para>
25282 <indexterm role="option">
25283 <primary><option>quota_warn_message</option></primary>
25284 </indexterm>
25285 where <emphasis>qualify-domain</emphasis> is the value of the <option>qualify_domain</option> option.
25286 A warning message that is generated by the <option>quota_warn_message</option> option in an
25287 <command>appendfile</command> transport may contain its own <emphasis>From:</emphasis> header line that
25288 overrides the default.
25289 </para>
25290 <para>
25291 Experience shows that people reply to bounce messages. If the
25292 <option>errors_reply_to</option> option is set, a <emphasis>Reply-To:</emphasis> header is added to bounce
25293 and warning messages. For example:
25294 </para>
25295 <literallayout class="monospaced">
25296 errors_reply_to = postmaster@my.domain.example
25297 </literallayout>
25298 <para>
25299 The value of the option is not expanded. It must specify a valid RFC 2822
25300 address. However, if a warning message that is generated by the
25301 <option>quota_warn_message</option> option in an <command>appendfile</command> transport contain its
25302 own <emphasis>Reply-To:</emphasis> header line, the value of the <option>errors_reply_to</option> option is
25303 not used.
25304 </para>
25305 <para>
25306 <indexterm role="option">
25307 <primary><option>event_action</option></primary>
25308 </indexterm>
25309 </para>
25310 <informaltable frame="all">
25311 <tgroup cols="4" colsep="0" rowsep="0">
25312 <colspec colwidth="8*" align="left"/>
25313 <colspec colwidth="6*" align="center"/>
25314 <colspec colwidth="6*" align="center"/>
25315 <colspec colwidth="6*" align="right"/>
25316 <tbody>
25317 <row>
25318 <entry><option>event_action</option></entry>
25319 <entry>Use: <emphasis>main</emphasis></entry>
25320 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25321 <entry>Default: <emphasis>unset</emphasis></entry>
25322 </row>
25323 </tbody>
25324 </tgroup>
25325 </informaltable>
25326 <para>
25327 <indexterm role="concept">
25328 <primary>events</primary>
25329 </indexterm>
25330 This option declares a string to be expanded for Exim&#x2019;s events mechanism.
25331 For details see chapter <xref linkend="CHAPevents"/>.
25332 </para>
25333 <para>
25334 <indexterm role="option">
25335 <primary><option>exim_group</option></primary>
25336 </indexterm>
25337 </para>
25338 <informaltable frame="all">
25339 <tgroup cols="4" colsep="0" rowsep="0">
25340 <colspec colwidth="8*" align="left"/>
25341 <colspec colwidth="6*" align="center"/>
25342 <colspec colwidth="6*" align="center"/>
25343 <colspec colwidth="6*" align="right"/>
25344 <tbody>
25345 <row>
25346 <entry><option>exim_group</option></entry>
25347 <entry>Use: <emphasis>main</emphasis></entry>
25348 <entry>Type: <emphasis>string</emphasis></entry>
25349 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
25350 </row>
25351 </tbody>
25352 </tgroup>
25353 </informaltable>
25354 <para>
25355 <indexterm role="concept">
25356 <primary>gid (group id)</primary>
25357 <secondary>Exim&#x2019;s own</secondary>
25358 </indexterm>
25359 <indexterm role="concept">
25360 <primary>Exim group</primary>
25361 </indexterm>
25362 This option changes the gid under which Exim runs when it gives up root
25363 privilege. The default value is compiled into the binary. The value of this
25364 option is used only when <option>exim_user</option> is also set. Unless it consists entirely
25365 of digits, the string is looked up using <function>getgrnam()</function>, and failure causes a
25366 configuration error. See chapter <xref linkend="CHAPsecurity"/> for a discussion of
25367 security issues.
25368 </para>
25369 <para>
25370 <indexterm role="option">
25371 <primary><option>exim_path</option></primary>
25372 </indexterm>
25373 </para>
25374 <informaltable frame="all">
25375 <tgroup cols="4" colsep="0" rowsep="0">
25376 <colspec colwidth="8*" align="left"/>
25377 <colspec colwidth="6*" align="center"/>
25378 <colspec colwidth="6*" align="center"/>
25379 <colspec colwidth="6*" align="right"/>
25380 <tbody>
25381 <row>
25382 <entry><option>exim_path</option></entry>
25383 <entry>Use: <emphasis>main</emphasis></entry>
25384 <entry>Type: <emphasis>string</emphasis></entry>
25385 <entry>Default: <emphasis>see below</emphasis></entry>
25386 </row>
25387 </tbody>
25388 </tgroup>
25389 </informaltable>
25390 <para>
25391 <indexterm role="concept">
25392 <primary>Exim binary, path name</primary>
25393 </indexterm>
25394 This option specifies the path name of the Exim binary, which is used when Exim
25395 needs to re-exec itself. The default is set up to point to the file <emphasis>exim</emphasis> in
25396 the directory configured at compile time by the BIN_DIRECTORY setting. It
25397 is necessary to change <option>exim_path</option> if, exceptionally, Exim is run from some
25398 other place.
25399 <emphasis role="bold">Warning</emphasis>: Do not use a macro to define the value of this option, because
25400 you will break those Exim utilities that scan the configuration file to find
25401 where the binary is. (They then use the <option>-bP</option> option to extract option
25402 settings such as the value of <option>spool_directory</option>.)
25403 </para>
25404 <para>
25405 <indexterm role="option">
25406 <primary><option>exim_user</option></primary>
25407 </indexterm>
25408 </para>
25409 <informaltable frame="all">
25410 <tgroup cols="4" colsep="0" rowsep="0">
25411 <colspec colwidth="8*" align="left"/>
25412 <colspec colwidth="6*" align="center"/>
25413 <colspec colwidth="6*" align="center"/>
25414 <colspec colwidth="6*" align="right"/>
25415 <tbody>
25416 <row>
25417 <entry><option>exim_user</option></entry>
25418 <entry>Use: <emphasis>main</emphasis></entry>
25419 <entry>Type: <emphasis>string</emphasis></entry>
25420 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
25421 </row>
25422 </tbody>
25423 </tgroup>
25424 </informaltable>
25425 <para>
25426 <indexterm role="concept">
25427 <primary>uid (user id)</primary>
25428 <secondary>Exim&#x2019;s own</secondary>
25429 </indexterm>
25430 <indexterm role="concept">
25431 <primary>Exim user</primary>
25432 </indexterm>
25433 This option changes the uid under which Exim runs when it gives up root
25434 privilege. The default value is compiled into the binary. Ownership of the run
25435 time configuration file and the use of the <option>-C</option> and <option>-D</option> command line
25436 options is checked against the values in the binary, not what is set here.
25437 </para>
25438 <para>
25439 Unless it consists entirely of digits, the string is looked up using
25440 <function>getpwnam()</function>, and failure causes a configuration error. If <option>exim_group</option> is
25441 not also supplied, the gid is taken from the result of <function>getpwnam()</function> if it is
25442 used. See chapter <xref linkend="CHAPsecurity"/> for a discussion of security issues.
25443 </para>
25444 <para>
25445 <indexterm role="option">
25446 <primary><option>extra_local_interfaces</option></primary>
25447 </indexterm>
25448 </para>
25449 <informaltable frame="all">
25450 <tgroup cols="4" colsep="0" rowsep="0">
25451 <colspec colwidth="8*" align="left"/>
25452 <colspec colwidth="6*" align="center"/>
25453 <colspec colwidth="6*" align="center"/>
25454 <colspec colwidth="6*" align="right"/>
25455 <tbody>
25456 <row>
25457 <entry><option>extra_local_interfaces</option></entry>
25458 <entry>Use: <emphasis>main</emphasis></entry>
25459 <entry>Type: <emphasis>string list</emphasis></entry>
25460 <entry>Default: <emphasis>unset</emphasis></entry>
25461 </row>
25462 </tbody>
25463 </tgroup>
25464 </informaltable>
25465 <para>
25466 This option defines network interfaces that are to be considered local when
25467 routing, but which are not used for listening by the daemon. See section
25468 <xref linkend="SECTreclocipadd"/> for details.
25469 </para>
25470 <para>
25471 <indexterm role="option">
25472 <primary><option>extract_addresses_remove_arguments</option></primary>
25473 </indexterm>
25474 </para>
25475 <informaltable frame="all">
25476 <tgroup cols="4" colsep="0" rowsep="0">
25477 <colspec colwidth="8*" align="left"/>
25478 <colspec colwidth="6*" align="center"/>
25479 <colspec colwidth="6*" align="center"/>
25480 <colspec colwidth="6*" align="right"/>
25481 <tbody>
25482 <row>
25483 <entry><option>extract_addresses_remove_arguments</option></entry>
25484 <entry>Use: <emphasis>main</emphasis></entry>
25485 <entry>Type: <emphasis>boolean</emphasis></entry>
25486 <entry>Default: <emphasis>true</emphasis></entry>
25487 </row>
25488 </tbody>
25489 </tgroup>
25490 </informaltable>
25491 <para>
25492 <indexterm role="option">
25493 <primary><option>-t</option></primary>
25494 </indexterm>
25495 <indexterm role="concept">
25496 <primary>command line</primary>
25497 <secondary>addresses with <option>-t</option></secondary>
25498 </indexterm>
25499 <indexterm role="concept">
25500 <primary>Sendmail compatibility</primary>
25501 <secondary><option>-t</option> option</secondary>
25502 </indexterm>
25503 According to some Sendmail documentation (Sun, IRIX, HP-UX), if any addresses
25504 are present on the command line when the <option>-t</option> option is used to build an
25505 envelope from a message&#x2019;s <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis> and <emphasis>Bcc:</emphasis> headers, the command
25506 line addresses are removed from the recipients list. This is also how Smail
25507 behaves. However, other Sendmail documentation (the O&#x2019;Reilly book) states that
25508 command line addresses are added to those obtained from the header lines. When
25509 <option>extract_addresses_remove_arguments</option> is true (the default), Exim subtracts
25510 argument headers. If it is set false, Exim adds rather than removes argument
25511 addresses.
25512 </para>
25513 <para>
25514 <indexterm role="option">
25515 <primary><option>finduser_retries</option></primary>
25516 </indexterm>
25517 </para>
25518 <informaltable frame="all">
25519 <tgroup cols="4" colsep="0" rowsep="0">
25520 <colspec colwidth="8*" align="left"/>
25521 <colspec colwidth="6*" align="center"/>
25522 <colspec colwidth="6*" align="center"/>
25523 <colspec colwidth="6*" align="right"/>
25524 <tbody>
25525 <row>
25526 <entry><option>finduser_retries</option></entry>
25527 <entry>Use: <emphasis>main</emphasis></entry>
25528 <entry>Type: <emphasis>integer</emphasis></entry>
25529 <entry>Default: <emphasis>0</emphasis></entry>
25530 </row>
25531 </tbody>
25532 </tgroup>
25533 </informaltable>
25534 <para>
25535 <indexterm role="concept">
25536 <primary>NIS, retrying user lookups</primary>
25537 </indexterm>
25538 On systems running NIS or other schemes in which user and group information is
25539 distributed from a remote system, there can be times when <function>getpwnam()</function> and
25540 related functions fail, even when given valid data, because things time out.
25541 Unfortunately these failures cannot be distinguished from genuine <quote>not found</quote>
25542 errors. If <option>finduser_retries</option> is set greater than zero, Exim will try that
25543 many extra times to find a user or a group, waiting for one second between
25544 retries.
25545 </para>
25546 <para>
25547 <indexterm role="concept">
25548 <primary><filename>/etc/passwd</filename></primary>
25549 <secondary>multiple reading of</secondary>
25550 </indexterm>
25551 You should not set this option greater than zero if your user information is in
25552 a traditional <filename>/etc/passwd</filename> file, because it will cause Exim needlessly to
25553 search the file multiple times for non-existent users, and also cause delay.
25554 </para>
25555 <para>
25556 <indexterm role="option">
25557 <primary><option>freeze_tell</option></primary>
25558 </indexterm>
25559 </para>
25560 <informaltable frame="all">
25561 <tgroup cols="4" colsep="0" rowsep="0">
25562 <colspec colwidth="8*" align="left"/>
25563 <colspec colwidth="6*" align="center"/>
25564 <colspec colwidth="6*" align="center"/>
25565 <colspec colwidth="6*" align="right"/>
25566 <tbody>
25567 <row>
25568 <entry><option>freeze_tell</option></entry>
25569 <entry>Use: <emphasis>main</emphasis></entry>
25570 <entry>Type: <emphasis>string list, comma separated</emphasis></entry>
25571 <entry>Default: <emphasis>unset</emphasis></entry>
25572 </row>
25573 </tbody>
25574 </tgroup>
25575 </informaltable>
25576 <para>
25577 <indexterm role="concept">
25578 <primary>freezing messages</primary>
25579 <secondary>sending a message when freezing</secondary>
25580 </indexterm>
25581 On encountering certain errors, or when configured to do so in a system filter,
25582 ACL, or special router, Exim freezes a message. This means that no further
25583 delivery attempts take place until an administrator thaws the message, or the
25584 <option>auto_thaw</option>, <option>ignore_bounce_errors_after</option>, or <option>timeout_frozen_after</option>
25585 feature cause it to be processed. If <option>freeze_tell</option> is set, Exim generates a
25586 warning message whenever it freezes something, unless the message it is
25587 freezing is a locally-generated bounce message. (Without this exception there
25588 is the possibility of looping.) The warning message is sent to the addresses
25589 supplied as the comma-separated value of this option. If several of the
25590 message&#x2019;s addresses cause freezing, only a single message is sent. If the
25591 freezing was automatic, the reason(s) for freezing can be found in the message
25592 log. If you configure freezing in a filter or ACL, you must arrange for any
25593 logging that you require.
25594 </para>
25595 <para>
25596 <indexterm role="option">
25597 <primary><option>gecos_name</option></primary>
25598 </indexterm>
25599 </para>
25600 <informaltable frame="all">
25601 <tgroup cols="4" colsep="0" rowsep="0">
25602 <colspec colwidth="8*" align="left"/>
25603 <colspec colwidth="6*" align="center"/>
25604 <colspec colwidth="6*" align="center"/>
25605 <colspec colwidth="6*" align="right"/>
25606 <tbody>
25607 <row>
25608 <entry><option>gecos_name</option></entry>
25609 <entry>Use: <emphasis>main</emphasis></entry>
25610 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25611 <entry>Default: <emphasis>unset</emphasis></entry>
25612 </row>
25613 </tbody>
25614 </tgroup>
25615 </informaltable>
25616 <para>
25617 <indexterm role="concept">
25618 <primary>HP-UX</primary>
25619 </indexterm>
25620 <indexterm role="concept">
25621 <primary><quote>gecos</quote> field, parsing</primary>
25622 </indexterm>
25623 Some operating systems, notably HP-UX, use the <quote>gecos</quote> field in the system
25624 password file to hold other information in addition to users&#x2019; real names. Exim
25625 looks up this field for use when it is creating <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis>
25626 headers. If either <option>gecos_pattern</option> or <option>gecos_name</option> are unset, the contents
25627 of the field are used unchanged, except that, if an ampersand is encountered,
25628 it is replaced by the user&#x2019;s login name with the first character forced to
25629 upper case, since this is a convention that is observed on many systems.
25630 </para>
25631 <para>
25632 When these options are set, <option>gecos_pattern</option> is treated as a regular
25633 expression that is to be applied to the field (again with &amp; replaced by the
25634 login name), and if it matches, <option>gecos_name</option> is expanded and used as the
25635 user&#x2019;s name.
25636 </para>
25637 <para>
25638 <indexterm role="concept">
25639 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
25640 <secondary>in <option>gecos_name</option></secondary>
25641 </indexterm>
25642 Numeric variables such as <varname>$1</varname>, <varname>$2</varname>, etc. can be used in the expansion to
25643 pick up sub-fields that were matched by the pattern. In HP-UX, where the user&#x2019;s
25644 name terminates at the first comma, the following can be used:
25645 </para>
25646 <literallayout class="monospaced">
25647 gecos_pattern = ([^,]*)
25648 gecos_name = $1
25649 </literallayout>
25650 <para>
25651 <indexterm role="option">
25652 <primary><option>gecos_pattern</option></primary>
25653 </indexterm>
25654 </para>
25655 <informaltable frame="all">
25656 <tgroup cols="4" colsep="0" rowsep="0">
25657 <colspec colwidth="8*" align="left"/>
25658 <colspec colwidth="6*" align="center"/>
25659 <colspec colwidth="6*" align="center"/>
25660 <colspec colwidth="6*" align="right"/>
25661 <tbody>
25662 <row>
25663 <entry><option>gecos_pattern</option></entry>
25664 <entry>Use: <emphasis>main</emphasis></entry>
25665 <entry>Type: <emphasis>string</emphasis></entry>
25666 <entry>Default: <emphasis>unset</emphasis></entry>
25667 </row>
25668 </tbody>
25669 </tgroup>
25670 </informaltable>
25671 <para>
25672 See <option>gecos_name</option> above.
25673 </para>
25674 <para>
25675 <indexterm role="option">
25676 <primary><option>gnutls_compat_mode</option></primary>
25677 </indexterm>
25678 </para>
25679 <informaltable frame="all">
25680 <tgroup cols="4" colsep="0" rowsep="0">
25681 <colspec colwidth="8*" align="left"/>
25682 <colspec colwidth="6*" align="center"/>
25683 <colspec colwidth="6*" align="center"/>
25684 <colspec colwidth="6*" align="right"/>
25685 <tbody>
25686 <row>
25687 <entry><option>gnutls_compat_mode</option></entry>
25688 <entry>Use: <emphasis>main</emphasis></entry>
25689 <entry>Type: <emphasis>boolean</emphasis></entry>
25690 <entry>Default: <emphasis>unset</emphasis></entry>
25691 </row>
25692 </tbody>
25693 </tgroup>
25694 </informaltable>
25695 <para>
25696 This option controls whether GnuTLS is used in compatibility mode in an Exim
25697 server. This reduces security slightly, but improves interworking with older
25698 implementations of TLS.
25699 </para>
25700 <para>
25701 option gnutls_allow_auto_pkcs11 main boolean unset
25702 This option will let GnuTLS (2.12.0 or later) autoload PKCS11 modules with
25703 the p11-kit configuration files in <filename>/etc/pkcs11/modules/</filename>.
25704 </para>
25705 <para>
25706 See
25707 <emphasis role="bold"><ulink url="http://www.gnutls.org/manual/gnutls.html#Smart-cards-and-HSMs">http://www.gnutls.org/manual/gnutls.html#Smart-cards-and-HSMs</ulink></emphasis>
25708 for documentation.
25709 </para>
25710 <para>
25711 <indexterm role="option">
25712 <primary><option>headers_charset</option></primary>
25713 </indexterm>
25714 </para>
25715 <informaltable frame="all">
25716 <tgroup cols="4" colsep="0" rowsep="0">
25717 <colspec colwidth="8*" align="left"/>
25718 <colspec colwidth="6*" align="center"/>
25719 <colspec colwidth="6*" align="center"/>
25720 <colspec colwidth="6*" align="right"/>
25721 <tbody>
25722 <row>
25723 <entry><option>headers_charset</option></entry>
25724 <entry>Use: <emphasis>main</emphasis></entry>
25725 <entry>Type: <emphasis>string</emphasis></entry>
25726 <entry>Default: <emphasis>see below</emphasis></entry>
25727 </row>
25728 </tbody>
25729 </tgroup>
25730 </informaltable>
25731 <para>
25732 This option sets a default character set for translating from encoded MIME
25733 <quote>words</quote> in header lines, when referenced by an <varname>$h_xxx</varname> expansion item. The
25734 default is the value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The
25735 ultimate default is ISO-8859-1. For more details see the description of header
25736 insertions in section <xref linkend="SECTexpansionitems"/>.
25737 </para>
25738 <para>
25739 <indexterm role="option">
25740 <primary><option>header_maxsize</option></primary>
25741 </indexterm>
25742 </para>
25743 <informaltable frame="all">
25744 <tgroup cols="4" colsep="0" rowsep="0">
25745 <colspec colwidth="8*" align="left"/>
25746 <colspec colwidth="6*" align="center"/>
25747 <colspec colwidth="6*" align="center"/>
25748 <colspec colwidth="6*" align="right"/>
25749 <tbody>
25750 <row>
25751 <entry><option>header_maxsize</option></entry>
25752 <entry>Use: <emphasis>main</emphasis></entry>
25753 <entry>Type: <emphasis>integer</emphasis></entry>
25754 <entry>Default: <emphasis>see below</emphasis></entry>
25755 </row>
25756 </tbody>
25757 </tgroup>
25758 </informaltable>
25759 <para>
25760 <indexterm role="concept">
25761 <primary>header section</primary>
25762 <secondary>maximum size of</secondary>
25763 </indexterm>
25764 <indexterm role="concept">
25765 <primary>limit</primary>
25766 <secondary>size of message header section</secondary>
25767 </indexterm>
25768 This option controls the overall maximum size of a message&#x2019;s header
25769 section. The default is the value of HEADER_MAXSIZE in
25770 <filename>Local/Makefile</filename>; the default for that is 1M. Messages with larger header
25771 sections are rejected.
25772 </para>
25773 <para>
25774 <indexterm role="option">
25775 <primary><option>header_line_maxsize</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>header_line_maxsize</option></entry>
25787 <entry>Use: <emphasis>main</emphasis></entry>
25788 <entry>Type: <emphasis>integer</emphasis></entry>
25789 <entry>Default: <emphasis>0</emphasis></entry>
25790 </row>
25791 </tbody>
25792 </tgroup>
25793 </informaltable>
25794 <para>
25795 <indexterm role="concept">
25796 <primary>header lines</primary>
25797 <secondary>maximum size of</secondary>
25798 </indexterm>
25799 <indexterm role="concept">
25800 <primary>limit</primary>
25801 <secondary>size of one header line</secondary>
25802 </indexterm>
25803 This option limits the length of any individual header line in a message, after
25804 all the continuations have been joined together. Messages with individual
25805 header lines that are longer than the limit are rejected. The default value of
25806 zero means <quote>no limit</quote>.
25807 </para>
25808 <para>
25809 <indexterm role="option">
25810 <primary><option>helo_accept_junk_hosts</option></primary>
25811 </indexterm>
25812 </para>
25813 <informaltable frame="all">
25814 <tgroup cols="4" colsep="0" rowsep="0">
25815 <colspec colwidth="8*" align="left"/>
25816 <colspec colwidth="6*" align="center"/>
25817 <colspec colwidth="6*" align="center"/>
25818 <colspec colwidth="6*" align="right"/>
25819 <tbody>
25820 <row>
25821 <entry><option>helo_accept_junk_hosts</option></entry>
25822 <entry>Use: <emphasis>main</emphasis></entry>
25823 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25824 <entry>Default: <emphasis>unset</emphasis></entry>
25825 </row>
25826 </tbody>
25827 </tgroup>
25828 </informaltable>
25829 <para>
25830 <indexterm role="concept">
25831 <primary>HELO</primary>
25832 <secondary>accepting junk data</secondary>
25833 </indexterm>
25834 <indexterm role="concept">
25835 <primary>EHLO</primary>
25836 <secondary>accepting junk data</secondary>
25837 </indexterm>
25838 Exim checks the syntax of HELO and EHLO commands for incoming SMTP
25839 mail, and gives an error response for invalid data. Unfortunately, there are
25840 some SMTP clients that send syntactic junk. They can be accommodated by setting
25841 this option. Note that this is a syntax check only. See <option>helo_verify_hosts</option>
25842 if you want to do semantic checking.
25843 See also <option>helo_allow_chars</option> for a way of extending the permitted character
25844 set.
25845 </para>
25846 <para>
25847 <indexterm role="option">
25848 <primary><option>helo_allow_chars</option></primary>
25849 </indexterm>
25850 </para>
25851 <informaltable frame="all">
25852 <tgroup cols="4" colsep="0" rowsep="0">
25853 <colspec colwidth="8*" align="left"/>
25854 <colspec colwidth="6*" align="center"/>
25855 <colspec colwidth="6*" align="center"/>
25856 <colspec colwidth="6*" align="right"/>
25857 <tbody>
25858 <row>
25859 <entry><option>helo_allow_chars</option></entry>
25860 <entry>Use: <emphasis>main</emphasis></entry>
25861 <entry>Type: <emphasis>string</emphasis></entry>
25862 <entry>Default: <emphasis>unset</emphasis></entry>
25863 </row>
25864 </tbody>
25865 </tgroup>
25866 </informaltable>
25867 <para>
25868 <indexterm role="concept">
25869 <primary>HELO</primary>
25870 <secondary>underscores in</secondary>
25871 </indexterm>
25872 <indexterm role="concept">
25873 <primary>EHLO</primary>
25874 <secondary>underscores in</secondary>
25875 </indexterm>
25876 <indexterm role="concept">
25877 <primary>underscore in EHLO/HELO</primary>
25878 </indexterm>
25879 This option can be set to a string of rogue characters that are permitted in
25880 all EHLO and HELO names in addition to the standard letters, digits,
25881 hyphens, and dots. If you really must allow underscores, you can set
25882 </para>
25883 <literallayout class="monospaced">
25884 helo_allow_chars = _
25885 </literallayout>
25886 <para>
25887 Note that the value is one string, not a list.
25888 </para>
25889 <para>
25890 <indexterm role="option">
25891 <primary><option>helo_lookup_domains</option></primary>
25892 </indexterm>
25893 </para>
25894 <informaltable frame="all">
25895 <tgroup cols="4" colsep="0" rowsep="0">
25896 <colspec colwidth="8*" align="left"/>
25897 <colspec colwidth="6*" align="center"/>
25898 <colspec colwidth="6*" align="center"/>
25899 <colspec colwidth="6*" align="right"/>
25900 <tbody>
25901 <row>
25902 <entry><option>helo_lookup_domains</option></entry>
25903 <entry>Use: <emphasis>main</emphasis></entry>
25904 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
25905 <entry>Default: <emphasis><literal>@:@[]</literal></emphasis></entry>
25906 </row>
25907 </tbody>
25908 </tgroup>
25909 </informaltable>
25910 <para>
25911 <indexterm role="concept">
25912 <primary>HELO</primary>
25913 <secondary>forcing reverse lookup</secondary>
25914 </indexterm>
25915 <indexterm role="concept">
25916 <primary>EHLO</primary>
25917 <secondary>forcing reverse lookup</secondary>
25918 </indexterm>
25919 If the domain given by a client in a HELO or EHLO command matches this
25920 list, a reverse lookup is done in order to establish the host&#x2019;s true name. The
25921 default forces a lookup if the client host gives the server&#x2019;s name or any of
25922 its IP addresses (in brackets), something that broken clients have been seen to
25923 do.
25924 </para>
25925 <para>
25926 <indexterm role="option">
25927 <primary><option>helo_try_verify_hosts</option></primary>
25928 </indexterm>
25929 </para>
25930 <informaltable frame="all">
25931 <tgroup cols="4" colsep="0" rowsep="0">
25932 <colspec colwidth="8*" align="left"/>
25933 <colspec colwidth="6*" align="center"/>
25934 <colspec colwidth="6*" align="center"/>
25935 <colspec colwidth="6*" align="right"/>
25936 <tbody>
25937 <row>
25938 <entry><option>helo_try_verify_hosts</option></entry>
25939 <entry>Use: <emphasis>main</emphasis></entry>
25940 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25941 <entry>Default: <emphasis>unset</emphasis></entry>
25942 </row>
25943 </tbody>
25944 </tgroup>
25945 </informaltable>
25946 <para>
25947 <indexterm role="concept">
25948 <primary>HELO verifying</primary>
25949 <secondary>optional</secondary>
25950 </indexterm>
25951 <indexterm role="concept">
25952 <primary>EHLO</primary>
25953 <secondary>verifying, optional</secondary>
25954 </indexterm>
25955 By default, Exim just checks the syntax of HELO and EHLO commands (see
25956 <option>helo_accept_junk_hosts</option> and <option>helo_allow_chars</option>). However, some sites like
25957 to do more extensive checking of the data supplied by these commands. The ACL
25958 condition <literal>verify = helo</literal> is provided to make this possible.
25959 Formerly, it was necessary also to set this option (<option>helo_try_verify_hosts</option>)
25960 to force the check to occur. From release 4.53 onwards, this is no longer
25961 necessary. If the check has not been done before <literal>verify = helo</literal> is
25962 encountered, it is done at that time. Consequently, this option is obsolete.
25963 Its specification is retained here for backwards compatibility.
25964 </para>
25965 <para>
25966 When an EHLO or HELO command is received, if the calling host matches
25967 <option>helo_try_verify_hosts</option>, Exim checks that the host name given in the HELO or
25968 EHLO command either:
25969 </para>
25970 <itemizedlist>
25971 <listitem>
25972 <para>
25973 is an IP literal matching the calling address of the host, or
25974 </para>
25975 </listitem>
25976 <listitem>
25977 <para>
25978 <indexterm role="concept">
25979 <primary>DNS</primary>
25980 <secondary>reverse lookup</secondary>
25981 </indexterm>
25982 <indexterm role="concept">
25983 <primary>reverse DNS lookup</primary>
25984 </indexterm>
25985 matches the host name that Exim obtains by doing a reverse lookup of the
25986 calling host address, or
25987 </para>
25988 </listitem>
25989 <listitem>
25990 <para>
25991 when looked up in DNS yields the calling host address.
25992 </para>
25993 </listitem>
25994 </itemizedlist>
25995 <para>
25996 However, the EHLO or HELO command is not rejected if any of the checks
25997 fail. Processing continues, but the result of the check is remembered, and can
25998 be detected later in an ACL by the <literal>verify = helo</literal> condition.
25999 </para>
26000 <para>
26001 If DNS was used for successful verification, the variable
26002 <indexterm role="concept">
26003 <primary>DNS</primary>
26004 <secondary>DNSSEC</secondary>
26005 </indexterm>
26006 <varname>$helo_verify_dnssec</varname> records the DNSSEC status of the lookups.
26007 </para>
26008 <para>
26009 <indexterm role="option">
26010 <primary><option>helo_verify_hosts</option></primary>
26011 </indexterm>
26012 </para>
26013 <informaltable frame="all">
26014 <tgroup cols="4" colsep="0" rowsep="0">
26015 <colspec colwidth="8*" align="left"/>
26016 <colspec colwidth="6*" align="center"/>
26017 <colspec colwidth="6*" align="center"/>
26018 <colspec colwidth="6*" align="right"/>
26019 <tbody>
26020 <row>
26021 <entry><option>helo_verify_hosts</option></entry>
26022 <entry>Use: <emphasis>main</emphasis></entry>
26023 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26024 <entry>Default: <emphasis>unset</emphasis></entry>
26025 </row>
26026 </tbody>
26027 </tgroup>
26028 </informaltable>
26029 <para>
26030 <indexterm role="concept">
26031 <primary>HELO verifying</primary>
26032 <secondary>mandatory</secondary>
26033 </indexterm>
26034 <indexterm role="concept">
26035 <primary>EHLO</primary>
26036 <secondary>verifying, mandatory</secondary>
26037 </indexterm>
26038 Like <option>helo_try_verify_hosts</option>, this option is obsolete, and retained only for
26039 backwards compatibility. For hosts that match this option, Exim checks the host
26040 name given in the HELO or EHLO in the same way as for
26041 <option>helo_try_verify_hosts</option>. If the check fails, the HELO or EHLO command is
26042 rejected with a 550 error, and entries are written to the main and reject logs.
26043 If a MAIL command is received before EHLO or HELO, it is rejected with a 503
26044 error.
26045 </para>
26046 <para>
26047 <indexterm role="option">
26048 <primary><option>hold_domains</option></primary>
26049 </indexterm>
26050 </para>
26051 <informaltable frame="all">
26052 <tgroup cols="4" colsep="0" rowsep="0">
26053 <colspec colwidth="8*" align="left"/>
26054 <colspec colwidth="6*" align="center"/>
26055 <colspec colwidth="6*" align="center"/>
26056 <colspec colwidth="6*" align="right"/>
26057 <tbody>
26058 <row>
26059 <entry><option>hold_domains</option></entry>
26060 <entry>Use: <emphasis>main</emphasis></entry>
26061 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
26062 <entry>Default: <emphasis>unset</emphasis></entry>
26063 </row>
26064 </tbody>
26065 </tgroup>
26066 </informaltable>
26067 <para>
26068 <indexterm role="concept">
26069 <primary>domain</primary>
26070 <secondary>delaying delivery</secondary>
26071 </indexterm>
26072 <indexterm role="concept">
26073 <primary>delivery</primary>
26074 <secondary>delaying certain domains</secondary>
26075 </indexterm>
26076 This option allows mail for particular domains to be held on the queue
26077 manually. The option is overridden if a message delivery is forced with the
26078 <option>-M</option>, <option>-qf</option>, <option>-Rf</option> or <option>-Sf</option> options, and also while testing or
26079 verifying addresses using <option>-bt</option> or <option>-bv</option>. Otherwise, if a domain matches an
26080 item in <option>hold_domains</option>, no routing or delivery for that address is done, and
26081 it is deferred every time the message is looked at.
26082 </para>
26083 <para>
26084 This option is intended as a temporary operational measure for delaying the
26085 delivery of mail while some problem is being sorted out, or some new
26086 configuration tested. If you just want to delay the processing of some
26087 domains until a queue run occurs, you should use <option>queue_domains</option> or
26088 <option>queue_smtp_domains</option>, not <option>hold_domains</option>.
26089 </para>
26090 <para>
26091 A setting of <option>hold_domains</option> does not override Exim&#x2019;s code for removing
26092 messages from the queue if they have been there longer than the longest retry
26093 time in any retry rule. If you want to hold messages for longer than the normal
26094 retry times, insert a dummy retry rule with a long retry time.
26095 </para>
26096 <para>
26097 <indexterm role="option">
26098 <primary><option>host_lookup</option></primary>
26099 </indexterm>
26100 </para>
26101 <informaltable frame="all">
26102 <tgroup cols="4" colsep="0" rowsep="0">
26103 <colspec colwidth="8*" align="left"/>
26104 <colspec colwidth="6*" align="center"/>
26105 <colspec colwidth="6*" align="center"/>
26106 <colspec colwidth="6*" align="right"/>
26107 <tbody>
26108 <row>
26109 <entry><option>host_lookup</option></entry>
26110 <entry>Use: <emphasis>main</emphasis></entry>
26111 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26112 <entry>Default: <emphasis>unset</emphasis></entry>
26113 </row>
26114 </tbody>
26115 </tgroup>
26116 </informaltable>
26117 <para>
26118 <indexterm role="concept">
26119 <primary>host name</primary>
26120 <secondary>lookup, forcing</secondary>
26121 </indexterm>
26122 Exim does not look up the name of a calling host from its IP address unless it
26123 is required to compare against some host list, or the host matches
26124 <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>, or the host matches this
26125 option (which normally contains IP addresses rather than host names). The
26126 default configuration file contains
26127 </para>
26128 <literallayout class="monospaced">
26129 host_lookup = *
26130 </literallayout>
26131 <para>
26132 which causes a lookup to happen for all hosts. If the expense of these lookups
26133 is felt to be too great, the setting can be changed or removed.
26134 </para>
26135 <para>
26136 After a successful reverse lookup, Exim does a forward lookup on the name it
26137 has obtained, to verify that it yields the IP address that it started with. If
26138 this check fails, Exim behaves as if the name lookup failed.
26139 </para>
26140 <para>
26141 <indexterm role="variable">
26142 <primary><varname>$host_lookup_failed</varname></primary>
26143 </indexterm>
26144 <indexterm role="variable">
26145 <primary><varname>$sender_host_name</varname></primary>
26146 </indexterm>
26147 After any kind of failure, the host name (in <varname>$sender_host_name</varname>) remains
26148 unset, and <varname>$host_lookup_failed</varname> is set to the string <quote>1</quote>. See also
26149 <option>dns_again_means_nonexist</option>, <option>helo_lookup_domains</option>, and
26150 <literal>verify = reverse_host_lookup</literal> in ACLs.
26151 </para>
26152 <para>
26153 <indexterm role="option">
26154 <primary><option>host_lookup_order</option></primary>
26155 </indexterm>
26156 </para>
26157 <informaltable frame="all">
26158 <tgroup cols="4" colsep="0" rowsep="0">
26159 <colspec colwidth="8*" align="left"/>
26160 <colspec colwidth="6*" align="center"/>
26161 <colspec colwidth="6*" align="center"/>
26162 <colspec colwidth="6*" align="right"/>
26163 <tbody>
26164 <row>
26165 <entry><option>host_lookup_order</option></entry>
26166 <entry>Use: <emphasis>main</emphasis></entry>
26167 <entry>Type: <emphasis>string list</emphasis></entry>
26168 <entry>Default: <emphasis><literal>bydns:byaddr</literal></emphasis></entry>
26169 </row>
26170 </tbody>
26171 </tgroup>
26172 </informaltable>
26173 <para>
26174 This option specifies the order of different lookup methods when Exim is trying
26175 to find a host name from an IP address. The default is to do a DNS lookup
26176 first, and then to try a local lookup (using <function>gethostbyaddr()</function> or equivalent)
26177 if that fails. You can change the order of these lookups, or omit one entirely,
26178 if you want.
26179 </para>
26180 <para>
26181 <emphasis role="bold">Warning</emphasis>: The <quote>byaddr</quote> method does not always yield aliases when there are
26182 multiple PTR records in the DNS and the IP address is not listed in
26183 <filename>/etc/hosts</filename>. Different operating systems give different results in this
26184 case. That is why the default tries a DNS lookup first.
26185 </para>
26186 <para>
26187 <indexterm role="option">
26188 <primary><option>host_reject_connection</option></primary>
26189 </indexterm>
26190 </para>
26191 <informaltable frame="all">
26192 <tgroup cols="4" colsep="0" rowsep="0">
26193 <colspec colwidth="8*" align="left"/>
26194 <colspec colwidth="6*" align="center"/>
26195 <colspec colwidth="6*" align="center"/>
26196 <colspec colwidth="6*" align="right"/>
26197 <tbody>
26198 <row>
26199 <entry><option>host_reject_connection</option></entry>
26200 <entry>Use: <emphasis>main</emphasis></entry>
26201 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26202 <entry>Default: <emphasis>unset</emphasis></entry>
26203 </row>
26204 </tbody>
26205 </tgroup>
26206 </informaltable>
26207 <para>
26208 <indexterm role="concept">
26209 <primary>host</primary>
26210 <secondary>rejecting connections from</secondary>
26211 </indexterm>
26212 If this option is set, incoming SMTP calls from the hosts listed are rejected
26213 as soon as the connection is made.
26214 This option is obsolete, and retained only for backward compatibility, because
26215 nowadays the ACL specified by <option>acl_smtp_connect</option> can also reject incoming
26216 connections immediately.
26217 </para>
26218 <para>
26219 The ability to give an immediate rejection (either by this option or using an
26220 ACL) is provided for use in unusual cases. Many hosts will just try again,
26221 sometimes without much delay. Normally, it is better to use an ACL to reject
26222 incoming messages at a later stage, such as after RCPT commands. See
26223 chapter <xref linkend="CHAPACL"/>.
26224 </para>
26225 <para>
26226 <indexterm role="option">
26227 <primary><option>hosts_connection_nolog</option></primary>
26228 </indexterm>
26229 </para>
26230 <informaltable frame="all">
26231 <tgroup cols="4" colsep="0" rowsep="0">
26232 <colspec colwidth="8*" align="left"/>
26233 <colspec colwidth="6*" align="center"/>
26234 <colspec colwidth="6*" align="center"/>
26235 <colspec colwidth="6*" align="right"/>
26236 <tbody>
26237 <row>
26238 <entry><option>hosts_connection_nolog</option></entry>
26239 <entry>Use: <emphasis>main</emphasis></entry>
26240 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26241 <entry>Default: <emphasis>unset</emphasis></entry>
26242 </row>
26243 </tbody>
26244 </tgroup>
26245 </informaltable>
26246 <para>
26247 <indexterm role="concept">
26248 <primary>host</primary>
26249 <secondary>not logging connections from</secondary>
26250 </indexterm>
26251 This option defines a list of hosts for which connection logging does not
26252 happen, even though the <option>smtp_connection</option> log selector is set. For example,
26253 you might want not to log SMTP connections from local processes, or from
26254 127.0.0.1, or from your local LAN. This option is consulted in the main loop of
26255 the daemon; you should therefore strive to restrict its value to a short inline
26256 list of IP addresses and networks. To disable logging SMTP connections from
26257 local processes, you must create a host list with an empty item. For example:
26258 </para>
26259 <literallayout class="monospaced">
26260 hosts_connection_nolog = :
26261 </literallayout>
26262 <para>
26263 If the <option>smtp_connection</option> log selector is not set, this option has no effect.
26264 </para>
26265 <para>
26266 <indexterm role="option">
26267 <primary><option>hosts_proxy</option></primary>
26268 </indexterm>
26269 </para>
26270 <informaltable frame="all">
26271 <tgroup cols="4" colsep="0" rowsep="0">
26272 <colspec colwidth="8*" align="left"/>
26273 <colspec colwidth="6*" align="center"/>
26274 <colspec colwidth="6*" align="center"/>
26275 <colspec colwidth="6*" align="right"/>
26276 <tbody>
26277 <row>
26278 <entry><option>hosts_proxy</option></entry>
26279 <entry>Use: <emphasis>main</emphasis></entry>
26280 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26281 <entry>Default: <emphasis>unset</emphasis></entry>
26282 </row>
26283 </tbody>
26284 </tgroup>
26285 </informaltable>
26286 <para>
26287 <indexterm role="concept">
26288 <primary>proxy</primary>
26289 <secondary>proxy protocol</secondary>
26290 </indexterm>
26291 This option enables use of Proxy Protocol proxies for incoming
26292 connections.  For details see section <xref linkend="SECTproxyInbound"/>.
26293 </para>
26294 <para>
26295 <indexterm role="option">
26296 <primary><option>hosts_treat_as_local</option></primary>
26297 </indexterm>
26298 </para>
26299 <informaltable frame="all">
26300 <tgroup cols="4" colsep="0" rowsep="0">
26301 <colspec colwidth="8*" align="left"/>
26302 <colspec colwidth="6*" align="center"/>
26303 <colspec colwidth="6*" align="center"/>
26304 <colspec colwidth="6*" align="right"/>
26305 <tbody>
26306 <row>
26307 <entry><option>hosts_treat_as_local</option></entry>
26308 <entry>Use: <emphasis>main</emphasis></entry>
26309 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
26310 <entry>Default: <emphasis>unset</emphasis></entry>
26311 </row>
26312 </tbody>
26313 </tgroup>
26314 </informaltable>
26315 <para>
26316 <indexterm role="concept">
26317 <primary>local host</primary>
26318 <secondary>domains treated as</secondary>
26319 </indexterm>
26320 <indexterm role="concept">
26321 <primary>host</primary>
26322 <secondary>treated as local</secondary>
26323 </indexterm>
26324 If this option is set, any host names that match the domain list are treated as
26325 if they were the local host when Exim is scanning host lists obtained from MX
26326 records
26327 or other sources. Note that the value of this option is a domain list, not a
26328 host list, because it is always used to check host names, not IP addresses.
26329 </para>
26330 <para>
26331 This option also applies when Exim is matching the special items
26332 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal> in a domain list (see
26333 section <xref linkend="SECTdomainlist"/>), and when checking the <option>hosts</option> option in the
26334 <command>smtp</command> transport for the local host (see the <option>allow_localhost</option> option in
26335 that transport). See also <option>local_interfaces</option>, <option>extra_local_interfaces</option>, and
26336 chapter <xref linkend="CHAPinterfaces"/>, which contains a discussion about local network
26337 interfaces and recognizing the local host.
26338 </para>
26339 <para>
26340 <indexterm role="option">
26341 <primary><option>ibase_servers</option></primary>
26342 </indexterm>
26343 </para>
26344 <informaltable frame="all">
26345 <tgroup cols="4" colsep="0" rowsep="0">
26346 <colspec colwidth="8*" align="left"/>
26347 <colspec colwidth="6*" align="center"/>
26348 <colspec colwidth="6*" align="center"/>
26349 <colspec colwidth="6*" align="right"/>
26350 <tbody>
26351 <row>
26352 <entry><option>ibase_servers</option></entry>
26353 <entry>Use: <emphasis>main</emphasis></entry>
26354 <entry>Type: <emphasis>string list</emphasis></entry>
26355 <entry>Default: <emphasis>unset</emphasis></entry>
26356 </row>
26357 </tbody>
26358 </tgroup>
26359 </informaltable>
26360 <para>
26361 <indexterm role="concept">
26362 <primary>InterBase</primary>
26363 <secondary>server list</secondary>
26364 </indexterm>
26365 This option provides a list of InterBase servers and associated connection data,
26366 to be used in conjunction with <command>ibase</command> lookups (see section <xref linkend="SECID72"/>).
26367 The option is available only if Exim has been built with InterBase support.
26368 </para>
26369 <para>
26370 <indexterm role="option">
26371 <primary><option>ignore_bounce_errors_after</option></primary>
26372 </indexterm>
26373 </para>
26374 <informaltable frame="all">
26375 <tgroup cols="4" colsep="0" rowsep="0">
26376 <colspec colwidth="8*" align="left"/>
26377 <colspec colwidth="6*" align="center"/>
26378 <colspec colwidth="6*" align="center"/>
26379 <colspec colwidth="6*" align="right"/>
26380 <tbody>
26381 <row>
26382 <entry><option>ignore_bounce_errors_after</option></entry>
26383 <entry>Use: <emphasis>main</emphasis></entry>
26384 <entry>Type: <emphasis>time</emphasis></entry>
26385 <entry>Default: <emphasis>10w</emphasis></entry>
26386 </row>
26387 </tbody>
26388 </tgroup>
26389 </informaltable>
26390 <para>
26391 <indexterm role="concept">
26392 <primary>bounce message</primary>
26393 <secondary>discarding</secondary>
26394 </indexterm>
26395 <indexterm role="concept">
26396 <primary>discarding bounce message</primary>
26397 </indexterm>
26398 This option affects the processing of bounce messages that cannot be delivered,
26399 that is, those that suffer a permanent delivery failure. (Bounce messages that
26400 suffer temporary delivery failures are of course retried in the usual way.)
26401 </para>
26402 <para>
26403 After a permanent delivery failure, bounce messages are frozen,
26404 because there is no sender to whom they can be returned. When a frozen bounce
26405 message has been on the queue for more than the given time, it is unfrozen at
26406 the next queue run, and a further delivery is attempted. If delivery fails
26407 again, the bounce message is discarded. This makes it possible to keep failed
26408 bounce messages around for a shorter time than the normal maximum retry time
26409 for frozen messages. For example,
26410 </para>
26411 <literallayout class="monospaced">
26412 ignore_bounce_errors_after = 12h
26413 </literallayout>
26414 <para>
26415 retries failed bounce message deliveries after 12 hours, discarding any further
26416 failures. If the value of this option is set to a zero time period, bounce
26417 failures are discarded immediately. Setting a very long time (as in the default
26418 value) has the effect of disabling this option. For ways of automatically
26419 dealing with other kinds of frozen message, see <option>auto_thaw</option> and
26420 <option>timeout_frozen_after</option>.
26421 </para>
26422 <para>
26423 <indexterm role="option">
26424 <primary><option>ignore_fromline_hosts</option></primary>
26425 </indexterm>
26426 </para>
26427 <informaltable frame="all">
26428 <tgroup cols="4" colsep="0" rowsep="0">
26429 <colspec colwidth="8*" align="left"/>
26430 <colspec colwidth="6*" align="center"/>
26431 <colspec colwidth="6*" align="center"/>
26432 <colspec colwidth="6*" align="right"/>
26433 <tbody>
26434 <row>
26435 <entry><option>ignore_fromline_hosts</option></entry>
26436 <entry>Use: <emphasis>main</emphasis></entry>
26437 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26438 <entry>Default: <emphasis>unset</emphasis></entry>
26439 </row>
26440 </tbody>
26441 </tgroup>
26442 </informaltable>
26443 <para>
26444 <indexterm role="concept">
26445 <primary><quote>From</quote> line</primary>
26446 </indexterm>
26447 <indexterm role="concept">
26448 <primary>UUCP</primary>
26449 <secondary><quote>From</quote> line</secondary>
26450 </indexterm>
26451 Some broken SMTP clients insist on sending a UUCP-like <quote>From&nbsp;</quote> line before
26452 the headers of a message. By default this is treated as the start of the
26453 message&#x2019;s body, which means that any following headers are not recognized as
26454 such. Exim can be made to ignore it by setting <option>ignore_fromline_hosts</option> to
26455 match those hosts that insist on sending it. If the sender is actually a local
26456 process rather than a remote host, and is using <option>-bs</option> to inject the messages,
26457 <option>ignore_fromline_local</option> must be set to achieve this effect.
26458 </para>
26459 <para>
26460 <indexterm role="option">
26461 <primary><option>ignore_fromline_local</option></primary>
26462 </indexterm>
26463 </para>
26464 <informaltable frame="all">
26465 <tgroup cols="4" colsep="0" rowsep="0">
26466 <colspec colwidth="8*" align="left"/>
26467 <colspec colwidth="6*" align="center"/>
26468 <colspec colwidth="6*" align="center"/>
26469 <colspec colwidth="6*" align="right"/>
26470 <tbody>
26471 <row>
26472 <entry><option>ignore_fromline_local</option></entry>
26473 <entry>Use: <emphasis>main</emphasis></entry>
26474 <entry>Type: <emphasis>boolean</emphasis></entry>
26475 <entry>Default: <emphasis>false</emphasis></entry>
26476 </row>
26477 </tbody>
26478 </tgroup>
26479 </informaltable>
26480 <para>
26481 See <option>ignore_fromline_hosts</option> above.
26482 </para>
26483 <para>
26484 <indexterm role="option">
26485 <primary><option>keep_environment</option></primary>
26486 </indexterm>
26487 </para>
26488 <informaltable frame="all">
26489 <tgroup cols="4" colsep="0" rowsep="0">
26490 <colspec colwidth="8*" align="left"/>
26491 <colspec colwidth="6*" align="center"/>
26492 <colspec colwidth="6*" align="center"/>
26493 <colspec colwidth="6*" align="right"/>
26494 <tbody>
26495 <row>
26496 <entry><option>keep_environment</option></entry>
26497 <entry>Use: <emphasis>main</emphasis></entry>
26498 <entry>Type: <emphasis>string list</emphasis></entry>
26499 <entry>Default: <emphasis>unset</emphasis></entry>
26500 </row>
26501 </tbody>
26502 </tgroup>
26503 </informaltable>
26504 <para>
26505 <indexterm role="concept">
26506 <primary>environment</primary>
26507 <secondary>values from</secondary>
26508 </indexterm>
26509 This option contains a string list of environment variables to keep.
26510 You have to trust these variables or you have to be sure that
26511 these variables do not impose any security risk. Keep in mind that
26512 during the startup phase Exim is running with an effective UID 0 in most
26513 installations. As the default value is an empty list, the default
26514 environment for using libraries, running embedded Perl code, or running
26515 external binaries is empty, and does not not even contain PATH or HOME.
26516 </para>
26517 <para>
26518 Actually the list is interpreted as a list of patterns
26519 (<xref linkend="SECTlistexpand"/>), except that it is not expanded first.
26520 </para>
26521 <para>
26522 WARNING: Macro substitution is still done first, so having a macro
26523 FOO and having FOO_HOME in your <option>keep_environment</option> option may have
26524 unexpected results. You may work around this using a regular expression
26525 that does not match the macro name: ^[F]OO_HOME$.
26526 </para>
26527 <para>
26528 Current versions of Exim issue a warning during startup if you do not mention
26529 <option>keep_environment</option> in your runtime configuration file and if your
26530 current environment is not empty. Future versions may not issue that warning
26531 anymore.
26532 </para>
26533 <para>
26534 See the <option>add_environment</option> main config option for a way to set
26535 environment variables to a fixed value.  The environment for <command>pipe</command>
26536 transports is handled separately, see section <xref linkend="SECTpipeenv"/> for
26537 details.
26538 </para>
26539 <para>
26540 <indexterm role="option">
26541 <primary><option>keep_malformed</option></primary>
26542 </indexterm>
26543 </para>
26544 <informaltable frame="all">
26545 <tgroup cols="4" colsep="0" rowsep="0">
26546 <colspec colwidth="8*" align="left"/>
26547 <colspec colwidth="6*" align="center"/>
26548 <colspec colwidth="6*" align="center"/>
26549 <colspec colwidth="6*" align="right"/>
26550 <tbody>
26551 <row>
26552 <entry><option>keep_malformed</option></entry>
26553 <entry>Use: <emphasis>main</emphasis></entry>
26554 <entry>Type: <emphasis>time</emphasis></entry>
26555 <entry>Default: <emphasis>4d</emphasis></entry>
26556 </row>
26557 </tbody>
26558 </tgroup>
26559 </informaltable>
26560 <para>
26561 This option specifies the length of time to keep messages whose spool files
26562 have been corrupted in some way. This should, of course, never happen. At the
26563 next attempt to deliver such a message, it gets removed. The incident is
26564 logged.
26565 </para>
26566 <para>
26567 <indexterm role="option">
26568 <primary><option>ldap_ca_cert_dir</option></primary>
26569 </indexterm>
26570 </para>
26571 <informaltable frame="all">
26572 <tgroup cols="4" colsep="0" rowsep="0">
26573 <colspec colwidth="8*" align="left"/>
26574 <colspec colwidth="6*" align="center"/>
26575 <colspec colwidth="6*" align="center"/>
26576 <colspec colwidth="6*" align="right"/>
26577 <tbody>
26578 <row>
26579 <entry><option>ldap_ca_cert_dir</option></entry>
26580 <entry>Use: <emphasis>main</emphasis></entry>
26581 <entry>Type: <emphasis>string</emphasis></entry>
26582 <entry>Default: <emphasis>unset</emphasis></entry>
26583 </row>
26584 </tbody>
26585 </tgroup>
26586 </informaltable>
26587 <para>
26588 <indexterm role="concept">
26589 <primary>LDAP</primary>
26590 <secondary>,</secondary>
26591 </indexterm>
26592 <indexterm role="concept">
26593 <primary>certificate</primary>
26594 <secondary>directory for LDAP</secondary>
26595 </indexterm>
26596 This option indicates which directory contains CA certificates for verifying
26597 a TLS certificate presented by an LDAP server.
26598 While Exim does not provide a default value, your SSL library may.
26599 Analogous to <option>tls_verify_certificates</option> but as a client-side option for LDAP
26600 and constrained to be a directory.
26601 </para>
26602 <para>
26603 <indexterm role="option">
26604 <primary><option>ldap_ca_cert_file</option></primary>
26605 </indexterm>
26606 </para>
26607 <informaltable frame="all">
26608 <tgroup cols="4" colsep="0" rowsep="0">
26609 <colspec colwidth="8*" align="left"/>
26610 <colspec colwidth="6*" align="center"/>
26611 <colspec colwidth="6*" align="center"/>
26612 <colspec colwidth="6*" align="right"/>
26613 <tbody>
26614 <row>
26615 <entry><option>ldap_ca_cert_file</option></entry>
26616 <entry>Use: <emphasis>main</emphasis></entry>
26617 <entry>Type: <emphasis>string</emphasis></entry>
26618 <entry>Default: <emphasis>unset</emphasis></entry>
26619 </row>
26620 </tbody>
26621 </tgroup>
26622 </informaltable>
26623 <para>
26624 <indexterm role="concept">
26625 <primary>LDAP</primary>
26626 <secondary>,</secondary>
26627 </indexterm>
26628 <indexterm role="concept">
26629 <primary>certificate</primary>
26630 <secondary>file for LDAP</secondary>
26631 </indexterm>
26632 This option indicates which file contains CA certificates for verifying
26633 a TLS certificate presented by an LDAP server.
26634 While Exim does not provide a default value, your SSL library may.
26635 Analogous to <option>tls_verify_certificates</option> but as a client-side option for LDAP
26636 and constrained to be a file.
26637 </para>
26638 <para>
26639 <indexterm role="option">
26640 <primary><option>ldap_cert_file</option></primary>
26641 </indexterm>
26642 </para>
26643 <informaltable frame="all">
26644 <tgroup cols="4" colsep="0" rowsep="0">
26645 <colspec colwidth="8*" align="left"/>
26646 <colspec colwidth="6*" align="center"/>
26647 <colspec colwidth="6*" align="center"/>
26648 <colspec colwidth="6*" align="right"/>
26649 <tbody>
26650 <row>
26651 <entry><option>ldap_cert_file</option></entry>
26652 <entry>Use: <emphasis>main</emphasis></entry>
26653 <entry>Type: <emphasis>string</emphasis></entry>
26654 <entry>Default: <emphasis>unset</emphasis></entry>
26655 </row>
26656 </tbody>
26657 </tgroup>
26658 </informaltable>
26659 <para>
26660 <indexterm role="concept">
26661 <primary>LDAP</primary>
26662 <secondary>TLS client certificate file</secondary>
26663 </indexterm>
26664 <indexterm role="concept">
26665 <primary>certificate</primary>
26666 <secondary>file for LDAP</secondary>
26667 </indexterm>
26668 This option indicates which file contains an TLS client certificate which
26669 Exim should present to the LDAP server during TLS negotiation.
26670 Should be used together with <option>ldap_cert_key</option>.
26671 </para>
26672 <para>
26673 <indexterm role="option">
26674 <primary><option>ldap_cert_key</option></primary>
26675 </indexterm>
26676 </para>
26677 <informaltable frame="all">
26678 <tgroup cols="4" colsep="0" rowsep="0">
26679 <colspec colwidth="8*" align="left"/>
26680 <colspec colwidth="6*" align="center"/>
26681 <colspec colwidth="6*" align="center"/>
26682 <colspec colwidth="6*" align="right"/>
26683 <tbody>
26684 <row>
26685 <entry><option>ldap_cert_key</option></entry>
26686 <entry>Use: <emphasis>main</emphasis></entry>
26687 <entry>Type: <emphasis>string</emphasis></entry>
26688 <entry>Default: <emphasis>unset</emphasis></entry>
26689 </row>
26690 </tbody>
26691 </tgroup>
26692 </informaltable>
26693 <para>
26694 <indexterm role="concept">
26695 <primary>LDAP</primary>
26696 <secondary>TLS client key file</secondary>
26697 </indexterm>
26698 <indexterm role="concept">
26699 <primary>certificate</primary>
26700 <secondary>key for LDAP</secondary>
26701 </indexterm>
26702 This option indicates which file contains the secret/private key to use
26703 to prove identity to the LDAP server during TLS negotiation.
26704 Should be used together with <option>ldap_cert_file</option>, which contains the
26705 identity to be proven.
26706 </para>
26707 <para>
26708 <indexterm role="option">
26709 <primary><option>ldap_cipher_suite</option></primary>
26710 </indexterm>
26711 </para>
26712 <informaltable frame="all">
26713 <tgroup cols="4" colsep="0" rowsep="0">
26714 <colspec colwidth="8*" align="left"/>
26715 <colspec colwidth="6*" align="center"/>
26716 <colspec colwidth="6*" align="center"/>
26717 <colspec colwidth="6*" align="right"/>
26718 <tbody>
26719 <row>
26720 <entry><option>ldap_cipher_suite</option></entry>
26721 <entry>Use: <emphasis>main</emphasis></entry>
26722 <entry>Type: <emphasis>string</emphasis></entry>
26723 <entry>Default: <emphasis>unset</emphasis></entry>
26724 </row>
26725 </tbody>
26726 </tgroup>
26727 </informaltable>
26728 <para>
26729 <indexterm role="concept">
26730 <primary>LDAP</primary>
26731 <secondary>TLS cipher suite</secondary>
26732 </indexterm>
26733 This controls the TLS cipher-suite negotiation during TLS negotiation with
26734 the LDAP server.  See <xref linkend="SECTreqciphssl"/> for more details of the format of
26735 cipher-suite options with OpenSSL (as used by LDAP client libraries).
26736 </para>
26737 <para>
26738 <indexterm role="option">
26739 <primary><option>ldap_default_servers</option></primary>
26740 </indexterm>
26741 </para>
26742 <informaltable frame="all">
26743 <tgroup cols="4" colsep="0" rowsep="0">
26744 <colspec colwidth="8*" align="left"/>
26745 <colspec colwidth="6*" align="center"/>
26746 <colspec colwidth="6*" align="center"/>
26747 <colspec colwidth="6*" align="right"/>
26748 <tbody>
26749 <row>
26750 <entry><option>ldap_default_servers</option></entry>
26751 <entry>Use: <emphasis>main</emphasis></entry>
26752 <entry>Type: <emphasis>string list</emphasis></entry>
26753 <entry>Default: <emphasis>unset</emphasis></entry>
26754 </row>
26755 </tbody>
26756 </tgroup>
26757 </informaltable>
26758 <para>
26759 <indexterm role="concept">
26760 <primary>LDAP</primary>
26761 <secondary>default servers</secondary>
26762 </indexterm>
26763 This option provides a list of LDAP servers which are tried in turn when an
26764 LDAP query does not contain a server. See section <xref linkend="SECTforldaque"/> for
26765 details of LDAP queries. This option is available only when Exim has been built
26766 with LDAP support.
26767 </para>
26768 <para>
26769 <indexterm role="option">
26770 <primary><option>ldap_require_cert</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>ldap_require_cert</option></entry>
26782 <entry>Use: <emphasis>main</emphasis></entry>
26783 <entry>Type: <emphasis>string</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>LDAP</primary>
26792 <secondary>policy for LDAP server TLS cert presentation</secondary>
26793 </indexterm>
26794 This should be one of the values "hard", "demand", "allow", "try" or "never".
26795 A value other than one of these is interpreted as "never".
26796 See the entry "TLS_REQCERT" in your system man page for ldap.conf(5).
26797 Although Exim does not set a default, the LDAP library probably defaults
26798 to hard/demand.
26799 </para>
26800 <para>
26801 <indexterm role="option">
26802 <primary><option>ldap_start_tls</option></primary>
26803 </indexterm>
26804 </para>
26805 <informaltable frame="all">
26806 <tgroup cols="4" colsep="0" rowsep="0">
26807 <colspec colwidth="8*" align="left"/>
26808 <colspec colwidth="6*" align="center"/>
26809 <colspec colwidth="6*" align="center"/>
26810 <colspec colwidth="6*" align="right"/>
26811 <tbody>
26812 <row>
26813 <entry><option>ldap_start_tls</option></entry>
26814 <entry>Use: <emphasis>main</emphasis></entry>
26815 <entry>Type: <emphasis>boolean</emphasis></entry>
26816 <entry>Default: <emphasis>false</emphasis></entry>
26817 </row>
26818 </tbody>
26819 </tgroup>
26820 </informaltable>
26821 <para>
26822 <indexterm role="concept">
26823 <primary>LDAP</primary>
26824 <secondary>whether or not to negotiate TLS</secondary>
26825 </indexterm>
26826 If set, Exim will attempt to negotiate TLS with the LDAP server when
26827 connecting on a regular LDAP port.  This is the LDAP equivalent of SMTP&#x2019;s
26828 "STARTTLS".  This is distinct from using "ldaps", which is the LDAP form
26829 of SSL-on-connect.
26830 In the event of failure to negotiate TLS, the action taken is controlled
26831 by <option>ldap_require_cert</option>.
26832 This option is ignored for <literal>ldapi</literal> connections.
26833 </para>
26834 <para>
26835 <indexterm role="option">
26836 <primary><option>ldap_version</option></primary>
26837 </indexterm>
26838 </para>
26839 <informaltable frame="all">
26840 <tgroup cols="4" colsep="0" rowsep="0">
26841 <colspec colwidth="8*" align="left"/>
26842 <colspec colwidth="6*" align="center"/>
26843 <colspec colwidth="6*" align="center"/>
26844 <colspec colwidth="6*" align="right"/>
26845 <tbody>
26846 <row>
26847 <entry><option>ldap_version</option></entry>
26848 <entry>Use: <emphasis>main</emphasis></entry>
26849 <entry>Type: <emphasis>integer</emphasis></entry>
26850 <entry>Default: <emphasis>unset</emphasis></entry>
26851 </row>
26852 </tbody>
26853 </tgroup>
26854 </informaltable>
26855 <para>
26856 <indexterm role="concept">
26857 <primary>LDAP</primary>
26858 <secondary>protocol version, forcing</secondary>
26859 </indexterm>
26860 This option can be used to force Exim to set a specific protocol version for
26861 LDAP. If it option is unset, it is shown by the <option>-bP</option> command line option as
26862 -1. When this is the case, the default is 3 if LDAP_VERSION3 is defined in
26863 the LDAP headers; otherwise it is 2. This option is available only when Exim
26864 has been built with LDAP support.
26865 </para>
26866 <para>
26867 <indexterm role="option">
26868 <primary><option>local_from_check</option></primary>
26869 </indexterm>
26870 </para>
26871 <informaltable frame="all">
26872 <tgroup cols="4" colsep="0" rowsep="0">
26873 <colspec colwidth="8*" align="left"/>
26874 <colspec colwidth="6*" align="center"/>
26875 <colspec colwidth="6*" align="center"/>
26876 <colspec colwidth="6*" align="right"/>
26877 <tbody>
26878 <row>
26879 <entry><option>local_from_check</option></entry>
26880 <entry>Use: <emphasis>main</emphasis></entry>
26881 <entry>Type: <emphasis>boolean</emphasis></entry>
26882 <entry>Default: <emphasis>true</emphasis></entry>
26883 </row>
26884 </tbody>
26885 </tgroup>
26886 </informaltable>
26887 <para>
26888 <indexterm role="concept">
26889 <primary><emphasis>Sender:</emphasis> header line</primary>
26890 <secondary>disabling addition of</secondary>
26891 </indexterm>
26892 <indexterm role="concept">
26893 <primary><emphasis>From:</emphasis> header line</primary>
26894 <secondary>disabling checking of</secondary>
26895 </indexterm>
26896 When a message is submitted locally (that is, not over a TCP/IP connection) by
26897 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line, and
26898 checks that the <emphasis>From:</emphasis> header line matches the login of the calling user and
26899 the domain specified by <option>qualify_domain</option>.
26900 </para>
26901 <para>
26902 <emphasis role="bold">Note</emphasis>: An unqualified address (no domain) in the <emphasis>From:</emphasis> header in a
26903 locally submitted message is automatically qualified by Exim, unless the
26904 <option>-bnq</option> command line option is used.
26905 </para>
26906 <para>
26907 You can use <option>local_from_prefix</option> and <option>local_from_suffix</option> to permit affixes
26908 on the local part. If the <emphasis>From:</emphasis> header line does not match, Exim adds a
26909 <emphasis>Sender:</emphasis> header with an address constructed from the calling user&#x2019;s login
26910 and the default qualify domain.
26911 </para>
26912 <para>
26913 If <option>local_from_check</option> is set false, the <emphasis>From:</emphasis> header check is disabled,
26914 and no <emphasis>Sender:</emphasis> header is ever added. If, in addition, you want to retain
26915 <emphasis>Sender:</emphasis> header lines supplied by untrusted users, you must also set
26916 <option>local_sender_retain</option> to be true.
26917 </para>
26918 <para>
26919 <indexterm role="concept">
26920 <primary>envelope sender</primary>
26921 </indexterm>
26922 These options affect only the header lines in the message. The envelope sender
26923 is still forced to be the login id at the qualify domain unless
26924 <option>untrusted_set_sender</option> permits the user to supply an envelope sender.
26925 </para>
26926 <para>
26927 For messages received over TCP/IP, an ACL can specify <quote>submission mode</quote> to
26928 request similar header line checking. See section <xref linkend="SECTthesenhea"/>, which
26929 has more details about <emphasis>Sender:</emphasis> processing.
26930 </para>
26931 <para>
26932 <indexterm role="option">
26933 <primary><option>local_from_prefix</option></primary>
26934 </indexterm>
26935 </para>
26936 <informaltable frame="all">
26937 <tgroup cols="4" colsep="0" rowsep="0">
26938 <colspec colwidth="8*" align="left"/>
26939 <colspec colwidth="6*" align="center"/>
26940 <colspec colwidth="6*" align="center"/>
26941 <colspec colwidth="6*" align="right"/>
26942 <tbody>
26943 <row>
26944 <entry><option>local_from_prefix</option></entry>
26945 <entry>Use: <emphasis>main</emphasis></entry>
26946 <entry>Type: <emphasis>string</emphasis></entry>
26947 <entry>Default: <emphasis>unset</emphasis></entry>
26948 </row>
26949 </tbody>
26950 </tgroup>
26951 </informaltable>
26952 <para>
26953 When Exim checks the <emphasis>From:</emphasis> header line of locally submitted messages for
26954 matching the login id (see <option>local_from_check</option> above), it can be configured to
26955 ignore certain prefixes and suffixes in the local part of the address. This is
26956 done by setting <option>local_from_prefix</option> and/or <option>local_from_suffix</option> to
26957 appropriate lists, in the same form as the <option>local_part_prefix</option> and
26958 <option>local_part_suffix</option> router options (see chapter <xref linkend="CHAProutergeneric"/>). For
26959 example, if
26960 </para>
26961 <literallayout class="monospaced">
26962 local_from_prefix = *-
26963 </literallayout>
26964 <para>
26965 is set, a <emphasis>From:</emphasis> line containing
26966 </para>
26967 <literallayout class="monospaced">
26968 From: anything-user@your.domain.example
26969 </literallayout>
26970 <para>
26971 will not cause a <emphasis>Sender:</emphasis> header to be added if <emphasis>user@your.domain.example</emphasis>
26972 matches the actual sender address that is constructed from the login name and
26973 qualify domain.
26974 </para>
26975 <para>
26976 <indexterm role="option">
26977 <primary><option>local_from_suffix</option></primary>
26978 </indexterm>
26979 </para>
26980 <informaltable frame="all">
26981 <tgroup cols="4" colsep="0" rowsep="0">
26982 <colspec colwidth="8*" align="left"/>
26983 <colspec colwidth="6*" align="center"/>
26984 <colspec colwidth="6*" align="center"/>
26985 <colspec colwidth="6*" align="right"/>
26986 <tbody>
26987 <row>
26988 <entry><option>local_from_suffix</option></entry>
26989 <entry>Use: <emphasis>main</emphasis></entry>
26990 <entry>Type: <emphasis>string</emphasis></entry>
26991 <entry>Default: <emphasis>unset</emphasis></entry>
26992 </row>
26993 </tbody>
26994 </tgroup>
26995 </informaltable>
26996 <para>
26997 See <option>local_from_prefix</option> above.
26998 </para>
26999 <para>
27000 <indexterm role="option">
27001 <primary><option>local_interfaces</option></primary>
27002 </indexterm>
27003 </para>
27004 <informaltable frame="all">
27005 <tgroup cols="4" colsep="0" rowsep="0">
27006 <colspec colwidth="8*" align="left"/>
27007 <colspec colwidth="6*" align="center"/>
27008 <colspec colwidth="6*" align="center"/>
27009 <colspec colwidth="6*" align="right"/>
27010 <tbody>
27011 <row>
27012 <entry><option>local_interfaces</option></entry>
27013 <entry>Use: <emphasis>main</emphasis></entry>
27014 <entry>Type: <emphasis>string list</emphasis></entry>
27015 <entry>Default: <emphasis>see below</emphasis></entry>
27016 </row>
27017 </tbody>
27018 </tgroup>
27019 </informaltable>
27020 <para>
27021 This option controls which network interfaces are used by the daemon for
27022 listening; they are also used to identify the local host when routing. Chapter
27023 <xref linkend="CHAPinterfaces"/> contains a full description of this option and the related
27024 options <option>daemon_smtp_ports</option>, <option>extra_local_interfaces</option>,
27025 <option>hosts_treat_as_local</option>, and <option>tls_on_connect_ports</option>. The default value for
27026 <option>local_interfaces</option> is
27027 </para>
27028 <literallayout class="monospaced">
27029 local_interfaces = 0.0.0.0
27030 </literallayout>
27031 <para>
27032 when Exim is built without IPv6 support; otherwise it is
27033 </para>
27034 <literallayout class="monospaced">
27035 local_interfaces = &lt;; ::0 ; 0.0.0.0
27036 </literallayout>
27037 <para>
27038 <indexterm role="option">
27039 <primary><option>local_scan_timeout</option></primary>
27040 </indexterm>
27041 </para>
27042 <informaltable frame="all">
27043 <tgroup cols="4" colsep="0" rowsep="0">
27044 <colspec colwidth="8*" align="left"/>
27045 <colspec colwidth="6*" align="center"/>
27046 <colspec colwidth="6*" align="center"/>
27047 <colspec colwidth="6*" align="right"/>
27048 <tbody>
27049 <row>
27050 <entry><option>local_scan_timeout</option></entry>
27051 <entry>Use: <emphasis>main</emphasis></entry>
27052 <entry>Type: <emphasis>time</emphasis></entry>
27053 <entry>Default: <emphasis>5m</emphasis></entry>
27054 </row>
27055 </tbody>
27056 </tgroup>
27057 </informaltable>
27058 <para>
27059 <indexterm role="concept">
27060 <primary>timeout</primary>
27061 <secondary>for <function>local_scan()</function> function</secondary>
27062 </indexterm>
27063 <indexterm role="concept">
27064 <primary><function>local_scan()</function> function</primary>
27065 <secondary>timeout</secondary>
27066 </indexterm>
27067 This timeout applies to the <function>local_scan()</function> function (see chapter
27068 <xref linkend="CHAPlocalscan"/>). Zero means <quote>no timeout</quote>. If the timeout is exceeded,
27069 the incoming message is rejected with a temporary error if it is an SMTP
27070 message. For a non-SMTP message, the message is dropped and Exim ends with a
27071 non-zero code. The incident is logged on the main and reject logs.
27072 </para>
27073 <para>
27074 <indexterm role="option">
27075 <primary><option>local_sender_retain</option></primary>
27076 </indexterm>
27077 </para>
27078 <informaltable frame="all">
27079 <tgroup cols="4" colsep="0" rowsep="0">
27080 <colspec colwidth="8*" align="left"/>
27081 <colspec colwidth="6*" align="center"/>
27082 <colspec colwidth="6*" align="center"/>
27083 <colspec colwidth="6*" align="right"/>
27084 <tbody>
27085 <row>
27086 <entry><option>local_sender_retain</option></entry>
27087 <entry>Use: <emphasis>main</emphasis></entry>
27088 <entry>Type: <emphasis>boolean</emphasis></entry>
27089 <entry>Default: <emphasis>false</emphasis></entry>
27090 </row>
27091 </tbody>
27092 </tgroup>
27093 </informaltable>
27094 <para>
27095 <indexterm role="concept">
27096 <primary><emphasis>Sender:</emphasis> header line</primary>
27097 <secondary>retaining from local submission</secondary>
27098 </indexterm>
27099 When a message is submitted locally (that is, not over a TCP/IP connection) by
27100 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line. If you
27101 do not want this to happen, you must set <option>local_sender_retain</option>, and you must
27102 also set <option>local_from_check</option> to be false (Exim will complain if you do not).
27103 See also the ACL modifier <literal>control = suppress_local_fixups</literal>. Section
27104 <xref linkend="SECTthesenhea"/> has more details about <emphasis>Sender:</emphasis> processing.
27105 </para>
27106 <para>
27107 <indexterm role="option">
27108 <primary><option>localhost_number</option></primary>
27109 </indexterm>
27110 </para>
27111 <informaltable frame="all">
27112 <tgroup cols="4" colsep="0" rowsep="0">
27113 <colspec colwidth="8*" align="left"/>
27114 <colspec colwidth="6*" align="center"/>
27115 <colspec colwidth="6*" align="center"/>
27116 <colspec colwidth="6*" align="right"/>
27117 <tbody>
27118 <row>
27119 <entry><option>localhost_number</option></entry>
27120 <entry>Use: <emphasis>main</emphasis></entry>
27121 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27122 <entry>Default: <emphasis>unset</emphasis></entry>
27123 </row>
27124 </tbody>
27125 </tgroup>
27126 </informaltable>
27127 <para>
27128 <indexterm role="concept">
27129 <primary>host</primary>
27130 <secondary>locally unique number for</secondary>
27131 </indexterm>
27132 <indexterm role="concept">
27133 <primary>message ids</primary>
27134 <secondary>with multiple hosts</secondary>
27135 </indexterm>
27136 <indexterm role="variable">
27137 <primary><varname>$localhost_number</varname></primary>
27138 </indexterm>
27139 Exim&#x2019;s message ids are normally unique only within the local host. If
27140 uniqueness among a set of hosts is required, each host must set a different
27141 value for the <option>localhost_number</option> option. The string is expanded immediately
27142 after reading the configuration file (so that a number can be computed from the
27143 host name, for example) and the result of the expansion must be a number in the
27144 range 0&ndash;16 (or 0&ndash;10 on operating systems with case-insensitive file
27145 systems). This is available in subsequent string expansions via the variable
27146 <varname>$localhost_number</varname>. When <option>localhost_number is set</option>, the final two
27147 characters of the message id, instead of just being a fractional part of the
27148 time, are computed from the time and the local host number as described in
27149 section <xref linkend="SECTmessiden"/>.
27150 </para>
27151 <para>
27152 <indexterm role="option">
27153 <primary><option>log_file_path</option></primary>
27154 </indexterm>
27155 </para>
27156 <informaltable frame="all">
27157 <tgroup cols="4" colsep="0" rowsep="0">
27158 <colspec colwidth="8*" align="left"/>
27159 <colspec colwidth="6*" align="center"/>
27160 <colspec colwidth="6*" align="center"/>
27161 <colspec colwidth="6*" align="right"/>
27162 <tbody>
27163 <row>
27164 <entry><option>log_file_path</option></entry>
27165 <entry>Use: <emphasis>main</emphasis></entry>
27166 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
27167 <entry>Default: <emphasis>set at compile time</emphasis></entry>
27168 </row>
27169 </tbody>
27170 </tgroup>
27171 </informaltable>
27172 <para>
27173 <indexterm role="concept">
27174 <primary>log</primary>
27175 <secondary>file path for</secondary>
27176 </indexterm>
27177 This option sets the path which is used to determine the names of Exim&#x2019;s log
27178 files, or indicates that logging is to be to syslog, or both. It is expanded
27179 when Exim is entered, so it can, for example, contain a reference to the host
27180 name. If no specific path is set for the log files at compile or run time,
27181 or if the option is unset at run time (i.e.  <literal>log_file_path = </literal>)
27182 they are written in a sub-directory called <filename>log</filename> in Exim&#x2019;s spool directory.
27183 Chapter <xref linkend="CHAPlog"/> contains further details about Exim&#x2019;s logging, and
27184 section <xref linkend="SECTwhelogwri"/> describes how the contents of <option>log_file_path</option> are
27185 used. If this string is fixed at your installation (contains no expansion
27186 variables) it is recommended that you do not set this option in the
27187 configuration file, but instead supply the path using LOG_FILE_PATH in
27188 <filename>Local/Makefile</filename> so that it is available to Exim for logging errors detected
27189 early on &ndash; in particular, failure to read the configuration file.
27190 </para>
27191 <para>
27192 <indexterm role="option">
27193 <primary><option>log_selector</option></primary>
27194 </indexterm>
27195 </para>
27196 <informaltable frame="all">
27197 <tgroup cols="4" colsep="0" rowsep="0">
27198 <colspec colwidth="8*" align="left"/>
27199 <colspec colwidth="6*" align="center"/>
27200 <colspec colwidth="6*" align="center"/>
27201 <colspec colwidth="6*" align="right"/>
27202 <tbody>
27203 <row>
27204 <entry><option>log_selector</option></entry>
27205 <entry>Use: <emphasis>main</emphasis></entry>
27206 <entry>Type: <emphasis>string</emphasis></entry>
27207 <entry>Default: <emphasis>unset</emphasis></entry>
27208 </row>
27209 </tbody>
27210 </tgroup>
27211 </informaltable>
27212 <para>
27213 <indexterm role="concept">
27214 <primary>log</primary>
27215 <secondary>selectors</secondary>
27216 </indexterm>
27217 This option can be used to reduce or increase the number of things that Exim
27218 writes to its log files. Its argument is made up of names preceded by plus or
27219 minus characters. For example:
27220 </para>
27221 <literallayout class="monospaced">
27222 log_selector = +arguments -retry_defer
27223 </literallayout>
27224 <para>
27225 A list of possible names and what they control is given in the chapter on
27226 logging, in section <xref linkend="SECTlogselector"/>.
27227 </para>
27228 <para>
27229 <indexterm role="option">
27230 <primary><option>log_timezone</option></primary>
27231 </indexterm>
27232 </para>
27233 <informaltable frame="all">
27234 <tgroup cols="4" colsep="0" rowsep="0">
27235 <colspec colwidth="8*" align="left"/>
27236 <colspec colwidth="6*" align="center"/>
27237 <colspec colwidth="6*" align="center"/>
27238 <colspec colwidth="6*" align="right"/>
27239 <tbody>
27240 <row>
27241 <entry><option>log_timezone</option></entry>
27242 <entry>Use: <emphasis>main</emphasis></entry>
27243 <entry>Type: <emphasis>boolean</emphasis></entry>
27244 <entry>Default: <emphasis>false</emphasis></entry>
27245 </row>
27246 </tbody>
27247 </tgroup>
27248 </informaltable>
27249 <para>
27250 <indexterm role="concept">
27251 <primary>log</primary>
27252 <secondary>timezone for entries</secondary>
27253 </indexterm>
27254 <indexterm role="variable">
27255 <primary><varname>$tod_log</varname></primary>
27256 </indexterm>
27257 <indexterm role="variable">
27258 <primary><varname>$tod_zone</varname></primary>
27259 </indexterm>
27260 By default, the timestamps on log lines are in local time without the
27261 timezone. This means that if your timezone changes twice a year, the timestamps
27262 in log lines are ambiguous for an hour when the clocks go back. One way of
27263 avoiding this problem is to set the timezone to UTC. An alternative is to set
27264 <option>log_timezone</option> true. This turns on the addition of the timezone offset to
27265 timestamps in log lines. Turning on this option can add quite a lot to the size
27266 of log files because each line is extended by 6 characters. Note that the
27267 <varname>$tod_log</varname> variable contains the log timestamp without the zone, but there is
27268 another variable called <varname>$tod_zone</varname> that contains just the timezone offset.
27269 </para>
27270 <para>
27271 <indexterm role="option">
27272 <primary><option>lookup_open_max</option></primary>
27273 </indexterm>
27274 </para>
27275 <informaltable frame="all">
27276 <tgroup cols="4" colsep="0" rowsep="0">
27277 <colspec colwidth="8*" align="left"/>
27278 <colspec colwidth="6*" align="center"/>
27279 <colspec colwidth="6*" align="center"/>
27280 <colspec colwidth="6*" align="right"/>
27281 <tbody>
27282 <row>
27283 <entry><option>lookup_open_max</option></entry>
27284 <entry>Use: <emphasis>main</emphasis></entry>
27285 <entry>Type: <emphasis>integer</emphasis></entry>
27286 <entry>Default: <emphasis>25</emphasis></entry>
27287 </row>
27288 </tbody>
27289 </tgroup>
27290 </informaltable>
27291 <para>
27292 <indexterm role="concept">
27293 <primary>too many open files</primary>
27294 </indexterm>
27295 <indexterm role="concept">
27296 <primary>open files, too many</primary>
27297 </indexterm>
27298 <indexterm role="concept">
27299 <primary>file</primary>
27300 <secondary>too many open</secondary>
27301 </indexterm>
27302 <indexterm role="concept">
27303 <primary>lookup</primary>
27304 <secondary>maximum open files</secondary>
27305 </indexterm>
27306 <indexterm role="concept">
27307 <primary>limit</primary>
27308 <secondary>open files for lookups</secondary>
27309 </indexterm>
27310 This option limits the number of simultaneously open files for single-key
27311 lookups that use regular files (that is, <command>lsearch</command>, <command>dbm</command>, and <command>cdb</command>).
27312 Exim normally keeps these files open during routing, because often the same
27313 file is required several times. If the limit is reached, Exim closes the least
27314 recently used file. Note that if you are using the <emphasis>ndbm</emphasis> library, it
27315 actually opens two files for each logical DBM database, though it still counts
27316 as one for the purposes of <option>lookup_open_max</option>. If you are getting <quote>too many
27317 open files</quote> errors with NDBM, you need to reduce the value of
27318 <option>lookup_open_max</option>.
27319 </para>
27320 <para>
27321 <indexterm role="option">
27322 <primary><option>max_username_length</option></primary>
27323 </indexterm>
27324 </para>
27325 <informaltable frame="all">
27326 <tgroup cols="4" colsep="0" rowsep="0">
27327 <colspec colwidth="8*" align="left"/>
27328 <colspec colwidth="6*" align="center"/>
27329 <colspec colwidth="6*" align="center"/>
27330 <colspec colwidth="6*" align="right"/>
27331 <tbody>
27332 <row>
27333 <entry><option>max_username_length</option></entry>
27334 <entry>Use: <emphasis>main</emphasis></entry>
27335 <entry>Type: <emphasis>integer</emphasis></entry>
27336 <entry>Default: <emphasis>0</emphasis></entry>
27337 </row>
27338 </tbody>
27339 </tgroup>
27340 </informaltable>
27341 <para>
27342 <indexterm role="concept">
27343 <primary>length of login name</primary>
27344 </indexterm>
27345 <indexterm role="concept">
27346 <primary>user name</primary>
27347 <secondary>maximum length</secondary>
27348 </indexterm>
27349 <indexterm role="concept">
27350 <primary>limit</primary>
27351 <secondary>user name length</secondary>
27352 </indexterm>
27353 Some operating systems are broken in that they truncate long arguments to
27354 <function>getpwnam()</function> to eight characters, instead of returning <quote>no such user</quote>. If
27355 this option is set greater than zero, any attempt to call <function>getpwnam()</function> with
27356 an argument that is longer behaves as if <function>getpwnam()</function> failed.
27357 </para>
27358 <para>
27359 <indexterm role="option">
27360 <primary><option>message_body_newlines</option></primary>
27361 </indexterm>
27362 </para>
27363 <informaltable frame="all">
27364 <tgroup cols="4" colsep="0" rowsep="0">
27365 <colspec colwidth="8*" align="left"/>
27366 <colspec colwidth="6*" align="center"/>
27367 <colspec colwidth="6*" align="center"/>
27368 <colspec colwidth="6*" align="right"/>
27369 <tbody>
27370 <row>
27371 <entry><option>message_body_newlines</option></entry>
27372 <entry>Use: <emphasis>main</emphasis></entry>
27373 <entry>Type: <emphasis>bool</emphasis></entry>
27374 <entry>Default: <emphasis>false</emphasis></entry>
27375 </row>
27376 </tbody>
27377 </tgroup>
27378 </informaltable>
27379 <para>
27380 <indexterm role="concept">
27381 <primary>message body</primary>
27382 <secondary>newlines in variables</secondary>
27383 </indexterm>
27384 <indexterm role="concept">
27385 <primary>newline</primary>
27386 <secondary>in message body variables</secondary>
27387 </indexterm>
27388 <indexterm role="variable">
27389 <primary><varname>$message_body</varname></primary>
27390 </indexterm>
27391 <indexterm role="variable">
27392 <primary><varname>$message_body_end</varname></primary>
27393 </indexterm>
27394 By default, newlines in the message body are replaced by spaces when setting
27395 the <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables. If this
27396 option is set true, this no longer happens.
27397 </para>
27398 <para>
27399 <indexterm role="option">
27400 <primary><option>message_body_visible</option></primary>
27401 </indexterm>
27402 </para>
27403 <informaltable frame="all">
27404 <tgroup cols="4" colsep="0" rowsep="0">
27405 <colspec colwidth="8*" align="left"/>
27406 <colspec colwidth="6*" align="center"/>
27407 <colspec colwidth="6*" align="center"/>
27408 <colspec colwidth="6*" align="right"/>
27409 <tbody>
27410 <row>
27411 <entry><option>message_body_visible</option></entry>
27412 <entry>Use: <emphasis>main</emphasis></entry>
27413 <entry>Type: <emphasis>integer</emphasis></entry>
27414 <entry>Default: <emphasis>500</emphasis></entry>
27415 </row>
27416 </tbody>
27417 </tgroup>
27418 </informaltable>
27419 <para>
27420 <indexterm role="concept">
27421 <primary>body of message</primary>
27422 <secondary>visible size</secondary>
27423 </indexterm>
27424 <indexterm role="concept">
27425 <primary>message body</primary>
27426 <secondary>visible size</secondary>
27427 </indexterm>
27428 <indexterm role="variable">
27429 <primary><varname>$message_body</varname></primary>
27430 </indexterm>
27431 <indexterm role="variable">
27432 <primary><varname>$message_body_end</varname></primary>
27433 </indexterm>
27434 This option specifies how much of a message&#x2019;s body is to be included in the
27435 <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables.
27436 </para>
27437 <para>
27438 <indexterm role="option">
27439 <primary><option>message_id_header_domain</option></primary>
27440 </indexterm>
27441 </para>
27442 <informaltable frame="all">
27443 <tgroup cols="4" colsep="0" rowsep="0">
27444 <colspec colwidth="8*" align="left"/>
27445 <colspec colwidth="6*" align="center"/>
27446 <colspec colwidth="6*" align="center"/>
27447 <colspec colwidth="6*" align="right"/>
27448 <tbody>
27449 <row>
27450 <entry><option>message_id_header_domain</option></entry>
27451 <entry>Use: <emphasis>main</emphasis></entry>
27452 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27453 <entry>Default: <emphasis>unset</emphasis></entry>
27454 </row>
27455 </tbody>
27456 </tgroup>
27457 </informaltable>
27458 <para>
27459 <indexterm role="concept">
27460 <primary><emphasis>Message-ID:</emphasis> header line</primary>
27461 </indexterm>
27462 If this option is set, the string is expanded and used as the right hand side
27463 (domain) of the <emphasis>Message-ID:</emphasis> header that Exim creates if a
27464 locally-originated incoming message does not have one. <quote>Locally-originated</quote>
27465 means <quote>not received over TCP/IP.</quote>
27466 Otherwise, the primary host name is used.
27467 Only letters, digits, dot and hyphen are accepted; any other characters are
27468 replaced by hyphens. If the expansion is forced to fail, or if the result is an
27469 empty string, the option is ignored.
27470 </para>
27471 <para>
27472 <indexterm role="option">
27473 <primary><option>message_id_header_text</option></primary>
27474 </indexterm>
27475 </para>
27476 <informaltable frame="all">
27477 <tgroup cols="4" colsep="0" rowsep="0">
27478 <colspec colwidth="8*" align="left"/>
27479 <colspec colwidth="6*" align="center"/>
27480 <colspec colwidth="6*" align="center"/>
27481 <colspec colwidth="6*" align="right"/>
27482 <tbody>
27483 <row>
27484 <entry><option>message_id_header_text</option></entry>
27485 <entry>Use: <emphasis>main</emphasis></entry>
27486 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27487 <entry>Default: <emphasis>unset</emphasis></entry>
27488 </row>
27489 </tbody>
27490 </tgroup>
27491 </informaltable>
27492 <para>
27493 If this variable is set, the string is expanded and used to augment the text of
27494 the <emphasis>Message-id:</emphasis> header that Exim creates if a locally-originated incoming
27495 message does not have one. The text of this header is required by RFC 2822 to
27496 take the form of an address. By default, Exim uses its internal message id as
27497 the local part, and the primary host name as the domain. If this option is set,
27498 it is expanded, and provided the expansion is not forced to fail, and does not
27499 yield an empty string, the result is inserted into the header immediately
27500 before the @, separated from the internal message id by a dot. Any characters
27501 that are illegal in an address are automatically converted into hyphens. This
27502 means that variables such as <varname>$tod_log</varname> can be used, because the spaces and
27503 colons will become hyphens.
27504 </para>
27505 <para>
27506 <indexterm role="option">
27507 <primary><option>message_logs</option></primary>
27508 </indexterm>
27509 </para>
27510 <informaltable frame="all">
27511 <tgroup cols="4" colsep="0" rowsep="0">
27512 <colspec colwidth="8*" align="left"/>
27513 <colspec colwidth="6*" align="center"/>
27514 <colspec colwidth="6*" align="center"/>
27515 <colspec colwidth="6*" align="right"/>
27516 <tbody>
27517 <row>
27518 <entry><option>message_logs</option></entry>
27519 <entry>Use: <emphasis>main</emphasis></entry>
27520 <entry>Type: <emphasis>boolean</emphasis></entry>
27521 <entry>Default: <emphasis>true</emphasis></entry>
27522 </row>
27523 </tbody>
27524 </tgroup>
27525 </informaltable>
27526 <para>
27527 <indexterm role="concept">
27528 <primary>message logs</primary>
27529 <secondary>disabling</secondary>
27530 </indexterm>
27531 <indexterm role="concept">
27532 <primary>log</primary>
27533 <secondary>message log; disabling</secondary>
27534 </indexterm>
27535 If this option is turned off, per-message log files are not created in the
27536 <filename>msglog</filename> spool sub-directory. This reduces the amount of disk I/O required by
27537 Exim, by reducing the number of files involved in handling a message from a
27538 minimum of four (header spool file, body spool file, delivery journal, and
27539 per-message log) to three. The other major I/O activity is Exim&#x2019;s main log,
27540 which is not affected by this option.
27541 </para>
27542 <para>
27543 <indexterm role="option">
27544 <primary><option>message_size_limit</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>message_size_limit</option></entry>
27556 <entry>Use: <emphasis>main</emphasis></entry>
27557 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27558 <entry>Default: <emphasis>50M</emphasis></entry>
27559 </row>
27560 </tbody>
27561 </tgroup>
27562 </informaltable>
27563 <para>
27564 <indexterm role="concept">
27565 <primary>message</primary>
27566 <secondary>size limit</secondary>
27567 </indexterm>
27568 <indexterm role="concept">
27569 <primary>limit</primary>
27570 <secondary>message size</secondary>
27571 </indexterm>
27572 <indexterm role="concept">
27573 <primary>size</primary>
27574 <secondary>of message, limit</secondary>
27575 </indexterm>
27576 This option limits the maximum size of message that Exim will process. The
27577 value is expanded for each incoming connection so, for example, it can be made
27578 to depend on the IP address of the remote host for messages arriving via
27579 TCP/IP. After expansion, the value must be a sequence of decimal digits,
27580 optionally followed by K or M.
27581 </para>
27582 <para>
27583 <emphasis role="bold">Note</emphasis>: This limit cannot be made to depend on a message&#x2019;s sender or any
27584 other properties of an individual message, because it has to be advertised in
27585 the server&#x2019;s response to EHLO. String expansion failure causes a temporary
27586 error. A value of zero means no limit, but its use is not recommended. See also
27587 <option>bounce_return_size_limit</option>.
27588 </para>
27589 <para>
27590 Incoming SMTP messages are failed with a 552 error if the limit is
27591 exceeded; locally-generated messages either get a stderr message or a delivery
27592 failure message to the sender, depending on the <option>-oe</option> setting. Rejection of
27593 an oversized message is logged in both the main and the reject logs. See also
27594 the generic transport option <option>message_size_limit</option>, which limits the size of
27595 message that an individual transport can process.
27596 </para>
27597 <para>
27598 If you use a virus-scanner and set this option to to a value larger than the
27599 maximum size that your virus-scanner is configured to support, you may get
27600 failures triggered by large mails.  The right size to configure for the
27601 virus-scanner depends upon what data is passed and the options in use but it&#x2019;s
27602 probably safest to just set it to a little larger than this value.  E.g., with a
27603 default Exim message size of 50M and a default ClamAV StreamMaxLength of 10M,
27604 some problems may result.
27605 </para>
27606 <para>
27607 A value of 0 will disable size limit checking; Exim will still advertise the
27608 SIZE extension in an EHLO response, but without a limit, so as to permit
27609 SMTP clients to still indicate the message size along with the MAIL verb.
27610 </para>
27611 <para>
27612 <indexterm role="option">
27613 <primary><option>move_frozen_messages</option></primary>
27614 </indexterm>
27615 </para>
27616 <informaltable frame="all">
27617 <tgroup cols="4" colsep="0" rowsep="0">
27618 <colspec colwidth="8*" align="left"/>
27619 <colspec colwidth="6*" align="center"/>
27620 <colspec colwidth="6*" align="center"/>
27621 <colspec colwidth="6*" align="right"/>
27622 <tbody>
27623 <row>
27624 <entry><option>move_frozen_messages</option></entry>
27625 <entry>Use: <emphasis>main</emphasis></entry>
27626 <entry>Type: <emphasis>boolean</emphasis></entry>
27627 <entry>Default: <emphasis>false</emphasis></entry>
27628 </row>
27629 </tbody>
27630 </tgroup>
27631 </informaltable>
27632 <para>
27633 <indexterm role="concept">
27634 <primary>frozen messages</primary>
27635 <secondary>moving</secondary>
27636 </indexterm>
27637 This option, which is available only if Exim has been built with the setting
27638 </para>
27639 <literallayout class="monospaced">
27640 SUPPORT_MOVE_FROZEN_MESSAGES=yes
27641 </literallayout>
27642 <para>
27643 in <filename>Local/Makefile</filename>, causes frozen messages and their message logs to be
27644 moved from the <filename>input</filename> and <filename>msglog</filename> directories on the spool to <filename>Finput</filename>
27645 and <filename>Fmsglog</filename>, respectively. There is currently no support in Exim or the
27646 standard utilities for handling such moved messages, and they do not show up in
27647 lists generated by <option>-bp</option> or by the Exim monitor.
27648 </para>
27649 <para>
27650 <indexterm role="option">
27651 <primary><option>mua_wrapper</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>mua_wrapper</option></entry>
27663 <entry>Use: <emphasis>main</emphasis></entry>
27664 <entry>Type: <emphasis>boolean</emphasis></entry>
27665 <entry>Default: <emphasis>false</emphasis></entry>
27666 </row>
27667 </tbody>
27668 </tgroup>
27669 </informaltable>
27670 <para>
27671 Setting this option true causes Exim to run in a very restrictive mode in which
27672 it passes messages synchronously to a smart host. Chapter <xref linkend="CHAPnonqueueing"/>
27673 contains a full description of this facility.
27674 </para>
27675 <para>
27676 <indexterm role="option">
27677 <primary><option>mysql_servers</option></primary>
27678 </indexterm>
27679 </para>
27680 <informaltable frame="all">
27681 <tgroup cols="4" colsep="0" rowsep="0">
27682 <colspec colwidth="8*" align="left"/>
27683 <colspec colwidth="6*" align="center"/>
27684 <colspec colwidth="6*" align="center"/>
27685 <colspec colwidth="6*" align="right"/>
27686 <tbody>
27687 <row>
27688 <entry><option>mysql_servers</option></entry>
27689 <entry>Use: <emphasis>main</emphasis></entry>
27690 <entry>Type: <emphasis>string list</emphasis></entry>
27691 <entry>Default: <emphasis>unset</emphasis></entry>
27692 </row>
27693 </tbody>
27694 </tgroup>
27695 </informaltable>
27696 <para>
27697 <indexterm role="concept">
27698 <primary>MySQL</primary>
27699 <secondary>server list</secondary>
27700 </indexterm>
27701 This option provides a list of MySQL servers and associated connection data, to
27702 be used in conjunction with <command>mysql</command> lookups (see section <xref linkend="SECID72"/>). The
27703 option is available only if Exim has been built with MySQL support.
27704 </para>
27705 <para>
27706 <indexterm role="option">
27707 <primary><option>never_users</option></primary>
27708 </indexterm>
27709 </para>
27710 <informaltable frame="all">
27711 <tgroup cols="4" colsep="0" rowsep="0">
27712 <colspec colwidth="8*" align="left"/>
27713 <colspec colwidth="6*" align="center"/>
27714 <colspec colwidth="6*" align="center"/>
27715 <colspec colwidth="6*" align="right"/>
27716 <tbody>
27717 <row>
27718 <entry><option>never_users</option></entry>
27719 <entry>Use: <emphasis>main</emphasis></entry>
27720 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
27721 <entry>Default: <emphasis>unset</emphasis></entry>
27722 </row>
27723 </tbody>
27724 </tgroup>
27725 </informaltable>
27726 <para>
27727 This option is expanded just once, at the start of Exim&#x2019;s processing. Local
27728 message deliveries are normally run in processes that are setuid to the
27729 recipient, and remote deliveries are normally run under Exim&#x2019;s own uid and gid.
27730 It is usually desirable to prevent any deliveries from running as root, as a
27731 safety precaution.
27732 </para>
27733 <para>
27734 When Exim is built, an option called FIXED_NEVER_USERS can be set to a
27735 list of users that must not be used for local deliveries. This list is fixed in
27736 the binary and cannot be overridden by the configuration file. By default, it
27737 contains just the single user name <quote>root</quote>. The <option>never_users</option> runtime option
27738 can be used to add more users to the fixed list.
27739 </para>
27740 <para>
27741 If a message is to be delivered as one of the users on the fixed list or the
27742 <option>never_users</option> list, an error occurs, and delivery is deferred. A common
27743 example is
27744 </para>
27745 <literallayout class="monospaced">
27746 never_users = root:daemon:bin
27747 </literallayout>
27748 <para>
27749 Including root is redundant if it is also on the fixed list, but it does no
27750 harm. This option overrides the <option>pipe_as_creator</option> option of the <command>pipe</command>
27751 transport driver.
27752 </para>
27753 <para>
27754 <indexterm role="option">
27755 <primary><option>openssl_options</option></primary>
27756 </indexterm>
27757 </para>
27758 <informaltable frame="all">
27759 <tgroup cols="4" colsep="0" rowsep="0">
27760 <colspec colwidth="8*" align="left"/>
27761 <colspec colwidth="6*" align="center"/>
27762 <colspec colwidth="6*" align="center"/>
27763 <colspec colwidth="6*" align="right"/>
27764 <tbody>
27765 <row>
27766 <entry><option>openssl_options</option></entry>
27767 <entry>Use: <emphasis>main</emphasis></entry>
27768 <entry>Type: <emphasis>string list</emphasis></entry>
27769 <entry>Default: <emphasis>+no_sslv2 +single_dh_use +no_ticket</emphasis></entry>
27770 </row>
27771 </tbody>
27772 </tgroup>
27773 </informaltable>
27774 <para>
27775 <indexterm role="concept">
27776 <primary>OpenSSL </primary>
27777 <secondary>compatibility</secondary>
27778 </indexterm>
27779 This option allows an administrator to adjust the SSL options applied
27780 by OpenSSL to connections.  It is given as a space-separated list of items,
27781 each one to be +added or -subtracted from the current value.
27782 </para>
27783 <para>
27784 This option is only available if Exim is built against OpenSSL.  The values
27785 available for this option vary according to the age of your OpenSSL install.
27786 The <quote>all</quote> value controls a subset of flags which are available, typically
27787 the bug workaround options.  The <emphasis>SSL_CTX_set_options</emphasis> man page will
27788 list the values known on your system and Exim should support all the
27789 <quote>bug workaround</quote> options and many of the <quote>modifying</quote> options.  The Exim
27790 names lose the leading <quote>SSL_OP_</quote> and are lower-cased.
27791 </para>
27792 <para>
27793 Note that adjusting the options can have severe impact upon the security of
27794 SSL as used by Exim.  It is possible to disable safety checks and shoot
27795 yourself in the foot in various unpleasant ways.  This option should not be
27796 adjusted lightly.  An unrecognised item will be detected at startup, by
27797 invoking Exim with the <option>-bV</option> flag.
27798 </para>
27799 <para>
27800 The option affects Exim operating both as a server and as a client.
27801 </para>
27802 <para>
27803 Historical note: prior to release 4.80, Exim defaulted this value to
27804 "+dont_insert_empty_fragments", which may still be needed for compatibility
27805 with some clients, but which lowers security by increasing exposure to
27806 some now infamous attacks.
27807 </para>
27808 <para>
27809 Examples:
27810 </para>
27811 <literallayout class="monospaced">
27812 # Make both old MS and old Eudora happy:
27813 openssl_options = -all +microsoft_big_sslv3_buffer \
27814                        +dont_insert_empty_fragments
27815
27816 # Disable older protocol versions:
27817 openssl_options = +no_sslv2 +no_sslv3
27818 </literallayout>
27819 <para>
27820 Possible options may include:
27821 </para>
27822 <itemizedlist>
27823 <listitem>
27824 <para>
27825 <literal>all</literal>
27826 </para>
27827 </listitem>
27828 <listitem>
27829 <para>
27830 <literal>allow_unsafe_legacy_renegotiation</literal>
27831 </para>
27832 </listitem>
27833 <listitem>
27834 <para>
27835 <literal>cipher_server_preference</literal>
27836 </para>
27837 </listitem>
27838 <listitem>
27839 <para>
27840 <literal>dont_insert_empty_fragments</literal>
27841 </para>
27842 </listitem>
27843 <listitem>
27844 <para>
27845 <literal>ephemeral_rsa</literal>
27846 </para>
27847 </listitem>
27848 <listitem>
27849 <para>
27850 <literal>legacy_server_connect</literal>
27851 </para>
27852 </listitem>
27853 <listitem>
27854 <para>
27855 <literal>microsoft_big_sslv3_buffer</literal>
27856 </para>
27857 </listitem>
27858 <listitem>
27859 <para>
27860 <literal>microsoft_sess_id_bug</literal>
27861 </para>
27862 </listitem>
27863 <listitem>
27864 <para>
27865 <literal>msie_sslv2_rsa_padding</literal>
27866 </para>
27867 </listitem>
27868 <listitem>
27869 <para>
27870 <literal>netscape_challenge_bug</literal>
27871 </para>
27872 </listitem>
27873 <listitem>
27874 <para>
27875 <literal>netscape_reuse_cipher_change_bug</literal>
27876 </para>
27877 </listitem>
27878 <listitem>
27879 <para>
27880 <literal>no_compression</literal>
27881 </para>
27882 </listitem>
27883 <listitem>
27884 <para>
27885 <literal>no_session_resumption_on_renegotiation</literal>
27886 </para>
27887 </listitem>
27888 <listitem>
27889 <para>
27890 <literal>no_sslv2</literal>
27891 </para>
27892 </listitem>
27893 <listitem>
27894 <para>
27895 <literal>no_sslv3</literal>
27896 </para>
27897 </listitem>
27898 <listitem>
27899 <para>
27900 <literal>no_ticket</literal>
27901 </para>
27902 </listitem>
27903 <listitem>
27904 <para>
27905 <literal>no_tlsv1</literal>
27906 </para>
27907 </listitem>
27908 <listitem>
27909 <para>
27910 <literal>no_tlsv1_1</literal>
27911 </para>
27912 </listitem>
27913 <listitem>
27914 <para>
27915 <literal>no_tlsv1_2</literal>
27916 </para>
27917 </listitem>
27918 <listitem>
27919 <para>
27920 <literal>safari_ecdhe_ecdsa_bug</literal>
27921 </para>
27922 </listitem>
27923 <listitem>
27924 <para>
27925 <literal>single_dh_use</literal>
27926 </para>
27927 </listitem>
27928 <listitem>
27929 <para>
27930 <literal>single_ecdh_use</literal>
27931 </para>
27932 </listitem>
27933 <listitem>
27934 <para>
27935 <literal>ssleay_080_client_dh_bug</literal>
27936 </para>
27937 </listitem>
27938 <listitem>
27939 <para>
27940 <literal>sslref2_reuse_cert_type_bug</literal>
27941 </para>
27942 </listitem>
27943 <listitem>
27944 <para>
27945 <literal>tls_block_padding_bug</literal>
27946 </para>
27947 </listitem>
27948 <listitem>
27949 <para>
27950 <literal>tls_d5_bug</literal>
27951 </para>
27952 </listitem>
27953 <listitem>
27954 <para>
27955 <literal>tls_rollback_bug</literal>
27956 </para>
27957 </listitem>
27958 </itemizedlist>
27959 <para>
27960 As an aside, the <literal>safari_ecdhe_ecdsa_bug</literal> item is a misnomer and affects
27961 all clients connecting using the MacOS SecureTransport TLS facility prior
27962 to MacOS 10.8.4, including email clients.  If you see old MacOS clients failing
27963 to negotiate TLS then this option value might help, provided that your OpenSSL
27964 release is new enough to contain this work-around.  This may be a situation
27965 where you have to upgrade OpenSSL to get buggy clients working.
27966 </para>
27967 <para>
27968 <indexterm role="option">
27969 <primary><option>oracle_servers</option></primary>
27970 </indexterm>
27971 </para>
27972 <informaltable frame="all">
27973 <tgroup cols="4" colsep="0" rowsep="0">
27974 <colspec colwidth="8*" align="left"/>
27975 <colspec colwidth="6*" align="center"/>
27976 <colspec colwidth="6*" align="center"/>
27977 <colspec colwidth="6*" align="right"/>
27978 <tbody>
27979 <row>
27980 <entry><option>oracle_servers</option></entry>
27981 <entry>Use: <emphasis>main</emphasis></entry>
27982 <entry>Type: <emphasis>string list</emphasis></entry>
27983 <entry>Default: <emphasis>unset</emphasis></entry>
27984 </row>
27985 </tbody>
27986 </tgroup>
27987 </informaltable>
27988 <para>
27989 <indexterm role="concept">
27990 <primary>Oracle</primary>
27991 <secondary>server list</secondary>
27992 </indexterm>
27993 This option provides a list of Oracle servers and associated connection data,
27994 to be used in conjunction with <command>oracle</command> lookups (see section <xref linkend="SECID72"/>).
27995 The option is available only if Exim has been built with Oracle support.
27996 </para>
27997 <para>
27998 <indexterm role="option">
27999 <primary><option>percent_hack_domains</option></primary>
28000 </indexterm>
28001 </para>
28002 <informaltable frame="all">
28003 <tgroup cols="4" colsep="0" rowsep="0">
28004 <colspec colwidth="8*" align="left"/>
28005 <colspec colwidth="6*" align="center"/>
28006 <colspec colwidth="6*" align="center"/>
28007 <colspec colwidth="6*" align="right"/>
28008 <tbody>
28009 <row>
28010 <entry><option>percent_hack_domains</option></entry>
28011 <entry>Use: <emphasis>main</emphasis></entry>
28012 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
28013 <entry>Default: <emphasis>unset</emphasis></entry>
28014 </row>
28015 </tbody>
28016 </tgroup>
28017 </informaltable>
28018 <para>
28019 <indexterm role="concept">
28020 <primary><quote>percent hack</quote></primary>
28021 </indexterm>
28022 <indexterm role="concept">
28023 <primary>source routing</primary>
28024 <secondary>in email address</secondary>
28025 </indexterm>
28026 <indexterm role="concept">
28027 <primary>address</primary>
28028 <secondary>source-routed</secondary>
28029 </indexterm>
28030 The <quote>percent hack</quote> is the convention whereby a local part containing a
28031 percent sign is re-interpreted as a new email address, with the percent
28032 replaced by @. This is sometimes called <quote>source routing</quote>, though that term is
28033 also applied to RFC 2822 addresses that begin with an @ character. If this
28034 option is set, Exim implements the percent facility for those domains listed,
28035 but no others. This happens before an incoming SMTP address is tested against
28036 an ACL.
28037 </para>
28038 <para>
28039 <emphasis role="bold">Warning</emphasis>: The <quote>percent hack</quote> has often been abused by people who are
28040 trying to get round relaying restrictions. For this reason, it is best avoided
28041 if at all possible. Unfortunately, a number of less security-conscious MTAs
28042 implement it unconditionally. If you are running Exim on a gateway host, and
28043 routing mail through to internal MTAs without processing the local parts, it is
28044 a good idea to reject recipient addresses with percent characters in their
28045 local parts. Exim&#x2019;s default configuration does this.
28046 </para>
28047 <para>
28048 <indexterm role="option">
28049 <primary><option>perl_at_start</option></primary>
28050 </indexterm>
28051 </para>
28052 <informaltable frame="all">
28053 <tgroup cols="4" colsep="0" rowsep="0">
28054 <colspec colwidth="8*" align="left"/>
28055 <colspec colwidth="6*" align="center"/>
28056 <colspec colwidth="6*" align="center"/>
28057 <colspec colwidth="6*" align="right"/>
28058 <tbody>
28059 <row>
28060 <entry><option>perl_at_start</option></entry>
28061 <entry>Use: <emphasis>main</emphasis></entry>
28062 <entry>Type: <emphasis>boolean</emphasis></entry>
28063 <entry>Default: <emphasis>false</emphasis></entry>
28064 </row>
28065 </tbody>
28066 </tgroup>
28067 </informaltable>
28068 <para>
28069 <indexterm role="concept">
28070 <primary>Perl</primary>
28071 </indexterm>
28072 This option is available only when Exim is built with an embedded Perl
28073 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
28074 </para>
28075 <para>
28076 <indexterm role="option">
28077 <primary><option>perl_startup</option></primary>
28078 </indexterm>
28079 </para>
28080 <informaltable frame="all">
28081 <tgroup cols="4" colsep="0" rowsep="0">
28082 <colspec colwidth="8*" align="left"/>
28083 <colspec colwidth="6*" align="center"/>
28084 <colspec colwidth="6*" align="center"/>
28085 <colspec colwidth="6*" align="right"/>
28086 <tbody>
28087 <row>
28088 <entry><option>perl_startup</option></entry>
28089 <entry>Use: <emphasis>main</emphasis></entry>
28090 <entry>Type: <emphasis>string</emphasis></entry>
28091 <entry>Default: <emphasis>unset</emphasis></entry>
28092 </row>
28093 </tbody>
28094 </tgroup>
28095 </informaltable>
28096 <para>
28097 <indexterm role="concept">
28098 <primary>Perl</primary>
28099 </indexterm>
28100 This option is available only when Exim is built with an embedded Perl
28101 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
28102 </para>
28103 <para>
28104 <indexterm role="option">
28105 <primary><option>perl_startup</option></primary>
28106 </indexterm>
28107 </para>
28108 <informaltable frame="all">
28109 <tgroup cols="4" colsep="0" rowsep="0">
28110 <colspec colwidth="8*" align="left"/>
28111 <colspec colwidth="6*" align="center"/>
28112 <colspec colwidth="6*" align="center"/>
28113 <colspec colwidth="6*" align="right"/>
28114 <tbody>
28115 <row>
28116 <entry><option>perl_startup</option></entry>
28117 <entry>Use: <emphasis>main</emphasis></entry>
28118 <entry>Type: <emphasis>boolean</emphasis></entry>
28119 <entry>Default: <emphasis>false</emphasis></entry>
28120 </row>
28121 </tbody>
28122 </tgroup>
28123 </informaltable>
28124 <para>
28125 <indexterm role="concept">
28126 <primary>Perl</primary>
28127 </indexterm>
28128 This Option enables the taint mode of the embedded Perl interpreter.
28129 </para>
28130 <para>
28131 <indexterm role="option">
28132 <primary><option>pgsql_servers</option></primary>
28133 </indexterm>
28134 </para>
28135 <informaltable frame="all">
28136 <tgroup cols="4" colsep="0" rowsep="0">
28137 <colspec colwidth="8*" align="left"/>
28138 <colspec colwidth="6*" align="center"/>
28139 <colspec colwidth="6*" align="center"/>
28140 <colspec colwidth="6*" align="right"/>
28141 <tbody>
28142 <row>
28143 <entry><option>pgsql_servers</option></entry>
28144 <entry>Use: <emphasis>main</emphasis></entry>
28145 <entry>Type: <emphasis>string list</emphasis></entry>
28146 <entry>Default: <emphasis>unset</emphasis></entry>
28147 </row>
28148 </tbody>
28149 </tgroup>
28150 </informaltable>
28151 <para>
28152 <indexterm role="concept">
28153 <primary>PostgreSQL lookup type</primary>
28154 <secondary>server list</secondary>
28155 </indexterm>
28156 This option provides a list of PostgreSQL servers and associated connection
28157 data, to be used in conjunction with <command>pgsql</command> lookups (see section
28158 <xref linkend="SECID72"/>). The option is available only if Exim has been built with
28159 PostgreSQL support.
28160 </para>
28161 <para>
28162 <indexterm role="option">
28163 <primary><option>pid_file_path</option></primary>
28164 </indexterm>
28165 </para>
28166 <informaltable frame="all">
28167 <tgroup cols="4" colsep="0" rowsep="0">
28168 <colspec colwidth="8*" align="left"/>
28169 <colspec colwidth="6*" align="center"/>
28170 <colspec colwidth="6*" align="center"/>
28171 <colspec colwidth="6*" align="right"/>
28172 <tbody>
28173 <row>
28174 <entry><option>pid_file_path</option></entry>
28175 <entry>Use: <emphasis>main</emphasis></entry>
28176 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28177 <entry>Default: <emphasis>set at compile time</emphasis></entry>
28178 </row>
28179 </tbody>
28180 </tgroup>
28181 </informaltable>
28182 <para>
28183 <indexterm role="concept">
28184 <primary>daemon</primary>
28185 <secondary>pid file path</secondary>
28186 </indexterm>
28187 <indexterm role="concept">
28188 <primary>pid file, path for</primary>
28189 </indexterm>
28190 This option sets the name of the file to which the Exim daemon writes its
28191 process id. The string is expanded, so it can contain, for example, references
28192 to the host name:
28193 </para>
28194 <literallayout class="monospaced">
28195 pid_file_path = /var/log/$primary_hostname/exim.pid
28196 </literallayout>
28197 <para>
28198 If no path is set, the pid is written to the file <filename>exim-daemon.pid</filename> in Exim&#x2019;s
28199 spool directory.
28200 The value set by the option can be overridden by the <option>-oP</option> command line
28201 option. A pid file is not written if a <quote>non-standard</quote> daemon is run by means
28202 of the <option>-oX</option> option, unless a path is explicitly supplied by <option>-oP</option>.
28203 </para>
28204 <para>
28205 <indexterm role="option">
28206 <primary><option>pipelining_advertise_hosts</option></primary>
28207 </indexterm>
28208 </para>
28209 <informaltable frame="all">
28210 <tgroup cols="4" colsep="0" rowsep="0">
28211 <colspec colwidth="8*" align="left"/>
28212 <colspec colwidth="6*" align="center"/>
28213 <colspec colwidth="6*" align="center"/>
28214 <colspec colwidth="6*" align="right"/>
28215 <tbody>
28216 <row>
28217 <entry><option>pipelining_advertise_hosts</option></entry>
28218 <entry>Use: <emphasis>main</emphasis></entry>
28219 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28220 <entry>Default: <emphasis>*</emphasis></entry>
28221 </row>
28222 </tbody>
28223 </tgroup>
28224 </informaltable>
28225 <para>
28226 <indexterm role="concept">
28227 <primary>PIPELINING</primary>
28228 <secondary>suppressing advertising</secondary>
28229 </indexterm>
28230 This option can be used to suppress the advertisement of the SMTP
28231 PIPELINING extension to specific hosts. See also the <emphasis role="bold">no_pipelining</emphasis>
28232 control in section <xref linkend="SECTcontrols"/>. When PIPELINING is not advertised and
28233 <option>smtp_enforce_sync</option> is true, an Exim server enforces strict synchronization
28234 for each SMTP command and response. When PIPELINING is advertised, Exim assumes
28235 that clients will use it; <quote>out of order</quote> commands that are <quote>expected</quote> do
28236 not count as protocol errors (see <option>smtp_max_synprot_errors</option>).
28237 </para>
28238 <para>
28239 <indexterm role="option">
28240 <primary><option>prdr_enable</option></primary>
28241 </indexterm>
28242 </para>
28243 <informaltable frame="all">
28244 <tgroup cols="4" colsep="0" rowsep="0">
28245 <colspec colwidth="8*" align="left"/>
28246 <colspec colwidth="6*" align="center"/>
28247 <colspec colwidth="6*" align="center"/>
28248 <colspec colwidth="6*" align="right"/>
28249 <tbody>
28250 <row>
28251 <entry><option>prdr_enable</option></entry>
28252 <entry>Use: <emphasis>main</emphasis></entry>
28253 <entry>Type: <emphasis>boolean</emphasis></entry>
28254 <entry>Default: <emphasis>false</emphasis></entry>
28255 </row>
28256 </tbody>
28257 </tgroup>
28258 </informaltable>
28259 <para>
28260 <indexterm role="concept">
28261 <primary>PRDR</primary>
28262 <secondary>enabling on server</secondary>
28263 </indexterm>
28264 This option can be used to enable the Per-Recipient Data Response extension
28265 to SMTP, defined by Eric Hall.
28266 If the option is set, PRDR is advertised by Exim when operating as a server.
28267 If the client requests PRDR, and more than one recipient, for a message
28268 an additional ACL is called for each recipient after the message content
28269 is received.  See section <xref linkend="SECTPRDRACL"/>.
28270 </para>
28271 <para>
28272 <indexterm role="option">
28273 <primary><option>preserve_message_logs</option></primary>
28274 </indexterm>
28275 </para>
28276 <informaltable frame="all">
28277 <tgroup cols="4" colsep="0" rowsep="0">
28278 <colspec colwidth="8*" align="left"/>
28279 <colspec colwidth="6*" align="center"/>
28280 <colspec colwidth="6*" align="center"/>
28281 <colspec colwidth="6*" align="right"/>
28282 <tbody>
28283 <row>
28284 <entry><option>preserve_message_logs</option></entry>
28285 <entry>Use: <emphasis>main</emphasis></entry>
28286 <entry>Type: <emphasis>boolean</emphasis></entry>
28287 <entry>Default: <emphasis>false</emphasis></entry>
28288 </row>
28289 </tbody>
28290 </tgroup>
28291 </informaltable>
28292 <para>
28293 <indexterm role="concept">
28294 <primary>message logs</primary>
28295 <secondary>preserving</secondary>
28296 </indexterm>
28297 If this option is set, message log files are not deleted when messages are
28298 completed. Instead, they are moved to a sub-directory of the spool directory
28299 called <filename>msglog.OLD</filename>, where they remain available for statistical or debugging
28300 purposes. This is a dangerous option to set on systems with any appreciable
28301 volume of mail. Use with care!
28302 </para>
28303 <para>
28304 <indexterm role="option">
28305 <primary><option>primary_hostname</option></primary>
28306 </indexterm>
28307 </para>
28308 <informaltable frame="all">
28309 <tgroup cols="4" colsep="0" rowsep="0">
28310 <colspec colwidth="8*" align="left"/>
28311 <colspec colwidth="6*" align="center"/>
28312 <colspec colwidth="6*" align="center"/>
28313 <colspec colwidth="6*" align="right"/>
28314 <tbody>
28315 <row>
28316 <entry><option>primary_hostname</option></entry>
28317 <entry>Use: <emphasis>main</emphasis></entry>
28318 <entry>Type: <emphasis>string</emphasis></entry>
28319 <entry>Default: <emphasis>see below</emphasis></entry>
28320 </row>
28321 </tbody>
28322 </tgroup>
28323 </informaltable>
28324 <para>
28325 <indexterm role="concept">
28326 <primary>name</primary>
28327 <secondary>of local host</secondary>
28328 </indexterm>
28329 <indexterm role="concept">
28330 <primary>host</primary>
28331 <secondary>name of local</secondary>
28332 </indexterm>
28333 <indexterm role="concept">
28334 <primary>local host</primary>
28335 <secondary>name of</secondary>
28336 </indexterm>
28337 <indexterm role="variable">
28338 <primary><varname>$primary_hostname</varname></primary>
28339 </indexterm>
28340 This specifies the name of the current host. It is used in the default EHLO or
28341 HELO command for outgoing SMTP messages (changeable via the <option>helo_data</option>
28342 option in the <command>smtp</command> transport), and as the default for <option>qualify_domain</option>.
28343 The value is also used by default in some SMTP response messages from an Exim
28344 server. This can be changed dynamically by setting <option>smtp_active_hostname</option>.
28345 </para>
28346 <para>
28347 If <option>primary_hostname</option> is not set, Exim calls <function>uname()</function> to find the host
28348 name. If this fails, Exim panics and dies. If the name returned by <function>uname()</function>
28349 contains only one component, Exim passes it to <function>gethostbyname()</function> (or
28350 <function>getipnodebyname()</function> when available) in order to obtain the fully qualified
28351 version. The variable <varname>$primary_hostname</varname> contains the host name, whether set
28352 explicitly by this option, or defaulted.
28353 </para>
28354 <para>
28355 <indexterm role="option">
28356 <primary><option>print_topbitchars</option></primary>
28357 </indexterm>
28358 </para>
28359 <informaltable frame="all">
28360 <tgroup cols="4" colsep="0" rowsep="0">
28361 <colspec colwidth="8*" align="left"/>
28362 <colspec colwidth="6*" align="center"/>
28363 <colspec colwidth="6*" align="center"/>
28364 <colspec colwidth="6*" align="right"/>
28365 <tbody>
28366 <row>
28367 <entry><option>print_topbitchars</option></entry>
28368 <entry>Use: <emphasis>main</emphasis></entry>
28369 <entry>Type: <emphasis>boolean</emphasis></entry>
28370 <entry>Default: <emphasis>false</emphasis></entry>
28371 </row>
28372 </tbody>
28373 </tgroup>
28374 </informaltable>
28375 <para>
28376 <indexterm role="concept">
28377 <primary>printing characters</primary>
28378 </indexterm>
28379 <indexterm role="concept">
28380 <primary>8-bit characters</primary>
28381 </indexterm>
28382 By default, Exim considers only those characters whose codes lie in the range
28383 32&ndash;126 to be printing characters. In a number of circumstances (for example,
28384 when writing log entries) non-printing characters are converted into escape
28385 sequences, primarily to avoid messing up the layout. If <option>print_topbitchars</option>
28386 is set, code values of 128 and above are also considered to be printing
28387 characters.
28388 </para>
28389 <para>
28390 This option also affects the header syntax checks performed by the
28391 <command>autoreply</command> transport, and whether Exim uses RFC 2047 encoding of
28392 the user&#x2019;s full name when constructing From: and Sender: addresses (as
28393 described in section <xref linkend="SECTconstr"/>). Setting this option can cause
28394 Exim to generate eight bit message headers that do not conform to the
28395 standards.
28396 </para>
28397 <para>
28398 <indexterm role="option">
28399 <primary><option>process_log_path</option></primary>
28400 </indexterm>
28401 </para>
28402 <informaltable frame="all">
28403 <tgroup cols="4" colsep="0" rowsep="0">
28404 <colspec colwidth="8*" align="left"/>
28405 <colspec colwidth="6*" align="center"/>
28406 <colspec colwidth="6*" align="center"/>
28407 <colspec colwidth="6*" align="right"/>
28408 <tbody>
28409 <row>
28410 <entry><option>process_log_path</option></entry>
28411 <entry>Use: <emphasis>main</emphasis></entry>
28412 <entry>Type: <emphasis>string</emphasis></entry>
28413 <entry>Default: <emphasis>unset</emphasis></entry>
28414 </row>
28415 </tbody>
28416 </tgroup>
28417 </informaltable>
28418 <para>
28419 <indexterm role="concept">
28420 <primary>process log path</primary>
28421 </indexterm>
28422 <indexterm role="concept">
28423 <primary>log</primary>
28424 <secondary>process log</secondary>
28425 </indexterm>
28426 <indexterm role="concept">
28427 <primary><emphasis>exiwhat</emphasis></primary>
28428 </indexterm>
28429 This option sets the name of the file to which an Exim process writes its
28430 <quote>process log</quote> when sent a USR1 signal. This is used by the <emphasis>exiwhat</emphasis>
28431 utility script. If this option is unset, the file called <filename>exim-process.info</filename>
28432 in Exim&#x2019;s spool directory is used. The ability to specify the name explicitly
28433 can be useful in environments where two different Exims are running, using
28434 different spool directories.
28435 </para>
28436 <para>
28437 <indexterm role="option">
28438 <primary><option>prod_requires_admin</option></primary>
28439 </indexterm>
28440 </para>
28441 <informaltable frame="all">
28442 <tgroup cols="4" colsep="0" rowsep="0">
28443 <colspec colwidth="8*" align="left"/>
28444 <colspec colwidth="6*" align="center"/>
28445 <colspec colwidth="6*" align="center"/>
28446 <colspec colwidth="6*" align="right"/>
28447 <tbody>
28448 <row>
28449 <entry><option>prod_requires_admin</option></entry>
28450 <entry>Use: <emphasis>main</emphasis></entry>
28451 <entry>Type: <emphasis>boolean</emphasis></entry>
28452 <entry>Default: <emphasis>true</emphasis></entry>
28453 </row>
28454 </tbody>
28455 </tgroup>
28456 </informaltable>
28457 <para>
28458 <indexterm role="concept">
28459 <primary>restricting access to features</primary>
28460 </indexterm>
28461 <indexterm role="option">
28462 <primary><option>-M</option></primary>
28463 </indexterm>
28464 <indexterm role="option">
28465 <primary><option>-R</option></primary>
28466 </indexterm>
28467 <indexterm role="option">
28468 <primary><option>-q</option></primary>
28469 </indexterm>
28470 The <option>-M</option>, <option>-R</option>, and <option>-q</option> command-line options require the caller to be an
28471 admin user unless <option>prod_requires_admin</option> is set false. See also
28472 <option>queue_list_requires_admin</option> and <option>commandline_checks_require_admin</option>.
28473 </para>
28474 <para>
28475 <indexterm role="option">
28476 <primary><option>qualify_domain</option></primary>
28477 </indexterm>
28478 </para>
28479 <informaltable frame="all">
28480 <tgroup cols="4" colsep="0" rowsep="0">
28481 <colspec colwidth="8*" align="left"/>
28482 <colspec colwidth="6*" align="center"/>
28483 <colspec colwidth="6*" align="center"/>
28484 <colspec colwidth="6*" align="right"/>
28485 <tbody>
28486 <row>
28487 <entry><option>qualify_domain</option></entry>
28488 <entry>Use: <emphasis>main</emphasis></entry>
28489 <entry>Type: <emphasis>string</emphasis></entry>
28490 <entry>Default: <emphasis>see below</emphasis></entry>
28491 </row>
28492 </tbody>
28493 </tgroup>
28494 </informaltable>
28495 <para>
28496 <indexterm role="concept">
28497 <primary>domain</primary>
28498 <secondary>for qualifying addresses</secondary>
28499 </indexterm>
28500 <indexterm role="concept">
28501 <primary>address</primary>
28502 <secondary>qualification</secondary>
28503 </indexterm>
28504 This option specifies the domain name that is added to any envelope sender
28505 addresses that do not have a domain qualification. It also applies to
28506 recipient addresses if <option>qualify_recipient</option> is not set. Unqualified addresses
28507 are accepted by default only for locally-generated messages. Qualification is
28508 also applied to addresses in header lines such as <emphasis>From:</emphasis> and <emphasis>To:</emphasis> for
28509 locally-generated messages, unless the <option>-bnq</option> command line option is used.
28510 </para>
28511 <para>
28512 Messages from external sources must always contain fully qualified addresses,
28513 unless the sending host matches <option>sender_unqualified_hosts</option> or
28514 <option>recipient_unqualified_hosts</option> (as appropriate), in which case incoming
28515 addresses are qualified with <option>qualify_domain</option> or <option>qualify_recipient</option> as
28516 necessary. Internally, Exim always works with fully qualified envelope
28517 addresses. If <option>qualify_domain</option> is not set, it defaults to the
28518 <option>primary_hostname</option> value.
28519 </para>
28520 <para>
28521 <indexterm role="option">
28522 <primary><option>qualify_recipient</option></primary>
28523 </indexterm>
28524 </para>
28525 <informaltable frame="all">
28526 <tgroup cols="4" colsep="0" rowsep="0">
28527 <colspec colwidth="8*" align="left"/>
28528 <colspec colwidth="6*" align="center"/>
28529 <colspec colwidth="6*" align="center"/>
28530 <colspec colwidth="6*" align="right"/>
28531 <tbody>
28532 <row>
28533 <entry><option>qualify_recipient</option></entry>
28534 <entry>Use: <emphasis>main</emphasis></entry>
28535 <entry>Type: <emphasis>string</emphasis></entry>
28536 <entry>Default: <emphasis>see below</emphasis></entry>
28537 </row>
28538 </tbody>
28539 </tgroup>
28540 </informaltable>
28541 <para>
28542 This option allows you to specify a different domain for qualifying recipient
28543 addresses to the one that is used for senders. See <option>qualify_domain</option> above.
28544 </para>
28545 <para>
28546 <indexterm role="option">
28547 <primary><option>queue_domains</option></primary>
28548 </indexterm>
28549 </para>
28550 <informaltable frame="all">
28551 <tgroup cols="4" colsep="0" rowsep="0">
28552 <colspec colwidth="8*" align="left"/>
28553 <colspec colwidth="6*" align="center"/>
28554 <colspec colwidth="6*" align="center"/>
28555 <colspec colwidth="6*" align="right"/>
28556 <tbody>
28557 <row>
28558 <entry><option>queue_domains</option></entry>
28559 <entry>Use: <emphasis>main</emphasis></entry>
28560 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
28561 <entry>Default: <emphasis>unset</emphasis></entry>
28562 </row>
28563 </tbody>
28564 </tgroup>
28565 </informaltable>
28566 <para>
28567 <indexterm role="concept">
28568 <primary>domain</primary>
28569 <secondary>specifying non-immediate delivery</secondary>
28570 </indexterm>
28571 <indexterm role="concept">
28572 <primary>queueing incoming messages</primary>
28573 </indexterm>
28574 <indexterm role="concept">
28575 <primary>message</primary>
28576 <secondary>queueing certain domains</secondary>
28577 </indexterm>
28578 This option lists domains for which immediate delivery is not required.
28579 A delivery process is started whenever a message is received, but only those
28580 domains that do not match are processed. All other deliveries wait until the
28581 next queue run. See also <option>hold_domains</option> and <option>queue_smtp_domains</option>.
28582 </para>
28583 <para>
28584 <indexterm role="option">
28585 <primary><option>queue_list_requires_admin</option></primary>
28586 </indexterm>
28587 </para>
28588 <informaltable frame="all">
28589 <tgroup cols="4" colsep="0" rowsep="0">
28590 <colspec colwidth="8*" align="left"/>
28591 <colspec colwidth="6*" align="center"/>
28592 <colspec colwidth="6*" align="center"/>
28593 <colspec colwidth="6*" align="right"/>
28594 <tbody>
28595 <row>
28596 <entry><option>queue_list_requires_admin</option></entry>
28597 <entry>Use: <emphasis>main</emphasis></entry>
28598 <entry>Type: <emphasis>boolean</emphasis></entry>
28599 <entry>Default: <emphasis>true</emphasis></entry>
28600 </row>
28601 </tbody>
28602 </tgroup>
28603 </informaltable>
28604 <para>
28605 <indexterm role="concept">
28606 <primary>restricting access to features</primary>
28607 </indexterm>
28608 <indexterm role="option">
28609 <primary><option>-bp</option></primary>
28610 </indexterm>
28611 The <option>-bp</option> command-line option, which lists the messages that are on the
28612 queue, requires the caller to be an admin user unless
28613 <option>queue_list_requires_admin</option> is set false.
28614 See also <option>prod_requires_admin</option> and <option>commandline_checks_require_admin</option>.
28615 </para>
28616 <para>
28617 <indexterm role="option">
28618 <primary><option>queue_only</option></primary>
28619 </indexterm>
28620 </para>
28621 <informaltable frame="all">
28622 <tgroup cols="4" colsep="0" rowsep="0">
28623 <colspec colwidth="8*" align="left"/>
28624 <colspec colwidth="6*" align="center"/>
28625 <colspec colwidth="6*" align="center"/>
28626 <colspec colwidth="6*" align="right"/>
28627 <tbody>
28628 <row>
28629 <entry><option>queue_only</option></entry>
28630 <entry>Use: <emphasis>main</emphasis></entry>
28631 <entry>Type: <emphasis>boolean</emphasis></entry>
28632 <entry>Default: <emphasis>false</emphasis></entry>
28633 </row>
28634 </tbody>
28635 </tgroup>
28636 </informaltable>
28637 <para>
28638 <indexterm role="concept">
28639 <primary>queueing incoming messages</primary>
28640 </indexterm>
28641 <indexterm role="concept">
28642 <primary>message</primary>
28643 <secondary>queueing unconditionally</secondary>
28644 </indexterm>
28645 If <option>queue_only</option> is set, a delivery process is not automatically started
28646 whenever a message is received. Instead, the message waits on the queue for the
28647 next queue run. Even if <option>queue_only</option> is false, incoming messages may not get
28648 delivered immediately when certain conditions (such as heavy load) occur.
28649 </para>
28650 <para>
28651 The <option>-odq</option> command line has the same effect as <option>queue_only</option>. The <option>-odb</option>
28652 and <option>-odi</option> command line options override <option>queue_only</option> unless
28653 <option>queue_only_override</option> is set false. See also <option>queue_only_file</option>,
28654 <option>queue_only_load</option>, and <option>smtp_accept_queue</option>.
28655 </para>
28656 <para>
28657 <indexterm role="option">
28658 <primary><option>queue_only_file</option></primary>
28659 </indexterm>
28660 </para>
28661 <informaltable frame="all">
28662 <tgroup cols="4" colsep="0" rowsep="0">
28663 <colspec colwidth="8*" align="left"/>
28664 <colspec colwidth="6*" align="center"/>
28665 <colspec colwidth="6*" align="center"/>
28666 <colspec colwidth="6*" align="right"/>
28667 <tbody>
28668 <row>
28669 <entry><option>queue_only_file</option></entry>
28670 <entry>Use: <emphasis>main</emphasis></entry>
28671 <entry>Type: <emphasis>string</emphasis></entry>
28672 <entry>Default: <emphasis>unset</emphasis></entry>
28673 </row>
28674 </tbody>
28675 </tgroup>
28676 </informaltable>
28677 <para>
28678 <indexterm role="concept">
28679 <primary>queueing incoming messages</primary>
28680 </indexterm>
28681 <indexterm role="concept">
28682 <primary>message</primary>
28683 <secondary>queueing by file existence</secondary>
28684 </indexterm>
28685 This option can be set to a colon-separated list of absolute path names, each
28686 one optionally preceded by <quote>smtp</quote>. When Exim is receiving a message,
28687 it tests for the existence of each listed path using a call to <function>stat()</function>. For
28688 each path that exists, the corresponding queueing option is set.
28689 For paths with no prefix, <option>queue_only</option> is set; for paths prefixed by
28690 <quote>smtp</quote>, <option>queue_smtp_domains</option> is set to match all domains. So, for example,
28691 </para>
28692 <literallayout class="monospaced">
28693 queue_only_file = smtp/some/file
28694 </literallayout>
28695 <para>
28696 causes Exim to behave as if <option>queue_smtp_domains</option> were set to <quote>*</quote> whenever
28697 <filename>/some/file</filename> exists.
28698 </para>
28699 <para>
28700 <indexterm role="option">
28701 <primary><option>queue_only_load</option></primary>
28702 </indexterm>
28703 </para>
28704 <informaltable frame="all">
28705 <tgroup cols="4" colsep="0" rowsep="0">
28706 <colspec colwidth="8*" align="left"/>
28707 <colspec colwidth="6*" align="center"/>
28708 <colspec colwidth="6*" align="center"/>
28709 <colspec colwidth="6*" align="right"/>
28710 <tbody>
28711 <row>
28712 <entry><option>queue_only_load</option></entry>
28713 <entry>Use: <emphasis>main</emphasis></entry>
28714 <entry>Type: <emphasis>fixed-point</emphasis></entry>
28715 <entry>Default: <emphasis>unset</emphasis></entry>
28716 </row>
28717 </tbody>
28718 </tgroup>
28719 </informaltable>
28720 <para>
28721 <indexterm role="concept">
28722 <primary>load average</primary>
28723 </indexterm>
28724 <indexterm role="concept">
28725 <primary>queueing incoming messages</primary>
28726 </indexterm>
28727 <indexterm role="concept">
28728 <primary>message</primary>
28729 <secondary>queueing by load</secondary>
28730 </indexterm>
28731 If the system load average is higher than this value, incoming messages from
28732 all sources are queued, and no automatic deliveries are started. If this
28733 happens during local or remote SMTP input, all subsequent messages received on
28734 the same SMTP connection are queued by default, whatever happens to the load in
28735 the meantime, but this can be changed by setting <option>queue_only_load_latch</option>
28736 false.
28737 </para>
28738 <para>
28739 Deliveries will subsequently be performed by queue runner processes. This
28740 option has no effect on ancient operating systems on which Exim cannot
28741 determine the load average. See also <option>deliver_queue_load_max</option> and
28742 <option>smtp_load_reserve</option>.
28743 </para>
28744 <para>
28745 <indexterm role="option">
28746 <primary><option>queue_only_load_latch</option></primary>
28747 </indexterm>
28748 </para>
28749 <informaltable frame="all">
28750 <tgroup cols="4" colsep="0" rowsep="0">
28751 <colspec colwidth="8*" align="left"/>
28752 <colspec colwidth="6*" align="center"/>
28753 <colspec colwidth="6*" align="center"/>
28754 <colspec colwidth="6*" align="right"/>
28755 <tbody>
28756 <row>
28757 <entry><option>queue_only_load_latch</option></entry>
28758 <entry>Use: <emphasis>main</emphasis></entry>
28759 <entry>Type: <emphasis>boolean</emphasis></entry>
28760 <entry>Default: <emphasis>true</emphasis></entry>
28761 </row>
28762 </tbody>
28763 </tgroup>
28764 </informaltable>
28765 <para>
28766 <indexterm role="concept">
28767 <primary>load average</primary>
28768 <secondary>re-evaluating per message</secondary>
28769 </indexterm>
28770 When this option is true (the default), once one message has been queued
28771 because the load average is higher than the value set by <option>queue_only_load</option>,
28772 all subsequent messages received on the same SMTP connection are also queued.
28773 This is a deliberate choice; even though the load average may fall below the
28774 threshold, it doesn&#x2019;t seem right to deliver later messages on the same
28775 connection when not delivering earlier ones. However, there are special
28776 circumstances such as very long-lived connections from scanning appliances
28777 where this is not the best strategy. In such cases, <option>queue_only_load_latch</option>
28778 should be set false. This causes the value of the load average to be
28779 re-evaluated for each message.
28780 </para>
28781 <para>
28782 <indexterm role="option">
28783 <primary><option>queue_only_override</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>queue_only_override</option></entry>
28795 <entry>Use: <emphasis>main</emphasis></entry>
28796 <entry>Type: <emphasis>boolean</emphasis></entry>
28797 <entry>Default: <emphasis>true</emphasis></entry>
28798 </row>
28799 </tbody>
28800 </tgroup>
28801 </informaltable>
28802 <para>
28803 <indexterm role="concept">
28804 <primary>queueing incoming messages</primary>
28805 </indexterm>
28806 When this option is true, the <option>-od</option><emphasis>x</emphasis> command line options override the
28807 setting of <option>queue_only</option> or <option>queue_only_file</option> in the configuration file. If
28808 <option>queue_only_override</option> is set false, the <option>-od</option><emphasis>x</emphasis> options cannot be used
28809 to override; they are accepted, but ignored.
28810 </para>
28811 <para>
28812 <indexterm role="option">
28813 <primary><option>queue_run_in_order</option></primary>
28814 </indexterm>
28815 </para>
28816 <informaltable frame="all">
28817 <tgroup cols="4" colsep="0" rowsep="0">
28818 <colspec colwidth="8*" align="left"/>
28819 <colspec colwidth="6*" align="center"/>
28820 <colspec colwidth="6*" align="center"/>
28821 <colspec colwidth="6*" align="right"/>
28822 <tbody>
28823 <row>
28824 <entry><option>queue_run_in_order</option></entry>
28825 <entry>Use: <emphasis>main</emphasis></entry>
28826 <entry>Type: <emphasis>boolean</emphasis></entry>
28827 <entry>Default: <emphasis>false</emphasis></entry>
28828 </row>
28829 </tbody>
28830 </tgroup>
28831 </informaltable>
28832 <para>
28833 <indexterm role="concept">
28834 <primary>queue runner</primary>
28835 <secondary>processing messages in order</secondary>
28836 </indexterm>
28837 If this option is set, queue runs happen in order of message arrival instead of
28838 in an arbitrary order. For this to happen, a complete list of the entire queue
28839 must be set up before the deliveries start. When the queue is all held in a
28840 single directory (the default), a single list is created for both the ordered
28841 and the non-ordered cases. However, if <option>split_spool_directory</option> is set, a
28842 single list is not created when <option>queue_run_in_order</option> is false. In this case,
28843 the sub-directories are processed one at a time (in a random order), and this
28844 avoids setting up one huge list for the whole queue. Thus, setting
28845 <option>queue_run_in_order</option> with <option>split_spool_directory</option> may degrade performance
28846 when the queue is large, because of the extra work in setting up the single,
28847 large list. In most situations, <option>queue_run_in_order</option> should not be set.
28848 </para>
28849 <para>
28850 <indexterm role="option">
28851 <primary><option>queue_run_max</option></primary>
28852 </indexterm>
28853 </para>
28854 <informaltable frame="all">
28855 <tgroup cols="4" colsep="0" rowsep="0">
28856 <colspec colwidth="8*" align="left"/>
28857 <colspec colwidth="6*" align="center"/>
28858 <colspec colwidth="6*" align="center"/>
28859 <colspec colwidth="6*" align="right"/>
28860 <tbody>
28861 <row>
28862 <entry><option>queue_run_max</option></entry>
28863 <entry>Use: <emphasis>main</emphasis></entry>
28864 <entry>Type: <emphasis>integer</emphasis>&dagger;<emphasis></emphasis></entry>
28865 <entry>Default: <emphasis>5</emphasis></entry>
28866 </row>
28867 </tbody>
28868 </tgroup>
28869 </informaltable>
28870 <para>
28871 <indexterm role="concept">
28872 <primary>queue runner</primary>
28873 <secondary>maximum number of</secondary>
28874 </indexterm>
28875 This controls the maximum number of queue runner processes that an Exim daemon
28876 can run simultaneously. This does not mean that it starts them all at once,
28877 but rather that if the maximum number are still running when the time comes to
28878 start another one, it refrains from starting another one. This can happen with
28879 very large queues and/or very sluggish deliveries. This option does not,
28880 however, interlock with other processes, so additional queue runners can be
28881 started by other means, or by killing and restarting the daemon.
28882 </para>
28883 <para>
28884 Setting this option to zero does not suppress queue runs; rather, it disables
28885 the limit, allowing any number of simultaneous queue runner processes to be
28886 run. If you do not want queue runs to occur, omit the <option>-q</option><emphasis>xx</emphasis> setting on
28887 the daemon&#x2019;s command line.
28888 </para>
28889 <para>
28890 <indexterm role="concept">
28891 <primary>queues</primary>
28892 <secondary>named</secondary>
28893 </indexterm>
28894 <indexterm role="concept">
28895 <primary>named queues</primary>
28896 </indexterm>
28897 To set limits for different named queues use
28898 an expansion depending on the <varname>$queue_name</varname> variable.
28899 </para>
28900 <para>
28901 <indexterm role="option">
28902 <primary><option>queue_smtp_domains</option></primary>
28903 </indexterm>
28904 </para>
28905 <informaltable frame="all">
28906 <tgroup cols="4" colsep="0" rowsep="0">
28907 <colspec colwidth="8*" align="left"/>
28908 <colspec colwidth="6*" align="center"/>
28909 <colspec colwidth="6*" align="center"/>
28910 <colspec colwidth="6*" align="right"/>
28911 <tbody>
28912 <row>
28913 <entry><option>queue_smtp_domains</option></entry>
28914 <entry>Use: <emphasis>main</emphasis></entry>
28915 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
28916 <entry>Default: <emphasis>unset</emphasis></entry>
28917 </row>
28918 </tbody>
28919 </tgroup>
28920 </informaltable>
28921 <para>
28922 <indexterm role="concept">
28923 <primary>queueing incoming messages</primary>
28924 </indexterm>
28925 <indexterm role="concept">
28926 <primary>message</primary>
28927 <secondary>queueing remote deliveries</secondary>
28928 </indexterm>
28929 When this option is set, a delivery process is started whenever a message is
28930 received, routing is performed, and local deliveries take place.
28931 However, if any SMTP deliveries are required for domains that match
28932 <option>queue_smtp_domains</option>, they are not immediately delivered, but instead the
28933 message waits on the queue for the next queue run. Since routing of the message
28934 has taken place, Exim knows to which remote hosts it must be delivered, and so
28935 when the queue run happens, multiple messages for the same host are delivered
28936 over a single SMTP connection. The <option>-odqs</option> command line option causes all
28937 SMTP deliveries to be queued in this way, and is equivalent to setting
28938 <option>queue_smtp_domains</option> to <quote>*</quote>. See also <option>hold_domains</option> and
28939 <option>queue_domains</option>.
28940 </para>
28941 <para>
28942 <indexterm role="option">
28943 <primary><option>receive_timeout</option></primary>
28944 </indexterm>
28945 </para>
28946 <informaltable frame="all">
28947 <tgroup cols="4" colsep="0" rowsep="0">
28948 <colspec colwidth="8*" align="left"/>
28949 <colspec colwidth="6*" align="center"/>
28950 <colspec colwidth="6*" align="center"/>
28951 <colspec colwidth="6*" align="right"/>
28952 <tbody>
28953 <row>
28954 <entry><option>receive_timeout</option></entry>
28955 <entry>Use: <emphasis>main</emphasis></entry>
28956 <entry>Type: <emphasis>time</emphasis></entry>
28957 <entry>Default: <emphasis>0s</emphasis></entry>
28958 </row>
28959 </tbody>
28960 </tgroup>
28961 </informaltable>
28962 <para>
28963 <indexterm role="concept">
28964 <primary>timeout</primary>
28965 <secondary>for non-SMTP input</secondary>
28966 </indexterm>
28967 This option sets the timeout for accepting a non-SMTP message, that is, the
28968 maximum time that Exim waits when reading a message on the standard input. If
28969 the value is zero, it will wait for ever. This setting is overridden by the
28970 <option>-or</option> command line option. The timeout for incoming SMTP messages is
28971 controlled by <option>smtp_receive_timeout</option>.
28972 </para>
28973 <para>
28974 <indexterm role="option">
28975 <primary><option>received_header_text</option></primary>
28976 </indexterm>
28977 </para>
28978 <informaltable frame="all">
28979 <tgroup cols="4" colsep="0" rowsep="0">
28980 <colspec colwidth="8*" align="left"/>
28981 <colspec colwidth="6*" align="center"/>
28982 <colspec colwidth="6*" align="center"/>
28983 <colspec colwidth="6*" align="right"/>
28984 <tbody>
28985 <row>
28986 <entry><option>received_header_text</option></entry>
28987 <entry>Use: <emphasis>main</emphasis></entry>
28988 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28989 <entry>Default: <emphasis>see below</emphasis></entry>
28990 </row>
28991 </tbody>
28992 </tgroup>
28993 </informaltable>
28994 <para>
28995 <indexterm role="concept">
28996 <primary>customizing</primary>
28997 <secondary><emphasis>Received:</emphasis> header</secondary>
28998 </indexterm>
28999 <indexterm role="concept">
29000 <primary><emphasis>Received:</emphasis> header line</primary>
29001 <secondary>customizing</secondary>
29002 </indexterm>
29003 This string defines the contents of the <emphasis>Received:</emphasis> message header that is
29004 added to each message, except for the timestamp, which is automatically added
29005 on at the end (preceded by a semicolon). The string is expanded each time it is
29006 used. If the expansion yields an empty string, no <emphasis>Received:</emphasis> header line is
29007 added to the message. Otherwise, the string should start with the text
29008 <quote>Received:</quote> and conform to the RFC 2822 specification for <emphasis>Received:</emphasis>
29009 header lines. The default setting is:
29010 </para>
29011 <literallayout class="monospaced">
29012 received_header_text = Received: \
29013   ${if def:sender_rcvhost {from $sender_rcvhost\n\t}\
29014   {${if def:sender_ident \
29015   {from ${quote_local_part:$sender_ident} }}\
29016   ${if def:sender_helo_name {(helo=$sender_helo_name)\n\t}}}}\
29017   by $primary_hostname \
29018   ${if def:received_protocol {with $received_protocol}} \
29019   ${if def:tls_in_cipher {($tls_in_cipher)\n\t}}\
29020   (Exim $version_number)\n\t\
29021   ${if def:sender_address \
29022   {(envelope-from &lt;$sender_address&gt;)\n\t}}\
29023   id $message_exim_id\
29024   ${if def:received_for {\n\tfor $received_for}}
29025 </literallayout>
29026 <para>
29027 The reference to the TLS cipher is omitted when Exim is built without TLS
29028 support. The use of conditional expansions ensures that this works for both
29029 locally generated messages and messages received from remote hosts, giving
29030 header lines such as the following:
29031 </para>
29032 <literallayout class="monospaced">
29033 Received: from scrooge.carol.example ([192.168.12.25] ident=root)
29034 by marley.carol.example with esmtp (Exim 4.00)
29035 (envelope-from &lt;bob@carol.example&gt;)
29036 id 16IOWa-00019l-00
29037 for chas@dickens.example; Tue, 25 Dec 2001 14:43:44 +0000
29038 Received: by scrooge.carol.example with local (Exim 4.00)
29039 id 16IOWW-000083-00; Tue, 25 Dec 2001 14:43:41 +0000
29040 </literallayout>
29041 <para>
29042 Until the body of the message has been received, the timestamp is the time when
29043 the message started to be received. Once the body has arrived, and all policy
29044 checks have taken place, the timestamp is updated to the time at which the
29045 message was accepted.
29046 </para>
29047 <para>
29048 <indexterm role="option">
29049 <primary><option>received_headers_max</option></primary>
29050 </indexterm>
29051 </para>
29052 <informaltable frame="all">
29053 <tgroup cols="4" colsep="0" rowsep="0">
29054 <colspec colwidth="8*" align="left"/>
29055 <colspec colwidth="6*" align="center"/>
29056 <colspec colwidth="6*" align="center"/>
29057 <colspec colwidth="6*" align="right"/>
29058 <tbody>
29059 <row>
29060 <entry><option>received_headers_max</option></entry>
29061 <entry>Use: <emphasis>main</emphasis></entry>
29062 <entry>Type: <emphasis>integer</emphasis></entry>
29063 <entry>Default: <emphasis>30</emphasis></entry>
29064 </row>
29065 </tbody>
29066 </tgroup>
29067 </informaltable>
29068 <para>
29069 <indexterm role="concept">
29070 <primary>loop</primary>
29071 <secondary>prevention</secondary>
29072 </indexterm>
29073 <indexterm role="concept">
29074 <primary>mail loop prevention</primary>
29075 </indexterm>
29076 <indexterm role="concept">
29077 <primary><emphasis>Received:</emphasis> header line</primary>
29078 <secondary>counting</secondary>
29079 </indexterm>
29080 When a message is to be delivered, the number of <emphasis>Received:</emphasis> headers is
29081 counted, and if it is greater than this parameter, a mail loop is assumed to
29082 have occurred, the delivery is abandoned, and an error message is generated.
29083 This applies to both local and remote deliveries.
29084 </para>
29085 <para>
29086 <indexterm role="option">
29087 <primary><option>recipient_unqualified_hosts</option></primary>
29088 </indexterm>
29089 </para>
29090 <informaltable frame="all">
29091 <tgroup cols="4" colsep="0" rowsep="0">
29092 <colspec colwidth="8*" align="left"/>
29093 <colspec colwidth="6*" align="center"/>
29094 <colspec colwidth="6*" align="center"/>
29095 <colspec colwidth="6*" align="right"/>
29096 <tbody>
29097 <row>
29098 <entry><option>recipient_unqualified_hosts</option></entry>
29099 <entry>Use: <emphasis>main</emphasis></entry>
29100 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
29101 <entry>Default: <emphasis>unset</emphasis></entry>
29102 </row>
29103 </tbody>
29104 </tgroup>
29105 </informaltable>
29106 <para>
29107 <indexterm role="concept">
29108 <primary>unqualified addresses</primary>
29109 </indexterm>
29110 <indexterm role="concept">
29111 <primary>host</primary>
29112 <secondary>unqualified addresses from</secondary>
29113 </indexterm>
29114 This option lists those hosts from which Exim is prepared to accept unqualified
29115 recipient addresses in message envelopes. The addresses are made fully
29116 qualified by the addition of the <option>qualify_recipient</option> value. This option also
29117 affects message header lines. Exim does not reject unqualified recipient
29118 addresses in headers, but it qualifies them only if the message came from a
29119 host that matches <option>recipient_unqualified_hosts</option>,
29120 or if the message was submitted locally (not using TCP/IP), and the <option>-bnq</option>
29121 option was not set.
29122 </para>
29123 <para>
29124 <indexterm role="option">
29125 <primary><option>recipients_max</option></primary>
29126 </indexterm>
29127 </para>
29128 <informaltable frame="all">
29129 <tgroup cols="4" colsep="0" rowsep="0">
29130 <colspec colwidth="8*" align="left"/>
29131 <colspec colwidth="6*" align="center"/>
29132 <colspec colwidth="6*" align="center"/>
29133 <colspec colwidth="6*" align="right"/>
29134 <tbody>
29135 <row>
29136 <entry><option>recipients_max</option></entry>
29137 <entry>Use: <emphasis>main</emphasis></entry>
29138 <entry>Type: <emphasis>integer</emphasis></entry>
29139 <entry>Default: <emphasis>0</emphasis></entry>
29140 </row>
29141 </tbody>
29142 </tgroup>
29143 </informaltable>
29144 <para>
29145 <indexterm role="concept">
29146 <primary>limit</primary>
29147 <secondary>number of recipients</secondary>
29148 </indexterm>
29149 <indexterm role="concept">
29150 <primary>recipient</primary>
29151 <secondary>maximum number</secondary>
29152 </indexterm>
29153 If this option is set greater than zero, it specifies the maximum number of
29154 original recipients for any message. Additional recipients that are generated
29155 by aliasing or forwarding do not count. SMTP messages get a 452 response for
29156 all recipients over the limit; earlier recipients are delivered as normal.
29157 Non-SMTP messages with too many recipients are failed, and no deliveries are
29158 done.
29159 </para>
29160 <para>
29161 <indexterm role="concept">
29162 <primary>RCPT</primary>
29163 <secondary>maximum number of incoming</secondary>
29164 </indexterm>
29165 <emphasis role="bold">Note</emphasis>: The RFCs specify that an SMTP server should accept at least 100
29166 RCPT commands in a single message.
29167 </para>
29168 <para>
29169 <indexterm role="option">
29170 <primary><option>recipients_max_reject</option></primary>
29171 </indexterm>
29172 </para>
29173 <informaltable frame="all">
29174 <tgroup cols="4" colsep="0" rowsep="0">
29175 <colspec colwidth="8*" align="left"/>
29176 <colspec colwidth="6*" align="center"/>
29177 <colspec colwidth="6*" align="center"/>
29178 <colspec colwidth="6*" align="right"/>
29179 <tbody>
29180 <row>
29181 <entry><option>recipients_max_reject</option></entry>
29182 <entry>Use: <emphasis>main</emphasis></entry>
29183 <entry>Type: <emphasis>boolean</emphasis></entry>
29184 <entry>Default: <emphasis>false</emphasis></entry>
29185 </row>
29186 </tbody>
29187 </tgroup>
29188 </informaltable>
29189 <para>
29190 If this option is set true, Exim rejects SMTP messages containing too many
29191 recipients by giving 552 errors to the surplus RCPT commands, and a 554
29192 error to the eventual DATA command. Otherwise (the default) it gives a 452
29193 error to the surplus RCPT commands and accepts the message on behalf of the
29194 initial set of recipients. The remote server should then re-send the message
29195 for the remaining recipients at a later time.
29196 </para>
29197 <para>
29198 <indexterm role="option">
29199 <primary><option>remote_max_parallel</option></primary>
29200 </indexterm>
29201 </para>
29202 <informaltable frame="all">
29203 <tgroup cols="4" colsep="0" rowsep="0">
29204 <colspec colwidth="8*" align="left"/>
29205 <colspec colwidth="6*" align="center"/>
29206 <colspec colwidth="6*" align="center"/>
29207 <colspec colwidth="6*" align="right"/>
29208 <tbody>
29209 <row>
29210 <entry><option>remote_max_parallel</option></entry>
29211 <entry>Use: <emphasis>main</emphasis></entry>
29212 <entry>Type: <emphasis>integer</emphasis></entry>
29213 <entry>Default: <emphasis>2</emphasis></entry>
29214 </row>
29215 </tbody>
29216 </tgroup>
29217 </informaltable>
29218 <para>
29219 <indexterm role="concept">
29220 <primary>delivery</primary>
29221 <secondary>parallelism for remote</secondary>
29222 </indexterm>
29223 This option controls parallel delivery of one message to a number of remote
29224 hosts. If the value is less than 2, parallel delivery is disabled, and Exim
29225 does all the remote deliveries for a message one by one. Otherwise, if a single
29226 message has to be delivered to more than one remote host, or if several copies
29227 have to be sent to the same remote host, up to <option>remote_max_parallel</option>
29228 deliveries are done simultaneously. If more than <option>remote_max_parallel</option>
29229 deliveries are required, the maximum number of processes are started, and as
29230 each one finishes, another is begun. The order of starting processes is the
29231 same as if sequential delivery were being done, and can be controlled by the
29232 <option>remote_sort_domains</option> option. If parallel delivery takes place while running
29233 with debugging turned on, the debugging output from each delivery process is
29234 tagged with its process id.
29235 </para>
29236 <para>
29237 This option controls only the maximum number of parallel deliveries for one
29238 message in one Exim delivery process. Because Exim has no central queue
29239 manager, there is no way of controlling the total number of simultaneous
29240 deliveries if the configuration allows a delivery attempt as soon as a message
29241 is received.
29242 </para>
29243 <para>
29244 <indexterm role="concept">
29245 <primary>number of deliveries</primary>
29246 </indexterm>
29247 <indexterm role="concept">
29248 <primary>delivery</primary>
29249 <secondary>maximum number of</secondary>
29250 </indexterm>
29251 If you want to control the total number of deliveries on the system, you
29252 need to set the <option>queue_only</option> option. This ensures that all incoming messages
29253 are added to the queue without starting a delivery process. Then set up an Exim
29254 daemon to start queue runner processes at appropriate intervals (probably
29255 fairly often, for example, every minute), and limit the total number of queue
29256 runners by setting the <option>queue_run_max</option> parameter. Because each queue runner
29257 delivers only one message at a time, the maximum number of deliveries that can
29258 then take place at once is <option>queue_run_max</option> multiplied by
29259 <option>remote_max_parallel</option>.
29260 </para>
29261 <para>
29262 If it is purely remote deliveries you want to control, use
29263 <option>queue_smtp_domains</option> instead of <option>queue_only</option>. This has the added benefit of
29264 doing the SMTP routing before queueing, so that several messages for the same
29265 host will eventually get delivered down the same connection.
29266 </para>
29267 <para>
29268 <indexterm role="option">
29269 <primary><option>remote_sort_domains</option></primary>
29270 </indexterm>
29271 </para>
29272 <informaltable frame="all">
29273 <tgroup cols="4" colsep="0" rowsep="0">
29274 <colspec colwidth="8*" align="left"/>
29275 <colspec colwidth="6*" align="center"/>
29276 <colspec colwidth="6*" align="center"/>
29277 <colspec colwidth="6*" align="right"/>
29278 <tbody>
29279 <row>
29280 <entry><option>remote_sort_domains</option></entry>
29281 <entry>Use: <emphasis>main</emphasis></entry>
29282 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
29283 <entry>Default: <emphasis>unset</emphasis></entry>
29284 </row>
29285 </tbody>
29286 </tgroup>
29287 </informaltable>
29288 <para>
29289 <indexterm role="concept">
29290 <primary>sorting remote deliveries</primary>
29291 </indexterm>
29292 <indexterm role="concept">
29293 <primary>delivery</primary>
29294 <secondary>sorting remote</secondary>
29295 </indexterm>
29296 When there are a number of remote deliveries for a message, they are sorted by
29297 domain into the order given by this list. For example,
29298 </para>
29299 <literallayout class="monospaced">
29300 remote_sort_domains = *.cam.ac.uk:*.uk
29301 </literallayout>
29302 <para>
29303 would attempt to deliver to all addresses in the <emphasis>cam.ac.uk</emphasis> domain first,
29304 then to those in the <option>uk</option> domain, then to any others.
29305 </para>
29306 <para>
29307 <indexterm role="option">
29308 <primary><option>retry_data_expire</option></primary>
29309 </indexterm>
29310 </para>
29311 <informaltable frame="all">
29312 <tgroup cols="4" colsep="0" rowsep="0">
29313 <colspec colwidth="8*" align="left"/>
29314 <colspec colwidth="6*" align="center"/>
29315 <colspec colwidth="6*" align="center"/>
29316 <colspec colwidth="6*" align="right"/>
29317 <tbody>
29318 <row>
29319 <entry><option>retry_data_expire</option></entry>
29320 <entry>Use: <emphasis>main</emphasis></entry>
29321 <entry>Type: <emphasis>time</emphasis></entry>
29322 <entry>Default: <emphasis>7d</emphasis></entry>
29323 </row>
29324 </tbody>
29325 </tgroup>
29326 </informaltable>
29327 <para>
29328 <indexterm role="concept">
29329 <primary>hints database</primary>
29330 <secondary>data expiry</secondary>
29331 </indexterm>
29332 This option sets a <quote>use before</quote> time on retry information in Exim&#x2019;s hints
29333 database. Any older retry data is ignored. This means that, for example, once a
29334 host has not been tried for 7 days, Exim behaves as if it has no knowledge of
29335 past failures.
29336 </para>
29337 <para>
29338 <indexterm role="option">
29339 <primary><option>retry_interval_max</option></primary>
29340 </indexterm>
29341 </para>
29342 <informaltable frame="all">
29343 <tgroup cols="4" colsep="0" rowsep="0">
29344 <colspec colwidth="8*" align="left"/>
29345 <colspec colwidth="6*" align="center"/>
29346 <colspec colwidth="6*" align="center"/>
29347 <colspec colwidth="6*" align="right"/>
29348 <tbody>
29349 <row>
29350 <entry><option>retry_interval_max</option></entry>
29351 <entry>Use: <emphasis>main</emphasis></entry>
29352 <entry>Type: <emphasis>time</emphasis></entry>
29353 <entry>Default: <emphasis>24h</emphasis></entry>
29354 </row>
29355 </tbody>
29356 </tgroup>
29357 </informaltable>
29358 <para>
29359 <indexterm role="concept">
29360 <primary>retry</primary>
29361 <secondary>limit on interval</secondary>
29362 </indexterm>
29363 <indexterm role="concept">
29364 <primary>limit</primary>
29365 <secondary>on retry interval</secondary>
29366 </indexterm>
29367 Chapter <xref linkend="CHAPretry"/> describes Exim&#x2019;s mechanisms for controlling the
29368 intervals between delivery attempts for messages that cannot be delivered
29369 straight away. This option sets an overall limit to the length of time between
29370 retries. It cannot be set greater than 24 hours; any attempt to do so forces
29371 the default value.
29372 </para>
29373 <para>
29374 <indexterm role="option">
29375 <primary><option>return_path_remove</option></primary>
29376 </indexterm>
29377 </para>
29378 <informaltable frame="all">
29379 <tgroup cols="4" colsep="0" rowsep="0">
29380 <colspec colwidth="8*" align="left"/>
29381 <colspec colwidth="6*" align="center"/>
29382 <colspec colwidth="6*" align="center"/>
29383 <colspec colwidth="6*" align="right"/>
29384 <tbody>
29385 <row>
29386 <entry><option>return_path_remove</option></entry>
29387 <entry>Use: <emphasis>main</emphasis></entry>
29388 <entry>Type: <emphasis>boolean</emphasis></entry>
29389 <entry>Default: <emphasis>true</emphasis></entry>
29390 </row>
29391 </tbody>
29392 </tgroup>
29393 </informaltable>
29394 <para>
29395 <indexterm role="concept">
29396 <primary><emphasis>Return-path:</emphasis> header line</primary>
29397 <secondary>removing</secondary>
29398 </indexterm>
29399 RFC 2821, section 4.4, states that an SMTP server must insert a
29400 <emphasis>Return-path:</emphasis> header line into a message when it makes a <quote>final delivery</quote>.
29401 The <emphasis>Return-path:</emphasis> header preserves the sender address as received in the
29402 MAIL command. This description implies that this header should not be present
29403 in an incoming message. If <option>return_path_remove</option> is true, any existing
29404 <emphasis>Return-path:</emphasis> headers are removed from messages at the time they are
29405 received. Exim&#x2019;s transports have options for adding <emphasis>Return-path:</emphasis> headers at
29406 the time of delivery. They are normally used only for final local deliveries.
29407 </para>
29408 <para>
29409 <indexterm role="option">
29410 <primary><option>return_size_limit</option></primary>
29411 </indexterm>
29412 </para>
29413 <informaltable frame="all">
29414 <tgroup cols="4" colsep="0" rowsep="0">
29415 <colspec colwidth="8*" align="left"/>
29416 <colspec colwidth="6*" align="center"/>
29417 <colspec colwidth="6*" align="center"/>
29418 <colspec colwidth="6*" align="right"/>
29419 <tbody>
29420 <row>
29421 <entry><option>return_size_limit</option></entry>
29422 <entry>Use: <emphasis>main</emphasis></entry>
29423 <entry>Type: <emphasis>integer</emphasis></entry>
29424 <entry>Default: <emphasis>100K</emphasis></entry>
29425 </row>
29426 </tbody>
29427 </tgroup>
29428 </informaltable>
29429 <para>
29430 This option is an obsolete synonym for <option>bounce_return_size_limit</option>.
29431 </para>
29432 <para>
29433 <indexterm role="option">
29434 <primary><option>rfc1413_hosts</option></primary>
29435 </indexterm>
29436 </para>
29437 <informaltable frame="all">
29438 <tgroup cols="4" colsep="0" rowsep="0">
29439 <colspec colwidth="8*" align="left"/>
29440 <colspec colwidth="6*" align="center"/>
29441 <colspec colwidth="6*" align="center"/>
29442 <colspec colwidth="6*" align="right"/>
29443 <tbody>
29444 <row>
29445 <entry><option>rfc1413_hosts</option></entry>
29446 <entry>Use: <emphasis>main</emphasis></entry>
29447 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
29448 <entry>Default: <emphasis>@[]</emphasis></entry>
29449 </row>
29450 </tbody>
29451 </tgroup>
29452 </informaltable>
29453 <para>
29454 <indexterm role="concept">
29455 <primary>RFC 1413</primary>
29456 </indexterm>
29457 <indexterm role="concept">
29458 <primary>host</primary>
29459 <secondary>for RFC 1413 calls</secondary>
29460 </indexterm>
29461 RFC 1413 identification calls are made to any client host which matches
29462 an item in the list.
29463 The default value specifies just this host, being any local interface
29464 for the system.
29465 </para>
29466 <para>
29467 <indexterm role="option">
29468 <primary><option>rfc1413_query_timeout</option></primary>
29469 </indexterm>
29470 </para>
29471 <informaltable frame="all">
29472 <tgroup cols="4" colsep="0" rowsep="0">
29473 <colspec colwidth="8*" align="left"/>
29474 <colspec colwidth="6*" align="center"/>
29475 <colspec colwidth="6*" align="center"/>
29476 <colspec colwidth="6*" align="right"/>
29477 <tbody>
29478 <row>
29479 <entry><option>rfc1413_query_timeout</option></entry>
29480 <entry>Use: <emphasis>main</emphasis></entry>
29481 <entry>Type: <emphasis>time</emphasis></entry>
29482 <entry>Default: <emphasis>0s</emphasis></entry>
29483 </row>
29484 </tbody>
29485 </tgroup>
29486 </informaltable>
29487 <para>
29488 <indexterm role="concept">
29489 <primary>RFC 1413</primary>
29490 <secondary>query timeout</secondary>
29491 </indexterm>
29492 <indexterm role="concept">
29493 <primary>timeout</primary>
29494 <secondary>for RFC 1413 call</secondary>
29495 </indexterm>
29496 This sets the timeout on RFC 1413 identification calls. If it is set to zero,
29497 no RFC 1413 calls are ever made.
29498 </para>
29499 <para>
29500 <indexterm role="option">
29501 <primary><option>sender_unqualified_hosts</option></primary>
29502 </indexterm>
29503 </para>
29504 <informaltable frame="all">
29505 <tgroup cols="4" colsep="0" rowsep="0">
29506 <colspec colwidth="8*" align="left"/>
29507 <colspec colwidth="6*" align="center"/>
29508 <colspec colwidth="6*" align="center"/>
29509 <colspec colwidth="6*" align="right"/>
29510 <tbody>
29511 <row>
29512 <entry><option>sender_unqualified_hosts</option></entry>
29513 <entry>Use: <emphasis>main</emphasis></entry>
29514 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
29515 <entry>Default: <emphasis>unset</emphasis></entry>
29516 </row>
29517 </tbody>
29518 </tgroup>
29519 </informaltable>
29520 <para>
29521 <indexterm role="concept">
29522 <primary>unqualified addresses</primary>
29523 </indexterm>
29524 <indexterm role="concept">
29525 <primary>host</primary>
29526 <secondary>unqualified addresses from</secondary>
29527 </indexterm>
29528 This option lists those hosts from which Exim is prepared to accept unqualified
29529 sender addresses. The addresses are made fully qualified by the addition of
29530 <option>qualify_domain</option>. This option also affects message header lines. Exim does
29531 not reject unqualified addresses in headers that contain sender addresses, but
29532 it qualifies them only if the message came from a host that matches
29533 <option>sender_unqualified_hosts</option>, or if the message was submitted locally (not
29534 using TCP/IP), and the <option>-bnq</option> option was not set.
29535 </para>
29536 <para>
29537 <indexterm role="option">
29538 <primary><option>set_environment</option></primary>
29539 </indexterm>
29540 </para>
29541 <informaltable frame="all">
29542 <tgroup cols="4" colsep="0" rowsep="0">
29543 <colspec colwidth="8*" align="left"/>
29544 <colspec colwidth="6*" align="center"/>
29545 <colspec colwidth="6*" align="center"/>
29546 <colspec colwidth="6*" align="right"/>
29547 <tbody>
29548 <row>
29549 <entry><option>set_environment</option></entry>
29550 <entry>Use: <emphasis>main</emphasis></entry>
29551 <entry>Type: <emphasis>string list</emphasis></entry>
29552 <entry>Default: <emphasis>empty</emphasis></entry>
29553 </row>
29554 </tbody>
29555 </tgroup>
29556 </informaltable>
29557 <para>
29558 <indexterm role="concept">
29559 <primary>environment</primary>
29560 </indexterm>
29561 This option allows to set individual environment variables that the
29562 currently linked libraries and programs in child processes use. The
29563 default list is empty,
29564 </para>
29565 <para>
29566 <indexterm role="option">
29567 <primary><option>slow_lookup_log</option></primary>
29568 </indexterm>
29569 </para>
29570 <informaltable frame="all">
29571 <tgroup cols="4" colsep="0" rowsep="0">
29572 <colspec colwidth="8*" align="left"/>
29573 <colspec colwidth="6*" align="center"/>
29574 <colspec colwidth="6*" align="center"/>
29575 <colspec colwidth="6*" align="right"/>
29576 <tbody>
29577 <row>
29578 <entry><option>slow_lookup_log</option></entry>
29579 <entry>Use: <emphasis>main</emphasis></entry>
29580 <entry>Type: <emphasis>integer</emphasis></entry>
29581 <entry>Default: <emphasis>0</emphasis></entry>
29582 </row>
29583 </tbody>
29584 </tgroup>
29585 </informaltable>
29586 <para>
29587 <indexterm role="concept">
29588 <primary>logging</primary>
29589 <secondary>slow lookups</secondary>
29590 </indexterm>
29591 <indexterm role="concept">
29592 <primary>dns</primary>
29593 <secondary>logging slow lookups</secondary>
29594 </indexterm>
29595 This option controls logging of slow lookups.
29596 If the value is nonzero it is taken as a number of milliseconds
29597 and lookups taking longer than this are logged.
29598 Currently this applies only to DNS lookups.
29599 </para>
29600 <para>
29601 <indexterm role="option">
29602 <primary><option>smtp_accept_keepalive</option></primary>
29603 </indexterm>
29604 </para>
29605 <informaltable frame="all">
29606 <tgroup cols="4" colsep="0" rowsep="0">
29607 <colspec colwidth="8*" align="left"/>
29608 <colspec colwidth="6*" align="center"/>
29609 <colspec colwidth="6*" align="center"/>
29610 <colspec colwidth="6*" align="right"/>
29611 <tbody>
29612 <row>
29613 <entry><option>smtp_accept_keepalive</option></entry>
29614 <entry>Use: <emphasis>main</emphasis></entry>
29615 <entry>Type: <emphasis>boolean</emphasis></entry>
29616 <entry>Default: <emphasis>true</emphasis></entry>
29617 </row>
29618 </tbody>
29619 </tgroup>
29620 </informaltable>
29621 <para>
29622 <indexterm role="concept">
29623 <primary>keepalive</primary>
29624 <secondary>on incoming connection</secondary>
29625 </indexterm>
29626 This option controls the setting of the SO_KEEPALIVE option on incoming
29627 TCP/IP socket connections. When set, it causes the kernel to probe idle
29628 connections periodically, by sending packets with <quote>old</quote> sequence numbers. The
29629 other end of the connection should send an acknowledgment if the connection is
29630 still okay or a reset if the connection has been aborted. The reason for doing
29631 this is that it has the beneficial effect of freeing up certain types of
29632 connection that can get stuck when the remote host is disconnected without
29633 tidying up the TCP/IP call properly. The keepalive mechanism takes several
29634 hours to detect unreachable hosts.
29635 </para>
29636 <para>
29637 <indexterm role="option">
29638 <primary><option>smtp_accept_max</option></primary>
29639 </indexterm>
29640 </para>
29641 <informaltable frame="all">
29642 <tgroup cols="4" colsep="0" rowsep="0">
29643 <colspec colwidth="8*" align="left"/>
29644 <colspec colwidth="6*" align="center"/>
29645 <colspec colwidth="6*" align="center"/>
29646 <colspec colwidth="6*" align="right"/>
29647 <tbody>
29648 <row>
29649 <entry><option>smtp_accept_max</option></entry>
29650 <entry>Use: <emphasis>main</emphasis></entry>
29651 <entry>Type: <emphasis>integer</emphasis></entry>
29652 <entry>Default: <emphasis>20</emphasis></entry>
29653 </row>
29654 </tbody>
29655 </tgroup>
29656 </informaltable>
29657 <para>
29658 <indexterm role="concept">
29659 <primary>limit</primary>
29660 <secondary>incoming SMTP connections</secondary>
29661 </indexterm>
29662 <indexterm role="concept">
29663 <primary>SMTP</primary>
29664 <secondary>incoming connection count</secondary>
29665 </indexterm>
29666 <indexterm role="concept">
29667 <primary>inetd</primary>
29668 </indexterm>
29669 This option specifies the maximum number of simultaneous incoming SMTP calls
29670 that Exim will accept. It applies only to the listening daemon; there is no
29671 control (in Exim) when incoming SMTP is being handled by <emphasis>inetd</emphasis>. If the
29672 value is set to zero, no limit is applied. However, it is required to be
29673 non-zero if either <option>smtp_accept_max_per_host</option> or <option>smtp_accept_queue</option> is
29674 set. See also <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option>.
29675 </para>
29676 <para>
29677 A new SMTP connection is immediately rejected if the <option>smtp_accept_max</option> limit
29678 has been reached. If not, Exim first checks <option>smtp_accept_max_per_host</option>. If
29679 that limit has not been reached for the client host, <option>smtp_accept_reserve</option>
29680 and <option>smtp_load_reserve</option> are then checked before accepting the connection.
29681 </para>
29682 <para>
29683 <indexterm role="option">
29684 <primary><option>smtp_accept_max_nonmail</option></primary>
29685 </indexterm>
29686 </para>
29687 <informaltable frame="all">
29688 <tgroup cols="4" colsep="0" rowsep="0">
29689 <colspec colwidth="8*" align="left"/>
29690 <colspec colwidth="6*" align="center"/>
29691 <colspec colwidth="6*" align="center"/>
29692 <colspec colwidth="6*" align="right"/>
29693 <tbody>
29694 <row>
29695 <entry><option>smtp_accept_max_nonmail</option></entry>
29696 <entry>Use: <emphasis>main</emphasis></entry>
29697 <entry>Type: <emphasis>integer</emphasis></entry>
29698 <entry>Default: <emphasis>10</emphasis></entry>
29699 </row>
29700 </tbody>
29701 </tgroup>
29702 </informaltable>
29703 <para>
29704 <indexterm role="concept">
29705 <primary>limit</primary>
29706 <secondary>non-mail SMTP commands</secondary>
29707 </indexterm>
29708 <indexterm role="concept">
29709 <primary>SMTP</primary>
29710 <secondary>limiting non-mail commands</secondary>
29711 </indexterm>
29712 Exim counts the number of <quote>non-mail</quote> commands in an SMTP session, and drops
29713 the connection if there are too many. This option defines <quote>too many</quote>. The
29714 check catches some denial-of-service attacks, repeated failing AUTHs, or a mad
29715 client looping sending EHLO, for example. The check is applied only if the
29716 client host matches <option>smtp_accept_max_nonmail_hosts</option>.
29717 </para>
29718 <para>
29719 When a new message is expected, one occurrence of RSET is not counted. This
29720 allows a client to send one RSET between messages (this is not necessary,
29721 but some clients do it). Exim also allows one uncounted occurrence of HELO
29722 or EHLO, and one occurrence of STARTTLS between messages. After
29723 starting up a TLS session, another EHLO is expected, and so it too is not
29724 counted. The first occurrence of AUTH in a connection, or immediately
29725 following STARTTLS is not counted. Otherwise, all commands other than
29726 MAIL, RCPT, DATA, and QUIT are counted.
29727 </para>
29728 <para>
29729 <indexterm role="option">
29730 <primary><option>smtp_accept_max_nonmail_hosts</option></primary>
29731 </indexterm>
29732 </para>
29733 <informaltable frame="all">
29734 <tgroup cols="4" colsep="0" rowsep="0">
29735 <colspec colwidth="8*" align="left"/>
29736 <colspec colwidth="6*" align="center"/>
29737 <colspec colwidth="6*" align="center"/>
29738 <colspec colwidth="6*" align="right"/>
29739 <tbody>
29740 <row>
29741 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
29742 <entry>Use: <emphasis>main</emphasis></entry>
29743 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
29744 <entry>Default: <emphasis>*</emphasis></entry>
29745 </row>
29746 </tbody>
29747 </tgroup>
29748 </informaltable>
29749 <para>
29750 You can control which hosts are subject to the <option>smtp_accept_max_nonmail</option>
29751 check by setting this option. The default value makes it apply to all hosts. By
29752 changing the value, you can exclude any badly-behaved hosts that you have to
29753 live with.
29754 </para>
29755 <para>
29756 <indexterm role="option">
29757 <primary><option>smtp_accept_max_per_connection</option></primary>
29758 </indexterm>
29759 </para>
29760 <informaltable frame="all">
29761 <tgroup cols="4" colsep="0" rowsep="0">
29762 <colspec colwidth="8*" align="left"/>
29763 <colspec colwidth="6*" align="center"/>
29764 <colspec colwidth="6*" align="center"/>
29765 <colspec colwidth="6*" align="right"/>
29766 <tbody>
29767 <row>
29768 <entry><option>smtp_accept_max_per_connection</option></entry>
29769 <entry>Use: <emphasis>main</emphasis></entry>
29770 <entry>Type: <emphasis>integer</emphasis></entry>
29771 <entry>Default: <emphasis>1000</emphasis></entry>
29772 </row>
29773 </tbody>
29774 </tgroup>
29775 </informaltable>
29776 <para>
29777 <indexterm role="concept">
29778 <primary>SMTP</primary>
29779 <secondary>limiting incoming message count</secondary>
29780 </indexterm>
29781 <indexterm role="concept">
29782 <primary>limit</primary>
29783 <secondary>messages per SMTP connection</secondary>
29784 </indexterm>
29785 The value of this option limits the number of MAIL commands that Exim is
29786 prepared to accept over a single SMTP connection, whether or not each command
29787 results in the transfer of a message. After the limit is reached, a 421
29788 response is given to subsequent MAIL commands. This limit is a safety
29789 precaution against a client that goes mad (incidents of this type have been
29790 seen).
29791 </para>
29792 <para>
29793 <indexterm role="option">
29794 <primary><option>smtp_accept_max_per_host</option></primary>
29795 </indexterm>
29796 </para>
29797 <informaltable frame="all">
29798 <tgroup cols="4" colsep="0" rowsep="0">
29799 <colspec colwidth="8*" align="left"/>
29800 <colspec colwidth="6*" align="center"/>
29801 <colspec colwidth="6*" align="center"/>
29802 <colspec colwidth="6*" align="right"/>
29803 <tbody>
29804 <row>
29805 <entry><option>smtp_accept_max_per_host</option></entry>
29806 <entry>Use: <emphasis>main</emphasis></entry>
29807 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29808 <entry>Default: <emphasis>unset</emphasis></entry>
29809 </row>
29810 </tbody>
29811 </tgroup>
29812 </informaltable>
29813 <para>
29814 <indexterm role="concept">
29815 <primary>limit</primary>
29816 <secondary>SMTP connections from one host</secondary>
29817 </indexterm>
29818 <indexterm role="concept">
29819 <primary>host</primary>
29820 <secondary>limiting SMTP connections from</secondary>
29821 </indexterm>
29822 This option restricts the number of simultaneous IP connections from a single
29823 host (strictly, from a single IP address) to the Exim daemon. The option is
29824 expanded, to enable different limits to be applied to different hosts by
29825 reference to <varname>$sender_host_address</varname>. Once the limit is reached, additional
29826 connection attempts from the same host are rejected with error code 421. This
29827 is entirely independent of <option>smtp_accept_reserve</option>. The option&#x2019;s default value
29828 of zero imposes no limit. If this option is set greater than zero, it is
29829 required that <option>smtp_accept_max</option> be non-zero.
29830 </para>
29831 <para>
29832 <emphasis role="bold">Warning</emphasis>: When setting this option you should not use any expansion
29833 constructions that take an appreciable amount of time. The expansion and test
29834 happen in the main daemon loop, in order to reject additional connections
29835 without forking additional processes (otherwise a denial-of-service attack
29836 could cause a vast number or processes to be created). While the daemon is
29837 doing this processing, it cannot accept any other incoming connections.
29838 </para>
29839 <para>
29840 <indexterm role="option">
29841 <primary><option>smtp_accept_queue</option></primary>
29842 </indexterm>
29843 </para>
29844 <informaltable frame="all">
29845 <tgroup cols="4" colsep="0" rowsep="0">
29846 <colspec colwidth="8*" align="left"/>
29847 <colspec colwidth="6*" align="center"/>
29848 <colspec colwidth="6*" align="center"/>
29849 <colspec colwidth="6*" align="right"/>
29850 <tbody>
29851 <row>
29852 <entry><option>smtp_accept_queue</option></entry>
29853 <entry>Use: <emphasis>main</emphasis></entry>
29854 <entry>Type: <emphasis>integer</emphasis></entry>
29855 <entry>Default: <emphasis>0</emphasis></entry>
29856 </row>
29857 </tbody>
29858 </tgroup>
29859 </informaltable>
29860 <para>
29861 <indexterm role="concept">
29862 <primary>SMTP</primary>
29863 <secondary>incoming connection count</secondary>
29864 </indexterm>
29865 <indexterm role="concept">
29866 <primary>queueing incoming messages</primary>
29867 </indexterm>
29868 <indexterm role="concept">
29869 <primary>message</primary>
29870 <secondary>queueing by SMTP connection count</secondary>
29871 </indexterm>
29872 If the number of simultaneous incoming SMTP connections being handled via the
29873 listening daemon exceeds this value, messages received by SMTP are just placed
29874 on the queue; no delivery processes are started automatically. The count is
29875 fixed at the start of an SMTP connection. It cannot be updated in the
29876 subprocess that receives messages, and so the queueing or not queueing applies
29877 to all messages received in the same connection.
29878 </para>
29879 <para>
29880 A value of zero implies no limit, and clearly any non-zero value is useful only
29881 if it is less than the <option>smtp_accept_max</option> value (unless that is zero). See
29882 also <option>queue_only</option>, <option>queue_only_load</option>, <option>queue_smtp_domains</option>, and the
29883 various <option>-od</option><emphasis>x</emphasis> command line options.
29884 </para>
29885 <para>
29886 <indexterm role="option">
29887 <primary><option>smtp_accept_queue_per_connection</option></primary>
29888 </indexterm>
29889 </para>
29890 <informaltable frame="all">
29891 <tgroup cols="4" colsep="0" rowsep="0">
29892 <colspec colwidth="8*" align="left"/>
29893 <colspec colwidth="6*" align="center"/>
29894 <colspec colwidth="6*" align="center"/>
29895 <colspec colwidth="6*" align="right"/>
29896 <tbody>
29897 <row>
29898 <entry><option>smtp_accept_queue_per_connection</option></entry>
29899 <entry>Use: <emphasis>main</emphasis></entry>
29900 <entry>Type: <emphasis>integer</emphasis></entry>
29901 <entry>Default: <emphasis>10</emphasis></entry>
29902 </row>
29903 </tbody>
29904 </tgroup>
29905 </informaltable>
29906 <para>
29907 <indexterm role="concept">
29908 <primary>queueing incoming messages</primary>
29909 </indexterm>
29910 <indexterm role="concept">
29911 <primary>message</primary>
29912 <secondary>queueing by message count</secondary>
29913 </indexterm>
29914 This option limits the number of delivery processes that Exim starts
29915 automatically when receiving messages via SMTP, whether via the daemon or by
29916 the use of <option>-bs</option> or <option>-bS</option>. If the value of the option is greater than zero,
29917 and the number of messages received in a single SMTP session exceeds this
29918 number, subsequent messages are placed on the queue, but no delivery processes
29919 are started. This helps to limit the number of Exim processes when a server
29920 restarts after downtime and there is a lot of mail waiting for it on other
29921 systems. On large systems, the default should probably be increased, and on
29922 dial-in client systems it should probably be set to zero (that is, disabled).
29923 </para>
29924 <para>
29925 <indexterm role="option">
29926 <primary><option>smtp_accept_reserve</option></primary>
29927 </indexterm>
29928 </para>
29929 <informaltable frame="all">
29930 <tgroup cols="4" colsep="0" rowsep="0">
29931 <colspec colwidth="8*" align="left"/>
29932 <colspec colwidth="6*" align="center"/>
29933 <colspec colwidth="6*" align="center"/>
29934 <colspec colwidth="6*" align="right"/>
29935 <tbody>
29936 <row>
29937 <entry><option>smtp_accept_reserve</option></entry>
29938 <entry>Use: <emphasis>main</emphasis></entry>
29939 <entry>Type: <emphasis>integer</emphasis></entry>
29940 <entry>Default: <emphasis>0</emphasis></entry>
29941 </row>
29942 </tbody>
29943 </tgroup>
29944 </informaltable>
29945 <para>
29946 <indexterm role="concept">
29947 <primary>SMTP</primary>
29948 <secondary>incoming call count</secondary>
29949 </indexterm>
29950 <indexterm role="concept">
29951 <primary>host</primary>
29952 <secondary>reserved</secondary>
29953 </indexterm>
29954 When <option>smtp_accept_max</option> is set greater than zero, this option specifies a
29955 number of SMTP connections that are reserved for connections from the hosts
29956 that are specified in <option>smtp_reserve_hosts</option>. The value set in
29957 <option>smtp_accept_max</option> includes this reserve pool. The specified hosts are not
29958 restricted to this number of connections; the option specifies a minimum number
29959 of connection slots for them, not a maximum. It is a guarantee that this group
29960 of hosts can always get at least <option>smtp_accept_reserve</option> connections. However,
29961 the limit specified by <option>smtp_accept_max_per_host</option> is still applied to each
29962 individual host.
29963 </para>
29964 <para>
29965 For example, if <option>smtp_accept_max</option> is set to 50 and <option>smtp_accept_reserve</option> is
29966 set to 5, once there are 45 active connections (from any hosts), new
29967 connections are accepted only from hosts listed in <option>smtp_reserve_hosts</option>,
29968 provided the other criteria for acceptance are met.
29969 </para>
29970 <para>
29971 <indexterm role="option">
29972 <primary><option>smtp_active_hostname</option></primary>
29973 </indexterm>
29974 </para>
29975 <informaltable frame="all">
29976 <tgroup cols="4" colsep="0" rowsep="0">
29977 <colspec colwidth="8*" align="left"/>
29978 <colspec colwidth="6*" align="center"/>
29979 <colspec colwidth="6*" align="center"/>
29980 <colspec colwidth="6*" align="right"/>
29981 <tbody>
29982 <row>
29983 <entry><option>smtp_active_hostname</option></entry>
29984 <entry>Use: <emphasis>main</emphasis></entry>
29985 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29986 <entry>Default: <emphasis>unset</emphasis></entry>
29987 </row>
29988 </tbody>
29989 </tgroup>
29990 </informaltable>
29991 <para>
29992 <indexterm role="concept">
29993 <primary>host</primary>
29994 <secondary>name in SMTP responses</secondary>
29995 </indexterm>
29996 <indexterm role="concept">
29997 <primary>SMTP</primary>
29998 <secondary>host name in responses</secondary>
29999 </indexterm>
30000 <indexterm role="variable">
30001 <primary><varname>$primary_hostname</varname></primary>
30002 </indexterm>
30003 This option is provided for multi-homed servers that want to masquerade as
30004 several different hosts. At the start of an incoming SMTP connection, its value
30005 is expanded and used instead of the value of <varname>$primary_hostname</varname> in SMTP
30006 responses. For example, it is used as domain name in the response to an
30007 incoming HELO or EHLO command.
30008 </para>
30009 <para>
30010 <indexterm role="variable">
30011 <primary><varname>$smtp_active_hostname</varname></primary>
30012 </indexterm>
30013 The active hostname is placed in the <varname>$smtp_active_hostname</varname> variable, which
30014 is saved with any messages that are received. It is therefore available for use
30015 in routers and transports when the message is later delivered.
30016 </para>
30017 <para>
30018 If this option is unset, or if its expansion is forced to fail, or if the
30019 expansion results in an empty string, the value of <varname>$primary_hostname</varname> is
30020 used. Other expansion failures cause a message to be written to the main and
30021 panic logs, and the SMTP command receives a temporary error. Typically, the
30022 value of <option>smtp_active_hostname</option> depends on the incoming interface address.
30023 For example:
30024 </para>
30025 <literallayout class="monospaced">
30026 smtp_active_hostname = ${if eq{$received_ip_address}{10.0.0.1}\
30027   {cox.mydomain}{box.mydomain}}
30028 </literallayout>
30029 <para>
30030 Although <varname>$smtp_active_hostname</varname> is primarily concerned with incoming
30031 messages, it is also used as the default for HELO commands in callout
30032 verification if there is no remote transport from which to obtain a
30033 <option>helo_data</option> value.
30034 </para>
30035 <para>
30036 <indexterm role="option">
30037 <primary><option>smtp_banner</option></primary>
30038 </indexterm>
30039 </para>
30040 <informaltable frame="all">
30041 <tgroup cols="4" colsep="0" rowsep="0">
30042 <colspec colwidth="8*" align="left"/>
30043 <colspec colwidth="6*" align="center"/>
30044 <colspec colwidth="6*" align="center"/>
30045 <colspec colwidth="6*" align="right"/>
30046 <tbody>
30047 <row>
30048 <entry><option>smtp_banner</option></entry>
30049 <entry>Use: <emphasis>main</emphasis></entry>
30050 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30051 <entry>Default: <emphasis>see below</emphasis></entry>
30052 </row>
30053 </tbody>
30054 </tgroup>
30055 </informaltable>
30056 <para>
30057 <indexterm role="concept">
30058 <primary>SMTP</primary>
30059 <secondary>welcome banner</secondary>
30060 </indexterm>
30061 <indexterm role="concept">
30062 <primary>banner for SMTP</primary>
30063 </indexterm>
30064 <indexterm role="concept">
30065 <primary>welcome banner for SMTP</primary>
30066 </indexterm>
30067 <indexterm role="concept">
30068 <primary>customizing</primary>
30069 <secondary>SMTP banner</secondary>
30070 </indexterm>
30071 This string, which is expanded every time it is used, is output as the initial
30072 positive response to an SMTP connection. The default setting is:
30073 </para>
30074 <literallayout class="monospaced">
30075 smtp_banner = $smtp_active_hostname ESMTP Exim \
30076   $version_number $tod_full
30077 </literallayout>
30078 <para>
30079 Failure to expand the string causes a panic error. If you want to create a
30080 multiline response to the initial SMTP connection, use <quote>\n</quote> in the string at
30081 appropriate points, but not at the end. Note that the 220 code is not included
30082 in this string. Exim adds it automatically (several times in the case of a
30083 multiline response).
30084 </para>
30085 <para>
30086 <indexterm role="option">
30087 <primary><option>smtp_check_spool_space</option></primary>
30088 </indexterm>
30089 </para>
30090 <informaltable frame="all">
30091 <tgroup cols="4" colsep="0" rowsep="0">
30092 <colspec colwidth="8*" align="left"/>
30093 <colspec colwidth="6*" align="center"/>
30094 <colspec colwidth="6*" align="center"/>
30095 <colspec colwidth="6*" align="right"/>
30096 <tbody>
30097 <row>
30098 <entry><option>smtp_check_spool_space</option></entry>
30099 <entry>Use: <emphasis>main</emphasis></entry>
30100 <entry>Type: <emphasis>boolean</emphasis></entry>
30101 <entry>Default: <emphasis>true</emphasis></entry>
30102 </row>
30103 </tbody>
30104 </tgroup>
30105 </informaltable>
30106 <para>
30107 <indexterm role="concept">
30108 <primary>checking disk space</primary>
30109 </indexterm>
30110 <indexterm role="concept">
30111 <primary>disk space, checking</primary>
30112 </indexterm>
30113 <indexterm role="concept">
30114 <primary>spool directory</primary>
30115 <secondary>checking space</secondary>
30116 </indexterm>
30117 When this option is set, if an incoming SMTP session encounters the SIZE
30118 option on a MAIL command, it checks that there is enough space in the
30119 spool directory&#x2019;s partition to accept a message of that size, while still
30120 leaving free the amount specified by <option>check_spool_space</option> (even if that value
30121 is zero). If there isn&#x2019;t enough space, a temporary error code is returned.
30122 </para>
30123 <para>
30124 <indexterm role="option">
30125 <primary><option>smtp_connect_backlog</option></primary>
30126 </indexterm>
30127 </para>
30128 <informaltable frame="all">
30129 <tgroup cols="4" colsep="0" rowsep="0">
30130 <colspec colwidth="8*" align="left"/>
30131 <colspec colwidth="6*" align="center"/>
30132 <colspec colwidth="6*" align="center"/>
30133 <colspec colwidth="6*" align="right"/>
30134 <tbody>
30135 <row>
30136 <entry><option>smtp_connect_backlog</option></entry>
30137 <entry>Use: <emphasis>main</emphasis></entry>
30138 <entry>Type: <emphasis>integer</emphasis></entry>
30139 <entry>Default: <emphasis>20</emphasis></entry>
30140 </row>
30141 </tbody>
30142 </tgroup>
30143 </informaltable>
30144 <para>
30145 <indexterm role="concept">
30146 <primary>connection backlog</primary>
30147 </indexterm>
30148 <indexterm role="concept">
30149 <primary>SMTP</primary>
30150 <secondary>connection backlog</secondary>
30151 </indexterm>
30152 <indexterm role="concept">
30153 <primary>backlog of connections</primary>
30154 </indexterm>
30155 This option specifies a maximum number of waiting SMTP connections. Exim passes
30156 this value to the TCP/IP system when it sets up its listener. Once this number
30157 of connections are waiting for the daemon&#x2019;s attention, subsequent connection
30158 attempts are refused at the TCP/IP level. At least, that is what the manuals
30159 say; in some circumstances such connection attempts have been observed to time
30160 out instead. For large systems it is probably a good idea to increase the
30161 value (to 50, say). It also gives some protection against denial-of-service
30162 attacks by SYN flooding.
30163 </para>
30164 <para>
30165 <indexterm role="option">
30166 <primary><option>smtp_enforce_sync</option></primary>
30167 </indexterm>
30168 </para>
30169 <informaltable frame="all">
30170 <tgroup cols="4" colsep="0" rowsep="0">
30171 <colspec colwidth="8*" align="left"/>
30172 <colspec colwidth="6*" align="center"/>
30173 <colspec colwidth="6*" align="center"/>
30174 <colspec colwidth="6*" align="right"/>
30175 <tbody>
30176 <row>
30177 <entry><option>smtp_enforce_sync</option></entry>
30178 <entry>Use: <emphasis>main</emphasis></entry>
30179 <entry>Type: <emphasis>boolean</emphasis></entry>
30180 <entry>Default: <emphasis>true</emphasis></entry>
30181 </row>
30182 </tbody>
30183 </tgroup>
30184 </informaltable>
30185 <para>
30186 <indexterm role="concept">
30187 <primary>SMTP</primary>
30188 <secondary>synchronization checking</secondary>
30189 </indexterm>
30190 <indexterm role="concept">
30191 <primary>synchronization checking in SMTP</primary>
30192 </indexterm>
30193 The SMTP protocol specification requires the client to wait for a response from
30194 the server at certain points in the dialogue. Without PIPELINING these
30195 synchronization points are after every command; with PIPELINING they are
30196 fewer, but they still exist.
30197 </para>
30198 <para>
30199 Some spamming sites send out a complete set of SMTP commands without waiting
30200 for any response. Exim protects against this by rejecting a message if the
30201 client has sent further input when it should not have. The error response <quote>554
30202 SMTP synchronization error</quote> is sent, and the connection is dropped. Testing
30203 for this error cannot be perfect because of transmission delays (unexpected
30204 input may be on its way but not yet received when Exim checks). However, it
30205 does detect many instances.
30206 </para>
30207 <para>
30208 The check can be globally disabled by setting <option>smtp_enforce_sync</option> false.
30209 If you want to disable the check selectively (for example, only for certain
30210 hosts), you can do so by an appropriate use of a <option>control</option> modifier in an ACL
30211 (see section <xref linkend="SECTcontrols"/>). See also <option>pipelining_advertise_hosts</option>.
30212 </para>
30213 <para>
30214 <indexterm role="option">
30215 <primary><option>smtp_etrn_command</option></primary>
30216 </indexterm>
30217 </para>
30218 <informaltable frame="all">
30219 <tgroup cols="4" colsep="0" rowsep="0">
30220 <colspec colwidth="8*" align="left"/>
30221 <colspec colwidth="6*" align="center"/>
30222 <colspec colwidth="6*" align="center"/>
30223 <colspec colwidth="6*" align="right"/>
30224 <tbody>
30225 <row>
30226 <entry><option>smtp_etrn_command</option></entry>
30227 <entry>Use: <emphasis>main</emphasis></entry>
30228 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30229 <entry>Default: <emphasis>unset</emphasis></entry>
30230 </row>
30231 </tbody>
30232 </tgroup>
30233 </informaltable>
30234 <para>
30235 <indexterm role="concept">
30236 <primary>ETRN</primary>
30237 <secondary>command to be run</secondary>
30238 </indexterm>
30239 <indexterm role="variable">
30240 <primary><varname>$domain</varname></primary>
30241 </indexterm>
30242 If this option is set, the given command is run whenever an SMTP ETRN
30243 command is received from a host that is permitted to issue such commands (see
30244 chapter <xref linkend="CHAPACL"/>). The string is split up into separate arguments which
30245 are independently expanded. The expansion variable <varname>$domain</varname> is set to the
30246 argument of the ETRN command, and no syntax checking is done on it. For
30247 example:
30248 </para>
30249 <literallayout class="monospaced">
30250 smtp_etrn_command = /etc/etrn_command $domain \
30251                     $sender_host_address
30252 </literallayout>
30253 <para>
30254 A new process is created to run the command, but Exim does not wait for it to
30255 complete. Consequently, its status cannot be checked. If the command cannot be
30256 run, a line is written to the panic log, but the ETRN caller still receives
30257 a 250 success response. Exim is normally running under its own uid when
30258 receiving SMTP, so it is not possible for it to change the uid before running
30259 the command.
30260 </para>
30261 <para>
30262 <indexterm role="option">
30263 <primary><option>smtp_etrn_serialize</option></primary>
30264 </indexterm>
30265 </para>
30266 <informaltable frame="all">
30267 <tgroup cols="4" colsep="0" rowsep="0">
30268 <colspec colwidth="8*" align="left"/>
30269 <colspec colwidth="6*" align="center"/>
30270 <colspec colwidth="6*" align="center"/>
30271 <colspec colwidth="6*" align="right"/>
30272 <tbody>
30273 <row>
30274 <entry><option>smtp_etrn_serialize</option></entry>
30275 <entry>Use: <emphasis>main</emphasis></entry>
30276 <entry>Type: <emphasis>boolean</emphasis></entry>
30277 <entry>Default: <emphasis>true</emphasis></entry>
30278 </row>
30279 </tbody>
30280 </tgroup>
30281 </informaltable>
30282 <para>
30283 <indexterm role="concept">
30284 <primary>ETRN</primary>
30285 <secondary>serializing</secondary>
30286 </indexterm>
30287 When this option is set, it prevents the simultaneous execution of more than
30288 one identical command as a result of ETRN in an SMTP connection. See
30289 section <xref linkend="SECTETRN"/> for details.
30290 </para>
30291 <para>
30292 <indexterm role="option">
30293 <primary><option>smtp_load_reserve</option></primary>
30294 </indexterm>
30295 </para>
30296 <informaltable frame="all">
30297 <tgroup cols="4" colsep="0" rowsep="0">
30298 <colspec colwidth="8*" align="left"/>
30299 <colspec colwidth="6*" align="center"/>
30300 <colspec colwidth="6*" align="center"/>
30301 <colspec colwidth="6*" align="right"/>
30302 <tbody>
30303 <row>
30304 <entry><option>smtp_load_reserve</option></entry>
30305 <entry>Use: <emphasis>main</emphasis></entry>
30306 <entry>Type: <emphasis>fixed-point</emphasis></entry>
30307 <entry>Default: <emphasis>unset</emphasis></entry>
30308 </row>
30309 </tbody>
30310 </tgroup>
30311 </informaltable>
30312 <para>
30313 <indexterm role="concept">
30314 <primary>load average</primary>
30315 </indexterm>
30316 If the system load average ever gets higher than this, incoming SMTP calls are
30317 accepted only from those hosts that match an entry in <option>smtp_reserve_hosts</option>.
30318 If <option>smtp_reserve_hosts</option> is not set, no incoming SMTP calls are accepted when
30319 the load is over the limit. The option has no effect on ancient operating
30320 systems on which Exim cannot determine the load average. See also
30321 <option>deliver_queue_load_max</option> and <option>queue_only_load</option>.
30322 </para>
30323 <para>
30324 <indexterm role="option">
30325 <primary><option>smtp_max_synprot_errors</option></primary>
30326 </indexterm>
30327 </para>
30328 <informaltable frame="all">
30329 <tgroup cols="4" colsep="0" rowsep="0">
30330 <colspec colwidth="8*" align="left"/>
30331 <colspec colwidth="6*" align="center"/>
30332 <colspec colwidth="6*" align="center"/>
30333 <colspec colwidth="6*" align="right"/>
30334 <tbody>
30335 <row>
30336 <entry><option>smtp_max_synprot_errors</option></entry>
30337 <entry>Use: <emphasis>main</emphasis></entry>
30338 <entry>Type: <emphasis>integer</emphasis></entry>
30339 <entry>Default: <emphasis>3</emphasis></entry>
30340 </row>
30341 </tbody>
30342 </tgroup>
30343 </informaltable>
30344 <para>
30345 <indexterm role="concept">
30346 <primary>SMTP</primary>
30347 <secondary>limiting syntax and protocol errors</secondary>
30348 </indexterm>
30349 <indexterm role="concept">
30350 <primary>limit</primary>
30351 <secondary>SMTP syntax and protocol errors</secondary>
30352 </indexterm>
30353 Exim rejects SMTP commands that contain syntax or protocol errors. In
30354 particular, a syntactically invalid email address, as in this command:
30355 </para>
30356 <literallayout class="monospaced">
30357 RCPT TO:&lt;abc xyz@a.b.c&gt;
30358 </literallayout>
30359 <para>
30360 causes immediate rejection of the command, before any other tests are done.
30361 (The ACL cannot be run if there is no valid address to set up for it.) An
30362 example of a protocol error is receiving RCPT before MAIL. If there are
30363 too many syntax or protocol errors in one SMTP session, the connection is
30364 dropped. The limit is set by this option.
30365 </para>
30366 <para>
30367 <indexterm role="concept">
30368 <primary>PIPELINING</primary>
30369 <secondary>expected errors</secondary>
30370 </indexterm>
30371 When the PIPELINING extension to SMTP is in use, some protocol errors are
30372 <quote>expected</quote>, for instance, a RCPT command after a rejected MAIL command.
30373 Exim assumes that PIPELINING will be used if it advertises it (see
30374 <option>pipelining_advertise_hosts</option>), and in this situation, <quote>expected</quote> errors do
30375 not count towards the limit.
30376 </para>
30377 <para>
30378 <indexterm role="option">
30379 <primary><option>smtp_max_unknown_commands</option></primary>
30380 </indexterm>
30381 </para>
30382 <informaltable frame="all">
30383 <tgroup cols="4" colsep="0" rowsep="0">
30384 <colspec colwidth="8*" align="left"/>
30385 <colspec colwidth="6*" align="center"/>
30386 <colspec colwidth="6*" align="center"/>
30387 <colspec colwidth="6*" align="right"/>
30388 <tbody>
30389 <row>
30390 <entry><option>smtp_max_unknown_commands</option></entry>
30391 <entry>Use: <emphasis>main</emphasis></entry>
30392 <entry>Type: <emphasis>integer</emphasis></entry>
30393 <entry>Default: <emphasis>3</emphasis></entry>
30394 </row>
30395 </tbody>
30396 </tgroup>
30397 </informaltable>
30398 <para>
30399 <indexterm role="concept">
30400 <primary>SMTP</primary>
30401 <secondary>limiting unknown commands</secondary>
30402 </indexterm>
30403 <indexterm role="concept">
30404 <primary>limit</primary>
30405 <secondary>unknown SMTP commands</secondary>
30406 </indexterm>
30407 If there are too many unrecognized commands in an incoming SMTP session, an
30408 Exim server drops the connection. This is a defence against some kinds of abuse
30409 that subvert web
30410 clients
30411 into making connections to SMTP ports; in these circumstances, a number of
30412 non-SMTP command lines are sent first.
30413 </para>
30414 <para>
30415 <indexterm role="option">
30416 <primary><option>smtp_ratelimit_hosts</option></primary>
30417 </indexterm>
30418 </para>
30419 <informaltable frame="all">
30420 <tgroup cols="4" colsep="0" rowsep="0">
30421 <colspec colwidth="8*" align="left"/>
30422 <colspec colwidth="6*" align="center"/>
30423 <colspec colwidth="6*" align="center"/>
30424 <colspec colwidth="6*" align="right"/>
30425 <tbody>
30426 <row>
30427 <entry><option>smtp_ratelimit_hosts</option></entry>
30428 <entry>Use: <emphasis>main</emphasis></entry>
30429 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
30430 <entry>Default: <emphasis>unset</emphasis></entry>
30431 </row>
30432 </tbody>
30433 </tgroup>
30434 </informaltable>
30435 <para>
30436 <indexterm role="concept">
30437 <primary>SMTP</primary>
30438 <secondary>rate limiting</secondary>
30439 </indexterm>
30440 <indexterm role="concept">
30441 <primary>limit</primary>
30442 <secondary>rate of message arrival</secondary>
30443 </indexterm>
30444 <indexterm role="concept">
30445 <primary>RCPT</primary>
30446 <secondary>rate limiting</secondary>
30447 </indexterm>
30448 Some sites find it helpful to be able to limit the rate at which certain hosts
30449 can send them messages, and the rate at which an individual message can specify
30450 recipients.
30451 </para>
30452 <para>
30453 Exim has two rate-limiting facilities. This section describes the older
30454 facility, which can limit rates within a single connection. The newer
30455 <option>ratelimit</option> ACL condition can limit rates across all connections. See section
30456 <xref linkend="SECTratelimiting"/> for details of the newer facility.
30457 </para>
30458 <para>
30459 When a host matches <option>smtp_ratelimit_hosts</option>, the values of
30460 <option>smtp_ratelimit_mail</option> and <option>smtp_ratelimit_rcpt</option> are used to control the
30461 rate of acceptance of MAIL and RCPT commands in a single SMTP session,
30462 respectively. Each option, if set, must contain a set of four comma-separated
30463 values:
30464 </para>
30465 <itemizedlist>
30466 <listitem>
30467 <para>
30468 A threshold, before which there is no rate limiting.
30469 </para>
30470 </listitem>
30471 <listitem>
30472 <para>
30473 An initial time delay. Unlike other times in Exim, numbers with decimal
30474 fractional parts are allowed here.
30475 </para>
30476 </listitem>
30477 <listitem>
30478 <para>
30479 A factor by which to increase the delay each time.
30480 </para>
30481 </listitem>
30482 <listitem>
30483 <para>
30484 A maximum value for the delay. This should normally be less than 5 minutes,
30485 because after that time, the client is liable to timeout the SMTP command.
30486 </para>
30487 </listitem>
30488 </itemizedlist>
30489 <para>
30490 For example, these settings have been used successfully at the site which
30491 first suggested this feature, for controlling mail from their customers:
30492 </para>
30493 <literallayout class="monospaced">
30494 smtp_ratelimit_mail = 2,0.5s,1.05,4m
30495 smtp_ratelimit_rcpt = 4,0.25s,1.015,4m
30496 </literallayout>
30497 <para>
30498 The first setting specifies delays that are applied to MAIL commands after
30499 two have been received over a single connection. The initial delay is 0.5
30500 seconds, increasing by a factor of 1.05 each time. The second setting applies
30501 delays to RCPT commands when more than four occur in a single message.
30502 </para>
30503 <para>
30504 <indexterm role="option">
30505 <primary><option>smtp_ratelimit_mail</option></primary>
30506 </indexterm>
30507 </para>
30508 <informaltable frame="all">
30509 <tgroup cols="4" colsep="0" rowsep="0">
30510 <colspec colwidth="8*" align="left"/>
30511 <colspec colwidth="6*" align="center"/>
30512 <colspec colwidth="6*" align="center"/>
30513 <colspec colwidth="6*" align="right"/>
30514 <tbody>
30515 <row>
30516 <entry><option>smtp_ratelimit_mail</option></entry>
30517 <entry>Use: <emphasis>main</emphasis></entry>
30518 <entry>Type: <emphasis>string</emphasis></entry>
30519 <entry>Default: <emphasis>unset</emphasis></entry>
30520 </row>
30521 </tbody>
30522 </tgroup>
30523 </informaltable>
30524 <para>
30525 See <option>smtp_ratelimit_hosts</option> above.
30526 </para>
30527 <para>
30528 <indexterm role="option">
30529 <primary><option>smtp_ratelimit_rcpt</option></primary>
30530 </indexterm>
30531 </para>
30532 <informaltable frame="all">
30533 <tgroup cols="4" colsep="0" rowsep="0">
30534 <colspec colwidth="8*" align="left"/>
30535 <colspec colwidth="6*" align="center"/>
30536 <colspec colwidth="6*" align="center"/>
30537 <colspec colwidth="6*" align="right"/>
30538 <tbody>
30539 <row>
30540 <entry><option>smtp_ratelimit_rcpt</option></entry>
30541 <entry>Use: <emphasis>main</emphasis></entry>
30542 <entry>Type: <emphasis>string</emphasis></entry>
30543 <entry>Default: <emphasis>unset</emphasis></entry>
30544 </row>
30545 </tbody>
30546 </tgroup>
30547 </informaltable>
30548 <para>
30549 See <option>smtp_ratelimit_hosts</option> above.
30550 </para>
30551 <para>
30552 <indexterm role="option">
30553 <primary><option>smtp_receive_timeout</option></primary>
30554 </indexterm>
30555 </para>
30556 <informaltable frame="all">
30557 <tgroup cols="4" colsep="0" rowsep="0">
30558 <colspec colwidth="8*" align="left"/>
30559 <colspec colwidth="6*" align="center"/>
30560 <colspec colwidth="6*" align="center"/>
30561 <colspec colwidth="6*" align="right"/>
30562 <tbody>
30563 <row>
30564 <entry><option>smtp_receive_timeout</option></entry>
30565 <entry>Use: <emphasis>main</emphasis></entry>
30566 <entry>Type: <emphasis>time</emphasis>&dagger;<emphasis></emphasis></entry>
30567 <entry>Default: <emphasis>5m</emphasis></entry>
30568 </row>
30569 </tbody>
30570 </tgroup>
30571 </informaltable>
30572 <para>
30573 <indexterm role="concept">
30574 <primary>timeout</primary>
30575 <secondary>for SMTP input</secondary>
30576 </indexterm>
30577 <indexterm role="concept">
30578 <primary>SMTP</primary>
30579 <secondary>input timeout</secondary>
30580 </indexterm>
30581 This sets a timeout value for SMTP reception. It applies to all forms of SMTP
30582 input, including batch SMTP. If a line of input (either an SMTP command or a
30583 data line) is not received within this time, the SMTP connection is dropped and
30584 the message is abandoned.
30585 A line is written to the log containing one of the following messages:
30586 </para>
30587 <literallayout class="monospaced">
30588 SMTP command timeout on connection from...
30589 SMTP data timeout on connection from...
30590 </literallayout>
30591 <para>
30592 The former means that Exim was expecting to read an SMTP command; the latter
30593 means that it was in the DATA phase, reading the contents of a message.
30594 </para>
30595 <para>
30596 If the first character of the option is a <quote>$</quote> the option is
30597 expanded before use and may depend on
30598 <varname>$sender_host_name</varname>, <varname>$sender_host_address</varname> and <varname>$sender_host_port</varname>.
30599 </para>
30600 <para>
30601 <indexterm role="option">
30602 <primary><option>-os</option></primary>
30603 </indexterm>
30604 The value set by this option can be overridden by the
30605 <option>-os</option> command-line option. A setting of zero time disables the timeout, but
30606 this should never be used for SMTP over TCP/IP. (It can be useful in some cases
30607 of local input using <option>-bs</option> or <option>-bS</option>.) For non-SMTP input, the reception
30608 timeout is controlled by <option>receive_timeout</option> and <option>-or</option>.
30609 </para>
30610 <para>
30611 <indexterm role="option">
30612 <primary><option>smtp_reserve_hosts</option></primary>
30613 </indexterm>
30614 </para>
30615 <informaltable frame="all">
30616 <tgroup cols="4" colsep="0" rowsep="0">
30617 <colspec colwidth="8*" align="left"/>
30618 <colspec colwidth="6*" align="center"/>
30619 <colspec colwidth="6*" align="center"/>
30620 <colspec colwidth="6*" align="right"/>
30621 <tbody>
30622 <row>
30623 <entry><option>smtp_reserve_hosts</option></entry>
30624 <entry>Use: <emphasis>main</emphasis></entry>
30625 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
30626 <entry>Default: <emphasis>unset</emphasis></entry>
30627 </row>
30628 </tbody>
30629 </tgroup>
30630 </informaltable>
30631 <para>
30632 This option defines hosts for which SMTP connections are reserved; see
30633 <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option> above.
30634 </para>
30635 <para>
30636 <indexterm role="option">
30637 <primary><option>smtp_return_error_details</option></primary>
30638 </indexterm>
30639 </para>
30640 <informaltable frame="all">
30641 <tgroup cols="4" colsep="0" rowsep="0">
30642 <colspec colwidth="8*" align="left"/>
30643 <colspec colwidth="6*" align="center"/>
30644 <colspec colwidth="6*" align="center"/>
30645 <colspec colwidth="6*" align="right"/>
30646 <tbody>
30647 <row>
30648 <entry><option>smtp_return_error_details</option></entry>
30649 <entry>Use: <emphasis>main</emphasis></entry>
30650 <entry>Type: <emphasis>boolean</emphasis></entry>
30651 <entry>Default: <emphasis>false</emphasis></entry>
30652 </row>
30653 </tbody>
30654 </tgroup>
30655 </informaltable>
30656 <para>
30657 <indexterm role="concept">
30658 <primary>SMTP</primary>
30659 <secondary>details policy failures</secondary>
30660 </indexterm>
30661 <indexterm role="concept">
30662 <primary>policy control</primary>
30663 <secondary>rejection, returning details</secondary>
30664 </indexterm>
30665 In the default state, Exim uses bland messages such as
30666 <quote>Administrative prohibition</quote> when it rejects SMTP commands for policy
30667 reasons. Many sysadmins like this because it gives away little information
30668 to spammers. However, some other sysadmins who are applying strict checking
30669 policies want to give out much fuller information about failures. Setting
30670 <option>smtp_return_error_details</option> true causes Exim to be more forthcoming. For
30671 example, instead of <quote>Administrative prohibition</quote>, it might give:
30672 </para>
30673 <literallayout class="monospaced">
30674 550-Rejected after DATA: '&gt;' missing at end of address:
30675 550 failing address in "From" header is: &lt;user@dom.ain
30676 </literallayout>
30677 <para>
30678 <indexterm role="option">
30679 <primary><option>smtputf8_advertise_hosts</option></primary>
30680 </indexterm>
30681 </para>
30682 <informaltable frame="all">
30683 <tgroup cols="4" colsep="0" rowsep="0">
30684 <colspec colwidth="8*" align="left"/>
30685 <colspec colwidth="6*" align="center"/>
30686 <colspec colwidth="6*" align="center"/>
30687 <colspec colwidth="6*" align="right"/>
30688 <tbody>
30689 <row>
30690 <entry><option>smtputf8_advertise_hosts</option></entry>
30691 <entry>Use: <emphasis>main</emphasis></entry>
30692 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
30693 <entry>Default: <emphasis>*</emphasis></entry>
30694 </row>
30695 </tbody>
30696 </tgroup>
30697 </informaltable>
30698 <para>
30699 <indexterm role="concept">
30700 <primary>SMTPUTF8</primary>
30701 <secondary>advertising</secondary>
30702 </indexterm>
30703 When Exim is built with support for internationalised mail names,
30704 the availability thereof is advertised in
30705 response to EHLO only to those client hosts that match this option. See
30706 chapter <xref linkend="CHAPi18n"/> for details of Exim&#x2019;s support for internationalisation.
30707 </para>
30708 <para>
30709 <indexterm role="option">
30710 <primary><option>spamd_address</option></primary>
30711 </indexterm>
30712 </para>
30713 <informaltable frame="all">
30714 <tgroup cols="4" colsep="0" rowsep="0">
30715 <colspec colwidth="8*" align="left"/>
30716 <colspec colwidth="6*" align="center"/>
30717 <colspec colwidth="6*" align="center"/>
30718 <colspec colwidth="6*" align="right"/>
30719 <tbody>
30720 <row>
30721 <entry><option>spamd_address</option></entry>
30722 <entry>Use: <emphasis>main</emphasis></entry>
30723 <entry>Type: <emphasis>string</emphasis></entry>
30724 <entry>Default: <emphasis>see below</emphasis></entry>
30725 </row>
30726 </tbody>
30727 </tgroup>
30728 </informaltable>
30729 <para>
30730 This option is available when Exim is compiled with the content-scanning
30731 extension. It specifies how Exim connects to SpamAssassin&#x2019;s <option>spamd</option> daemon.
30732 The default value is
30733 </para>
30734 <literallayout class="monospaced">
30735 127.0.0.1 783
30736 </literallayout>
30737 <para>
30738 See section <xref linkend="SECTscanspamass"/> for more details.
30739 </para>
30740 <para>
30741 <indexterm role="option">
30742 <primary><option>split_spool_directory</option></primary>
30743 </indexterm>
30744 </para>
30745 <informaltable frame="all">
30746 <tgroup cols="4" colsep="0" rowsep="0">
30747 <colspec colwidth="8*" align="left"/>
30748 <colspec colwidth="6*" align="center"/>
30749 <colspec colwidth="6*" align="center"/>
30750 <colspec colwidth="6*" align="right"/>
30751 <tbody>
30752 <row>
30753 <entry><option>split_spool_directory</option></entry>
30754 <entry>Use: <emphasis>main</emphasis></entry>
30755 <entry>Type: <emphasis>boolean</emphasis></entry>
30756 <entry>Default: <emphasis>false</emphasis></entry>
30757 </row>
30758 </tbody>
30759 </tgroup>
30760 </informaltable>
30761 <para>
30762 <indexterm role="concept">
30763 <primary>multiple spool directories</primary>
30764 </indexterm>
30765 <indexterm role="concept">
30766 <primary>spool directory</primary>
30767 <secondary>split</secondary>
30768 </indexterm>
30769 <indexterm role="concept">
30770 <primary>directories, multiple</primary>
30771 </indexterm>
30772 If this option is set, it causes Exim to split its input directory into 62
30773 subdirectories, each with a single alphanumeric character as its name. The
30774 sixth character of the message id is used to allocate messages to
30775 subdirectories; this is the least significant base-62 digit of the time of
30776 arrival of the message.
30777 </para>
30778 <para>
30779 Splitting up the spool in this way may provide better performance on systems
30780 where there are long mail queues, by reducing the number of files in any one
30781 directory. The msglog directory is also split up in a similar way to the input
30782 directory; however, if <option>preserve_message_logs</option> is set, all old msglog files
30783 are still placed in the single directory <filename>msglog.OLD</filename>.
30784 </para>
30785 <para>
30786 It is not necessary to take any special action for existing messages when
30787 changing <option>split_spool_directory</option>. Exim notices messages that are in the
30788 <quote>wrong</quote> place, and continues to process them. If the option is turned off
30789 after a period of being on, the subdirectories will eventually empty and be
30790 automatically deleted.
30791 </para>
30792 <para>
30793 When <option>split_spool_directory</option> is set, the behaviour of queue runner processes
30794 changes. Instead of creating a list of all messages in the queue, and then
30795 trying to deliver each one in turn, it constructs a list of those in one
30796 sub-directory and tries to deliver them, before moving on to the next
30797 sub-directory. The sub-directories are processed in a random order. This
30798 spreads out the scanning of the input directories, and uses less memory. It is
30799 particularly beneficial when there are lots of messages on the queue. However,
30800 if <option>queue_run_in_order</option> is set, none of this new processing happens. The
30801 entire queue has to be scanned and sorted before any deliveries can start.
30802 </para>
30803 <para>
30804 <indexterm role="option">
30805 <primary><option>spool_directory</option></primary>
30806 </indexterm>
30807 </para>
30808 <informaltable frame="all">
30809 <tgroup cols="4" colsep="0" rowsep="0">
30810 <colspec colwidth="8*" align="left"/>
30811 <colspec colwidth="6*" align="center"/>
30812 <colspec colwidth="6*" align="center"/>
30813 <colspec colwidth="6*" align="right"/>
30814 <tbody>
30815 <row>
30816 <entry><option>spool_directory</option></entry>
30817 <entry>Use: <emphasis>main</emphasis></entry>
30818 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30819 <entry>Default: <emphasis>set at compile time</emphasis></entry>
30820 </row>
30821 </tbody>
30822 </tgroup>
30823 </informaltable>
30824 <para>
30825 <indexterm role="concept">
30826 <primary>spool directory</primary>
30827 <secondary>path to</secondary>
30828 </indexterm>
30829 This defines the directory in which Exim keeps its spool, that is, the messages
30830 it is waiting to deliver. The default value is taken from the compile-time
30831 configuration setting, if there is one. If not, this option must be set. The
30832 string is expanded, so it can contain, for example, a reference to
30833 <varname>$primary_hostname</varname>.
30834 </para>
30835 <para>
30836 If the spool directory name is fixed on your installation, it is recommended
30837 that you set it at build time rather than from this option, particularly if the
30838 log files are being written to the spool directory (see <option>log_file_path</option>).
30839 Otherwise log files cannot be used for errors that are detected early on, such
30840 as failures in the configuration file.
30841 </para>
30842 <para>
30843 By using this option to override the compiled-in path, it is possible to run
30844 tests of Exim without using the standard spool.
30845 </para>
30846 <para revisionflag="changed">
30847 <indexterm role="option">
30848 <primary><option>spool_wireformat</option></primary>
30849 </indexterm>
30850 </para>
30851 <informaltable frame="all" revisionflag="changed">
30852 <tgroup cols="4" colsep="0" rowsep="0">
30853 <colspec colwidth="8*" align="left"/>
30854 <colspec colwidth="6*" align="center"/>
30855 <colspec colwidth="6*" align="center"/>
30856 <colspec colwidth="6*" align="right"/>
30857 <tbody>
30858 <row>
30859 <entry><option>spool_wireformat</option></entry>
30860 <entry>Use: <emphasis>main</emphasis></entry>
30861 <entry>Type: <emphasis>boolean</emphasis></entry>
30862 <entry>Default: <emphasis>false</emphasis></entry>
30863 </row>
30864 </tbody>
30865 </tgroup>
30866 </informaltable>
30867 <para revisionflag="changed">
30868 <indexterm role="concept">
30869 <primary>spool directory</primary>
30870 <secondary>file formats</secondary>
30871 </indexterm>
30872 If this option is set, Exim may for some messages use an alternate format
30873 for data-files in the spool which matches the wire format.
30874 Doing this permits more efficient message reception and transmission.
30875 Currently it is only done for messages received using the EMSTP CHUNKING
30876 option.
30877 </para>
30878 <para revisionflag="changed">
30879 The following variables will not have useful values:
30880 </para>
30881 <literallayout class="monospaced" revisionflag="changed">
30882 $max_received_linelength
30883 $body_linecount
30884 $body_zerocount
30885 </literallayout>
30886 <para revisionflag="changed">
30887 Users of the local_scan() API (see <xref linkend="CHAPlocalscan"/>),
30888 and any external programs which are passed a reference to a message data file
30889 (except via the <quote>regex</quote>, <quote>malware</quote> or <quote>spam</quote>) ACL conditions)
30890 will need to be aware of the potential different format.
30891 </para>
30892 <para revisionflag="changed">
30893 Using any of the ACL conditions noted will negate the reception benefit
30894 (as a Unix-mbox-format file is contructed for them).
30895 The transimssion benefit is maintained.
30896 </para>
30897 <para>
30898 <indexterm role="option">
30899 <primary><option>sqlite_lock_timeout</option></primary>
30900 </indexterm>
30901 </para>
30902 <informaltable frame="all">
30903 <tgroup cols="4" colsep="0" rowsep="0">
30904 <colspec colwidth="8*" align="left"/>
30905 <colspec colwidth="6*" align="center"/>
30906 <colspec colwidth="6*" align="center"/>
30907 <colspec colwidth="6*" align="right"/>
30908 <tbody>
30909 <row>
30910 <entry><option>sqlite_lock_timeout</option></entry>
30911 <entry>Use: <emphasis>main</emphasis></entry>
30912 <entry>Type: <emphasis>time</emphasis></entry>
30913 <entry>Default: <emphasis>5s</emphasis></entry>
30914 </row>
30915 </tbody>
30916 </tgroup>
30917 </informaltable>
30918 <para>
30919 <indexterm role="concept">
30920 <primary>sqlite lookup type</primary>
30921 <secondary>lock timeout</secondary>
30922 </indexterm>
30923 This option controls the timeout that the <command>sqlite</command> lookup uses when trying to
30924 access an SQLite database. See section <xref linkend="SECTsqlite"/> for more details.
30925 </para>
30926 <para>
30927 <indexterm role="option">
30928 <primary><option>strict_acl_vars</option></primary>
30929 </indexterm>
30930 </para>
30931 <informaltable frame="all">
30932 <tgroup cols="4" colsep="0" rowsep="0">
30933 <colspec colwidth="8*" align="left"/>
30934 <colspec colwidth="6*" align="center"/>
30935 <colspec colwidth="6*" align="center"/>
30936 <colspec colwidth="6*" align="right"/>
30937 <tbody>
30938 <row>
30939 <entry><option>strict_acl_vars</option></entry>
30940 <entry>Use: <emphasis>main</emphasis></entry>
30941 <entry>Type: <emphasis>boolean</emphasis></entry>
30942 <entry>Default: <emphasis>false</emphasis></entry>
30943 </row>
30944 </tbody>
30945 </tgroup>
30946 </informaltable>
30947 <para>
30948 <indexterm role="concept">
30949 <primary>access control lists (ACLs)</primary>
30950 <secondary>variables, handling unset</secondary>
30951 </indexterm>
30952 This option controls what happens if a syntactically valid but undefined ACL
30953 variable is referenced. If it is false (the default), an empty string
30954 is substituted; if it is true, an error is generated. See section
30955 <xref linkend="SECTaclvariables"/> for details of ACL variables.
30956 </para>
30957 <para>
30958 <indexterm role="option">
30959 <primary><option>strip_excess_angle_brackets</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>strip_excess_angle_brackets</option></entry>
30971 <entry>Use: <emphasis>main</emphasis></entry>
30972 <entry>Type: <emphasis>boolean</emphasis></entry>
30973 <entry>Default: <emphasis>false</emphasis></entry>
30974 </row>
30975 </tbody>
30976 </tgroup>
30977 </informaltable>
30978 <para>
30979 <indexterm role="concept">
30980 <primary>angle brackets, excess</primary>
30981 </indexterm>
30982 If this option is set, redundant pairs of angle brackets round <quote>route-addr</quote>
30983 items in addresses are stripped. For example, <emphasis>&lt;&lt;xxx@a.b.c.d&gt;&gt;</emphasis> is
30984 treated as <emphasis>&lt;xxx@a.b.c.d&gt;</emphasis>. If this is in the envelope and the message is
30985 passed on to another MTA, the excess angle brackets are not passed on. If this
30986 option is not set, multiple pairs of angle brackets cause a syntax error.
30987 </para>
30988 <para>
30989 <indexterm role="option">
30990 <primary><option>strip_trailing_dot</option></primary>
30991 </indexterm>
30992 </para>
30993 <informaltable frame="all">
30994 <tgroup cols="4" colsep="0" rowsep="0">
30995 <colspec colwidth="8*" align="left"/>
30996 <colspec colwidth="6*" align="center"/>
30997 <colspec colwidth="6*" align="center"/>
30998 <colspec colwidth="6*" align="right"/>
30999 <tbody>
31000 <row>
31001 <entry><option>strip_trailing_dot</option></entry>
31002 <entry>Use: <emphasis>main</emphasis></entry>
31003 <entry>Type: <emphasis>boolean</emphasis></entry>
31004 <entry>Default: <emphasis>false</emphasis></entry>
31005 </row>
31006 </tbody>
31007 </tgroup>
31008 </informaltable>
31009 <para>
31010 <indexterm role="concept">
31011 <primary>trailing dot on domain</primary>
31012 </indexterm>
31013 <indexterm role="concept">
31014 <primary>dot</primary>
31015 <secondary>trailing on domain</secondary>
31016 </indexterm>
31017 If this option is set, a trailing dot at the end of a domain in an address is
31018 ignored. If this is in the envelope and the message is passed on to another
31019 MTA, the dot is not passed on. If this option is not set, a dot at the end of a
31020 domain causes a syntax error.
31021 However, addresses in header lines are checked only when an ACL requests header
31022 syntax checking.
31023 </para>
31024 <para>
31025 <indexterm role="option">
31026 <primary><option>syslog_duplication</option></primary>
31027 </indexterm>
31028 </para>
31029 <informaltable frame="all">
31030 <tgroup cols="4" colsep="0" rowsep="0">
31031 <colspec colwidth="8*" align="left"/>
31032 <colspec colwidth="6*" align="center"/>
31033 <colspec colwidth="6*" align="center"/>
31034 <colspec colwidth="6*" align="right"/>
31035 <tbody>
31036 <row>
31037 <entry><option>syslog_duplication</option></entry>
31038 <entry>Use: <emphasis>main</emphasis></entry>
31039 <entry>Type: <emphasis>boolean</emphasis></entry>
31040 <entry>Default: <emphasis>true</emphasis></entry>
31041 </row>
31042 </tbody>
31043 </tgroup>
31044 </informaltable>
31045 <para>
31046 <indexterm role="concept">
31047 <primary>syslog</primary>
31048 <secondary>duplicate log lines; suppressing</secondary>
31049 </indexterm>
31050 When Exim is logging to syslog, it writes the log lines for its three
31051 separate logs at different syslog priorities so that they can in principle
31052 be separated on the logging hosts. Some installations do not require this
31053 separation, and in those cases, the duplication of certain log lines is a
31054 nuisance. If <option>syslog_duplication</option> is set false, only one copy of any
31055 particular log line is written to syslog. For lines that normally go to
31056 both the main log and the reject log, the reject log version (possibly
31057 containing message header lines) is written, at LOG_NOTICE priority.
31058 Lines that normally go to both the main and the panic log are written at
31059 the LOG_ALERT priority.
31060 </para>
31061 <para>
31062 <indexterm role="option">
31063 <primary><option>syslog_facility</option></primary>
31064 </indexterm>
31065 </para>
31066 <informaltable frame="all">
31067 <tgroup cols="4" colsep="0" rowsep="0">
31068 <colspec colwidth="8*" align="left"/>
31069 <colspec colwidth="6*" align="center"/>
31070 <colspec colwidth="6*" align="center"/>
31071 <colspec colwidth="6*" align="right"/>
31072 <tbody>
31073 <row>
31074 <entry><option>syslog_facility</option></entry>
31075 <entry>Use: <emphasis>main</emphasis></entry>
31076 <entry>Type: <emphasis>string</emphasis></entry>
31077 <entry>Default: <emphasis>unset</emphasis></entry>
31078 </row>
31079 </tbody>
31080 </tgroup>
31081 </informaltable>
31082 <para>
31083 <indexterm role="concept">
31084 <primary>syslog</primary>
31085 <secondary>facility; setting</secondary>
31086 </indexterm>
31087 This option sets the syslog <quote>facility</quote> name, used when Exim is logging to
31088 syslog. The value must be one of the strings <quote>mail</quote>, <quote>user</quote>, <quote>news</quote>,
31089 <quote>uucp</quote>, <quote>daemon</quote>, or <quote>local<emphasis>x</emphasis></quote> where <emphasis>x</emphasis> is a digit between 0 and 7.
31090 If this option is unset, <quote>mail</quote> is used. See chapter <xref linkend="CHAPlog"/> for
31091 details of Exim&#x2019;s logging.
31092 </para>
31093 <para>
31094 <indexterm role="option">
31095 <primary><option>syslog_pid</option></primary>
31096 </indexterm>
31097 </para>
31098 <informaltable frame="all">
31099 <tgroup cols="4" colsep="0" rowsep="0">
31100 <colspec colwidth="8*" align="left"/>
31101 <colspec colwidth="6*" align="center"/>
31102 <colspec colwidth="6*" align="center"/>
31103 <colspec colwidth="6*" align="right"/>
31104 <tbody>
31105 <row>
31106 <entry><option>syslog_pid</option></entry>
31107 <entry>Use: <emphasis>main</emphasis></entry>
31108 <entry>Type: <emphasis>boolean</emphasis></entry>
31109 <entry>Default: <emphasis>true</emphasis></entry>
31110 </row>
31111 </tbody>
31112 </tgroup>
31113 </informaltable>
31114 <para>
31115 <indexterm role="concept">
31116 <primary>syslog</primary>
31117 <secondary>pid</secondary>
31118 </indexterm>
31119 If <option>syslog_pid</option> is set false, the PID on Exim&#x2019;s log lines are
31120 omitted when these lines are sent to syslog. (Syslog normally prefixes
31121 the log lines with the PID of the logging process automatically.) You need
31122 to enable the <literal>+pid</literal> log selector item, if you want Exim to write it&#x2019;s PID
31123 into the logs.) See chapter <xref linkend="CHAPlog"/> for details of Exim&#x2019;s logging.
31124 </para>
31125 <para>
31126 <indexterm role="option">
31127 <primary><option>syslog_processname</option></primary>
31128 </indexterm>
31129 </para>
31130 <informaltable frame="all">
31131 <tgroup cols="4" colsep="0" rowsep="0">
31132 <colspec colwidth="8*" align="left"/>
31133 <colspec colwidth="6*" align="center"/>
31134 <colspec colwidth="6*" align="center"/>
31135 <colspec colwidth="6*" align="right"/>
31136 <tbody>
31137 <row>
31138 <entry><option>syslog_processname</option></entry>
31139 <entry>Use: <emphasis>main</emphasis></entry>
31140 <entry>Type: <emphasis>string</emphasis></entry>
31141 <entry>Default: <emphasis><literal>exim</literal></emphasis></entry>
31142 </row>
31143 </tbody>
31144 </tgroup>
31145 </informaltable>
31146 <para>
31147 <indexterm role="concept">
31148 <primary>syslog</primary>
31149 <secondary>process name; setting</secondary>
31150 </indexterm>
31151 This option sets the syslog <quote>ident</quote> name, used when Exim is logging to
31152 syslog. The value must be no longer than 32 characters. See chapter
31153 <xref linkend="CHAPlog"/> for details of Exim&#x2019;s logging.
31154 </para>
31155 <para>
31156 <indexterm role="option">
31157 <primary><option>syslog_timestamp</option></primary>
31158 </indexterm>
31159 </para>
31160 <informaltable frame="all">
31161 <tgroup cols="4" colsep="0" rowsep="0">
31162 <colspec colwidth="8*" align="left"/>
31163 <colspec colwidth="6*" align="center"/>
31164 <colspec colwidth="6*" align="center"/>
31165 <colspec colwidth="6*" align="right"/>
31166 <tbody>
31167 <row>
31168 <entry><option>syslog_timestamp</option></entry>
31169 <entry>Use: <emphasis>main</emphasis></entry>
31170 <entry>Type: <emphasis>boolean</emphasis></entry>
31171 <entry>Default: <emphasis>true</emphasis></entry>
31172 </row>
31173 </tbody>
31174 </tgroup>
31175 </informaltable>
31176 <para>
31177 <indexterm role="concept">
31178 <primary>syslog</primary>
31179 <secondary>timestamps</secondary>
31180 </indexterm>
31181 If <option>syslog_timestamp</option> is set false, the timestamps on Exim&#x2019;s log lines are
31182 omitted when these lines are sent to syslog. See chapter <xref linkend="CHAPlog"/> for
31183 details of Exim&#x2019;s logging.
31184 </para>
31185 <para>
31186 <indexterm role="option">
31187 <primary><option>system_filter</option></primary>
31188 </indexterm>
31189 </para>
31190 <informaltable frame="all">
31191 <tgroup cols="4" colsep="0" rowsep="0">
31192 <colspec colwidth="8*" align="left"/>
31193 <colspec colwidth="6*" align="center"/>
31194 <colspec colwidth="6*" align="center"/>
31195 <colspec colwidth="6*" align="right"/>
31196 <tbody>
31197 <row>
31198 <entry><option>system_filter</option></entry>
31199 <entry>Use: <emphasis>main</emphasis></entry>
31200 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31201 <entry>Default: <emphasis>unset</emphasis></entry>
31202 </row>
31203 </tbody>
31204 </tgroup>
31205 </informaltable>
31206 <para>
31207 <indexterm role="concept">
31208 <primary>filter</primary>
31209 <secondary>system filter</secondary>
31210 </indexterm>
31211 <indexterm role="concept">
31212 <primary>system filter</primary>
31213 <secondary>specifying</secondary>
31214 </indexterm>
31215 <indexterm role="concept">
31216 <primary>Sieve filter</primary>
31217 <secondary>not available for system filter</secondary>
31218 </indexterm>
31219 This option specifies an Exim filter file that is applied to all messages at
31220 the start of each delivery attempt, before any routing is done. System filters
31221 must be Exim filters; they cannot be Sieve filters. If the system filter
31222 generates any deliveries to files or pipes, or any new mail messages, the
31223 appropriate <option>system_filter_..._transport</option> option(s) must be set, to define
31224 which transports are to be used. Details of this facility are given in chapter
31225 <xref linkend="CHAPsystemfilter"/>.
31226 A forced expansion failure results in no filter operation.
31227 </para>
31228 <para>
31229 <indexterm role="option">
31230 <primary><option>system_filter_directory_transport</option></primary>
31231 </indexterm>
31232 </para>
31233 <informaltable frame="all">
31234 <tgroup cols="4" colsep="0" rowsep="0">
31235 <colspec colwidth="8*" align="left"/>
31236 <colspec colwidth="6*" align="center"/>
31237 <colspec colwidth="6*" align="center"/>
31238 <colspec colwidth="6*" align="right"/>
31239 <tbody>
31240 <row>
31241 <entry><option>system_filter_directory_transport</option></entry>
31242 <entry>Use: <emphasis>main</emphasis></entry>
31243 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31244 <entry>Default: <emphasis>unset</emphasis></entry>
31245 </row>
31246 </tbody>
31247 </tgroup>
31248 </informaltable>
31249 <para>
31250 <indexterm role="variable">
31251 <primary><varname>$address_file</varname></primary>
31252 </indexterm>
31253 This sets the name of the transport driver that is to be used when the
31254 <option>save</option> command in a system message filter specifies a path ending in <quote>/</quote>,
31255 implying delivery of each message into a separate file in some directory.
31256 During the delivery, the variable <varname>$address_file</varname> contains the path name.
31257 </para>
31258 <para>
31259 <indexterm role="option">
31260 <primary><option>system_filter_file_transport</option></primary>
31261 </indexterm>
31262 </para>
31263 <informaltable frame="all">
31264 <tgroup cols="4" colsep="0" rowsep="0">
31265 <colspec colwidth="8*" align="left"/>
31266 <colspec colwidth="6*" align="center"/>
31267 <colspec colwidth="6*" align="center"/>
31268 <colspec colwidth="6*" align="right"/>
31269 <tbody>
31270 <row>
31271 <entry><option>system_filter_file_transport</option></entry>
31272 <entry>Use: <emphasis>main</emphasis></entry>
31273 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31274 <entry>Default: <emphasis>unset</emphasis></entry>
31275 </row>
31276 </tbody>
31277 </tgroup>
31278 </informaltable>
31279 <para>
31280 <indexterm role="concept">
31281 <primary>file</primary>
31282 <secondary>transport for system filter</secondary>
31283 </indexterm>
31284 This sets the name of the transport driver that is to be used when the <option>save</option>
31285 command in a system message filter specifies a path not ending in <quote>/</quote>. During
31286 the delivery, the variable <varname>$address_file</varname> contains the path name.
31287 </para>
31288 <para>
31289 <indexterm role="option">
31290 <primary><option>system_filter_group</option></primary>
31291 </indexterm>
31292 </para>
31293 <informaltable frame="all">
31294 <tgroup cols="4" colsep="0" rowsep="0">
31295 <colspec colwidth="8*" align="left"/>
31296 <colspec colwidth="6*" align="center"/>
31297 <colspec colwidth="6*" align="center"/>
31298 <colspec colwidth="6*" align="right"/>
31299 <tbody>
31300 <row>
31301 <entry><option>system_filter_group</option></entry>
31302 <entry>Use: <emphasis>main</emphasis></entry>
31303 <entry>Type: <emphasis>string</emphasis></entry>
31304 <entry>Default: <emphasis>unset</emphasis></entry>
31305 </row>
31306 </tbody>
31307 </tgroup>
31308 </informaltable>
31309 <para>
31310 <indexterm role="concept">
31311 <primary>gid (group id)</primary>
31312 <secondary>system filter</secondary>
31313 </indexterm>
31314 This option is used only when <option>system_filter_user</option> is also set. It sets the
31315 gid under which the system filter is run, overriding any gid that is associated
31316 with the user. The value may be numerical or symbolic.
31317 </para>
31318 <para>
31319 <indexterm role="option">
31320 <primary><option>system_filter_pipe_transport</option></primary>
31321 </indexterm>
31322 </para>
31323 <informaltable frame="all">
31324 <tgroup cols="4" colsep="0" rowsep="0">
31325 <colspec colwidth="8*" align="left"/>
31326 <colspec colwidth="6*" align="center"/>
31327 <colspec colwidth="6*" align="center"/>
31328 <colspec colwidth="6*" align="right"/>
31329 <tbody>
31330 <row>
31331 <entry><option>system_filter_pipe_transport</option></entry>
31332 <entry>Use: <emphasis>main</emphasis></entry>
31333 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31334 <entry>Default: <emphasis>unset</emphasis></entry>
31335 </row>
31336 </tbody>
31337 </tgroup>
31338 </informaltable>
31339 <para>
31340 <indexterm role="concept">
31341 <primary><command>pipe</command> transport</primary>
31342 <secondary>for system filter</secondary>
31343 </indexterm>
31344 <indexterm role="variable">
31345 <primary><varname>$address_pipe</varname></primary>
31346 </indexterm>
31347 This specifies the transport driver that is to be used when a <option>pipe</option> command
31348 is used in a system filter. During the delivery, the variable <varname>$address_pipe</varname>
31349 contains the pipe command.
31350 </para>
31351 <para>
31352 <indexterm role="option">
31353 <primary><option>system_filter_reply_transport</option></primary>
31354 </indexterm>
31355 </para>
31356 <informaltable frame="all">
31357 <tgroup cols="4" colsep="0" rowsep="0">
31358 <colspec colwidth="8*" align="left"/>
31359 <colspec colwidth="6*" align="center"/>
31360 <colspec colwidth="6*" align="center"/>
31361 <colspec colwidth="6*" align="right"/>
31362 <tbody>
31363 <row>
31364 <entry><option>system_filter_reply_transport</option></entry>
31365 <entry>Use: <emphasis>main</emphasis></entry>
31366 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31367 <entry>Default: <emphasis>unset</emphasis></entry>
31368 </row>
31369 </tbody>
31370 </tgroup>
31371 </informaltable>
31372 <para>
31373 <indexterm role="concept">
31374 <primary><command>autoreply</command> transport</primary>
31375 <secondary>for system filter</secondary>
31376 </indexterm>
31377 This specifies the transport driver that is to be used when a <option>mail</option> command
31378 is used in a system filter.
31379 </para>
31380 <para>
31381 <indexterm role="option">
31382 <primary><option>system_filter_user</option></primary>
31383 </indexterm>
31384 </para>
31385 <informaltable frame="all">
31386 <tgroup cols="4" colsep="0" rowsep="0">
31387 <colspec colwidth="8*" align="left"/>
31388 <colspec colwidth="6*" align="center"/>
31389 <colspec colwidth="6*" align="center"/>
31390 <colspec colwidth="6*" align="right"/>
31391 <tbody>
31392 <row>
31393 <entry><option>system_filter_user</option></entry>
31394 <entry>Use: <emphasis>main</emphasis></entry>
31395 <entry>Type: <emphasis>string</emphasis></entry>
31396 <entry>Default: <emphasis>unset</emphasis></entry>
31397 </row>
31398 </tbody>
31399 </tgroup>
31400 </informaltable>
31401 <para>
31402 <indexterm role="concept">
31403 <primary>uid (user id)</primary>
31404 <secondary>system filter</secondary>
31405 </indexterm>
31406 If this option is set to root, the system filter is run in the main Exim
31407 delivery process, as root.  Otherwise, the system filter runs in a separate
31408 process, as the given user, defaulting to the Exim run-time user.
31409 Unless the string consists entirely of digits, it
31410 is looked up in the password data. Failure to find the named user causes a
31411 configuration error. The gid is either taken from the password data, or
31412 specified by <option>system_filter_group</option>. When the uid is specified numerically,
31413 <option>system_filter_group</option> is required to be set.
31414 </para>
31415 <para>
31416 If the system filter generates any pipe, file, or reply deliveries, the uid
31417 under which the filter is run is used when transporting them, unless a
31418 transport option overrides.
31419 </para>
31420 <para>
31421 <indexterm role="option">
31422 <primary><option>tcp_nodelay</option></primary>
31423 </indexterm>
31424 </para>
31425 <informaltable frame="all">
31426 <tgroup cols="4" colsep="0" rowsep="0">
31427 <colspec colwidth="8*" align="left"/>
31428 <colspec colwidth="6*" align="center"/>
31429 <colspec colwidth="6*" align="center"/>
31430 <colspec colwidth="6*" align="right"/>
31431 <tbody>
31432 <row>
31433 <entry><option>tcp_nodelay</option></entry>
31434 <entry>Use: <emphasis>main</emphasis></entry>
31435 <entry>Type: <emphasis>boolean</emphasis></entry>
31436 <entry>Default: <emphasis>true</emphasis></entry>
31437 </row>
31438 </tbody>
31439 </tgroup>
31440 </informaltable>
31441 <para>
31442 <indexterm role="concept">
31443 <primary>daemon</primary>
31444 <secondary>TCP_NODELAY on sockets</secondary>
31445 </indexterm>
31446 <indexterm role="concept">
31447 <primary>Nagle algorithm</primary>
31448 </indexterm>
31449 <indexterm role="concept">
31450 <primary>TCP_NODELAY on listening sockets</primary>
31451 </indexterm>
31452 If this option is set false, it stops the Exim daemon setting the
31453 TCP_NODELAY option on its listening sockets. Setting TCP_NODELAY
31454 turns off the <quote>Nagle algorithm</quote>, which is a way of improving network
31455 performance in interactive (character-by-character) situations. Turning it off
31456 should improve Exim&#x2019;s performance a bit, so that is what happens by default.
31457 However, it appears that some broken clients cannot cope, and time out. Hence
31458 this option. It affects only those sockets that are set up for listening by the
31459 daemon. Sockets created by the smtp transport for delivering mail always set
31460 TCP_NODELAY.
31461 </para>
31462 <para>
31463 <indexterm role="option">
31464 <primary><option>timeout_frozen_after</option></primary>
31465 </indexterm>
31466 </para>
31467 <informaltable frame="all">
31468 <tgroup cols="4" colsep="0" rowsep="0">
31469 <colspec colwidth="8*" align="left"/>
31470 <colspec colwidth="6*" align="center"/>
31471 <colspec colwidth="6*" align="center"/>
31472 <colspec colwidth="6*" align="right"/>
31473 <tbody>
31474 <row>
31475 <entry><option>timeout_frozen_after</option></entry>
31476 <entry>Use: <emphasis>main</emphasis></entry>
31477 <entry>Type: <emphasis>time</emphasis></entry>
31478 <entry>Default: <emphasis>0s</emphasis></entry>
31479 </row>
31480 </tbody>
31481 </tgroup>
31482 </informaltable>
31483 <para>
31484 <indexterm role="concept">
31485 <primary>frozen messages</primary>
31486 <secondary>timing out</secondary>
31487 </indexterm>
31488 <indexterm role="concept">
31489 <primary>timeout</primary>
31490 <secondary>frozen messages</secondary>
31491 </indexterm>
31492 If <option>timeout_frozen_after</option> is set to a time greater than zero, a frozen
31493 message of any kind that has been on the queue for longer than the given time
31494 is automatically cancelled at the next queue run. If the frozen message is a
31495 bounce message, it is just discarded; otherwise, a bounce is sent to the
31496 sender, in a similar manner to cancellation by the <option>-Mg</option> command line option.
31497 If you want to timeout frozen bounce messages earlier than other kinds of
31498 frozen message, see <option>ignore_bounce_errors_after</option>.
31499 </para>
31500 <para>
31501 <emphasis role="bold">Note:</emphasis> the default value of zero means no timeouts; with this setting,
31502 frozen messages remain on the queue forever (except for any frozen bounce
31503 messages that are released by <option>ignore_bounce_errors_after</option>).
31504 </para>
31505 <para>
31506 <indexterm role="option">
31507 <primary><option>timezone</option></primary>
31508 </indexterm>
31509 </para>
31510 <informaltable frame="all">
31511 <tgroup cols="4" colsep="0" rowsep="0">
31512 <colspec colwidth="8*" align="left"/>
31513 <colspec colwidth="6*" align="center"/>
31514 <colspec colwidth="6*" align="center"/>
31515 <colspec colwidth="6*" align="right"/>
31516 <tbody>
31517 <row>
31518 <entry><option>timezone</option></entry>
31519 <entry>Use: <emphasis>main</emphasis></entry>
31520 <entry>Type: <emphasis>string</emphasis></entry>
31521 <entry>Default: <emphasis>unset</emphasis></entry>
31522 </row>
31523 </tbody>
31524 </tgroup>
31525 </informaltable>
31526 <para>
31527 <indexterm role="concept">
31528 <primary>timezone, setting</primary>
31529 </indexterm>
31530 <indexterm role="concept">
31531 <primary>environment</primary>
31532 <secondary>values from</secondary>
31533 </indexterm>
31534 The value of <option>timezone</option> is used to set the environment variable TZ while
31535 running Exim (if it is different on entry). This ensures that all timestamps
31536 created by Exim are in the required timezone. If you want all your timestamps
31537 to be in UTC (aka GMT) you should set
31538 </para>
31539 <literallayout class="monospaced">
31540 timezone = UTC
31541 </literallayout>
31542 <para>
31543 The default value is taken from TIMEZONE_DEFAULT in <filename>Local/Makefile</filename>,
31544 or, if that is not set, from the value of the TZ environment variable when Exim
31545 is built. If <option>timezone</option> is set to the empty string, either at build or run
31546 time, any existing TZ variable is removed from the environment when Exim
31547 runs. This is appropriate behaviour for obtaining wall-clock time on some, but
31548 unfortunately not all, operating systems.
31549 </para>
31550 <para>
31551 <indexterm role="option">
31552 <primary><option>tls_advertise_hosts</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>tls_advertise_hosts</option></entry>
31564 <entry>Use: <emphasis>main</emphasis></entry>
31565 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
31566 <entry>Default: <emphasis>*</emphasis></entry>
31567 </row>
31568 </tbody>
31569 </tgroup>
31570 </informaltable>
31571 <para>
31572 <indexterm role="concept">
31573 <primary>TLS</primary>
31574 <secondary>advertising</secondary>
31575 </indexterm>
31576 <indexterm role="concept">
31577 <primary>encryption</primary>
31578 <secondary>on SMTP connection</secondary>
31579 </indexterm>
31580 <indexterm role="concept">
31581 <primary>SMTP</primary>
31582 <secondary>encrypted connection</secondary>
31583 </indexterm>
31584 When Exim is built with support for TLS encrypted connections, the availability
31585 of the STARTTLS command to set up an encrypted session is advertised in
31586 response to EHLO only to those client hosts that match this option. See
31587 chapter <xref linkend="CHAPTLS"/> for details of Exim&#x2019;s support for TLS.
31588 Note that the default value requires that a certificate be supplied
31589 using the <option>tls_certificate</option> option.  If TLS support for incoming connections
31590 is not required the <option>tls_advertise_hosts</option> option should be set empty.
31591 </para>
31592 <para>
31593 <indexterm role="option">
31594 <primary><option>unset</option></primary>
31595 </indexterm>
31596 </para>
31597 <informaltable frame="all">
31598 <tgroup cols="4" colsep="0" rowsep="0">
31599 <colspec colwidth="8*" align="left"/>
31600 <colspec colwidth="6*" align="center"/>
31601 <colspec colwidth="6*" align="center"/>
31602 <colspec colwidth="6*" align="right"/>
31603 <tbody>
31604 <row>
31605 <entry><option>tls_certificate</option></entry>
31606 <entry>Use: <emphasis>main</emphasis></entry>
31607 <entry>Type: <emphasis>string</emphasis></entry>
31608 <entry>Default: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
31609 </row>
31610 </tbody>
31611 </tgroup>
31612 </informaltable>
31613 <para>
31614 <indexterm role="concept">
31615 <primary>TLS</primary>
31616 <secondary>server certificate; location of</secondary>
31617 </indexterm>
31618 <indexterm role="concept">
31619 <primary>certificate</primary>
31620 <secondary>server, location of</secondary>
31621 </indexterm>
31622 </para>
31623 <para revisionflag="changed">
31624 The value of this option is expanded, and must then be a list of absolute paths to
31625 files which contains the server&#x2019;s certificates.  Commonly only one file is
31626 needed.
31627 </para>
31628 <para>
31629 The server&#x2019;s private key is also
31630 assumed to be in this file if <option>tls_privatekey</option> is unset. See chapter
31631 <xref linkend="CHAPTLS"/> for further details.
31632 </para>
31633 <para>
31634 <emphasis role="bold">Note</emphasis>: The certificates defined by this option are used only when Exim is
31635 receiving incoming messages as a server. If you want to supply certificates for
31636 use when sending messages as a client, you must set the <option>tls_certificate</option>
31637 option in the relevant <command>smtp</command> transport.
31638 </para>
31639 <para revisionflag="changed">
31640 <emphasis role="bold">Note</emphasis>: If you use filenames based on IP addresses, change the list
31641 separator in the usual way to avoid confusion under IPv6.
31642 </para>
31643 <para revisionflag="changed">
31644 <emphasis role="bold">Note</emphasis>: Under current versions of OpenSSL, when a list of more than one
31645 file is used, the <varname>$tls_in_ourcert</varname> veriable is unreliable.
31646 </para>
31647 <para revisionflag="changed">
31648 <emphasis role="bold">Note</emphasis>: OCSP stapling is not usable when a list of more than one file is used.
31649 </para>
31650 <para>
31651 If the option contains <varname>$tls_out_sni</varname> and Exim is built against OpenSSL, then
31652 if the OpenSSL build supports TLS extensions and the TLS client sends the
31653 Server Name Indication extension, then this option and others documented in
31654 <xref linkend="SECTtlssni"/> will be re-expanded.
31655 </para>
31656 <para>
31657 If this option is unset or empty a fresh self-signed certificate will be
31658 generated for every connection.
31659 </para>
31660 <para>
31661 <indexterm role="option">
31662 <primary><option>tls_crl</option></primary>
31663 </indexterm>
31664 </para>
31665 <informaltable frame="all">
31666 <tgroup cols="4" colsep="0" rowsep="0">
31667 <colspec colwidth="8*" align="left"/>
31668 <colspec colwidth="6*" align="center"/>
31669 <colspec colwidth="6*" align="center"/>
31670 <colspec colwidth="6*" align="right"/>
31671 <tbody>
31672 <row>
31673 <entry><option>tls_crl</option></entry>
31674 <entry>Use: <emphasis>main</emphasis></entry>
31675 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31676 <entry>Default: <emphasis>unset</emphasis></entry>
31677 </row>
31678 </tbody>
31679 </tgroup>
31680 </informaltable>
31681 <para>
31682 <indexterm role="concept">
31683 <primary>TLS</primary>
31684 <secondary>server certificate revocation list</secondary>
31685 </indexterm>
31686 <indexterm role="concept">
31687 <primary>certificate</primary>
31688 <secondary>revocation list for server</secondary>
31689 </indexterm>
31690 This option specifies a certificate revocation list. The expanded value must
31691 be the name of a file that contains a CRL in PEM format.
31692 </para>
31693 <para>
31694 See <xref linkend="SECTtlssni"/> for discussion of when this option might be re-expanded.
31695 </para>
31696 <para>
31697 <indexterm role="option">
31698 <primary><option>tls_dh_max_bits</option></primary>
31699 </indexterm>
31700 </para>
31701 <informaltable frame="all">
31702 <tgroup cols="4" colsep="0" rowsep="0">
31703 <colspec colwidth="8*" align="left"/>
31704 <colspec colwidth="6*" align="center"/>
31705 <colspec colwidth="6*" align="center"/>
31706 <colspec colwidth="6*" align="right"/>
31707 <tbody>
31708 <row>
31709 <entry><option>tls_dh_max_bits</option></entry>
31710 <entry>Use: <emphasis>main</emphasis></entry>
31711 <entry>Type: <emphasis>integer</emphasis></entry>
31712 <entry>Default: <emphasis>2236</emphasis></entry>
31713 </row>
31714 </tbody>
31715 </tgroup>
31716 </informaltable>
31717 <para>
31718 <indexterm role="concept">
31719 <primary>TLS</primary>
31720 <secondary>D-H bit count</secondary>
31721 </indexterm>
31722 The number of bits used for Diffie-Hellman key-exchange may be suggested by
31723 the chosen TLS library.  That value might prove to be too high for
31724 interoperability.  This option provides a maximum clamp on the value
31725 suggested, trading off security for interoperability.
31726 </para>
31727 <para>
31728 The value must be at least 1024.
31729 </para>
31730 <para>
31731 The value 2236 was chosen because, at time of adding the option, it was the
31732 hard-coded maximum value supported by the NSS cryptographic library, as used
31733 by Thunderbird, while GnuTLS was suggesting 2432 bits as normal.
31734 </para>
31735 <para>
31736 If you prefer more security and are willing to break some clients, raise this
31737 number.
31738 </para>
31739 <para>
31740 Note that the value passed to GnuTLS for *generating* a new prime may be a
31741 little less than this figure, because GnuTLS is inexact and may produce a
31742 larger prime than requested.
31743 </para>
31744 <para>
31745 <indexterm role="option">
31746 <primary><option>tls_dhparam</option></primary>
31747 </indexterm>
31748 </para>
31749 <informaltable frame="all">
31750 <tgroup cols="4" colsep="0" rowsep="0">
31751 <colspec colwidth="8*" align="left"/>
31752 <colspec colwidth="6*" align="center"/>
31753 <colspec colwidth="6*" align="center"/>
31754 <colspec colwidth="6*" align="right"/>
31755 <tbody>
31756 <row>
31757 <entry><option>tls_dhparam</option></entry>
31758 <entry>Use: <emphasis>main</emphasis></entry>
31759 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31760 <entry>Default: <emphasis>unset</emphasis></entry>
31761 </row>
31762 </tbody>
31763 </tgroup>
31764 </informaltable>
31765 <para>
31766 <indexterm role="concept">
31767 <primary>TLS</primary>
31768 <secondary>D-H parameters for server</secondary>
31769 </indexterm>
31770 The value of this option is expanded and indicates the source of DH parameters
31771 to be used by Exim.
31772 </para>
31773 <para>
31774 <emphasis role="bold">Note: The Exim Maintainers strongly recommend using a filename with site-generated
31775 local DH parameters</emphasis>, which has been supported across all versions of Exim.  The
31776 other specific constants available are a fallback so that even when
31777 "unconfigured", Exim can offer Perfect Forward Secrecy in older ciphersuites in TLS.
31778 </para>
31779 <para>
31780 If <option>tls_dhparam</option> is a filename starting with a <literal>/</literal>,
31781 then it names a file from which DH
31782 parameters should be loaded.  If the file exists, it should hold a PEM-encoded
31783 PKCS#3 representation of the DH prime.  If the file does not exist, for
31784 OpenSSL it is an error.  For GnuTLS, Exim will attempt to create the file and
31785 fill it with a generated DH prime.  For OpenSSL, if the DH bit-count from
31786 loading the file is greater than <option>tls_dh_max_bits</option> then it will be ignored,
31787 and treated as though the <option>tls_dhparam</option> were set to "none".
31788 </para>
31789 <para>
31790 If this option expands to the string "none", then no DH parameters will be
31791 loaded by Exim.
31792 </para>
31793 <para>
31794 If this option expands to the string "historic" and Exim is using GnuTLS, then
31795 Exim will attempt to load a file from inside the spool directory.  If the file
31796 does not exist, Exim will attempt to create it.
31797 See section <xref linkend="SECTgnutlsparam"/> for further details.
31798 </para>
31799 <para>
31800 If Exim is using OpenSSL and this option is empty or unset, then Exim will load
31801 a default DH prime; the default is Exim-specific but lacks verifiable provenance.
31802 </para>
31803 <para>
31804 In older versions of Exim the default was the 2048 bit prime described in section
31805 2.2 of RFC 5114, "2048-bit MODP Group with 224-bit Prime Order Subgroup", which
31806 in IKE is assigned number 23.
31807 </para>
31808 <para>
31809 Otherwise, the option must expand to the name used by Exim for any of a number
31810 of DH primes specified in RFC 2409, RFC 3526, RFC 5114, RFC 7919, or from other
31811 sources.  As names, Exim uses a standard specified name, else "ike" followed by
31812 the number used by IKE, or "default" which corresponds to
31813 <literal>exim.dev.20160529.3</literal>.
31814 </para>
31815 <para>
31816 The available standard primes are:
31817 <literal>ffdhe2048</literal>, <literal>ffdhe3072</literal>, <literal>ffdhe4096</literal>, <literal>ffdhe6144</literal>, <literal>ffdhe8192</literal>,
31818 <literal>ike1</literal>, <literal>ike2</literal>, <literal>ike5</literal>,
31819 <literal>ike14</literal>, <literal>ike15</literal>, <literal>ike16</literal>, <literal>ike17</literal>, <literal>ike18</literal>,
31820 <literal>ike22</literal>, <literal>ike23</literal> and <literal>ike24</literal>.
31821 </para>
31822 <para>
31823 The available additional primes are:
31824 <literal>exim.dev.20160529.1</literal>, <literal>exim.dev.20160529.2</literal> and <literal>exim.dev.20160529.3</literal>.
31825 </para>
31826 <para>
31827 Some of these will be too small to be accepted by clients.
31828 Some may be too large to be accepted by clients.
31829 The open cryptographic community has suspicions about the integrity of some
31830 of the later IKE values, which led into RFC7919 providing new fixed constants
31831 (the "ffdhe" identifiers).
31832 </para>
31833 <para>
31834 At this point, all of the "ike" values should be considered obsolete;
31835 they&#x2019;re still in Exim to avoid breaking unusual configurations, but are
31836 candidates for removal the next time we have backwards-incompatible changes.
31837 </para>
31838 <para>
31839 The TLS protocol does not negotiate an acceptable size for this; clients tend
31840 to hard-drop connections if what is offered by the server is unacceptable,
31841 whether too large or too small, and there&#x2019;s no provision for the client to
31842 tell the server what these constraints are.  Thus, as a server operator, you
31843 need to make an educated guess as to what is most likely to work for your
31844 userbase.
31845 </para>
31846 <para>
31847 Some known size constraints suggest that a bit-size in the range 2048 to 2236
31848 is most likely to maximise interoperability.  The upper bound comes from
31849 applications using the Mozilla Network Security Services (NSS) library, which
31850 used to set its <literal>DH_MAX_P_BITS</literal> upper-bound to 2236.  This affects many
31851 mail user agents (MUAs). The lower bound comes from Debian installs of Exim4
31852 prior to the 4.80 release, as Debian used to patch Exim to raise the minimum
31853 acceptable bound from 1024 to 2048.
31854 </para>
31855 <para>
31856 <indexterm role="option">
31857 <primary><option>tls_eccurve</option></primary>
31858 </indexterm>
31859 </para>
31860 <informaltable frame="all">
31861 <tgroup cols="4" colsep="0" rowsep="0">
31862 <colspec colwidth="8*" align="left"/>
31863 <colspec colwidth="6*" align="center"/>
31864 <colspec colwidth="6*" align="center"/>
31865 <colspec colwidth="6*" align="right"/>
31866 <tbody>
31867 <row>
31868 <entry><option>tls_eccurve</option></entry>
31869 <entry>Use: <emphasis>main</emphasis></entry>
31870 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31871 <entry>Default: <emphasis><literal>auto</literal></emphasis></entry>
31872 </row>
31873 </tbody>
31874 </tgroup>
31875 </informaltable>
31876 <para>
31877 <indexterm role="concept">
31878 <primary>TLS</primary>
31879 <secondary>EC cryptography</secondary>
31880 </indexterm>
31881 This option selects a EC curve for use by Exim when used with OpenSSL.
31882 It has no effect when Exim is used with GnuTLS.
31883 </para>
31884 <para>
31885 After expansion it must contain a valid EC curve parameter, such as
31886 <literal>prime256v1</literal>, <literal>secp384r1</literal>, or <literal>P-512</literal>. Consult your OpenSSL manual
31887 for valid selections.
31888 </para>
31889 <para>
31890 For OpenSSL versions before (and not including) 1.0.2, the string
31891 <literal>auto</literal> selects <literal>prime256v1</literal>. For more recent OpenSSL versions
31892 <literal>auto</literal> tells the library to choose.
31893 </para>
31894 <para>
31895 If the option expands to an empty string, no EC curves will be enabled.
31896 </para>
31897 <para>
31898 <indexterm role="option">
31899 <primary><option>tls_ocsp_file</option></primary>
31900 </indexterm>
31901 </para>
31902 <informaltable frame="all">
31903 <tgroup cols="4" colsep="0" rowsep="0">
31904 <colspec colwidth="8*" align="left"/>
31905 <colspec colwidth="6*" align="center"/>
31906 <colspec colwidth="6*" align="center"/>
31907 <colspec colwidth="6*" align="right"/>
31908 <tbody>
31909 <row>
31910 <entry><option>tls_ocsp_file</option></entry>
31911 <entry>Use: <emphasis>main</emphasis></entry>
31912 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31913 <entry>Default: <emphasis>unset</emphasis></entry>
31914 </row>
31915 </tbody>
31916 </tgroup>
31917 </informaltable>
31918 <para>
31919 <indexterm role="concept">
31920 <primary>TLS</primary>
31921 <secondary>certificate status</secondary>
31922 </indexterm>
31923 <indexterm role="concept">
31924 <primary>TLS</primary>
31925 <secondary>OCSP proof file</secondary>
31926 </indexterm>
31927 This option
31928 must if set expand to the absolute path to a file which contains a current
31929 status proof for the server&#x2019;s certificate, as obtained from the
31930 Certificate Authority.
31931 </para>
31932 <para>
31933 Usable for GnuTLS 3.4.4 or 3.3.17 or OpenSSL 1.1.0 (or later).
31934 </para>
31935 <para revisionflag="changed">
31936 <emphasis role="bold">Note</emphasis>: There is currently no support for multiple OCSP proofs to match the
31937 multiple certificates facility.
31938 </para>
31939 <para>
31940 <indexterm role="option">
31941 <primary><option>tls_on_connect_ports</option></primary>
31942 </indexterm>
31943 </para>
31944 <informaltable frame="all">
31945 <tgroup cols="4" colsep="0" rowsep="0">
31946 <colspec colwidth="8*" align="left"/>
31947 <colspec colwidth="6*" align="center"/>
31948 <colspec colwidth="6*" align="center"/>
31949 <colspec colwidth="6*" align="right"/>
31950 <tbody>
31951 <row>
31952 <entry><option>tls_on_connect_ports</option></entry>
31953 <entry>Use: <emphasis>main</emphasis></entry>
31954 <entry>Type: <emphasis>string list</emphasis></entry>
31955 <entry>Default: <emphasis>unset</emphasis></entry>
31956 </row>
31957 </tbody>
31958 </tgroup>
31959 </informaltable>
31960 <para>
31961 <indexterm role="concept">
31962 <primary>SSMTP</primary>
31963 </indexterm>
31964 <indexterm role="concept">
31965 <primary>SMTPS</primary>
31966 </indexterm>
31967 This option specifies a list of incoming SSMTP (aka SMTPS) ports that should
31968 operate the obsolete SSMTP (SMTPS) protocol, where a TLS session is immediately
31969 set up without waiting for the client to issue a STARTTLS command. For
31970 further details, see section <xref linkend="SECTsupobssmt"/>.
31971 </para>
31972 <para>
31973 <indexterm role="option">
31974 <primary><option>unset</option></primary>
31975 </indexterm>
31976 </para>
31977 <informaltable frame="all">
31978 <tgroup cols="4" colsep="0" rowsep="0">
31979 <colspec colwidth="8*" align="left"/>
31980 <colspec colwidth="6*" align="center"/>
31981 <colspec colwidth="6*" align="center"/>
31982 <colspec colwidth="6*" align="right"/>
31983 <tbody>
31984 <row>
31985 <entry><option>tls_privatekey</option></entry>
31986 <entry>Use: <emphasis>main</emphasis></entry>
31987 <entry>Type: <emphasis>string</emphasis></entry>
31988 <entry>Default: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
31989 </row>
31990 </tbody>
31991 </tgroup>
31992 </informaltable>
31993 <para>
31994 <indexterm role="concept">
31995 <primary>TLS</primary>
31996 <secondary>server private key; location of</secondary>
31997 </indexterm>
31998 </para>
31999 <para revisionflag="changed">
32000 The value of this option is expanded, and must then be a list of absolute paths to
32001 files which contains the server&#x2019;s private keys.
32002 </para>
32003 <para>
32004 If this option is unset, or if
32005 the expansion is forced to fail, or the result is an empty string, the private
32006 key is assumed to be in the same file as the server&#x2019;s certificates. See chapter
32007 <xref linkend="CHAPTLS"/> for further details.
32008 </para>
32009 <para>
32010 See <xref linkend="SECTtlssni"/> for discussion of when this option might be re-expanded.
32011 </para>
32012 <para>
32013 <indexterm role="option">
32014 <primary><option>tls_remember_esmtp</option></primary>
32015 </indexterm>
32016 </para>
32017 <informaltable frame="all">
32018 <tgroup cols="4" colsep="0" rowsep="0">
32019 <colspec colwidth="8*" align="left"/>
32020 <colspec colwidth="6*" align="center"/>
32021 <colspec colwidth="6*" align="center"/>
32022 <colspec colwidth="6*" align="right"/>
32023 <tbody>
32024 <row>
32025 <entry><option>tls_remember_esmtp</option></entry>
32026 <entry>Use: <emphasis>main</emphasis></entry>
32027 <entry>Type: <emphasis>boolean</emphasis></entry>
32028 <entry>Default: <emphasis>false</emphasis></entry>
32029 </row>
32030 </tbody>
32031 </tgroup>
32032 </informaltable>
32033 <para>
32034 <indexterm role="concept">
32035 <primary>TLS</primary>
32036 <secondary>esmtp state; remembering</secondary>
32037 </indexterm>
32038 <indexterm role="concept">
32039 <primary>TLS</primary>
32040 <secondary>broken clients</secondary>
32041 </indexterm>
32042 If this option is set true, Exim violates the RFCs by remembering that it is in
32043 <quote>esmtp</quote> state after successfully negotiating a TLS session. This provides
32044 support for broken clients that fail to send a new EHLO after starting a
32045 TLS session.
32046 </para>
32047 <para>
32048 <indexterm role="option">
32049 <primary><option>tls_require_ciphers</option></primary>
32050 </indexterm>
32051 </para>
32052 <informaltable frame="all">
32053 <tgroup cols="4" colsep="0" rowsep="0">
32054 <colspec colwidth="8*" align="left"/>
32055 <colspec colwidth="6*" align="center"/>
32056 <colspec colwidth="6*" align="center"/>
32057 <colspec colwidth="6*" align="right"/>
32058 <tbody>
32059 <row>
32060 <entry><option>tls_require_ciphers</option></entry>
32061 <entry>Use: <emphasis>main</emphasis></entry>
32062 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32063 <entry>Default: <emphasis>unset</emphasis></entry>
32064 </row>
32065 </tbody>
32066 </tgroup>
32067 </informaltable>
32068 <para>
32069 <indexterm role="concept">
32070 <primary>TLS</primary>
32071 <secondary>requiring specific ciphers</secondary>
32072 </indexterm>
32073 <indexterm role="concept">
32074 <primary>cipher</primary>
32075 <secondary>requiring specific</secondary>
32076 </indexterm>
32077 This option controls which ciphers can be used for incoming TLS connections.
32078 The <command>smtp</command> transport has an option of the same name for controlling outgoing
32079 connections. This option is expanded for each connection, so can be varied for
32080 different clients if required. The value of this option must be a list of
32081 permitted cipher suites. The OpenSSL and GnuTLS libraries handle cipher control
32082 in somewhat different ways. If GnuTLS is being used, the client controls the
32083 preference order of the available ciphers. Details are given in sections
32084 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
32085 </para>
32086 <para>
32087 <indexterm role="option">
32088 <primary><option>tls_try_verify_hosts</option></primary>
32089 </indexterm>
32090 </para>
32091 <informaltable frame="all">
32092 <tgroup cols="4" colsep="0" rowsep="0">
32093 <colspec colwidth="8*" align="left"/>
32094 <colspec colwidth="6*" align="center"/>
32095 <colspec colwidth="6*" align="center"/>
32096 <colspec colwidth="6*" align="right"/>
32097 <tbody>
32098 <row>
32099 <entry><option>tls_try_verify_hosts</option></entry>
32100 <entry>Use: <emphasis>main</emphasis></entry>
32101 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
32102 <entry>Default: <emphasis>unset</emphasis></entry>
32103 </row>
32104 </tbody>
32105 </tgroup>
32106 </informaltable>
32107 <para>
32108 <indexterm role="concept">
32109 <primary>TLS</primary>
32110 <secondary>client certificate verification</secondary>
32111 </indexterm>
32112 <indexterm role="concept">
32113 <primary>certificate</primary>
32114 <secondary>verification of client</secondary>
32115 </indexterm>
32116 See <option>tls_verify_hosts</option> below.
32117 </para>
32118 <para>
32119 <indexterm role="option">
32120 <primary><option>tls_verify_certificates</option></primary>
32121 </indexterm>
32122 </para>
32123 <informaltable frame="all">
32124 <tgroup cols="4" colsep="0" rowsep="0">
32125 <colspec colwidth="8*" align="left"/>
32126 <colspec colwidth="6*" align="center"/>
32127 <colspec colwidth="6*" align="center"/>
32128 <colspec colwidth="6*" align="right"/>
32129 <tbody>
32130 <row>
32131 <entry><option>tls_verify_certificates</option></entry>
32132 <entry>Use: <emphasis>main</emphasis></entry>
32133 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32134 <entry>Default: <emphasis>system</emphasis></entry>
32135 </row>
32136 </tbody>
32137 </tgroup>
32138 </informaltable>
32139 <para>
32140 <indexterm role="concept">
32141 <primary>TLS</primary>
32142 <secondary>client certificate verification</secondary>
32143 </indexterm>
32144 <indexterm role="concept">
32145 <primary>certificate</primary>
32146 <secondary>verification of client</secondary>
32147 </indexterm>
32148 The value of this option is expanded, and must then be either the
32149 word "system"
32150 or the absolute path to
32151 a file or directory containing permitted certificates for clients that
32152 match <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option>.
32153 </para>
32154 <para>
32155 The "system" value for the option will use a
32156 system default location compiled into the SSL library.
32157 This is not available for GnuTLS versions preceding 3.0.20,
32158 and will be taken as empty; an explicit location
32159 must be specified.
32160 </para>
32161 <para>
32162 The use of a directory for the option value is not available for GnuTLS versions
32163 preceding 3.3.6 and a single file must be used.
32164 </para>
32165 <para>
32166 With OpenSSL the certificates specified
32167 explicitly
32168 either by file or directory
32169 are added to those given by the system default location.
32170 </para>
32171 <para>
32172 These certificates should be for the certificate authorities trusted, rather
32173 than the public cert of individual clients.  With both OpenSSL and GnuTLS, if
32174 the value is a file then the certificates are sent by Exim as a server to
32175 connecting clients, defining the list of accepted certificate authorities.
32176 Thus the values defined should be considered public data.  To avoid this,
32177 use the explicit directory version.
32178 </para>
32179 <para>
32180 See <xref linkend="SECTtlssni"/> for discussion of when this option might be re-expanded.
32181 </para>
32182 <para>
32183 A forced expansion failure or setting to an empty string is equivalent to
32184 being unset.
32185 </para>
32186 <para>
32187 <indexterm role="option">
32188 <primary><option>tls_verify_hosts</option></primary>
32189 </indexterm>
32190 </para>
32191 <informaltable frame="all">
32192 <tgroup cols="4" colsep="0" rowsep="0">
32193 <colspec colwidth="8*" align="left"/>
32194 <colspec colwidth="6*" align="center"/>
32195 <colspec colwidth="6*" align="center"/>
32196 <colspec colwidth="6*" align="right"/>
32197 <tbody>
32198 <row>
32199 <entry><option>tls_verify_hosts</option></entry>
32200 <entry>Use: <emphasis>main</emphasis></entry>
32201 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
32202 <entry>Default: <emphasis>unset</emphasis></entry>
32203 </row>
32204 </tbody>
32205 </tgroup>
32206 </informaltable>
32207 <para>
32208 <indexterm role="concept">
32209 <primary>TLS</primary>
32210 <secondary>client certificate verification</secondary>
32211 </indexterm>
32212 <indexterm role="concept">
32213 <primary>certificate</primary>
32214 <secondary>verification of client</secondary>
32215 </indexterm>
32216 This option, along with <option>tls_try_verify_hosts</option>, controls the checking of
32217 certificates from clients. The expected certificates are defined by
32218 <option>tls_verify_certificates</option>, which must be set. A configuration error occurs if
32219 either <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> is set and
32220 <option>tls_verify_certificates</option> is not set.
32221 </para>
32222 <para>
32223 Any client that matches <option>tls_verify_hosts</option> is constrained by
32224 <option>tls_verify_certificates</option>. When the client initiates a TLS session, it must
32225 present one of the listed certificates. If it does not, the connection is
32226 aborted. <emphasis role="bold">Warning</emphasis>: Including a host in <option>tls_verify_hosts</option> does not require
32227 the host to use TLS. It can still send SMTP commands through unencrypted
32228 connections. Forcing a client to use TLS has to be done separately using an
32229 ACL to reject inappropriate commands when the connection is not encrypted.
32230 </para>
32231 <para>
32232 A weaker form of checking is provided by <option>tls_try_verify_hosts</option>. If a client
32233 matches this option (but not <option>tls_verify_hosts</option>), Exim requests a
32234 certificate and checks it against <option>tls_verify_certificates</option>, but does not
32235 abort the connection if there is no certificate or if it does not match. This
32236 state can be detected in an ACL, which makes it possible to implement policies
32237 such as <quote>accept for relay only if a verified certificate has been received,
32238 but accept for local delivery if encrypted, even without a verified
32239 certificate</quote>.
32240 </para>
32241 <para>
32242 Client hosts that match neither of these lists are not asked to present
32243 certificates.
32244 </para>
32245 <para>
32246 <indexterm role="option">
32247 <primary><option>trusted_groups</option></primary>
32248 </indexterm>
32249 </para>
32250 <informaltable frame="all">
32251 <tgroup cols="4" colsep="0" rowsep="0">
32252 <colspec colwidth="8*" align="left"/>
32253 <colspec colwidth="6*" align="center"/>
32254 <colspec colwidth="6*" align="center"/>
32255 <colspec colwidth="6*" align="right"/>
32256 <tbody>
32257 <row>
32258 <entry><option>trusted_groups</option></entry>
32259 <entry>Use: <emphasis>main</emphasis></entry>
32260 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
32261 <entry>Default: <emphasis>unset</emphasis></entry>
32262 </row>
32263 </tbody>
32264 </tgroup>
32265 </informaltable>
32266 <para>
32267 <indexterm role="concept">
32268 <primary>trusted groups</primary>
32269 </indexterm>
32270 <indexterm role="concept">
32271 <primary>groups</primary>
32272 <secondary>trusted</secondary>
32273 </indexterm>
32274 This option is expanded just once, at the start of Exim&#x2019;s processing. If this
32275 option is set, any process that is running in one of the listed groups, or
32276 which has one of them as a supplementary group, is trusted. The groups can be
32277 specified numerically or by name. See section <xref linkend="SECTtrustedadmin"/> for
32278 details of what trusted callers are permitted to do. If neither
32279 <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the Exim user
32280 are trusted.
32281 </para>
32282 <para>
32283 <indexterm role="option">
32284 <primary><option>trusted_users</option></primary>
32285 </indexterm>
32286 </para>
32287 <informaltable frame="all">
32288 <tgroup cols="4" colsep="0" rowsep="0">
32289 <colspec colwidth="8*" align="left"/>
32290 <colspec colwidth="6*" align="center"/>
32291 <colspec colwidth="6*" align="center"/>
32292 <colspec colwidth="6*" align="right"/>
32293 <tbody>
32294 <row>
32295 <entry><option>trusted_users</option></entry>
32296 <entry>Use: <emphasis>main</emphasis></entry>
32297 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
32298 <entry>Default: <emphasis>unset</emphasis></entry>
32299 </row>
32300 </tbody>
32301 </tgroup>
32302 </informaltable>
32303 <para>
32304 <indexterm role="concept">
32305 <primary>trusted users</primary>
32306 </indexterm>
32307 <indexterm role="concept">
32308 <primary>user</primary>
32309 <secondary>trusted</secondary>
32310 </indexterm>
32311 This option is expanded just once, at the start of Exim&#x2019;s processing. If this
32312 option is set, any process that is running as one of the listed users is
32313 trusted. The users can be specified numerically or by name. See section
32314 <xref linkend="SECTtrustedadmin"/> for details of what trusted callers are permitted to do.
32315 If neither <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the
32316 Exim user are trusted.
32317 </para>
32318 <para>
32319 <indexterm role="option">
32320 <primary><option>unknown_login</option></primary>
32321 </indexterm>
32322 </para>
32323 <informaltable frame="all">
32324 <tgroup cols="4" colsep="0" rowsep="0">
32325 <colspec colwidth="8*" align="left"/>
32326 <colspec colwidth="6*" align="center"/>
32327 <colspec colwidth="6*" align="center"/>
32328 <colspec colwidth="6*" align="right"/>
32329 <tbody>
32330 <row>
32331 <entry><option>unknown_login</option></entry>
32332 <entry>Use: <emphasis>main</emphasis></entry>
32333 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32334 <entry>Default: <emphasis>unset</emphasis></entry>
32335 </row>
32336 </tbody>
32337 </tgroup>
32338 </informaltable>
32339 <para>
32340 <indexterm role="concept">
32341 <primary>uid (user id)</primary>
32342 <secondary>unknown caller</secondary>
32343 </indexterm>
32344 <indexterm role="variable">
32345 <primary><varname>$caller_uid</varname></primary>
32346 </indexterm>
32347 This is a specialized feature for use in unusual configurations. By default, if
32348 the uid of the caller of Exim cannot be looked up using <function>getpwuid()</function>, Exim
32349 gives up. The <option>unknown_login</option> option can be used to set a login name to be
32350 used in this circumstance. It is expanded, so values like <option>user$caller_uid</option>
32351 can be set. When <option>unknown_login</option> is used, the value of <option>unknown_username</option>
32352 is used for the user&#x2019;s real name (gecos field), unless this has been set by the
32353 <option>-F</option> option.
32354 </para>
32355 <para>
32356 <indexterm role="option">
32357 <primary><option>unknown_username</option></primary>
32358 </indexterm>
32359 </para>
32360 <informaltable frame="all">
32361 <tgroup cols="4" colsep="0" rowsep="0">
32362 <colspec colwidth="8*" align="left"/>
32363 <colspec colwidth="6*" align="center"/>
32364 <colspec colwidth="6*" align="center"/>
32365 <colspec colwidth="6*" align="right"/>
32366 <tbody>
32367 <row>
32368 <entry><option>unknown_username</option></entry>
32369 <entry>Use: <emphasis>main</emphasis></entry>
32370 <entry>Type: <emphasis>string</emphasis></entry>
32371 <entry>Default: <emphasis>unset</emphasis></entry>
32372 </row>
32373 </tbody>
32374 </tgroup>
32375 </informaltable>
32376 <para>
32377 See <option>unknown_login</option>.
32378 </para>
32379 <para>
32380 <indexterm role="option">
32381 <primary><option>untrusted_set_sender</option></primary>
32382 </indexterm>
32383 </para>
32384 <informaltable frame="all">
32385 <tgroup cols="4" colsep="0" rowsep="0">
32386 <colspec colwidth="8*" align="left"/>
32387 <colspec colwidth="6*" align="center"/>
32388 <colspec colwidth="6*" align="center"/>
32389 <colspec colwidth="6*" align="right"/>
32390 <tbody>
32391 <row>
32392 <entry><option>untrusted_set_sender</option></entry>
32393 <entry>Use: <emphasis>main</emphasis></entry>
32394 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
32395 <entry>Default: <emphasis>unset</emphasis></entry>
32396 </row>
32397 </tbody>
32398 </tgroup>
32399 </informaltable>
32400 <para>
32401 <indexterm role="concept">
32402 <primary>trusted users</primary>
32403 </indexterm>
32404 <indexterm role="concept">
32405 <primary>sender</primary>
32406 <secondary>setting by untrusted user</secondary>
32407 </indexterm>
32408 <indexterm role="concept">
32409 <primary>untrusted user setting sender</primary>
32410 </indexterm>
32411 <indexterm role="concept">
32412 <primary>user</primary>
32413 <secondary>untrusted setting sender</secondary>
32414 </indexterm>
32415 <indexterm role="concept">
32416 <primary>envelope sender</primary>
32417 </indexterm>
32418 When an untrusted user submits a message to Exim using the standard input, Exim
32419 normally creates an envelope sender address from the user&#x2019;s login and the
32420 default qualification domain. Data from the <option>-f</option> option (for setting envelope
32421 senders on non-SMTP messages) or the SMTP MAIL command (if <option>-bs</option> or <option>-bS</option>
32422 is used) is ignored.
32423 </para>
32424 <para>
32425 However, untrusted users are permitted to set an empty envelope sender address,
32426 to declare that a message should never generate any bounces. For example:
32427 </para>
32428 <literallayout class="monospaced">
32429 exim -f '&lt;&gt;' user@domain.example
32430 </literallayout>
32431 <para>
32432 <indexterm role="variable">
32433 <primary><varname>$sender_ident</varname></primary>
32434 </indexterm>
32435 The <option>untrusted_set_sender</option> option allows you to permit untrusted users to set
32436 other envelope sender addresses in a controlled way. When it is set, untrusted
32437 users are allowed to set envelope sender addresses that match any of the
32438 patterns in the list. Like all address lists, the string is expanded. The
32439 identity of the user is in <varname>$sender_ident</varname>, so you can, for example, restrict
32440 users to setting senders that start with their login ids
32441 followed by a hyphen
32442 by a setting like this:
32443 </para>
32444 <literallayout class="monospaced">
32445 untrusted_set_sender = ^$sender_ident-
32446 </literallayout>
32447 <para>
32448 If you want to allow untrusted users to set envelope sender addresses without
32449 restriction, you can use
32450 </para>
32451 <literallayout class="monospaced">
32452 untrusted_set_sender = *
32453 </literallayout>
32454 <para>
32455 The <option>untrusted_set_sender</option> option applies to all forms of local input, but
32456 only to the setting of the envelope sender. It does not permit untrusted users
32457 to use the other options which trusted user can use to override message
32458 parameters. Furthermore, it does not stop Exim from removing an existing
32459 <emphasis>Sender:</emphasis> header in the message, or from adding a <emphasis>Sender:</emphasis> header if
32460 necessary. See <option>local_sender_retain</option> and <option>local_from_check</option> for ways of
32461 overriding these actions. The handling of the <emphasis>Sender:</emphasis> header is also
32462 described in section <xref linkend="SECTthesenhea"/>.
32463 </para>
32464 <para>
32465 The log line for a message&#x2019;s arrival shows the envelope sender following
32466 <quote>&lt;=</quote>. For local messages, the user&#x2019;s login always follows, after <quote>U=</quote>. In
32467 <option>-bp</option> displays, and in the Exim monitor, if an untrusted user sets an
32468 envelope sender address, the user&#x2019;s login is shown in parentheses after the
32469 sender address.
32470 </para>
32471 <para>
32472 <indexterm role="option">
32473 <primary><option>uucp_from_pattern</option></primary>
32474 </indexterm>
32475 </para>
32476 <informaltable frame="all">
32477 <tgroup cols="4" colsep="0" rowsep="0">
32478 <colspec colwidth="8*" align="left"/>
32479 <colspec colwidth="6*" align="center"/>
32480 <colspec colwidth="6*" align="center"/>
32481 <colspec colwidth="6*" align="right"/>
32482 <tbody>
32483 <row>
32484 <entry><option>uucp_from_pattern</option></entry>
32485 <entry>Use: <emphasis>main</emphasis></entry>
32486 <entry>Type: <emphasis>string</emphasis></entry>
32487 <entry>Default: <emphasis>see below</emphasis></entry>
32488 </row>
32489 </tbody>
32490 </tgroup>
32491 </informaltable>
32492 <para>
32493 <indexterm role="concept">
32494 <primary><quote>From</quote> line</primary>
32495 </indexterm>
32496 <indexterm role="concept">
32497 <primary>UUCP</primary>
32498 <secondary><quote>From</quote> line</secondary>
32499 </indexterm>
32500 Some applications that pass messages to an MTA via a command line interface use
32501 an initial line starting with <quote>From&nbsp;</quote> to pass the envelope sender. In
32502 particular, this is used by UUCP software. Exim recognizes such a line by means
32503 of a regular expression that is set in <option>uucp_from_pattern</option>. When the pattern
32504 matches, the sender address is constructed by expanding the contents of
32505 <option>uucp_from_sender</option>, provided that the caller of Exim is a trusted user. The
32506 default pattern recognizes lines in the following two forms:
32507 </para>
32508 <literallayout class="monospaced">
32509 From ph10 Fri Jan  5 12:35 GMT 1996
32510 From ph10 Fri, 7 Jan 97 14:00:00 GMT
32511 </literallayout>
32512 <para>
32513 The pattern can be seen by running
32514 </para>
32515 <literallayout class="monospaced">
32516 exim -bP uucp_from_pattern
32517 </literallayout>
32518 <para>
32519 It checks only up to the hours and minutes, and allows for a 2-digit or 4-digit
32520 year in the second case. The first word after <quote>From&nbsp;</quote> is matched in the
32521 regular expression by a parenthesized subpattern. The default value for
32522 <option>uucp_from_sender</option> is <quote>$1</quote>, which therefore just uses this first word
32523 (<quote>ph10</quote> in the example above) as the message&#x2019;s sender. See also
32524 <option>ignore_fromline_hosts</option>.
32525 </para>
32526 <para>
32527 <indexterm role="option">
32528 <primary><option>uucp_from_sender</option></primary>
32529 </indexterm>
32530 </para>
32531 <informaltable frame="all">
32532 <tgroup cols="4" colsep="0" rowsep="0">
32533 <colspec colwidth="8*" align="left"/>
32534 <colspec colwidth="6*" align="center"/>
32535 <colspec colwidth="6*" align="center"/>
32536 <colspec colwidth="6*" align="right"/>
32537 <tbody>
32538 <row>
32539 <entry><option>uucp_from_sender</option></entry>
32540 <entry>Use: <emphasis>main</emphasis></entry>
32541 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32542 <entry>Default: <emphasis><literal>$1</literal></emphasis></entry>
32543 </row>
32544 </tbody>
32545 </tgroup>
32546 </informaltable>
32547 <para>
32548 See <option>uucp_from_pattern</option> above.
32549 </para>
32550 <para>
32551 <indexterm role="option">
32552 <primary><option>warn_message_file</option></primary>
32553 </indexterm>
32554 </para>
32555 <informaltable frame="all">
32556 <tgroup cols="4" colsep="0" rowsep="0">
32557 <colspec colwidth="8*" align="left"/>
32558 <colspec colwidth="6*" align="center"/>
32559 <colspec colwidth="6*" align="center"/>
32560 <colspec colwidth="6*" align="right"/>
32561 <tbody>
32562 <row>
32563 <entry><option>warn_message_file</option></entry>
32564 <entry>Use: <emphasis>main</emphasis></entry>
32565 <entry>Type: <emphasis>string</emphasis></entry>
32566 <entry>Default: <emphasis>unset</emphasis></entry>
32567 </row>
32568 </tbody>
32569 </tgroup>
32570 </informaltable>
32571 <para>
32572 <indexterm role="concept">
32573 <primary>warning of delay</primary>
32574 <secondary>customizing the message</secondary>
32575 </indexterm>
32576 <indexterm role="concept">
32577 <primary>customizing</primary>
32578 <secondary>warning message</secondary>
32579 </indexterm>
32580 This option defines a template file containing paragraphs of text to be used
32581 for constructing the warning message which is sent by Exim when a message has
32582 been on the queue for a specified amount of time, as specified by
32583 <option>delay_warning</option>. Details of the file&#x2019;s contents are given in chapter
32584 <xref linkend="CHAPemsgcust"/>. See also <option>bounce_message_file</option>.
32585 </para>
32586 <para>
32587 <indexterm role="option">
32588 <primary><option>write_rejectlog</option></primary>
32589 </indexterm>
32590 </para>
32591 <informaltable frame="all">
32592 <tgroup cols="4" colsep="0" rowsep="0">
32593 <colspec colwidth="8*" align="left"/>
32594 <colspec colwidth="6*" align="center"/>
32595 <colspec colwidth="6*" align="center"/>
32596 <colspec colwidth="6*" align="right"/>
32597 <tbody>
32598 <row>
32599 <entry><option>write_rejectlog</option></entry>
32600 <entry>Use: <emphasis>main</emphasis></entry>
32601 <entry>Type: <emphasis>boolean</emphasis></entry>
32602 <entry>Default: <emphasis>true</emphasis></entry>
32603 </row>
32604 </tbody>
32605 </tgroup>
32606 </informaltable>
32607 <para>
32608 <indexterm role="concept">
32609 <primary>reject log</primary>
32610 <secondary>disabling</secondary>
32611 </indexterm>
32612 If this option is set false, Exim no longer writes anything to the reject log.
32613 See chapter <xref linkend="CHAPlog"/> for details of what Exim writes to its logs.
32614 <indexterm role="concept" startref="IIDconfima" class="endofrange"/>
32615 <indexterm role="concept" startref="IIDmaiconf" class="endofrange"/>
32616 </para>
32617 </section>
32618 </chapter>
32619
32620 <chapter id="CHAProutergeneric">
32621 <title>Generic options for routers</title>
32622 <para>
32623 <indexterm role="concept" id="IIDgenoprou1" class="startofrange">
32624 <primary>options</primary>
32625 <secondary>generic; for routers</secondary>
32626 </indexterm>
32627 <indexterm role="concept" id="IIDgenoprou2" class="startofrange">
32628 <primary>generic options</primary>
32629 <secondary>router</secondary>
32630 </indexterm>
32631 This chapter describes the generic options that apply to all routers.
32632 Those that are preconditions are marked with &Dagger; in the <quote>use</quote> field.
32633 </para>
32634 <para>
32635 For a general description of how a router operates, see sections
32636 <xref linkend="SECTrunindrou"/> and <xref linkend="SECTrouprecon"/>. The latter specifies the order in
32637 which the preconditions are tested. The order of expansion of the options that
32638 provide data for a transport is: <option>errors_to</option>, <option>headers_add</option>,
32639 <option>headers_remove</option>, <option>transport</option>.
32640 </para>
32641 <para>
32642 <indexterm role="option">
32643 <primary><option>address_data</option></primary>
32644 </indexterm>
32645 </para>
32646 <informaltable frame="all">
32647 <tgroup cols="4" colsep="0" rowsep="0">
32648 <colspec colwidth="8*" align="left"/>
32649 <colspec colwidth="6*" align="center"/>
32650 <colspec colwidth="6*" align="center"/>
32651 <colspec colwidth="6*" align="right"/>
32652 <tbody>
32653 <row>
32654 <entry><option>address_data</option></entry>
32655 <entry>Use: <emphasis>routers</emphasis></entry>
32656 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32657 <entry>Default: <emphasis>unset</emphasis></entry>
32658 </row>
32659 </tbody>
32660 </tgroup>
32661 </informaltable>
32662 <para>
32663 <indexterm role="concept">
32664 <primary>router</primary>
32665 <secondary>data attached to address</secondary>
32666 </indexterm>
32667 The string is expanded just before the router is run, that is, after all the
32668 precondition tests have succeeded. If the expansion is forced to fail, the
32669 router declines, the value of <option>address_data</option> remains unchanged, and the
32670 <option>more</option> option controls what happens next. Other expansion failures cause
32671 delivery of the address to be deferred.
32672 </para>
32673 <para>
32674 <indexterm role="variable">
32675 <primary><varname>$address_data</varname></primary>
32676 </indexterm>
32677 When the expansion succeeds, the value is retained with the address, and can be
32678 accessed using the variable <varname>$address_data</varname> in the current router, subsequent
32679 routers, and the eventual transport.
32680 </para>
32681 <para>
32682 <emphasis role="bold">Warning</emphasis>: If the current or any subsequent router is a <command>redirect</command> router
32683 that runs a user&#x2019;s filter file, the contents of <varname>$address_data</varname> are accessible
32684 in the filter. This is not normally a problem, because such data is usually
32685 either not confidential or it <quote>belongs</quote> to the current user, but if you do
32686 put confidential data into <varname>$address_data</varname> you need to remember this point.
32687 </para>
32688 <para>
32689 Even if the router declines or passes, the value of <varname>$address_data</varname> remains
32690 with the address, though it can be changed by another <option>address_data</option> setting
32691 on a subsequent router. If a router generates child addresses, the value of
32692 <varname>$address_data</varname> propagates to them. This also applies to the special kind of
32693 <quote>child</quote> that is generated by a router with the <option>unseen</option> option.
32694 </para>
32695 <para>
32696 The idea of <option>address_data</option> is that you can use it to look up a lot of data
32697 for the address once, and then pick out parts of the data later. For example,
32698 you could use a single LDAP lookup to return a string of the form
32699 </para>
32700 <literallayout class="monospaced">
32701 uid=1234 gid=5678 mailbox=/mail/xyz forward=/home/xyz/.forward
32702 </literallayout>
32703 <para>
32704 In the transport you could pick out the mailbox by a setting such as
32705 </para>
32706 <literallayout class="monospaced">
32707 file = ${extract{mailbox}{$address_data}}
32708 </literallayout>
32709 <para>
32710 This makes the configuration file less messy, and also reduces the number of
32711 lookups (though Exim does cache lookups).
32712 </para>
32713 <para>
32714 <indexterm role="variable">
32715 <primary><varname>$sender_address_data</varname></primary>
32716 </indexterm>
32717 <indexterm role="variable">
32718 <primary><varname>$address_data</varname></primary>
32719 </indexterm>
32720 The <option>address_data</option> facility is also useful as a means of passing information
32721 from one router to another, and from a router to a transport. In addition, if
32722 <varname>$address_data</varname> is set by a router when verifying a recipient address from an
32723 ACL, it remains available for use in the rest of the ACL statement. After
32724 verifying a sender, the value is transferred to <varname>$sender_address_data</varname>.
32725 </para>
32726 <para>
32727 <indexterm role="option">
32728 <primary><option>address_test</option></primary>
32729 </indexterm>
32730 </para>
32731 <informaltable frame="all">
32732 <tgroup cols="4" colsep="0" rowsep="0">
32733 <colspec colwidth="8*" align="left"/>
32734 <colspec colwidth="6*" align="center"/>
32735 <colspec colwidth="6*" align="center"/>
32736 <colspec colwidth="6*" align="right"/>
32737 <tbody>
32738 <row>
32739 <entry><option>address_test</option></entry>
32740 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
32741 <entry>Type: <emphasis>boolean</emphasis></entry>
32742 <entry>Default: <emphasis>true</emphasis></entry>
32743 </row>
32744 </tbody>
32745 </tgroup>
32746 </informaltable>
32747 <para>
32748 <indexterm role="option">
32749 <primary><option>-bt</option></primary>
32750 </indexterm>
32751 <indexterm role="concept">
32752 <primary>router</primary>
32753 <secondary>skipping when address testing</secondary>
32754 </indexterm>
32755 If this option is set false, the router is skipped when routing is being tested
32756 by means of the <option>-bt</option> command line option. This can be a convenience when
32757 your first router sends messages to an external scanner, because it saves you
32758 having to set the <quote>already scanned</quote> indicator when testing real address
32759 routing.
32760 </para>
32761 <para>
32762 <indexterm role="option">
32763 <primary><option>cannot_route_message</option></primary>
32764 </indexterm>
32765 </para>
32766 <informaltable frame="all">
32767 <tgroup cols="4" colsep="0" rowsep="0">
32768 <colspec colwidth="8*" align="left"/>
32769 <colspec colwidth="6*" align="center"/>
32770 <colspec colwidth="6*" align="center"/>
32771 <colspec colwidth="6*" align="right"/>
32772 <tbody>
32773 <row>
32774 <entry><option>cannot_route_message</option></entry>
32775 <entry>Use: <emphasis>routers</emphasis></entry>
32776 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32777 <entry>Default: <emphasis>unset</emphasis></entry>
32778 </row>
32779 </tbody>
32780 </tgroup>
32781 </informaltable>
32782 <para>
32783 <indexterm role="concept">
32784 <primary>router</primary>
32785 <secondary>customizing <quote>cannot route</quote> message</secondary>
32786 </indexterm>
32787 <indexterm role="concept">
32788 <primary>customizing</primary>
32789 <secondary><quote>cannot route</quote> message</secondary>
32790 </indexterm>
32791 This option specifies a text message that is used when an address cannot be
32792 routed because Exim has run out of routers. The default message is
32793 <quote>Unrouteable address</quote>. This option is useful only on routers that have
32794 <option>more</option> set false, or on the very last router in a configuration, because the
32795 value that is used is taken from the last router that is considered. This
32796 includes a router that is skipped because its preconditions are not met, as
32797 well as a router that declines. For example, using the default configuration,
32798 you could put:
32799 </para>
32800 <literallayout class="monospaced">
32801 cannot_route_message = Remote domain not found in DNS
32802 </literallayout>
32803 <para>
32804 on the first router, which is a <command>dnslookup</command> router with <option>more</option> set false,
32805 and
32806 </para>
32807 <literallayout class="monospaced">
32808 cannot_route_message = Unknown local user
32809 </literallayout>
32810 <para>
32811 on the final router that checks for local users. If string expansion fails for
32812 this option, the default message is used. Unless the expansion failure was
32813 explicitly forced, a message about the failure is written to the main and panic
32814 logs, in addition to the normal message about the routing failure.
32815 </para>
32816 <para>
32817 <indexterm role="option">
32818 <primary><option>caseful_local_part</option></primary>
32819 </indexterm>
32820 </para>
32821 <informaltable frame="all">
32822 <tgroup cols="4" colsep="0" rowsep="0">
32823 <colspec colwidth="8*" align="left"/>
32824 <colspec colwidth="6*" align="center"/>
32825 <colspec colwidth="6*" align="center"/>
32826 <colspec colwidth="6*" align="right"/>
32827 <tbody>
32828 <row>
32829 <entry><option>caseful_local_part</option></entry>
32830 <entry>Use: <emphasis>routers</emphasis></entry>
32831 <entry>Type: <emphasis>boolean</emphasis></entry>
32832 <entry>Default: <emphasis>false</emphasis></entry>
32833 </row>
32834 </tbody>
32835 </tgroup>
32836 </informaltable>
32837 <para>
32838 <indexterm role="concept">
32839 <primary>case of local parts</primary>
32840 </indexterm>
32841 <indexterm role="concept">
32842 <primary>router</primary>
32843 <secondary>case of local parts</secondary>
32844 </indexterm>
32845 By default, routers handle the local parts of addresses in a case-insensitive
32846 manner, though the actual case is preserved for transmission with the message.
32847 If you want the case of letters to be significant in a router, you must set
32848 this option true. For individual router options that contain address or local
32849 part lists (for example, <option>local_parts</option>), case-sensitive matching can be
32850 turned on by <quote>+caseful</quote> as a list item. See section <xref linkend="SECTcasletadd"/> for
32851 more details.
32852 </para>
32853 <para>
32854 <indexterm role="variable">
32855 <primary><varname>$local_part</varname></primary>
32856 </indexterm>
32857 <indexterm role="variable">
32858 <primary><varname>$original_local_part</varname></primary>
32859 </indexterm>
32860 <indexterm role="variable">
32861 <primary><varname>$parent_local_part</varname></primary>
32862 </indexterm>
32863 The value of the <varname>$local_part</varname> variable is forced to lower case while a
32864 router is running unless <option>caseful_local_part</option> is set. When a router assigns
32865 an address to a transport, the value of <varname>$local_part</varname> when the transport runs
32866 is the same as it was in the router. Similarly, when a router generates child
32867 addresses by aliasing or forwarding, the values of <varname>$original_local_part</varname>
32868 and <varname>$parent_local_part</varname> are those that were used by the redirecting router.
32869 </para>
32870 <para>
32871 This option applies to the processing of an address by a router. When a
32872 recipient address is being processed in an ACL, there is a separate <option>control</option>
32873 modifier that can be used to specify case-sensitive processing within the ACL
32874 (see section <xref linkend="SECTcontrols"/>).
32875 </para>
32876 <para>
32877 <indexterm role="option">
32878 <primary><option>check_local_user</option></primary>
32879 </indexterm>
32880 </para>
32881 <informaltable frame="all">
32882 <tgroup cols="4" colsep="0" rowsep="0">
32883 <colspec colwidth="8*" align="left"/>
32884 <colspec colwidth="6*" align="center"/>
32885 <colspec colwidth="6*" align="center"/>
32886 <colspec colwidth="6*" align="right"/>
32887 <tbody>
32888 <row>
32889 <entry><option>check_local_user</option></entry>
32890 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
32891 <entry>Type: <emphasis>boolean</emphasis></entry>
32892 <entry>Default: <emphasis>false</emphasis></entry>
32893 </row>
32894 </tbody>
32895 </tgroup>
32896 </informaltable>
32897 <para>
32898 <indexterm role="concept">
32899 <primary>local user, checking in router</primary>
32900 </indexterm>
32901 <indexterm role="concept">
32902 <primary>router</primary>
32903 <secondary>checking for local user</secondary>
32904 </indexterm>
32905 <indexterm role="concept">
32906 <primary><filename>/etc/passwd</filename></primary>
32907 </indexterm>
32908 <indexterm role="variable">
32909 <primary><varname>$home</varname></primary>
32910 </indexterm>
32911 When this option is true, Exim checks that the local part of the recipient
32912 address (with affixes removed if relevant) is the name of an account on the
32913 local system. The check is done by calling the <function>getpwnam()</function> function rather
32914 than trying to read <filename>/etc/passwd</filename> directly. This means that other methods of
32915 holding password data (such as NIS) are supported. If the local part is a local
32916 user, <varname>$home</varname> is set from the password data, and can be tested in other
32917 preconditions that are evaluated after this one (the order of evaluation is
32918 given in section <xref linkend="SECTrouprecon"/>). However, the value of <varname>$home</varname> can be
32919 overridden by <option>router_home_directory</option>. If the local part is not a local user,
32920 the router is skipped.
32921 </para>
32922 <para>
32923 If you want to check that the local part is either the name of a local user
32924 or matches something else, you cannot combine <option>check_local_user</option> with a
32925 setting of <option>local_parts</option>, because that specifies the logical <emphasis>and</emphasis> of the
32926 two conditions. However, you can use a <command>passwd</command> lookup in a <option>local_parts</option>
32927 setting to achieve this. For example:
32928 </para>
32929 <literallayout class="monospaced">
32930 local_parts = passwd;$local_part : lsearch;/etc/other/users
32931 </literallayout>
32932 <para>
32933 Note, however, that the side effects of <option>check_local_user</option> (such as setting
32934 up a home directory) do not occur when a <command>passwd</command> lookup is used in a
32935 <option>local_parts</option> (or any other) precondition.
32936 </para>
32937 <para>
32938 <indexterm role="option">
32939 <primary><option>condition</option></primary>
32940 </indexterm>
32941 </para>
32942 <informaltable frame="all">
32943 <tgroup cols="4" colsep="0" rowsep="0">
32944 <colspec colwidth="8*" align="left"/>
32945 <colspec colwidth="6*" align="center"/>
32946 <colspec colwidth="6*" align="center"/>
32947 <colspec colwidth="6*" align="right"/>
32948 <tbody>
32949 <row>
32950 <entry><option>condition</option></entry>
32951 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
32952 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32953 <entry>Default: <emphasis>unset</emphasis></entry>
32954 </row>
32955 </tbody>
32956 </tgroup>
32957 </informaltable>
32958 <para>
32959 <indexterm role="concept">
32960 <primary>router</primary>
32961 <secondary>customized precondition</secondary>
32962 </indexterm>
32963 This option specifies a general precondition test that has to succeed for the
32964 router to be called. The <option>condition</option> option is the last precondition to be
32965 evaluated (see section <xref linkend="SECTrouprecon"/>). The string is expanded, and if the
32966 result is a forced failure, or an empty string, or one of the strings <quote>0</quote> or
32967 <quote>no</quote> or <quote>false</quote> (checked without regard to the case of the letters), the
32968 router is skipped, and the address is offered to the next one.
32969 </para>
32970 <para>
32971 If the result is any other value, the router is run (as this is the last
32972 precondition to be evaluated, all the other preconditions must be true).
32973 </para>
32974 <para>
32975 This option is unusual in that multiple <option>condition</option> options may be present.
32976 All <option>condition</option> options must succeed.
32977 </para>
32978 <para>
32979 The <option>condition</option> option provides a means of applying custom conditions to the
32980 running of routers. Note that in the case of a simple conditional expansion,
32981 the default expansion values are exactly what is wanted. For example:
32982 </para>
32983 <literallayout class="monospaced">
32984 condition = ${if &gt;{$message_age}{600}}
32985 </literallayout>
32986 <para>
32987 Because of the default behaviour of the string expansion, this is equivalent to
32988 </para>
32989 <literallayout class="monospaced">
32990 condition = ${if &gt;{$message_age}{600}{true}{}}
32991 </literallayout>
32992 <para>
32993 A multiple condition example, which succeeds:
32994 </para>
32995 <literallayout class="monospaced">
32996 condition = ${if &gt;{$message_age}{600}}
32997 condition = ${if !eq{${lc:$local_part}}{postmaster}}
32998 condition = foobar
32999 </literallayout>
33000 <para>
33001 If the expansion fails (other than forced failure) delivery is deferred. Some
33002 of the other precondition options are common special cases that could in fact
33003 be specified using <option>condition</option>.
33004 </para>
33005 <para>
33006 Historical note: We have <option>condition</option> on ACLs and on Routers.  Routers
33007 are far older, and use one set of semantics.  ACLs are newer and when
33008 they were created, the ACL <option>condition</option> process was given far stricter
33009 parse semantics.  The <option>bool{}</option> expansion condition uses the same rules as
33010 ACLs.  The <option>bool_lax{}</option> expansion condition uses the same rules as
33011 Routers.  More pointedly, the <option>bool_lax{}</option> was written to match the existing
33012 Router rules processing behavior.
33013 </para>
33014 <para>
33015 This is best illustrated in an example:
33016 </para>
33017 <literallayout class="monospaced">
33018 # If used in an ACL condition will fail with a syntax error, but
33019 # in a router condition any extra characters are treated as a string
33020
33021 $ exim -be '${if eq {${lc:GOOGLE.com}} {google.com}} {yes} {no}}'
33022 true {yes} {no}}
33023
33024 $ exim -be '${if eq {${lc:WHOIS.com}} {google.com}} {yes} {no}}'
33025  {yes} {no}}
33026 </literallayout>
33027 <para>
33028 In each example above, the <option>if</option> statement actually ends after
33029 <quote>{google.com}}</quote>.  Since no true or false braces were defined, the
33030 default <option>if</option> behavior is to return a boolean true or a null answer
33031 (which evaluates to false). The rest of the line is then treated as a
33032 string. So the first example resulted in the boolean answer <quote>true</quote>
33033 with the string <quote> {yes} {no}}</quote> appended to it. The second example
33034 resulted in the null output (indicating false) with the string
33035 <quote> {yes} {no}}</quote> appended to it.
33036 </para>
33037 <para>
33038 In fact you can put excess forward braces in too.  In the router
33039 <option>condition</option>, Exim&#x2019;s parser only looks for <quote>{</quote> symbols when they
33040 mean something, like after a <quote>$</quote> or when required as part of a
33041 conditional.  But otherwise <quote>{</quote> and <quote>}</quote> are treated as ordinary
33042 string characters.
33043 </para>
33044 <para>
33045 Thus, in a Router, the above expansion strings will both always evaluate
33046 true, as the result of expansion is a non-empty string which doesn&#x2019;t
33047 match an explicit false value.  This can be tricky to debug.  By
33048 contrast, in an ACL either of those strings will always result in an
33049 expansion error because the result doesn&#x2019;t look sufficiently boolean.
33050 </para>
33051 <para>
33052 <indexterm role="option">
33053 <primary><option>debug_print</option></primary>
33054 </indexterm>
33055 </para>
33056 <informaltable frame="all">
33057 <tgroup cols="4" colsep="0" rowsep="0">
33058 <colspec colwidth="8*" align="left"/>
33059 <colspec colwidth="6*" align="center"/>
33060 <colspec colwidth="6*" align="center"/>
33061 <colspec colwidth="6*" align="right"/>
33062 <tbody>
33063 <row>
33064 <entry><option>debug_print</option></entry>
33065 <entry>Use: <emphasis>routers</emphasis></entry>
33066 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33067 <entry>Default: <emphasis>unset</emphasis></entry>
33068 </row>
33069 </tbody>
33070 </tgroup>
33071 </informaltable>
33072 <para>
33073 <indexterm role="concept">
33074 <primary>testing</primary>
33075 <secondary>variables in drivers</secondary>
33076 </indexterm>
33077 If this option is set and debugging is enabled (see the <option>-d</option> command line
33078 option) or in address-testing mode (see the <option>-bt</option> command line option),
33079 the string is expanded and included in the debugging output.
33080 If expansion of the string fails, the error message is written to the debugging
33081 output, and Exim carries on processing.
33082 This option is provided to help with checking out the values of variables and
33083 so on when debugging router configurations. For example, if a <option>condition</option>
33084 option appears not to be working, <option>debug_print</option> can be used to output the
33085 variables it references. The output happens after checks for <option>domains</option>,
33086 <option>local_parts</option>, and <option>check_local_user</option> but before any other preconditions
33087 are tested. A newline is added to the text if it does not end with one.
33088 The variable <varname>$router_name</varname> contains the name of the router.
33089 </para>
33090 <para>
33091 <indexterm role="option">
33092 <primary><option>disable_logging</option></primary>
33093 </indexterm>
33094 </para>
33095 <informaltable frame="all">
33096 <tgroup cols="4" colsep="0" rowsep="0">
33097 <colspec colwidth="8*" align="left"/>
33098 <colspec colwidth="6*" align="center"/>
33099 <colspec colwidth="6*" align="center"/>
33100 <colspec colwidth="6*" align="right"/>
33101 <tbody>
33102 <row>
33103 <entry><option>disable_logging</option></entry>
33104 <entry>Use: <emphasis>routers</emphasis></entry>
33105 <entry>Type: <emphasis>boolean</emphasis></entry>
33106 <entry>Default: <emphasis>false</emphasis></entry>
33107 </row>
33108 </tbody>
33109 </tgroup>
33110 </informaltable>
33111 <para>
33112 If this option is set true, nothing is logged for any routing errors
33113 or for any deliveries caused by this router. You should not set this option
33114 unless you really, really know what you are doing. See also the generic
33115 transport option of the same name.
33116 </para>
33117 <para>
33118 <indexterm role="option">
33119 <primary><option>dnssec_request_domains</option></primary>
33120 </indexterm>
33121 </para>
33122 <informaltable frame="all">
33123 <tgroup cols="4" colsep="0" rowsep="0">
33124 <colspec colwidth="8*" align="left"/>
33125 <colspec colwidth="6*" align="center"/>
33126 <colspec colwidth="6*" align="center"/>
33127 <colspec colwidth="6*" align="right"/>
33128 <tbody>
33129 <row>
33130 <entry><option>dnssec_request_domains</option></entry>
33131 <entry>Use: <emphasis>routers</emphasis></entry>
33132 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
33133 <entry>Default: <emphasis>unset</emphasis></entry>
33134 </row>
33135 </tbody>
33136 </tgroup>
33137 </informaltable>
33138 <para>
33139 <indexterm role="concept">
33140 <primary>MX record</primary>
33141 <secondary>security</secondary>
33142 </indexterm>
33143 <indexterm role="concept">
33144 <primary>DNSSEC</primary>
33145 <secondary>MX lookup</secondary>
33146 </indexterm>
33147 <indexterm role="concept">
33148 <primary>security</primary>
33149 <secondary>MX lookup</secondary>
33150 </indexterm>
33151 <indexterm role="concept">
33152 <primary>DNS</primary>
33153 <secondary>DNSSEC</secondary>
33154 </indexterm>
33155 DNS lookups for domains matching <option>dnssec_request_domains</option> will be done with
33156 the dnssec request bit set.
33157 This applies to all of the SRV, MX, AAAA, A lookup sequence.
33158 </para>
33159 <para>
33160 <indexterm role="option">
33161 <primary><option>dnssec_require_domains</option></primary>
33162 </indexterm>
33163 </para>
33164 <informaltable frame="all">
33165 <tgroup cols="4" colsep="0" rowsep="0">
33166 <colspec colwidth="8*" align="left"/>
33167 <colspec colwidth="6*" align="center"/>
33168 <colspec colwidth="6*" align="center"/>
33169 <colspec colwidth="6*" align="right"/>
33170 <tbody>
33171 <row>
33172 <entry><option>dnssec_require_domains</option></entry>
33173 <entry>Use: <emphasis>routers</emphasis></entry>
33174 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
33175 <entry>Default: <emphasis>unset</emphasis></entry>
33176 </row>
33177 </tbody>
33178 </tgroup>
33179 </informaltable>
33180 <para>
33181 <indexterm role="concept">
33182 <primary>MX record</primary>
33183 <secondary>security</secondary>
33184 </indexterm>
33185 <indexterm role="concept">
33186 <primary>DNSSEC</primary>
33187 <secondary>MX lookup</secondary>
33188 </indexterm>
33189 <indexterm role="concept">
33190 <primary>security</primary>
33191 <secondary>MX lookup</secondary>
33192 </indexterm>
33193 <indexterm role="concept">
33194 <primary>DNS</primary>
33195 <secondary>DNSSEC</secondary>
33196 </indexterm>
33197 DNS lookups for domains matching <option>dnssec_require_domains</option> will be done with
33198 the dnssec request bit set.  Any returns not having the Authenticated Data bit
33199 (AD bit) set will be ignored and logged as a host-lookup failure.
33200 This applies to all of the SRV, MX, AAAA, A lookup sequence.
33201 </para>
33202 <para>
33203 <indexterm role="option">
33204 <primary><option>domains</option></primary>
33205 </indexterm>
33206 </para>
33207 <informaltable frame="all">
33208 <tgroup cols="4" colsep="0" rowsep="0">
33209 <colspec colwidth="8*" align="left"/>
33210 <colspec colwidth="6*" align="center"/>
33211 <colspec colwidth="6*" align="center"/>
33212 <colspec colwidth="6*" align="right"/>
33213 <tbody>
33214 <row>
33215 <entry><option>domains</option></entry>
33216 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
33217 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
33218 <entry>Default: <emphasis>unset</emphasis></entry>
33219 </row>
33220 </tbody>
33221 </tgroup>
33222 </informaltable>
33223 <para>
33224 <indexterm role="concept">
33225 <primary>router</primary>
33226 <secondary>restricting to specific domains</secondary>
33227 </indexterm>
33228 <indexterm role="variable">
33229 <primary><varname>$domain_data</varname></primary>
33230 </indexterm>
33231 If this option is set, the router is skipped unless the current domain matches
33232 the list. If the match is achieved by means of a file lookup, the data that the
33233 lookup returned for the domain is placed in <varname>$domain_data</varname> for use in string
33234 expansions of the driver&#x2019;s private options. See section <xref linkend="SECTrouprecon"/> for
33235 a list of the order in which preconditions are evaluated.
33236 </para>
33237 <para>
33238 <indexterm role="option">
33239 <primary><option>driver</option></primary>
33240 </indexterm>
33241 </para>
33242 <informaltable frame="all">
33243 <tgroup cols="4" colsep="0" rowsep="0">
33244 <colspec colwidth="8*" align="left"/>
33245 <colspec colwidth="6*" align="center"/>
33246 <colspec colwidth="6*" align="center"/>
33247 <colspec colwidth="6*" align="right"/>
33248 <tbody>
33249 <row>
33250 <entry><option>driver</option></entry>
33251 <entry>Use: <emphasis>routers</emphasis></entry>
33252 <entry>Type: <emphasis>string</emphasis></entry>
33253 <entry>Default: <emphasis>unset</emphasis></entry>
33254 </row>
33255 </tbody>
33256 </tgroup>
33257 </informaltable>
33258 <para>
33259 This option must always be set. It specifies which of the available routers is
33260 to be used.
33261 </para>
33262 <para>
33263 <indexterm role="option">
33264 <primary><option>dsn_lasthop</option></primary>
33265 </indexterm>
33266 </para>
33267 <informaltable frame="all">
33268 <tgroup cols="4" colsep="0" rowsep="0">
33269 <colspec colwidth="8*" align="left"/>
33270 <colspec colwidth="6*" align="center"/>
33271 <colspec colwidth="6*" align="center"/>
33272 <colspec colwidth="6*" align="right"/>
33273 <tbody>
33274 <row>
33275 <entry><option>dsn_lasthop</option></entry>
33276 <entry>Use: <emphasis>routers</emphasis></entry>
33277 <entry>Type: <emphasis>boolean</emphasis></entry>
33278 <entry>Default: <emphasis>false</emphasis></entry>
33279 </row>
33280 </tbody>
33281 </tgroup>
33282 </informaltable>
33283 <para>
33284 <indexterm role="concept">
33285 <primary>DSN</primary>
33286 <secondary>success</secondary>
33287 </indexterm>
33288 <indexterm role="concept">
33289 <primary>Delivery Status Notification</primary>
33290 <secondary>success</secondary>
33291 </indexterm>
33292 If this option is set true, and extended DSN (RFC3461) processing is in effect,
33293 Exim will not pass on DSN requests to downstream DSN-aware hosts but will
33294 instead send a success DSN as if the next hop does not support DSN.
33295 Not effective on redirect routers.
33296 </para>
33297 <para>
33298 <indexterm role="option">
33299 <primary><option>errors_to</option></primary>
33300 </indexterm>
33301 </para>
33302 <informaltable frame="all">
33303 <tgroup cols="4" colsep="0" rowsep="0">
33304 <colspec colwidth="8*" align="left"/>
33305 <colspec colwidth="6*" align="center"/>
33306 <colspec colwidth="6*" align="center"/>
33307 <colspec colwidth="6*" align="right"/>
33308 <tbody>
33309 <row>
33310 <entry><option>errors_to</option></entry>
33311 <entry>Use: <emphasis>routers</emphasis></entry>
33312 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33313 <entry>Default: <emphasis>unset</emphasis></entry>
33314 </row>
33315 </tbody>
33316 </tgroup>
33317 </informaltable>
33318 <para>
33319 <indexterm role="concept">
33320 <primary>envelope sender</primary>
33321 </indexterm>
33322 <indexterm role="concept">
33323 <primary>router</primary>
33324 <secondary>changing address for errors</secondary>
33325 </indexterm>
33326 If a router successfully handles an address, it may assign the address to a
33327 transport for delivery or it may generate child addresses. In both cases, if
33328 there is a delivery problem during later processing, the resulting bounce
33329 message is sent to the address that results from expanding this string,
33330 provided that the address verifies successfully. The <option>errors_to</option> option is
33331 expanded before <option>headers_add</option>, <option>headers_remove</option>, and <option>transport</option>.
33332 </para>
33333 <para>
33334 The <option>errors_to</option> setting associated with an address can be overridden if it
33335 subsequently passes through other routers that have their own <option>errors_to</option>
33336 settings, or if the message is delivered by a transport with a <option>return_path</option>
33337 setting.
33338 </para>
33339 <para>
33340 If <option>errors_to</option> is unset, or the expansion is forced to fail, or the result of
33341 the expansion fails to verify, the errors address associated with the incoming
33342 address is used. At top level, this is the envelope sender. A non-forced
33343 expansion failure causes delivery to be deferred.
33344 </para>
33345 <para>
33346 If an address for which <option>errors_to</option> has been set ends up being delivered over
33347 SMTP, the envelope sender for that delivery is the <option>errors_to</option> value, so that
33348 any bounces that are generated by other MTAs on the delivery route are also
33349 sent there. You can set <option>errors_to</option> to the empty string by either of these
33350 settings:
33351 </para>
33352 <literallayout class="monospaced">
33353 errors_to =
33354 errors_to = ""
33355 </literallayout>
33356 <para>
33357 An expansion item that yields an empty string has the same effect. If you do
33358 this, a locally detected delivery error for addresses processed by this router
33359 no longer gives rise to a bounce message; the error is discarded. If the
33360 address is delivered to a remote host, the return path is set to <literal>&lt;&gt;</literal>, unless
33361 overridden by the <option>return_path</option> option on the transport.
33362 </para>
33363 <para>
33364 <indexterm role="variable">
33365 <primary><varname>$address_data</varname></primary>
33366 </indexterm>
33367 If for some reason you want to discard local errors, but use a non-empty
33368 MAIL command for remote delivery, you can preserve the original return
33369 path in <varname>$address_data</varname> in the router, and reinstate it in the transport by
33370 setting <option>return_path</option>.
33371 </para>
33372 <para>
33373 The most common use of <option>errors_to</option> is to direct mailing list bounces to the
33374 manager of the list, as described in section <xref linkend="SECTmailinglists"/>, or to
33375 implement VERP (Variable Envelope Return Paths) (see section <xref linkend="SECTverp"/>).
33376 </para>
33377 <para>
33378 <indexterm role="option">
33379 <primary><option>expn</option></primary>
33380 </indexterm>
33381 </para>
33382 <informaltable frame="all">
33383 <tgroup cols="4" colsep="0" rowsep="0">
33384 <colspec colwidth="8*" align="left"/>
33385 <colspec colwidth="6*" align="center"/>
33386 <colspec colwidth="6*" align="center"/>
33387 <colspec colwidth="6*" align="right"/>
33388 <tbody>
33389 <row>
33390 <entry><option>expn</option></entry>
33391 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
33392 <entry>Type: <emphasis>boolean</emphasis></entry>
33393 <entry>Default: <emphasis>true</emphasis></entry>
33394 </row>
33395 </tbody>
33396 </tgroup>
33397 </informaltable>
33398 <para>
33399 <indexterm role="concept">
33400 <primary>address</primary>
33401 <secondary>testing</secondary>
33402 </indexterm>
33403 <indexterm role="concept">
33404 <primary>testing</primary>
33405 <secondary>addresses</secondary>
33406 </indexterm>
33407 <indexterm role="concept">
33408 <primary>EXPN</primary>
33409 <secondary>router skipping</secondary>
33410 </indexterm>
33411 <indexterm role="concept">
33412 <primary>router</primary>
33413 <secondary>skipping for EXPN</secondary>
33414 </indexterm>
33415 If this option is turned off, the router is skipped when testing an address
33416 as a result of processing an SMTP EXPN command. You might, for example,
33417 want to turn it off on a router for users&#x2019; <filename>.forward</filename> files, while leaving it
33418 on for the system alias file.
33419 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
33420 are evaluated.
33421 </para>
33422 <para>
33423 The use of the SMTP EXPN command is controlled by an ACL (see chapter
33424 <xref linkend="CHAPACL"/>). When Exim is running an EXPN command, it is similar to testing
33425 an address with <option>-bt</option>. Compare VRFY, whose counterpart is <option>-bv</option>.
33426 </para>
33427 <para>
33428 <indexterm role="option">
33429 <primary><option>fail_verify</option></primary>
33430 </indexterm>
33431 </para>
33432 <informaltable frame="all">
33433 <tgroup cols="4" colsep="0" rowsep="0">
33434 <colspec colwidth="8*" align="left"/>
33435 <colspec colwidth="6*" align="center"/>
33436 <colspec colwidth="6*" align="center"/>
33437 <colspec colwidth="6*" align="right"/>
33438 <tbody>
33439 <row>
33440 <entry><option>fail_verify</option></entry>
33441 <entry>Use: <emphasis>routers</emphasis></entry>
33442 <entry>Type: <emphasis>boolean</emphasis></entry>
33443 <entry>Default: <emphasis>false</emphasis></entry>
33444 </row>
33445 </tbody>
33446 </tgroup>
33447 </informaltable>
33448 <para>
33449 <indexterm role="concept">
33450 <primary>router</primary>
33451 <secondary>forcing verification failure</secondary>
33452 </indexterm>
33453 Setting this option has the effect of setting both <option>fail_verify_sender</option> and
33454 <option>fail_verify_recipient</option> to the same value.
33455 </para>
33456 <para>
33457 <indexterm role="option">
33458 <primary><option>fail_verify_recipient</option></primary>
33459 </indexterm>
33460 </para>
33461 <informaltable frame="all">
33462 <tgroup cols="4" colsep="0" rowsep="0">
33463 <colspec colwidth="8*" align="left"/>
33464 <colspec colwidth="6*" align="center"/>
33465 <colspec colwidth="6*" align="center"/>
33466 <colspec colwidth="6*" align="right"/>
33467 <tbody>
33468 <row>
33469 <entry><option>fail_verify_recipient</option></entry>
33470 <entry>Use: <emphasis>routers</emphasis></entry>
33471 <entry>Type: <emphasis>boolean</emphasis></entry>
33472 <entry>Default: <emphasis>false</emphasis></entry>
33473 </row>
33474 </tbody>
33475 </tgroup>
33476 </informaltable>
33477 <para>
33478 If this option is true and an address is accepted by this router when
33479 verifying a recipient, verification fails.
33480 </para>
33481 <para>
33482 <indexterm role="option">
33483 <primary><option>fail_verify_sender</option></primary>
33484 </indexterm>
33485 </para>
33486 <informaltable frame="all">
33487 <tgroup cols="4" colsep="0" rowsep="0">
33488 <colspec colwidth="8*" align="left"/>
33489 <colspec colwidth="6*" align="center"/>
33490 <colspec colwidth="6*" align="center"/>
33491 <colspec colwidth="6*" align="right"/>
33492 <tbody>
33493 <row>
33494 <entry><option>fail_verify_sender</option></entry>
33495 <entry>Use: <emphasis>routers</emphasis></entry>
33496 <entry>Type: <emphasis>boolean</emphasis></entry>
33497 <entry>Default: <emphasis>false</emphasis></entry>
33498 </row>
33499 </tbody>
33500 </tgroup>
33501 </informaltable>
33502 <para>
33503 If this option is true and an address is accepted by this router when
33504 verifying a sender, verification fails.
33505 </para>
33506 <para>
33507 <indexterm role="option">
33508 <primary><option>fallback_hosts</option></primary>
33509 </indexterm>
33510 </para>
33511 <informaltable frame="all">
33512 <tgroup cols="4" colsep="0" rowsep="0">
33513 <colspec colwidth="8*" align="left"/>
33514 <colspec colwidth="6*" align="center"/>
33515 <colspec colwidth="6*" align="center"/>
33516 <colspec colwidth="6*" align="right"/>
33517 <tbody>
33518 <row>
33519 <entry><option>fallback_hosts</option></entry>
33520 <entry>Use: <emphasis>routers</emphasis></entry>
33521 <entry>Type: <emphasis>string list</emphasis></entry>
33522 <entry>Default: <emphasis>unset</emphasis></entry>
33523 </row>
33524 </tbody>
33525 </tgroup>
33526 </informaltable>
33527 <para>
33528 <indexterm role="concept">
33529 <primary>router</primary>
33530 <secondary>fallback hosts</secondary>
33531 </indexterm>
33532 <indexterm role="concept">
33533 <primary>fallback</primary>
33534 <secondary>hosts specified on router</secondary>
33535 </indexterm>
33536 String expansion is not applied to this option. The argument must be a
33537 colon-separated list of host names or IP addresses. The list separator can be
33538 changed (see section <xref linkend="SECTlistconstruct"/>), and a port can be specified with
33539 each name or address. In fact, the format of each item is exactly the same as
33540 defined for the list of hosts in a <command>manualroute</command> router (see section
33541 <xref linkend="SECTformatonehostitem"/>).
33542 </para>
33543 <para>
33544 If a router queues an address for a remote transport, this host list is
33545 associated with the address, and used instead of the transport&#x2019;s fallback host
33546 list. If <option>hosts_randomize</option> is set on the transport, the order of the list is
33547 randomized for each use. See the <option>fallback_hosts</option> option of the <command>smtp</command>
33548 transport for further details.
33549 </para>
33550 <para>
33551 <indexterm role="option">
33552 <primary><option>group</option></primary>
33553 </indexterm>
33554 </para>
33555 <informaltable frame="all">
33556 <tgroup cols="4" colsep="0" rowsep="0">
33557 <colspec colwidth="8*" align="left"/>
33558 <colspec colwidth="6*" align="center"/>
33559 <colspec colwidth="6*" align="center"/>
33560 <colspec colwidth="6*" align="right"/>
33561 <tbody>
33562 <row>
33563 <entry><option>group</option></entry>
33564 <entry>Use: <emphasis>routers</emphasis></entry>
33565 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33566 <entry>Default: <emphasis>see below</emphasis></entry>
33567 </row>
33568 </tbody>
33569 </tgroup>
33570 </informaltable>
33571 <para>
33572 <indexterm role="concept">
33573 <primary>gid (group id)</primary>
33574 <secondary>local delivery</secondary>
33575 </indexterm>
33576 <indexterm role="concept">
33577 <primary>local transports</primary>
33578 <secondary>uid and gid</secondary>
33579 </indexterm>
33580 <indexterm role="concept">
33581 <primary>transport</primary>
33582 <secondary>local</secondary>
33583 </indexterm>
33584 <indexterm role="concept">
33585 <primary>router</primary>
33586 <secondary>setting group</secondary>
33587 </indexterm>
33588 When a router queues an address for a transport, and the transport does not
33589 specify a group, the group given here is used when running the delivery
33590 process.
33591 The group may be specified numerically or by name. If expansion fails, the
33592 error is logged and delivery is deferred.
33593 The default is unset, unless <option>check_local_user</option> is set, when the default
33594 is taken from the password information. See also <option>initgroups</option> and <option>user</option>
33595 and the discussion in chapter <xref linkend="CHAPenvironment"/>.
33596 </para>
33597 <para>
33598 <indexterm role="option">
33599 <primary><option>headers_add</option></primary>
33600 </indexterm>
33601 </para>
33602 <informaltable frame="all">
33603 <tgroup cols="4" colsep="0" rowsep="0">
33604 <colspec colwidth="8*" align="left"/>
33605 <colspec colwidth="6*" align="center"/>
33606 <colspec colwidth="6*" align="center"/>
33607 <colspec colwidth="6*" align="right"/>
33608 <tbody>
33609 <row>
33610 <entry><option>headers_add</option></entry>
33611 <entry>Use: <emphasis>routers</emphasis></entry>
33612 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
33613 <entry>Default: <emphasis>unset</emphasis></entry>
33614 </row>
33615 </tbody>
33616 </tgroup>
33617 </informaltable>
33618 <para>
33619 <indexterm role="concept">
33620 <primary>header lines</primary>
33621 <secondary>adding</secondary>
33622 </indexterm>
33623 <indexterm role="concept">
33624 <primary>router</primary>
33625 <secondary>adding header lines</secondary>
33626 </indexterm>
33627 This option specifies a list of text headers,
33628 newline-separated (by default, changeable in the usual way),
33629 that is associated with any addresses that are accepted by the router.
33630 Each item is separately expanded, at routing time.  However, this
33631 option has no effect when an address is just being verified. The way in which
33632 the text is used to add header lines at transport time is described in section
33633 <xref linkend="SECTheadersaddrem"/>. New header lines are not actually added until the
33634 message is in the process of being transported. This means that references to
33635 header lines in string expansions in the transport&#x2019;s configuration do not
33636 <quote>see</quote> the added header lines.
33637 </para>
33638 <para>
33639 The <option>headers_add</option> option is expanded after <option>errors_to</option>, but before
33640 <option>headers_remove</option> and <option>transport</option>. If an item is empty, or if
33641 an item expansion is forced to fail, the item has no effect. Other expansion
33642 failures are treated as configuration errors.
33643 </para>
33644 <para>
33645 Unlike most options, <option>headers_add</option> can be specified multiple times
33646 for a router; all listed headers are added.
33647 </para>
33648 <para>
33649 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_add</option> option cannot be used for a <command>redirect</command>
33650 router that has the <option>one_time</option> option set.
33651 </para>
33652 <para>
33653 <indexterm role="concept">
33654 <primary>duplicate addresses</primary>
33655 </indexterm>
33656 <indexterm role="option">
33657 <primary><option>unseen</option></primary>
33658 </indexterm>
33659 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
33660 additions are deleted when the address is passed on to subsequent routers.
33661 For a <option>redirect</option> router, if a generated address is the same as the incoming
33662 address, this can lead to duplicate addresses with different header
33663 modifications. Exim does not do duplicate deliveries (except, in certain
33664 circumstances, to pipes -- see section <xref linkend="SECTdupaddr"/>), but it is undefined
33665 which of the duplicates is discarded, so this ambiguous situation should be
33666 avoided. The <option>repeat_use</option> option of the <option>redirect</option> router may be of help.
33667 </para>
33668 <para>
33669 <indexterm role="option">
33670 <primary><option>headers_remove</option></primary>
33671 </indexterm>
33672 </para>
33673 <informaltable frame="all">
33674 <tgroup cols="4" colsep="0" rowsep="0">
33675 <colspec colwidth="8*" align="left"/>
33676 <colspec colwidth="6*" align="center"/>
33677 <colspec colwidth="6*" align="center"/>
33678 <colspec colwidth="6*" align="right"/>
33679 <tbody>
33680 <row>
33681 <entry><option>headers_remove</option></entry>
33682 <entry>Use: <emphasis>routers</emphasis></entry>
33683 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
33684 <entry>Default: <emphasis>unset</emphasis></entry>
33685 </row>
33686 </tbody>
33687 </tgroup>
33688 </informaltable>
33689 <para>
33690 <indexterm role="concept">
33691 <primary>header lines</primary>
33692 <secondary>removing</secondary>
33693 </indexterm>
33694 <indexterm role="concept">
33695 <primary>router</primary>
33696 <secondary>removing header lines</secondary>
33697 </indexterm>
33698 This option specifies a list of text headers,
33699 colon-separated (by default, changeable in the usual way),
33700 that is associated with any addresses that are accepted by the router.
33701 Each item is separately expanded, at routing time.  However, this
33702 option has no effect when an address is just being verified. The way in which
33703 the text is used to remove header lines at transport time is described in
33704 section <xref linkend="SECTheadersaddrem"/>. Header lines are not actually removed until
33705 the message is in the process of being transported. This means that references
33706 to header lines in string expansions in the transport&#x2019;s configuration still
33707 <quote>see</quote> the original header lines.
33708 </para>
33709 <para>
33710 The <option>headers_remove</option> option is expanded after <option>errors_to</option> and
33711 <option>headers_add</option>, but before <option>transport</option>. If an item expansion is forced to fail,
33712 the item has no effect. Other expansion failures are treated as configuration
33713 errors.
33714 </para>
33715 <para>
33716 Unlike most options, <option>headers_remove</option> can be specified multiple times
33717 for a router; all listed headers are removed.
33718 </para>
33719 <para>
33720 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_remove</option> option cannot be used for a <command>redirect</command>
33721 router that has the <option>one_time</option> option set.
33722 </para>
33723 <para>
33724 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
33725 removal requests are deleted when the address is passed on to subsequent
33726 routers, and this can lead to problems with duplicates -- see the similar
33727 warning for <option>headers_add</option> above.
33728 </para>
33729 <para>
33730 <emphasis role="bold">Warning 3</emphasis>: Because of the separate expansion of the list items,
33731 items that contain a list separator must have it doubled.
33732 To avoid this, change the list separator (<xref linkend="SECTlistsepchange"/>).
33733 </para>
33734 <para>
33735 <indexterm role="option">
33736 <primary><option>ignore_target_hosts</option></primary>
33737 </indexterm>
33738 </para>
33739 <informaltable frame="all">
33740 <tgroup cols="4" colsep="0" rowsep="0">
33741 <colspec colwidth="8*" align="left"/>
33742 <colspec colwidth="6*" align="center"/>
33743 <colspec colwidth="6*" align="center"/>
33744 <colspec colwidth="6*" align="right"/>
33745 <tbody>
33746 <row>
33747 <entry><option>ignore_target_hosts</option></entry>
33748 <entry>Use: <emphasis>routers</emphasis></entry>
33749 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
33750 <entry>Default: <emphasis>unset</emphasis></entry>
33751 </row>
33752 </tbody>
33753 </tgroup>
33754 </informaltable>
33755 <para>
33756 <indexterm role="concept">
33757 <primary>IP address</primary>
33758 <secondary>discarding</secondary>
33759 </indexterm>
33760 <indexterm role="concept">
33761 <primary>router</primary>
33762 <secondary>discarding IP addresses</secondary>
33763 </indexterm>
33764 Although this option is a host list, it should normally contain IP address
33765 entries rather than names. If any host that is looked up by the router has an
33766 IP address that matches an item in this list, Exim behaves as if that IP
33767 address did not exist. This option allows you to cope with rogue DNS entries
33768 like
33769 </para>
33770 <literallayout class="monospaced">
33771 remote.domain.example.  A  127.0.0.1
33772 </literallayout>
33773 <para>
33774 by setting
33775 </para>
33776 <literallayout class="monospaced">
33777 ignore_target_hosts = 127.0.0.1
33778 </literallayout>
33779 <para>
33780 on the relevant router. If all the hosts found by a <command>dnslookup</command> router are
33781 discarded in this way, the router declines. In a conventional configuration, an
33782 attempt to mail to such a domain would normally provoke the <quote>unrouteable
33783 domain</quote> error, and an attempt to verify an address in the domain would fail.
33784 Similarly, if <option>ignore_target_hosts</option> is set on an <command>ipliteral</command> router, the
33785 router declines if presented with one of the listed addresses.
33786 </para>
33787 <para>
33788 You can use this option to disable the use of IPv4 or IPv6 for mail delivery by
33789 means of the first or the second of the following settings, respectively:
33790 </para>
33791 <literallayout class="monospaced">
33792 ignore_target_hosts = 0.0.0.0/0
33793 ignore_target_hosts = &lt;; 0::0/0
33794 </literallayout>
33795 <para>
33796 The pattern in the first line matches all IPv4 addresses, whereas the pattern
33797 in the second line matches all IPv6 addresses.
33798 </para>
33799 <para>
33800 This option may also be useful for ignoring link-local and site-local IPv6
33801 addresses. Because, like all host lists, the value of <option>ignore_target_hosts</option>
33802 is expanded before use as a list, it is possible to make it dependent on the
33803 domain that is being routed.
33804 </para>
33805 <para>
33806 <indexterm role="variable">
33807 <primary><varname>$host_address</varname></primary>
33808 </indexterm>
33809 During its expansion, <varname>$host_address</varname> is set to the IP address that is being
33810 checked.
33811 </para>
33812 <para>
33813 <indexterm role="option">
33814 <primary><option>initgroups</option></primary>
33815 </indexterm>
33816 </para>
33817 <informaltable frame="all">
33818 <tgroup cols="4" colsep="0" rowsep="0">
33819 <colspec colwidth="8*" align="left"/>
33820 <colspec colwidth="6*" align="center"/>
33821 <colspec colwidth="6*" align="center"/>
33822 <colspec colwidth="6*" align="right"/>
33823 <tbody>
33824 <row>
33825 <entry><option>initgroups</option></entry>
33826 <entry>Use: <emphasis>routers</emphasis></entry>
33827 <entry>Type: <emphasis>boolean</emphasis></entry>
33828 <entry>Default: <emphasis>false</emphasis></entry>
33829 </row>
33830 </tbody>
33831 </tgroup>
33832 </informaltable>
33833 <para>
33834 <indexterm role="concept">
33835 <primary>additional groups</primary>
33836 </indexterm>
33837 <indexterm role="concept">
33838 <primary>groups</primary>
33839 <secondary>additional</secondary>
33840 </indexterm>
33841 <indexterm role="concept">
33842 <primary>local transports</primary>
33843 <secondary>uid and gid</secondary>
33844 </indexterm>
33845 <indexterm role="concept">
33846 <primary>transport</primary>
33847 <secondary>local</secondary>
33848 </indexterm>
33849 If the router queues an address for a transport, and this option is true, and
33850 the uid supplied by the router is not overridden by the transport, the
33851 <function>initgroups()</function> function is called when running the transport to ensure that
33852 any additional groups associated with the uid are set up. See also <option>group</option>
33853 and <option>user</option> and the discussion in chapter <xref linkend="CHAPenvironment"/>.
33854 </para>
33855 <para>
33856 <indexterm role="option">
33857 <primary><option>local_part_prefix</option></primary>
33858 </indexterm>
33859 </para>
33860 <informaltable frame="all">
33861 <tgroup cols="4" colsep="0" rowsep="0">
33862 <colspec colwidth="8*" align="left"/>
33863 <colspec colwidth="6*" align="center"/>
33864 <colspec colwidth="6*" align="center"/>
33865 <colspec colwidth="6*" align="right"/>
33866 <tbody>
33867 <row>
33868 <entry><option>local_part_prefix</option></entry>
33869 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
33870 <entry>Type: <emphasis>string list</emphasis></entry>
33871 <entry>Default: <emphasis>unset</emphasis></entry>
33872 </row>
33873 </tbody>
33874 </tgroup>
33875 </informaltable>
33876 <para>
33877 <indexterm role="concept">
33878 <primary>router</primary>
33879 <secondary>prefix for local part</secondary>
33880 </indexterm>
33881 <indexterm role="concept">
33882 <primary>prefix</primary>
33883 <secondary>for local part, used in router</secondary>
33884 </indexterm>
33885 If this option is set, the router is skipped unless the local part starts with
33886 one of the given strings, or <option>local_part_prefix_optional</option> is true. See
33887 section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions are
33888 evaluated.
33889 </para>
33890 <para>
33891 The list is scanned from left to right, and the first prefix that matches is
33892 used. A limited form of wildcard is available; if the prefix begins with an
33893 asterisk, it matches the longest possible sequence of arbitrary characters at
33894 the start of the local part. An asterisk should therefore always be followed by
33895 some character that does not occur in normal local parts.
33896 <indexterm role="concept">
33897 <primary>multiple mailboxes</primary>
33898 </indexterm>
33899 <indexterm role="concept">
33900 <primary>mailbox</primary>
33901 <secondary>multiple</secondary>
33902 </indexterm>
33903 Wildcarding can be used to set up multiple user mailboxes, as described in
33904 section <xref linkend="SECTmulbox"/>.
33905 </para>
33906 <para>
33907 <indexterm role="variable">
33908 <primary><varname>$local_part</varname></primary>
33909 </indexterm>
33910 <indexterm role="variable">
33911 <primary><varname>$local_part_prefix</varname></primary>
33912 </indexterm>
33913 During the testing of the <option>local_parts</option> option, and while the router is
33914 running, the prefix is removed from the local part, and is available in the
33915 expansion variable <varname>$local_part_prefix</varname>. When a message is being delivered, if
33916 the router accepts the address, this remains true during subsequent delivery by
33917 a transport. In particular, the local part that is transmitted in the RCPT
33918 command for LMTP, SMTP, and BSMTP deliveries has the prefix removed by default.
33919 This behaviour can be overridden by setting <option>rcpt_include_affixes</option> true on
33920 the relevant transport.
33921 </para>
33922 <para>
33923 When an address is being verified, <option>local_part_prefix</option> affects only the
33924 behaviour of the router. If the callout feature of verification is in use, this
33925 means that the full address, including the prefix, will be used during the
33926 callout.
33927 </para>
33928 <para>
33929 The prefix facility is commonly used to handle local parts of the form
33930 <option>owner-something</option>. Another common use is to support local parts of the form
33931 <option>real-username</option> to bypass a user&#x2019;s <filename>.forward</filename> file &ndash; helpful when trying
33932 to tell a user their forwarding is broken &ndash; by placing a router like this one
33933 immediately before the router that handles <filename>.forward</filename> files:
33934 </para>
33935 <literallayout class="monospaced">
33936 real_localuser:
33937   driver = accept
33938   local_part_prefix = real-
33939   check_local_user
33940   transport = local_delivery
33941 </literallayout>
33942 <para>
33943 For security, it would probably be a good idea to restrict the use of this
33944 router to locally-generated messages, using a condition such as this:
33945 </para>
33946 <literallayout class="monospaced">
33947   condition = ${if match {$sender_host_address}\
33948                          {\N^(|127\.0\.0\.1)$\N}}
33949 </literallayout>
33950 <para>
33951 If both <option>local_part_prefix</option> and <option>local_part_suffix</option> are set for a router,
33952 both conditions must be met if not optional. Care must be taken if wildcards
33953 are used in both a prefix and a suffix on the same router. Different
33954 separator characters must be used to avoid ambiguity.
33955 </para>
33956 <para>
33957 <indexterm role="option">
33958 <primary><option>local_part_prefix_optional</option></primary>
33959 </indexterm>
33960 </para>
33961 <informaltable frame="all">
33962 <tgroup cols="4" colsep="0" rowsep="0">
33963 <colspec colwidth="8*" align="left"/>
33964 <colspec colwidth="6*" align="center"/>
33965 <colspec colwidth="6*" align="center"/>
33966 <colspec colwidth="6*" align="right"/>
33967 <tbody>
33968 <row>
33969 <entry><option>local_part_prefix_optional</option></entry>
33970 <entry>Use: <emphasis>routers</emphasis></entry>
33971 <entry>Type: <emphasis>boolean</emphasis></entry>
33972 <entry>Default: <emphasis>false</emphasis></entry>
33973 </row>
33974 </tbody>
33975 </tgroup>
33976 </informaltable>
33977 <para>
33978 See <option>local_part_prefix</option> above.
33979 </para>
33980 <para>
33981 <indexterm role="option">
33982 <primary><option>local_part_suffix</option></primary>
33983 </indexterm>
33984 </para>
33985 <informaltable frame="all">
33986 <tgroup cols="4" colsep="0" rowsep="0">
33987 <colspec colwidth="8*" align="left"/>
33988 <colspec colwidth="6*" align="center"/>
33989 <colspec colwidth="6*" align="center"/>
33990 <colspec colwidth="6*" align="right"/>
33991 <tbody>
33992 <row>
33993 <entry><option>local_part_suffix</option></entry>
33994 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
33995 <entry>Type: <emphasis>string list</emphasis></entry>
33996 <entry>Default: <emphasis>unset</emphasis></entry>
33997 </row>
33998 </tbody>
33999 </tgroup>
34000 </informaltable>
34001 <para>
34002 <indexterm role="concept">
34003 <primary>router</primary>
34004 <secondary>suffix for local part</secondary>
34005 </indexterm>
34006 <indexterm role="concept">
34007 <primary>suffix for local part</primary>
34008 <secondary>used in router</secondary>
34009 </indexterm>
34010 This option operates in the same way as <option>local_part_prefix</option>, except that the
34011 local part must end (rather than start) with the given string, the
34012 <option>local_part_suffix_optional</option> option determines whether the suffix is
34013 mandatory, and the wildcard * character, if present, must be the last
34014 character of the suffix. This option facility is commonly used to handle local
34015 parts of the form <option>something-request</option> and multiple user mailboxes of the form
34016 <option>username-foo</option>.
34017 </para>
34018 <para>
34019 <indexterm role="option">
34020 <primary><option>local_part_suffix_optional</option></primary>
34021 </indexterm>
34022 </para>
34023 <informaltable frame="all">
34024 <tgroup cols="4" colsep="0" rowsep="0">
34025 <colspec colwidth="8*" align="left"/>
34026 <colspec colwidth="6*" align="center"/>
34027 <colspec colwidth="6*" align="center"/>
34028 <colspec colwidth="6*" align="right"/>
34029 <tbody>
34030 <row>
34031 <entry><option>local_part_suffix_optional</option></entry>
34032 <entry>Use: <emphasis>routers</emphasis></entry>
34033 <entry>Type: <emphasis>boolean</emphasis></entry>
34034 <entry>Default: <emphasis>false</emphasis></entry>
34035 </row>
34036 </tbody>
34037 </tgroup>
34038 </informaltable>
34039 <para>
34040 See <option>local_part_suffix</option> above.
34041 </para>
34042 <para>
34043 <indexterm role="option">
34044 <primary><option>local_parts</option></primary>
34045 </indexterm>
34046 </para>
34047 <informaltable frame="all">
34048 <tgroup cols="4" colsep="0" rowsep="0">
34049 <colspec colwidth="8*" align="left"/>
34050 <colspec colwidth="6*" align="center"/>
34051 <colspec colwidth="6*" align="center"/>
34052 <colspec colwidth="6*" align="right"/>
34053 <tbody>
34054 <row>
34055 <entry><option>local_parts</option></entry>
34056 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
34057 <entry>Type: <emphasis>local part list</emphasis>&dagger;<emphasis></emphasis></entry>
34058 <entry>Default: <emphasis>unset</emphasis></entry>
34059 </row>
34060 </tbody>
34061 </tgroup>
34062 </informaltable>
34063 <para>
34064 <indexterm role="concept">
34065 <primary>router</primary>
34066 <secondary>restricting to specific local parts</secondary>
34067 </indexterm>
34068 <indexterm role="concept">
34069 <primary>local part</primary>
34070 <secondary>checking in router</secondary>
34071 </indexterm>
34072 The router is run only if the local part of the address matches the list.
34073 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
34074 are evaluated, and
34075 section <xref linkend="SECTlocparlis"/> for a discussion of local part lists. Because the
34076 string is expanded, it is possible to make it depend on the domain, for
34077 example:
34078 </para>
34079 <literallayout class="monospaced">
34080 local_parts = dbm;/usr/local/specials/$domain
34081 </literallayout>
34082 <para>
34083 <indexterm role="variable">
34084 <primary><varname>$local_part_data</varname></primary>
34085 </indexterm>
34086 If the match is achieved by a lookup, the data that the lookup returned
34087 for the local part is placed in the variable <varname>$local_part_data</varname> for use in
34088 expansions of the router&#x2019;s private options. You might use this option, for
34089 example, if you have a large number of local virtual domains, and you want to
34090 send all postmaster mail to the same place without having to set up an alias in
34091 each virtual domain:
34092 </para>
34093 <literallayout class="monospaced">
34094 postmaster:
34095   driver = redirect
34096   local_parts = postmaster
34097   data = postmaster@real.domain.example
34098 </literallayout>
34099 <para>
34100 <indexterm role="option">
34101 <primary><option>log_as_local</option></primary>
34102 </indexterm>
34103 </para>
34104 <informaltable frame="all">
34105 <tgroup cols="4" colsep="0" rowsep="0">
34106 <colspec colwidth="8*" align="left"/>
34107 <colspec colwidth="6*" align="center"/>
34108 <colspec colwidth="6*" align="center"/>
34109 <colspec colwidth="6*" align="right"/>
34110 <tbody>
34111 <row>
34112 <entry><option>log_as_local</option></entry>
34113 <entry>Use: <emphasis>routers</emphasis></entry>
34114 <entry>Type: <emphasis>boolean</emphasis></entry>
34115 <entry>Default: <emphasis>see below</emphasis></entry>
34116 </row>
34117 </tbody>
34118 </tgroup>
34119 </informaltable>
34120 <para>
34121 <indexterm role="concept">
34122 <primary>log</primary>
34123 <secondary>delivery line</secondary>
34124 </indexterm>
34125 <indexterm role="concept">
34126 <primary>delivery</primary>
34127 <secondary>log line format</secondary>
34128 </indexterm>
34129 Exim has two logging styles for delivery, the idea being to make local
34130 deliveries stand out more visibly from remote ones. In the <quote>local</quote> style, the
34131 recipient address is given just as the local part, without a domain. The use of
34132 this style is controlled by this option. It defaults to true for the <command>accept</command>
34133 router, and false for all the others. This option applies only when a
34134 router assigns an address to a transport. It has no effect on routers that
34135 redirect addresses.
34136 </para>
34137 <para>
34138 <indexterm role="option">
34139 <primary><option>more</option></primary>
34140 </indexterm>
34141 </para>
34142 <informaltable frame="all">
34143 <tgroup cols="4" colsep="0" rowsep="0">
34144 <colspec colwidth="8*" align="left"/>
34145 <colspec colwidth="6*" align="center"/>
34146 <colspec colwidth="6*" align="center"/>
34147 <colspec colwidth="6*" align="right"/>
34148 <tbody>
34149 <row>
34150 <entry><option>more</option></entry>
34151 <entry>Use: <emphasis>routers</emphasis></entry>
34152 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
34153 <entry>Default: <emphasis>true</emphasis></entry>
34154 </row>
34155 </tbody>
34156 </tgroup>
34157 </informaltable>
34158 <para>
34159 The result of string expansion for this option must be a valid boolean value,
34160 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
34161 result causes an error, and delivery is deferred. If the expansion is forced to
34162 fail, the default value for the option (true) is used. Other failures cause
34163 delivery to be deferred.
34164 </para>
34165 <para>
34166 If this option is set false, and the router declines to handle the address, no
34167 further routers are tried, routing fails, and the address is bounced.
34168 <indexterm role="option">
34169 <primary><option>self</option></primary>
34170 </indexterm>
34171 However, if the router explicitly passes an address to the following router by
34172 means of the setting
34173 </para>
34174 <literallayout class="monospaced">
34175 self = pass
34176 </literallayout>
34177 <para>
34178 or otherwise, the setting of <option>more</option> is ignored. Also, the setting of <option>more</option>
34179 does not affect the behaviour if one of the precondition tests fails. In that
34180 case, the address is always passed to the next router.
34181 </para>
34182 <para>
34183 Note that <option>address_data</option> is not considered to be a precondition. If its
34184 expansion is forced to fail, the router declines, and the value of <option>more</option>
34185 controls what happens next.
34186 </para>
34187 <para>
34188 <indexterm role="option">
34189 <primary><option>pass_on_timeout</option></primary>
34190 </indexterm>
34191 </para>
34192 <informaltable frame="all">
34193 <tgroup cols="4" colsep="0" rowsep="0">
34194 <colspec colwidth="8*" align="left"/>
34195 <colspec colwidth="6*" align="center"/>
34196 <colspec colwidth="6*" align="center"/>
34197 <colspec colwidth="6*" align="right"/>
34198 <tbody>
34199 <row>
34200 <entry><option>pass_on_timeout</option></entry>
34201 <entry>Use: <emphasis>routers</emphasis></entry>
34202 <entry>Type: <emphasis>boolean</emphasis></entry>
34203 <entry>Default: <emphasis>false</emphasis></entry>
34204 </row>
34205 </tbody>
34206 </tgroup>
34207 </informaltable>
34208 <para>
34209 <indexterm role="concept">
34210 <primary>timeout</primary>
34211 <secondary>of router</secondary>
34212 </indexterm>
34213 <indexterm role="concept">
34214 <primary>router</primary>
34215 <secondary>timeout</secondary>
34216 </indexterm>
34217 If a router times out during a host lookup, it normally causes deferral of the
34218 address. If <option>pass_on_timeout</option> is set, the address is passed on to the next
34219 router, overriding <option>no_more</option>. This may be helpful for systems that are
34220 intermittently connected to the Internet, or those that want to pass to a smart
34221 host any messages that cannot immediately be delivered.
34222 </para>
34223 <para>
34224 There are occasional other temporary errors that can occur while doing DNS
34225 lookups. They are treated in the same way as a timeout, and this option
34226 applies to all of them.
34227 </para>
34228 <para>
34229 <indexterm role="option">
34230 <primary><option>pass_router</option></primary>
34231 </indexterm>
34232 </para>
34233 <informaltable frame="all">
34234 <tgroup cols="4" colsep="0" rowsep="0">
34235 <colspec colwidth="8*" align="left"/>
34236 <colspec colwidth="6*" align="center"/>
34237 <colspec colwidth="6*" align="center"/>
34238 <colspec colwidth="6*" align="right"/>
34239 <tbody>
34240 <row>
34241 <entry><option>pass_router</option></entry>
34242 <entry>Use: <emphasis>routers</emphasis></entry>
34243 <entry>Type: <emphasis>string</emphasis></entry>
34244 <entry>Default: <emphasis>unset</emphasis></entry>
34245 </row>
34246 </tbody>
34247 </tgroup>
34248 </informaltable>
34249 <para>
34250 <indexterm role="concept">
34251 <primary>router</primary>
34252 <secondary>go to after <quote>pass</quote></secondary>
34253 </indexterm>
34254 Routers that recognize the generic <option>self</option> option (<command>dnslookup</command>,
34255 <command>ipliteral</command>, and <command>manualroute</command>) are able to return <quote>pass</quote>, forcing
34256 routing to continue, and overriding a false setting of <option>more</option>. When one of
34257 these routers returns <quote>pass</quote>, the address is normally handed on to the next
34258 router in sequence. This can be changed by setting <option>pass_router</option> to the name
34259 of another router. However (unlike <option>redirect_router</option>) the named router must
34260 be below the current router, to avoid loops. Note that this option applies only
34261 to the special case of <quote>pass</quote>. It does not apply when a router returns
34262 <quote>decline</quote> because it cannot handle an address.
34263 </para>
34264 <para>
34265 <indexterm role="option">
34266 <primary><option>redirect_router</option></primary>
34267 </indexterm>
34268 </para>
34269 <informaltable frame="all">
34270 <tgroup cols="4" colsep="0" rowsep="0">
34271 <colspec colwidth="8*" align="left"/>
34272 <colspec colwidth="6*" align="center"/>
34273 <colspec colwidth="6*" align="center"/>
34274 <colspec colwidth="6*" align="right"/>
34275 <tbody>
34276 <row>
34277 <entry><option>redirect_router</option></entry>
34278 <entry>Use: <emphasis>routers</emphasis></entry>
34279 <entry>Type: <emphasis>string</emphasis></entry>
34280 <entry>Default: <emphasis>unset</emphasis></entry>
34281 </row>
34282 </tbody>
34283 </tgroup>
34284 </informaltable>
34285 <para>
34286 <indexterm role="concept">
34287 <primary>router</primary>
34288 <secondary>start at after redirection</secondary>
34289 </indexterm>
34290 Sometimes an administrator knows that it is pointless to reprocess addresses
34291 generated from alias or forward files with the same router again. For
34292 example, if an alias file translates real names into login ids there is no
34293 point searching the alias file a second time, especially if it is a large file.
34294 </para>
34295 <para>
34296 The <option>redirect_router</option> option can be set to the name of any router instance.
34297 It causes the routing of any generated addresses to start at the named router
34298 instead of at the first router. This option has no effect if the router in
34299 which it is set does not generate new addresses.
34300 </para>
34301 <para>
34302 <indexterm role="option">
34303 <primary><option>require_files</option></primary>
34304 </indexterm>
34305 </para>
34306 <informaltable frame="all">
34307 <tgroup cols="4" colsep="0" rowsep="0">
34308 <colspec colwidth="8*" align="left"/>
34309 <colspec colwidth="6*" align="center"/>
34310 <colspec colwidth="6*" align="center"/>
34311 <colspec colwidth="6*" align="right"/>
34312 <tbody>
34313 <row>
34314 <entry><option>require_files</option></entry>
34315 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
34316 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
34317 <entry>Default: <emphasis>unset</emphasis></entry>
34318 </row>
34319 </tbody>
34320 </tgroup>
34321 </informaltable>
34322 <para>
34323 <indexterm role="concept">
34324 <primary>file</primary>
34325 <secondary>requiring for router</secondary>
34326 </indexterm>
34327 <indexterm role="concept">
34328 <primary>router</primary>
34329 <secondary>requiring file existence</secondary>
34330 </indexterm>
34331 This option provides a general mechanism for predicating the running of a
34332 router on the existence or non-existence of certain files or directories.
34333 Before running a router, as one of its precondition tests, Exim works its way
34334 through the <option>require_files</option> list, expanding each item separately.
34335 </para>
34336 <para>
34337 Because the list is split before expansion, any colons in expansion items must
34338 be doubled, or the facility for using a different list separator must be used.
34339 If any expansion is forced to fail, the item is ignored. Other expansion
34340 failures cause routing of the address to be deferred.
34341 </para>
34342 <para>
34343 If any expanded string is empty, it is ignored. Otherwise, except as described
34344 below, each string must be a fully qualified file path, optionally preceded by
34345 <quote>!</quote>. The paths are passed to the <function>stat()</function> function to test for the
34346 existence of the files or directories. The router is skipped if any paths not
34347 preceded by <quote>!</quote> do not exist, or if any paths preceded by <quote>!</quote> do exist.
34348 </para>
34349 <para>
34350 <indexterm role="concept">
34351 <primary>NFS</primary>
34352 </indexterm>
34353 If <function>stat()</function> cannot determine whether a file exists or not, delivery of
34354 the message is deferred. This can happen when NFS-mounted filesystems are
34355 unavailable.
34356 </para>
34357 <para>
34358 This option is checked after the <option>domains</option>, <option>local_parts</option>, and <option>senders</option>
34359 options, so you cannot use it to check for the existence of a file in which to
34360 look up a domain, local part, or sender. (See section <xref linkend="SECTrouprecon"/> for a
34361 full list of the order in which preconditions are evaluated.) However, as
34362 these options are all expanded, you can use the <option>exists</option> expansion condition
34363 to make such tests. The <option>require_files</option> option is intended for checking files
34364 that the router may be going to use internally, or which are needed by a
34365 transport (for example <filename>.procmailrc</filename>).
34366 </para>
34367 <para>
34368 During delivery, the <function>stat()</function> function is run as root, but there is a
34369 facility for some checking of the accessibility of a file by another user.
34370 This is not a proper permissions check, but just a <quote>rough</quote> check that
34371 operates as follows:
34372 </para>
34373 <para>
34374 If an item in a <option>require_files</option> list does not contain any forward slash
34375 characters, it is taken to be the user (and optional group, separated by a
34376 comma) to be checked for subsequent files in the list. If no group is specified
34377 but the user is specified symbolically, the gid associated with the uid is
34378 used. For example:
34379 </para>
34380 <literallayout class="monospaced">
34381 require_files = mail:/some/file
34382 require_files = $local_part:$home/.procmailrc
34383 </literallayout>
34384 <para>
34385 If a user or group name in a <option>require_files</option> list does not exist, the
34386 <option>require_files</option> condition fails.
34387 </para>
34388 <para>
34389 Exim performs the check by scanning along the components of the file path, and
34390 checking the access for the given uid and gid. It checks for <quote>x</quote> access on
34391 directories, and <quote>r</quote> access on the final file. Note that this means that file
34392 access control lists, if the operating system has them, are ignored.
34393 </para>
34394 <para>
34395 <emphasis role="bold">Warning 1</emphasis>: When the router is being run to verify addresses for an
34396 incoming SMTP message, Exim is not running as root, but under its own uid. This
34397 may affect the result of a <option>require_files</option> check. In particular, <function>stat()</function>
34398 may yield the error EACCES (<quote>Permission denied</quote>). This means that the Exim
34399 user is not permitted to read one of the directories on the file&#x2019;s path.
34400 </para>
34401 <para>
34402 <emphasis role="bold">Warning 2</emphasis>: Even when Exim is running as root while delivering a message,
34403 <function>stat()</function> can yield EACCES for a file in an NFS directory that is mounted
34404 without root access. In this case, if a check for access by a particular user
34405 is requested, Exim creates a subprocess that runs as that user, and tries the
34406 check again in that process.
34407 </para>
34408 <para>
34409 The default action for handling an unresolved EACCES is to consider it to
34410 be caused by a configuration error, and routing is deferred because the
34411 existence or non-existence of the file cannot be determined. However, in some
34412 circumstances it may be desirable to treat this condition as if the file did
34413 not exist. If the file name (or the exclamation mark that precedes the file
34414 name for non-existence) is preceded by a plus sign, the EACCES error is treated
34415 as if the file did not exist. For example:
34416 </para>
34417 <literallayout class="monospaced">
34418 require_files = +/some/file
34419 </literallayout>
34420 <para>
34421 If the router is not an essential part of verification (for example, it
34422 handles users&#x2019; <filename>.forward</filename> files), another solution is to set the <option>verify</option>
34423 option false so that the router is skipped when verifying.
34424 </para>
34425 <para>
34426 <indexterm role="option">
34427 <primary><option>retry_use_local_part</option></primary>
34428 </indexterm>
34429 </para>
34430 <informaltable frame="all">
34431 <tgroup cols="4" colsep="0" rowsep="0">
34432 <colspec colwidth="8*" align="left"/>
34433 <colspec colwidth="6*" align="center"/>
34434 <colspec colwidth="6*" align="center"/>
34435 <colspec colwidth="6*" align="right"/>
34436 <tbody>
34437 <row>
34438 <entry><option>retry_use_local_part</option></entry>
34439 <entry>Use: <emphasis>routers</emphasis></entry>
34440 <entry>Type: <emphasis>boolean</emphasis></entry>
34441 <entry>Default: <emphasis>see below</emphasis></entry>
34442 </row>
34443 </tbody>
34444 </tgroup>
34445 </informaltable>
34446 <para>
34447 <indexterm role="concept">
34448 <primary>hints database</primary>
34449 <secondary>retry keys</secondary>
34450 </indexterm>
34451 <indexterm role="concept">
34452 <primary>local part</primary>
34453 <secondary>in retry keys</secondary>
34454 </indexterm>
34455 When a delivery suffers a temporary routing failure, a retry record is created
34456 in Exim&#x2019;s hints database. For addresses whose routing depends only on the
34457 domain, the key for the retry record should not involve the local part, but for
34458 other addresses, both the domain and the local part should be included.
34459 Usually, remote routing is of the former kind, and local routing is of the
34460 latter kind.
34461 </para>
34462 <para>
34463 This option controls whether the local part is used to form the key for retry
34464 hints for addresses that suffer temporary errors while being handled by this
34465 router. The default value is true for any router that has <option>check_local_user</option>
34466 set, and false otherwise. Note that this option does not apply to hints keys
34467 for transport delays; they are controlled by a generic transport option of the
34468 same name.
34469 </para>
34470 <para>
34471 The setting of <option>retry_use_local_part</option> applies only to the router on which it
34472 appears. If the router generates child addresses, they are routed
34473 independently; this setting does not become attached to them.
34474 </para>
34475 <para>
34476 <indexterm role="option">
34477 <primary><option>router_home_directory</option></primary>
34478 </indexterm>
34479 </para>
34480 <informaltable frame="all">
34481 <tgroup cols="4" colsep="0" rowsep="0">
34482 <colspec colwidth="8*" align="left"/>
34483 <colspec colwidth="6*" align="center"/>
34484 <colspec colwidth="6*" align="center"/>
34485 <colspec colwidth="6*" align="right"/>
34486 <tbody>
34487 <row>
34488 <entry><option>router_home_directory</option></entry>
34489 <entry>Use: <emphasis>routers</emphasis></entry>
34490 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34491 <entry>Default: <emphasis>unset</emphasis></entry>
34492 </row>
34493 </tbody>
34494 </tgroup>
34495 </informaltable>
34496 <para>
34497 <indexterm role="concept">
34498 <primary>router</primary>
34499 <secondary>home directory for</secondary>
34500 </indexterm>
34501 <indexterm role="concept">
34502 <primary>home directory</primary>
34503 <secondary>for router</secondary>
34504 </indexterm>
34505 <indexterm role="variable">
34506 <primary><varname>$home</varname></primary>
34507 </indexterm>
34508 This option sets a home directory for use while the router is running. (Compare
34509 <option>transport_home_directory</option>, which sets a home directory for later
34510 transporting.) In particular, if used on a <command>redirect</command> router, this option
34511 sets a value for <varname>$home</varname> while a filter is running. The value is expanded;
34512 forced expansion failure causes the option to be ignored &ndash; other failures
34513 cause the router to defer.
34514 </para>
34515 <para>
34516 Expansion of <option>router_home_directory</option> happens immediately after the
34517 <option>check_local_user</option> test (if configured), before any further expansions take
34518 place.
34519 (See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
34520 are evaluated.)
34521 While the router is running, <option>router_home_directory</option> overrides the value of
34522 <varname>$home</varname> that came from <option>check_local_user</option>.
34523 </para>
34524 <para>
34525 When a router accepts an address and assigns it to a local transport (including
34526 the cases when a <command>redirect</command> router generates a pipe, file, or autoreply
34527 delivery), the home directory setting for the transport is taken from the first
34528 of these values that is set:
34529 </para>
34530 <itemizedlist>
34531 <listitem>
34532 <para>
34533 The <option>home_directory</option> option on the transport;
34534 </para>
34535 </listitem>
34536 <listitem>
34537 <para>
34538 The <option>transport_home_directory</option> option on the router;
34539 </para>
34540 </listitem>
34541 <listitem>
34542 <para>
34543 The password data if <option>check_local_user</option> is set on the router;
34544 </para>
34545 </listitem>
34546 <listitem>
34547 <para>
34548 The <option>router_home_directory</option> option on the router.
34549 </para>
34550 </listitem>
34551 </itemizedlist>
34552 <para>
34553 In other words, <option>router_home_directory</option> overrides the password data for the
34554 router, but not for the transport.
34555 </para>
34556 <para>
34557 <indexterm role="option">
34558 <primary><option>self</option></primary>
34559 </indexterm>
34560 </para>
34561 <informaltable frame="all">
34562 <tgroup cols="4" colsep="0" rowsep="0">
34563 <colspec colwidth="8*" align="left"/>
34564 <colspec colwidth="6*" align="center"/>
34565 <colspec colwidth="6*" align="center"/>
34566 <colspec colwidth="6*" align="right"/>
34567 <tbody>
34568 <row>
34569 <entry><option>self</option></entry>
34570 <entry>Use: <emphasis>routers</emphasis></entry>
34571 <entry>Type: <emphasis>string</emphasis></entry>
34572 <entry>Default: <emphasis>freeze</emphasis></entry>
34573 </row>
34574 </tbody>
34575 </tgroup>
34576 </informaltable>
34577 <para>
34578 <indexterm role="concept">
34579 <primary>MX record</primary>
34580 <secondary>pointing to local host</secondary>
34581 </indexterm>
34582 <indexterm role="concept">
34583 <primary>local host</primary>
34584 <secondary>MX pointing to</secondary>
34585 </indexterm>
34586 This option applies to those routers that use a recipient address to find a
34587 list of remote hosts. Currently, these are the <command>dnslookup</command>, <command>ipliteral</command>,
34588 and <command>manualroute</command> routers.
34589 Certain configurations of the <command>queryprogram</command> router can also specify a list
34590 of remote hosts.
34591 Usually such routers are configured to send the message to a remote host via an
34592 <command>smtp</command> transport. The <option>self</option> option specifies what happens when the first
34593 host on the list turns out to be the local host.
34594 The way in which Exim checks for the local host is described in section
34595 <xref linkend="SECTreclocipadd"/>.
34596 </para>
34597 <para>
34598 Normally this situation indicates either an error in Exim&#x2019;s configuration (for
34599 example, the router should be configured not to process this domain), or an
34600 error in the DNS (for example, the MX should not point to this host). For this
34601 reason, the default action is to log the incident, defer the address, and
34602 freeze the message. The following alternatives are provided for use in special
34603 cases:
34604 </para>
34605 <variablelist>
34606 <varlistentry>
34607 <term><option>defer</option></term>
34608 <listitem>
34609 <para>
34610 Delivery of the message is tried again later, but the message is not frozen.
34611 </para>
34612 </listitem></varlistentry>
34613 <varlistentry>
34614 <term><option>reroute</option>: &lt;<emphasis>domain</emphasis>&gt;</term>
34615 <listitem>
34616 <para>
34617 The domain is changed to the given domain, and the address is passed back to
34618 be reprocessed by the routers. No rewriting of headers takes place. This
34619 behaviour is essentially a redirection.
34620 </para>
34621 </listitem></varlistentry>
34622 <varlistentry>
34623 <term><option>reroute: rewrite:</option> &lt;<emphasis>domain</emphasis>&gt;</term>
34624 <listitem>
34625 <para>
34626 The domain is changed to the given domain, and the address is passed back to be
34627 reprocessed by the routers. Any headers that contain the original domain are
34628 rewritten.
34629 </para>
34630 </listitem></varlistentry>
34631 <varlistentry>
34632 <term><option>pass</option></term>
34633 <listitem>
34634 <para>
34635 <indexterm role="option">
34636 <primary><option>more</option></primary>
34637 </indexterm>
34638 <indexterm role="variable">
34639 <primary><varname>$self_hostname</varname></primary>
34640 </indexterm>
34641 The router passes the address to the next router, or to the router named in the
34642 <option>pass_router</option> option if it is set. This overrides <option>no_more</option>. During
34643 subsequent routing and delivery, the variable <varname>$self_hostname</varname> contains the
34644 name of the local host that the router encountered. This can be used to
34645 distinguish between different cases for hosts with multiple names. The
34646 combination
34647 </para>
34648 <literallayout class="monospaced">
34649 self = pass
34650 no_more
34651 </literallayout>
34652 <para>
34653 ensures that only those addresses that routed to the local host are passed on.
34654 Without <option>no_more</option>, addresses that were declined for other reasons would also
34655 be passed to the next router.
34656 </para>
34657 </listitem></varlistentry>
34658 <varlistentry>
34659 <term><option>fail</option></term>
34660 <listitem>
34661 <para>
34662 Delivery fails and an error report is generated.
34663 </para>
34664 </listitem></varlistentry>
34665 <varlistentry>
34666 <term><option>send</option></term>
34667 <listitem>
34668 <para>
34669 <indexterm role="concept">
34670 <primary>local host</primary>
34671 <secondary>sending to</secondary>
34672 </indexterm>
34673 The anomaly is ignored and the address is queued for the transport. This
34674 setting should be used with extreme caution. For an <command>smtp</command> transport, it
34675 makes sense only in cases where the program that is listening on the SMTP port
34676 is not this version of Exim. That is, it must be some other MTA, or Exim with a
34677 different configuration file that handles the domain in another way.
34678 </para>
34679 </listitem></varlistentry>
34680 </variablelist>
34681 <para>
34682 <indexterm role="option">
34683 <primary><option>senders</option></primary>
34684 </indexterm>
34685 </para>
34686 <informaltable frame="all">
34687 <tgroup cols="4" colsep="0" rowsep="0">
34688 <colspec colwidth="8*" align="left"/>
34689 <colspec colwidth="6*" align="center"/>
34690 <colspec colwidth="6*" align="center"/>
34691 <colspec colwidth="6*" align="right"/>
34692 <tbody>
34693 <row>
34694 <entry><option>senders</option></entry>
34695 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
34696 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
34697 <entry>Default: <emphasis>unset</emphasis></entry>
34698 </row>
34699 </tbody>
34700 </tgroup>
34701 </informaltable>
34702 <para>
34703 <indexterm role="concept">
34704 <primary>router</primary>
34705 <secondary>checking senders</secondary>
34706 </indexterm>
34707 If this option is set, the router is skipped unless the message&#x2019;s sender
34708 address matches something on the list.
34709 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
34710 are evaluated.
34711 </para>
34712 <para>
34713 There are issues concerning verification when the running of routers is
34714 dependent on the sender. When Exim is verifying the address in an <option>errors_to</option>
34715 setting, it sets the sender to the null string. When using the <option>-bt</option> option
34716 to check a configuration file, it is necessary also to use the <option>-f</option> option to
34717 set an appropriate sender. For incoming mail, the sender is unset when
34718 verifying the sender, but is available when verifying any recipients. If the
34719 SMTP VRFY command is enabled, it must be used after MAIL if the sender address
34720 matters.
34721 </para>
34722 <para>
34723 <indexterm role="option">
34724 <primary><option>translate_ip_address</option></primary>
34725 </indexterm>
34726 </para>
34727 <informaltable frame="all">
34728 <tgroup cols="4" colsep="0" rowsep="0">
34729 <colspec colwidth="8*" align="left"/>
34730 <colspec colwidth="6*" align="center"/>
34731 <colspec colwidth="6*" align="center"/>
34732 <colspec colwidth="6*" align="right"/>
34733 <tbody>
34734 <row>
34735 <entry><option>translate_ip_address</option></entry>
34736 <entry>Use: <emphasis>routers</emphasis></entry>
34737 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34738 <entry>Default: <emphasis>unset</emphasis></entry>
34739 </row>
34740 </tbody>
34741 </tgroup>
34742 </informaltable>
34743 <para>
34744 <indexterm role="concept">
34745 <primary>IP address</primary>
34746 <secondary>translating</secondary>
34747 </indexterm>
34748 <indexterm role="concept">
34749 <primary>packet radio</primary>
34750 </indexterm>
34751 <indexterm role="concept">
34752 <primary>router</primary>
34753 <secondary>IP address translation</secondary>
34754 </indexterm>
34755 There exist some rare networking situations (for example, packet radio) where
34756 it is helpful to be able to translate IP addresses generated by normal routing
34757 mechanisms into other IP addresses, thus performing a kind of manual IP
34758 routing. This should be done only if the normal IP routing of the TCP/IP stack
34759 is inadequate or broken. Because this is an extremely uncommon requirement, the
34760 code to support this option is not included in the Exim binary unless
34761 SUPPORT_TRANSLATE_IP_ADDRESS=yes is set in <filename>Local/Makefile</filename>.
34762 </para>
34763 <para>
34764 <indexterm role="variable">
34765 <primary><varname>$host_address</varname></primary>
34766 </indexterm>
34767 The <option>translate_ip_address</option> string is expanded for every IP address generated
34768 by the router, with the generated address set in <varname>$host_address</varname>. If the
34769 expansion is forced to fail, no action is taken.
34770 For any other expansion error, delivery of the message is deferred.
34771 If the result of the expansion is an IP address, that replaces the original
34772 address; otherwise the result is assumed to be a host name &ndash; this is looked
34773 up using <function>gethostbyname()</function> (or <function>getipnodebyname()</function> when available) to
34774 produce one or more replacement IP addresses. For example, to subvert all IP
34775 addresses in some specific networks, this could be added to a router:
34776 </para>
34777 <literallayout class="monospaced">
34778 translate_ip_address = \
34779   ${lookup{${mask:$host_address/26}}lsearch{/some/file}\
34780     {$value}fail}}
34781 </literallayout>
34782 <para>
34783 The file would contain lines like
34784 </para>
34785 <literallayout class="monospaced">
34786 10.2.3.128/26    some.host
34787 10.8.4.34/26     10.44.8.15
34788 </literallayout>
34789 <para>
34790 You should not make use of this facility unless you really understand what you
34791 are doing.
34792 </para>
34793 <para>
34794 <indexterm role="option">
34795 <primary><option>transport</option></primary>
34796 </indexterm>
34797 </para>
34798 <informaltable frame="all">
34799 <tgroup cols="4" colsep="0" rowsep="0">
34800 <colspec colwidth="8*" align="left"/>
34801 <colspec colwidth="6*" align="center"/>
34802 <colspec colwidth="6*" align="center"/>
34803 <colspec colwidth="6*" align="right"/>
34804 <tbody>
34805 <row>
34806 <entry><option>transport</option></entry>
34807 <entry>Use: <emphasis>routers</emphasis></entry>
34808 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34809 <entry>Default: <emphasis>unset</emphasis></entry>
34810 </row>
34811 </tbody>
34812 </tgroup>
34813 </informaltable>
34814 <para>
34815 This option specifies the transport to be used when a router accepts an address
34816 and sets it up for delivery. A transport is never needed if a router is used
34817 only for verification. The value of the option is expanded at routing time,
34818 after the expansion of <option>errors_to</option>, <option>headers_add</option>, and <option>headers_remove</option>,
34819 and result must be the name of one of the configured transports. If it is not,
34820 delivery is deferred.
34821 </para>
34822 <para>
34823 The <option>transport</option> option is not used by the <command>redirect</command> router, but it does
34824 have some private options that set up transports for pipe and file deliveries
34825 (see chapter <xref linkend="CHAPredirect"/>).
34826 </para>
34827 <para>
34828 <indexterm role="option">
34829 <primary><option>transport_current_directory</option></primary>
34830 </indexterm>
34831 </para>
34832 <informaltable frame="all">
34833 <tgroup cols="4" colsep="0" rowsep="0">
34834 <colspec colwidth="8*" align="left"/>
34835 <colspec colwidth="6*" align="center"/>
34836 <colspec colwidth="6*" align="center"/>
34837 <colspec colwidth="6*" align="right"/>
34838 <tbody>
34839 <row>
34840 <entry><option>transport_current_directory</option></entry>
34841 <entry>Use: <emphasis>routers</emphasis></entry>
34842 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34843 <entry>Default: <emphasis>unset</emphasis></entry>
34844 </row>
34845 </tbody>
34846 </tgroup>
34847 </informaltable>
34848 <para>
34849 <indexterm role="concept">
34850 <primary>current directory for local transport</primary>
34851 </indexterm>
34852 This option associates a current directory with any address that is routed
34853 to a local transport. This can happen either because a transport is
34854 explicitly configured for the router, or because it generates a delivery to a
34855 file or a pipe. During the delivery process (that is, at transport time), this
34856 option string is expanded and is set as the current directory, unless
34857 overridden by a setting on the transport.
34858 If the expansion fails for any reason, including forced failure, an error is
34859 logged, and delivery is deferred.
34860 See chapter <xref linkend="CHAPenvironment"/> for details of the local delivery
34861 environment.
34862 </para>
34863 <para>
34864 <indexterm role="option">
34865 <primary><option>transport_home_directory</option></primary>
34866 </indexterm>
34867 </para>
34868 <informaltable frame="all">
34869 <tgroup cols="4" colsep="0" rowsep="0">
34870 <colspec colwidth="8*" align="left"/>
34871 <colspec colwidth="6*" align="center"/>
34872 <colspec colwidth="6*" align="center"/>
34873 <colspec colwidth="6*" align="right"/>
34874 <tbody>
34875 <row>
34876 <entry><option>transport_home_directory</option></entry>
34877 <entry>Use: <emphasis>routers</emphasis></entry>
34878 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34879 <entry>Default: <emphasis>see below</emphasis></entry>
34880 </row>
34881 </tbody>
34882 </tgroup>
34883 </informaltable>
34884 <para>
34885 <indexterm role="concept">
34886 <primary>home directory</primary>
34887 <secondary>for local transport</secondary>
34888 </indexterm>
34889 This option associates a home directory with any address that is routed to a
34890 local transport. This can happen either because a transport is explicitly
34891 configured for the router, or because it generates a delivery to a file or a
34892 pipe. During the delivery process (that is, at transport time), the option
34893 string is expanded and is set as the home directory, unless overridden by a
34894 setting of <option>home_directory</option> on the transport.
34895 If the expansion fails for any reason, including forced failure, an error is
34896 logged, and delivery is deferred.
34897 </para>
34898 <para>
34899 If the transport does not specify a home directory, and
34900 <option>transport_home_directory</option> is not set for the router, the home directory for
34901 the transport is taken from the password data if <option>check_local_user</option> is set for
34902 the router. Otherwise it is taken from <option>router_home_directory</option> if that option
34903 is set; if not, no home directory is set for the transport.
34904 </para>
34905 <para>
34906 See chapter <xref linkend="CHAPenvironment"/> for further details of the local delivery
34907 environment.
34908 </para>
34909 <para>
34910 <indexterm role="option">
34911 <primary><option>unseen</option></primary>
34912 </indexterm>
34913 </para>
34914 <informaltable frame="all">
34915 <tgroup cols="4" colsep="0" rowsep="0">
34916 <colspec colwidth="8*" align="left"/>
34917 <colspec colwidth="6*" align="center"/>
34918 <colspec colwidth="6*" align="center"/>
34919 <colspec colwidth="6*" align="right"/>
34920 <tbody>
34921 <row>
34922 <entry><option>unseen</option></entry>
34923 <entry>Use: <emphasis>routers</emphasis></entry>
34924 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
34925 <entry>Default: <emphasis>false</emphasis></entry>
34926 </row>
34927 </tbody>
34928 </tgroup>
34929 </informaltable>
34930 <para>
34931 <indexterm role="concept">
34932 <primary>router</primary>
34933 <secondary>carrying on after success</secondary>
34934 </indexterm>
34935 The result of string expansion for this option must be a valid boolean value,
34936 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
34937 result causes an error, and delivery is deferred. If the expansion is forced to
34938 fail, the default value for the option (false) is used. Other failures cause
34939 delivery to be deferred.
34940 </para>
34941 <para>
34942 When this option is set true, routing does not cease if the router accepts the
34943 address. Instead, a copy of the incoming address is passed to the next router,
34944 overriding a false setting of <option>more</option>. There is little point in setting
34945 <option>more</option> false if <option>unseen</option> is always true, but it may be useful in cases when
34946 the value of <option>unseen</option> contains expansion items (and therefore, presumably, is
34947 sometimes true and sometimes false).
34948 </para>
34949 <para>
34950 <indexterm role="concept">
34951 <primary>copy of message (<option>unseen</option> option)</primary>
34952 </indexterm>
34953 Setting the <option>unseen</option> option has a similar effect to the <option>unseen</option> command
34954 qualifier in filter files. It can be used to cause copies of messages to be
34955 delivered to some other destination, while also carrying out a normal delivery.
34956 In effect, the current address is made into a <quote>parent</quote> that has two children
34957 &ndash; one that is delivered as specified by this router, and a clone that goes on
34958 to be routed further. For this reason, <option>unseen</option> may not be combined with the
34959 <option>one_time</option> option in a <command>redirect</command> router.
34960 </para>
34961 <para>
34962 <emphasis role="bold">Warning</emphasis>: Header lines added to the address (or specified for removal) by
34963 this router or by previous routers affect the <quote>unseen</quote> copy of the message
34964 only. The clone that continues to be processed by further routers starts with
34965 no added headers and none specified for removal. For a <option>redirect</option> router, if
34966 a generated address is the same as the incoming address, this can lead to
34967 duplicate addresses with different header modifications. Exim does not do
34968 duplicate deliveries (except, in certain circumstances, to pipes -- see section
34969 <xref linkend="SECTdupaddr"/>), but it is undefined which of the duplicates is discarded,
34970 so this ambiguous situation should be avoided. The <option>repeat_use</option> option of the
34971 <option>redirect</option> router may be of help.
34972 </para>
34973 <para>
34974 Unlike the handling of header modifications, any data that was set by the
34975 <option>address_data</option> option in the current or previous routers <emphasis>is</emphasis> passed on to
34976 subsequent routers.
34977 </para>
34978 <para>
34979 <indexterm role="option">
34980 <primary><option>user</option></primary>
34981 </indexterm>
34982 </para>
34983 <informaltable frame="all">
34984 <tgroup cols="4" colsep="0" rowsep="0">
34985 <colspec colwidth="8*" align="left"/>
34986 <colspec colwidth="6*" align="center"/>
34987 <colspec colwidth="6*" align="center"/>
34988 <colspec colwidth="6*" align="right"/>
34989 <tbody>
34990 <row>
34991 <entry><option>user</option></entry>
34992 <entry>Use: <emphasis>routers</emphasis></entry>
34993 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34994 <entry>Default: <emphasis>see below</emphasis></entry>
34995 </row>
34996 </tbody>
34997 </tgroup>
34998 </informaltable>
34999 <para>
35000 <indexterm role="concept">
35001 <primary>uid (user id)</primary>
35002 <secondary>local delivery</secondary>
35003 </indexterm>
35004 <indexterm role="concept">
35005 <primary>local transports</primary>
35006 <secondary>uid and gid</secondary>
35007 </indexterm>
35008 <indexterm role="concept">
35009 <primary>transport</primary>
35010 <secondary>local</secondary>
35011 </indexterm>
35012 <indexterm role="concept">
35013 <primary>router</primary>
35014 <secondary>user for filter processing</secondary>
35015 </indexterm>
35016 <indexterm role="concept">
35017 <primary>filter</primary>
35018 <secondary>user for processing</secondary>
35019 </indexterm>
35020 When a router queues an address for a transport, and the transport does not
35021 specify a user, the user given here is used when running the delivery process.
35022 The user may be specified numerically or by name. If expansion fails, the
35023 error is logged and delivery is deferred.
35024 This user is also used by the <command>redirect</command> router when running a filter file.
35025 The default is unset, except when <option>check_local_user</option> is set. In this case,
35026 the default is taken from the password information. If the user is specified as
35027 a name, and <option>group</option> is not set, the group associated with the user is used.
35028 See also <option>initgroups</option> and <option>group</option> and the discussion in chapter
35029 <xref linkend="CHAPenvironment"/>.
35030 </para>
35031 <para>
35032 <indexterm role="option">
35033 <primary><option>verify</option></primary>
35034 </indexterm>
35035 </para>
35036 <informaltable frame="all">
35037 <tgroup cols="4" colsep="0" rowsep="0">
35038 <colspec colwidth="8*" align="left"/>
35039 <colspec colwidth="6*" align="center"/>
35040 <colspec colwidth="6*" align="center"/>
35041 <colspec colwidth="6*" align="right"/>
35042 <tbody>
35043 <row>
35044 <entry><option>verify</option></entry>
35045 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
35046 <entry>Type: <emphasis>boolean</emphasis></entry>
35047 <entry>Default: <emphasis>true</emphasis></entry>
35048 </row>
35049 </tbody>
35050 </tgroup>
35051 </informaltable>
35052 <para>
35053 Setting this option has the effect of setting <option>verify_sender</option> and
35054 <option>verify_recipient</option> to the same value.
35055 </para>
35056 <para>
35057 <indexterm role="option">
35058 <primary><option>verify_only</option></primary>
35059 </indexterm>
35060 </para>
35061 <informaltable frame="all">
35062 <tgroup cols="4" colsep="0" rowsep="0">
35063 <colspec colwidth="8*" align="left"/>
35064 <colspec colwidth="6*" align="center"/>
35065 <colspec colwidth="6*" align="center"/>
35066 <colspec colwidth="6*" align="right"/>
35067 <tbody>
35068 <row>
35069 <entry><option>verify_only</option></entry>
35070 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
35071 <entry>Type: <emphasis>boolean</emphasis></entry>
35072 <entry>Default: <emphasis>false</emphasis></entry>
35073 </row>
35074 </tbody>
35075 </tgroup>
35076 </informaltable>
35077 <para>
35078 <indexterm role="concept">
35079 <primary>EXPN</primary>
35080 <secondary>with <option>verify_only</option></secondary>
35081 </indexterm>
35082 <indexterm role="option">
35083 <primary><option>-bv</option></primary>
35084 </indexterm>
35085 <indexterm role="concept">
35086 <primary>router</primary>
35087 <secondary>used only when verifying</secondary>
35088 </indexterm>
35089 If this option is set, the router is used only when verifying an address,
35090 delivering in cutthrough mode or
35091 testing with the <option>-bv</option> option, not when actually doing a delivery, testing
35092 with the <option>-bt</option> option, or running the SMTP EXPN command. It can be further
35093 restricted to verifying only senders or recipients by means of
35094 <option>verify_sender</option> and <option>verify_recipient</option>.
35095 </para>
35096 <para>
35097 <emphasis role="bold">Warning</emphasis>: When the router is being run to verify addresses for an incoming
35098 SMTP message, Exim is not running as root, but under its own uid. If the router
35099 accesses any files, you need to make sure that they are accessible to the Exim
35100 user or group.
35101 </para>
35102 <para>
35103 <indexterm role="option">
35104 <primary><option>verify_recipient</option></primary>
35105 </indexterm>
35106 </para>
35107 <informaltable frame="all">
35108 <tgroup cols="4" colsep="0" rowsep="0">
35109 <colspec colwidth="8*" align="left"/>
35110 <colspec colwidth="6*" align="center"/>
35111 <colspec colwidth="6*" align="center"/>
35112 <colspec colwidth="6*" align="right"/>
35113 <tbody>
35114 <row>
35115 <entry><option>verify_recipient</option></entry>
35116 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
35117 <entry>Type: <emphasis>boolean</emphasis></entry>
35118 <entry>Default: <emphasis>true</emphasis></entry>
35119 </row>
35120 </tbody>
35121 </tgroup>
35122 </informaltable>
35123 <para>
35124 If this option is false, the router is skipped when verifying recipient
35125 addresses,
35126 delivering in cutthrough mode
35127 or testing recipient verification using <option>-bv</option>.
35128 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
35129 are evaluated.
35130 See also the <varname>$verify_mode</varname> variable.
35131 </para>
35132 <para>
35133 <indexterm role="option">
35134 <primary><option>verify_sender</option></primary>
35135 </indexterm>
35136 </para>
35137 <informaltable frame="all">
35138 <tgroup cols="4" colsep="0" rowsep="0">
35139 <colspec colwidth="8*" align="left"/>
35140 <colspec colwidth="6*" align="center"/>
35141 <colspec colwidth="6*" align="center"/>
35142 <colspec colwidth="6*" align="right"/>
35143 <tbody>
35144 <row>
35145 <entry><option>verify_sender</option></entry>
35146 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
35147 <entry>Type: <emphasis>boolean</emphasis></entry>
35148 <entry>Default: <emphasis>true</emphasis></entry>
35149 </row>
35150 </tbody>
35151 </tgroup>
35152 </informaltable>
35153 <para>
35154 If this option is false, the router is skipped when verifying sender addresses
35155 or testing sender verification using <option>-bvs</option>.
35156 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
35157 are evaluated.
35158 See also the <varname>$verify_mode</varname> variable.
35159 <indexterm role="concept" startref="IIDgenoprou1" class="endofrange"/>
35160 <indexterm role="concept" startref="IIDgenoprou2" class="endofrange"/>
35161 </para>
35162 </chapter>
35163
35164 <chapter id="CHID4">
35165 <title>The accept router</title>
35166 <para>
35167 <indexterm role="concept">
35168 <primary><command>accept</command> router</primary>
35169 </indexterm>
35170 <indexterm role="concept">
35171 <primary>routers</primary>
35172 <secondary><command>accept</command></secondary>
35173 </indexterm>
35174 The <command>accept</command> router has no private options of its own. Unless it is being
35175 used purely for verification (see <option>verify_only</option>) a transport is required to
35176 be defined by the generic <option>transport</option> option. If the preconditions that are
35177 specified by generic options are met, the router accepts the address and queues
35178 it for the given transport. The most common use of this router is for setting
35179 up deliveries to local mailboxes. For example:
35180 </para>
35181 <literallayout class="monospaced">
35182 localusers:
35183   driver = accept
35184   domains = mydomain.example
35185   check_local_user
35186   transport = local_delivery
35187 </literallayout>
35188 <para>
35189 The <option>domains</option> condition in this example checks the domain of the address, and
35190 <option>check_local_user</option> checks that the local part is the login of a local user.
35191 When both preconditions are met, the <command>accept</command> router runs, and queues the
35192 address for the <command>local_delivery</command> transport.
35193 </para>
35194 </chapter>
35195
35196 <chapter id="CHAPdnslookup">
35197 <title>The dnslookup router</title>
35198 <para>
35199 <indexterm role="concept" id="IIDdnsrou1" class="startofrange">
35200 <primary><command>dnslookup</command> router</primary>
35201 </indexterm>
35202 <indexterm role="concept" id="IIDdnsrou2" class="startofrange">
35203 <primary>routers</primary>
35204 <secondary><command>dnslookup</command></secondary>
35205 </indexterm>
35206 The <command>dnslookup</command> router looks up the hosts that handle mail for the
35207 recipient&#x2019;s domain in the DNS. A transport must always be set for this router,
35208 unless <option>verify_only</option> is set.
35209 </para>
35210 <para>
35211 If SRV support is configured (see <option>check_srv</option> below), Exim first searches for
35212 SRV records. If none are found, or if SRV support is not configured,
35213 MX records are looked up. If no MX records exist, address records are sought.
35214 However, <option>mx_domains</option> can be set to disable the direct use of address
35215 records.
35216 </para>
35217 <para>
35218 MX records of equal priority are sorted by Exim into a random order. Exim then
35219 looks for address records for the host names obtained from MX or SRV records.
35220 When a host has more than one IP address, they are sorted into a random order,
35221 except that IPv6 addresses are always sorted before IPv4 addresses. If all the
35222 IP addresses found are discarded by a setting of the <option>ignore_target_hosts</option>
35223 generic option, the router declines.
35224 </para>
35225 <para>
35226 Unless they have the highest priority (lowest MX value), MX records that point
35227 to the local host, or to any host name that matches <option>hosts_treat_as_local</option>,
35228 are discarded, together with any other MX records of equal or lower priority.
35229 </para>
35230 <para>
35231 <indexterm role="concept">
35232 <primary>MX record</primary>
35233 <secondary>pointing to local host</secondary>
35234 </indexterm>
35235 <indexterm role="concept">
35236 <primary>local host</primary>
35237 <secondary>MX pointing to</secondary>
35238 </indexterm>
35239 <indexterm role="option">
35240 <primary><option>self</option></primary>
35241 <secondary>in <command>dnslookup</command> router</secondary>
35242 </indexterm>
35243 If the host pointed to by the highest priority MX record, or looked up as an
35244 address record, is the local host, or matches <option>hosts_treat_as_local</option>, what
35245 happens is controlled by the generic <option>self</option> option.
35246 </para>
35247 <section id="SECTprowitdnsloo">
35248 <title>Problems with DNS lookups</title>
35249 <para>
35250 There have been problems with DNS servers when SRV records are looked up.
35251 Some misbehaving servers return a DNS error or timeout when a non-existent
35252 SRV record is sought. Similar problems have in the past been reported for
35253 MX records. The global <option>dns_again_means_nonexist</option> option can help with this
35254 problem, but it is heavy-handed because it is a global option.
35255 </para>
35256 <para>
35257 For this reason, there are two options, <option>srv_fail_domains</option> and
35258 <option>mx_fail_domains</option>, that control what happens when a DNS lookup in a
35259 <command>dnslookup</command> router results in a DNS failure or a <quote>try again</quote> response. If
35260 an attempt to look up an SRV or MX record causes one of these results, and the
35261 domain matches the relevant list, Exim behaves as if the DNS had responded <quote>no
35262 such record</quote>. In the case of an SRV lookup, this means that the router
35263 proceeds to look for MX records; in the case of an MX lookup, it proceeds to
35264 look for A or AAAA records, unless the domain matches <option>mx_domains</option>, in which
35265 case routing fails.
35266 </para>
35267 </section>
35268 <section id="SECTdnslookupdecline">
35269 <title>Declining addresses by dnslookup</title>
35270 <para>
35271 <indexterm role="concept">
35272 <primary><command>dnslookup</command> router</primary>
35273 <secondary>declines</secondary>
35274 </indexterm>
35275 There are a few cases where a <command>dnslookup</command> router will decline to accept
35276 an address; if such a router is expected to handle "all remaining non-local
35277 domains", then it is important to set <option>no_more</option>.
35278 </para>
35279 <para>
35280 The router will defer rather than decline if the domain
35281 is found in the <option>fail_defer_domains</option> router option.
35282 </para>
35283 <para>
35284 Reasons for a <command>dnslookup</command> router to decline currently include:
35285 </para>
35286 <itemizedlist>
35287 <listitem>
35288 <para>
35289 The domain does not exist in DNS
35290 </para>
35291 </listitem>
35292 <listitem>
35293 <para>
35294 The domain exists but the MX record&#x2019;s host part is just "."; this is a common
35295 convention (borrowed from SRV) used to indicate that there is no such service
35296 for this domain and to not fall back to trying A/AAAA records.
35297 </para>
35298 </listitem>
35299 <listitem>
35300 <para>
35301 Ditto, but for SRV records, when <option>check_srv</option> is set on this router.
35302 </para>
35303 </listitem>
35304 <listitem>
35305 <para>
35306 MX record points to a non-existent host.
35307 </para>
35308 </listitem>
35309 <listitem>
35310 <para>
35311 MX record points to an IP address and the main section option
35312 <option>allow_mx_to_ip</option> is not set.
35313 </para>
35314 </listitem>
35315 <listitem>
35316 <para>
35317 MX records exist and point to valid hosts, but all hosts resolve only to
35318 addresses blocked by the <option>ignore_target_hosts</option> generic option on this router.
35319 </para>
35320 </listitem>
35321 <listitem>
35322 <para>
35323 The domain is not syntactically valid (see also <option>allow_utf8_domains</option> and
35324 <option>dns_check_names_pattern</option> for handling one variant of this)
35325 </para>
35326 </listitem>
35327 <listitem>
35328 <para>
35329 <option>check_secondary_mx</option> is set on this router but the local host can
35330 not be found in the MX records (see below)
35331 </para>
35332 </listitem>
35333 </itemizedlist>
35334 </section>
35335 <section id="SECID118">
35336 <title>Private options for dnslookup</title>
35337 <para>
35338 <indexterm role="concept">
35339 <primary>options</primary>
35340 <secondary><command>dnslookup</command> router</secondary>
35341 </indexterm>
35342 The private options for the <command>dnslookup</command> router are as follows:
35343 </para>
35344 <para>
35345 <indexterm role="option">
35346 <primary><option>check_secondary_mx</option></primary>
35347 </indexterm>
35348 </para>
35349 <informaltable frame="all">
35350 <tgroup cols="4" colsep="0" rowsep="0">
35351 <colspec colwidth="8*" align="left"/>
35352 <colspec colwidth="6*" align="center"/>
35353 <colspec colwidth="6*" align="center"/>
35354 <colspec colwidth="6*" align="right"/>
35355 <tbody>
35356 <row>
35357 <entry><option>check_secondary_mx</option></entry>
35358 <entry>Use: <emphasis>dnslookup</emphasis></entry>
35359 <entry>Type: <emphasis>boolean</emphasis></entry>
35360 <entry>Default: <emphasis>false</emphasis></entry>
35361 </row>
35362 </tbody>
35363 </tgroup>
35364 </informaltable>
35365 <para>
35366 <indexterm role="concept">
35367 <primary>MX record</primary>
35368 <secondary>checking for secondary</secondary>
35369 </indexterm>
35370 If this option is set, the router declines unless the local host is found in
35371 (and removed from) the list of hosts obtained by MX lookup. This can be used to
35372 process domains for which the local host is a secondary mail exchanger
35373 differently to other domains. The way in which Exim decides whether a host is
35374 the local host is described in section <xref linkend="SECTreclocipadd"/>.
35375 </para>
35376 <para>
35377 <indexterm role="option">
35378 <primary><option>check_srv</option></primary>
35379 </indexterm>
35380 </para>
35381 <informaltable frame="all">
35382 <tgroup cols="4" colsep="0" rowsep="0">
35383 <colspec colwidth="8*" align="left"/>
35384 <colspec colwidth="6*" align="center"/>
35385 <colspec colwidth="6*" align="center"/>
35386 <colspec colwidth="6*" align="right"/>
35387 <tbody>
35388 <row>
35389 <entry><option>check_srv</option></entry>
35390 <entry>Use: <emphasis>dnslookup</emphasis></entry>
35391 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35392 <entry>Default: <emphasis>unset</emphasis></entry>
35393 </row>
35394 </tbody>
35395 </tgroup>
35396 </informaltable>
35397 <para>
35398 <indexterm role="concept">
35399 <primary>SRV record</primary>
35400 <secondary>enabling use of</secondary>
35401 </indexterm>
35402 The <command>dnslookup</command> router supports the use of SRV records (see RFC 2782) in
35403 addition to MX and address records. The support is disabled by default. To
35404 enable SRV support, set the <option>check_srv</option> option to the name of the service
35405 required. For example,
35406 </para>
35407 <literallayout class="monospaced">
35408 check_srv = smtp
35409 </literallayout>
35410 <para>
35411 looks for SRV records that refer to the normal smtp service. The option is
35412 expanded, so the service name can vary from message to message or address
35413 to address. This might be helpful if SRV records are being used for a
35414 submission service. If the expansion is forced to fail, the <option>check_srv</option>
35415 option is ignored, and the router proceeds to look for MX records in the
35416 normal way.
35417 </para>
35418 <para>
35419 When the expansion succeeds, the router searches first for SRV records for
35420 the given service (it assumes TCP protocol). A single SRV record with a
35421 host name that consists of just a single dot indicates <quote>no such service for
35422 this domain</quote>; if this is encountered, the router declines. If other kinds of
35423 SRV record are found, they are used to construct a host list for delivery
35424 according to the rules of RFC 2782. MX records are not sought in this case.
35425 </para>
35426 <para>
35427 When no SRV records are found, MX records (and address records) are sought in
35428 the traditional way. In other words, SRV records take precedence over MX
35429 records, just as MX records take precedence over address records. Note that
35430 this behaviour is not sanctioned by RFC 2782, though a previous draft RFC
35431 defined it. It is apparently believed that MX records are sufficient for email
35432 and that SRV records should not be used for this purpose. However, SRV records
35433 have an additional <quote>weight</quote> feature which some people might find useful when
35434 trying to split an SMTP load between hosts of different power.
35435 </para>
35436 <para>
35437 See section <xref linkend="SECTprowitdnsloo"/> above for a discussion of Exim&#x2019;s behaviour
35438 when there is a DNS lookup error.
35439 </para>
35440 <para>
35441 <indexterm role="option">
35442 <primary><option>fail_defer_domains</option></primary>
35443 </indexterm>
35444 </para>
35445 <informaltable frame="all">
35446 <tgroup cols="4" colsep="0" rowsep="0">
35447 <colspec colwidth="8*" align="left"/>
35448 <colspec colwidth="6*" align="center"/>
35449 <colspec colwidth="6*" align="center"/>
35450 <colspec colwidth="6*" align="right"/>
35451 <tbody>
35452 <row>
35453 <entry><option>fail_defer_domains</option></entry>
35454 <entry>Use: <emphasis>dnslookup</emphasis></entry>
35455 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
35456 <entry>Default: <emphasis>unset</emphasis></entry>
35457 </row>
35458 </tbody>
35459 </tgroup>
35460 </informaltable>
35461 <para>
35462 <indexterm role="concept">
35463 <primary>MX record</primary>
35464 <secondary>not found</secondary>
35465 </indexterm>
35466 DNS lookups for domains matching <option>fail_defer_domains</option>
35467 which find no matching record will cause the router to defer
35468 rather than the default behaviour of decline.
35469 This maybe be useful for queueing messages for a newly created
35470 domain while the DNS configuration is not ready.
35471 However, it will result in any message with mistyped domains
35472 also being queued.
35473 </para>
35474 <para>
35475 <indexterm role="option">
35476 <primary><option>mx_domains</option></primary>
35477 </indexterm>
35478 </para>
35479 <informaltable frame="all">
35480 <tgroup cols="4" colsep="0" rowsep="0">
35481 <colspec colwidth="8*" align="left"/>
35482 <colspec colwidth="6*" align="center"/>
35483 <colspec colwidth="6*" align="center"/>
35484 <colspec colwidth="6*" align="right"/>
35485 <tbody>
35486 <row>
35487 <entry><option>mx_domains</option></entry>
35488 <entry>Use: <emphasis>dnslookup</emphasis></entry>
35489 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
35490 <entry>Default: <emphasis>unset</emphasis></entry>
35491 </row>
35492 </tbody>
35493 </tgroup>
35494 </informaltable>
35495 <para>
35496 <indexterm role="concept">
35497 <primary>MX record</primary>
35498 <secondary>required to exist</secondary>
35499 </indexterm>
35500 <indexterm role="concept">
35501 <primary>SRV record</primary>
35502 <secondary>required to exist</secondary>
35503 </indexterm>
35504 A domain that matches <option>mx_domains</option> is required to have either an MX or an SRV
35505 record in order to be recognized. (The name of this option could be improved.)
35506 For example, if all the mail hosts in <emphasis>fict.example</emphasis> are known to have MX
35507 records, except for those in <emphasis>discworld.fict.example</emphasis>, you could use this
35508 setting:
35509 </para>
35510 <literallayout class="monospaced">
35511 mx_domains = ! *.discworld.fict.example : *.fict.example
35512 </literallayout>
35513 <para>
35514 This specifies that messages addressed to a domain that matches the list but
35515 has no MX record should be bounced immediately instead of being routed using
35516 the address record.
35517 </para>
35518 <para>
35519 <indexterm role="option">
35520 <primary><option>mx_fail_domains</option></primary>
35521 </indexterm>
35522 </para>
35523 <informaltable frame="all">
35524 <tgroup cols="4" colsep="0" rowsep="0">
35525 <colspec colwidth="8*" align="left"/>
35526 <colspec colwidth="6*" align="center"/>
35527 <colspec colwidth="6*" align="center"/>
35528 <colspec colwidth="6*" align="right"/>
35529 <tbody>
35530 <row>
35531 <entry><option>mx_fail_domains</option></entry>
35532 <entry>Use: <emphasis>dnslookup</emphasis></entry>
35533 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
35534 <entry>Default: <emphasis>unset</emphasis></entry>
35535 </row>
35536 </tbody>
35537 </tgroup>
35538 </informaltable>
35539 <para>
35540 If the DNS lookup for MX records for one of the domains in this list causes a
35541 DNS lookup error, Exim behaves as if no MX records were found. See section
35542 <xref linkend="SECTprowitdnsloo"/> for more discussion.
35543 </para>
35544 <para>
35545 <indexterm role="option">
35546 <primary><option>qualify_single</option></primary>
35547 </indexterm>
35548 </para>
35549 <informaltable frame="all">
35550 <tgroup cols="4" colsep="0" rowsep="0">
35551 <colspec colwidth="8*" align="left"/>
35552 <colspec colwidth="6*" align="center"/>
35553 <colspec colwidth="6*" align="center"/>
35554 <colspec colwidth="6*" align="right"/>
35555 <tbody>
35556 <row>
35557 <entry><option>qualify_single</option></entry>
35558 <entry>Use: <emphasis>dnslookup</emphasis></entry>
35559 <entry>Type: <emphasis>boolean</emphasis></entry>
35560 <entry>Default: <emphasis>true</emphasis></entry>
35561 </row>
35562 </tbody>
35563 </tgroup>
35564 </informaltable>
35565 <para>
35566 <indexterm role="concept">
35567 <primary>DNS</primary>
35568 <secondary>resolver options</secondary>
35569 </indexterm>
35570 <indexterm role="concept">
35571 <primary>DNS</primary>
35572 <secondary>qualifying single-component names</secondary>
35573 </indexterm>
35574 When this option is true, the resolver option RES_DEFNAMES is set for DNS
35575 lookups. Typically, but not standardly, this causes the resolver to qualify
35576 single-component names with the default domain. For example, on a machine
35577 called <emphasis>dictionary.ref.example</emphasis>, the domain <emphasis>thesaurus</emphasis> would be changed to
35578 <emphasis>thesaurus.ref.example</emphasis> inside the resolver. For details of what your
35579 resolver actually does, consult your man pages for <emphasis>resolver</emphasis> and
35580 <emphasis>resolv.conf</emphasis>.
35581 </para>
35582 <para>
35583 <indexterm role="option">
35584 <primary><option>rewrite_headers</option></primary>
35585 </indexterm>
35586 </para>
35587 <informaltable frame="all">
35588 <tgroup cols="4" colsep="0" rowsep="0">
35589 <colspec colwidth="8*" align="left"/>
35590 <colspec colwidth="6*" align="center"/>
35591 <colspec colwidth="6*" align="center"/>
35592 <colspec colwidth="6*" align="right"/>
35593 <tbody>
35594 <row>
35595 <entry><option>rewrite_headers</option></entry>
35596 <entry>Use: <emphasis>dnslookup</emphasis></entry>
35597 <entry>Type: <emphasis>boolean</emphasis></entry>
35598 <entry>Default: <emphasis>true</emphasis></entry>
35599 </row>
35600 </tbody>
35601 </tgroup>
35602 </informaltable>
35603 <para>
35604 <indexterm role="concept">
35605 <primary>rewriting</primary>
35606 <secondary>header lines</secondary>
35607 </indexterm>
35608 <indexterm role="concept">
35609 <primary>header lines</primary>
35610 <secondary>rewriting</secondary>
35611 </indexterm>
35612 If the domain name in the address that is being processed is not fully
35613 qualified, it may be expanded to its full form by a DNS lookup. For example, if
35614 an address is specified as <emphasis>dormouse@teaparty</emphasis>, the domain might be
35615 expanded to <emphasis>teaparty.wonderland.fict.example</emphasis>. Domain expansion can also
35616 occur as a result of setting the <option>widen_domains</option> option. If
35617 <option>rewrite_headers</option> is true, all occurrences of the abbreviated domain name in
35618 any <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-to:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>
35619 header lines of the message are rewritten with the full domain name.
35620 </para>
35621 <para>
35622 This option should be turned off only when it is known that no message is
35623 ever going to be sent outside an environment where the abbreviation makes
35624 sense.
35625 </para>
35626 <para>
35627 When an MX record is looked up in the DNS and matches a wildcard record, name
35628 servers normally return a record containing the name that has been looked up,
35629 making it impossible to detect whether a wildcard was present or not. However,
35630 some name servers have recently been seen to return the wildcard entry. If the
35631 name returned by a DNS lookup begins with an asterisk, it is not used for
35632 header rewriting.
35633 </para>
35634 <para>
35635 <indexterm role="option">
35636 <primary><option>same_domain_copy_routing</option></primary>
35637 </indexterm>
35638 </para>
35639 <informaltable frame="all">
35640 <tgroup cols="4" colsep="0" rowsep="0">
35641 <colspec colwidth="8*" align="left"/>
35642 <colspec colwidth="6*" align="center"/>
35643 <colspec colwidth="6*" align="center"/>
35644 <colspec colwidth="6*" align="right"/>
35645 <tbody>
35646 <row>
35647 <entry><option>same_domain_copy_routing</option></entry>
35648 <entry>Use: <emphasis>dnslookup</emphasis></entry>
35649 <entry>Type: <emphasis>boolean</emphasis></entry>
35650 <entry>Default: <emphasis>false</emphasis></entry>
35651 </row>
35652 </tbody>
35653 </tgroup>
35654 </informaltable>
35655 <para>
35656 <indexterm role="concept">
35657 <primary>address</primary>
35658 <secondary>copying routing</secondary>
35659 </indexterm>
35660 Addresses with the same domain are normally routed by the <command>dnslookup</command> router
35661 to the same list of hosts. However, this cannot be presumed, because the router
35662 options and preconditions may refer to the local part of the address. By
35663 default, therefore, Exim routes each address in a message independently. DNS
35664 servers run caches, so repeated DNS lookups are not normally expensive, and in
35665 any case, personal messages rarely have more than a few recipients.
35666 </para>
35667 <para>
35668 If you are running mailing lists with large numbers of subscribers at the same
35669 domain, and you are using a <command>dnslookup</command> router which is independent of the
35670 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
35671 lookups for identical domains in one message. In this case, when <command>dnslookup</command>
35672 routes an address to a remote transport, any other unrouted addresses in the
35673 message that have the same domain are automatically given the same routing
35674 without processing them independently,
35675 provided the following conditions are met:
35676 </para>
35677 <itemizedlist>
35678 <listitem>
35679 <para>
35680 No router that processed the address specified <option>headers_add</option> or
35681 <option>headers_remove</option>.
35682 </para>
35683 </listitem>
35684 <listitem>
35685 <para>
35686 The router did not change the address in any way, for example, by <quote>widening</quote>
35687 the domain.
35688 </para>
35689 </listitem>
35690 </itemizedlist>
35691 <para>
35692 <indexterm role="option">
35693 <primary><option>search_parents</option></primary>
35694 </indexterm>
35695 </para>
35696 <informaltable frame="all">
35697 <tgroup cols="4" colsep="0" rowsep="0">
35698 <colspec colwidth="8*" align="left"/>
35699 <colspec colwidth="6*" align="center"/>
35700 <colspec colwidth="6*" align="center"/>
35701 <colspec colwidth="6*" align="right"/>
35702 <tbody>
35703 <row>
35704 <entry><option>search_parents</option></entry>
35705 <entry>Use: <emphasis>dnslookup</emphasis></entry>
35706 <entry>Type: <emphasis>boolean</emphasis></entry>
35707 <entry>Default: <emphasis>false</emphasis></entry>
35708 </row>
35709 </tbody>
35710 </tgroup>
35711 </informaltable>
35712 <para>
35713 <indexterm role="concept">
35714 <primary>DNS</primary>
35715 <secondary>resolver options</secondary>
35716 </indexterm>
35717 When this option is true, the resolver option RES_DNSRCH is set for DNS
35718 lookups. This is different from the <option>qualify_single</option> option in that it
35719 applies to domains containing dots. Typically, but not standardly, it causes
35720 the resolver to search for the name in the current domain and in parent
35721 domains. For example, on a machine in the <emphasis>fict.example</emphasis> domain, if looking
35722 up <emphasis>teaparty.wonderland</emphasis> failed, the resolver would try
35723 <emphasis>teaparty.wonderland.fict.example</emphasis>. For details of what your resolver
35724 actually does, consult your man pages for <emphasis>resolver</emphasis> and <emphasis>resolv.conf</emphasis>.
35725 </para>
35726 <para>
35727 Setting this option true can cause problems in domains that have a wildcard MX
35728 record, because any domain that does not have its own MX record matches the
35729 local wildcard.
35730 </para>
35731 <para>
35732 <indexterm role="option">
35733 <primary><option>srv_fail_domains</option></primary>
35734 </indexterm>
35735 </para>
35736 <informaltable frame="all">
35737 <tgroup cols="4" colsep="0" rowsep="0">
35738 <colspec colwidth="8*" align="left"/>
35739 <colspec colwidth="6*" align="center"/>
35740 <colspec colwidth="6*" align="center"/>
35741 <colspec colwidth="6*" align="right"/>
35742 <tbody>
35743 <row>
35744 <entry><option>srv_fail_domains</option></entry>
35745 <entry>Use: <emphasis>dnslookup</emphasis></entry>
35746 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
35747 <entry>Default: <emphasis>unset</emphasis></entry>
35748 </row>
35749 </tbody>
35750 </tgroup>
35751 </informaltable>
35752 <para>
35753 If the DNS lookup for SRV records for one of the domains in this list causes a
35754 DNS lookup error, Exim behaves as if no SRV records were found. See section
35755 <xref linkend="SECTprowitdnsloo"/> for more discussion.
35756 </para>
35757 <para>
35758 <indexterm role="option">
35759 <primary><option>widen_domains</option></primary>
35760 </indexterm>
35761 </para>
35762 <informaltable frame="all">
35763 <tgroup cols="4" colsep="0" rowsep="0">
35764 <colspec colwidth="8*" align="left"/>
35765 <colspec colwidth="6*" align="center"/>
35766 <colspec colwidth="6*" align="center"/>
35767 <colspec colwidth="6*" align="right"/>
35768 <tbody>
35769 <row>
35770 <entry><option>widen_domains</option></entry>
35771 <entry>Use: <emphasis>dnslookup</emphasis></entry>
35772 <entry>Type: <emphasis>string list</emphasis></entry>
35773 <entry>Default: <emphasis>unset</emphasis></entry>
35774 </row>
35775 </tbody>
35776 </tgroup>
35777 </informaltable>
35778 <para>
35779 <indexterm role="concept">
35780 <primary>domain</primary>
35781 <secondary>partial; widening</secondary>
35782 </indexterm>
35783 If a DNS lookup fails and this option is set, each of its strings in turn is
35784 added onto the end of the domain, and the lookup is tried again. For example,
35785 if
35786 </para>
35787 <literallayout class="monospaced">
35788 widen_domains = fict.example:ref.example
35789 </literallayout>
35790 <para>
35791 is set and a lookup of <emphasis>klingon.dictionary</emphasis> fails,
35792 <emphasis>klingon.dictionary.fict.example</emphasis> is looked up, and if this fails,
35793 <emphasis>klingon.dictionary.ref.example</emphasis> is tried. Note that the <option>qualify_single</option>
35794 and <option>search_parents</option> options can cause some widening to be undertaken inside
35795 the DNS resolver. <option>widen_domains</option> is not applied to sender addresses
35796 when verifying, unless <option>rewrite_headers</option> is false (not the default).
35797 </para>
35798 </section>
35799 <section id="SECID119">
35800 <title>Effect of qualify_single and search_parents</title>
35801 <para>
35802 When a domain from an envelope recipient is changed by the resolver as a result
35803 of the <option>qualify_single</option> or <option>search_parents</option> options, Exim rewrites the
35804 corresponding address in the message&#x2019;s header lines unless <option>rewrite_headers</option>
35805 is set false. Exim then re-routes the address, using the full domain.
35806 </para>
35807 <para>
35808 These two options affect only the DNS lookup that takes place inside the router
35809 for the domain of the address that is being routed. They do not affect lookups
35810 such as that implied by
35811 </para>
35812 <literallayout class="monospaced">
35813 domains = @mx_any
35814 </literallayout>
35815 <para>
35816 that may happen while processing a router precondition before the router is
35817 entered. No widening ever takes place for these lookups.
35818 <indexterm role="concept" startref="IIDdnsrou1" class="endofrange"/>
35819 <indexterm role="concept" startref="IIDdnsrou2" class="endofrange"/>
35820 </para>
35821 </section>
35822 </chapter>
35823
35824 <chapter id="CHID5">
35825 <title>The ipliteral router</title>
35826 <para>
35827 <indexterm role="concept">
35828 <primary><command>ipliteral</command> router</primary>
35829 </indexterm>
35830 <indexterm role="concept">
35831 <primary>domain literal</primary>
35832 <secondary>routing</secondary>
35833 </indexterm>
35834 <indexterm role="concept">
35835 <primary>routers</primary>
35836 <secondary><command>ipliteral</command></secondary>
35837 </indexterm>
35838 This router has no private options. Unless it is being used purely for
35839 verification (see <option>verify_only</option>) a transport is required to be defined by the
35840 generic <option>transport</option> option. The router accepts the address if its domain part
35841 takes the form of an RFC 2822 domain literal. For example, the <command>ipliteral</command>
35842 router handles the address
35843 </para>
35844 <literallayout class="monospaced">
35845 root@[192.168.1.1]
35846 </literallayout>
35847 <para>
35848 by setting up delivery to the host with that IP address. IPv4 domain literals
35849 consist of an IPv4 address enclosed in square brackets. IPv6 domain literals
35850 are similar, but the address is preceded by <literal>ipv6:</literal>. For example:
35851 </para>
35852 <literallayout class="monospaced">
35853 postmaster@[ipv6:fe80::a00:20ff:fe86:a061.5678]
35854 </literallayout>
35855 <para>
35856 Exim allows <literal>ipv4:</literal> before IPv4 addresses, for consistency, and on the
35857 grounds that sooner or later somebody will try it.
35858 </para>
35859 <para>
35860 <indexterm role="option">
35861 <primary><option>self</option></primary>
35862 <secondary>in <command>ipliteral</command> router</secondary>
35863 </indexterm>
35864 If the IP address matches something in <option>ignore_target_hosts</option>, the router
35865 declines. If an IP literal turns out to refer to the local host, the generic
35866 <option>self</option> option determines what happens.
35867 </para>
35868 <para>
35869 The RFCs require support for domain literals; however, their use is
35870 controversial in today&#x2019;s Internet. If you want to use this router, you must
35871 also set the main configuration option <option>allow_domain_literals</option>. Otherwise,
35872 Exim will not recognize the domain literal syntax in addresses.
35873 </para>
35874 </chapter>
35875
35876 <chapter id="CHID6">
35877 <title>The iplookup router</title>
35878 <para>
35879 <indexterm role="concept">
35880 <primary><command>iplookup</command> router</primary>
35881 </indexterm>
35882 <indexterm role="concept">
35883 <primary>routers</primary>
35884 <secondary><command>iplookup</command></secondary>
35885 </indexterm>
35886 The <command>iplookup</command> router was written to fulfil a specific requirement in
35887 Cambridge University (which in fact no longer exists). For this reason, it is
35888 not included in the binary of Exim by default. If you want to include it, you
35889 must set
35890 </para>
35891 <literallayout class="monospaced">
35892 ROUTER_IPLOOKUP=yes
35893 </literallayout>
35894 <para>
35895 in your <filename>Local/Makefile</filename> configuration file.
35896 </para>
35897 <para>
35898 The <command>iplookup</command> router routes an address by sending it over a TCP or UDP
35899 connection to one or more specific hosts. The host can then return the same or
35900 a different address &ndash; in effect rewriting the recipient address in the
35901 message&#x2019;s envelope. The new address is then passed on to subsequent routers. If
35902 this process fails, the address can be passed on to other routers, or delivery
35903 can be deferred. Since <command>iplookup</command> is just a rewriting router, a transport
35904 must not be specified for it.
35905 </para>
35906 <para>
35907 <indexterm role="concept">
35908 <primary>options</primary>
35909 <secondary><command>iplookup</command> router</secondary>
35910 </indexterm>
35911 <indexterm role="option">
35912 <primary><option>hosts</option></primary>
35913 </indexterm>
35914 </para>
35915 <informaltable frame="all">
35916 <tgroup cols="4" colsep="0" rowsep="0">
35917 <colspec colwidth="8*" align="left"/>
35918 <colspec colwidth="6*" align="center"/>
35919 <colspec colwidth="6*" align="center"/>
35920 <colspec colwidth="6*" align="right"/>
35921 <tbody>
35922 <row>
35923 <entry><option>hosts</option></entry>
35924 <entry>Use: <emphasis>iplookup</emphasis></entry>
35925 <entry>Type: <emphasis>string</emphasis></entry>
35926 <entry>Default: <emphasis>unset</emphasis></entry>
35927 </row>
35928 </tbody>
35929 </tgroup>
35930 </informaltable>
35931 <para>
35932 This option must be supplied. Its value is a colon-separated list of host
35933 names. The hosts are looked up using <function>gethostbyname()</function>
35934 (or <function>getipnodebyname()</function> when available)
35935 and are tried in order until one responds to the query. If none respond, what
35936 happens is controlled by <option>optional</option>.
35937 </para>
35938 <para>
35939 <indexterm role="option">
35940 <primary><option>optional</option></primary>
35941 </indexterm>
35942 </para>
35943 <informaltable frame="all">
35944 <tgroup cols="4" colsep="0" rowsep="0">
35945 <colspec colwidth="8*" align="left"/>
35946 <colspec colwidth="6*" align="center"/>
35947 <colspec colwidth="6*" align="center"/>
35948 <colspec colwidth="6*" align="right"/>
35949 <tbody>
35950 <row>
35951 <entry><option>optional</option></entry>
35952 <entry>Use: <emphasis>iplookup</emphasis></entry>
35953 <entry>Type: <emphasis>boolean</emphasis></entry>
35954 <entry>Default: <emphasis>false</emphasis></entry>
35955 </row>
35956 </tbody>
35957 </tgroup>
35958 </informaltable>
35959 <para>
35960 If <option>optional</option> is true, if no response is obtained from any host, the address
35961 is passed to the next router, overriding <option>no_more</option>. If <option>optional</option> is false,
35962 delivery to the address is deferred.
35963 </para>
35964 <para>
35965 <indexterm role="option">
35966 <primary><option>port</option></primary>
35967 </indexterm>
35968 </para>
35969 <informaltable frame="all">
35970 <tgroup cols="4" colsep="0" rowsep="0">
35971 <colspec colwidth="8*" align="left"/>
35972 <colspec colwidth="6*" align="center"/>
35973 <colspec colwidth="6*" align="center"/>
35974 <colspec colwidth="6*" align="right"/>
35975 <tbody>
35976 <row>
35977 <entry><option>port</option></entry>
35978 <entry>Use: <emphasis>iplookup</emphasis></entry>
35979 <entry>Type: <emphasis>integer</emphasis></entry>
35980 <entry>Default: <emphasis>0</emphasis></entry>
35981 </row>
35982 </tbody>
35983 </tgroup>
35984 </informaltable>
35985 <para>
35986 <indexterm role="concept">
35987 <primary>port</primary>
35988 <secondary><command>iplookup</command> router</secondary>
35989 </indexterm>
35990 This option must be supplied. It specifies the port number for the TCP or UDP
35991 call.
35992 </para>
35993 <para>
35994 <indexterm role="option">
35995 <primary><option>protocol</option></primary>
35996 </indexterm>
35997 </para>
35998 <informaltable frame="all">
35999 <tgroup cols="4" colsep="0" rowsep="0">
36000 <colspec colwidth="8*" align="left"/>
36001 <colspec colwidth="6*" align="center"/>
36002 <colspec colwidth="6*" align="center"/>
36003 <colspec colwidth="6*" align="right"/>
36004 <tbody>
36005 <row>
36006 <entry><option>protocol</option></entry>
36007 <entry>Use: <emphasis>iplookup</emphasis></entry>
36008 <entry>Type: <emphasis>string</emphasis></entry>
36009 <entry>Default: <emphasis>udp</emphasis></entry>
36010 </row>
36011 </tbody>
36012 </tgroup>
36013 </informaltable>
36014 <para>
36015 This option can be set to <quote>udp</quote> or <quote>tcp</quote> to specify which of the two
36016 protocols is to be used.
36017 </para>
36018 <para>
36019 <indexterm role="option">
36020 <primary><option>query</option></primary>
36021 </indexterm>
36022 </para>
36023 <informaltable frame="all">
36024 <tgroup cols="4" colsep="0" rowsep="0">
36025 <colspec colwidth="8*" align="left"/>
36026 <colspec colwidth="6*" align="center"/>
36027 <colspec colwidth="6*" align="center"/>
36028 <colspec colwidth="6*" align="right"/>
36029 <tbody>
36030 <row>
36031 <entry><option>query</option></entry>
36032 <entry>Use: <emphasis>iplookup</emphasis></entry>
36033 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36034 <entry>Default: <emphasis>see below</emphasis></entry>
36035 </row>
36036 </tbody>
36037 </tgroup>
36038 </informaltable>
36039 <para>
36040 This defines the content of the query that is sent to the remote hosts. The
36041 default value is:
36042 </para>
36043 <literallayout class="monospaced">
36044 $local_part@$domain $local_part@$domain
36045 </literallayout>
36046 <para>
36047 The repetition serves as a way of checking that a response is to the correct
36048 query in the default case (see <option>response_pattern</option> below).
36049 </para>
36050 <para>
36051 <indexterm role="option">
36052 <primary><option>reroute</option></primary>
36053 </indexterm>
36054 </para>
36055 <informaltable frame="all">
36056 <tgroup cols="4" colsep="0" rowsep="0">
36057 <colspec colwidth="8*" align="left"/>
36058 <colspec colwidth="6*" align="center"/>
36059 <colspec colwidth="6*" align="center"/>
36060 <colspec colwidth="6*" align="right"/>
36061 <tbody>
36062 <row>
36063 <entry><option>reroute</option></entry>
36064 <entry>Use: <emphasis>iplookup</emphasis></entry>
36065 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36066 <entry>Default: <emphasis>unset</emphasis></entry>
36067 </row>
36068 </tbody>
36069 </tgroup>
36070 </informaltable>
36071 <para>
36072 If this option is not set, the rerouted address is precisely the byte string
36073 returned by the remote host, up to the first white space, if any. If set, the
36074 string is expanded to form the rerouted address. It can include parts matched
36075 in the response by <option>response_pattern</option> by means of numeric variables such as
36076 <varname>$1</varname>, <varname>$2</varname>, etc. The variable <varname>$0</varname> refers to the entire input string,
36077 whether or not a pattern is in use. In all cases, the rerouted address must end
36078 up in the form <emphasis>local_part@domain</emphasis>.
36079 </para>
36080 <para>
36081 <indexterm role="option">
36082 <primary><option>response_pattern</option></primary>
36083 </indexterm>
36084 </para>
36085 <informaltable frame="all">
36086 <tgroup cols="4" colsep="0" rowsep="0">
36087 <colspec colwidth="8*" align="left"/>
36088 <colspec colwidth="6*" align="center"/>
36089 <colspec colwidth="6*" align="center"/>
36090 <colspec colwidth="6*" align="right"/>
36091 <tbody>
36092 <row>
36093 <entry><option>response_pattern</option></entry>
36094 <entry>Use: <emphasis>iplookup</emphasis></entry>
36095 <entry>Type: <emphasis>string</emphasis></entry>
36096 <entry>Default: <emphasis>unset</emphasis></entry>
36097 </row>
36098 </tbody>
36099 </tgroup>
36100 </informaltable>
36101 <para>
36102 This option can be set to a regular expression that is applied to the string
36103 returned from the remote host. If the pattern does not match the response, the
36104 router declines. If <option>response_pattern</option> is not set, no checking of the
36105 response is done, unless the query was defaulted, in which case there is a
36106 check that the text returned after the first white space is the original
36107 address. This checks that the answer that has been received is in response to
36108 the correct question. For example, if the response is just a new domain, the
36109 following could be used:
36110 </para>
36111 <literallayout class="monospaced">
36112 response_pattern = ^([^@]+)$
36113 reroute = $local_part@$1
36114 </literallayout>
36115 <para>
36116 <indexterm role="option">
36117 <primary><option>timeout</option></primary>
36118 </indexterm>
36119 </para>
36120 <informaltable frame="all">
36121 <tgroup cols="4" colsep="0" rowsep="0">
36122 <colspec colwidth="8*" align="left"/>
36123 <colspec colwidth="6*" align="center"/>
36124 <colspec colwidth="6*" align="center"/>
36125 <colspec colwidth="6*" align="right"/>
36126 <tbody>
36127 <row>
36128 <entry><option>timeout</option></entry>
36129 <entry>Use: <emphasis>iplookup</emphasis></entry>
36130 <entry>Type: <emphasis>time</emphasis></entry>
36131 <entry>Default: <emphasis>5s</emphasis></entry>
36132 </row>
36133 </tbody>
36134 </tgroup>
36135 </informaltable>
36136 <para>
36137 This specifies the amount of time to wait for a response from the remote
36138 machine. The same timeout is used for the <function>connect()</function> function for a TCP
36139 call. It does not apply to UDP.
36140 </para>
36141 </chapter>
36142
36143 <chapter id="CHID7">
36144 <title>The manualroute router</title>
36145 <para>
36146 <indexterm role="concept" id="IIDmanrou1" class="startofrange">
36147 <primary><command>manualroute</command> router</primary>
36148 </indexterm>
36149 <indexterm role="concept" id="IIDmanrou2" class="startofrange">
36150 <primary>routers</primary>
36151 <secondary><command>manualroute</command></secondary>
36152 </indexterm>
36153 <indexterm role="concept">
36154 <primary>domain</primary>
36155 <secondary>manually routing</secondary>
36156 </indexterm>
36157 The <command>manualroute</command> router is so-called because it provides a way of manually
36158 routing an address according to its domain. It is mainly used when you want to
36159 route addresses to remote hosts according to your own rules, bypassing the
36160 normal DNS routing that looks up MX records. However, <command>manualroute</command> can also
36161 route to local transports, a facility that may be useful if you want to save
36162 messages for dial-in hosts in local files.
36163 </para>
36164 <para>
36165 The <command>manualroute</command> router compares a list of domain patterns with the domain
36166 it is trying to route. If there is no match, the router declines. Each pattern
36167 has associated with it a list of hosts and some other optional data, which may
36168 include a transport. The combination of a pattern and its data is called a
36169 <quote>routing rule</quote>. For patterns that do not have an associated transport, the
36170 generic <option>transport</option> option must specify a transport, unless the router is
36171 being used purely for verification (see <option>verify_only</option>).
36172 </para>
36173 <para>
36174 <indexterm role="variable">
36175 <primary><varname>$host</varname></primary>
36176 </indexterm>
36177 In the case of verification, matching the domain pattern is sufficient for the
36178 router to accept the address. When actually routing an address for delivery,
36179 an address that matches a domain pattern is queued for the associated
36180 transport. If the transport is not a local one, a host list must be associated
36181 with the pattern; IP addresses are looked up for the hosts, and these are
36182 passed to the transport along with the mail address. For local transports, a
36183 host list is optional. If it is present, it is passed in <varname>$host</varname> as a single
36184 text string.
36185 </para>
36186 <para>
36187 The list of routing rules can be provided as an inline string in
36188 <option>route_list</option>, or the data can be obtained by looking up the domain in a file
36189 or database by setting <option>route_data</option>. Only one of these settings may appear in
36190 any one instance of <command>manualroute</command>. The format of routing rules is described
36191 below, following the list of private options.
36192 </para>
36193 <section id="SECTprioptman">
36194 <title>Private options for manualroute</title>
36195 <para>
36196 <indexterm role="concept">
36197 <primary>options</primary>
36198 <secondary><command>manualroute</command> router</secondary>
36199 </indexterm>
36200 The private options for the <command>manualroute</command> router are as follows:
36201 </para>
36202 <para>
36203 <indexterm role="option">
36204 <primary><option>host_all_ignored</option></primary>
36205 </indexterm>
36206 </para>
36207 <informaltable frame="all">
36208 <tgroup cols="4" colsep="0" rowsep="0">
36209 <colspec colwidth="8*" align="left"/>
36210 <colspec colwidth="6*" align="center"/>
36211 <colspec colwidth="6*" align="center"/>
36212 <colspec colwidth="6*" align="right"/>
36213 <tbody>
36214 <row>
36215 <entry><option>host_all_ignored</option></entry>
36216 <entry>Use: <emphasis>manualroute</emphasis></entry>
36217 <entry>Type: <emphasis>string</emphasis></entry>
36218 <entry>Default: <emphasis>defer</emphasis></entry>
36219 </row>
36220 </tbody>
36221 </tgroup>
36222 </informaltable>
36223 <para>
36224 See <option>host_find_failed</option>.
36225 </para>
36226 <para>
36227 <indexterm role="option">
36228 <primary><option>host_find_failed</option></primary>
36229 </indexterm>
36230 </para>
36231 <informaltable frame="all">
36232 <tgroup cols="4" colsep="0" rowsep="0">
36233 <colspec colwidth="8*" align="left"/>
36234 <colspec colwidth="6*" align="center"/>
36235 <colspec colwidth="6*" align="center"/>
36236 <colspec colwidth="6*" align="right"/>
36237 <tbody>
36238 <row>
36239 <entry><option>host_find_failed</option></entry>
36240 <entry>Use: <emphasis>manualroute</emphasis></entry>
36241 <entry>Type: <emphasis>string</emphasis></entry>
36242 <entry>Default: <emphasis>freeze</emphasis></entry>
36243 </row>
36244 </tbody>
36245 </tgroup>
36246 </informaltable>
36247 <para>
36248 This option controls what happens when <command>manualroute</command> tries to find an IP
36249 address for a host, and the host does not exist. The option can be set to one
36250 of the following values:
36251 </para>
36252 <literallayout class="monospaced">
36253 decline
36254 defer
36255 fail
36256 freeze
36257 ignore
36258 pass
36259 </literallayout>
36260 <para>
36261 The default (<quote>freeze</quote>) assumes that this state is a serious configuration
36262 error. The difference between <quote>pass</quote> and <quote>decline</quote> is that the former
36263 forces the address to be passed to the next router (or the router defined by
36264 <option>pass_router</option>),
36265 <indexterm role="option">
36266 <primary><option>more</option></primary>
36267 </indexterm>
36268 overriding <option>no_more</option>, whereas the latter passes the address to the next
36269 router only if <option>more</option> is true.
36270 </para>
36271 <para>
36272 The value <quote>ignore</quote> causes Exim to completely ignore a host whose IP address
36273 cannot be found. If all the hosts in the list are ignored, the behaviour is
36274 controlled by the <option>host_all_ignored</option> option. This takes the same values
36275 as <option>host_find_failed</option>, except that it cannot be set to <quote>ignore</quote>.
36276 </para>
36277 <para>
36278 The <option>host_find_failed</option> option applies only to a definite <quote>does not exist</quote>
36279 state; if a host lookup gets a temporary error, delivery is deferred unless the
36280 generic <option>pass_on_timeout</option> option is set.
36281 </para>
36282 <para>
36283 <indexterm role="option">
36284 <primary><option>hosts_randomize</option></primary>
36285 </indexterm>
36286 </para>
36287 <informaltable frame="all">
36288 <tgroup cols="4" colsep="0" rowsep="0">
36289 <colspec colwidth="8*" align="left"/>
36290 <colspec colwidth="6*" align="center"/>
36291 <colspec colwidth="6*" align="center"/>
36292 <colspec colwidth="6*" align="right"/>
36293 <tbody>
36294 <row>
36295 <entry><option>hosts_randomize</option></entry>
36296 <entry>Use: <emphasis>manualroute</emphasis></entry>
36297 <entry>Type: <emphasis>boolean</emphasis></entry>
36298 <entry>Default: <emphasis>false</emphasis></entry>
36299 </row>
36300 </tbody>
36301 </tgroup>
36302 </informaltable>
36303 <para>
36304 <indexterm role="concept">
36305 <primary>randomized host list</primary>
36306 </indexterm>
36307 <indexterm role="concept">
36308 <primary>host</primary>
36309 <secondary>list of; randomized</secondary>
36310 </indexterm>
36311 If this option is set, the order of the items in a host list in a routing rule
36312 is randomized each time the list is used, unless an option in the routing rule
36313 overrides (see below). Randomizing the order of a host list can be used to do
36314 crude load sharing. However, if more than one mail address is routed by the
36315 same router to the same host list, the host lists are considered to be the same
36316 (even though they may be randomized into different orders) for the purpose of
36317 deciding whether to batch the deliveries into a single SMTP transaction.
36318 </para>
36319 <para>
36320 When <option>hosts_randomize</option> is true, a host list may be split
36321 into groups whose order is separately randomized. This makes it possible to
36322 set up MX-like behaviour. The boundaries between groups are indicated by an
36323 item that is just <literal>+</literal> in the host list. For example:
36324 </para>
36325 <literallayout class="monospaced">
36326 route_list = * host1:host2:host3:+:host4:host5
36327 </literallayout>
36328 <para>
36329 The order of the first three hosts and the order of the last two hosts is
36330 randomized for each use, but the first three always end up before the last two.
36331 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored. If a
36332 randomized host list is passed to an <command>smtp</command> transport that also has
36333 <option>hosts_randomize set</option>, the list is not re-randomized.
36334 </para>
36335 <para>
36336 <indexterm role="option">
36337 <primary><option>route_data</option></primary>
36338 </indexterm>
36339 </para>
36340 <informaltable frame="all">
36341 <tgroup cols="4" colsep="0" rowsep="0">
36342 <colspec colwidth="8*" align="left"/>
36343 <colspec colwidth="6*" align="center"/>
36344 <colspec colwidth="6*" align="center"/>
36345 <colspec colwidth="6*" align="right"/>
36346 <tbody>
36347 <row>
36348 <entry><option>route_data</option></entry>
36349 <entry>Use: <emphasis>manualroute</emphasis></entry>
36350 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36351 <entry>Default: <emphasis>unset</emphasis></entry>
36352 </row>
36353 </tbody>
36354 </tgroup>
36355 </informaltable>
36356 <para>
36357 If this option is set, it must expand to yield the data part of a routing rule.
36358 Typically, the expansion string includes a lookup based on the domain. For
36359 example:
36360 </para>
36361 <literallayout class="monospaced">
36362 route_data = ${lookup{$domain}dbm{/etc/routes}}
36363 </literallayout>
36364 <para>
36365 If the expansion is forced to fail, or the result is an empty string, the
36366 router declines. Other kinds of expansion failure cause delivery to be
36367 deferred.
36368 </para>
36369 <para>
36370 <indexterm role="option">
36371 <primary><option>route_list</option></primary>
36372 </indexterm>
36373 </para>
36374 <informaltable frame="all">
36375 <tgroup cols="4" colsep="0" rowsep="0">
36376 <colspec colwidth="8*" align="left"/>
36377 <colspec colwidth="6*" align="center"/>
36378 <colspec colwidth="6*" align="center"/>
36379 <colspec colwidth="6*" align="right"/>
36380 <tbody>
36381 <row>
36382 <entry><option>route_list</option></entry>
36383 <entry>Use: <emphasis>manualroute</emphasis></entry>
36384 <entry>Type: <emphasis>string list</emphasis></entry>
36385 <entry>Default: <emphasis>unset</emphasis></entry>
36386 </row>
36387 </tbody>
36388 </tgroup>
36389 </informaltable>
36390 <para>
36391 This string is a list of routing rules, in the form defined below. Note that,
36392 unlike most string lists, the items are separated by semicolons. This is so
36393 that they may contain colon-separated host lists.
36394 </para>
36395 <para>
36396 <indexterm role="option">
36397 <primary><option>same_domain_copy_routing</option></primary>
36398 </indexterm>
36399 </para>
36400 <informaltable frame="all">
36401 <tgroup cols="4" colsep="0" rowsep="0">
36402 <colspec colwidth="8*" align="left"/>
36403 <colspec colwidth="6*" align="center"/>
36404 <colspec colwidth="6*" align="center"/>
36405 <colspec colwidth="6*" align="right"/>
36406 <tbody>
36407 <row>
36408 <entry><option>same_domain_copy_routing</option></entry>
36409 <entry>Use: <emphasis>manualroute</emphasis></entry>
36410 <entry>Type: <emphasis>boolean</emphasis></entry>
36411 <entry>Default: <emphasis>false</emphasis></entry>
36412 </row>
36413 </tbody>
36414 </tgroup>
36415 </informaltable>
36416 <para>
36417 <indexterm role="concept">
36418 <primary>address</primary>
36419 <secondary>copying routing</secondary>
36420 </indexterm>
36421 Addresses with the same domain are normally routed by the <command>manualroute</command>
36422 router to the same list of hosts. However, this cannot be presumed, because the
36423 router options and preconditions may refer to the local part of the address. By
36424 default, therefore, Exim routes each address in a message independently. DNS
36425 servers run caches, so repeated DNS lookups are not normally expensive, and in
36426 any case, personal messages rarely have more than a few recipients.
36427 </para>
36428 <para>
36429 If you are running mailing lists with large numbers of subscribers at the same
36430 domain, and you are using a <command>manualroute</command> router which is independent of the
36431 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
36432 lookups for identical domains in one message. In this case, when
36433 <command>manualroute</command> routes an address to a remote transport, any other unrouted
36434 addresses in the message that have the same domain are automatically given the
36435 same routing without processing them independently. However, this is only done
36436 if <option>headers_add</option> and <option>headers_remove</option> are unset.
36437 </para>
36438 </section>
36439 <section id="SECID120">
36440 <title>Routing rules in route_list</title>
36441 <para>
36442 The value of <option>route_list</option> is a string consisting of a sequence of routing
36443 rules, separated by semicolons. If a semicolon is needed in a rule, it can be
36444 entered as two semicolons. Alternatively, the list separator can be changed as
36445 described (for colon-separated lists) in section <xref linkend="SECTlistconstruct"/>.
36446 Empty rules are ignored. The format of each rule is
36447 </para>
36448 <literallayout>
36449 &lt;<emphasis>domain pattern</emphasis>&gt;  &lt;<emphasis>list of hosts</emphasis>&gt;  &lt;<emphasis>options</emphasis>&gt;
36450 </literallayout>
36451 <para>
36452 The following example contains two rules, each with a simple domain pattern and
36453 no options:
36454 </para>
36455 <literallayout class="monospaced">
36456 route_list = \
36457   dict.ref.example  mail-1.ref.example:mail-2.ref.example ; \
36458   thes.ref.example  mail-3.ref.example:mail-4.ref.example
36459 </literallayout>
36460 <para>
36461 The three parts of a rule are separated by white space. The pattern and the
36462 list of hosts can be enclosed in quotes if necessary, and if they are, the
36463 usual quoting rules apply. Each rule in a <option>route_list</option> must start with a
36464 single domain pattern, which is the only mandatory item in the rule. The
36465 pattern is in the same format as one item in a domain list (see section
36466 <xref linkend="SECTdomainlist"/>),
36467 except that it may not be the name of an interpolated file.
36468 That is, it may be wildcarded, or a regular expression, or a file or database
36469 lookup (with semicolons doubled, because of the use of semicolon as a separator
36470 in a <option>route_list</option>).
36471 </para>
36472 <para>
36473 The rules in <option>route_list</option> are searched in order until one of the patterns
36474 matches the domain that is being routed. The list of hosts and then options are
36475 then used as described below. If there is no match, the router declines. When
36476 <option>route_list</option> is set, <option>route_data</option> must not be set.
36477 </para>
36478 </section>
36479 <section id="SECID121">
36480 <title>Routing rules in route_data</title>
36481 <para>
36482 The use of <option>route_list</option> is convenient when there are only a small number of
36483 routing rules. For larger numbers, it is easier to use a file or database to
36484 hold the routing information, and use the <option>route_data</option> option instead.
36485 The value of <option>route_data</option> is a list of hosts, followed by (optional) options.
36486 Most commonly, <option>route_data</option> is set as a string that contains an
36487 expansion lookup. For example, suppose we place two routing rules in a file
36488 like this:
36489 </para>
36490 <literallayout class="monospaced">
36491 dict.ref.example:  mail-1.ref.example:mail-2.ref.example
36492 thes.ref.example:  mail-3.ref.example:mail-4.ref.example
36493 </literallayout>
36494 <para>
36495 This data can be accessed by setting
36496 </para>
36497 <literallayout class="monospaced">
36498 route_data = ${lookup{$domain}lsearch{/the/file/name}}
36499 </literallayout>
36500 <para>
36501 Failure of the lookup results in an empty string, causing the router to
36502 decline. However, you do not have to use a lookup in <option>route_data</option>. The only
36503 requirement is that the result of expanding the string is a list of hosts,
36504 possibly followed by options, separated by white space. The list of hosts must
36505 be enclosed in quotes if it contains white space.
36506 </para>
36507 </section>
36508 <section id="SECID122">
36509 <title>Format of the list of hosts</title>
36510 <para>
36511 A list of hosts, whether obtained via <option>route_data</option> or <option>route_list</option>, is
36512 always separately expanded before use. If the expansion fails, the router
36513 declines. The result of the expansion must be a colon-separated list of names
36514 and/or IP addresses, optionally also including ports. The format of each item
36515 in the list is described in the next section. The list separator can be changed
36516 as described in section <xref linkend="SECTlistconstruct"/>.
36517 </para>
36518 <para>
36519 If the list of hosts was obtained from a <option>route_list</option> item, the following
36520 variables are set during its expansion:
36521 </para>
36522 <itemizedlist>
36523 <listitem>
36524 <para>
36525 <indexterm role="concept">
36526 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname>  etc)</primary>
36527 <secondary>in <command>manualroute</command> router</secondary>
36528 </indexterm>
36529 If the domain was matched against a regular expression, the numeric variables
36530 <varname>$1</varname>, <varname>$2</varname>, etc. may be set. For example:
36531 </para>
36532 <literallayout class="monospaced">
36533 route_list = ^domain(\d+)   host-$1.text.example
36534 </literallayout>
36535 </listitem>
36536 <listitem>
36537 <para>
36538 <varname>$0</varname> is always set to the entire domain.
36539 </para>
36540 </listitem>
36541 <listitem>
36542 <para>
36543 <varname>$1</varname> is also set when partial matching is done in a file lookup.
36544 </para>
36545 </listitem>
36546 <listitem>
36547 <para>
36548 <indexterm role="variable">
36549 <primary><varname>$value</varname></primary>
36550 </indexterm>
36551 If the pattern that matched the domain was a lookup item, the data that was
36552 looked up is available in the expansion variable <varname>$value</varname>. For example:
36553 </para>
36554 <literallayout class="monospaced">
36555 route_list = lsearch;;/some/file.routes  $value
36556 </literallayout>
36557 </listitem>
36558 </itemizedlist>
36559 <para>
36560 Note the doubling of the semicolon in the pattern that is necessary because
36561 semicolon is the default route list separator.
36562 </para>
36563 </section>
36564 <section id="SECTformatonehostitem">
36565 <title>Format of one host item</title>
36566 <para>
36567 Each item in the list of hosts is either a host name or an IP address,
36568 optionally with an attached port number. When no port is given, an IP address
36569 is not enclosed in brackets. When a port is specified, it overrides the port
36570 specification on the transport. The port is separated from the name or address
36571 by a colon. This leads to some complications:
36572 </para>
36573 <itemizedlist>
36574 <listitem>
36575 <para>
36576 Because colon is the default separator for the list of hosts, either
36577 the colon that specifies a port must be doubled, or the list separator must
36578 be changed. The following two examples have the same effect:
36579 </para>
36580 <literallayout class="monospaced">
36581 route_list = * "host1.tld::1225 : host2.tld::1226"
36582 route_list = * "&lt;+ host1.tld:1225 + host2.tld:1226"
36583 </literallayout>
36584 </listitem>
36585 <listitem>
36586 <para>
36587 When IPv6 addresses are involved, it gets worse, because they contain
36588 colons of their own. To make this case easier, it is permitted to
36589 enclose an IP address (either v4 or v6) in square brackets if a port
36590 number follows. For example:
36591 </para>
36592 <literallayout class="monospaced">
36593 route_list = * "&lt;/ [10.1.1.1]:1225 / [::1]:1226"
36594 </literallayout>
36595 </listitem>
36596 </itemizedlist>
36597 </section>
36598 <section id="SECThostshowused">
36599 <title>How the list of hosts is used</title>
36600 <para>
36601 When an address is routed to an <command>smtp</command> transport by <command>manualroute</command>, each of
36602 the hosts is tried, in the order specified, when carrying out the SMTP
36603 delivery. However, the order can be changed by setting the <option>hosts_randomize</option>
36604 option, either on the router (see section <xref linkend="SECTprioptman"/> above), or on the
36605 transport.
36606 </para>
36607 <para>
36608 Hosts may be listed by name or by IP address. An unadorned name in the list of
36609 hosts is interpreted as a host name. A name that is followed by <literal>/MX</literal> is
36610 interpreted as an indirection to a sublist of hosts obtained by looking up MX
36611 records in the DNS. For example:
36612 </para>
36613 <literallayout class="monospaced">
36614 route_list = *  x.y.z:p.q.r/MX:e.f.g
36615 </literallayout>
36616 <para>
36617 If this feature is used with a port specifier, the port must come last. For
36618 example:
36619 </para>
36620 <literallayout class="monospaced">
36621 route_list = *  dom1.tld/mx::1225
36622 </literallayout>
36623 <para>
36624 If the <option>hosts_randomize</option> option is set, the order of the items in the list is
36625 randomized before any lookups are done. Exim then scans the list; for any name
36626 that is not followed by <literal>/MX</literal> it looks up an IP address. If this turns out to
36627 be an interface on the local host and the item is not the first in the list,
36628 Exim discards it and any subsequent items. If it is the first item, what
36629 happens is controlled by the
36630 <indexterm role="option">
36631 <primary><option>self</option></primary>
36632 <secondary>in <command>manualroute</command> router</secondary>
36633 </indexterm>
36634 <option>self</option> option of the router.
36635 </para>
36636 <para>
36637 A name on the list that is followed by <literal>/MX</literal> is replaced with the list of
36638 hosts obtained by looking up MX records for the name. This is always a DNS
36639 lookup; the <option>bydns</option> and <option>byname</option> options (see section <xref linkend="SECThowoptused"/>
36640 below) are not relevant here. The order of these hosts is determined by the
36641 preference values in the MX records, according to the usual rules. Because
36642 randomizing happens before the MX lookup, it does not affect the order that is
36643 defined by MX preferences.
36644 </para>
36645 <para>
36646 If the local host is present in the sublist obtained from MX records, but is
36647 not the most preferred host in that list, it and any equally or less
36648 preferred hosts are removed before the sublist is inserted into the main list.
36649 </para>
36650 <para>
36651 If the local host is the most preferred host in the MX list, what happens
36652 depends on where in the original list of hosts the <literal>/MX</literal> item appears. If it
36653 is not the first item (that is, there are previous hosts in the main list),
36654 Exim discards this name and any subsequent items in the main list.
36655 </para>
36656 <para>
36657 If the MX item is first in the list of hosts, and the local host is the
36658 most preferred host, what happens is controlled by the <option>self</option> option of the
36659 router.
36660 </para>
36661 <para>
36662 DNS failures when lookup up the MX records are treated in the same way as DNS
36663 failures when looking up IP addresses: <option>pass_on_timeout</option> and
36664 <option>host_find_failed</option> are used when relevant.
36665 </para>
36666 <para>
36667 The generic <option>ignore_target_hosts</option> option applies to all hosts in the list,
36668 whether obtained from an MX lookup or not.
36669 </para>
36670 </section>
36671 <section id="SECThowoptused">
36672 <title>How the options are used</title>
36673 <para>
36674 The options are a sequence of words; in practice no more than three are ever
36675 present. One of the words can be the name of a transport; this overrides the
36676 <option>transport</option> option on the router for this particular routing rule only. The
36677 other words (if present) control randomization of the list of hosts on a
36678 per-rule basis, and how the IP addresses of the hosts are to be found when
36679 routing to a remote transport. These options are as follows:
36680 </para>
36681 <itemizedlist>
36682 <listitem>
36683 <para>
36684 <option>randomize</option>: randomize the order of the hosts in this list, overriding the
36685 setting of <option>hosts_randomize</option> for this routing rule only.
36686 </para>
36687 </listitem>
36688 <listitem>
36689 <para>
36690 <option>no_randomize</option>: do not randomize the order of the hosts in this list,
36691 overriding the setting of <option>hosts_randomize</option> for this routing rule only.
36692 </para>
36693 </listitem>
36694 <listitem>
36695 <para>
36696 <option>byname</option>: use <function>getipnodebyname()</function> (<function>gethostbyname()</function> on older systems) to
36697 find IP addresses. This function may ultimately cause a DNS lookup, but it may
36698 also look in <filename>/etc/hosts</filename> or other sources of information.
36699 </para>
36700 </listitem>
36701 <listitem>
36702 <para>
36703 <option>bydns</option>: look up address records for the hosts directly in the DNS; fail if
36704 no address records are found. If there is a temporary DNS error (such as a
36705 timeout), delivery is deferred.
36706 </para>
36707 </listitem>
36708 </itemizedlist>
36709 <para>
36710 For example:
36711 </para>
36712 <literallayout class="monospaced">
36713 route_list = domain1  host1:host2:host3  randomize bydns;\
36714              domain2  host4:host5
36715 </literallayout>
36716 <para>
36717 If neither <option>byname</option> nor <option>bydns</option> is given, Exim behaves as follows: First, a
36718 DNS lookup is done. If this yields anything other than HOST_NOT_FOUND, that
36719 result is used. Otherwise, Exim goes on to try a call to <function>getipnodebyname()</function>
36720 or <function>gethostbyname()</function>, and the result of the lookup is the result of that
36721 call.
36722 </para>
36723 <para>
36724 <emphasis role="bold">Warning</emphasis>: It has been discovered that on some systems, if a DNS lookup
36725 called via <function>getipnodebyname()</function> times out, HOST_NOT_FOUND is returned
36726 instead of TRY_AGAIN. That is why the default action is to try a DNS
36727 lookup first. Only if that gives a definite <quote>no such host</quote> is the local
36728 function called.
36729 </para>
36730 <para>
36731 <emphasis role="bold">Compatibility</emphasis>: From Exim 4.85 until fixed for 4.90, there was an
36732 inadvertent constraint that a transport name as an option had to be the last
36733 option specified.
36734 </para>
36735 <para>
36736 If no IP address for a host can be found, what happens is controlled by the
36737 <option>host_find_failed</option> option.
36738 </para>
36739 <para>
36740 <indexterm role="variable">
36741 <primary><varname>$host</varname></primary>
36742 </indexterm>
36743 When an address is routed to a local transport, IP addresses are not looked up.
36744 The host list is passed to the transport in the <varname>$host</varname> variable.
36745 </para>
36746 </section>
36747 <section id="SECID123">
36748 <title>Manualroute examples</title>
36749 <para>
36750 In some of the examples that follow, the presence of the <option>remote_smtp</option>
36751 transport, as defined in the default configuration file, is assumed:
36752 </para>
36753 <itemizedlist>
36754 <listitem>
36755 <para>
36756 <indexterm role="concept">
36757 <primary>smart host</primary>
36758 <secondary>example router</secondary>
36759 </indexterm>
36760 The <command>manualroute</command> router can be used to forward all external mail to a
36761 <emphasis>smart host</emphasis>. If you have set up, in the main part of the configuration, a
36762 named domain list that contains your local domains, for example:
36763 </para>
36764 <literallayout class="monospaced">
36765 domainlist local_domains = my.domain.example
36766 </literallayout>
36767 <para>
36768 You can arrange for all other domains to be routed to a smart host by making
36769 your first router something like this:
36770 </para>
36771 <literallayout class="monospaced">
36772 smart_route:
36773   driver = manualroute
36774   domains = !+local_domains
36775   transport = remote_smtp
36776   route_list = * smarthost.ref.example
36777 </literallayout>
36778 <para>
36779 This causes all non-local addresses to be sent to the single host
36780 <emphasis>smarthost.ref.example</emphasis>. If a colon-separated list of smart hosts is given,
36781 they are tried in order
36782 (but you can use <option>hosts_randomize</option> to vary the order each time).
36783 Another way of configuring the same thing is this:
36784 </para>
36785 <literallayout class="monospaced">
36786 smart_route:
36787   driver = manualroute
36788   transport = remote_smtp
36789   route_list = !+local_domains  smarthost.ref.example
36790 </literallayout>
36791 <para>
36792 There is no difference in behaviour between these two routers as they stand.
36793 However, they behave differently if <option>no_more</option> is added to them. In the first
36794 example, the router is skipped if the domain does not match the <option>domains</option>
36795 precondition; the following router is always tried. If the router runs, it
36796 always matches the domain and so can never decline. Therefore, <option>no_more</option>
36797 would have no effect. In the second case, the router is never skipped; it
36798 always runs. However, if it doesn&#x2019;t match the domain, it declines. In this case
36799 <option>no_more</option> would prevent subsequent routers from running.
36800 </para>
36801 </listitem>
36802 <listitem>
36803 <para>
36804 <indexterm role="concept">
36805 <primary>mail hub example</primary>
36806 </indexterm>
36807 A <emphasis>mail hub</emphasis> is a host which receives mail for a number of domains via MX
36808 records in the DNS and delivers it via its own private routing mechanism. Often
36809 the final destinations are behind a firewall, with the mail hub being the one
36810 machine that can connect to machines both inside and outside the firewall. The
36811 <command>manualroute</command> router is usually used on a mail hub to route incoming messages
36812 to the correct hosts. For a small number of domains, the routing can be inline,
36813 using the <option>route_list</option> option, but for a larger number a file or database
36814 lookup is easier to manage.
36815 </para>
36816 <para>
36817 If the domain names are in fact the names of the machines to which the mail is
36818 to be sent by the mail hub, the configuration can be quite simple. For
36819 example:
36820 </para>
36821 <literallayout class="monospaced">
36822 hub_route:
36823   driver = manualroute
36824   transport = remote_smtp
36825   route_list = *.rhodes.tvs.example  $domain
36826 </literallayout>
36827 <para>
36828 This configuration routes domains that match <literal>*.rhodes.tvs.example</literal> to hosts
36829 whose names are the same as the mail domains. A similar approach can be taken
36830 if the host name can be obtained from the domain name by a string manipulation
36831 that the expansion facilities can handle. Otherwise, a lookup based on the
36832 domain can be used to find the host:
36833 </para>
36834 <literallayout class="monospaced">
36835 through_firewall:
36836   driver = manualroute
36837   transport = remote_smtp
36838   route_data = ${lookup {$domain} cdb {/internal/host/routes}}
36839 </literallayout>
36840 <para>
36841 The result of the lookup must be the name or IP address of the host (or
36842 hosts) to which the address is to be routed. If the lookup fails, the route
36843 data is empty, causing the router to decline. The address then passes to the
36844 next router.
36845 </para>
36846 </listitem>
36847 <listitem>
36848 <para>
36849 <indexterm role="concept">
36850 <primary>batched SMTP output example</primary>
36851 </indexterm>
36852 <indexterm role="concept">
36853 <primary>SMTP</primary>
36854 <secondary>batched outgoing; example</secondary>
36855 </indexterm>
36856 You can use <command>manualroute</command> to deliver messages to pipes or files in batched
36857 SMTP format for onward transportation by some other means. This is one way of
36858 storing mail for a dial-up host when it is not connected. The route list entry
36859 can be as simple as a single domain name in a configuration like this:
36860 </para>
36861 <literallayout class="monospaced">
36862 save_in_file:
36863   driver = manualroute
36864   transport = batchsmtp_appendfile
36865   route_list = saved.domain.example
36866 </literallayout>
36867 <para>
36868 though often a pattern is used to pick up more than one domain. If there are
36869 several domains or groups of domains with different transport requirements,
36870 different transports can be listed in the routing information:
36871 </para>
36872 <literallayout class="monospaced">
36873 save_in_file:
36874   driver = manualroute
36875   route_list = \
36876     *.saved.domain1.example  $domain  batch_appendfile; \
36877     *.saved.domain2.example  \
36878       ${lookup{$domain}dbm{/domain2/hosts}{$value}fail} \
36879       batch_pipe
36880 </literallayout>
36881 <para>
36882 <indexterm role="variable">
36883 <primary><varname>$domain</varname></primary>
36884 </indexterm>
36885 <indexterm role="variable">
36886 <primary><varname>$host</varname></primary>
36887 </indexterm>
36888 The first of these just passes the domain in the <varname>$host</varname> variable, which
36889 doesn&#x2019;t achieve much (since it is also in <varname>$domain</varname>), but the second does a
36890 file lookup to find a value to pass, causing the router to decline to handle
36891 the address if the lookup fails.
36892 </para>
36893 </listitem>
36894 <listitem>
36895 <para>
36896 <indexterm role="concept">
36897 <primary>UUCP</primary>
36898 <secondary>example of router for</secondary>
36899 </indexterm>
36900 Routing mail directly to UUCP software is a specific case of the use of
36901 <command>manualroute</command> in a gateway to another mail environment. This is an example of
36902 one way it can be done:
36903 </para>
36904 <literallayout class="monospaced">
36905 # Transport
36906 uucp:
36907   driver = pipe
36908   user = nobody
36909   command = /usr/local/bin/uux -r - \
36910     ${substr_-5:$host}!rmail ${local_part}
36911   return_fail_output = true
36912
36913 # Router
36914 uucphost:
36915   transport = uucp
36916   driver = manualroute
36917   route_data = \
36918     ${lookup{$domain}lsearch{/usr/local/exim/uucphosts}}
36919 </literallayout>
36920 <para>
36921 The file <filename>/usr/local/exim/uucphosts</filename> contains entries like
36922 </para>
36923 <literallayout class="monospaced">
36924 darksite.ethereal.example:           darksite.UUCP
36925 </literallayout>
36926 <para>
36927 It can be set up more simply without adding and removing <quote>.UUCP</quote> but this way
36928 makes clear the distinction between the domain name
36929 <emphasis>darksite.ethereal.example</emphasis> and the UUCP host name <emphasis>darksite</emphasis>.
36930 </para>
36931 </listitem>
36932 </itemizedlist>
36933 <para>
36934 <indexterm role="concept" startref="IIDmanrou1" class="endofrange"/>
36935 <indexterm role="concept" startref="IIDmanrou2" class="endofrange"/>
36936 </para>
36937 </section>
36938 </chapter>
36939
36940 <chapter id="CHAPdriverlast">
36941 <title>The queryprogram router</title>
36942 <para>
36943 <indexterm role="concept" id="IIDquerou1" class="startofrange">
36944 <primary><command>queryprogram</command> router</primary>
36945 </indexterm>
36946 <indexterm role="concept" id="IIDquerou2" class="startofrange">
36947 <primary>routers</primary>
36948 <secondary><command>queryprogram</command></secondary>
36949 </indexterm>
36950 <indexterm role="concept">
36951 <primary>routing</primary>
36952 <secondary>by external program</secondary>
36953 </indexterm>
36954 The <command>queryprogram</command> router routes an address by running an external command
36955 and acting on its output. This is an expensive way to route, and is intended
36956 mainly for use in lightly-loaded systems, or for performing experiments.
36957 However, if it is possible to use the precondition options (<option>domains</option>,
36958 <option>local_parts</option>, etc) to skip this router for most addresses, it could sensibly
36959 be used in special cases, even on a busy host. There are the following private
36960 options:
36961 <indexterm role="concept">
36962 <primary>options</primary>
36963 <secondary><command>queryprogram</command> router</secondary>
36964 </indexterm>
36965 </para>
36966 <para>
36967 <indexterm role="option">
36968 <primary><option>command</option></primary>
36969 </indexterm>
36970 </para>
36971 <informaltable frame="all">
36972 <tgroup cols="4" colsep="0" rowsep="0">
36973 <colspec colwidth="8*" align="left"/>
36974 <colspec colwidth="6*" align="center"/>
36975 <colspec colwidth="6*" align="center"/>
36976 <colspec colwidth="6*" align="right"/>
36977 <tbody>
36978 <row>
36979 <entry><option>command</option></entry>
36980 <entry>Use: <emphasis>queryprogram</emphasis></entry>
36981 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36982 <entry>Default: <emphasis>unset</emphasis></entry>
36983 </row>
36984 </tbody>
36985 </tgroup>
36986 </informaltable>
36987 <para>
36988 This option must be set. It specifies the command that is to be run. The
36989 command is split up into a command name and arguments, and then each is
36990 expanded separately (exactly as for a <command>pipe</command> transport, described in chapter
36991 <xref linkend="CHAPpipetransport"/>).
36992 </para>
36993 <para>
36994 <indexterm role="option">
36995 <primary><option>command_group</option></primary>
36996 </indexterm>
36997 </para>
36998 <informaltable frame="all">
36999 <tgroup cols="4" colsep="0" rowsep="0">
37000 <colspec colwidth="8*" align="left"/>
37001 <colspec colwidth="6*" align="center"/>
37002 <colspec colwidth="6*" align="center"/>
37003 <colspec colwidth="6*" align="right"/>
37004 <tbody>
37005 <row>
37006 <entry><option>command_group</option></entry>
37007 <entry>Use: <emphasis>queryprogram</emphasis></entry>
37008 <entry>Type: <emphasis>string</emphasis></entry>
37009 <entry>Default: <emphasis>unset</emphasis></entry>
37010 </row>
37011 </tbody>
37012 </tgroup>
37013 </informaltable>
37014 <para>
37015 <indexterm role="concept">
37016 <primary>gid (group id)</primary>
37017 <secondary>in <command>queryprogram</command> router</secondary>
37018 </indexterm>
37019 This option specifies a gid to be set when running the command while routing an
37020 address for deliver. It must be set if <option>command_user</option> specifies a numerical
37021 uid. If it begins with a digit, it is interpreted as the numerical value of the
37022 gid. Otherwise it is looked up using <function>getgrnam()</function>.
37023 </para>
37024 <para>
37025 <indexterm role="option">
37026 <primary><option>command_user</option></primary>
37027 </indexterm>
37028 </para>
37029 <informaltable frame="all">
37030 <tgroup cols="4" colsep="0" rowsep="0">
37031 <colspec colwidth="8*" align="left"/>
37032 <colspec colwidth="6*" align="center"/>
37033 <colspec colwidth="6*" align="center"/>
37034 <colspec colwidth="6*" align="right"/>
37035 <tbody>
37036 <row>
37037 <entry><option>command_user</option></entry>
37038 <entry>Use: <emphasis>queryprogram</emphasis></entry>
37039 <entry>Type: <emphasis>string</emphasis></entry>
37040 <entry>Default: <emphasis>unset</emphasis></entry>
37041 </row>
37042 </tbody>
37043 </tgroup>
37044 </informaltable>
37045 <para>
37046 <indexterm role="concept">
37047 <primary>uid (user id)</primary>
37048 <secondary>for <command>queryprogram</command></secondary>
37049 </indexterm>
37050 This option must be set. It specifies the uid which is set when running the
37051 command while routing an address for delivery. If the value begins with a digit,
37052 it is interpreted as the numerical value of the uid. Otherwise, it is looked up
37053 using <function>getpwnam()</function> to obtain a value for the uid and, if <option>command_group</option> is
37054 not set, a value for the gid also.
37055 </para>
37056 <para>
37057 <emphasis role="bold">Warning:</emphasis> Changing uid and gid is possible only when Exim is running as
37058 root, which it does during a normal delivery in a conventional configuration.
37059 However, when an address is being verified during message reception, Exim is
37060 usually running as the Exim user, not as root. If the <command>queryprogram</command> router
37061 is called from a non-root process, Exim cannot change uid or gid before running
37062 the command. In this circumstance the command runs under the current uid and
37063 gid.
37064 </para>
37065 <para>
37066 <indexterm role="option">
37067 <primary><option>current_directory</option></primary>
37068 </indexterm>
37069 </para>
37070 <informaltable frame="all">
37071 <tgroup cols="4" colsep="0" rowsep="0">
37072 <colspec colwidth="8*" align="left"/>
37073 <colspec colwidth="6*" align="center"/>
37074 <colspec colwidth="6*" align="center"/>
37075 <colspec colwidth="6*" align="right"/>
37076 <tbody>
37077 <row>
37078 <entry><option>current_directory</option></entry>
37079 <entry>Use: <emphasis>queryprogram</emphasis></entry>
37080 <entry>Type: <emphasis>string</emphasis></entry>
37081 <entry>Default: <emphasis>/</emphasis></entry>
37082 </row>
37083 </tbody>
37084 </tgroup>
37085 </informaltable>
37086 <para>
37087 This option specifies an absolute path which is made the current directory
37088 before running the command.
37089 </para>
37090 <para>
37091 <indexterm role="option">
37092 <primary><option>timeout</option></primary>
37093 </indexterm>
37094 </para>
37095 <informaltable frame="all">
37096 <tgroup cols="4" colsep="0" rowsep="0">
37097 <colspec colwidth="8*" align="left"/>
37098 <colspec colwidth="6*" align="center"/>
37099 <colspec colwidth="6*" align="center"/>
37100 <colspec colwidth="6*" align="right"/>
37101 <tbody>
37102 <row>
37103 <entry><option>timeout</option></entry>
37104 <entry>Use: <emphasis>queryprogram</emphasis></entry>
37105 <entry>Type: <emphasis>time</emphasis></entry>
37106 <entry>Default: <emphasis>1h</emphasis></entry>
37107 </row>
37108 </tbody>
37109 </tgroup>
37110 </informaltable>
37111 <para>
37112 If the command does not complete within the timeout period, its process group
37113 is killed and the message is frozen. A value of zero time specifies no
37114 timeout.
37115 </para>
37116 <para>
37117 The standard output of the command is connected to a pipe, which is read when
37118 the command terminates. It should consist of a single line of output,
37119 containing up to five fields, separated by white space. The maximum length of
37120 the line is 1023 characters. Longer lines are silently truncated. The first
37121 field is one of the following words (case-insensitive):
37122 </para>
37123 <itemizedlist>
37124 <listitem>
37125 <para>
37126 <emphasis>Accept</emphasis>: routing succeeded; the remaining fields specify what to do (see
37127 below).
37128 </para>
37129 </listitem>
37130 <listitem>
37131 <para>
37132 <emphasis>Decline</emphasis>: the router declines; pass the address to the next router, unless
37133 <option>no_more</option> is set.
37134 </para>
37135 </listitem>
37136 <listitem>
37137 <para>
37138 <emphasis>Fail</emphasis>: routing failed; do not pass the address to any more routers. Any
37139 subsequent text on the line is an error message. If the router is run as part
37140 of address verification during an incoming SMTP message, the message is
37141 included in the SMTP response.
37142 </para>
37143 </listitem>
37144 <listitem>
37145 <para>
37146 <emphasis>Defer</emphasis>: routing could not be completed at this time; try again later. Any
37147 subsequent text on the line is an error message which is logged. It is not
37148 included in any SMTP response.
37149 </para>
37150 </listitem>
37151 <listitem>
37152 <para>
37153 <emphasis>Freeze</emphasis>: the same as <emphasis>defer</emphasis>, except that the message is frozen.
37154 </para>
37155 </listitem>
37156 <listitem>
37157 <para>
37158 <emphasis>Pass</emphasis>: pass the address to the next router (or the router specified by
37159 <option>pass_router</option>), overriding <option>no_more</option>.
37160 </para>
37161 </listitem>
37162 <listitem>
37163 <para>
37164 <emphasis>Redirect</emphasis>: the message is redirected. The remainder of the line is a list of
37165 new addresses, which are routed independently, starting with the first router,
37166 or the router specified by <option>redirect_router</option>, if set.
37167 </para>
37168 </listitem>
37169 </itemizedlist>
37170 <para>
37171 When the first word is <emphasis>accept</emphasis>, the remainder of the line consists of a
37172 number of keyed data values, as follows (split into two lines here, to fit on
37173 the page):
37174 </para>
37175 <literallayout class="monospaced">
37176 ACCEPT TRANSPORT=&lt;transport&gt; HOSTS=&lt;list of hosts&gt;
37177 LOOKUP=byname|bydns DATA=&lt;text&gt;
37178 </literallayout>
37179 <para>
37180 The data items can be given in any order, and all are optional. If no transport
37181 is included, the transport specified by the generic <option>transport</option> option is
37182 used. The list of hosts and the lookup type are needed only if the transport is
37183 an <command>smtp</command> transport that does not itself supply a list of hosts.
37184 </para>
37185 <para>
37186 The format of the list of hosts is the same as for the <command>manualroute</command> router.
37187 As well as host names and IP addresses with optional port numbers, as described
37188 in section <xref linkend="SECTformatonehostitem"/>, it may contain names followed by
37189 <literal>/MX</literal> to specify sublists of hosts that are obtained by looking up MX records
37190 (see section <xref linkend="SECThostshowused"/>).
37191 </para>
37192 <para>
37193 If the lookup type is not specified, Exim behaves as follows when trying to
37194 find an IP address for each host: First, a DNS lookup is done. If this yields
37195 anything other than HOST_NOT_FOUND, that result is used. Otherwise, Exim
37196 goes on to try a call to <function>getipnodebyname()</function> or <function>gethostbyname()</function>, and the
37197 result of the lookup is the result of that call.
37198 </para>
37199 <para>
37200 <indexterm role="variable">
37201 <primary><varname>$address_data</varname></primary>
37202 </indexterm>
37203 If the DATA field is set, its value is placed in the <varname>$address_data</varname>
37204 variable. For example, this return line
37205 </para>
37206 <literallayout class="monospaced">
37207 accept hosts=x1.y.example:x2.y.example data="rule1"
37208 </literallayout>
37209 <para>
37210 routes the address to the default transport, passing a list of two hosts. When
37211 the transport runs, the string <quote>rule1</quote> is in <varname>$address_data</varname>.
37212 <indexterm role="concept" startref="IIDquerou1" class="endofrange"/>
37213 <indexterm role="concept" startref="IIDquerou2" class="endofrange"/>
37214 </para>
37215 </chapter>
37216
37217 <chapter id="CHAPredirect">
37218 <title>The redirect router</title>
37219 <para>
37220 <indexterm role="concept" id="IIDredrou1" class="startofrange">
37221 <primary><command>redirect</command> router</primary>
37222 </indexterm>
37223 <indexterm role="concept" id="IIDredrou2" class="startofrange">
37224 <primary>routers</primary>
37225 <secondary><command>redirect</command></secondary>
37226 </indexterm>
37227 <indexterm role="concept">
37228 <primary>alias file</primary>
37229 <secondary>in a <command>redirect</command> router</secondary>
37230 </indexterm>
37231 <indexterm role="concept">
37232 <primary>address redirection</primary>
37233 <secondary><command>redirect</command> router</secondary>
37234 </indexterm>
37235 The <command>redirect</command> router handles several kinds of address redirection. Its most
37236 common uses are for resolving local part aliases from a central alias file
37237 (usually called <filename>/etc/aliases</filename>) and for handling users&#x2019; personal <filename>.forward</filename>
37238 files, but it has many other potential uses. The incoming address can be
37239 redirected in several different ways:
37240 </para>
37241 <itemizedlist>
37242 <listitem>
37243 <para>
37244 It can be replaced by one or more new addresses which are themselves routed
37245 independently.
37246 </para>
37247 </listitem>
37248 <listitem>
37249 <para>
37250 It can be routed to be delivered to a given file or directory.
37251 </para>
37252 </listitem>
37253 <listitem>
37254 <para>
37255 It can be routed to be delivered to a specified pipe command.
37256 </para>
37257 </listitem>
37258 <listitem>
37259 <para>
37260 It can cause an automatic reply to be generated.
37261 </para>
37262 </listitem>
37263 <listitem>
37264 <para>
37265 It can be forced to fail, optionally with a custom error message.
37266 </para>
37267 </listitem>
37268 <listitem>
37269 <para>
37270 It can be temporarily deferred, optionally with a custom message.
37271 </para>
37272 </listitem>
37273 <listitem>
37274 <para>
37275 It can be discarded.
37276 </para>
37277 </listitem>
37278 </itemizedlist>
37279 <para>
37280 The generic <option>transport</option> option must not be set for <command>redirect</command> routers.
37281 However, there are some private options which define transports for delivery to
37282 files and pipes, and for generating autoreplies. See the <option>file_transport</option>,
37283 <option>pipe_transport</option> and <option>reply_transport</option> descriptions below.
37284 </para>
37285 <para>
37286 If success DSNs have been requested
37287 <indexterm role="concept">
37288 <primary>DSN</primary>
37289 <secondary>success</secondary>
37290 </indexterm>
37291 <indexterm role="concept">
37292 <primary>Delivery Status Notification</primary>
37293 <secondary>success</secondary>
37294 </indexterm>
37295 redirection triggers one and the DSN options are not passed any further.
37296 </para>
37297 <section id="SECID124">
37298 <title>Redirection data</title>
37299 <para>
37300 The router operates by interpreting a text string which it obtains either by
37301 expanding the contents of the <option>data</option> option, or by reading the entire
37302 contents of a file whose name is given in the <option>file</option> option. These two
37303 options are mutually exclusive. The first is commonly used for handling system
37304 aliases, in a configuration like this:
37305 </para>
37306 <literallayout class="monospaced">
37307 system_aliases:
37308   driver = redirect
37309   data = ${lookup{$local_part}lsearch{/etc/aliases}}
37310 </literallayout>
37311 <para>
37312 If the lookup fails, the expanded string in this example is empty. When the
37313 expansion of <option>data</option> results in an empty string, the router declines. A forced
37314 expansion failure also causes the router to decline; other expansion failures
37315 cause delivery to be deferred.
37316 </para>
37317 <para>
37318 A configuration using <option>file</option> is commonly used for handling users&#x2019;
37319 <filename>.forward</filename> files, like this:
37320 </para>
37321 <literallayout class="monospaced">
37322 userforward:
37323   driver = redirect
37324   check_local_user
37325   file = $home/.forward
37326   no_verify
37327 </literallayout>
37328 <para>
37329 If the file does not exist, or causes no action to be taken (for example, it is
37330 empty or consists only of comments), the router declines. <emphasis role="bold">Warning</emphasis>: This
37331 is not the case when the file contains syntactically valid items that happen to
37332 yield empty addresses, for example, items containing only RFC 2822 address
37333 comments.
37334 </para>
37335 </section>
37336 <section id="SECID125">
37337 <title>Forward files and address verification</title>
37338 <para>
37339 <indexterm role="concept">
37340 <primary>address redirection</primary>
37341 <secondary>while verifying</secondary>
37342 </indexterm>
37343 It is usual to set <option>no_verify</option> on <command>redirect</command> routers which handle users&#x2019;
37344 <filename>.forward</filename> files, as in the example above. There are two reasons for this:
37345 </para>
37346 <itemizedlist>
37347 <listitem>
37348 <para>
37349 When Exim is receiving an incoming SMTP message from a remote host, it is
37350 running under the Exim uid, not as root. Exim is unable to change uid to read
37351 the file as the user, and it may not be able to read it as the Exim user. So in
37352 practice the router may not be able to operate.
37353 </para>
37354 </listitem>
37355 <listitem>
37356 <para>
37357 However, even when the router can operate, the existence of a <filename>.forward</filename> file
37358 is unimportant when verifying an address. What should be checked is whether the
37359 local part is a valid user name or not. Cutting out the redirection processing
37360 saves some resources.
37361 </para>
37362 </listitem>
37363 </itemizedlist>
37364 </section>
37365 <section id="SECID126">
37366 <title>Interpreting redirection data</title>
37367 <para>
37368 <indexterm role="concept">
37369 <primary>Sieve filter</primary>
37370 <secondary>specifying in redirection data</secondary>
37371 </indexterm>
37372 <indexterm role="concept">
37373 <primary>filter</primary>
37374 <secondary>specifying in redirection data</secondary>
37375 </indexterm>
37376 The contents of the data string, whether obtained from <option>data</option> or <option>file</option>,
37377 can be interpreted in two different ways:
37378 </para>
37379 <itemizedlist>
37380 <listitem>
37381 <para>
37382 If the <option>allow_filter</option> option is set true, and the data begins with the text
37383 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote>, it is interpreted as a list of
37384 <emphasis>filtering</emphasis> instructions in the form of an Exim or Sieve filter file,
37385 respectively. Details of the syntax and semantics of filter files are described
37386 in a separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>; this
37387 document is intended for use by end users.
37388 </para>
37389 </listitem>
37390 <listitem>
37391 <para>
37392 Otherwise, the data must be a comma-separated list of redirection items, as
37393 described in the next section.
37394 </para>
37395 </listitem>
37396 </itemizedlist>
37397 <para>
37398 When a message is redirected to a file (a <quote>mail folder</quote>), the file name given
37399 in a non-filter redirection list must always be an absolute path. A filter may
37400 generate a relative path &ndash; how this is handled depends on the transport&#x2019;s
37401 configuration. See section <xref linkend="SECTfildiropt"/> for a discussion of this issue
37402 for the <command>appendfile</command> transport.
37403 </para>
37404 </section>
37405 <section id="SECTitenonfilred">
37406 <title>Items in a non-filter redirection list</title>
37407 <para>
37408 <indexterm role="concept">
37409 <primary>address redirection</primary>
37410 <secondary>non-filter list items</secondary>
37411 </indexterm>
37412 When the redirection data is not an Exim or Sieve filter, for example, if it
37413 comes from a conventional alias or forward file, it consists of a list of
37414 addresses, file names, pipe commands, or certain special items (see section
37415 <xref linkend="SECTspecitredli"/> below). The special items can be individually enabled or
37416 disabled by means of options whose names begin with <option>allow_</option> or <option>forbid_</option>,
37417 depending on their default values. The items in the list are separated by
37418 commas or newlines.
37419 If a comma is required in an item, the entire item must be enclosed in double
37420 quotes.
37421 </para>
37422 <para>
37423 Lines starting with a # character are comments, and are ignored, and # may
37424 also appear following a comma, in which case everything between the # and the
37425 next newline character is ignored.
37426 </para>
37427 <para>
37428 If an item is entirely enclosed in double quotes, these are removed. Otherwise
37429 double quotes are retained because some forms of mail address require their use
37430 (but never to enclose the entire address). In the following description,
37431 <quote>item</quote> refers to what remains after any surrounding double quotes have been
37432 removed.
37433 </para>
37434 <para>
37435 <indexterm role="variable">
37436 <primary><varname>$local_part</varname></primary>
37437 </indexterm>
37438 <emphasis role="bold">Warning</emphasis>: If you use an Exim expansion to construct a redirection address,
37439 and the expansion contains a reference to <varname>$local_part</varname>, you should make use
37440 of the <option>quote_local_part</option> expansion operator, in case the local part contains
37441 special characters. For example, to redirect all mail for the domain
37442 <emphasis>obsolete.example</emphasis>, retaining the existing local part, you could use this
37443 setting:
37444 </para>
37445 <literallayout class="monospaced">
37446 data = ${quote_local_part:$local_part}@newdomain.example
37447 </literallayout>
37448 </section>
37449 <section id="SECTredlocmai">
37450 <title>Redirecting to a local mailbox</title>
37451 <para>
37452 <indexterm role="concept">
37453 <primary>routing</primary>
37454 <secondary>loops in</secondary>
37455 </indexterm>
37456 <indexterm role="concept">
37457 <primary>loop</primary>
37458 <secondary>while routing, avoidance of</secondary>
37459 </indexterm>
37460 <indexterm role="concept">
37461 <primary>address redirection</primary>
37462 <secondary>to local mailbox</secondary>
37463 </indexterm>
37464 A redirection item may safely be the same as the address currently under
37465 consideration. This does not cause a routing loop, because a router is
37466 automatically skipped if any ancestor of the address that is being processed
37467 is the same as the current address and was processed by the current router.
37468 Such an address is therefore passed to the following routers, so it is handled
37469 as if there were no redirection. When making this loop-avoidance test, the
37470 complete local part, including any prefix or suffix, is used.
37471 </para>
37472 <para>
37473 <indexterm role="concept">
37474 <primary>address redirection</primary>
37475 <secondary>local part without domain</secondary>
37476 </indexterm>
37477 Specifying the same local part without a domain is a common usage in personal
37478 filter files when the user wants to have messages delivered to the local
37479 mailbox and also forwarded elsewhere. For example, the user whose login is
37480 <emphasis>cleo</emphasis> might have a <filename>.forward</filename> file containing this:
37481 </para>
37482 <literallayout class="monospaced">
37483 cleo, cleopatra@egypt.example
37484 </literallayout>
37485 <para>
37486 <indexterm role="concept">
37487 <primary>backslash in alias file</primary>
37488 </indexterm>
37489 <indexterm role="concept">
37490 <primary>alias file</primary>
37491 <secondary>backslash in</secondary>
37492 </indexterm>
37493 For compatibility with other MTAs, such unqualified local parts may be
37494 preceded by <quote>\</quote>, but this is not a requirement for loop prevention. However,
37495 it does make a difference if more than one domain is being handled
37496 synonymously.
37497 </para>
37498 <para>
37499 If an item begins with <quote>\</quote> and the rest of the item parses as a valid RFC
37500 2822 address that does not include a domain, the item is qualified using the
37501 domain of the incoming address. In the absence of a leading <quote>\</quote>, unqualified
37502 addresses are qualified using the value in <option>qualify_recipient</option>, but you can
37503 force the incoming domain to be used by setting <option>qualify_preserve_domain</option>.
37504 </para>
37505 <para>
37506 Care must be taken if there are alias names for local users.
37507 Consider an MTA handling a single local domain where the system alias file
37508 contains:
37509 </para>
37510 <literallayout class="monospaced">
37511 Sam.Reman: spqr
37512 </literallayout>
37513 <para>
37514 Now suppose that Sam (whose login id is <emphasis>spqr</emphasis>) wants to save copies of
37515 messages in the local mailbox, and also forward copies elsewhere. He creates
37516 this forward file:
37517 </para>
37518 <literallayout class="monospaced">
37519 Sam.Reman, spqr@reme.elsewhere.example
37520 </literallayout>
37521 <para>
37522 With these settings, an incoming message addressed to <emphasis>Sam.Reman</emphasis> fails. The
37523 <command>redirect</command> router for system aliases does not process <emphasis>Sam.Reman</emphasis> the
37524 second time round, because it has previously routed it,
37525 and the following routers presumably cannot handle the alias. The forward file
37526 should really contain
37527 </para>
37528 <literallayout class="monospaced">
37529 spqr, spqr@reme.elsewhere.example
37530 </literallayout>
37531 <para>
37532 but because this is such a common error, the <option>check_ancestor</option> option (see
37533 below) exists to provide a way to get round it. This is normally set on a
37534 <command>redirect</command> router that is handling users&#x2019; <filename>.forward</filename> files.
37535 </para>
37536 </section>
37537 <section id="SECTspecitredli">
37538 <title>Special items in redirection lists</title>
37539 <para>
37540 In addition to addresses, the following types of item may appear in redirection
37541 lists (that is, in non-filter redirection data):
37542 </para>
37543 <itemizedlist>
37544 <listitem>
37545 <para>
37546 <indexterm role="concept">
37547 <primary>pipe</primary>
37548 <secondary>in redirection list</secondary>
37549 </indexterm>
37550 <indexterm role="concept">
37551 <primary>address redirection</primary>
37552 <secondary>to pipe</secondary>
37553 </indexterm>
37554 An item is treated as a pipe command if it begins with <quote>|</quote> and does not parse
37555 as a valid RFC 2822 address that includes a domain. A transport for running the
37556 command must be specified by the <option>pipe_transport</option> option.
37557 Normally, either the router or the transport specifies a user and a group under
37558 which to run the delivery. The default is to use the Exim user and group.
37559 </para>
37560 <para>
37561 Single or double quotes can be used for enclosing the individual arguments of
37562 the pipe command; no interpretation of escapes is done for single quotes. If
37563 the command contains a comma character, it is necessary to put the whole item
37564 in double quotes, for example:
37565 </para>
37566 <literallayout class="monospaced">
37567 "|/some/command ready,steady,go"
37568 </literallayout>
37569 <para>
37570 since items in redirection lists are terminated by commas. Do not, however,
37571 quote just the command. An item such as
37572 </para>
37573 <literallayout class="monospaced">
37574 |"/some/command ready,steady,go"
37575 </literallayout>
37576 <para>
37577 is interpreted as a pipe with a rather strange command name, and no arguments.
37578 </para>
37579 <para>
37580 Note that the above example assumes that the text comes from a lookup source
37581 of some sort, so that the quotes are part of the data.  If composing a
37582 redirect router with a <option>data</option> option directly specifying this command, the
37583 quotes will be used by the configuration parser to define the extent of one
37584 string, but will not be passed down into the redirect router itself.  There
37585 are two main approaches to get around this: escape quotes to be part of the
37586 data itself, or avoid using this mechanism and instead create a custom
37587 transport with the <option>command</option> option set and reference that transport from
37588 an <option>accept</option> router.
37589 </para>
37590 </listitem>
37591 <listitem>
37592 <para>
37593 <indexterm role="concept">
37594 <primary>file</primary>
37595 <secondary>in redirection list</secondary>
37596 </indexterm>
37597 <indexterm role="concept">
37598 <primary>address redirection</primary>
37599 <secondary>to file</secondary>
37600 </indexterm>
37601 An item is interpreted as a path name if it begins with <quote>/</quote> and does not
37602 parse as a valid RFC 2822 address that includes a domain. For example,
37603 </para>
37604 <literallayout class="monospaced">
37605 /home/world/minbari
37606 </literallayout>
37607 <para>
37608 is treated as a file name, but
37609 </para>
37610 <literallayout class="monospaced">
37611 /s=molari/o=babylon/@x400gate.way
37612 </literallayout>
37613 <para>
37614 is treated as an address. For a file name, a transport must be specified using
37615 the <option>file_transport</option> option. However, if the generated path name ends with a
37616 forward slash character, it is interpreted as a directory name rather than a
37617 file name, and <option>directory_transport</option> is used instead.
37618 </para>
37619 <para>
37620 Normally, either the router or the transport specifies a user and a group under
37621 which to run the delivery. The default is to use the Exim user and group.
37622 </para>
37623 <para>
37624 <indexterm role="concept">
37625 <primary><filename>/dev/null</filename></primary>
37626 </indexterm>
37627 However, if a redirection item is the path <filename>/dev/null</filename>, delivery to it is
37628 bypassed at a high level, and the log entry shows <quote>**bypassed**</quote>
37629 instead of a transport name. In this case the user and group are not used.
37630 </para>
37631 </listitem>
37632 <listitem>
37633 <para>
37634 <indexterm role="concept">
37635 <primary>included address list</primary>
37636 </indexterm>
37637 <indexterm role="concept">
37638 <primary>address redirection</primary>
37639 <secondary>included external list</secondary>
37640 </indexterm>
37641 If an item is of the form
37642 </para>
37643 <literallayout class="monospaced">
37644 :include:&lt;path name&gt;
37645 </literallayout>
37646 <para>
37647 a list of further items is taken from the given file and included at that
37648 point. <emphasis role="bold">Note</emphasis>: Such a file can not be a filter file; it is just an
37649 out-of-line addition to the list. The items in the included list are separated
37650 by commas or newlines and are not subject to expansion. If this is the first
37651 item in an alias list in an <command>lsearch</command> file, a colon must be used to terminate
37652 the alias name. This example is incorrect:
37653 </para>
37654 <literallayout class="monospaced">
37655 list1    :include:/opt/lists/list1
37656 </literallayout>
37657 <para>
37658 It must be given as
37659 </para>
37660 <literallayout class="monospaced">
37661 list1:   :include:/opt/lists/list1
37662 </literallayout>
37663 </listitem>
37664 <listitem>
37665 <para>
37666 <indexterm role="concept">
37667 <primary>address redirection</primary>
37668 <secondary>to black hole</secondary>
37669 </indexterm>
37670 <indexterm role="concept">
37671 <primary>delivery</primary>
37672 <secondary>discard</secondary>
37673 </indexterm>
37674 <indexterm role="concept">
37675 <primary>delivery</primary>
37676 <secondary>blackhole</secondary>
37677 </indexterm>
37678 <indexterm role="concept">
37679 <primary>black hole</primary>
37680 </indexterm>
37681 <indexterm role="concept">
37682 <primary>abandoning mail</primary>
37683 </indexterm>
37684 Sometimes you want to throw away mail to a particular local part.  Making the
37685 <option>data</option> option expand to an empty string does not work, because that causes
37686 the router to decline. Instead, the alias item
37687 </para>
37688 <literallayout class="monospaced">
37689 :blackhole:
37690 </literallayout>
37691 <para>
37692 can be used. It does what its name implies. No delivery is
37693 done, and no error message is generated. This has the same effect as specifying
37694 <filename>/dev/null</filename> as a destination, but it can be independently disabled.
37695 </para>
37696 <para>
37697 <emphasis role="bold">Warning</emphasis>: If <emphasis>:blackhole:</emphasis> appears anywhere in a redirection list, no
37698 delivery is done for the original local part, even if other redirection items
37699 are present. If you are generating a multi-item list (for example, by reading a
37700 database) and need the ability to provide a no-op item, you must use
37701 <filename>/dev/null</filename>.
37702 </para>
37703 </listitem>
37704 <listitem>
37705 <para>
37706 <indexterm role="concept">
37707 <primary>delivery</primary>
37708 <secondary>forcing failure</secondary>
37709 </indexterm>
37710 <indexterm role="concept">
37711 <primary>delivery</primary>
37712 <secondary>forcing deferral</secondary>
37713 </indexterm>
37714 <indexterm role="concept">
37715 <primary>failing delivery</primary>
37716 <secondary>forcing</secondary>
37717 </indexterm>
37718 <indexterm role="concept">
37719 <primary>deferred delivery, forcing</primary>
37720 </indexterm>
37721 <indexterm role="concept">
37722 <primary>customizing</primary>
37723 <secondary>failure message</secondary>
37724 </indexterm>
37725 An attempt to deliver a particular address can be deferred or forced to fail by
37726 redirection items of the form
37727 </para>
37728 <literallayout class="monospaced">
37729 :defer:
37730 :fail:
37731 </literallayout>
37732 <para>
37733 respectively. When a redirection list contains such an item, it applies
37734 to the entire redirection; any other items in the list are ignored. Any
37735 text following <emphasis>:fail:</emphasis> or <emphasis>:defer:</emphasis> is placed in the error text
37736 associated with the failure. For example, an alias file might contain:
37737 </para>
37738 <literallayout class="monospaced">
37739 X.Employee:  :fail: Gone away, no forwarding address
37740 </literallayout>
37741 <para>
37742 In the case of an address that is being verified from an ACL or as the subject
37743 of a
37744 <indexterm role="concept">
37745 <primary>VRFY</primary>
37746 <secondary>error text, display of</secondary>
37747 </indexterm>
37748 VRFY command, the text is included in the SMTP error response by
37749 default.
37750 <indexterm role="concept">
37751 <primary>EXPN</primary>
37752 <secondary>error text, display of</secondary>
37753 </indexterm>
37754 The text is not included in the response to an EXPN command. In non-SMTP cases
37755 the text is included in the error message that Exim generates.
37756 </para>
37757 <para>
37758 <indexterm role="concept">
37759 <primary>SMTP</primary>
37760 <secondary>error codes</secondary>
37761 </indexterm>
37762 By default, Exim sends a 451 SMTP code for a <emphasis>:defer:</emphasis>, and 550 for
37763 <emphasis>:fail:</emphasis>. However, if the message starts with three digits followed by a
37764 space, optionally followed by an extended code of the form <emphasis>n.n.n</emphasis>, also
37765 followed by a space, and the very first digit is the same as the default error
37766 code, the code from the message is used instead. If the very first digit is
37767 incorrect, a panic error is logged, and the default code is used. You can
37768 suppress the use of the supplied code in a redirect router by setting the
37769 <option>forbid_smtp_code</option> option true. In this case, any SMTP code is quietly
37770 ignored.
37771 </para>
37772 <para>
37773 <indexterm role="variable">
37774 <primary><varname>$acl_verify_message</varname></primary>
37775 </indexterm>
37776 In an ACL, an explicitly provided message overrides the default, but the
37777 default message is available in the variable <varname>$acl_verify_message</varname> and can
37778 therefore be included in a custom message if this is desired.
37779 </para>
37780 <para>
37781 Normally the error text is the rest of the redirection list &ndash; a comma does
37782 not terminate it &ndash; but a newline does act as a terminator. Newlines are not
37783 normally present in alias expansions. In <command>lsearch</command> lookups they are removed
37784 as part of the continuation process, but they may exist in other kinds of
37785 lookup and in <emphasis>:include:</emphasis> files.
37786 </para>
37787 <para>
37788 During routing for message delivery (as opposed to verification), a redirection
37789 containing <emphasis>:fail:</emphasis> causes an immediate failure of the incoming address,
37790 whereas <emphasis>:defer:</emphasis> causes the message to remain on the queue so that a
37791 subsequent delivery attempt can happen at a later time. If an address is
37792 deferred for too long, it will ultimately fail, because the normal retry
37793 rules still apply.
37794 </para>
37795 </listitem>
37796 <listitem>
37797 <para>
37798 <indexterm role="concept">
37799 <primary>alias file</primary>
37800 <secondary>exception to default</secondary>
37801 </indexterm>
37802 Sometimes it is useful to use a single-key search type with a default (see
37803 chapter <xref linkend="CHAPfdlookup"/>) to look up aliases. However, there may be a need
37804 for exceptions to the default. These can be handled by aliasing them to
37805 <emphasis>:unknown:</emphasis>. This differs from <emphasis>:fail:</emphasis> in that it causes the <command>redirect</command>
37806 router to decline, whereas <emphasis>:fail:</emphasis> forces routing to fail. A lookup which
37807 results in an empty redirection list has the same effect.
37808 </para>
37809 </listitem>
37810 </itemizedlist>
37811 </section>
37812 <section id="SECTdupaddr">
37813 <title>Duplicate addresses</title>
37814 <para>
37815 <indexterm role="concept">
37816 <primary>duplicate addresses</primary>
37817 </indexterm>
37818 <indexterm role="concept">
37819 <primary>address duplicate, discarding</primary>
37820 </indexterm>
37821 <indexterm role="concept">
37822 <primary>pipe</primary>
37823 <secondary>duplicated</secondary>
37824 </indexterm>
37825 Exim removes duplicate addresses from the list to which it is delivering, so as
37826 to deliver just one copy to each address. This does not apply to deliveries
37827 routed to pipes by different immediate parent addresses, but an indirect
37828 aliasing scheme of the type
37829 </para>
37830 <literallayout class="monospaced">
37831 pipe:       |/some/command $local_part
37832 localpart1: pipe
37833 localpart2: pipe
37834 </literallayout>
37835 <para>
37836 does not work with a message that is addressed to both local parts, because
37837 when the second is aliased to the intermediate local part <quote>pipe</quote> it gets
37838 discarded as being the same as a previously handled address. However, a scheme
37839 such as
37840 </para>
37841 <literallayout class="monospaced">
37842 localpart1: |/some/command $local_part
37843 localpart2: |/some/command $local_part
37844 </literallayout>
37845 <para>
37846 does result in two different pipe deliveries, because the immediate parents of
37847 the pipes are distinct.
37848 </para>
37849 </section>
37850 <section id="SECID128">
37851 <title>Repeated redirection expansion</title>
37852 <para>
37853 <indexterm role="concept">
37854 <primary>repeated redirection expansion</primary>
37855 </indexterm>
37856 <indexterm role="concept">
37857 <primary>address redirection</primary>
37858 <secondary>repeated for each delivery attempt</secondary>
37859 </indexterm>
37860 When a message cannot be delivered to all of its recipients immediately,
37861 leading to two or more delivery attempts, redirection expansion is carried out
37862 afresh each time for those addresses whose children were not all previously
37863 delivered. If redirection is being used as a mailing list, this can lead to new
37864 members of the list receiving copies of old messages. The <option>one_time</option> option
37865 can be used to avoid this.
37866 </para>
37867 </section>
37868 <section id="SECID129">
37869 <title>Errors in redirection lists</title>
37870 <para>
37871 <indexterm role="concept">
37872 <primary>address redirection</primary>
37873 <secondary>errors</secondary>
37874 </indexterm>
37875 If <option>skip_syntax_errors</option> is set, a malformed address that causes a parsing
37876 error is skipped, and an entry is written to the main log. This may be useful
37877 for mailing lists that are automatically managed. Otherwise, if an error is
37878 detected while generating the list of new addresses, the original address is
37879 deferred. See also <option>syntax_errors_to</option>.
37880 </para>
37881 </section>
37882 <section id="SECID130">
37883 <title>Private options for the redirect router</title>
37884 <para>
37885 <indexterm role="concept">
37886 <primary>options</primary>
37887 <secondary><command>redirect</command> router</secondary>
37888 </indexterm>
37889 The private options for the <command>redirect</command> router are as follows:
37890 </para>
37891 <para>
37892 <indexterm role="option">
37893 <primary><option>allow_defer</option></primary>
37894 </indexterm>
37895 </para>
37896 <informaltable frame="all">
37897 <tgroup cols="4" colsep="0" rowsep="0">
37898 <colspec colwidth="8*" align="left"/>
37899 <colspec colwidth="6*" align="center"/>
37900 <colspec colwidth="6*" align="center"/>
37901 <colspec colwidth="6*" align="right"/>
37902 <tbody>
37903 <row>
37904 <entry><option>allow_defer</option></entry>
37905 <entry>Use: <emphasis>redirect</emphasis></entry>
37906 <entry>Type: <emphasis>boolean</emphasis></entry>
37907 <entry>Default: <emphasis>false</emphasis></entry>
37908 </row>
37909 </tbody>
37910 </tgroup>
37911 </informaltable>
37912 <para>
37913 Setting this option allows the use of <emphasis>:defer:</emphasis> in non-filter redirection
37914 data, or the <option>defer</option> command in an Exim filter file.
37915 </para>
37916 <para>
37917 <indexterm role="option">
37918 <primary><option>allow_fail</option></primary>
37919 </indexterm>
37920 </para>
37921 <informaltable frame="all">
37922 <tgroup cols="4" colsep="0" rowsep="0">
37923 <colspec colwidth="8*" align="left"/>
37924 <colspec colwidth="6*" align="center"/>
37925 <colspec colwidth="6*" align="center"/>
37926 <colspec colwidth="6*" align="right"/>
37927 <tbody>
37928 <row>
37929 <entry><option>allow_fail</option></entry>
37930 <entry>Use: <emphasis>redirect</emphasis></entry>
37931 <entry>Type: <emphasis>boolean</emphasis></entry>
37932 <entry>Default: <emphasis>false</emphasis></entry>
37933 </row>
37934 </tbody>
37935 </tgroup>
37936 </informaltable>
37937 <para>
37938 <indexterm role="concept">
37939 <primary>failing delivery</primary>
37940 <secondary>from filter</secondary>
37941 </indexterm>
37942 If this option is true, the <emphasis>:fail:</emphasis> item can be used in a redirection list,
37943 and the <option>fail</option> command may be used in an Exim filter file.
37944 </para>
37945 <para>
37946 <indexterm role="option">
37947 <primary><option>allow_filter</option></primary>
37948 </indexterm>
37949 </para>
37950 <informaltable frame="all">
37951 <tgroup cols="4" colsep="0" rowsep="0">
37952 <colspec colwidth="8*" align="left"/>
37953 <colspec colwidth="6*" align="center"/>
37954 <colspec colwidth="6*" align="center"/>
37955 <colspec colwidth="6*" align="right"/>
37956 <tbody>
37957 <row>
37958 <entry><option>allow_filter</option></entry>
37959 <entry>Use: <emphasis>redirect</emphasis></entry>
37960 <entry>Type: <emphasis>boolean</emphasis></entry>
37961 <entry>Default: <emphasis>false</emphasis></entry>
37962 </row>
37963 </tbody>
37964 </tgroup>
37965 </informaltable>
37966 <para>
37967 <indexterm role="concept">
37968 <primary>filter</primary>
37969 <secondary>enabling use of</secondary>
37970 </indexterm>
37971 <indexterm role="concept">
37972 <primary>Sieve filter</primary>
37973 <secondary>enabling use of</secondary>
37974 </indexterm>
37975 Setting this option allows Exim to interpret redirection data that starts with
37976 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote> as a set of filtering instructions. There
37977 are some features of Exim filter files that some administrators may wish to
37978 lock out; see the <option>forbid_filter_</option><emphasis>xxx</emphasis> options below.
37979 </para>
37980 <para>
37981 It is also possible to lock out Exim filters or Sieve filters while allowing
37982 the other type; see <option>forbid_exim_filter</option> and <option>forbid_sieve_filter</option>.
37983 </para>
37984 <para>
37985 The filter is run using the uid and gid set by the generic <option>user</option> and
37986 <option>group</option> options. These take their defaults from the password data if
37987 <option>check_local_user</option> is set, so in the normal case of users&#x2019; personal filter
37988 files, the filter is run as the relevant user. When <option>allow_filter</option> is set
37989 true, Exim insists that either <option>check_local_user</option> or <option>user</option> is set.
37990 </para>
37991 <para>
37992 <indexterm role="option">
37993 <primary><option>allow_freeze</option></primary>
37994 </indexterm>
37995 </para>
37996 <informaltable frame="all">
37997 <tgroup cols="4" colsep="0" rowsep="0">
37998 <colspec colwidth="8*" align="left"/>
37999 <colspec colwidth="6*" align="center"/>
38000 <colspec colwidth="6*" align="center"/>
38001 <colspec colwidth="6*" align="right"/>
38002 <tbody>
38003 <row>
38004 <entry><option>allow_freeze</option></entry>
38005 <entry>Use: <emphasis>redirect</emphasis></entry>
38006 <entry>Type: <emphasis>boolean</emphasis></entry>
38007 <entry>Default: <emphasis>false</emphasis></entry>
38008 </row>
38009 </tbody>
38010 </tgroup>
38011 </informaltable>
38012 <para>
38013 <indexterm role="concept">
38014 <primary>freezing messages</primary>
38015 <secondary>allowing in filter</secondary>
38016 </indexterm>
38017 Setting this option allows the use of the <option>freeze</option> command in an Exim filter.
38018 This command is more normally encountered in system filters, and is disabled by
38019 default for redirection filters because it isn&#x2019;t something you usually want to
38020 let ordinary users do.
38021 </para>
38022 <para>
38023 <indexterm role="option">
38024 <primary><option>check_ancestor</option></primary>
38025 </indexterm>
38026 </para>
38027 <informaltable frame="all">
38028 <tgroup cols="4" colsep="0" rowsep="0">
38029 <colspec colwidth="8*" align="left"/>
38030 <colspec colwidth="6*" align="center"/>
38031 <colspec colwidth="6*" align="center"/>
38032 <colspec colwidth="6*" align="right"/>
38033 <tbody>
38034 <row>
38035 <entry><option>check_ancestor</option></entry>
38036 <entry>Use: <emphasis>redirect</emphasis></entry>
38037 <entry>Type: <emphasis>boolean</emphasis></entry>
38038 <entry>Default: <emphasis>false</emphasis></entry>
38039 </row>
38040 </tbody>
38041 </tgroup>
38042 </informaltable>
38043 <para>
38044 This option is concerned with handling generated addresses that are the same
38045 as some address in the list of redirection ancestors of the current address.
38046 Although it is turned off by default in the code, it is set in the default
38047 configuration file for handling users&#x2019; <filename>.forward</filename> files. It is recommended
38048 for this use of the <command>redirect</command> router.
38049 </para>
38050 <para>
38051 When <option>check_ancestor</option> is set, if a generated address (including the domain)
38052 is the same as any ancestor of the current address, it is replaced by a copy of
38053 the current address. This helps in the case where local part A is aliased to B,
38054 and B has a <filename>.forward</filename> file pointing back to A. For example, within a single
38055 domain, the local part <quote>Joe.Bloggs</quote> is aliased to <quote>jb</quote> and
38056 <filename>&nbsp;jb/.forward</filename> contains:
38057 </para>
38058 <literallayout class="monospaced">
38059 \Joe.Bloggs, &lt;other item(s)&gt;
38060 </literallayout>
38061 <para>
38062 Without the <option>check_ancestor</option> setting, either local part (<quote>jb</quote> or
38063 <quote>joe.bloggs</quote>) gets processed once by each router and so ends up as it was
38064 originally. If <quote>jb</quote> is the real mailbox name, mail to <quote>jb</quote> gets delivered
38065 (having been turned into <quote>joe.bloggs</quote> by the <filename>.forward</filename> file and back to
38066 <quote>jb</quote> by the alias), but mail to <quote>joe.bloggs</quote> fails. Setting
38067 <option>check_ancestor</option> on the <command>redirect</command> router that handles the <filename>.forward</filename>
38068 file prevents it from turning <quote>jb</quote> back into <quote>joe.bloggs</quote> when that was the
38069 original address. See also the <option>repeat_use</option> option below.
38070 </para>
38071 <para>
38072 <indexterm role="option">
38073 <primary><option>check_group</option></primary>
38074 </indexterm>
38075 </para>
38076 <informaltable frame="all">
38077 <tgroup cols="4" colsep="0" rowsep="0">
38078 <colspec colwidth="8*" align="left"/>
38079 <colspec colwidth="6*" align="center"/>
38080 <colspec colwidth="6*" align="center"/>
38081 <colspec colwidth="6*" align="right"/>
38082 <tbody>
38083 <row>
38084 <entry><option>check_group</option></entry>
38085 <entry>Use: <emphasis>redirect</emphasis></entry>
38086 <entry>Type: <emphasis>boolean</emphasis></entry>
38087 <entry>Default: <emphasis>see below</emphasis></entry>
38088 </row>
38089 </tbody>
38090 </tgroup>
38091 </informaltable>
38092 <para>
38093 When the <option>file</option> option is used, the group owner of the file is checked only
38094 when this option is set. The permitted groups are those listed in the
38095 <option>owngroups</option> option, together with the user&#x2019;s default group if
38096 <option>check_local_user</option> is set. If the file has the wrong group, routing is
38097 deferred. The default setting for this option is true if <option>check_local_user</option>
38098 is set and the <option>modemask</option> option permits the group write bit, or if the
38099 <option>owngroups</option> option is set. Otherwise it is false, and no group check occurs.
38100 </para>
38101 <para>
38102 <indexterm role="option">
38103 <primary><option>check_owner</option></primary>
38104 </indexterm>
38105 </para>
38106 <informaltable frame="all">
38107 <tgroup cols="4" colsep="0" rowsep="0">
38108 <colspec colwidth="8*" align="left"/>
38109 <colspec colwidth="6*" align="center"/>
38110 <colspec colwidth="6*" align="center"/>
38111 <colspec colwidth="6*" align="right"/>
38112 <tbody>
38113 <row>
38114 <entry><option>check_owner</option></entry>
38115 <entry>Use: <emphasis>redirect</emphasis></entry>
38116 <entry>Type: <emphasis>boolean</emphasis></entry>
38117 <entry>Default: <emphasis>see below</emphasis></entry>
38118 </row>
38119 </tbody>
38120 </tgroup>
38121 </informaltable>
38122 <para>
38123 When the <option>file</option> option is used, the owner of the file is checked only when
38124 this option is set. If <option>check_local_user</option> is set, the local user is
38125 permitted; otherwise the owner must be one of those listed in the <option>owners</option>
38126 option. The default value for this option is true if <option>check_local_user</option> or
38127 <option>owners</option> is set. Otherwise the default is false, and no owner check occurs.
38128 </para>
38129 <para>
38130 <indexterm role="option">
38131 <primary><option>data</option></primary>
38132 </indexterm>
38133 </para>
38134 <informaltable frame="all">
38135 <tgroup cols="4" colsep="0" rowsep="0">
38136 <colspec colwidth="8*" align="left"/>
38137 <colspec colwidth="6*" align="center"/>
38138 <colspec colwidth="6*" align="center"/>
38139 <colspec colwidth="6*" align="right"/>
38140 <tbody>
38141 <row>
38142 <entry><option>data</option></entry>
38143 <entry>Use: <emphasis>redirect</emphasis></entry>
38144 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38145 <entry>Default: <emphasis>unset</emphasis></entry>
38146 </row>
38147 </tbody>
38148 </tgroup>
38149 </informaltable>
38150 <para>
38151 This option is mutually exclusive with <option>file</option>. One or other of them must be
38152 set, but not both. The contents of <option>data</option> are expanded, and then used as the
38153 list of forwarding items, or as a set of filtering instructions. If the
38154 expansion is forced to fail, or the result is an empty string or a string that
38155 has no effect (consists entirely of comments), the router declines.
38156 </para>
38157 <para>
38158 When filtering instructions are used, the string must begin with <quote>#Exim
38159 filter</quote>, and all comments in the string, including this initial one, must be
38160 terminated with newline characters. For example:
38161 </para>
38162 <literallayout class="monospaced">
38163 data = #Exim filter\n\
38164        if $h_to: contains Exim then save $home/mail/exim endif
38165 </literallayout>
38166 <para>
38167 If you are reading the data from a database where newlines cannot be included,
38168 you can use the <varname>${sg}</varname> expansion item to turn the escape string of your
38169 choice into a newline.
38170 </para>
38171 <para>
38172 <indexterm role="option">
38173 <primary><option>directory_transport</option></primary>
38174 </indexterm>
38175 </para>
38176 <informaltable frame="all">
38177 <tgroup cols="4" colsep="0" rowsep="0">
38178 <colspec colwidth="8*" align="left"/>
38179 <colspec colwidth="6*" align="center"/>
38180 <colspec colwidth="6*" align="center"/>
38181 <colspec colwidth="6*" align="right"/>
38182 <tbody>
38183 <row>
38184 <entry><option>directory_transport</option></entry>
38185 <entry>Use: <emphasis>redirect</emphasis></entry>
38186 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38187 <entry>Default: <emphasis>unset</emphasis></entry>
38188 </row>
38189 </tbody>
38190 </tgroup>
38191 </informaltable>
38192 <para>
38193 A <command>redirect</command> router sets up a direct delivery to a directory when a path name
38194 ending with a slash is specified as a new <quote>address</quote>. The transport used is
38195 specified by this option, which, after expansion, must be the name of a
38196 configured transport. This should normally be an <command>appendfile</command> transport.
38197 </para>
38198 <para>
38199 <indexterm role="option">
38200 <primary><option>file</option></primary>
38201 </indexterm>
38202 </para>
38203 <informaltable frame="all">
38204 <tgroup cols="4" colsep="0" rowsep="0">
38205 <colspec colwidth="8*" align="left"/>
38206 <colspec colwidth="6*" align="center"/>
38207 <colspec colwidth="6*" align="center"/>
38208 <colspec colwidth="6*" align="right"/>
38209 <tbody>
38210 <row>
38211 <entry><option>file</option></entry>
38212 <entry>Use: <emphasis>redirect</emphasis></entry>
38213 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38214 <entry>Default: <emphasis>unset</emphasis></entry>
38215 </row>
38216 </tbody>
38217 </tgroup>
38218 </informaltable>
38219 <para>
38220 This option specifies the name of a file that contains the redirection data. It
38221 is mutually exclusive with the <option>data</option> option. The string is expanded before
38222 use; if the expansion is forced to fail, the router declines. Other expansion
38223 failures cause delivery to be deferred. The result of a successful expansion
38224 must be an absolute path. The entire file is read and used as the redirection
38225 data. If the data is an empty string or a string that has no effect (consists
38226 entirely of comments), the router declines.
38227 </para>
38228 <para>
38229 <indexterm role="concept">
38230 <primary>NFS</primary>
38231 <secondary>checking for file existence</secondary>
38232 </indexterm>
38233 If the attempt to open the file fails with a <quote>does not exist</quote> error, Exim
38234 runs a check on the containing directory,
38235 unless <option>ignore_enotdir</option> is true (see below).
38236 If the directory does not appear to exist, delivery is deferred. This can
38237 happen when users&#x2019; <filename>.forward</filename> files are in NFS-mounted directories, and there
38238 is a mount problem. If the containing directory does exist, but the file does
38239 not, the router declines.
38240 </para>
38241 <para>
38242 <indexterm role="option">
38243 <primary><option>file_transport</option></primary>
38244 </indexterm>
38245 </para>
38246 <informaltable frame="all">
38247 <tgroup cols="4" colsep="0" rowsep="0">
38248 <colspec colwidth="8*" align="left"/>
38249 <colspec colwidth="6*" align="center"/>
38250 <colspec colwidth="6*" align="center"/>
38251 <colspec colwidth="6*" align="right"/>
38252 <tbody>
38253 <row>
38254 <entry><option>file_transport</option></entry>
38255 <entry>Use: <emphasis>redirect</emphasis></entry>
38256 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38257 <entry>Default: <emphasis>unset</emphasis></entry>
38258 </row>
38259 </tbody>
38260 </tgroup>
38261 </informaltable>
38262 <para>
38263 <indexterm role="variable">
38264 <primary><varname>$address_file</varname></primary>
38265 </indexterm>
38266 A <command>redirect</command> router sets up a direct delivery to a file when a path name not
38267 ending in a slash is specified as a new <quote>address</quote>. The transport used is
38268 specified by this option, which, after expansion, must be the name of a
38269 configured transport. This should normally be an <command>appendfile</command> transport. When
38270 it is running, the file name is in <varname>$address_file</varname>.
38271 </para>
38272 <para>
38273 <indexterm role="option">
38274 <primary><option>filter_prepend_home</option></primary>
38275 </indexterm>
38276 </para>
38277 <informaltable frame="all">
38278 <tgroup cols="4" colsep="0" rowsep="0">
38279 <colspec colwidth="8*" align="left"/>
38280 <colspec colwidth="6*" align="center"/>
38281 <colspec colwidth="6*" align="center"/>
38282 <colspec colwidth="6*" align="right"/>
38283 <tbody>
38284 <row>
38285 <entry><option>filter_prepend_home</option></entry>
38286 <entry>Use: <emphasis>redirect</emphasis></entry>
38287 <entry>Type: <emphasis>boolean</emphasis></entry>
38288 <entry>Default: <emphasis>true</emphasis></entry>
38289 </row>
38290 </tbody>
38291 </tgroup>
38292 </informaltable>
38293 <para>
38294 When this option is true, if a <command>save</command> command in an Exim filter specifies a
38295 relative path, and <varname>$home</varname> is defined, it is automatically prepended to the
38296 relative path. If this option is set false, this action does not happen. The
38297 relative path is then passed to the transport unmodified.
38298 </para>
38299 <para>
38300 <indexterm role="option">
38301 <primary><option>forbid_blackhole</option></primary>
38302 </indexterm>
38303 </para>
38304 <informaltable frame="all">
38305 <tgroup cols="4" colsep="0" rowsep="0">
38306 <colspec colwidth="8*" align="left"/>
38307 <colspec colwidth="6*" align="center"/>
38308 <colspec colwidth="6*" align="center"/>
38309 <colspec colwidth="6*" align="right"/>
38310 <tbody>
38311 <row>
38312 <entry><option>forbid_blackhole</option></entry>
38313 <entry>Use: <emphasis>redirect</emphasis></entry>
38314 <entry>Type: <emphasis>boolean</emphasis></entry>
38315 <entry>Default: <emphasis>false</emphasis></entry>
38316 </row>
38317 </tbody>
38318 </tgroup>
38319 </informaltable>
38320 <para>
38321 <indexterm role="concept">
38322 <primary>restricting access to features</primary>
38323 </indexterm>
38324 <indexterm role="concept">
38325 <primary>filter</primary>
38326 <secondary>locking out certain features</secondary>
38327 </indexterm>
38328 If this option is true, the <emphasis>:blackhole:</emphasis> item may not appear in a
38329 redirection list.
38330 </para>
38331 <para>
38332 <indexterm role="option">
38333 <primary><option>forbid_exim_filter</option></primary>
38334 </indexterm>
38335 </para>
38336 <informaltable frame="all">
38337 <tgroup cols="4" colsep="0" rowsep="0">
38338 <colspec colwidth="8*" align="left"/>
38339 <colspec colwidth="6*" align="center"/>
38340 <colspec colwidth="6*" align="center"/>
38341 <colspec colwidth="6*" align="right"/>
38342 <tbody>
38343 <row>
38344 <entry><option>forbid_exim_filter</option></entry>
38345 <entry>Use: <emphasis>redirect</emphasis></entry>
38346 <entry>Type: <emphasis>boolean</emphasis></entry>
38347 <entry>Default: <emphasis>false</emphasis></entry>
38348 </row>
38349 </tbody>
38350 </tgroup>
38351 </informaltable>
38352 <para>
38353 <indexterm role="concept">
38354 <primary>restricting access to features</primary>
38355 </indexterm>
38356 <indexterm role="concept">
38357 <primary>filter</primary>
38358 <secondary>locking out certain features</secondary>
38359 </indexterm>
38360 If this option is set true, only Sieve filters are permitted when
38361 <option>allow_filter</option> is true.
38362 </para>
38363 <para>
38364 <indexterm role="option">
38365 <primary><option>forbid_file</option></primary>
38366 </indexterm>
38367 </para>
38368 <informaltable frame="all">
38369 <tgroup cols="4" colsep="0" rowsep="0">
38370 <colspec colwidth="8*" align="left"/>
38371 <colspec colwidth="6*" align="center"/>
38372 <colspec colwidth="6*" align="center"/>
38373 <colspec colwidth="6*" align="right"/>
38374 <tbody>
38375 <row>
38376 <entry><option>forbid_file</option></entry>
38377 <entry>Use: <emphasis>redirect</emphasis></entry>
38378 <entry>Type: <emphasis>boolean</emphasis></entry>
38379 <entry>Default: <emphasis>false</emphasis></entry>
38380 </row>
38381 </tbody>
38382 </tgroup>
38383 </informaltable>
38384 <para>
38385 <indexterm role="concept">
38386 <primary>restricting access to features</primary>
38387 </indexterm>
38388 <indexterm role="concept">
38389 <primary>delivery</primary>
38390 <secondary>to file; forbidding</secondary>
38391 </indexterm>
38392 <indexterm role="concept">
38393 <primary>filter</primary>
38394 <secondary>locking out certain features</secondary>
38395 </indexterm>
38396 <indexterm role="concept">
38397 <primary>Sieve filter</primary>
38398 <secondary>forbidding delivery to a file</secondary>
38399 </indexterm>
38400 <indexterm role="concept">
38401 <primary>Sieve filter</primary>
38402 <secondary><quote>keep</quote> facility; disabling</secondary>
38403 </indexterm>
38404 If this option is true, this router may not generate a new address that
38405 specifies delivery to a local file or directory, either from a filter or from a
38406 conventional forward file. This option is forced to be true if <option>one_time</option> is
38407 set. It applies to Sieve filters as well as to Exim filters, but if true, it
38408 locks out the Sieve&#x2019;s <quote>keep</quote> facility.
38409 </para>
38410 <para>
38411 <indexterm role="option">
38412 <primary><option>forbid_filter_dlfunc</option></primary>
38413 </indexterm>
38414 </para>
38415 <informaltable frame="all">
38416 <tgroup cols="4" colsep="0" rowsep="0">
38417 <colspec colwidth="8*" align="left"/>
38418 <colspec colwidth="6*" align="center"/>
38419 <colspec colwidth="6*" align="center"/>
38420 <colspec colwidth="6*" align="right"/>
38421 <tbody>
38422 <row>
38423 <entry><option>forbid_filter_dlfunc</option></entry>
38424 <entry>Use: <emphasis>redirect</emphasis></entry>
38425 <entry>Type: <emphasis>boolean</emphasis></entry>
38426 <entry>Default: <emphasis>false</emphasis></entry>
38427 </row>
38428 </tbody>
38429 </tgroup>
38430 </informaltable>
38431 <para>
38432 <indexterm role="concept">
38433 <primary>restricting access to features</primary>
38434 </indexterm>
38435 <indexterm role="concept">
38436 <primary>filter</primary>
38437 <secondary>locking out certain features</secondary>
38438 </indexterm>
38439 If this option is true, string expansions in Exim filters are not allowed to
38440 make use of the <option>dlfunc</option> expansion facility to run dynamically loaded
38441 functions.
38442 </para>
38443 <para>
38444 <indexterm role="option">
38445 <primary><option>forbid_filter_existstest</option></primary>
38446 </indexterm>
38447 </para>
38448 <informaltable frame="all">
38449 <tgroup cols="4" colsep="0" rowsep="0">
38450 <colspec colwidth="8*" align="left"/>
38451 <colspec colwidth="6*" align="center"/>
38452 <colspec colwidth="6*" align="center"/>
38453 <colspec colwidth="6*" align="right"/>
38454 <tbody>
38455 <row>
38456 <entry><option>forbid_filter_existstest</option></entry>
38457 <entry>Use: <emphasis>redirect</emphasis></entry>
38458 <entry>Type: <emphasis>boolean</emphasis></entry>
38459 <entry>Default: <emphasis>false</emphasis></entry>
38460 </row>
38461 </tbody>
38462 </tgroup>
38463 </informaltable>
38464 <para>
38465 <indexterm role="concept">
38466 <primary>restricting access to features</primary>
38467 </indexterm>
38468 <indexterm role="concept">
38469 <primary>filter</primary>
38470 <secondary>locking out certain features</secondary>
38471 </indexterm>
38472 <indexterm role="concept">
38473 <primary>expansion</primary>
38474 <secondary>statting a file</secondary>
38475 </indexterm>
38476 If this option is true, string expansions in Exim filters are not allowed to
38477 make use of the <option>exists</option> condition or the <option>stat</option> expansion item.
38478 </para>
38479 <para>
38480 <indexterm role="option">
38481 <primary><option>forbid_filter_logwrite</option></primary>
38482 </indexterm>
38483 </para>
38484 <informaltable frame="all">
38485 <tgroup cols="4" colsep="0" rowsep="0">
38486 <colspec colwidth="8*" align="left"/>
38487 <colspec colwidth="6*" align="center"/>
38488 <colspec colwidth="6*" align="center"/>
38489 <colspec colwidth="6*" align="right"/>
38490 <tbody>
38491 <row>
38492 <entry><option>forbid_filter_logwrite</option></entry>
38493 <entry>Use: <emphasis>redirect</emphasis></entry>
38494 <entry>Type: <emphasis>boolean</emphasis></entry>
38495 <entry>Default: <emphasis>false</emphasis></entry>
38496 </row>
38497 </tbody>
38498 </tgroup>
38499 </informaltable>
38500 <para>
38501 <indexterm role="concept">
38502 <primary>restricting access to features</primary>
38503 </indexterm>
38504 <indexterm role="concept">
38505 <primary>filter</primary>
38506 <secondary>locking out certain features</secondary>
38507 </indexterm>
38508 If this option is true, use of the logging facility in Exim filters is not
38509 permitted. Logging is in any case available only if the filter is being run
38510 under some unprivileged uid (which is normally the case for ordinary users&#x2019;
38511 <filename>.forward</filename> files).
38512 </para>
38513 <para>
38514 <indexterm role="option">
38515 <primary><option>forbid_filter_lookup</option></primary>
38516 </indexterm>
38517 </para>
38518 <informaltable frame="all">
38519 <tgroup cols="4" colsep="0" rowsep="0">
38520 <colspec colwidth="8*" align="left"/>
38521 <colspec colwidth="6*" align="center"/>
38522 <colspec colwidth="6*" align="center"/>
38523 <colspec colwidth="6*" align="right"/>
38524 <tbody>
38525 <row>
38526 <entry><option>forbid_filter_lookup</option></entry>
38527 <entry>Use: <emphasis>redirect</emphasis></entry>
38528 <entry>Type: <emphasis>boolean</emphasis></entry>
38529 <entry>Default: <emphasis>false</emphasis></entry>
38530 </row>
38531 </tbody>
38532 </tgroup>
38533 </informaltable>
38534 <para>
38535 <indexterm role="concept">
38536 <primary>restricting access to features</primary>
38537 </indexterm>
38538 <indexterm role="concept">
38539 <primary>filter</primary>
38540 <secondary>locking out certain features</secondary>
38541 </indexterm>
38542 If this option is true, string expansions in Exim filter files are not allowed
38543 to make use of <option>lookup</option> items.
38544 </para>
38545 <para>
38546 <indexterm role="option">
38547 <primary><option>forbid_filter_perl</option></primary>
38548 </indexterm>
38549 </para>
38550 <informaltable frame="all">
38551 <tgroup cols="4" colsep="0" rowsep="0">
38552 <colspec colwidth="8*" align="left"/>
38553 <colspec colwidth="6*" align="center"/>
38554 <colspec colwidth="6*" align="center"/>
38555 <colspec colwidth="6*" align="right"/>
38556 <tbody>
38557 <row>
38558 <entry><option>forbid_filter_perl</option></entry>
38559 <entry>Use: <emphasis>redirect</emphasis></entry>
38560 <entry>Type: <emphasis>boolean</emphasis></entry>
38561 <entry>Default: <emphasis>false</emphasis></entry>
38562 </row>
38563 </tbody>
38564 </tgroup>
38565 </informaltable>
38566 <para>
38567 <indexterm role="concept">
38568 <primary>restricting access to features</primary>
38569 </indexterm>
38570 <indexterm role="concept">
38571 <primary>filter</primary>
38572 <secondary>locking out certain features</secondary>
38573 </indexterm>
38574 This option has an effect only if Exim is built with embedded Perl support. If
38575 it is true, string expansions in Exim filter files are not allowed to make use
38576 of the embedded Perl support.
38577 </para>
38578 <para>
38579 <indexterm role="option">
38580 <primary><option>forbid_filter_readfile</option></primary>
38581 </indexterm>
38582 </para>
38583 <informaltable frame="all">
38584 <tgroup cols="4" colsep="0" rowsep="0">
38585 <colspec colwidth="8*" align="left"/>
38586 <colspec colwidth="6*" align="center"/>
38587 <colspec colwidth="6*" align="center"/>
38588 <colspec colwidth="6*" align="right"/>
38589 <tbody>
38590 <row>
38591 <entry><option>forbid_filter_readfile</option></entry>
38592 <entry>Use: <emphasis>redirect</emphasis></entry>
38593 <entry>Type: <emphasis>boolean</emphasis></entry>
38594 <entry>Default: <emphasis>false</emphasis></entry>
38595 </row>
38596 </tbody>
38597 </tgroup>
38598 </informaltable>
38599 <para>
38600 <indexterm role="concept">
38601 <primary>restricting access to features</primary>
38602 </indexterm>
38603 <indexterm role="concept">
38604 <primary>filter</primary>
38605 <secondary>locking out certain features</secondary>
38606 </indexterm>
38607 If this option is true, string expansions in Exim filter files are not allowed
38608 to make use of <option>readfile</option> items.
38609 </para>
38610 <para>
38611 <indexterm role="option">
38612 <primary><option>forbid_filter_readsocket</option></primary>
38613 </indexterm>
38614 </para>
38615 <informaltable frame="all">
38616 <tgroup cols="4" colsep="0" rowsep="0">
38617 <colspec colwidth="8*" align="left"/>
38618 <colspec colwidth="6*" align="center"/>
38619 <colspec colwidth="6*" align="center"/>
38620 <colspec colwidth="6*" align="right"/>
38621 <tbody>
38622 <row>
38623 <entry><option>forbid_filter_readsocket</option></entry>
38624 <entry>Use: <emphasis>redirect</emphasis></entry>
38625 <entry>Type: <emphasis>boolean</emphasis></entry>
38626 <entry>Default: <emphasis>false</emphasis></entry>
38627 </row>
38628 </tbody>
38629 </tgroup>
38630 </informaltable>
38631 <para>
38632 <indexterm role="concept">
38633 <primary>restricting access to features</primary>
38634 </indexterm>
38635 <indexterm role="concept">
38636 <primary>filter</primary>
38637 <secondary>locking out certain features</secondary>
38638 </indexterm>
38639 If this option is true, string expansions in Exim filter files are not allowed
38640 to make use of <option>readsocket</option> items.
38641 </para>
38642 <para>
38643 <indexterm role="option">
38644 <primary><option>forbid_filter_reply</option></primary>
38645 </indexterm>
38646 </para>
38647 <informaltable frame="all">
38648 <tgroup cols="4" colsep="0" rowsep="0">
38649 <colspec colwidth="8*" align="left"/>
38650 <colspec colwidth="6*" align="center"/>
38651 <colspec colwidth="6*" align="center"/>
38652 <colspec colwidth="6*" align="right"/>
38653 <tbody>
38654 <row>
38655 <entry><option>forbid_filter_reply</option></entry>
38656 <entry>Use: <emphasis>redirect</emphasis></entry>
38657 <entry>Type: <emphasis>boolean</emphasis></entry>
38658 <entry>Default: <emphasis>false</emphasis></entry>
38659 </row>
38660 </tbody>
38661 </tgroup>
38662 </informaltable>
38663 <para>
38664 <indexterm role="concept">
38665 <primary>restricting access to features</primary>
38666 </indexterm>
38667 <indexterm role="concept">
38668 <primary>filter</primary>
38669 <secondary>locking out certain features</secondary>
38670 </indexterm>
38671 If this option is true, this router may not generate an automatic reply
38672 message. Automatic replies can be generated only from Exim or Sieve filter
38673 files, not from traditional forward files. This option is forced to be true if
38674 <option>one_time</option> is set.
38675 </para>
38676 <para>
38677 <indexterm role="option">
38678 <primary><option>forbid_filter_run</option></primary>
38679 </indexterm>
38680 </para>
38681 <informaltable frame="all">
38682 <tgroup cols="4" colsep="0" rowsep="0">
38683 <colspec colwidth="8*" align="left"/>
38684 <colspec colwidth="6*" align="center"/>
38685 <colspec colwidth="6*" align="center"/>
38686 <colspec colwidth="6*" align="right"/>
38687 <tbody>
38688 <row>
38689 <entry><option>forbid_filter_run</option></entry>
38690 <entry>Use: <emphasis>redirect</emphasis></entry>
38691 <entry>Type: <emphasis>boolean</emphasis></entry>
38692 <entry>Default: <emphasis>false</emphasis></entry>
38693 </row>
38694 </tbody>
38695 </tgroup>
38696 </informaltable>
38697 <para>
38698 <indexterm role="concept">
38699 <primary>restricting access to features</primary>
38700 </indexterm>
38701 <indexterm role="concept">
38702 <primary>filter</primary>
38703 <secondary>locking out certain features</secondary>
38704 </indexterm>
38705 If this option is true, string expansions in Exim filter files are not allowed
38706 to make use of <option>run</option> items.
38707 </para>
38708 <para>
38709 <indexterm role="option">
38710 <primary><option>forbid_include</option></primary>
38711 </indexterm>
38712 </para>
38713 <informaltable frame="all">
38714 <tgroup cols="4" colsep="0" rowsep="0">
38715 <colspec colwidth="8*" align="left"/>
38716 <colspec colwidth="6*" align="center"/>
38717 <colspec colwidth="6*" align="center"/>
38718 <colspec colwidth="6*" align="right"/>
38719 <tbody>
38720 <row>
38721 <entry><option>forbid_include</option></entry>
38722 <entry>Use: <emphasis>redirect</emphasis></entry>
38723 <entry>Type: <emphasis>boolean</emphasis></entry>
38724 <entry>Default: <emphasis>false</emphasis></entry>
38725 </row>
38726 </tbody>
38727 </tgroup>
38728 </informaltable>
38729 <para>
38730 <indexterm role="concept">
38731 <primary>restricting access to features</primary>
38732 </indexterm>
38733 <indexterm role="concept">
38734 <primary>filter</primary>
38735 <secondary>locking out certain features</secondary>
38736 </indexterm>
38737 If this option is true, items of the form
38738 </para>
38739 <literallayout class="monospaced">
38740 :include:&lt;path name&gt;
38741 </literallayout>
38742 <para>
38743 are not permitted in non-filter redirection lists.
38744 </para>
38745 <para>
38746 <indexterm role="option">
38747 <primary><option>forbid_pipe</option></primary>
38748 </indexterm>
38749 </para>
38750 <informaltable frame="all">
38751 <tgroup cols="4" colsep="0" rowsep="0">
38752 <colspec colwidth="8*" align="left"/>
38753 <colspec colwidth="6*" align="center"/>
38754 <colspec colwidth="6*" align="center"/>
38755 <colspec colwidth="6*" align="right"/>
38756 <tbody>
38757 <row>
38758 <entry><option>forbid_pipe</option></entry>
38759 <entry>Use: <emphasis>redirect</emphasis></entry>
38760 <entry>Type: <emphasis>boolean</emphasis></entry>
38761 <entry>Default: <emphasis>false</emphasis></entry>
38762 </row>
38763 </tbody>
38764 </tgroup>
38765 </informaltable>
38766 <para>
38767 <indexterm role="concept">
38768 <primary>restricting access to features</primary>
38769 </indexterm>
38770 <indexterm role="concept">
38771 <primary>filter</primary>
38772 <secondary>locking out certain features</secondary>
38773 </indexterm>
38774 <indexterm role="concept">
38775 <primary>delivery</primary>
38776 <secondary>to pipe; forbidding</secondary>
38777 </indexterm>
38778 If this option is true, this router may not generate a new address which
38779 specifies delivery to a pipe, either from an Exim filter or from a conventional
38780 forward file. This option is forced to be true if <option>one_time</option> is set.
38781 </para>
38782 <para>
38783 <indexterm role="option">
38784 <primary><option>forbid_sieve_filter</option></primary>
38785 </indexterm>
38786 </para>
38787 <informaltable frame="all">
38788 <tgroup cols="4" colsep="0" rowsep="0">
38789 <colspec colwidth="8*" align="left"/>
38790 <colspec colwidth="6*" align="center"/>
38791 <colspec colwidth="6*" align="center"/>
38792 <colspec colwidth="6*" align="right"/>
38793 <tbody>
38794 <row>
38795 <entry><option>forbid_sieve_filter</option></entry>
38796 <entry>Use: <emphasis>redirect</emphasis></entry>
38797 <entry>Type: <emphasis>boolean</emphasis></entry>
38798 <entry>Default: <emphasis>false</emphasis></entry>
38799 </row>
38800 </tbody>
38801 </tgroup>
38802 </informaltable>
38803 <para>
38804 <indexterm role="concept">
38805 <primary>restricting access to features</primary>
38806 </indexterm>
38807 <indexterm role="concept">
38808 <primary>filter</primary>
38809 <secondary>locking out certain features</secondary>
38810 </indexterm>
38811 If this option is set true, only Exim filters are permitted when
38812 <option>allow_filter</option> is true.
38813 </para>
38814 <para>
38815 <indexterm role="concept">
38816 <primary>SMTP</primary>
38817 <secondary>error codes</secondary>
38818 </indexterm>
38819 <indexterm role="option">
38820 <primary><option>forbid_smtp_code</option></primary>
38821 </indexterm>
38822 </para>
38823 <informaltable frame="all">
38824 <tgroup cols="4" colsep="0" rowsep="0">
38825 <colspec colwidth="8*" align="left"/>
38826 <colspec colwidth="6*" align="center"/>
38827 <colspec colwidth="6*" align="center"/>
38828 <colspec colwidth="6*" align="right"/>
38829 <tbody>
38830 <row>
38831 <entry><option>forbid_smtp_code</option></entry>
38832 <entry>Use: <emphasis>redirect</emphasis></entry>
38833 <entry>Type: <emphasis>boolean</emphasis></entry>
38834 <entry>Default: <emphasis>false</emphasis></entry>
38835 </row>
38836 </tbody>
38837 </tgroup>
38838 </informaltable>
38839 <para>
38840 If this option is set true, any SMTP error codes that are present at the start
38841 of messages specified for <literal>:defer:</literal> or <literal>:fail:</literal> are quietly ignored, and
38842 the default codes (451 and 550, respectively) are always used.
38843 </para>
38844 <para>
38845 <indexterm role="option">
38846 <primary><option>hide_child_in_errmsg</option></primary>
38847 </indexterm>
38848 </para>
38849 <informaltable frame="all">
38850 <tgroup cols="4" colsep="0" rowsep="0">
38851 <colspec colwidth="8*" align="left"/>
38852 <colspec colwidth="6*" align="center"/>
38853 <colspec colwidth="6*" align="center"/>
38854 <colspec colwidth="6*" align="right"/>
38855 <tbody>
38856 <row>
38857 <entry><option>hide_child_in_errmsg</option></entry>
38858 <entry>Use: <emphasis>redirect</emphasis></entry>
38859 <entry>Type: <emphasis>boolean</emphasis></entry>
38860 <entry>Default: <emphasis>false</emphasis></entry>
38861 </row>
38862 </tbody>
38863 </tgroup>
38864 </informaltable>
38865 <para>
38866 <indexterm role="concept">
38867 <primary>bounce message</primary>
38868 <secondary>redirection details; suppressing</secondary>
38869 </indexterm>
38870 If this option is true, it prevents Exim from quoting a child address if it
38871 generates a bounce or delay message for it. Instead it says <quote>an address
38872 generated from &lt;<emphasis>the top level address</emphasis>&gt;</quote>. Of course, this applies only to
38873 bounces generated locally. If a message is forwarded to another host, <emphasis>its</emphasis>
38874 bounce may well quote the generated address.
38875 </para>
38876 <para>
38877 <indexterm role="option">
38878 <primary><option>ignore_eacces</option></primary>
38879 </indexterm>
38880 </para>
38881 <informaltable frame="all">
38882 <tgroup cols="4" colsep="0" rowsep="0">
38883 <colspec colwidth="8*" align="left"/>
38884 <colspec colwidth="6*" align="center"/>
38885 <colspec colwidth="6*" align="center"/>
38886 <colspec colwidth="6*" align="right"/>
38887 <tbody>
38888 <row>
38889 <entry><option>ignore_eacces</option></entry>
38890 <entry>Use: <emphasis>redirect</emphasis></entry>
38891 <entry>Type: <emphasis>boolean</emphasis></entry>
38892 <entry>Default: <emphasis>false</emphasis></entry>
38893 </row>
38894 </tbody>
38895 </tgroup>
38896 </informaltable>
38897 <para>
38898 <indexterm role="concept">
38899 <primary>EACCES</primary>
38900 </indexterm>
38901 If this option is set and an attempt to open a redirection file yields the
38902 EACCES error (permission denied), the <command>redirect</command> router behaves as if the
38903 file did not exist.
38904 </para>
38905 <para>
38906 <indexterm role="option">
38907 <primary><option>ignore_enotdir</option></primary>
38908 </indexterm>
38909 </para>
38910 <informaltable frame="all">
38911 <tgroup cols="4" colsep="0" rowsep="0">
38912 <colspec colwidth="8*" align="left"/>
38913 <colspec colwidth="6*" align="center"/>
38914 <colspec colwidth="6*" align="center"/>
38915 <colspec colwidth="6*" align="right"/>
38916 <tbody>
38917 <row>
38918 <entry><option>ignore_enotdir</option></entry>
38919 <entry>Use: <emphasis>redirect</emphasis></entry>
38920 <entry>Type: <emphasis>boolean</emphasis></entry>
38921 <entry>Default: <emphasis>false</emphasis></entry>
38922 </row>
38923 </tbody>
38924 </tgroup>
38925 </informaltable>
38926 <para>
38927 <indexterm role="concept">
38928 <primary>ENOTDIR</primary>
38929 </indexterm>
38930 If this option is set and an attempt to open a redirection file yields the
38931 ENOTDIR error (something on the path is not a directory), the <command>redirect</command>
38932 router behaves as if the file did not exist.
38933 </para>
38934 <para>
38935 Setting <option>ignore_enotdir</option> has another effect as well: When a <command>redirect</command>
38936 router that has the <option>file</option> option set discovers that the file does not exist
38937 (the ENOENT error), it tries to <function>stat()</function> the parent directory, as a check
38938 against unmounted NFS directories. If the parent can not be statted, delivery
38939 is deferred. However, it seems wrong to do this check when <option>ignore_enotdir</option>
38940 is set, because that option tells Exim to ignore <quote>something on the path is not
38941 a directory</quote> (the ENOTDIR error). This is a confusing area, because it seems
38942 that some operating systems give ENOENT where others give ENOTDIR.
38943 </para>
38944 <para>
38945 <indexterm role="option">
38946 <primary><option>include_directory</option></primary>
38947 </indexterm>
38948 </para>
38949 <informaltable frame="all">
38950 <tgroup cols="4" colsep="0" rowsep="0">
38951 <colspec colwidth="8*" align="left"/>
38952 <colspec colwidth="6*" align="center"/>
38953 <colspec colwidth="6*" align="center"/>
38954 <colspec colwidth="6*" align="right"/>
38955 <tbody>
38956 <row>
38957 <entry><option>include_directory</option></entry>
38958 <entry>Use: <emphasis>redirect</emphasis></entry>
38959 <entry>Type: <emphasis>string</emphasis></entry>
38960 <entry>Default: <emphasis>unset</emphasis></entry>
38961 </row>
38962 </tbody>
38963 </tgroup>
38964 </informaltable>
38965 <para>
38966 If this option is set, the path names of any <emphasis>:include:</emphasis> items in a
38967 redirection list must start with this directory.
38968 </para>
38969 <para>
38970 <indexterm role="option">
38971 <primary><option>modemask</option></primary>
38972 </indexterm>
38973 </para>
38974 <informaltable frame="all">
38975 <tgroup cols="4" colsep="0" rowsep="0">
38976 <colspec colwidth="8*" align="left"/>
38977 <colspec colwidth="6*" align="center"/>
38978 <colspec colwidth="6*" align="center"/>
38979 <colspec colwidth="6*" align="right"/>
38980 <tbody>
38981 <row>
38982 <entry><option>modemask</option></entry>
38983 <entry>Use: <emphasis>redirect</emphasis></entry>
38984 <entry>Type: <emphasis>octal integer</emphasis></entry>
38985 <entry>Default: <emphasis>022</emphasis></entry>
38986 </row>
38987 </tbody>
38988 </tgroup>
38989 </informaltable>
38990 <para>
38991 This specifies mode bits which must not be set for a file specified by the
38992 <option>file</option> option. If any of the forbidden bits are set, delivery is deferred.
38993 </para>
38994 <para>
38995 <indexterm role="option">
38996 <primary><option>one_time</option></primary>
38997 </indexterm>
38998 </para>
38999 <informaltable frame="all">
39000 <tgroup cols="4" colsep="0" rowsep="0">
39001 <colspec colwidth="8*" align="left"/>
39002 <colspec colwidth="6*" align="center"/>
39003 <colspec colwidth="6*" align="center"/>
39004 <colspec colwidth="6*" align="right"/>
39005 <tbody>
39006 <row>
39007 <entry><option>one_time</option></entry>
39008 <entry>Use: <emphasis>redirect</emphasis></entry>
39009 <entry>Type: <emphasis>boolean</emphasis></entry>
39010 <entry>Default: <emphasis>false</emphasis></entry>
39011 </row>
39012 </tbody>
39013 </tgroup>
39014 </informaltable>
39015 <para>
39016 <indexterm role="concept">
39017 <primary>one-time aliasing/forwarding expansion</primary>
39018 </indexterm>
39019 <indexterm role="concept">
39020 <primary>alias file</primary>
39021 <secondary>one-time expansion</secondary>
39022 </indexterm>
39023 <indexterm role="concept">
39024 <primary>forward file</primary>
39025 <secondary>one-time expansion</secondary>
39026 </indexterm>
39027 <indexterm role="concept">
39028 <primary>mailing lists</primary>
39029 <secondary>one-time expansion</secondary>
39030 </indexterm>
39031 <indexterm role="concept">
39032 <primary>address redirection</primary>
39033 <secondary>one-time expansion</secondary>
39034 </indexterm>
39035 Sometimes the fact that Exim re-evaluates aliases and reprocesses redirection
39036 files each time it tries to deliver a message causes a problem when one or more
39037 of the generated addresses fails be delivered at the first attempt. The problem
39038 is not one of duplicate delivery &ndash; Exim is clever enough to handle that &ndash;
39039 but of what happens when the redirection list changes during the time that the
39040 message is on Exim&#x2019;s queue. This is particularly true in the case of mailing
39041 lists, where new subscribers might receive copies of messages that were posted
39042 before they subscribed.
39043 </para>
39044 <para>
39045 If <option>one_time</option> is set and any addresses generated by the router fail to
39046 deliver at the first attempt, the failing addresses are added to the message as
39047 <quote>top level</quote> addresses, and the parent address that generated them is marked
39048 <quote>delivered</quote>. Thus, redirection does not happen again at the next delivery
39049 attempt.
39050 </para>
39051 <para>
39052 <emphasis role="bold">Warning 1</emphasis>: Any header line addition or removal that is specified by this
39053 router would be lost if delivery did not succeed at the first attempt. For this
39054 reason, the <option>headers_add</option> and <option>headers_remove</option> generic options are not
39055 permitted when <option>one_time</option> is set.
39056 </para>
39057 <para>
39058 <emphasis role="bold">Warning 2</emphasis>: To ensure that the router generates only addresses (as opposed
39059 to pipe or file deliveries or auto-replies) <option>forbid_file</option>, <option>forbid_pipe</option>,
39060 and <option>forbid_filter_reply</option> are forced to be true when <option>one_time</option> is set.
39061 </para>
39062 <para>
39063 <emphasis role="bold">Warning 3</emphasis>: The <option>unseen</option> generic router option may not be set with
39064 <option>one_time</option>.
39065 </para>
39066 <para>
39067 The original top-level address is remembered with each of the generated
39068 addresses, and is output in any log messages. However, any intermediate parent
39069 addresses are not recorded. This makes a difference to the log only if
39070 <option>all_parents</option> log selector is set. It is expected that <option>one_time</option> will
39071 typically be used for mailing lists, where there is normally just one level of
39072 expansion.
39073 </para>
39074 <para>
39075 <indexterm role="option">
39076 <primary><option>owners</option></primary>
39077 </indexterm>
39078 </para>
39079 <informaltable frame="all">
39080 <tgroup cols="4" colsep="0" rowsep="0">
39081 <colspec colwidth="8*" align="left"/>
39082 <colspec colwidth="6*" align="center"/>
39083 <colspec colwidth="6*" align="center"/>
39084 <colspec colwidth="6*" align="right"/>
39085 <tbody>
39086 <row>
39087 <entry><option>owners</option></entry>
39088 <entry>Use: <emphasis>redirect</emphasis></entry>
39089 <entry>Type: <emphasis>string list</emphasis></entry>
39090 <entry>Default: <emphasis>unset</emphasis></entry>
39091 </row>
39092 </tbody>
39093 </tgroup>
39094 </informaltable>
39095 <para>
39096 <indexterm role="concept">
39097 <primary>ownership</primary>
39098 <secondary>alias file</secondary>
39099 </indexterm>
39100 <indexterm role="concept">
39101 <primary>ownership</primary>
39102 <secondary>forward file</secondary>
39103 </indexterm>
39104 <indexterm role="concept">
39105 <primary>alias file</primary>
39106 <secondary>ownership</secondary>
39107 </indexterm>
39108 <indexterm role="concept">
39109 <primary>forward file</primary>
39110 <secondary>ownership</secondary>
39111 </indexterm>
39112 This specifies a list of permitted owners for the file specified by <option>file</option>.
39113 This list is in addition to the local user when <option>check_local_user</option> is set.
39114 See <option>check_owner</option> above.
39115 </para>
39116 <para>
39117 <indexterm role="option">
39118 <primary><option>owngroups</option></primary>
39119 </indexterm>
39120 </para>
39121 <informaltable frame="all">
39122 <tgroup cols="4" colsep="0" rowsep="0">
39123 <colspec colwidth="8*" align="left"/>
39124 <colspec colwidth="6*" align="center"/>
39125 <colspec colwidth="6*" align="center"/>
39126 <colspec colwidth="6*" align="right"/>
39127 <tbody>
39128 <row>
39129 <entry><option>owngroups</option></entry>
39130 <entry>Use: <emphasis>redirect</emphasis></entry>
39131 <entry>Type: <emphasis>string list</emphasis></entry>
39132 <entry>Default: <emphasis>unset</emphasis></entry>
39133 </row>
39134 </tbody>
39135 </tgroup>
39136 </informaltable>
39137 <para>
39138 This specifies a list of permitted groups for the file specified by <option>file</option>.
39139 The list is in addition to the local user&#x2019;s primary group when
39140 <option>check_local_user</option> is set. See <option>check_group</option> above.
39141 </para>
39142 <para>
39143 <indexterm role="option">
39144 <primary><option>pipe_transport</option></primary>
39145 </indexterm>
39146 </para>
39147 <informaltable frame="all">
39148 <tgroup cols="4" colsep="0" rowsep="0">
39149 <colspec colwidth="8*" align="left"/>
39150 <colspec colwidth="6*" align="center"/>
39151 <colspec colwidth="6*" align="center"/>
39152 <colspec colwidth="6*" align="right"/>
39153 <tbody>
39154 <row>
39155 <entry><option>pipe_transport</option></entry>
39156 <entry>Use: <emphasis>redirect</emphasis></entry>
39157 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39158 <entry>Default: <emphasis>unset</emphasis></entry>
39159 </row>
39160 </tbody>
39161 </tgroup>
39162 </informaltable>
39163 <para>
39164 <indexterm role="variable">
39165 <primary><varname>$address_pipe</varname></primary>
39166 </indexterm>
39167 A <command>redirect</command> router sets up a direct delivery to a pipe when a string
39168 starting with a vertical bar character is specified as a new <quote>address</quote>. The
39169 transport used is specified by this option, which, after expansion, must be the
39170 name of a configured transport. This should normally be a <command>pipe</command> transport.
39171 When the transport is run, the pipe command is in <varname>$address_pipe</varname>.
39172 </para>
39173 <para>
39174 <indexterm role="option">
39175 <primary><option>qualify_domain</option></primary>
39176 </indexterm>
39177 </para>
39178 <informaltable frame="all">
39179 <tgroup cols="4" colsep="0" rowsep="0">
39180 <colspec colwidth="8*" align="left"/>
39181 <colspec colwidth="6*" align="center"/>
39182 <colspec colwidth="6*" align="center"/>
39183 <colspec colwidth="6*" align="right"/>
39184 <tbody>
39185 <row>
39186 <entry><option>qualify_domain</option></entry>
39187 <entry>Use: <emphasis>redirect</emphasis></entry>
39188 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39189 <entry>Default: <emphasis>unset</emphasis></entry>
39190 </row>
39191 </tbody>
39192 </tgroup>
39193 </informaltable>
39194 <para>
39195 <indexterm role="variable">
39196 <primary><varname>$qualify_recipient</varname></primary>
39197 </indexterm>
39198 If this option is set, and an unqualified address (one without a domain) is
39199 generated, and that address would normally be qualified by the global setting
39200 in <option>qualify_recipient</option>, it is instead qualified with the domain specified by
39201 expanding this string. If the expansion fails, the router declines. If you want
39202 to revert to the default, you can have the expansion generate
39203 <varname>$qualify_recipient</varname>.
39204 </para>
39205 <para>
39206 This option applies to all unqualified addresses generated by Exim filters,
39207 but for traditional <filename>.forward</filename> files, it applies only to addresses that are
39208 not preceded by a backslash. Sieve filters cannot generate unqualified
39209 addresses.
39210 </para>
39211 <para>
39212 <indexterm role="option">
39213 <primary><option>qualify_preserve_domain</option></primary>
39214 </indexterm>
39215 </para>
39216 <informaltable frame="all">
39217 <tgroup cols="4" colsep="0" rowsep="0">
39218 <colspec colwidth="8*" align="left"/>
39219 <colspec colwidth="6*" align="center"/>
39220 <colspec colwidth="6*" align="center"/>
39221 <colspec colwidth="6*" align="right"/>
39222 <tbody>
39223 <row>
39224 <entry><option>qualify_preserve_domain</option></entry>
39225 <entry>Use: <emphasis>redirect</emphasis></entry>
39226 <entry>Type: <emphasis>boolean</emphasis></entry>
39227 <entry>Default: <emphasis>false</emphasis></entry>
39228 </row>
39229 </tbody>
39230 </tgroup>
39231 </informaltable>
39232 <para>
39233 <indexterm role="concept">
39234 <primary>domain</primary>
39235 <secondary>in redirection; preserving</secondary>
39236 </indexterm>
39237 <indexterm role="concept">
39238 <primary>preserving domain in redirection</primary>
39239 </indexterm>
39240 <indexterm role="concept">
39241 <primary>address redirection</primary>
39242 <secondary>domain; preserving</secondary>
39243 </indexterm>
39244 If this option is set, the router&#x2019;s local <option>qualify_domain</option> option must not be
39245 set (a configuration error occurs if it is). If an unqualified address (one
39246 without a domain) is generated, it is qualified with the domain of the parent
39247 address (the immediately preceding ancestor) instead of the global
39248 <option>qualify_recipient</option> value. In the case of a traditional <filename>.forward</filename> file,
39249 this applies whether or not the address is preceded by a backslash.
39250 </para>
39251 <para>
39252 <indexterm role="option">
39253 <primary><option>repeat_use</option></primary>
39254 </indexterm>
39255 </para>
39256 <informaltable frame="all">
39257 <tgroup cols="4" colsep="0" rowsep="0">
39258 <colspec colwidth="8*" align="left"/>
39259 <colspec colwidth="6*" align="center"/>
39260 <colspec colwidth="6*" align="center"/>
39261 <colspec colwidth="6*" align="right"/>
39262 <tbody>
39263 <row>
39264 <entry><option>repeat_use</option></entry>
39265 <entry>Use: <emphasis>redirect</emphasis></entry>
39266 <entry>Type: <emphasis>boolean</emphasis></entry>
39267 <entry>Default: <emphasis>true</emphasis></entry>
39268 </row>
39269 </tbody>
39270 </tgroup>
39271 </informaltable>
39272 <para>
39273 If this option is set false, the router is skipped for a child address that has
39274 any ancestor that was routed by this router. This test happens before any of
39275 the other preconditions are tested. Exim&#x2019;s default anti-looping rules skip
39276 only when the ancestor is the same as the current address. See also
39277 <option>check_ancestor</option> above and the generic <option>redirect_router</option> option.
39278 </para>
39279 <para>
39280 <indexterm role="option">
39281 <primary><option>reply_transport</option></primary>
39282 </indexterm>
39283 </para>
39284 <informaltable frame="all">
39285 <tgroup cols="4" colsep="0" rowsep="0">
39286 <colspec colwidth="8*" align="left"/>
39287 <colspec colwidth="6*" align="center"/>
39288 <colspec colwidth="6*" align="center"/>
39289 <colspec colwidth="6*" align="right"/>
39290 <tbody>
39291 <row>
39292 <entry><option>reply_transport</option></entry>
39293 <entry>Use: <emphasis>redirect</emphasis></entry>
39294 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39295 <entry>Default: <emphasis>unset</emphasis></entry>
39296 </row>
39297 </tbody>
39298 </tgroup>
39299 </informaltable>
39300 <para>
39301 A <command>redirect</command> router sets up an automatic reply when a <option>mail</option> or
39302 <option>vacation</option> command is used in a filter file. The transport used is specified
39303 by this option, which, after expansion, must be the name of a configured
39304 transport. This should normally be an <command>autoreply</command> transport. Other transports
39305 are unlikely to do anything sensible or useful.
39306 </para>
39307 <para>
39308 <indexterm role="option">
39309 <primary><option>rewrite</option></primary>
39310 </indexterm>
39311 </para>
39312 <informaltable frame="all">
39313 <tgroup cols="4" colsep="0" rowsep="0">
39314 <colspec colwidth="8*" align="left"/>
39315 <colspec colwidth="6*" align="center"/>
39316 <colspec colwidth="6*" align="center"/>
39317 <colspec colwidth="6*" align="right"/>
39318 <tbody>
39319 <row>
39320 <entry><option>rewrite</option></entry>
39321 <entry>Use: <emphasis>redirect</emphasis></entry>
39322 <entry>Type: <emphasis>boolean</emphasis></entry>
39323 <entry>Default: <emphasis>true</emphasis></entry>
39324 </row>
39325 </tbody>
39326 </tgroup>
39327 </informaltable>
39328 <para>
39329 <indexterm role="concept">
39330 <primary>address redirection</primary>
39331 <secondary>disabling rewriting</secondary>
39332 </indexterm>
39333 If this option is set false, addresses generated by the router are not
39334 subject to address rewriting. Otherwise, they are treated like new addresses
39335 and are rewritten according to the global rewriting rules.
39336 </para>
39337 <para>
39338 <indexterm role="option">
39339 <primary><option>sieve_subaddress</option></primary>
39340 </indexterm>
39341 </para>
39342 <informaltable frame="all">
39343 <tgroup cols="4" colsep="0" rowsep="0">
39344 <colspec colwidth="8*" align="left"/>
39345 <colspec colwidth="6*" align="center"/>
39346 <colspec colwidth="6*" align="center"/>
39347 <colspec colwidth="6*" align="right"/>
39348 <tbody>
39349 <row>
39350 <entry><option>sieve_subaddress</option></entry>
39351 <entry>Use: <emphasis>redirect</emphasis></entry>
39352 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39353 <entry>Default: <emphasis>unset</emphasis></entry>
39354 </row>
39355 </tbody>
39356 </tgroup>
39357 </informaltable>
39358 <para>
39359 The value of this option is passed to a Sieve filter to specify the
39360 :subaddress part of an address.
39361 </para>
39362 <para>
39363 <indexterm role="option">
39364 <primary><option>sieve_useraddress</option></primary>
39365 </indexterm>
39366 </para>
39367 <informaltable frame="all">
39368 <tgroup cols="4" colsep="0" rowsep="0">
39369 <colspec colwidth="8*" align="left"/>
39370 <colspec colwidth="6*" align="center"/>
39371 <colspec colwidth="6*" align="center"/>
39372 <colspec colwidth="6*" align="right"/>
39373 <tbody>
39374 <row>
39375 <entry><option>sieve_useraddress</option></entry>
39376 <entry>Use: <emphasis>redirect</emphasis></entry>
39377 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39378 <entry>Default: <emphasis>unset</emphasis></entry>
39379 </row>
39380 </tbody>
39381 </tgroup>
39382 </informaltable>
39383 <para>
39384 The value of this option is passed to a Sieve filter to specify the :user part
39385 of an address. However, if it is unset, the entire original local part
39386 (including any prefix or suffix) is used for :user.
39387 </para>
39388 <para>
39389 <indexterm role="option">
39390 <primary><option>sieve_vacation_directory</option></primary>
39391 </indexterm>
39392 </para>
39393 <informaltable frame="all">
39394 <tgroup cols="4" colsep="0" rowsep="0">
39395 <colspec colwidth="8*" align="left"/>
39396 <colspec colwidth="6*" align="center"/>
39397 <colspec colwidth="6*" align="center"/>
39398 <colspec colwidth="6*" align="right"/>
39399 <tbody>
39400 <row>
39401 <entry><option>sieve_vacation_directory</option></entry>
39402 <entry>Use: <emphasis>redirect</emphasis></entry>
39403 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39404 <entry>Default: <emphasis>unset</emphasis></entry>
39405 </row>
39406 </tbody>
39407 </tgroup>
39408 </informaltable>
39409 <para>
39410 <indexterm role="concept">
39411 <primary>Sieve filter</primary>
39412 <secondary>vacation directory</secondary>
39413 </indexterm>
39414 To enable the <quote>vacation</quote> extension for Sieve filters, you must set
39415 <option>sieve_vacation_directory</option> to the directory where vacation databases are held
39416 (do not put anything else in that directory), and ensure that the
39417 <option>reply_transport</option> option refers to an <command>autoreply</command> transport. Each user
39418 needs their own directory; Exim will create it if necessary.
39419 </para>
39420 <para>
39421 <indexterm role="option">
39422 <primary><option>skip_syntax_errors</option></primary>
39423 </indexterm>
39424 </para>
39425 <informaltable frame="all">
39426 <tgroup cols="4" colsep="0" rowsep="0">
39427 <colspec colwidth="8*" align="left"/>
39428 <colspec colwidth="6*" align="center"/>
39429 <colspec colwidth="6*" align="center"/>
39430 <colspec colwidth="6*" align="right"/>
39431 <tbody>
39432 <row>
39433 <entry><option>skip_syntax_errors</option></entry>
39434 <entry>Use: <emphasis>redirect</emphasis></entry>
39435 <entry>Type: <emphasis>boolean</emphasis></entry>
39436 <entry>Default: <emphasis>false</emphasis></entry>
39437 </row>
39438 </tbody>
39439 </tgroup>
39440 </informaltable>
39441 <para>
39442 <indexterm role="concept">
39443 <primary>forward file</primary>
39444 <secondary>broken</secondary>
39445 </indexterm>
39446 <indexterm role="concept">
39447 <primary>address redirection</primary>
39448 <secondary>broken files</secondary>
39449 </indexterm>
39450 <indexterm role="concept">
39451 <primary>alias file</primary>
39452 <secondary>broken</secondary>
39453 </indexterm>
39454 <indexterm role="concept">
39455 <primary>broken alias or forward files</primary>
39456 </indexterm>
39457 <indexterm role="concept">
39458 <primary>ignoring faulty addresses</primary>
39459 </indexterm>
39460 <indexterm role="concept">
39461 <primary>skipping faulty addresses</primary>
39462 </indexterm>
39463 <indexterm role="concept">
39464 <primary>error</primary>
39465 <secondary>skipping bad syntax</secondary>
39466 </indexterm>
39467 If <option>skip_syntax_errors</option> is set, syntactically malformed addresses in
39468 non-filter redirection data are skipped, and each failing address is logged. If
39469 <option>syntax_errors_to</option> is set, a message is sent to the address it defines,
39470 giving details of the failures. If <option>syntax_errors_text</option> is set, its contents
39471 are expanded and placed at the head of the error message generated by
39472 <option>syntax_errors_to</option>. Usually it is appropriate to set <option>syntax_errors_to</option> to
39473 be the same address as the generic <option>errors_to</option> option. The
39474 <option>skip_syntax_errors</option> option is often used when handling mailing lists.
39475 </para>
39476 <para>
39477 If all the addresses in a redirection list are skipped because of syntax
39478 errors, the router declines to handle the original address, and it is passed to
39479 the following routers.
39480 </para>
39481 <para>
39482 If <option>skip_syntax_errors</option> is set when an Exim filter is interpreted, any syntax
39483 error in the filter causes filtering to be abandoned without any action being
39484 taken. The incident is logged, and the router declines to handle the address,
39485 so it is passed to the following routers.
39486 </para>
39487 <para>
39488 <indexterm role="concept">
39489 <primary>Sieve filter</primary>
39490 <secondary>syntax errors in</secondary>
39491 </indexterm>
39492 Syntax errors in a Sieve filter file cause the <quote>keep</quote> action to occur. This
39493 action is specified by RFC 3028. The values of <option>skip_syntax_errors</option>,
39494 <option>syntax_errors_to</option>, and <option>syntax_errors_text</option> are not used.
39495 </para>
39496 <para>
39497 <option>skip_syntax_errors</option> can be used to specify that errors in users&#x2019; forward
39498 lists or filter files should not prevent delivery. The <option>syntax_errors_to</option>
39499 option, used with an address that does not get redirected, can be used to
39500 notify users of these errors, by means of a router like this:
39501 </para>
39502 <literallayout class="monospaced">
39503 userforward:
39504   driver = redirect
39505   allow_filter
39506   check_local_user
39507   file = $home/.forward
39508   file_transport = address_file
39509   pipe_transport = address_pipe
39510   reply_transport = address_reply
39511   no_verify
39512   skip_syntax_errors
39513   syntax_errors_to = real-$local_part@$domain
39514   syntax_errors_text = \
39515    This is an automatically generated message. An error has\n\
39516    been found in your .forward file. Details of the error are\n\
39517    reported below. While this error persists, you will receive\n\
39518    a copy of this message for every message that is addressed\n\
39519    to you. If your .forward file is a filter file, or if it is\n\
39520    a non-filter file containing no valid forwarding addresses,\n\
39521    a copy of each incoming message will be put in your normal\n\
39522    mailbox. If a non-filter file contains at least one valid\n\
39523    forwarding address, forwarding to the valid addresses will\n\
39524    happen, and those will be the only deliveries that occur.
39525 </literallayout>
39526 <para>
39527 You also need a router to ensure that local addresses that are prefixed by
39528 <literal>real-</literal> are recognized, but not forwarded or filtered. For example, you could
39529 put this immediately before the <command>userforward</command> router:
39530 </para>
39531 <literallayout class="monospaced">
39532 real_localuser:
39533   driver = accept
39534   check_local_user
39535   local_part_prefix = real-
39536   transport = local_delivery
39537 </literallayout>
39538 <para>
39539 For security, it would probably be a good idea to restrict the use of this
39540 router to locally-generated messages, using a condition such as this:
39541 </para>
39542 <literallayout class="monospaced">
39543   condition = ${if match {$sender_host_address}\
39544                          {\N^(|127\.0\.0\.1)$\N}}
39545 </literallayout>
39546 <para>
39547 <indexterm role="option">
39548 <primary><option>syntax_errors_text</option></primary>
39549 </indexterm>
39550 </para>
39551 <informaltable frame="all">
39552 <tgroup cols="4" colsep="0" rowsep="0">
39553 <colspec colwidth="8*" align="left"/>
39554 <colspec colwidth="6*" align="center"/>
39555 <colspec colwidth="6*" align="center"/>
39556 <colspec colwidth="6*" align="right"/>
39557 <tbody>
39558 <row>
39559 <entry><option>syntax_errors_text</option></entry>
39560 <entry>Use: <emphasis>redirect</emphasis></entry>
39561 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39562 <entry>Default: <emphasis>unset</emphasis></entry>
39563 </row>
39564 </tbody>
39565 </tgroup>
39566 </informaltable>
39567 <para>
39568 See <option>skip_syntax_errors</option> above.
39569 </para>
39570 <para>
39571 <indexterm role="option">
39572 <primary><option>syntax_errors_to</option></primary>
39573 </indexterm>
39574 </para>
39575 <informaltable frame="all">
39576 <tgroup cols="4" colsep="0" rowsep="0">
39577 <colspec colwidth="8*" align="left"/>
39578 <colspec colwidth="6*" align="center"/>
39579 <colspec colwidth="6*" align="center"/>
39580 <colspec colwidth="6*" align="right"/>
39581 <tbody>
39582 <row>
39583 <entry><option>syntax_errors_to</option></entry>
39584 <entry>Use: <emphasis>redirect</emphasis></entry>
39585 <entry>Type: <emphasis>string</emphasis></entry>
39586 <entry>Default: <emphasis>unset</emphasis></entry>
39587 </row>
39588 </tbody>
39589 </tgroup>
39590 </informaltable>
39591 <para>
39592 See <option>skip_syntax_errors</option> above.
39593 <indexterm role="concept" startref="IIDredrou1" class="endofrange"/>
39594 <indexterm role="concept" startref="IIDredrou2" class="endofrange"/>
39595 </para>
39596 </section>
39597 </chapter>
39598
39599 <chapter id="CHAPenvironment">
39600 <title>Environment for running local transports</title>
39601 <titleabbrev>Environment for local transports</titleabbrev>
39602 <para>
39603 <indexterm role="concept" id="IIDenvlotra1" class="startofrange">
39604 <primary>local transports</primary>
39605 <secondary>environment for</secondary>
39606 </indexterm>
39607 <indexterm role="concept" id="IIDenvlotra2" class="startofrange">
39608 <primary>environment</primary>
39609 <secondary>local transports</secondary>
39610 </indexterm>
39611 <indexterm role="concept" id="IIDenvlotra3" class="startofrange">
39612 <primary>transport</primary>
39613 <secondary>local; environment for</secondary>
39614 </indexterm>
39615 Local transports handle deliveries to files and pipes. (The <command>autoreply</command>
39616 transport can be thought of as similar to a pipe.) Exim always runs transports
39617 in subprocesses, under specified uids and gids. Typical deliveries to local
39618 mailboxes run under the uid and gid of the local user.
39619 </para>
39620 <para>
39621 Exim also sets a specific current directory while running the transport; for
39622 some transports a home directory setting is also relevant. The <command>pipe</command>
39623 transport is the only one that sets up environment variables; see section
39624 <xref linkend="SECTpipeenv"/> for details.
39625 </para>
39626 <para>
39627 The values used for the uid, gid, and the directories may come from several
39628 different places. In many cases, the router that handles the address associates
39629 settings with that address as a result of its <option>check_local_user</option>, <option>group</option>,
39630 or <option>user</option> options. However, values may also be given in the transport&#x2019;s own
39631 configuration, and these override anything that comes from the router.
39632 </para>
39633 <section id="SECID131">
39634 <title>Concurrent deliveries</title>
39635 <para>
39636 <indexterm role="concept">
39637 <primary>concurrent deliveries</primary>
39638 </indexterm>
39639 <indexterm role="concept">
39640 <primary>simultaneous deliveries</primary>
39641 </indexterm>
39642 If two different messages for the same local recipient arrive more or less
39643 simultaneously, the two delivery processes are likely to run concurrently. When
39644 the <command>appendfile</command> transport is used to write to a file, Exim applies locking
39645 rules to stop concurrent processes from writing to the same file at the same
39646 time.
39647 </para>
39648 <para>
39649 However, when you use a <command>pipe</command> transport, it is up to you to arrange any
39650 locking that is needed. Here is a silly example:
39651 </para>
39652 <literallayout class="monospaced">
39653 my_transport:
39654   driver = pipe
39655   command = /bin/sh -c 'cat &gt;&gt;/some/file'
39656 </literallayout>
39657 <para>
39658 This is supposed to write the message at the end of the file. However, if two
39659 messages arrive at the same time, the file will be scrambled. You can use the
39660 <option>exim_lock</option> utility program (see section <xref linkend="SECTmailboxmaint"/>) to lock a
39661 file using the same algorithm that Exim itself uses.
39662 </para>
39663 </section>
39664 <section id="SECTenvuidgid">
39665 <title>Uids and gids</title>
39666 <para>
39667 <indexterm role="concept">
39668 <primary>local transports</primary>
39669 <secondary>uid and gid</secondary>
39670 </indexterm>
39671 <indexterm role="concept">
39672 <primary>transport</primary>
39673 <secondary>local; uid and gid</secondary>
39674 </indexterm>
39675 All transports have the options <option>group</option> and <option>user</option>. If <option>group</option> is set, it
39676 overrides any group that the router set in the address, even if <option>user</option> is not
39677 set for the transport. This makes it possible, for example, to run local mail
39678 delivery under the uid of the recipient (set by the router), but in a special
39679 group (set by the transport). For example:
39680 </para>
39681 <literallayout class="monospaced">
39682 # Routers ...
39683 # User/group are set by check_local_user in this router
39684 local_users:
39685   driver = accept
39686   check_local_user
39687   transport = group_delivery
39688
39689 # Transports ...
39690 # This transport overrides the group
39691 group_delivery:
39692   driver = appendfile
39693   file = /var/spool/mail/$local_part
39694   group = mail
39695 </literallayout>
39696 <para>
39697 If <option>user</option> is set for a transport, its value overrides what is set in the
39698 address by the router. If <option>user</option> is non-numeric and <option>group</option> is not set, the
39699 gid associated with the user is used. If <option>user</option> is numeric, <option>group</option> must be
39700 set.
39701 </para>
39702 <para>
39703 <indexterm role="option">
39704 <primary><option>initgroups</option></primary>
39705 </indexterm>
39706 When the uid is taken from the transport&#x2019;s configuration, the <function>initgroups()</function>
39707 function is called for the groups associated with that uid if the
39708 <option>initgroups</option> option is set for the transport. When the uid is not specified
39709 by the transport, but is associated with the address by a router, the option
39710 for calling <function>initgroups()</function> is taken from the router configuration.
39711 </para>
39712 <para>
39713 <indexterm role="concept">
39714 <primary><command>pipe</command> transport</primary>
39715 <secondary>uid for</secondary>
39716 </indexterm>
39717 The <command>pipe</command> transport contains the special option <option>pipe_as_creator</option>. If this
39718 is set and <option>user</option> is not set, the uid of the process that called Exim to
39719 receive the message is used, and if <option>group</option> is not set, the corresponding
39720 original gid is also used.
39721 </para>
39722 <para>
39723 This is the detailed preference order for obtaining a gid; the first of the
39724 following that is set is used:
39725 </para>
39726 <itemizedlist>
39727 <listitem>
39728 <para>
39729 A <option>group</option> setting of the transport;
39730 </para>
39731 </listitem>
39732 <listitem>
39733 <para>
39734 A <option>group</option> setting of the router;
39735 </para>
39736 </listitem>
39737 <listitem>
39738 <para>
39739 A gid associated with a user setting of the router, either as a result of
39740 <option>check_local_user</option> or an explicit non-numeric <option>user</option> setting;
39741 </para>
39742 </listitem>
39743 <listitem>
39744 <para>
39745 The group associated with a non-numeric <option>user</option> setting of the transport;
39746 </para>
39747 </listitem>
39748 <listitem>
39749 <para>
39750 In a <command>pipe</command> transport, the creator&#x2019;s gid if <option>deliver_as_creator</option> is set and
39751 the uid is the creator&#x2019;s uid;
39752 </para>
39753 </listitem>
39754 <listitem>
39755 <para>
39756 The Exim gid if the Exim uid is being used as a default.
39757 </para>
39758 </listitem>
39759 </itemizedlist>
39760 <para>
39761 If, for example, the user is specified numerically on the router and there are
39762 no group settings, no gid is available. In this situation, an error occurs.
39763 This is different for the uid, for which there always is an ultimate default.
39764 The first of the following that is set is used:
39765 </para>
39766 <itemizedlist>
39767 <listitem>
39768 <para>
39769 A <option>user</option> setting of the transport;
39770 </para>
39771 </listitem>
39772 <listitem>
39773 <para>
39774 In a <command>pipe</command> transport, the creator&#x2019;s uid if <option>deliver_as_creator</option> is set;
39775 </para>
39776 </listitem>
39777 <listitem>
39778 <para>
39779 A <option>user</option> setting of the router;
39780 </para>
39781 </listitem>
39782 <listitem>
39783 <para>
39784 A <option>check_local_user</option> setting of the router;
39785 </para>
39786 </listitem>
39787 <listitem>
39788 <para>
39789 The Exim uid.
39790 </para>
39791 </listitem>
39792 </itemizedlist>
39793 <para>
39794 Of course, an error will still occur if the uid that is chosen is on the
39795 <option>never_users</option> list.
39796 </para>
39797 </section>
39798 <section id="SECID132">
39799 <title>Current and home directories</title>
39800 <para>
39801 <indexterm role="concept">
39802 <primary>current directory for local transport</primary>
39803 </indexterm>
39804 <indexterm role="concept">
39805 <primary>home directory</primary>
39806 <secondary>for local transport</secondary>
39807 </indexterm>
39808 <indexterm role="concept">
39809 <primary>transport</primary>
39810 <secondary>local; home directory for</secondary>
39811 </indexterm>
39812 <indexterm role="concept">
39813 <primary>transport</primary>
39814 <secondary>local; current directory for</secondary>
39815 </indexterm>
39816 Routers may set current and home directories for local transports by means of
39817 the <option>transport_current_directory</option> and <option>transport_home_directory</option> options.
39818 However, if the transport&#x2019;s <option>current_directory</option> or <option>home_directory</option> options
39819 are set, they override the router&#x2019;s values. In detail, the home directory
39820 for a local transport is taken from the first of these values that is set:
39821 </para>
39822 <itemizedlist>
39823 <listitem>
39824 <para>
39825 The <option>home_directory</option> option on the transport;
39826 </para>
39827 </listitem>
39828 <listitem>
39829 <para>
39830 The <option>transport_home_directory</option> option on the router;
39831 </para>
39832 </listitem>
39833 <listitem>
39834 <para>
39835 The password data if <option>check_local_user</option> is set on the router;
39836 </para>
39837 </listitem>
39838 <listitem>
39839 <para>
39840 The <option>router_home_directory</option> option on the router.
39841 </para>
39842 </listitem>
39843 </itemizedlist>
39844 <para>
39845 The current directory is taken from the first of these values that is set:
39846 </para>
39847 <itemizedlist>
39848 <listitem>
39849 <para>
39850 The <option>current_directory</option> option on the transport;
39851 </para>
39852 </listitem>
39853 <listitem>
39854 <para>
39855 The <option>transport_current_directory</option> option on the router.
39856 </para>
39857 </listitem>
39858 </itemizedlist>
39859 <para>
39860 If neither the router nor the transport sets a current directory, Exim uses the
39861 value of the home directory, if it is set. Otherwise it sets the current
39862 directory to <filename>/</filename> before running a local transport.
39863 </para>
39864 </section>
39865 <section id="SECID133">
39866 <title>Expansion variables derived from the address</title>
39867 <para>
39868 <indexterm role="variable">
39869 <primary><varname>$domain</varname></primary>
39870 </indexterm>
39871 <indexterm role="variable">
39872 <primary><varname>$local_part</varname></primary>
39873 </indexterm>
39874 <indexterm role="variable">
39875 <primary><varname>$original_domain</varname></primary>
39876 </indexterm>
39877 Normally a local delivery is handling a single address, and in that case the
39878 variables such as <varname>$domain</varname> and <varname>$local_part</varname> are set during local
39879 deliveries. However, in some circumstances more than one address may be handled
39880 at once (for example, while writing batch SMTP for onward transmission by some
39881 other means). In this case, the variables associated with the local part are
39882 never set, <varname>$domain</varname> is set only if all the addresses have the same domain,
39883 and <varname>$original_domain</varname> is never set.
39884 <indexterm role="concept" startref="IIDenvlotra1" class="endofrange"/>
39885 <indexterm role="concept" startref="IIDenvlotra2" class="endofrange"/>
39886 <indexterm role="concept" startref="IIDenvlotra3" class="endofrange"/>
39887 </para>
39888 </section>
39889 </chapter>
39890
39891 <chapter id="CHAPtransportgeneric">
39892 <title>Generic options for transports</title>
39893 <para>
39894 <indexterm role="concept" id="IIDgenoptra1" class="startofrange">
39895 <primary>generic options</primary>
39896 <secondary>transport</secondary>
39897 </indexterm>
39898 <indexterm role="concept" id="IIDgenoptra2" class="startofrange">
39899 <primary>options</primary>
39900 <secondary>generic; for transports</secondary>
39901 </indexterm>
39902 <indexterm role="concept" id="IIDgenoptra3" class="startofrange">
39903 <primary>transport</primary>
39904 <secondary>generic options for</secondary>
39905 </indexterm>
39906 The following generic options apply to all transports:
39907 </para>
39908 <para>
39909 <indexterm role="option">
39910 <primary><option>body_only</option></primary>
39911 </indexterm>
39912 </para>
39913 <informaltable frame="all">
39914 <tgroup cols="4" colsep="0" rowsep="0">
39915 <colspec colwidth="8*" align="left"/>
39916 <colspec colwidth="6*" align="center"/>
39917 <colspec colwidth="6*" align="center"/>
39918 <colspec colwidth="6*" align="right"/>
39919 <tbody>
39920 <row>
39921 <entry><option>body_only</option></entry>
39922 <entry>Use: <emphasis>transports</emphasis></entry>
39923 <entry>Type: <emphasis>boolean</emphasis></entry>
39924 <entry>Default: <emphasis>false</emphasis></entry>
39925 </row>
39926 </tbody>
39927 </tgroup>
39928 </informaltable>
39929 <para>
39930 <indexterm role="concept">
39931 <primary>transport</primary>
39932 <secondary>body only</secondary>
39933 </indexterm>
39934 <indexterm role="concept">
39935 <primary>message</primary>
39936 <secondary>transporting body only</secondary>
39937 </indexterm>
39938 <indexterm role="concept">
39939 <primary>body of message</primary>
39940 <secondary>transporting</secondary>
39941 </indexterm>
39942 If this option is set, the message&#x2019;s headers are not transported. It is
39943 mutually exclusive with <option>headers_only</option>. If it is used with the <command>appendfile</command>
39944 or <command>pipe</command> transports, the settings of <option>message_prefix</option> and
39945 <option>message_suffix</option> should be checked, because this option does not
39946 automatically suppress them.
39947 </para>
39948 <para>
39949 <indexterm role="option">
39950 <primary><option>current_directory</option></primary>
39951 </indexterm>
39952 </para>
39953 <informaltable frame="all">
39954 <tgroup cols="4" colsep="0" rowsep="0">
39955 <colspec colwidth="8*" align="left"/>
39956 <colspec colwidth="6*" align="center"/>
39957 <colspec colwidth="6*" align="center"/>
39958 <colspec colwidth="6*" align="right"/>
39959 <tbody>
39960 <row>
39961 <entry><option>current_directory</option></entry>
39962 <entry>Use: <emphasis>transports</emphasis></entry>
39963 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39964 <entry>Default: <emphasis>unset</emphasis></entry>
39965 </row>
39966 </tbody>
39967 </tgroup>
39968 </informaltable>
39969 <para>
39970 <indexterm role="concept">
39971 <primary>transport</primary>
39972 <secondary>current directory for</secondary>
39973 </indexterm>
39974 This specifies the current directory that is to be set while running the
39975 transport, overriding any value that may have been set by the router.
39976 If the expansion fails for any reason, including forced failure, an error is
39977 logged, and delivery is deferred.
39978 </para>
39979 <para>
39980 <indexterm role="option">
39981 <primary><option>disable_logging</option></primary>
39982 </indexterm>
39983 </para>
39984 <informaltable frame="all">
39985 <tgroup cols="4" colsep="0" rowsep="0">
39986 <colspec colwidth="8*" align="left"/>
39987 <colspec colwidth="6*" align="center"/>
39988 <colspec colwidth="6*" align="center"/>
39989 <colspec colwidth="6*" align="right"/>
39990 <tbody>
39991 <row>
39992 <entry><option>disable_logging</option></entry>
39993 <entry>Use: <emphasis>transports</emphasis></entry>
39994 <entry>Type: <emphasis>boolean</emphasis></entry>
39995 <entry>Default: <emphasis>false</emphasis></entry>
39996 </row>
39997 </tbody>
39998 </tgroup>
39999 </informaltable>
40000 <para>
40001 If this option is set true, nothing is logged for any
40002 deliveries by the transport or for any
40003 transport errors. You should not set this option unless you really, really know
40004 what you are doing.
40005 </para>
40006 <para>
40007 <indexterm role="option">
40008 <primary><option>debug_print</option></primary>
40009 </indexterm>
40010 </para>
40011 <informaltable frame="all">
40012 <tgroup cols="4" colsep="0" rowsep="0">
40013 <colspec colwidth="8*" align="left"/>
40014 <colspec colwidth="6*" align="center"/>
40015 <colspec colwidth="6*" align="center"/>
40016 <colspec colwidth="6*" align="right"/>
40017 <tbody>
40018 <row>
40019 <entry><option>debug_print</option></entry>
40020 <entry>Use: <emphasis>transports</emphasis></entry>
40021 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40022 <entry>Default: <emphasis>unset</emphasis></entry>
40023 </row>
40024 </tbody>
40025 </tgroup>
40026 </informaltable>
40027 <para>
40028 <indexterm role="concept">
40029 <primary>testing</primary>
40030 <secondary>variables in drivers</secondary>
40031 </indexterm>
40032 If this option is set and debugging is enabled (see the <option>-d</option> command line
40033 option), the string is expanded and included in the debugging output when the
40034 transport is run.
40035 If expansion of the string fails, the error message is written to the debugging
40036 output, and Exim carries on processing.
40037 This facility is provided to help with checking out the values of variables and
40038 so on when debugging driver configurations. For example, if a <option>headers_add</option>
40039 option is not working properly, <option>debug_print</option> could be used to output the
40040 variables it references. A newline is added to the text if it does not end with
40041 one.
40042 The variables <varname>$transport_name</varname> and <varname>$router_name</varname> contain the name of the
40043 transport and the router that called it.
40044 </para>
40045 <para>
40046 <indexterm role="option">
40047 <primary><option>delivery_date_add</option></primary>
40048 </indexterm>
40049 </para>
40050 <informaltable frame="all">
40051 <tgroup cols="4" colsep="0" rowsep="0">
40052 <colspec colwidth="8*" align="left"/>
40053 <colspec colwidth="6*" align="center"/>
40054 <colspec colwidth="6*" align="center"/>
40055 <colspec colwidth="6*" align="right"/>
40056 <tbody>
40057 <row>
40058 <entry><option>delivery_date_add</option></entry>
40059 <entry>Use: <emphasis>transports</emphasis></entry>
40060 <entry>Type: <emphasis>boolean</emphasis></entry>
40061 <entry>Default: <emphasis>false</emphasis></entry>
40062 </row>
40063 </tbody>
40064 </tgroup>
40065 </informaltable>
40066 <para>
40067 <indexterm role="concept">
40068 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
40069 </indexterm>
40070 If this option is true, a <emphasis>Delivery-date:</emphasis> header is added to the message.
40071 This gives the actual time the delivery was made. As this is not a standard
40072 header, Exim has a configuration option (<option>delivery_date_remove</option>) which
40073 requests its removal from incoming messages, so that delivered messages can
40074 safely be resent to other recipients.
40075 </para>
40076 <para>
40077 <indexterm role="option">
40078 <primary><option>driver</option></primary>
40079 </indexterm>
40080 </para>
40081 <informaltable frame="all">
40082 <tgroup cols="4" colsep="0" rowsep="0">
40083 <colspec colwidth="8*" align="left"/>
40084 <colspec colwidth="6*" align="center"/>
40085 <colspec colwidth="6*" align="center"/>
40086 <colspec colwidth="6*" align="right"/>
40087 <tbody>
40088 <row>
40089 <entry><option>driver</option></entry>
40090 <entry>Use: <emphasis>transports</emphasis></entry>
40091 <entry>Type: <emphasis>string</emphasis></entry>
40092 <entry>Default: <emphasis>unset</emphasis></entry>
40093 </row>
40094 </tbody>
40095 </tgroup>
40096 </informaltable>
40097 <para>
40098 This specifies which of the available transport drivers is to be used.
40099 There is no default, and this option must be set for every transport.
40100 </para>
40101 <para>
40102 <indexterm role="option">
40103 <primary><option>envelope_to_add</option></primary>
40104 </indexterm>
40105 </para>
40106 <informaltable frame="all">
40107 <tgroup cols="4" colsep="0" rowsep="0">
40108 <colspec colwidth="8*" align="left"/>
40109 <colspec colwidth="6*" align="center"/>
40110 <colspec colwidth="6*" align="center"/>
40111 <colspec colwidth="6*" align="right"/>
40112 <tbody>
40113 <row>
40114 <entry><option>envelope_to_add</option></entry>
40115 <entry>Use: <emphasis>transports</emphasis></entry>
40116 <entry>Type: <emphasis>boolean</emphasis></entry>
40117 <entry>Default: <emphasis>false</emphasis></entry>
40118 </row>
40119 </tbody>
40120 </tgroup>
40121 </informaltable>
40122 <para>
40123 <indexterm role="concept">
40124 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
40125 </indexterm>
40126 If this option is true, an <emphasis>Envelope-to:</emphasis> header is added to the message.
40127 This gives the original address(es) in the incoming envelope that caused this
40128 delivery to happen. More than one address may be present if the transport is
40129 configured to handle several addresses at once, or if more than one original
40130 address was redirected to the same final address. As this is not a standard
40131 header, Exim has a configuration option (<option>envelope_to_remove</option>) which requests
40132 its removal from incoming messages, so that delivered messages can safely be
40133 resent to other recipients.
40134 </para>
40135 <para>
40136 <indexterm role="option">
40137 <primary><option>event_action</option></primary>
40138 </indexterm>
40139 </para>
40140 <informaltable frame="all">
40141 <tgroup cols="4" colsep="0" rowsep="0">
40142 <colspec colwidth="8*" align="left"/>
40143 <colspec colwidth="6*" align="center"/>
40144 <colspec colwidth="6*" align="center"/>
40145 <colspec colwidth="6*" align="right"/>
40146 <tbody>
40147 <row>
40148 <entry><option>event_action</option></entry>
40149 <entry>Use: <emphasis>transports</emphasis></entry>
40150 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40151 <entry>Default: <emphasis>unset</emphasis></entry>
40152 </row>
40153 </tbody>
40154 </tgroup>
40155 </informaltable>
40156 <para>
40157 <indexterm role="concept">
40158 <primary>events</primary>
40159 </indexterm>
40160 This option declares a string to be expanded for Exim&#x2019;s events mechanism.
40161 For details see chapter <xref linkend="CHAPevents"/>.
40162 </para>
40163 <para>
40164 <indexterm role="option">
40165 <primary><option>group</option></primary>
40166 </indexterm>
40167 </para>
40168 <informaltable frame="all">
40169 <tgroup cols="4" colsep="0" rowsep="0">
40170 <colspec colwidth="8*" align="left"/>
40171 <colspec colwidth="6*" align="center"/>
40172 <colspec colwidth="6*" align="center"/>
40173 <colspec colwidth="6*" align="right"/>
40174 <tbody>
40175 <row>
40176 <entry><option>group</option></entry>
40177 <entry>Use: <emphasis>transports</emphasis></entry>
40178 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40179 <entry>Default: <emphasis>Exim group</emphasis></entry>
40180 </row>
40181 </tbody>
40182 </tgroup>
40183 </informaltable>
40184 <para>
40185 <indexterm role="concept">
40186 <primary>transport</primary>
40187 <secondary>group; specifying</secondary>
40188 </indexterm>
40189 This option specifies a gid for running the transport process, overriding any
40190 value that the router supplies, and also overriding any value associated with
40191 <option>user</option> (see below).
40192 </para>
40193 <para>
40194 <indexterm role="option">
40195 <primary><option>headers_add</option></primary>
40196 </indexterm>
40197 </para>
40198 <informaltable frame="all">
40199 <tgroup cols="4" colsep="0" rowsep="0">
40200 <colspec colwidth="8*" align="left"/>
40201 <colspec colwidth="6*" align="center"/>
40202 <colspec colwidth="6*" align="center"/>
40203 <colspec colwidth="6*" align="right"/>
40204 <tbody>
40205 <row>
40206 <entry><option>headers_add</option></entry>
40207 <entry>Use: <emphasis>transports</emphasis></entry>
40208 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
40209 <entry>Default: <emphasis>unset</emphasis></entry>
40210 </row>
40211 </tbody>
40212 </tgroup>
40213 </informaltable>
40214 <para>
40215 <indexterm role="concept">
40216 <primary>header lines</primary>
40217 <secondary>adding in transport</secondary>
40218 </indexterm>
40219 <indexterm role="concept">
40220 <primary>transport</primary>
40221 <secondary>header lines; adding</secondary>
40222 </indexterm>
40223 This option specifies a list of text headers,
40224 newline-separated (by default, changeable in the usual way),
40225 which are (separately) expanded and added to the header
40226 portion of a message as it is transported, as described in section
40227 <xref linkend="SECTheadersaddrem"/>. Additional header lines can also be specified by
40228 routers. If the result of the expansion is an empty string, or if the expansion
40229 is forced to fail, no action is taken. Other expansion failures are treated as
40230 errors and cause the delivery to be deferred.
40231 </para>
40232 <para>
40233 Unlike most options, <option>headers_add</option> can be specified multiple times
40234 for a transport; all listed headers are added.
40235 </para>
40236 <para>
40237 <indexterm role="option">
40238 <primary><option>headers_only</option></primary>
40239 </indexterm>
40240 </para>
40241 <informaltable frame="all">
40242 <tgroup cols="4" colsep="0" rowsep="0">
40243 <colspec colwidth="8*" align="left"/>
40244 <colspec colwidth="6*" align="center"/>
40245 <colspec colwidth="6*" align="center"/>
40246 <colspec colwidth="6*" align="right"/>
40247 <tbody>
40248 <row>
40249 <entry><option>headers_only</option></entry>
40250 <entry>Use: <emphasis>transports</emphasis></entry>
40251 <entry>Type: <emphasis>boolean</emphasis></entry>
40252 <entry>Default: <emphasis>false</emphasis></entry>
40253 </row>
40254 </tbody>
40255 </tgroup>
40256 </informaltable>
40257 <para>
40258 <indexterm role="concept">
40259 <primary>transport</primary>
40260 <secondary>header lines only</secondary>
40261 </indexterm>
40262 <indexterm role="concept">
40263 <primary>message</primary>
40264 <secondary>transporting headers only</secondary>
40265 </indexterm>
40266 <indexterm role="concept">
40267 <primary>header lines</primary>
40268 <secondary>transporting</secondary>
40269 </indexterm>
40270 If this option is set, the message&#x2019;s body is not transported. It is mutually
40271 exclusive with <option>body_only</option>. If it is used with the <command>appendfile</command> or <command>pipe</command>
40272 transports, the settings of <option>message_prefix</option> and <option>message_suffix</option> should be
40273 checked, since this option does not automatically suppress them.
40274 </para>
40275 <para>
40276 <indexterm role="option">
40277 <primary><option>headers_remove</option></primary>
40278 </indexterm>
40279 </para>
40280 <informaltable frame="all">
40281 <tgroup cols="4" colsep="0" rowsep="0">
40282 <colspec colwidth="8*" align="left"/>
40283 <colspec colwidth="6*" align="center"/>
40284 <colspec colwidth="6*" align="center"/>
40285 <colspec colwidth="6*" align="right"/>
40286 <tbody>
40287 <row>
40288 <entry><option>headers_remove</option></entry>
40289 <entry>Use: <emphasis>transports</emphasis></entry>
40290 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
40291 <entry>Default: <emphasis>unset</emphasis></entry>
40292 </row>
40293 </tbody>
40294 </tgroup>
40295 </informaltable>
40296 <para>
40297 <indexterm role="concept">
40298 <primary>header lines</primary>
40299 <secondary>removing</secondary>
40300 </indexterm>
40301 <indexterm role="concept">
40302 <primary>transport</primary>
40303 <secondary>header lines; removing</secondary>
40304 </indexterm>
40305 This option specifies a list of header names,
40306 colon-separated (by default, changeable in the usual way);
40307 these headers are omitted from the message as it is transported, as described
40308 in section <xref linkend="SECTheadersaddrem"/>. Header removal can also be specified by
40309 routers.
40310 Each list item is separately expanded.
40311 If the result of the expansion is an empty string, or if the expansion
40312 is forced to fail, no action is taken. Other expansion failures are treated as
40313 errors and cause the delivery to be deferred.
40314 </para>
40315 <para>
40316 Unlike most options, <option>headers_remove</option> can be specified multiple times
40317 for a transport; all listed headers are removed.
40318 </para>
40319 <para>
40320 <emphasis role="bold">Warning</emphasis>: Because of the separate expansion of the list items,
40321 items that contain a list separator must have it doubled.
40322 To avoid this, change the list separator (<xref linkend="SECTlistsepchange"/>).
40323 </para>
40324 <para>
40325 <indexterm role="option">
40326 <primary><option>headers_rewrite</option></primary>
40327 </indexterm>
40328 </para>
40329 <informaltable frame="all">
40330 <tgroup cols="4" colsep="0" rowsep="0">
40331 <colspec colwidth="8*" align="left"/>
40332 <colspec colwidth="6*" align="center"/>
40333 <colspec colwidth="6*" align="center"/>
40334 <colspec colwidth="6*" align="right"/>
40335 <tbody>
40336 <row>
40337 <entry><option>headers_rewrite</option></entry>
40338 <entry>Use: <emphasis>transports</emphasis></entry>
40339 <entry>Type: <emphasis>string</emphasis></entry>
40340 <entry>Default: <emphasis>unset</emphasis></entry>
40341 </row>
40342 </tbody>
40343 </tgroup>
40344 </informaltable>
40345 <para>
40346 <indexterm role="concept">
40347 <primary>transport</primary>
40348 <secondary>header lines; rewriting</secondary>
40349 </indexterm>
40350 <indexterm role="concept">
40351 <primary>rewriting</primary>
40352 <secondary>at transport time</secondary>
40353 </indexterm>
40354 This option allows addresses in header lines to be rewritten at transport time,
40355 that is, as the message is being copied to its destination. The contents of the
40356 option are a colon-separated list of rewriting rules. Each rule is in exactly
40357 the same form as one of the general rewriting rules that are applied when a
40358 message is received. These are described in chapter <xref linkend="CHAPrewrite"/>. For
40359 example,
40360 </para>
40361 <literallayout class="monospaced">
40362 headers_rewrite = a@b c@d f : \
40363                   x@y w@z
40364 </literallayout>
40365 <para>
40366 changes <emphasis>a@b</emphasis> into <emphasis>c@d</emphasis> in <emphasis>From:</emphasis> header lines, and <emphasis>x@y</emphasis> into
40367 <emphasis>w@z</emphasis> in all address-bearing header lines. The rules are applied to the
40368 header lines just before they are written out at transport time, so they affect
40369 only those copies of the message that pass through the transport. However, only
40370 the message&#x2019;s original header lines, and any that were added by a system
40371 filter, are rewritten. If a router or transport adds header lines, they are not
40372 affected by this option. These rewriting rules are <emphasis>not</emphasis> applied to the
40373 envelope. You can change the return path using <option>return_path</option>, but you cannot
40374 change envelope recipients at this time.
40375 </para>
40376 <para>
40377 <indexterm role="option">
40378 <primary><option>home_directory</option></primary>
40379 </indexterm>
40380 </para>
40381 <informaltable frame="all">
40382 <tgroup cols="4" colsep="0" rowsep="0">
40383 <colspec colwidth="8*" align="left"/>
40384 <colspec colwidth="6*" align="center"/>
40385 <colspec colwidth="6*" align="center"/>
40386 <colspec colwidth="6*" align="right"/>
40387 <tbody>
40388 <row>
40389 <entry><option>home_directory</option></entry>
40390 <entry>Use: <emphasis>transports</emphasis></entry>
40391 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40392 <entry>Default: <emphasis>unset</emphasis></entry>
40393 </row>
40394 </tbody>
40395 </tgroup>
40396 </informaltable>
40397 <para>
40398 <indexterm role="concept">
40399 <primary>transport</primary>
40400 <secondary>home directory for</secondary>
40401 </indexterm>
40402 <indexterm role="variable">
40403 <primary><varname>$home</varname></primary>
40404 </indexterm>
40405 This option specifies a home directory setting for a local transport,
40406 overriding any value that may be set by the router. The home directory is
40407 placed in <varname>$home</varname> while expanding the transport&#x2019;s private options. It is also
40408 used as the current directory if no current directory is set by the
40409 <option>current_directory</option> option on the transport or the
40410 <option>transport_current_directory</option> option on the router. If the expansion fails
40411 for any reason, including forced failure, an error is logged, and delivery is
40412 deferred.
40413 </para>
40414 <para>
40415 <indexterm role="option">
40416 <primary><option>initgroups</option></primary>
40417 </indexterm>
40418 </para>
40419 <informaltable frame="all">
40420 <tgroup cols="4" colsep="0" rowsep="0">
40421 <colspec colwidth="8*" align="left"/>
40422 <colspec colwidth="6*" align="center"/>
40423 <colspec colwidth="6*" align="center"/>
40424 <colspec colwidth="6*" align="right"/>
40425 <tbody>
40426 <row>
40427 <entry><option>initgroups</option></entry>
40428 <entry>Use: <emphasis>transports</emphasis></entry>
40429 <entry>Type: <emphasis>boolean</emphasis></entry>
40430 <entry>Default: <emphasis>false</emphasis></entry>
40431 </row>
40432 </tbody>
40433 </tgroup>
40434 </informaltable>
40435 <para>
40436 <indexterm role="concept">
40437 <primary>additional groups</primary>
40438 </indexterm>
40439 <indexterm role="concept">
40440 <primary>groups</primary>
40441 <secondary>additional</secondary>
40442 </indexterm>
40443 <indexterm role="concept">
40444 <primary>transport</primary>
40445 <secondary>group; additional</secondary>
40446 </indexterm>
40447 If this option is true and the uid for the delivery process is provided by the
40448 transport, the <function>initgroups()</function> function is called when running the transport
40449 to ensure that any additional groups associated with the uid are set up.
40450 </para>
40451 <para>
40452 <indexterm role="option">
40453 <primary><option>max_parallel</option></primary>
40454 </indexterm>
40455 </para>
40456 <informaltable frame="all">
40457 <tgroup cols="4" colsep="0" rowsep="0">
40458 <colspec colwidth="8*" align="left"/>
40459 <colspec colwidth="6*" align="center"/>
40460 <colspec colwidth="6*" align="center"/>
40461 <colspec colwidth="6*" align="right"/>
40462 <tbody>
40463 <row>
40464 <entry><option>max_parallel</option></entry>
40465 <entry>Use: <emphasis>transports</emphasis></entry>
40466 <entry>Type: <emphasis>integer</emphasis>&dagger;<emphasis></emphasis></entry>
40467 <entry>Default: <emphasis>unset</emphasis></entry>
40468 </row>
40469 </tbody>
40470 </tgroup>
40471 </informaltable>
40472 <para>
40473 <indexterm role="concept">
40474 <primary>limit</primary>
40475 <secondary>transport parallelism</secondary>
40476 </indexterm>
40477 <indexterm role="concept">
40478 <primary>transport</primary>
40479 <secondary>parallel processes</secondary>
40480 </indexterm>
40481 <indexterm role="concept">
40482 <primary>transport</primary>
40483 <secondary>concurrency limit</secondary>
40484 </indexterm>
40485 <indexterm role="concept">
40486 <primary>delivery</primary>
40487 <secondary>parallelism for transport</secondary>
40488 </indexterm>
40489 If this option is set and expands to an integer greater than zero
40490 it limits the number of concurrent runs of the transport.
40491 The control does not apply to shadow transports.
40492 </para>
40493 <para>
40494 <indexterm role="concept">
40495 <primary>hints database</primary>
40496 <secondary>transport concurrency control</secondary>
40497 </indexterm>
40498 Exim implements this control by means of a hints database in which a record is
40499 incremented whenever a transport process is being created. The record
40500 is decremented and possibly removed when the process terminates.
40501 Obviously there is scope for
40502 records to get left lying around if there is a system or program crash. To
40503 guard against this, Exim ignores any records that are more than six hours old.
40504 </para>
40505 <para>
40506 If you use this option, you should also arrange to delete the
40507 relevant hints database whenever your system reboots. The names of the files
40508 start with <filename>misc</filename> and they are kept in the <filename>spool/db</filename> directory. There
40509 may be one or two files, depending on the type of DBM in use. The same files
40510 are used for ETRN and smtp transport serialization.
40511 </para>
40512 <para>
40513 <indexterm role="option">
40514 <primary><option>message_size_limit</option></primary>
40515 </indexterm>
40516 </para>
40517 <informaltable frame="all">
40518 <tgroup cols="4" colsep="0" rowsep="0">
40519 <colspec colwidth="8*" align="left"/>
40520 <colspec colwidth="6*" align="center"/>
40521 <colspec colwidth="6*" align="center"/>
40522 <colspec colwidth="6*" align="right"/>
40523 <tbody>
40524 <row>
40525 <entry><option>message_size_limit</option></entry>
40526 <entry>Use: <emphasis>transports</emphasis></entry>
40527 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40528 <entry>Default: <emphasis>0</emphasis></entry>
40529 </row>
40530 </tbody>
40531 </tgroup>
40532 </informaltable>
40533 <para>
40534 <indexterm role="concept">
40535 <primary>limit</primary>
40536 <secondary>message size per transport</secondary>
40537 </indexterm>
40538 <indexterm role="concept">
40539 <primary>size</primary>
40540 <secondary>of message, limit</secondary>
40541 </indexterm>
40542 <indexterm role="concept">
40543 <primary>transport</primary>
40544 <secondary>message size; limiting</secondary>
40545 </indexterm>
40546 This option controls the size of messages passed through the transport. It is
40547 expanded before use; the result of the expansion must be a sequence of decimal
40548 digits, optionally followed by K or M. If the expansion fails for any reason,
40549 including forced failure, or if the result is not of the required form,
40550 delivery is deferred. If the value is greater than zero and the size of a
40551 message exceeds this limit, the address is failed. If there is any chance that
40552 the resulting bounce message could be routed to the same transport, you should
40553 ensure that <option>return_size_limit</option> is less than the transport&#x2019;s
40554 <option>message_size_limit</option>, as otherwise the bounce message will fail to get
40555 delivered.
40556 </para>
40557 <para>
40558 <indexterm role="option">
40559 <primary><option>rcpt_include_affixes</option></primary>
40560 </indexterm>
40561 </para>
40562 <informaltable frame="all">
40563 <tgroup cols="4" colsep="0" rowsep="0">
40564 <colspec colwidth="8*" align="left"/>
40565 <colspec colwidth="6*" align="center"/>
40566 <colspec colwidth="6*" align="center"/>
40567 <colspec colwidth="6*" align="right"/>
40568 <tbody>
40569 <row>
40570 <entry><option>rcpt_include_affixes</option></entry>
40571 <entry>Use: <emphasis>transports</emphasis></entry>
40572 <entry>Type: <emphasis>boolean</emphasis></entry>
40573 <entry>Default: <emphasis>false</emphasis></entry>
40574 </row>
40575 </tbody>
40576 </tgroup>
40577 </informaltable>
40578 <para>
40579 <indexterm role="concept">
40580 <primary>prefix</primary>
40581 <secondary>for local part, including in envelope</secondary>
40582 </indexterm>
40583 <indexterm role="concept">
40584 <primary>suffix for local part</primary>
40585 <secondary>including in envelope</secondary>
40586 </indexterm>
40587 <indexterm role="concept">
40588 <primary>local part</primary>
40589 <secondary>prefix</secondary>
40590 </indexterm>
40591 <indexterm role="concept">
40592 <primary>local part</primary>
40593 <secondary>suffix</secondary>
40594 </indexterm>
40595 When this option is false (the default), and an address that has had any
40596 affixes (prefixes or suffixes) removed from the local part is delivered by any
40597 form of SMTP or LMTP, the affixes are not included. For example, if a router
40598 that contains
40599 </para>
40600 <literallayout class="monospaced">
40601 local_part_prefix = *-
40602 </literallayout>
40603 <para>
40604 routes the address <emphasis>abc-xyz@some.domain</emphasis> to an SMTP transport, the envelope
40605 is delivered with
40606 </para>
40607 <literallayout class="monospaced">
40608 RCPT TO:&lt;xyz@some.domain&gt;
40609 </literallayout>
40610 <para>
40611 This is also the case when an ACL-time callout is being used to verify a
40612 recipient address. However, if <option>rcpt_include_affixes</option> is set true, the
40613 whole local part is included in the RCPT command. This option applies to BSMTP
40614 deliveries by the <command>appendfile</command> and <command>pipe</command> transports as well as to the
40615 <command>lmtp</command> and <command>smtp</command> transports.
40616 </para>
40617 <para>
40618 <indexterm role="option">
40619 <primary><option>retry_use_local_part</option></primary>
40620 </indexterm>
40621 </para>
40622 <informaltable frame="all">
40623 <tgroup cols="4" colsep="0" rowsep="0">
40624 <colspec colwidth="8*" align="left"/>
40625 <colspec colwidth="6*" align="center"/>
40626 <colspec colwidth="6*" align="center"/>
40627 <colspec colwidth="6*" align="right"/>
40628 <tbody>
40629 <row>
40630 <entry><option>retry_use_local_part</option></entry>
40631 <entry>Use: <emphasis>transports</emphasis></entry>
40632 <entry>Type: <emphasis>boolean</emphasis></entry>
40633 <entry>Default: <emphasis>see below</emphasis></entry>
40634 </row>
40635 </tbody>
40636 </tgroup>
40637 </informaltable>
40638 <para>
40639 <indexterm role="concept">
40640 <primary>hints database</primary>
40641 <secondary>retry keys</secondary>
40642 </indexterm>
40643 When a delivery suffers a temporary failure, a retry record is created
40644 in Exim&#x2019;s hints database. For remote deliveries, the key for the retry record
40645 is based on the name and/or IP address of the failing remote host. For local
40646 deliveries, the key is normally the entire address, including both the local
40647 part and the domain. This is suitable for most common cases of local delivery
40648 temporary failure &ndash; for example, exceeding a mailbox quota should delay only
40649 deliveries to that mailbox, not to the whole domain.
40650 </para>
40651 <para>
40652 However, in some special cases you may want to treat a temporary local delivery
40653 as a failure associated with the domain, and not with a particular local part.
40654 (For example, if you are storing all mail for some domain in files.) You can do
40655 this by setting <option>retry_use_local_part</option> false.
40656 </para>
40657 <para>
40658 For all the local transports, its default value is true. For remote transports,
40659 the default value is false for tidiness, but changing the value has no effect
40660 on a remote transport in the current implementation.
40661 </para>
40662 <para>
40663 <indexterm role="option">
40664 <primary><option>return_path</option></primary>
40665 </indexterm>
40666 </para>
40667 <informaltable frame="all">
40668 <tgroup cols="4" colsep="0" rowsep="0">
40669 <colspec colwidth="8*" align="left"/>
40670 <colspec colwidth="6*" align="center"/>
40671 <colspec colwidth="6*" align="center"/>
40672 <colspec colwidth="6*" align="right"/>
40673 <tbody>
40674 <row>
40675 <entry><option>return_path</option></entry>
40676 <entry>Use: <emphasis>transports</emphasis></entry>
40677 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40678 <entry>Default: <emphasis>unset</emphasis></entry>
40679 </row>
40680 </tbody>
40681 </tgroup>
40682 </informaltable>
40683 <para>
40684 <indexterm role="concept">
40685 <primary>envelope sender</primary>
40686 </indexterm>
40687 <indexterm role="concept">
40688 <primary>transport</primary>
40689 <secondary>return path; changing</secondary>
40690 </indexterm>
40691 <indexterm role="concept">
40692 <primary>return path</primary>
40693 <secondary>changing in transport</secondary>
40694 </indexterm>
40695 If this option is set, the string is expanded at transport time and replaces
40696 the existing return path (envelope sender) value in the copy of the message
40697 that is being delivered. An empty return path is permitted. This feature is
40698 designed for remote deliveries, where the value of this option is used in the
40699 SMTP MAIL command. If you set <option>return_path</option> for a local transport, the
40700 only effect is to change the address that is placed in the <emphasis>Return-path:</emphasis>
40701 header line, if one is added to the message (see the next option).
40702 </para>
40703 <para>
40704 <emphasis role="bold">Note:</emphasis> A changed return path is not logged unless you add
40705 <option>return_path_on_delivery</option> to the log selector.
40706 </para>
40707 <para>
40708 <indexterm role="variable">
40709 <primary><varname>$return_path</varname></primary>
40710 </indexterm>
40711 The expansion can refer to the existing value via <varname>$return_path</varname>. This is
40712 either the message&#x2019;s envelope sender, or an address set by the
40713 <option>errors_to</option> option on a router. If the expansion is forced to fail, no
40714 replacement occurs; if it fails for another reason, delivery is deferred. This
40715 option can be used to support VERP (Variable Envelope Return Paths) &ndash; see
40716 section <xref linkend="SECTverp"/>.
40717 </para>
40718 <para>
40719 <emphasis role="bold">Note</emphasis>: If a delivery error is detected locally, including the case when a
40720 remote server rejects a message at SMTP time, the bounce message is not sent to
40721 the value of this option. It is sent to the previously set errors address.
40722 This defaults to the incoming sender address, but can be changed by setting
40723 <option>errors_to</option> in a router.
40724 </para>
40725 <para>
40726 <indexterm role="option">
40727 <primary><option>return_path_add</option></primary>
40728 </indexterm>
40729 </para>
40730 <informaltable frame="all">
40731 <tgroup cols="4" colsep="0" rowsep="0">
40732 <colspec colwidth="8*" align="left"/>
40733 <colspec colwidth="6*" align="center"/>
40734 <colspec colwidth="6*" align="center"/>
40735 <colspec colwidth="6*" align="right"/>
40736 <tbody>
40737 <row>
40738 <entry><option>return_path_add</option></entry>
40739 <entry>Use: <emphasis>transports</emphasis></entry>
40740 <entry>Type: <emphasis>boolean</emphasis></entry>
40741 <entry>Default: <emphasis>false</emphasis></entry>
40742 </row>
40743 </tbody>
40744 </tgroup>
40745 </informaltable>
40746 <para>
40747 <indexterm role="concept">
40748 <primary><emphasis>Return-path:</emphasis> header line</primary>
40749 </indexterm>
40750 If this option is true, a <emphasis>Return-path:</emphasis> header is added to the message.
40751 Although the return path is normally available in the prefix line of BSD
40752 mailboxes, this is commonly not displayed by MUAs, and so the user does not
40753 have easy access to it.
40754 </para>
40755 <para>
40756 RFC 2821 states that the <emphasis>Return-path:</emphasis> header is added to a message <quote>when
40757 the delivery SMTP server makes the final delivery</quote>. This implies that this
40758 header should not be present in incoming messages. Exim has a configuration
40759 option, <option>return_path_remove</option>, which requests removal of this header from
40760 incoming messages, so that delivered messages can safely be resent to other
40761 recipients.
40762 </para>
40763 <para>
40764 <indexterm role="option">
40765 <primary><option>shadow_condition</option></primary>
40766 </indexterm>
40767 </para>
40768 <informaltable frame="all">
40769 <tgroup cols="4" colsep="0" rowsep="0">
40770 <colspec colwidth="8*" align="left"/>
40771 <colspec colwidth="6*" align="center"/>
40772 <colspec colwidth="6*" align="center"/>
40773 <colspec colwidth="6*" align="right"/>
40774 <tbody>
40775 <row>
40776 <entry><option>shadow_condition</option></entry>
40777 <entry>Use: <emphasis>transports</emphasis></entry>
40778 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40779 <entry>Default: <emphasis>unset</emphasis></entry>
40780 </row>
40781 </tbody>
40782 </tgroup>
40783 </informaltable>
40784 <para>
40785 See <option>shadow_transport</option> below.
40786 </para>
40787 <para>
40788 <indexterm role="option">
40789 <primary><option>shadow_transport</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>shadow_transport</option></entry>
40801 <entry>Use: <emphasis>transports</emphasis></entry>
40802 <entry>Type: <emphasis>string</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>shadow transport</primary>
40811 </indexterm>
40812 <indexterm role="concept">
40813 <primary>transport</primary>
40814 <secondary>shadow</secondary>
40815 </indexterm>
40816 A local transport may set the <option>shadow_transport</option> option to the name of
40817 another local transport. Shadow remote transports are not supported.
40818 </para>
40819 <para>
40820 Whenever a delivery to the main transport succeeds, and either
40821 <option>shadow_condition</option> is unset, or its expansion does not result in the empty
40822 string or one of the strings <quote>0</quote> or <quote>no</quote> or <quote>false</quote>, the message is also
40823 passed to the shadow transport, with the same delivery address or addresses. If
40824 expansion fails, no action is taken except that non-forced expansion failures
40825 cause a log line to be written.
40826 </para>
40827 <para>
40828 The result of the shadow transport is discarded and does not affect the
40829 subsequent processing of the message. Only a single level of shadowing is
40830 provided; the <option>shadow_transport</option> option is ignored on any transport when it
40831 is running as a shadow. Options concerned with output from pipes are also
40832 ignored. The log line for the successful delivery has an item added on the end,
40833 of the form
40834 </para>
40835 <literallayout class="monospaced">
40836 ST=&lt;shadow transport name&gt;
40837 </literallayout>
40838 <para>
40839 If the shadow transport did not succeed, the error message is put in
40840 parentheses afterwards. Shadow transports can be used for a number of different
40841 purposes, including keeping more detailed log information than Exim normally
40842 provides, and implementing automatic acknowledgment policies based on message
40843 headers that some sites insist on.
40844 </para>
40845 <para>
40846 <indexterm role="option">
40847 <primary><option>transport_filter</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>transport_filter</option></entry>
40859 <entry>Use: <emphasis>transports</emphasis></entry>
40860 <entry>Type: <emphasis>string</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>transport</primary>
40869 <secondary>filter</secondary>
40870 </indexterm>
40871 <indexterm role="concept">
40872 <primary>filter</primary>
40873 <secondary>transport filter</secondary>
40874 </indexterm>
40875 This option sets up a filtering (in the Unix shell sense) process for messages
40876 at transport time. It should not be confused with mail filtering as set up by
40877 individual users or via a system filter.
40878 If unset, or expanding to an empty string, no filtering is done.
40879 </para>
40880 <para>
40881 When the message is about to be written out, the command specified by
40882 <option>transport_filter</option> is started up in a separate, parallel process, and
40883 the entire message, including the header lines, is passed to it on its standard
40884 input (this in fact is done from a third process, to avoid deadlock). The
40885 command must be specified as an absolute path.
40886 </para>
40887 <para>
40888 The lines of the message that are written to the transport filter are
40889 terminated by newline (<quote>\n</quote>). The message is passed to the filter before any
40890 SMTP-specific processing, such as turning <quote>\n</quote> into <quote>\r\n</quote> and escaping
40891 lines beginning with a dot, and also before any processing implied by the
40892 settings of <option>check_string</option> and <option>escape_string</option> in the <command>appendfile</command> or
40893 <command>pipe</command> transports.
40894 </para>
40895 <para>
40896 The standard error for the filter process is set to the same destination as its
40897 standard output; this is read and written to the message&#x2019;s ultimate
40898 destination. The process that writes the message to the filter, the
40899 filter itself, and the original process that reads the result and delivers it
40900 are all run in parallel, like a shell pipeline.
40901 </para>
40902 <para>
40903 The filter can perform any transformations it likes, but of course should take
40904 care not to break RFC 2822 syntax. Exim does not check the result, except to
40905 test for a final newline when SMTP is in use. All messages transmitted over
40906 SMTP must end with a newline, so Exim supplies one if it is missing.
40907 </para>
40908 <para>
40909 <indexterm role="concept">
40910 <primary>content scanning</primary>
40911 <secondary>per user</secondary>
40912 </indexterm>
40913 A transport filter can be used to provide content-scanning on a per-user basis
40914 at delivery time if the only required effect of the scan is to modify the
40915 message. For example, a content scan could insert a new header line containing
40916 a spam score. This could be interpreted by a filter in the user&#x2019;s MUA. It is
40917 not possible to discard a message at this stage.
40918 </para>
40919 <para>
40920 <indexterm role="concept">
40921 <primary>SMTP</primary>
40922 <secondary>SIZE</secondary>
40923 </indexterm>
40924 A problem might arise if the filter increases the size of a message that is
40925 being sent down an SMTP connection. If the receiving SMTP server has indicated
40926 support for the SIZE parameter, Exim will have sent the size of the message
40927 at the start of the SMTP session. If what is actually sent is substantially
40928 more, the server might reject the message. This can be worked round by setting
40929 the <option>size_addition</option> option on the <command>smtp</command> transport, either to allow for
40930 additions to the message, or to disable the use of SIZE altogether.
40931 </para>
40932 <para>
40933 <indexterm role="variable">
40934 <primary><varname>$pipe_addresses</varname></primary>
40935 </indexterm>
40936 The value of the <option>transport_filter</option> option is the command string for starting
40937 the filter, which is run directly from Exim, not under a shell. The string is
40938 parsed by Exim in the same way as a command string for the <command>pipe</command> transport:
40939 Exim breaks it up into arguments and then expands each argument separately (see
40940 section <xref linkend="SECThowcommandrun"/>). Any kind of expansion failure causes delivery
40941 to be deferred. The special argument <varname>$pipe_addresses</varname> is replaced by a number
40942 of arguments, one for each address that applies to this delivery. (This isn&#x2019;t
40943 an ideal name for this feature here, but as it was already implemented for the
40944 <command>pipe</command> transport, it seemed sensible not to change it.)
40945 </para>
40946 <para>
40947 <indexterm role="variable">
40948 <primary><varname>$host</varname></primary>
40949 </indexterm>
40950 <indexterm role="variable">
40951 <primary><varname>$host_address</varname></primary>
40952 </indexterm>
40953 The expansion variables <varname>$host</varname> and <varname>$host_address</varname> are available when the
40954 transport is a remote one. They contain the name and IP address of the host to
40955 which the message is being sent. For example:
40956 </para>
40957 <literallayout class="monospaced">
40958 transport_filter = /some/directory/transport-filter.pl \
40959   $host $host_address $sender_address $pipe_addresses
40960 </literallayout>
40961 <para>
40962 Two problems arise if you want to use more complicated expansion items to
40963 generate transport filter commands, both of which due to the fact that the
40964 command is split up <emphasis>before</emphasis> expansion.
40965 </para>
40966 <itemizedlist>
40967 <listitem>
40968 <para>
40969 If an expansion item contains white space, you must quote it, so that it is all
40970 part of the same command item. If the entire option setting is one such
40971 expansion item, you have to take care what kind of quoting you use. For
40972 example:
40973 </para>
40974 <literallayout class="monospaced">
40975 transport_filter = '/bin/cmd${if eq{$host}{a.b.c}{1}{2}}'
40976 </literallayout>
40977 <para>
40978 This runs the command <command>/bin/cmd1</command> if the host name is <emphasis>a.b.c</emphasis>, and
40979 <command>/bin/cmd2</command> otherwise. If double quotes had been used, they would have been
40980 stripped by Exim when it read the option&#x2019;s value. When the value is used, if
40981 the single quotes were missing, the line would be split into two items,
40982 <literal>/bin/cmd${if</literal> and <literal>eq{$host}{a.b.c}{1}{2}</literal>, and an error would occur when
40983 Exim tried to expand the first one.
40984 </para>
40985 </listitem>
40986 <listitem>
40987 <para>
40988 Except for the special case of <varname>$pipe_addresses</varname> that is mentioned above, an
40989 expansion cannot generate multiple arguments, or a command name followed by
40990 arguments. Consider this example:
40991 </para>
40992 <literallayout class="monospaced">
40993 transport_filter = ${lookup{$host}lsearch{/a/file}\
40994                     {$value}{/bin/cat}}
40995 </literallayout>
40996 <para>
40997 The result of the lookup is interpreted as the name of the command, even
40998 if it contains white space. The simplest way round this is to use a shell:
40999 </para>
41000 <literallayout class="monospaced">
41001 transport_filter = /bin/sh -c ${lookup{$host}lsearch{/a/file}\
41002                                {$value}{/bin/cat}}
41003 </literallayout>
41004 </listitem>
41005 </itemizedlist>
41006 <para>
41007 The filter process is run under the same uid and gid as the normal delivery.
41008 For remote deliveries this is the Exim uid/gid by default. The command should
41009 normally yield a zero return code. Transport filters are not supposed to fail.
41010 A non-zero code is taken to mean that the transport filter encountered some
41011 serious problem. Delivery of the message is deferred; the message remains on
41012 the queue and is tried again later. It is not possible to cause a message to be
41013 bounced from a transport filter.
41014 </para>
41015 <para>
41016 If a transport filter is set on an autoreply transport, the original message is
41017 passed through the filter as it is being copied into the newly generated
41018 message, which happens if the <option>return_message</option> option is set.
41019 </para>
41020 <para>
41021 <indexterm role="option">
41022 <primary><option>transport_filter_timeout</option></primary>
41023 </indexterm>
41024 </para>
41025 <informaltable frame="all">
41026 <tgroup cols="4" colsep="0" rowsep="0">
41027 <colspec colwidth="8*" align="left"/>
41028 <colspec colwidth="6*" align="center"/>
41029 <colspec colwidth="6*" align="center"/>
41030 <colspec colwidth="6*" align="right"/>
41031 <tbody>
41032 <row>
41033 <entry><option>transport_filter_timeout</option></entry>
41034 <entry>Use: <emphasis>transports</emphasis></entry>
41035 <entry>Type: <emphasis>time</emphasis></entry>
41036 <entry>Default: <emphasis>5m</emphasis></entry>
41037 </row>
41038 </tbody>
41039 </tgroup>
41040 </informaltable>
41041 <para>
41042 <indexterm role="concept">
41043 <primary>transport</primary>
41044 <secondary>filter, timeout</secondary>
41045 </indexterm>
41046 When Exim is reading the output of a transport filter, it applies a timeout
41047 that can be set by this option. Exceeding the timeout is normally treated as a
41048 temporary delivery failure. However, if a transport filter is used with a
41049 <command>pipe</command> transport, a timeout in the transport filter is treated in the same
41050 way as a timeout in the pipe command itself. By default, a timeout is a hard
41051 error, but if the <command>pipe</command> transport&#x2019;s <option>timeout_defer</option> option is set true, it
41052 becomes a temporary error.
41053 </para>
41054 <para>
41055 <indexterm role="option">
41056 <primary><option>user</option></primary>
41057 </indexterm>
41058 </para>
41059 <informaltable frame="all">
41060 <tgroup cols="4" colsep="0" rowsep="0">
41061 <colspec colwidth="8*" align="left"/>
41062 <colspec colwidth="6*" align="center"/>
41063 <colspec colwidth="6*" align="center"/>
41064 <colspec colwidth="6*" align="right"/>
41065 <tbody>
41066 <row>
41067 <entry><option>user</option></entry>
41068 <entry>Use: <emphasis>transports</emphasis></entry>
41069 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41070 <entry>Default: <emphasis>Exim user</emphasis></entry>
41071 </row>
41072 </tbody>
41073 </tgroup>
41074 </informaltable>
41075 <para>
41076 <indexterm role="concept">
41077 <primary>uid (user id)</primary>
41078 <secondary>local delivery</secondary>
41079 </indexterm>
41080 <indexterm role="concept">
41081 <primary>transport</primary>
41082 <secondary>user, specifying</secondary>
41083 </indexterm>
41084 This option specifies the user under whose uid the delivery process is to be
41085 run, overriding any uid that may have been set by the router. If the user is
41086 given as a name, the uid is looked up from the password data, and the
41087 associated group is taken as the value of the gid to be used if the <option>group</option>
41088 option is not set.
41089 </para>
41090 <para>
41091 For deliveries that use local transports, a user and group are normally
41092 specified explicitly or implicitly (for example, as a result of
41093 <option>check_local_user</option>) by the router or transport.
41094 </para>
41095 <para>
41096 <indexterm role="concept">
41097 <primary>hints database</primary>
41098 <secondary>access by remote transport</secondary>
41099 </indexterm>
41100 For remote transports, you should leave this option unset unless you really are
41101 sure you know what you are doing. When a remote transport is running, it needs
41102 to be able to access Exim&#x2019;s hints databases, because each host may have its own
41103 retry data.
41104 <indexterm role="concept" startref="IIDgenoptra1" class="endofrange"/>
41105 <indexterm role="concept" startref="IIDgenoptra2" class="endofrange"/>
41106 <indexterm role="concept" startref="IIDgenoptra3" class="endofrange"/>
41107 </para>
41108 </chapter>
41109
41110 <chapter id="CHAPbatching">
41111 <title>Address batching in local transports</title>
41112 <titleabbrev>Address batching</titleabbrev>
41113 <para>
41114 <indexterm role="concept">
41115 <primary>transport</primary>
41116 <secondary>local; address batching in</secondary>
41117 </indexterm>
41118 The only remote transport (<command>smtp</command>) is normally configured to handle more than
41119 one address at a time, so that when several addresses are routed to the same
41120 remote host, just one copy of the message is sent. Local transports, however,
41121 normally handle one address at a time. That is, a separate instance of the
41122 transport is run for each address that is routed to the transport. A separate
41123 copy of the message is delivered each time.
41124 </para>
41125 <para>
41126 <indexterm role="concept">
41127 <primary>batched local delivery</primary>
41128 </indexterm>
41129 <indexterm role="option">
41130 <primary><option>batch_max</option></primary>
41131 </indexterm>
41132 <indexterm role="option">
41133 <primary><option>batch_id</option></primary>
41134 </indexterm>
41135 In special cases, it may be desirable to handle several addresses at once in a
41136 local transport, for example:
41137 </para>
41138 <itemizedlist>
41139 <listitem>
41140 <para>
41141 In an <command>appendfile</command> transport, when storing messages in files for later
41142 delivery by some other means, a single copy of the message with multiple
41143 recipients saves space.
41144 </para>
41145 </listitem>
41146 <listitem>
41147 <para>
41148 In an <command>lmtp</command> transport, when delivering over <quote>local SMTP</quote> to some process,
41149 a single copy saves time, and is the normal way LMTP is expected to work.
41150 </para>
41151 </listitem>
41152 <listitem>
41153 <para>
41154 In a <command>pipe</command> transport, when passing the message
41155 to a scanner program or
41156 to some other delivery mechanism such as UUCP, multiple recipients may be
41157 acceptable.
41158 </para>
41159 </listitem>
41160 </itemizedlist>
41161 <para>
41162 These three local transports all have the same options for controlling multiple
41163 (<quote>batched</quote>) deliveries, namely <option>batch_max</option> and <option>batch_id</option>. To save
41164 repeating the information for each transport, these options are described here.
41165 </para>
41166 <para>
41167 The <option>batch_max</option> option specifies the maximum number of addresses that can be
41168 delivered together in a single run of the transport. Its default value is one
41169 (no batching). When more than one address is routed to a transport that has a
41170 <option>batch_max</option> value greater than one, the addresses are delivered in a batch
41171 (that is, in a single run of the transport with multiple recipients), subject
41172 to certain conditions:
41173 </para>
41174 <itemizedlist>
41175 <listitem>
41176 <para>
41177 <indexterm role="variable">
41178 <primary><varname>$local_part</varname></primary>
41179 </indexterm>
41180 If any of the transport&#x2019;s options contain a reference to <varname>$local_part</varname>, no
41181 batching is possible.
41182 </para>
41183 </listitem>
41184 <listitem>
41185 <para>
41186 <indexterm role="variable">
41187 <primary><varname>$domain</varname></primary>
41188 </indexterm>
41189 If any of the transport&#x2019;s options contain a reference to <varname>$domain</varname>, only
41190 addresses with the same domain are batched.
41191 </para>
41192 </listitem>
41193 <listitem>
41194 <para>
41195 <indexterm role="concept">
41196 <primary>customizing</primary>
41197 <secondary>batching condition</secondary>
41198 </indexterm>
41199 If <option>batch_id</option> is set, it is expanded for each address, and only those
41200 addresses with the same expanded value are batched. This allows you to specify
41201 customized batching conditions. Failure of the expansion for any reason,
41202 including forced failure, disables batching, but it does not stop the delivery
41203 from taking place.
41204 </para>
41205 </listitem>
41206 <listitem>
41207 <para>
41208 Batched addresses must also have the same errors address (where to send
41209 delivery errors), the same header additions and removals, the same user and
41210 group for the transport, and if a host list is present, the first host must
41211 be the same.
41212 </para>
41213 </listitem>
41214 </itemizedlist>
41215 <para>
41216 In the case of the <command>appendfile</command> and <command>pipe</command> transports, batching applies
41217 both when the file or pipe command is specified in the transport, and when it
41218 is specified by a <command>redirect</command> router, but all the batched addresses must of
41219 course be routed to the same file or pipe command. These two transports have an
41220 option called <option>use_bsmtp</option>, which causes them to deliver the message in
41221 <quote>batched SMTP</quote> format, with the envelope represented as SMTP commands. The
41222 <option>check_string</option> and <option>escape_string</option> options are forced to the values
41223 </para>
41224 <literallayout class="monospaced">
41225 check_string = "."
41226 escape_string = ".."
41227 </literallayout>
41228 <para>
41229 when batched SMTP is in use. A full description of the batch SMTP mechanism is
41230 given in section <xref linkend="SECTbatchSMTP"/>. The <command>lmtp</command> transport does not have a
41231 <option>use_bsmtp</option> option, because it always delivers using the SMTP protocol.
41232 </para>
41233 <para>
41234 <indexterm role="concept">
41235 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
41236 </indexterm>
41237 If the generic <option>envelope_to_add</option> option is set for a batching transport, the
41238 <emphasis>Envelope-to:</emphasis> header that is added to the message contains all the addresses
41239 that are being processed together. If you are using a batching <command>appendfile</command>
41240 transport without <option>use_bsmtp</option>, the only way to preserve the recipient
41241 addresses is to set the <option>envelope_to_add</option> option.
41242 </para>
41243 <para>
41244 <indexterm role="concept">
41245 <primary><command>pipe</command> transport</primary>
41246 <secondary>with multiple addresses</secondary>
41247 </indexterm>
41248 <indexterm role="variable">
41249 <primary><varname>$pipe_addresses</varname></primary>
41250 </indexterm>
41251 If you are using a <command>pipe</command> transport without BSMTP, and setting the
41252 transport&#x2019;s <option>command</option> option, you can include <varname>$pipe_addresses</varname> as part of
41253 the command. This is not a true variable; it is a bit of magic that causes each
41254 of the recipient addresses to be inserted into the command as a separate
41255 argument. This provides a way of accessing all the addresses that are being
41256 delivered in the batch. <emphasis role="bold">Note:</emphasis> This is not possible for pipe commands that
41257 are specified by a <command>redirect</command> router.
41258 </para>
41259 </chapter>
41260
41261 <chapter id="CHAPappendfile">
41262 <title>The appendfile transport</title>
41263 <para>
41264 <indexterm role="concept" id="IIDapptra1" class="startofrange">
41265 <primary><command>appendfile</command> transport</primary>
41266 </indexterm>
41267 <indexterm role="concept" id="IIDapptra2" class="startofrange">
41268 <primary>transports</primary>
41269 <secondary><command>appendfile</command></secondary>
41270 </indexterm>
41271 <indexterm role="concept">
41272 <primary>directory creation</primary>
41273 </indexterm>
41274 <indexterm role="concept">
41275 <primary>creating directories</primary>
41276 </indexterm>
41277 The <command>appendfile</command> transport delivers a message by appending it to an existing
41278 file, or by creating an entirely new file in a specified directory. Single
41279 files to which messages are appended can be in the traditional Unix mailbox
41280 format, or optionally in the MBX format supported by the Pine MUA and
41281 University of Washington IMAP daemon, <emphasis>inter alia</emphasis>. When each message is
41282 being delivered as a separate file, <quote>maildir</quote> format can optionally be used
41283 to give added protection against failures that happen part-way through the
41284 delivery. A third form of separate-file delivery known as <quote>mailstore</quote> is also
41285 supported. For all file formats, Exim attempts to create as many levels of
41286 directory as necessary, provided that <option>create_directory</option> is set.
41287 </para>
41288 <para>
41289 The code for the optional formats is not included in the Exim binary by
41290 default. It is necessary to set SUPPORT_MBX, SUPPORT_MAILDIR and/or
41291 SUPPORT_MAILSTORE in <filename>Local/Makefile</filename> to have the appropriate code
41292 included.
41293 </para>
41294 <para>
41295 <indexterm role="concept">
41296 <primary>quota</primary>
41297 <secondary>system</secondary>
41298 </indexterm>
41299 Exim recognizes system quota errors, and generates an appropriate message. Exim
41300 also supports its own quota control within the transport, for use when the
41301 system facility is unavailable or cannot be used for some reason.
41302 </para>
41303 <para>
41304 If there is an error while appending to a file (for example, quota exceeded or
41305 partition filled), Exim attempts to reset the file&#x2019;s length and last
41306 modification time back to what they were before. If there is an error while
41307 creating an entirely new file, the new file is removed.
41308 </para>
41309 <para>
41310 Before appending to a file, a number of security checks are made, and the
41311 file is locked. A detailed description is given below, after the list of
41312 private options.
41313 </para>
41314 <para>
41315 The <command>appendfile</command> transport is most commonly used for local deliveries to
41316 users&#x2019; mailboxes. However, it can also be used as a pseudo-remote transport for
41317 putting messages into files for remote delivery by some means other than Exim.
41318 <quote>Batch SMTP</quote> format is often used in this case (see the <option>use_bsmtp</option>
41319 option).
41320 </para>
41321 <section id="SECTfildiropt">
41322 <title>The file and directory options</title>
41323 <para>
41324 The <option>file</option> option specifies a single file, to which the message is appended;
41325 the <option>directory</option> option specifies a directory, in which a new file containing
41326 the message is created. Only one of these two options can be set, and for
41327 normal deliveries to mailboxes, one of them <emphasis>must</emphasis> be set.
41328 </para>
41329 <para>
41330 <indexterm role="variable">
41331 <primary><varname>$address_file</varname></primary>
41332 </indexterm>
41333 <indexterm role="variable">
41334 <primary><varname>$local_part</varname></primary>
41335 </indexterm>
41336 However, <command>appendfile</command> is also used for delivering messages to files or
41337 directories whose names (or parts of names) are obtained from alias,
41338 forwarding, or filtering operations (for example, a <option>save</option> command in a
41339 user&#x2019;s Exim filter). When such a transport is running, <varname>$local_part</varname> contains
41340 the local part that was aliased or forwarded, and <varname>$address_file</varname> contains the
41341 name (or partial name) of the file or directory generated by the redirection
41342 operation. There are two cases:
41343 </para>
41344 <itemizedlist>
41345 <listitem>
41346 <para>
41347 If neither <option>file</option> nor <option>directory</option> is set, the redirection operation
41348 must specify an absolute path (one that begins with <literal>/</literal>). This is the most
41349 common case when users with local accounts use filtering to sort mail into
41350 different folders. See for example, the <command>address_file</command> transport in the
41351 default configuration. If the path ends with a slash, it is assumed to be the
41352 name of a directory. A delivery to a directory can also be forced by setting
41353 <option>maildir_format</option> or <option>mailstore_format</option>.
41354 </para>
41355 </listitem>
41356 <listitem>
41357 <para>
41358 If <option>file</option> or <option>directory</option> is set for a delivery from a redirection, it is
41359 used to determine the file or directory name for the delivery. Normally, the
41360 contents of <varname>$address_file</varname> are used in some way in the string expansion.
41361 </para>
41362 </listitem>
41363 </itemizedlist>
41364 <para>
41365 <indexterm role="concept">
41366 <primary>Sieve filter</primary>
41367 <secondary>configuring <command>appendfile</command></secondary>
41368 </indexterm>
41369 <indexterm role="concept">
41370 <primary>Sieve filter</primary>
41371 <secondary>relative mailbox path handling</secondary>
41372 </indexterm>
41373 As an example of the second case, consider an environment where users do not
41374 have home directories. They may be permitted to use Exim filter commands of the
41375 form:
41376 </para>
41377 <literallayout class="monospaced">
41378 save folder23
41379 </literallayout>
41380 <para>
41381 or Sieve filter commands of the form:
41382 </para>
41383 <literallayout class="monospaced">
41384 require "fileinto";
41385 fileinto "folder23";
41386 </literallayout>
41387 <para>
41388 In this situation, the expansion of <option>file</option> or <option>directory</option> in the transport
41389 must transform the relative path into an appropriate absolute file name. In the
41390 case of Sieve filters, the name <emphasis>inbox</emphasis> must be handled. It is the name that
41391 is used as a result of a <quote>keep</quote> action in the filter. This example shows one
41392 way of handling this requirement:
41393 </para>
41394 <literallayout class="monospaced">
41395 file = ${if eq{$address_file}{inbox} \
41396             {/var/mail/$local_part} \
41397             {${if eq{${substr_0_1:$address_file}}{/} \
41398                   {$address_file} \
41399                   {$home/mail/$address_file} \
41400             }} \
41401        }
41402 </literallayout>
41403 <para>
41404 With this setting of <option>file</option>, <emphasis>inbox</emphasis> refers to the standard mailbox
41405 location, absolute paths are used without change, and other folders are in the
41406 <filename>mail</filename> directory within the home directory.
41407 </para>
41408 <para>
41409 <emphasis role="bold">Note 1</emphasis>: While processing an Exim filter, a relative path such as
41410 <filename>folder23</filename> is turned into an absolute path if a home directory is known to
41411 the router. In particular, this is the case if <option>check_local_user</option> is set. If
41412 you want to prevent this happening at routing time, you can set
41413 <option>router_home_directory</option> empty. This forces the router to pass the relative
41414 path to the transport.
41415 </para>
41416 <para>
41417 <emphasis role="bold">Note 2</emphasis>: An absolute path in <varname>$address_file</varname> is not treated specially;
41418 the <option>file</option> or <option>directory</option> option is still used if it is set.
41419 </para>
41420 </section>
41421 <section id="SECID134">
41422 <title>Private options for appendfile</title>
41423 <para>
41424 <indexterm role="concept">
41425 <primary>options</primary>
41426 <secondary><command>appendfile</command> transport</secondary>
41427 </indexterm>
41428 </para>
41429 <para>
41430 <indexterm role="option">
41431 <primary><option>allow_fifo</option></primary>
41432 </indexterm>
41433 </para>
41434 <informaltable frame="all">
41435 <tgroup cols="4" colsep="0" rowsep="0">
41436 <colspec colwidth="8*" align="left"/>
41437 <colspec colwidth="6*" align="center"/>
41438 <colspec colwidth="6*" align="center"/>
41439 <colspec colwidth="6*" align="right"/>
41440 <tbody>
41441 <row>
41442 <entry><option>allow_fifo</option></entry>
41443 <entry>Use: <emphasis>appendfile</emphasis></entry>
41444 <entry>Type: <emphasis>boolean</emphasis></entry>
41445 <entry>Default: <emphasis>false</emphasis></entry>
41446 </row>
41447 </tbody>
41448 </tgroup>
41449 </informaltable>
41450 <para>
41451 <indexterm role="concept">
41452 <primary>fifo (named pipe)</primary>
41453 </indexterm>
41454 <indexterm role="concept">
41455 <primary>named pipe (fifo)</primary>
41456 </indexterm>
41457 <indexterm role="concept">
41458 <primary>pipe</primary>
41459 <secondary>named (fifo)</secondary>
41460 </indexterm>
41461 Setting this option permits delivery to named pipes (FIFOs) as well as to
41462 regular files. If no process is reading the named pipe at delivery time, the
41463 delivery is deferred.
41464 </para>
41465 <para>
41466 <indexterm role="option">
41467 <primary><option>allow_symlink</option></primary>
41468 </indexterm>
41469 </para>
41470 <informaltable frame="all">
41471 <tgroup cols="4" colsep="0" rowsep="0">
41472 <colspec colwidth="8*" align="left"/>
41473 <colspec colwidth="6*" align="center"/>
41474 <colspec colwidth="6*" align="center"/>
41475 <colspec colwidth="6*" align="right"/>
41476 <tbody>
41477 <row>
41478 <entry><option>allow_symlink</option></entry>
41479 <entry>Use: <emphasis>appendfile</emphasis></entry>
41480 <entry>Type: <emphasis>boolean</emphasis></entry>
41481 <entry>Default: <emphasis>false</emphasis></entry>
41482 </row>
41483 </tbody>
41484 </tgroup>
41485 </informaltable>
41486 <para>
41487 <indexterm role="concept">
41488 <primary>symbolic link</primary>
41489 <secondary>to mailbox</secondary>
41490 </indexterm>
41491 <indexterm role="concept">
41492 <primary>mailbox</primary>
41493 <secondary>symbolic link</secondary>
41494 </indexterm>
41495 By default, <command>appendfile</command> will not deliver if the path name for the file is
41496 that of a symbolic link. Setting this option relaxes that constraint, but there
41497 are security issues involved in the use of symbolic links. Be sure you know
41498 what you are doing if you set this. Details of exactly what this option affects
41499 are included in the discussion which follows this list of options.
41500 </para>
41501 <para>
41502 <indexterm role="option">
41503 <primary><option>batch_id</option></primary>
41504 </indexterm>
41505 </para>
41506 <informaltable frame="all">
41507 <tgroup cols="4" colsep="0" rowsep="0">
41508 <colspec colwidth="8*" align="left"/>
41509 <colspec colwidth="6*" align="center"/>
41510 <colspec colwidth="6*" align="center"/>
41511 <colspec colwidth="6*" align="right"/>
41512 <tbody>
41513 <row>
41514 <entry><option>batch_id</option></entry>
41515 <entry>Use: <emphasis>appendfile</emphasis></entry>
41516 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41517 <entry>Default: <emphasis>unset</emphasis></entry>
41518 </row>
41519 </tbody>
41520 </tgroup>
41521 </informaltable>
41522 <para>
41523 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
41524 However, batching is automatically disabled for <command>appendfile</command> deliveries that
41525 happen as a result of forwarding or aliasing or other redirection directly to a
41526 file.
41527 </para>
41528 <para>
41529 <indexterm role="option">
41530 <primary><option>batch_max</option></primary>
41531 </indexterm>
41532 </para>
41533 <informaltable frame="all">
41534 <tgroup cols="4" colsep="0" rowsep="0">
41535 <colspec colwidth="8*" align="left"/>
41536 <colspec colwidth="6*" align="center"/>
41537 <colspec colwidth="6*" align="center"/>
41538 <colspec colwidth="6*" align="right"/>
41539 <tbody>
41540 <row>
41541 <entry><option>batch_max</option></entry>
41542 <entry>Use: <emphasis>appendfile</emphasis></entry>
41543 <entry>Type: <emphasis>integer</emphasis></entry>
41544 <entry>Default: <emphasis>1</emphasis></entry>
41545 </row>
41546 </tbody>
41547 </tgroup>
41548 </informaltable>
41549 <para>
41550 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
41551 </para>
41552 <para>
41553 <indexterm role="option">
41554 <primary><option>check_group</option></primary>
41555 </indexterm>
41556 </para>
41557 <informaltable frame="all">
41558 <tgroup cols="4" colsep="0" rowsep="0">
41559 <colspec colwidth="8*" align="left"/>
41560 <colspec colwidth="6*" align="center"/>
41561 <colspec colwidth="6*" align="center"/>
41562 <colspec colwidth="6*" align="right"/>
41563 <tbody>
41564 <row>
41565 <entry><option>check_group</option></entry>
41566 <entry>Use: <emphasis>appendfile</emphasis></entry>
41567 <entry>Type: <emphasis>boolean</emphasis></entry>
41568 <entry>Default: <emphasis>false</emphasis></entry>
41569 </row>
41570 </tbody>
41571 </tgroup>
41572 </informaltable>
41573 <para>
41574 When this option is set, the group owner of the file defined by the <option>file</option>
41575 option is checked to see that it is the same as the group under which the
41576 delivery process is running. The default setting is false because the default
41577 file mode is 0600, which means that the group is irrelevant.
41578 </para>
41579 <para>
41580 <indexterm role="option">
41581 <primary><option>check_owner</option></primary>
41582 </indexterm>
41583 </para>
41584 <informaltable frame="all">
41585 <tgroup cols="4" colsep="0" rowsep="0">
41586 <colspec colwidth="8*" align="left"/>
41587 <colspec colwidth="6*" align="center"/>
41588 <colspec colwidth="6*" align="center"/>
41589 <colspec colwidth="6*" align="right"/>
41590 <tbody>
41591 <row>
41592 <entry><option>check_owner</option></entry>
41593 <entry>Use: <emphasis>appendfile</emphasis></entry>
41594 <entry>Type: <emphasis>boolean</emphasis></entry>
41595 <entry>Default: <emphasis>true</emphasis></entry>
41596 </row>
41597 </tbody>
41598 </tgroup>
41599 </informaltable>
41600 <para>
41601 When this option is set, the owner of the file defined by the <option>file</option> option
41602 is checked to ensure that it is the same as the user under which the delivery
41603 process is running.
41604 </para>
41605 <para>
41606 <indexterm role="option">
41607 <primary><option>check_string</option></primary>
41608 </indexterm>
41609 </para>
41610 <informaltable frame="all">
41611 <tgroup cols="4" colsep="0" rowsep="0">
41612 <colspec colwidth="8*" align="left"/>
41613 <colspec colwidth="6*" align="center"/>
41614 <colspec colwidth="6*" align="center"/>
41615 <colspec colwidth="6*" align="right"/>
41616 <tbody>
41617 <row>
41618 <entry><option>check_string</option></entry>
41619 <entry>Use: <emphasis>appendfile</emphasis></entry>
41620 <entry>Type: <emphasis>string</emphasis></entry>
41621 <entry>Default: <emphasis>see below</emphasis></entry>
41622 </row>
41623 </tbody>
41624 </tgroup>
41625 </informaltable>
41626 <para>
41627 <indexterm role="concept">
41628 <primary><quote>From</quote> line</primary>
41629 </indexterm>
41630 As <command>appendfile</command> writes the message, the start of each line is tested for
41631 matching <option>check_string</option>, and if it does, the initial matching characters are
41632 replaced by the contents of <option>escape_string</option>. The value of <option>check_string</option> is
41633 a literal string, not a regular expression, and the case of any letters it
41634 contains is significant.
41635 </para>
41636 <para>
41637 If <option>use_bsmtp</option> is set the values of <option>check_string</option> and <option>escape_string</option>
41638 are forced to <quote>.</quote> and <quote>..</quote> respectively, and any settings in the
41639 configuration are ignored. Otherwise, they default to <quote>From&nbsp;</quote> and
41640 <quote>&gt;From&nbsp;</quote> when the <option>file</option> option is set, and unset when any of the
41641 <option>directory</option>, <option>maildir</option>, or <option>mailstore</option> options are set.
41642 </para>
41643 <para>
41644 The default settings, along with <option>message_prefix</option> and <option>message_suffix</option>, are
41645 suitable for traditional <quote>BSD</quote> mailboxes, where a line beginning with
41646 <quote>From&nbsp;</quote> indicates the start of a new message. All four options need changing
41647 if another format is used. For example, to deliver to mailboxes in MMDF format:
41648 <indexterm role="concept">
41649 <primary>MMDF format mailbox</primary>
41650 </indexterm>
41651 <indexterm role="concept">
41652 <primary>mailbox</primary>
41653 <secondary>MMDF format</secondary>
41654 </indexterm>
41655 </para>
41656 <literallayout class="monospaced">
41657 check_string = "\1\1\1\1\n"
41658 escape_string = "\1\1\1\1 \n"
41659 message_prefix = "\1\1\1\1\n"
41660 message_suffix = "\1\1\1\1\n"
41661 </literallayout>
41662 <para>
41663 <indexterm role="option">
41664 <primary><option>create_directory</option></primary>
41665 </indexterm>
41666 </para>
41667 <informaltable frame="all">
41668 <tgroup cols="4" colsep="0" rowsep="0">
41669 <colspec colwidth="8*" align="left"/>
41670 <colspec colwidth="6*" align="center"/>
41671 <colspec colwidth="6*" align="center"/>
41672 <colspec colwidth="6*" align="right"/>
41673 <tbody>
41674 <row>
41675 <entry><option>create_directory</option></entry>
41676 <entry>Use: <emphasis>appendfile</emphasis></entry>
41677 <entry>Type: <emphasis>boolean</emphasis></entry>
41678 <entry>Default: <emphasis>true</emphasis></entry>
41679 </row>
41680 </tbody>
41681 </tgroup>
41682 </informaltable>
41683 <para>
41684 <indexterm role="concept">
41685 <primary>directory creation</primary>
41686 </indexterm>
41687 When this option is true, Exim attempts to create any missing superior
41688 directories for the file that it is about to write. A created directory&#x2019;s mode
41689 is given by the <option>directory_mode</option> option.
41690 </para>
41691 <para>
41692 The group ownership of a newly created directory is highly dependent on the
41693 operating system (and possibly the file system) that is being used. For
41694 example, in Solaris, if the parent directory has the setgid bit set, its group
41695 is propagated to the child; if not, the currently set group is used. However,
41696 in FreeBSD, the parent&#x2019;s group is always used.
41697 </para>
41698 <para>
41699 <indexterm role="option">
41700 <primary><option>create_file</option></primary>
41701 </indexterm>
41702 </para>
41703 <informaltable frame="all">
41704 <tgroup cols="4" colsep="0" rowsep="0">
41705 <colspec colwidth="8*" align="left"/>
41706 <colspec colwidth="6*" align="center"/>
41707 <colspec colwidth="6*" align="center"/>
41708 <colspec colwidth="6*" align="right"/>
41709 <tbody>
41710 <row>
41711 <entry><option>create_file</option></entry>
41712 <entry>Use: <emphasis>appendfile</emphasis></entry>
41713 <entry>Type: <emphasis>string</emphasis></entry>
41714 <entry>Default: <emphasis>anywhere</emphasis></entry>
41715 </row>
41716 </tbody>
41717 </tgroup>
41718 </informaltable>
41719 <para>
41720 This option constrains the location of files and directories that are created
41721 by this transport. It applies to files defined by the <option>file</option> option and
41722 directories defined by the <option>directory</option> option. In the case of maildir
41723 delivery, it applies to the top level directory, not the maildir directories
41724 beneath.
41725 </para>
41726 <para>
41727 The option must be set to one of the words <quote>anywhere</quote>, <quote>inhome</quote>, or
41728 <quote>belowhome</quote>. In the second and third cases, a home directory must have been
41729 set for the transport. This option is not useful when an explicit file name is
41730 given for normal mailbox deliveries. It is intended for the case when file
41731 names are generated from users&#x2019; <filename>.forward</filename> files. These are usually handled
41732 by an <command>appendfile</command> transport called <option>address_file</option>. See also
41733 <option>file_must_exist</option>.
41734 </para>
41735 <para>
41736 <indexterm role="option">
41737 <primary><option>directory</option></primary>
41738 </indexterm>
41739 </para>
41740 <informaltable frame="all">
41741 <tgroup cols="4" colsep="0" rowsep="0">
41742 <colspec colwidth="8*" align="left"/>
41743 <colspec colwidth="6*" align="center"/>
41744 <colspec colwidth="6*" align="center"/>
41745 <colspec colwidth="6*" align="right"/>
41746 <tbody>
41747 <row>
41748 <entry><option>directory</option></entry>
41749 <entry>Use: <emphasis>appendfile</emphasis></entry>
41750 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41751 <entry>Default: <emphasis>unset</emphasis></entry>
41752 </row>
41753 </tbody>
41754 </tgroup>
41755 </informaltable>
41756 <para>
41757 This option is mutually exclusive with the <option>file</option> option, but one of <option>file</option>
41758 or <option>directory</option> must be set, unless the delivery is the direct result of a
41759 redirection (see section <xref linkend="SECTfildiropt"/>).
41760 </para>
41761 <para>
41762 When <option>directory</option> is set, the string is expanded, and the message is delivered
41763 into a new file or files in or below the given directory, instead of being
41764 appended to a single mailbox file. A number of different formats are provided
41765 (see <option>maildir_format</option> and <option>mailstore_format</option>), and see section
41766 <xref linkend="SECTopdir"/> for further details of this form of delivery.
41767 </para>
41768 <para>
41769 <indexterm role="option">
41770 <primary><option>directory_file</option></primary>
41771 </indexterm>
41772 </para>
41773 <informaltable frame="all">
41774 <tgroup cols="4" colsep="0" rowsep="0">
41775 <colspec colwidth="8*" align="left"/>
41776 <colspec colwidth="6*" align="center"/>
41777 <colspec colwidth="6*" align="center"/>
41778 <colspec colwidth="6*" align="right"/>
41779 <tbody>
41780 <row>
41781 <entry><option>directory_file</option></entry>
41782 <entry>Use: <emphasis>appendfile</emphasis></entry>
41783 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41784 <entry>Default: <emphasis>see below</emphasis></entry>
41785 </row>
41786 </tbody>
41787 </tgroup>
41788 </informaltable>
41789 <para>
41790 <indexterm role="concept">
41791 <primary>base62</primary>
41792 </indexterm>
41793 <indexterm role="variable">
41794 <primary><varname>$inode</varname></primary>
41795 </indexterm>
41796 When <option>directory</option> is set, but neither <option>maildir_format</option> nor
41797 <option>mailstore_format</option> is set, <command>appendfile</command> delivers each message into a file
41798 whose name is obtained by expanding this string. The default value is:
41799 </para>
41800 <literallayout class="monospaced">
41801 q${base62:$tod_epoch}-$inode
41802 </literallayout>
41803 <para>
41804 This generates a unique name from the current time, in base 62 form, and the
41805 inode of the file. The variable <varname>$inode</varname> is available only when expanding this
41806 option.
41807 </para>
41808 <para>
41809 <indexterm role="option">
41810 <primary><option>directory_mode</option></primary>
41811 </indexterm>
41812 </para>
41813 <informaltable frame="all">
41814 <tgroup cols="4" colsep="0" rowsep="0">
41815 <colspec colwidth="8*" align="left"/>
41816 <colspec colwidth="6*" align="center"/>
41817 <colspec colwidth="6*" align="center"/>
41818 <colspec colwidth="6*" align="right"/>
41819 <tbody>
41820 <row>
41821 <entry><option>directory_mode</option></entry>
41822 <entry>Use: <emphasis>appendfile</emphasis></entry>
41823 <entry>Type: <emphasis>octal integer</emphasis></entry>
41824 <entry>Default: <emphasis>0700</emphasis></entry>
41825 </row>
41826 </tbody>
41827 </tgroup>
41828 </informaltable>
41829 <para>
41830 If <command>appendfile</command> creates any directories as a result of the
41831 <option>create_directory</option> option, their mode is specified by this option.
41832 </para>
41833 <para>
41834 <indexterm role="option">
41835 <primary><option>escape_string</option></primary>
41836 </indexterm>
41837 </para>
41838 <informaltable frame="all">
41839 <tgroup cols="4" colsep="0" rowsep="0">
41840 <colspec colwidth="8*" align="left"/>
41841 <colspec colwidth="6*" align="center"/>
41842 <colspec colwidth="6*" align="center"/>
41843 <colspec colwidth="6*" align="right"/>
41844 <tbody>
41845 <row>
41846 <entry><option>escape_string</option></entry>
41847 <entry>Use: <emphasis>appendfile</emphasis></entry>
41848 <entry>Type: <emphasis>string</emphasis></entry>
41849 <entry>Default: <emphasis>see description</emphasis></entry>
41850 </row>
41851 </tbody>
41852 </tgroup>
41853 </informaltable>
41854 <para>
41855 See <option>check_string</option> above.
41856 </para>
41857 <para>
41858 <indexterm role="option">
41859 <primary><option>file</option></primary>
41860 </indexterm>
41861 </para>
41862 <informaltable frame="all">
41863 <tgroup cols="4" colsep="0" rowsep="0">
41864 <colspec colwidth="8*" align="left"/>
41865 <colspec colwidth="6*" align="center"/>
41866 <colspec colwidth="6*" align="center"/>
41867 <colspec colwidth="6*" align="right"/>
41868 <tbody>
41869 <row>
41870 <entry><option>file</option></entry>
41871 <entry>Use: <emphasis>appendfile</emphasis></entry>
41872 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41873 <entry>Default: <emphasis>unset</emphasis></entry>
41874 </row>
41875 </tbody>
41876 </tgroup>
41877 </informaltable>
41878 <para>
41879 This option is mutually exclusive with the <option>directory</option> option, but one of
41880 <option>file</option> or <option>directory</option> must be set, unless the delivery is the direct result
41881 of a redirection (see section <xref linkend="SECTfildiropt"/>). The <option>file</option> option
41882 specifies a single file, to which the message is appended. One or more of
41883 <option>use_fcntl_lock</option>, <option>use_flock_lock</option>, or <option>use_lockfile</option> must be set with
41884 <option>file</option>.
41885 </para>
41886 <para>
41887 <indexterm role="concept">
41888 <primary>NFS</primary>
41889 <secondary>lock file</secondary>
41890 </indexterm>
41891 <indexterm role="concept">
41892 <primary>locking files</primary>
41893 </indexterm>
41894 <indexterm role="concept">
41895 <primary>lock files</primary>
41896 </indexterm>
41897 If you are using more than one host to deliver over NFS into the same
41898 mailboxes, you should always use lock files.
41899 </para>
41900 <para>
41901 The string value is expanded for each delivery, and must yield an absolute
41902 path. The most common settings of this option are variations on one of these
41903 examples:
41904 </para>
41905 <literallayout class="monospaced">
41906 file = /var/spool/mail/$local_part
41907 file = /home/$local_part/inbox
41908 file = $home/inbox
41909 </literallayout>
41910 <para>
41911 <indexterm role="concept">
41912 <primary><quote>sticky</quote> bit</primary>
41913 </indexterm>
41914 In the first example, all deliveries are done into the same directory. If Exim
41915 is configured to use lock files (see <option>use_lockfile</option> below) it must be able to
41916 create a file in the directory, so the <quote>sticky</quote> bit must be turned on for
41917 deliveries to be possible, or alternatively the <option>group</option> option can be used to
41918 run the delivery under a group id which has write access to the directory.
41919 </para>
41920 <para>
41921 <indexterm role="option">
41922 <primary><option>file_format</option></primary>
41923 </indexterm>
41924 </para>
41925 <informaltable frame="all">
41926 <tgroup cols="4" colsep="0" rowsep="0">
41927 <colspec colwidth="8*" align="left"/>
41928 <colspec colwidth="6*" align="center"/>
41929 <colspec colwidth="6*" align="center"/>
41930 <colspec colwidth="6*" align="right"/>
41931 <tbody>
41932 <row>
41933 <entry><option>file_format</option></entry>
41934 <entry>Use: <emphasis>appendfile</emphasis></entry>
41935 <entry>Type: <emphasis>string</emphasis></entry>
41936 <entry>Default: <emphasis>unset</emphasis></entry>
41937 </row>
41938 </tbody>
41939 </tgroup>
41940 </informaltable>
41941 <para>
41942 <indexterm role="concept">
41943 <primary>file</primary>
41944 <secondary>mailbox; checking existing format</secondary>
41945 </indexterm>
41946 This option requests the transport to check the format of an existing file
41947 before adding to it. The check consists of matching a specific string at the
41948 start of the file. The value of the option consists of an even number of
41949 colon-separated strings. The first of each pair is the test string, and the
41950 second is the name of a transport. If the transport associated with a matched
41951 string is not the current transport, control is passed over to the other
41952 transport. For example, suppose the standard <command>local_delivery</command> transport has
41953 this added to it:
41954 </para>
41955 <literallayout class="monospaced">
41956 file_format = "From       : local_delivery :\
41957                \1\1\1\1\n : local_mmdf_delivery"
41958 </literallayout>
41959 <para>
41960 Mailboxes that begin with <quote>From</quote> are still handled by this transport, but if
41961 a mailbox begins with four binary ones followed by a newline, control is passed
41962 to a transport called <option>local_mmdf_delivery</option>, which presumably is configured
41963 to do the delivery in MMDF format. If a mailbox does not exist or is empty, it
41964 is assumed to match the current transport. If the start of a mailbox doesn&#x2019;t
41965 match any string, or if the transport named for a given string is not defined,
41966 delivery is deferred.
41967 </para>
41968 <para>
41969 <indexterm role="option">
41970 <primary><option>file_must_exist</option></primary>
41971 </indexterm>
41972 </para>
41973 <informaltable frame="all">
41974 <tgroup cols="4" colsep="0" rowsep="0">
41975 <colspec colwidth="8*" align="left"/>
41976 <colspec colwidth="6*" align="center"/>
41977 <colspec colwidth="6*" align="center"/>
41978 <colspec colwidth="6*" align="right"/>
41979 <tbody>
41980 <row>
41981 <entry><option>file_must_exist</option></entry>
41982 <entry>Use: <emphasis>appendfile</emphasis></entry>
41983 <entry>Type: <emphasis>boolean</emphasis></entry>
41984 <entry>Default: <emphasis>false</emphasis></entry>
41985 </row>
41986 </tbody>
41987 </tgroup>
41988 </informaltable>
41989 <para>
41990 If this option is true, the file specified by the <option>file</option> option must exist.
41991 A temporary error occurs if it does not, causing delivery to be deferred.
41992 If this option is false, the file is created if it does not exist.
41993 </para>
41994 <para>
41995 <indexterm role="option">
41996 <primary><option>lock_fcntl_timeout</option></primary>
41997 </indexterm>
41998 </para>
41999 <informaltable frame="all">
42000 <tgroup cols="4" colsep="0" rowsep="0">
42001 <colspec colwidth="8*" align="left"/>
42002 <colspec colwidth="6*" align="center"/>
42003 <colspec colwidth="6*" align="center"/>
42004 <colspec colwidth="6*" align="right"/>
42005 <tbody>
42006 <row>
42007 <entry><option>lock_fcntl_timeout</option></entry>
42008 <entry>Use: <emphasis>appendfile</emphasis></entry>
42009 <entry>Type: <emphasis>time</emphasis></entry>
42010 <entry>Default: <emphasis>0s</emphasis></entry>
42011 </row>
42012 </tbody>
42013 </tgroup>
42014 </informaltable>
42015 <para>
42016 <indexterm role="concept">
42017 <primary>timeout</primary>
42018 <secondary>mailbox locking</secondary>
42019 </indexterm>
42020 <indexterm role="concept">
42021 <primary>mailbox</primary>
42022 <secondary>locking, blocking and non-blocking</secondary>
42023 </indexterm>
42024 <indexterm role="concept">
42025 <primary>locking files</primary>
42026 </indexterm>
42027 By default, the <command>appendfile</command> transport uses non-blocking calls to <function>fcntl()</function>
42028 when locking an open mailbox file. If the call fails, the delivery process
42029 sleeps for <option>lock_interval</option> and tries again, up to <option>lock_retries</option> times.
42030 Non-blocking calls are used so that the file is not kept open during the wait
42031 for the lock; the reason for this is to make it as safe as possible for
42032 deliveries over NFS in the case when processes might be accessing an NFS
42033 mailbox without using a lock file. This should not be done, but
42034 misunderstandings and hence misconfigurations are not unknown.
42035 </para>
42036 <para>
42037 On a busy system, however, the performance of a non-blocking lock approach is
42038 not as good as using a blocking lock with a timeout. In this case, the waiting
42039 is done inside the system call, and Exim&#x2019;s delivery process acquires the lock
42040 and can proceed as soon as the previous lock holder releases it.
42041 </para>
42042 <para>
42043 If <option>lock_fcntl_timeout</option> is set to a non-zero time, blocking locks, with that
42044 timeout, are used. There may still be some retrying: the maximum number of
42045 retries is
42046 </para>
42047 <literallayout class="monospaced">
42048 (lock_retries * lock_interval) / lock_fcntl_timeout
42049 </literallayout>
42050 <para>
42051 rounded up to the next whole number. In other words, the total time during
42052 which <command>appendfile</command> is trying to get a lock is roughly the same, unless
42053 <option>lock_fcntl_timeout</option> is set very large.
42054 </para>
42055 <para>
42056 You should consider setting this option if you are getting a lot of delayed
42057 local deliveries because of errors of the form
42058 </para>
42059 <literallayout class="monospaced">
42060 failed to lock mailbox /some/file (fcntl)
42061 </literallayout>
42062 <para>
42063 <indexterm role="option">
42064 <primary><option>lock_flock_timeout</option></primary>
42065 </indexterm>
42066 </para>
42067 <informaltable frame="all">
42068 <tgroup cols="4" colsep="0" rowsep="0">
42069 <colspec colwidth="8*" align="left"/>
42070 <colspec colwidth="6*" align="center"/>
42071 <colspec colwidth="6*" align="center"/>
42072 <colspec colwidth="6*" align="right"/>
42073 <tbody>
42074 <row>
42075 <entry><option>lock_flock_timeout</option></entry>
42076 <entry>Use: <emphasis>appendfile</emphasis></entry>
42077 <entry>Type: <emphasis>time</emphasis></entry>
42078 <entry>Default: <emphasis>0s</emphasis></entry>
42079 </row>
42080 </tbody>
42081 </tgroup>
42082 </informaltable>
42083 <para>
42084 This timeout applies to file locking when using <function>flock()</function> (see
42085 <option>use_flock</option>); the timeout operates in a similar manner to
42086 <option>lock_fcntl_timeout</option>.
42087 </para>
42088 <para>
42089 <indexterm role="option">
42090 <primary><option>lock_interval</option></primary>
42091 </indexterm>
42092 </para>
42093 <informaltable frame="all">
42094 <tgroup cols="4" colsep="0" rowsep="0">
42095 <colspec colwidth="8*" align="left"/>
42096 <colspec colwidth="6*" align="center"/>
42097 <colspec colwidth="6*" align="center"/>
42098 <colspec colwidth="6*" align="right"/>
42099 <tbody>
42100 <row>
42101 <entry><option>lock_interval</option></entry>
42102 <entry>Use: <emphasis>appendfile</emphasis></entry>
42103 <entry>Type: <emphasis>time</emphasis></entry>
42104 <entry>Default: <emphasis>3s</emphasis></entry>
42105 </row>
42106 </tbody>
42107 </tgroup>
42108 </informaltable>
42109 <para>
42110 This specifies the time to wait between attempts to lock the file. See below
42111 for details of locking.
42112 </para>
42113 <para>
42114 <indexterm role="option">
42115 <primary><option>lock_retries</option></primary>
42116 </indexterm>
42117 </para>
42118 <informaltable frame="all">
42119 <tgroup cols="4" colsep="0" rowsep="0">
42120 <colspec colwidth="8*" align="left"/>
42121 <colspec colwidth="6*" align="center"/>
42122 <colspec colwidth="6*" align="center"/>
42123 <colspec colwidth="6*" align="right"/>
42124 <tbody>
42125 <row>
42126 <entry><option>lock_retries</option></entry>
42127 <entry>Use: <emphasis>appendfile</emphasis></entry>
42128 <entry>Type: <emphasis>integer</emphasis></entry>
42129 <entry>Default: <emphasis>10</emphasis></entry>
42130 </row>
42131 </tbody>
42132 </tgroup>
42133 </informaltable>
42134 <para>
42135 This specifies the maximum number of attempts to lock the file. A value of zero
42136 is treated as 1. See below for details of locking.
42137 </para>
42138 <para>
42139 <indexterm role="option">
42140 <primary><option>lockfile_mode</option></primary>
42141 </indexterm>
42142 </para>
42143 <informaltable frame="all">
42144 <tgroup cols="4" colsep="0" rowsep="0">
42145 <colspec colwidth="8*" align="left"/>
42146 <colspec colwidth="6*" align="center"/>
42147 <colspec colwidth="6*" align="center"/>
42148 <colspec colwidth="6*" align="right"/>
42149 <tbody>
42150 <row>
42151 <entry><option>lockfile_mode</option></entry>
42152 <entry>Use: <emphasis>appendfile</emphasis></entry>
42153 <entry>Type: <emphasis>octal integer</emphasis></entry>
42154 <entry>Default: <emphasis>0600</emphasis></entry>
42155 </row>
42156 </tbody>
42157 </tgroup>
42158 </informaltable>
42159 <para>
42160 This specifies the mode of the created lock file, when a lock file is being
42161 used (see <option>use_lockfile</option> and <option>use_mbx_lock</option>).
42162 </para>
42163 <para>
42164 <indexterm role="option">
42165 <primary><option>lockfile_timeout</option></primary>
42166 </indexterm>
42167 </para>
42168 <informaltable frame="all">
42169 <tgroup cols="4" colsep="0" rowsep="0">
42170 <colspec colwidth="8*" align="left"/>
42171 <colspec colwidth="6*" align="center"/>
42172 <colspec colwidth="6*" align="center"/>
42173 <colspec colwidth="6*" align="right"/>
42174 <tbody>
42175 <row>
42176 <entry><option>lockfile_timeout</option></entry>
42177 <entry>Use: <emphasis>appendfile</emphasis></entry>
42178 <entry>Type: <emphasis>time</emphasis></entry>
42179 <entry>Default: <emphasis>30m</emphasis></entry>
42180 </row>
42181 </tbody>
42182 </tgroup>
42183 </informaltable>
42184 <para>
42185 <indexterm role="concept">
42186 <primary>timeout</primary>
42187 <secondary>mailbox locking</secondary>
42188 </indexterm>
42189 When a lock file is being used (see <option>use_lockfile</option>), if a lock file already
42190 exists and is older than this value, it is assumed to have been left behind by
42191 accident, and Exim attempts to remove it.
42192 </para>
42193 <para>
42194 <indexterm role="option">
42195 <primary><option>mailbox_filecount</option></primary>
42196 </indexterm>
42197 </para>
42198 <informaltable frame="all">
42199 <tgroup cols="4" colsep="0" rowsep="0">
42200 <colspec colwidth="8*" align="left"/>
42201 <colspec colwidth="6*" align="center"/>
42202 <colspec colwidth="6*" align="center"/>
42203 <colspec colwidth="6*" align="right"/>
42204 <tbody>
42205 <row>
42206 <entry><option>mailbox_filecount</option></entry>
42207 <entry>Use: <emphasis>appendfile</emphasis></entry>
42208 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42209 <entry>Default: <emphasis>unset</emphasis></entry>
42210 </row>
42211 </tbody>
42212 </tgroup>
42213 </informaltable>
42214 <para>
42215 <indexterm role="concept">
42216 <primary>mailbox</primary>
42217 <secondary>specifying size of</secondary>
42218 </indexterm>
42219 <indexterm role="concept">
42220 <primary>size</primary>
42221 <secondary>of mailbox</secondary>
42222 </indexterm>
42223 If this option is set, it is expanded, and the result is taken as the current
42224 number of files in the mailbox. It must be a decimal number, optionally
42225 followed by K or M. This provides a way of obtaining this information from an
42226 external source that maintains the data.
42227 </para>
42228 <para>
42229 <indexterm role="option">
42230 <primary><option>mailbox_size</option></primary>
42231 </indexterm>
42232 </para>
42233 <informaltable frame="all">
42234 <tgroup cols="4" colsep="0" rowsep="0">
42235 <colspec colwidth="8*" align="left"/>
42236 <colspec colwidth="6*" align="center"/>
42237 <colspec colwidth="6*" align="center"/>
42238 <colspec colwidth="6*" align="right"/>
42239 <tbody>
42240 <row>
42241 <entry><option>mailbox_size</option></entry>
42242 <entry>Use: <emphasis>appendfile</emphasis></entry>
42243 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42244 <entry>Default: <emphasis>unset</emphasis></entry>
42245 </row>
42246 </tbody>
42247 </tgroup>
42248 </informaltable>
42249 <para>
42250 <indexterm role="concept">
42251 <primary>mailbox</primary>
42252 <secondary>specifying size of</secondary>
42253 </indexterm>
42254 <indexterm role="concept">
42255 <primary>size</primary>
42256 <secondary>of mailbox</secondary>
42257 </indexterm>
42258 If this option is set, it is expanded, and the result is taken as the current
42259 size the mailbox. It must be a decimal number, optionally followed by K or M.
42260 This provides a way of obtaining this information from an external source that
42261 maintains the data. This is likely to be helpful for maildir deliveries where
42262 it is computationally expensive to compute the size of a mailbox.
42263 </para>
42264 <para>
42265 <indexterm role="option">
42266 <primary><option>maildir_format</option></primary>
42267 </indexterm>
42268 </para>
42269 <informaltable frame="all">
42270 <tgroup cols="4" colsep="0" rowsep="0">
42271 <colspec colwidth="8*" align="left"/>
42272 <colspec colwidth="6*" align="center"/>
42273 <colspec colwidth="6*" align="center"/>
42274 <colspec colwidth="6*" align="right"/>
42275 <tbody>
42276 <row>
42277 <entry><option>maildir_format</option></entry>
42278 <entry>Use: <emphasis>appendfile</emphasis></entry>
42279 <entry>Type: <emphasis>boolean</emphasis></entry>
42280 <entry>Default: <emphasis>false</emphasis></entry>
42281 </row>
42282 </tbody>
42283 </tgroup>
42284 </informaltable>
42285 <para>
42286 <indexterm role="concept">
42287 <primary>maildir format</primary>
42288 <secondary>specifying</secondary>
42289 </indexterm>
42290 If this option is set with the <option>directory</option> option, the delivery is into a new
42291 file, in the <quote>maildir</quote> format that is used by other mail software. When the
42292 transport is activated directly from a <command>redirect</command> router (for example, the
42293 <command>address_file</command> transport in the default configuration), setting
42294 <option>maildir_format</option> causes the path received from the router to be treated as a
42295 directory, whether or not it ends with <literal>/</literal>. This option is available only if
42296 SUPPORT_MAILDIR is present in <filename>Local/Makefile</filename>. See section
42297 <xref linkend="SECTmaildirdelivery"/> below for further details.
42298 </para>
42299 <para>
42300 <indexterm role="option">
42301 <primary><option>maildir_quota_directory_regex</option></primary>
42302 </indexterm>
42303 </para>
42304 <informaltable frame="all">
42305 <tgroup cols="4" colsep="0" rowsep="0">
42306 <colspec colwidth="8*" align="left"/>
42307 <colspec colwidth="6*" align="center"/>
42308 <colspec colwidth="6*" align="center"/>
42309 <colspec colwidth="6*" align="right"/>
42310 <tbody>
42311 <row>
42312 <entry><option>maildir_quota_directory_regex</option></entry>
42313 <entry>Use: <emphasis>appendfile</emphasis></entry>
42314 <entry>Type: <emphasis>string</emphasis></entry>
42315 <entry>Default: <emphasis>See below</emphasis></entry>
42316 </row>
42317 </tbody>
42318 </tgroup>
42319 </informaltable>
42320 <para>
42321 <indexterm role="concept">
42322 <primary>maildir format</primary>
42323 <secondary>quota; directories included in</secondary>
42324 </indexterm>
42325 <indexterm role="concept">
42326 <primary>quota</primary>
42327 <secondary>maildir; directories included in</secondary>
42328 </indexterm>
42329 This option is relevant only when <option>maildir_use_size_file</option> is set. It defines
42330 a regular expression for specifying directories, relative to the quota
42331 directory (see <option>quota_directory</option>), that should be included in the quota
42332 calculation. The default value is:
42333 </para>
42334 <literallayout class="monospaced">
42335 maildir_quota_directory_regex = ^(?:cur|new|\..*)$
42336 </literallayout>
42337 <para>
42338 This includes the <filename>cur</filename> and <filename>new</filename> directories, and any maildir++ folders
42339 (directories whose names begin with a dot). If you want to exclude the
42340 <filename>Trash</filename>
42341 folder from the count (as some sites do), you need to change this setting to
42342 </para>
42343 <literallayout class="monospaced">
42344 maildir_quota_directory_regex = ^(?:cur|new|\.(?!Trash).*)$
42345 </literallayout>
42346 <para>
42347 This uses a negative lookahead in the regular expression to exclude the
42348 directory whose name is <filename>.Trash</filename>. When a directory is excluded from quota
42349 calculations, quota processing is bypassed for any messages that are delivered
42350 directly into that directory.
42351 </para>
42352 <para>
42353 <indexterm role="option">
42354 <primary><option>maildir_retries</option></primary>
42355 </indexterm>
42356 </para>
42357 <informaltable frame="all">
42358 <tgroup cols="4" colsep="0" rowsep="0">
42359 <colspec colwidth="8*" align="left"/>
42360 <colspec colwidth="6*" align="center"/>
42361 <colspec colwidth="6*" align="center"/>
42362 <colspec colwidth="6*" align="right"/>
42363 <tbody>
42364 <row>
42365 <entry><option>maildir_retries</option></entry>
42366 <entry>Use: <emphasis>appendfile</emphasis></entry>
42367 <entry>Type: <emphasis>integer</emphasis></entry>
42368 <entry>Default: <emphasis>10</emphasis></entry>
42369 </row>
42370 </tbody>
42371 </tgroup>
42372 </informaltable>
42373 <para>
42374 This option specifies the number of times to retry when writing a file in
42375 <quote>maildir</quote> format. See section <xref linkend="SECTmaildirdelivery"/> below.
42376 </para>
42377 <para>
42378 <indexterm role="option">
42379 <primary><option>maildir_tag</option></primary>
42380 </indexterm>
42381 </para>
42382 <informaltable frame="all">
42383 <tgroup cols="4" colsep="0" rowsep="0">
42384 <colspec colwidth="8*" align="left"/>
42385 <colspec colwidth="6*" align="center"/>
42386 <colspec colwidth="6*" align="center"/>
42387 <colspec colwidth="6*" align="right"/>
42388 <tbody>
42389 <row>
42390 <entry><option>maildir_tag</option></entry>
42391 <entry>Use: <emphasis>appendfile</emphasis></entry>
42392 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42393 <entry>Default: <emphasis>unset</emphasis></entry>
42394 </row>
42395 </tbody>
42396 </tgroup>
42397 </informaltable>
42398 <para>
42399 This option applies only to deliveries in maildir format, and is described in
42400 section <xref linkend="SECTmaildirdelivery"/> below.
42401 </para>
42402 <para>
42403 <indexterm role="option">
42404 <primary><option>maildir_use_size_file</option></primary>
42405 </indexterm>
42406 </para>
42407 <informaltable frame="all">
42408 <tgroup cols="4" colsep="0" rowsep="0">
42409 <colspec colwidth="8*" align="left"/>
42410 <colspec colwidth="6*" align="center"/>
42411 <colspec colwidth="6*" align="center"/>
42412 <colspec colwidth="6*" align="right"/>
42413 <tbody>
42414 <row>
42415 <entry><option>maildir_use_size_file</option></entry>
42416 <entry>Use: <emphasis>appendfile</emphasis>&dagger;<emphasis></emphasis></entry>
42417 <entry>Type: <emphasis>boolean</emphasis></entry>
42418 <entry>Default: <emphasis>false</emphasis></entry>
42419 </row>
42420 </tbody>
42421 </tgroup>
42422 </informaltable>
42423 <para>
42424 <indexterm role="concept">
42425 <primary>maildir format</primary>
42426 <secondary><filename>maildirsize</filename> file</secondary>
42427 </indexterm>
42428 The result of string expansion for this option must be a valid boolean value.
42429 If it is true, it enables support for <filename>maildirsize</filename> files. Exim
42430 creates a <filename>maildirsize</filename> file in a maildir if one does not exist, taking the
42431 quota from the <option>quota</option> option of the transport. If <option>quota</option> is unset, the
42432 value is zero. See <option>maildir_quota_directory_regex</option> above and section
42433 <xref linkend="SECTmaildirdelivery"/> below for further details.
42434 </para>
42435 <para>
42436 <indexterm role="option">
42437 <primary><option>maildirfolder_create_regex</option></primary>
42438 </indexterm>
42439 </para>
42440 <informaltable frame="all">
42441 <tgroup cols="4" colsep="0" rowsep="0">
42442 <colspec colwidth="8*" align="left"/>
42443 <colspec colwidth="6*" align="center"/>
42444 <colspec colwidth="6*" align="center"/>
42445 <colspec colwidth="6*" align="right"/>
42446 <tbody>
42447 <row>
42448 <entry><option>maildirfolder_create_regex</option></entry>
42449 <entry>Use: <emphasis>appendfile</emphasis></entry>
42450 <entry>Type: <emphasis>string</emphasis></entry>
42451 <entry>Default: <emphasis>unset</emphasis></entry>
42452 </row>
42453 </tbody>
42454 </tgroup>
42455 </informaltable>
42456 <para>
42457 <indexterm role="concept">
42458 <primary>maildir format</primary>
42459 <secondary><filename>maildirfolder</filename> file</secondary>
42460 </indexterm>
42461 <indexterm role="concept">
42462 <primary><filename>maildirfolder</filename>, creating</primary>
42463 </indexterm>
42464 The value of this option is a regular expression. If it is unset, it has no
42465 effect. Otherwise, before a maildir delivery takes place, the pattern is
42466 matched against the name of the maildir directory, that is, the directory
42467 containing the <filename>new</filename> and <filename>tmp</filename> subdirectories that will be used for the
42468 delivery. If there is a match, Exim checks for the existence of a file called
42469 <filename>maildirfolder</filename> in the directory, and creates it if it does not exist.
42470 See section <xref linkend="SECTmaildirdelivery"/> for more details.
42471 </para>
42472 <para>
42473 <indexterm role="option">
42474 <primary><option>mailstore_format</option></primary>
42475 </indexterm>
42476 </para>
42477 <informaltable frame="all">
42478 <tgroup cols="4" colsep="0" rowsep="0">
42479 <colspec colwidth="8*" align="left"/>
42480 <colspec colwidth="6*" align="center"/>
42481 <colspec colwidth="6*" align="center"/>
42482 <colspec colwidth="6*" align="right"/>
42483 <tbody>
42484 <row>
42485 <entry><option>mailstore_format</option></entry>
42486 <entry>Use: <emphasis>appendfile</emphasis></entry>
42487 <entry>Type: <emphasis>boolean</emphasis></entry>
42488 <entry>Default: <emphasis>false</emphasis></entry>
42489 </row>
42490 </tbody>
42491 </tgroup>
42492 </informaltable>
42493 <para>
42494 <indexterm role="concept">
42495 <primary>mailstore format</primary>
42496 <secondary>specifying</secondary>
42497 </indexterm>
42498 If this option is set with the <option>directory</option> option, the delivery is into two
42499 new files in  <quote>mailstore</quote> format. The option is available only if
42500 SUPPORT_MAILSTORE is present in <filename>Local/Makefile</filename>. See section <xref linkend="SECTopdir"/>
42501 below for further details.
42502 </para>
42503 <para>
42504 <indexterm role="option">
42505 <primary><option>mailstore_prefix</option></primary>
42506 </indexterm>
42507 </para>
42508 <informaltable frame="all">
42509 <tgroup cols="4" colsep="0" rowsep="0">
42510 <colspec colwidth="8*" align="left"/>
42511 <colspec colwidth="6*" align="center"/>
42512 <colspec colwidth="6*" align="center"/>
42513 <colspec colwidth="6*" align="right"/>
42514 <tbody>
42515 <row>
42516 <entry><option>mailstore_prefix</option></entry>
42517 <entry>Use: <emphasis>appendfile</emphasis></entry>
42518 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42519 <entry>Default: <emphasis>unset</emphasis></entry>
42520 </row>
42521 </tbody>
42522 </tgroup>
42523 </informaltable>
42524 <para>
42525 This option applies only to deliveries in mailstore format, and is described in
42526 section <xref linkend="SECTopdir"/> below.
42527 </para>
42528 <para>
42529 <indexterm role="option">
42530 <primary><option>mailstore_suffix</option></primary>
42531 </indexterm>
42532 </para>
42533 <informaltable frame="all">
42534 <tgroup cols="4" colsep="0" rowsep="0">
42535 <colspec colwidth="8*" align="left"/>
42536 <colspec colwidth="6*" align="center"/>
42537 <colspec colwidth="6*" align="center"/>
42538 <colspec colwidth="6*" align="right"/>
42539 <tbody>
42540 <row>
42541 <entry><option>mailstore_suffix</option></entry>
42542 <entry>Use: <emphasis>appendfile</emphasis></entry>
42543 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42544 <entry>Default: <emphasis>unset</emphasis></entry>
42545 </row>
42546 </tbody>
42547 </tgroup>
42548 </informaltable>
42549 <para>
42550 This option applies only to deliveries in mailstore format, and is described in
42551 section <xref linkend="SECTopdir"/> below.
42552 </para>
42553 <para>
42554 <indexterm role="option">
42555 <primary><option>mbx_format</option></primary>
42556 </indexterm>
42557 </para>
42558 <informaltable frame="all">
42559 <tgroup cols="4" colsep="0" rowsep="0">
42560 <colspec colwidth="8*" align="left"/>
42561 <colspec colwidth="6*" align="center"/>
42562 <colspec colwidth="6*" align="center"/>
42563 <colspec colwidth="6*" align="right"/>
42564 <tbody>
42565 <row>
42566 <entry><option>mbx_format</option></entry>
42567 <entry>Use: <emphasis>appendfile</emphasis></entry>
42568 <entry>Type: <emphasis>boolean</emphasis></entry>
42569 <entry>Default: <emphasis>false</emphasis></entry>
42570 </row>
42571 </tbody>
42572 </tgroup>
42573 </informaltable>
42574 <para>
42575 <indexterm role="concept">
42576 <primary>locking files</primary>
42577 </indexterm>
42578 <indexterm role="concept">
42579 <primary>file</primary>
42580 <secondary>locking</secondary>
42581 </indexterm>
42582 <indexterm role="concept">
42583 <primary>file</primary>
42584 <secondary>MBX format</secondary>
42585 </indexterm>
42586 <indexterm role="concept">
42587 <primary>MBX format, specifying</primary>
42588 </indexterm>
42589 This option is available only if Exim has been compiled with SUPPORT_MBX
42590 set in <filename>Local/Makefile</filename>. If <option>mbx_format</option> is set with the <option>file</option> option,
42591 the message is appended to the mailbox file in MBX format instead of
42592 traditional Unix format. This format is supported by Pine4 and its associated
42593 IMAP and POP daemons, by means of the <emphasis>c-client</emphasis> library that they all use.
42594 </para>
42595 <para>
42596 <emphasis role="bold">Note</emphasis>: The <option>message_prefix</option> and <option>message_suffix</option> options are not
42597 automatically changed by the use of <option>mbx_format</option>. They should normally be set
42598 empty when using MBX format, so this option almost always appears in this
42599 combination:
42600 </para>
42601 <literallayout class="monospaced">
42602 mbx_format = true
42603 message_prefix =
42604 message_suffix =
42605 </literallayout>
42606 <para>
42607 If none of the locking options are mentioned in the configuration,
42608 <option>use_mbx_lock</option> is assumed and the other locking options default to false. It
42609 is possible to specify the other kinds of locking with <option>mbx_format</option>, but
42610 <option>use_fcntl_lock</option> and <option>use_mbx_lock</option> are mutually exclusive. MBX locking
42611 interworks with <emphasis>c-client</emphasis>, providing for shared access to the mailbox. It
42612 should not be used if any program that does not use this form of locking is
42613 going to access the mailbox, nor should it be used if the mailbox file is NFS
42614 mounted, because it works only when the mailbox is accessed from a single host.
42615 </para>
42616 <para>
42617 If you set <option>use_fcntl_lock</option> with an MBX-format mailbox, you cannot use
42618 the standard version of <emphasis>c-client</emphasis>, because as long as it has a mailbox open
42619 (this means for the whole of a Pine or IMAP session), Exim will not be able to
42620 append messages to it.
42621 </para>
42622 <para>
42623 <indexterm role="option">
42624 <primary><option>message_prefix</option></primary>
42625 </indexterm>
42626 </para>
42627 <informaltable frame="all">
42628 <tgroup cols="4" colsep="0" rowsep="0">
42629 <colspec colwidth="8*" align="left"/>
42630 <colspec colwidth="6*" align="center"/>
42631 <colspec colwidth="6*" align="center"/>
42632 <colspec colwidth="6*" align="right"/>
42633 <tbody>
42634 <row>
42635 <entry><option>message_prefix</option></entry>
42636 <entry>Use: <emphasis>appendfile</emphasis></entry>
42637 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42638 <entry>Default: <emphasis>see below</emphasis></entry>
42639 </row>
42640 </tbody>
42641 </tgroup>
42642 </informaltable>
42643 <para>
42644 <indexterm role="concept">
42645 <primary><quote>From</quote> line</primary>
42646 </indexterm>
42647 The string specified here is expanded and output at the start of every message.
42648 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
42649 in which case it is:
42650 </para>
42651 <literallayout class="monospaced">
42652 message_prefix = "From ${if def:return_path{$return_path}\
42653   {MAILER-DAEMON}} $tod_bsdinbox\n"
42654 </literallayout>
42655 <para>
42656 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
42657 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_prefix</option>.
42658 </para>
42659 <para>
42660 <indexterm role="option">
42661 <primary><option>message_suffix</option></primary>
42662 </indexterm>
42663 </para>
42664 <informaltable frame="all">
42665 <tgroup cols="4" colsep="0" rowsep="0">
42666 <colspec colwidth="8*" align="left"/>
42667 <colspec colwidth="6*" align="center"/>
42668 <colspec colwidth="6*" align="center"/>
42669 <colspec colwidth="6*" align="right"/>
42670 <tbody>
42671 <row>
42672 <entry><option>message_suffix</option></entry>
42673 <entry>Use: <emphasis>appendfile</emphasis></entry>
42674 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42675 <entry>Default: <emphasis>see below</emphasis></entry>
42676 </row>
42677 </tbody>
42678 </tgroup>
42679 </informaltable>
42680 <para>
42681 The string specified here is expanded and output at the end of every message.
42682 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
42683 in which case it is a single newline character. The suffix can be suppressed by
42684 setting
42685 </para>
42686 <literallayout class="monospaced">
42687 message_suffix =
42688 </literallayout>
42689 <para>
42690 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
42691 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_suffix</option>.
42692 </para>
42693 <para>
42694 <indexterm role="option">
42695 <primary><option>mode</option></primary>
42696 </indexterm>
42697 </para>
42698 <informaltable frame="all">
42699 <tgroup cols="4" colsep="0" rowsep="0">
42700 <colspec colwidth="8*" align="left"/>
42701 <colspec colwidth="6*" align="center"/>
42702 <colspec colwidth="6*" align="center"/>
42703 <colspec colwidth="6*" align="right"/>
42704 <tbody>
42705 <row>
42706 <entry><option>mode</option></entry>
42707 <entry>Use: <emphasis>appendfile</emphasis></entry>
42708 <entry>Type: <emphasis>octal integer</emphasis></entry>
42709 <entry>Default: <emphasis>0600</emphasis></entry>
42710 </row>
42711 </tbody>
42712 </tgroup>
42713 </informaltable>
42714 <para>
42715 If the output file is created, it is given this mode. If it already exists and
42716 has wider permissions, they are reduced to this mode. If it has narrower
42717 permissions, an error occurs unless <option>mode_fail_narrower</option> is false. However,
42718 if the delivery is the result of a <option>save</option> command in a filter file specifying
42719 a particular mode, the mode of the output file is always forced to take that
42720 value, and this option is ignored.
42721 </para>
42722 <para>
42723 <indexterm role="option">
42724 <primary><option>mode_fail_narrower</option></primary>
42725 </indexterm>
42726 </para>
42727 <informaltable frame="all">
42728 <tgroup cols="4" colsep="0" rowsep="0">
42729 <colspec colwidth="8*" align="left"/>
42730 <colspec colwidth="6*" align="center"/>
42731 <colspec colwidth="6*" align="center"/>
42732 <colspec colwidth="6*" align="right"/>
42733 <tbody>
42734 <row>
42735 <entry><option>mode_fail_narrower</option></entry>
42736 <entry>Use: <emphasis>appendfile</emphasis></entry>
42737 <entry>Type: <emphasis>boolean</emphasis></entry>
42738 <entry>Default: <emphasis>true</emphasis></entry>
42739 </row>
42740 </tbody>
42741 </tgroup>
42742 </informaltable>
42743 <para>
42744 This option applies in the case when an existing mailbox file has a narrower
42745 mode than that specified by the <option>mode</option> option. If <option>mode_fail_narrower</option> is
42746 true, the delivery is deferred (<quote>mailbox has the wrong mode</quote>); otherwise Exim
42747 continues with the delivery attempt, using the existing mode of the file.
42748 </para>
42749 <para>
42750 <indexterm role="option">
42751 <primary><option>notify_comsat</option></primary>
42752 </indexterm>
42753 </para>
42754 <informaltable frame="all">
42755 <tgroup cols="4" colsep="0" rowsep="0">
42756 <colspec colwidth="8*" align="left"/>
42757 <colspec colwidth="6*" align="center"/>
42758 <colspec colwidth="6*" align="center"/>
42759 <colspec colwidth="6*" align="right"/>
42760 <tbody>
42761 <row>
42762 <entry><option>notify_comsat</option></entry>
42763 <entry>Use: <emphasis>appendfile</emphasis></entry>
42764 <entry>Type: <emphasis>boolean</emphasis></entry>
42765 <entry>Default: <emphasis>false</emphasis></entry>
42766 </row>
42767 </tbody>
42768 </tgroup>
42769 </informaltable>
42770 <para>
42771 If this option is true, the <emphasis>comsat</emphasis> daemon is notified after every
42772 successful delivery to a user mailbox. This is the daemon that notifies logged
42773 on users about incoming mail.
42774 </para>
42775 <para>
42776 <indexterm role="option">
42777 <primary><option>quota</option></primary>
42778 </indexterm>
42779 </para>
42780 <informaltable frame="all">
42781 <tgroup cols="4" colsep="0" rowsep="0">
42782 <colspec colwidth="8*" align="left"/>
42783 <colspec colwidth="6*" align="center"/>
42784 <colspec colwidth="6*" align="center"/>
42785 <colspec colwidth="6*" align="right"/>
42786 <tbody>
42787 <row>
42788 <entry><option>quota</option></entry>
42789 <entry>Use: <emphasis>appendfile</emphasis></entry>
42790 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42791 <entry>Default: <emphasis>unset</emphasis></entry>
42792 </row>
42793 </tbody>
42794 </tgroup>
42795 </informaltable>
42796 <para>
42797 <indexterm role="concept">
42798 <primary>quota</primary>
42799 <secondary>imposed by Exim</secondary>
42800 </indexterm>
42801 This option imposes a limit on the size of the file to which Exim is appending,
42802 or to the total space used in the directory tree when the <option>directory</option> option
42803 is set. In the latter case, computation of the space used is expensive, because
42804 all the files in the directory (and any sub-directories) have to be
42805 individually inspected and their sizes summed. (See <option>quota_size_regex</option> and
42806 <option>maildir_use_size_file</option> for ways to avoid this in environments where users
42807 have no shell access to their mailboxes).
42808 </para>
42809 <para>
42810 As there is no interlock against two simultaneous deliveries into a
42811 multi-file mailbox, it is possible for the quota to be overrun in this case.
42812 For single-file mailboxes, of course, an interlock is a necessity.
42813 </para>
42814 <para>
42815 A file&#x2019;s size is taken as its <emphasis>used</emphasis> value. Because of blocking effects, this
42816 may be a lot less than the actual amount of disk space allocated to the file.
42817 If the sizes of a number of files are being added up, the rounding effect can
42818 become quite noticeable, especially on systems that have large block sizes.
42819 Nevertheless, it seems best to stick to the <emphasis>used</emphasis> figure, because this is
42820 the obvious value which users understand most easily.
42821 </para>
42822 <para>
42823 The value of the option is expanded, and must then be a numerical value
42824 (decimal point allowed), optionally followed by one of the letters K, M, or G,
42825 for kilobytes, megabytes, or gigabytes, optionally followed by a slash
42826 and further option modifiers. If Exim is running on a system with
42827 large file support (Linux and FreeBSD have this), mailboxes larger than 2G can
42828 be handled.
42829 </para>
42830 <para>
42831 The option modifier <option>no_check</option> can be used to force delivery even if the over
42832 quota condition is met. The quota gets updated as usual.
42833 </para>
42834 <para>
42835 <emphasis role="bold">Note</emphasis>: A value of zero is interpreted as <quote>no quota</quote>.
42836 </para>
42837 <para>
42838 The expansion happens while Exim is running as root, before it changes uid for
42839 the delivery. This means that files that are inaccessible to the end user can
42840 be used to hold quota values that are looked up in the expansion. When delivery
42841 fails because this quota is exceeded, the handling of the error is as for
42842 system quota failures.
42843 </para>
42844 <para>
42845 By default, Exim&#x2019;s quota checking mimics system quotas, and restricts the
42846 mailbox to the specified maximum size, though the value is not accurate to the
42847 last byte, owing to separator lines and additional headers that may get added
42848 during message delivery. When a mailbox is nearly full, large messages may get
42849 refused even though small ones are accepted, because the size of the current
42850 message is added to the quota when the check is made. This behaviour can be
42851 changed by setting <option>quota_is_inclusive</option> false. When this is done, the check
42852 for exceeding the quota does not include the current message. Thus, deliveries
42853 continue until the quota has been exceeded; thereafter, no further messages are
42854 delivered. See also <option>quota_warn_threshold</option>.
42855 </para>
42856 <para>
42857 <indexterm role="option">
42858 <primary><option>quota_directory</option></primary>
42859 </indexterm>
42860 </para>
42861 <informaltable frame="all">
42862 <tgroup cols="4" colsep="0" rowsep="0">
42863 <colspec colwidth="8*" align="left"/>
42864 <colspec colwidth="6*" align="center"/>
42865 <colspec colwidth="6*" align="center"/>
42866 <colspec colwidth="6*" align="right"/>
42867 <tbody>
42868 <row>
42869 <entry><option>quota_directory</option></entry>
42870 <entry>Use: <emphasis>appendfile</emphasis></entry>
42871 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42872 <entry>Default: <emphasis>unset</emphasis></entry>
42873 </row>
42874 </tbody>
42875 </tgroup>
42876 </informaltable>
42877 <para>
42878 This option defines the directory to check for quota purposes when delivering
42879 into individual files. The default is the delivery directory, or, if a file
42880 called <filename>maildirfolder</filename> exists in a maildir directory, the parent of the
42881 delivery directory.
42882 </para>
42883 <para>
42884 <indexterm role="option">
42885 <primary><option>quota_filecount</option></primary>
42886 </indexterm>
42887 </para>
42888 <informaltable frame="all">
42889 <tgroup cols="4" colsep="0" rowsep="0">
42890 <colspec colwidth="8*" align="left"/>
42891 <colspec colwidth="6*" align="center"/>
42892 <colspec colwidth="6*" align="center"/>
42893 <colspec colwidth="6*" align="right"/>
42894 <tbody>
42895 <row>
42896 <entry><option>quota_filecount</option></entry>
42897 <entry>Use: <emphasis>appendfile</emphasis></entry>
42898 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42899 <entry>Default: <emphasis>0</emphasis></entry>
42900 </row>
42901 </tbody>
42902 </tgroup>
42903 </informaltable>
42904 <para>
42905 This option applies when the <option>directory</option> option is set. It limits the total
42906 number of files in the directory (compare the inode limit in system quotas). It
42907 can only be used if <option>quota</option> is also set. The value is expanded; an expansion
42908 failure causes delivery to be deferred. A value of zero is interpreted as
42909 <quote>no quota</quote>.
42910 </para>
42911 <para>
42912 The option modifier <option>no_check</option> can be used to force delivery even if the over
42913 quota condition is met. The quota gets updated as usual.
42914 </para>
42915 <para>
42916 <indexterm role="option">
42917 <primary><option>quota_is_inclusive</option></primary>
42918 </indexterm>
42919 </para>
42920 <informaltable frame="all">
42921 <tgroup cols="4" colsep="0" rowsep="0">
42922 <colspec colwidth="8*" align="left"/>
42923 <colspec colwidth="6*" align="center"/>
42924 <colspec colwidth="6*" align="center"/>
42925 <colspec colwidth="6*" align="right"/>
42926 <tbody>
42927 <row>
42928 <entry><option>quota_is_inclusive</option></entry>
42929 <entry>Use: <emphasis>appendfile</emphasis></entry>
42930 <entry>Type: <emphasis>boolean</emphasis></entry>
42931 <entry>Default: <emphasis>true</emphasis></entry>
42932 </row>
42933 </tbody>
42934 </tgroup>
42935 </informaltable>
42936 <para>
42937 See <option>quota</option> above.
42938 </para>
42939 <para>
42940 <indexterm role="option">
42941 <primary><option>quota_size_regex</option></primary>
42942 </indexterm>
42943 </para>
42944 <informaltable frame="all">
42945 <tgroup cols="4" colsep="0" rowsep="0">
42946 <colspec colwidth="8*" align="left"/>
42947 <colspec colwidth="6*" align="center"/>
42948 <colspec colwidth="6*" align="center"/>
42949 <colspec colwidth="6*" align="right"/>
42950 <tbody>
42951 <row>
42952 <entry><option>quota_size_regex</option></entry>
42953 <entry>Use: <emphasis>appendfile</emphasis></entry>
42954 <entry>Type: <emphasis>string</emphasis></entry>
42955 <entry>Default: <emphasis>unset</emphasis></entry>
42956 </row>
42957 </tbody>
42958 </tgroup>
42959 </informaltable>
42960 <para>
42961 This option applies when one of the delivery modes that writes a separate file
42962 for each message is being used. When Exim wants to find the size of one of
42963 these files in order to test the quota, it first checks <option>quota_size_regex</option>.
42964 If this is set to a regular expression that matches the file name, and it
42965 captures one string, that string is interpreted as a representation of the
42966 file&#x2019;s size. The value of <option>quota_size_regex</option> is not expanded.
42967 </para>
42968 <para>
42969 This feature is useful only when users have no shell access to their mailboxes
42970 &ndash; otherwise they could defeat the quota simply by renaming the files. This
42971 facility can be used with maildir deliveries, by setting <option>maildir_tag</option> to add
42972 the file length to the file name. For example:
42973 </para>
42974 <literallayout class="monospaced">
42975 maildir_tag = ,S=$message_size
42976 quota_size_regex = ,S=(\d+)
42977 </literallayout>
42978 <para>
42979 An alternative to <varname>$message_size</varname> is <varname>$message_linecount</varname>, which contains the
42980 number of lines in the message.
42981 </para>
42982 <para>
42983 The regular expression should not assume that the length is at the end of the
42984 file name (even though <option>maildir_tag</option> puts it there) because maildir MUAs
42985 sometimes add other information onto the ends of message file names.
42986 </para>
42987 <para>
42988 Section <xref linkend="SECID136"/> contains further information.
42989 </para>
42990 <para>
42991 <indexterm role="option">
42992 <primary><option>quota_warn_message</option></primary>
42993 </indexterm>
42994 </para>
42995 <informaltable frame="all">
42996 <tgroup cols="4" colsep="0" rowsep="0">
42997 <colspec colwidth="8*" align="left"/>
42998 <colspec colwidth="6*" align="center"/>
42999 <colspec colwidth="6*" align="center"/>
43000 <colspec colwidth="6*" align="right"/>
43001 <tbody>
43002 <row>
43003 <entry><option>quota_warn_message</option></entry>
43004 <entry>Use: <emphasis>appendfile</emphasis></entry>
43005 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43006 <entry>Default: <emphasis>see below</emphasis></entry>
43007 </row>
43008 </tbody>
43009 </tgroup>
43010 </informaltable>
43011 <para>
43012 See below for the use of this option. If it is not set when
43013 <option>quota_warn_threshold</option> is set, it defaults to
43014 </para>
43015 <literallayout class="monospaced">
43016 quota_warn_message = "\
43017   To: $local_part@$domain\n\
43018   Subject: Your mailbox\n\n\
43019   This message is automatically created \
43020   by mail delivery software.\n\n\
43021   The size of your mailbox has exceeded \
43022   a warning threshold that is\n\
43023   set by the system administrator.\n"
43024 </literallayout>
43025 <para>
43026 <indexterm role="option">
43027 <primary><option>quota_warn_threshold</option></primary>
43028 </indexterm>
43029 </para>
43030 <informaltable frame="all">
43031 <tgroup cols="4" colsep="0" rowsep="0">
43032 <colspec colwidth="8*" align="left"/>
43033 <colspec colwidth="6*" align="center"/>
43034 <colspec colwidth="6*" align="center"/>
43035 <colspec colwidth="6*" align="right"/>
43036 <tbody>
43037 <row>
43038 <entry><option>quota_warn_threshold</option></entry>
43039 <entry>Use: <emphasis>appendfile</emphasis></entry>
43040 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43041 <entry>Default: <emphasis>0</emphasis></entry>
43042 </row>
43043 </tbody>
43044 </tgroup>
43045 </informaltable>
43046 <para>
43047 <indexterm role="concept">
43048 <primary>quota</primary>
43049 <secondary>warning threshold</secondary>
43050 </indexterm>
43051 <indexterm role="concept">
43052 <primary>mailbox</primary>
43053 <secondary>size warning</secondary>
43054 </indexterm>
43055 <indexterm role="concept">
43056 <primary>size</primary>
43057 <secondary>of mailbox</secondary>
43058 </indexterm>
43059 This option is expanded in the same way as <option>quota</option> (see above). If the
43060 resulting value is greater than zero, and delivery of the message causes the
43061 size of the file or total space in the directory tree to cross the given
43062 threshold, a warning message is sent. If <option>quota</option> is also set, the threshold
43063 may be specified as a percentage of it by following the value with a percent
43064 sign. For example:
43065 </para>
43066 <literallayout class="monospaced">
43067 quota = 10M
43068 quota_warn_threshold = 75%
43069 </literallayout>
43070 <para>
43071 If <option>quota</option> is not set, a setting of <option>quota_warn_threshold</option> that ends with a
43072 percent sign is ignored.
43073 </para>
43074 <para>
43075 The warning message itself is specified by the <option>quota_warn_message</option> option,
43076 and it must start with a <emphasis>To:</emphasis> header line containing the recipient(s) of the
43077 warning message. These do not necessarily have to include the recipient(s) of
43078 the original message. A <emphasis>Subject:</emphasis> line should also normally be supplied. You
43079 can include any other header lines that you want. If you do not include a
43080 <emphasis>From:</emphasis> line, the default is:
43081 </para>
43082 <literallayout class="monospaced">
43083 From: Mail Delivery System &lt;mailer-daemon@$qualify_domain_sender&gt;
43084 </literallayout>
43085 <para>
43086 <indexterm role="option">
43087 <primary><option>errors_reply_to</option></primary>
43088 </indexterm>
43089 If you supply a <emphasis>Reply-To:</emphasis> line, it overrides the global <option>errors_reply_to</option>
43090 option.
43091 </para>
43092 <para>
43093 The <option>quota</option> option does not have to be set in order to use this option; they
43094 are independent of one another except when the threshold is specified as a
43095 percentage.
43096 </para>
43097 <para>
43098 <indexterm role="option">
43099 <primary><option>use_bsmtp</option></primary>
43100 </indexterm>
43101 </para>
43102 <informaltable frame="all">
43103 <tgroup cols="4" colsep="0" rowsep="0">
43104 <colspec colwidth="8*" align="left"/>
43105 <colspec colwidth="6*" align="center"/>
43106 <colspec colwidth="6*" align="center"/>
43107 <colspec colwidth="6*" align="right"/>
43108 <tbody>
43109 <row>
43110 <entry><option>use_bsmtp</option></entry>
43111 <entry>Use: <emphasis>appendfile</emphasis></entry>
43112 <entry>Type: <emphasis>boolean</emphasis></entry>
43113 <entry>Default: <emphasis>false</emphasis></entry>
43114 </row>
43115 </tbody>
43116 </tgroup>
43117 </informaltable>
43118 <para>
43119 <indexterm role="concept">
43120 <primary>envelope sender</primary>
43121 </indexterm>
43122 If this option is set true, <command>appendfile</command> writes messages in <quote>batch SMTP</quote>
43123 format, with the envelope sender and recipient(s) included as SMTP commands. If
43124 you want to include a leading HELO command with such messages, you can do
43125 so by setting the <option>message_prefix</option> option. See section <xref linkend="SECTbatchSMTP"/>
43126 for details of batch SMTP.
43127 </para>
43128 <para>
43129 <indexterm role="option">
43130 <primary><option>use_crlf</option></primary>
43131 </indexterm>
43132 </para>
43133 <informaltable frame="all">
43134 <tgroup cols="4" colsep="0" rowsep="0">
43135 <colspec colwidth="8*" align="left"/>
43136 <colspec colwidth="6*" align="center"/>
43137 <colspec colwidth="6*" align="center"/>
43138 <colspec colwidth="6*" align="right"/>
43139 <tbody>
43140 <row>
43141 <entry><option>use_crlf</option></entry>
43142 <entry>Use: <emphasis>appendfile</emphasis></entry>
43143 <entry>Type: <emphasis>boolean</emphasis></entry>
43144 <entry>Default: <emphasis>false</emphasis></entry>
43145 </row>
43146 </tbody>
43147 </tgroup>
43148 </informaltable>
43149 <para>
43150 <indexterm role="concept">
43151 <primary>carriage return</primary>
43152 </indexterm>
43153 <indexterm role="concept">
43154 <primary>linefeed</primary>
43155 </indexterm>
43156 This option causes lines to be terminated with the two-character CRLF sequence
43157 (carriage return, linefeed) instead of just a linefeed character. In the case
43158 of batched SMTP, the byte sequence written to the file is then an exact image
43159 of what would be sent down a real SMTP connection.
43160 </para>
43161 <para>
43162 <emphasis role="bold">Note:</emphasis> The contents of the <option>message_prefix</option> and <option>message_suffix</option> options
43163 (which are used to supply the traditional <quote>From&nbsp;</quote> and blank line separators
43164 in Berkeley-style mailboxes) are written verbatim, so must contain their own
43165 carriage return characters if these are needed. In cases where these options
43166 have non-empty defaults, the values end with a single linefeed, so they must be
43167 changed to end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
43168 </para>
43169 <para>
43170 <indexterm role="option">
43171 <primary><option>use_fcntl_lock</option></primary>
43172 </indexterm>
43173 </para>
43174 <informaltable frame="all">
43175 <tgroup cols="4" colsep="0" rowsep="0">
43176 <colspec colwidth="8*" align="left"/>
43177 <colspec colwidth="6*" align="center"/>
43178 <colspec colwidth="6*" align="center"/>
43179 <colspec colwidth="6*" align="right"/>
43180 <tbody>
43181 <row>
43182 <entry><option>use_fcntl_lock</option></entry>
43183 <entry>Use: <emphasis>appendfile</emphasis></entry>
43184 <entry>Type: <emphasis>boolean</emphasis></entry>
43185 <entry>Default: <emphasis>see below</emphasis></entry>
43186 </row>
43187 </tbody>
43188 </tgroup>
43189 </informaltable>
43190 <para>
43191 This option controls the use of the <function>fcntl()</function> function to lock a file for
43192 exclusive use when a message is being appended. It is set by default unless
43193 <option>use_flock_lock</option> is set. Otherwise, it should be turned off only if you know
43194 that all your MUAs use lock file locking. When both <option>use_fcntl_lock</option> and
43195 <option>use_flock_lock</option> are unset, <option>use_lockfile</option> must be set.
43196 </para>
43197 <para>
43198 <indexterm role="option">
43199 <primary><option>use_flock_lock</option></primary>
43200 </indexterm>
43201 </para>
43202 <informaltable frame="all">
43203 <tgroup cols="4" colsep="0" rowsep="0">
43204 <colspec colwidth="8*" align="left"/>
43205 <colspec colwidth="6*" align="center"/>
43206 <colspec colwidth="6*" align="center"/>
43207 <colspec colwidth="6*" align="right"/>
43208 <tbody>
43209 <row>
43210 <entry><option>use_flock_lock</option></entry>
43211 <entry>Use: <emphasis>appendfile</emphasis></entry>
43212 <entry>Type: <emphasis>boolean</emphasis></entry>
43213 <entry>Default: <emphasis>false</emphasis></entry>
43214 </row>
43215 </tbody>
43216 </tgroup>
43217 </informaltable>
43218 <para>
43219 This option is provided to support the use of <function>flock()</function> for file locking, for
43220 the few situations where it is needed. Most modern operating systems support
43221 <function>fcntl()</function> and <function>lockf()</function> locking, and these two functions interwork with
43222 each other. Exim uses <function>fcntl()</function> locking by default.
43223 </para>
43224 <para>
43225 This option is required only if you are using an operating system where
43226 <function>flock()</function> is used by programs that access mailboxes (typically MUAs), and
43227 where <function>flock()</function> does not correctly interwork with <function>fcntl()</function>. You can use
43228 both <function>fcntl()</function> and <function>flock()</function> locking simultaneously if you want.
43229 </para>
43230 <para>
43231 <indexterm role="concept">
43232 <primary>Solaris</primary>
43233 <secondary><function>flock()</function> support</secondary>
43234 </indexterm>
43235 Not all operating systems provide <function>flock()</function>. Some versions of Solaris do not
43236 have it (and some, I think, provide a not quite right version built on top of
43237 <function>lockf()</function>). If the OS does not have <function>flock()</function>, Exim will be built without
43238 the ability to use it, and any attempt to do so will cause a configuration
43239 error.
43240 </para>
43241 <para>
43242 <emphasis role="bold">Warning</emphasis>: <function>flock()</function> locks do not work on NFS files (unless <function>flock()</function>
43243 is just being mapped onto <function>fcntl()</function> by the OS).
43244 </para>
43245 <para>
43246 <indexterm role="option">
43247 <primary><option>use_lockfile</option></primary>
43248 </indexterm>
43249 </para>
43250 <informaltable frame="all">
43251 <tgroup cols="4" colsep="0" rowsep="0">
43252 <colspec colwidth="8*" align="left"/>
43253 <colspec colwidth="6*" align="center"/>
43254 <colspec colwidth="6*" align="center"/>
43255 <colspec colwidth="6*" align="right"/>
43256 <tbody>
43257 <row>
43258 <entry><option>use_lockfile</option></entry>
43259 <entry>Use: <emphasis>appendfile</emphasis></entry>
43260 <entry>Type: <emphasis>boolean</emphasis></entry>
43261 <entry>Default: <emphasis>see below</emphasis></entry>
43262 </row>
43263 </tbody>
43264 </tgroup>
43265 </informaltable>
43266 <para>
43267 If this option is turned off, Exim does not attempt to create a lock file when
43268 appending to a mailbox file. In this situation, the only locking is by
43269 <function>fcntl()</function>. You should only turn <option>use_lockfile</option> off if you are absolutely
43270 sure that every MUA that is ever going to look at your users&#x2019; mailboxes uses
43271 <function>fcntl()</function> rather than a lock file, and even then only when you are not
43272 delivering over NFS from more than one host.
43273 </para>
43274 <para>
43275 <indexterm role="concept">
43276 <primary>NFS</primary>
43277 <secondary>lock file</secondary>
43278 </indexterm>
43279 In order to append to an NFS file safely from more than one host, it is
43280 necessary to take out a lock <emphasis>before</emphasis> opening the file, and the lock file
43281 achieves this. Otherwise, even with <function>fcntl()</function> locking, there is a risk of
43282 file corruption.
43283 </para>
43284 <para>
43285 The <option>use_lockfile</option> option is set by default unless <option>use_mbx_lock</option> is set.
43286 It is not possible to turn both <option>use_lockfile</option> and <option>use_fcntl_lock</option> off,
43287 except when <option>mbx_format</option> is set.
43288 </para>
43289 <para>
43290 <indexterm role="option">
43291 <primary><option>use_mbx_lock</option></primary>
43292 </indexterm>
43293 </para>
43294 <informaltable frame="all">
43295 <tgroup cols="4" colsep="0" rowsep="0">
43296 <colspec colwidth="8*" align="left"/>
43297 <colspec colwidth="6*" align="center"/>
43298 <colspec colwidth="6*" align="center"/>
43299 <colspec colwidth="6*" align="right"/>
43300 <tbody>
43301 <row>
43302 <entry><option>use_mbx_lock</option></entry>
43303 <entry>Use: <emphasis>appendfile</emphasis></entry>
43304 <entry>Type: <emphasis>boolean</emphasis></entry>
43305 <entry>Default: <emphasis>see below</emphasis></entry>
43306 </row>
43307 </tbody>
43308 </tgroup>
43309 </informaltable>
43310 <para>
43311 This option is available only if Exim has been compiled with SUPPORT_MBX
43312 set in <filename>Local/Makefile</filename>. Setting the option specifies that special MBX
43313 locking rules be used. It is set by default if <option>mbx_format</option> is set and none
43314 of the locking options are mentioned in the configuration. The locking rules
43315 are the same as are used by the <emphasis>c-client</emphasis> library that underlies Pine and
43316 the IMAP4 and POP daemons that come with it (see the discussion below). The
43317 rules allow for shared access to the mailbox. However, this kind of locking
43318 does not work when the mailbox is NFS mounted.
43319 </para>
43320 <para>
43321 You can set <option>use_mbx_lock</option> with either (or both) of <option>use_fcntl_lock</option> and
43322 <option>use_flock_lock</option> to control what kind of locking is used in implementing the
43323 MBX locking rules. The default is to use <function>fcntl()</function> if <option>use_mbx_lock</option> is set
43324 without <option>use_fcntl_lock</option> or <option>use_flock_lock</option>.
43325 </para>
43326 </section>
43327 <section id="SECTopappend">
43328 <title>Operational details for appending</title>
43329 <para>
43330 <indexterm role="concept">
43331 <primary>appending to a file</primary>
43332 </indexterm>
43333 <indexterm role="concept">
43334 <primary>file</primary>
43335 <secondary>appending</secondary>
43336 </indexterm>
43337 Before appending to a file, the following preparations are made:
43338 </para>
43339 <itemizedlist>
43340 <listitem>
43341 <para>
43342 If the name of the file is <filename>/dev/null</filename>, no action is taken, and a success
43343 return is given.
43344 </para>
43345 </listitem>
43346 <listitem>
43347 <para>
43348 <indexterm role="concept">
43349 <primary>directory creation</primary>
43350 </indexterm>
43351 If any directories on the file&#x2019;s path are missing, Exim creates them if the
43352 <option>create_directory</option> option is set. A created directory&#x2019;s mode is given by the
43353 <option>directory_mode</option> option.
43354 </para>
43355 </listitem>
43356 <listitem>
43357 <para>
43358 If <option>file_format</option> is set, the format of an existing file is checked. If this
43359 indicates that a different transport should be used, control is passed to that
43360 transport.
43361 </para>
43362 </listitem>
43363 <listitem>
43364 <para>
43365 <indexterm role="concept">
43366 <primary>file</primary>
43367 <secondary>locking</secondary>
43368 </indexterm>
43369 <indexterm role="concept">
43370 <primary>locking files</primary>
43371 </indexterm>
43372 <indexterm role="concept">
43373 <primary>NFS</primary>
43374 <secondary>lock file</secondary>
43375 </indexterm>
43376 If <option>use_lockfile</option> is set, a lock file is built in a way that will work
43377 reliably over NFS, as follows:
43378 </para>
43379 <orderedlist numeration="arabic">
43380 <listitem>
43381 <para>
43382 Create a <quote>hitching post</quote> file whose name is that of the lock file with the
43383 current time, primary host name, and process id added, by opening for writing
43384 as a new file. If this fails with an access error, delivery is deferred.
43385 </para>
43386 </listitem>
43387 <listitem>
43388 <para>
43389 Close the hitching post file, and hard link it to the lock file name.
43390 </para>
43391 </listitem>
43392 <listitem>
43393 <para>
43394 If the call to <function>link()</function> succeeds, creation of the lock file has succeeded.
43395 Unlink the hitching post name.
43396 </para>
43397 </listitem>
43398 <listitem>
43399 <para>
43400 Otherwise, use <function>stat()</function> to get information about the hitching post file, and
43401 then unlink hitching post name. If the number of links is exactly two, creation
43402 of the lock file succeeded but something (for example, an NFS server crash and
43403 restart) caused this fact not to be communicated to the <function>link()</function> call.
43404 </para>
43405 </listitem>
43406 <listitem>
43407 <para>
43408 If creation of the lock file failed, wait for <option>lock_interval</option> and try again,
43409 up to <option>lock_retries</option> times. However, since any program that writes to a
43410 mailbox should complete its task very quickly, it is reasonable to time out old
43411 lock files that are normally the result of user agent and system crashes. If an
43412 existing lock file is older than <option>lockfile_timeout</option> Exim attempts to unlink
43413 it before trying again.
43414 </para>
43415 </listitem>
43416 </orderedlist>
43417 </listitem>
43418 <listitem>
43419 <para>
43420 A call is made to <function>lstat()</function> to discover whether the main file exists, and if
43421 so, what its characteristics are. If <function>lstat()</function> fails for any reason other
43422 than non-existence, delivery is deferred.
43423 </para>
43424 </listitem>
43425 <listitem>
43426 <para>
43427 <indexterm role="concept">
43428 <primary>symbolic link</primary>
43429 <secondary>to mailbox</secondary>
43430 </indexterm>
43431 <indexterm role="concept">
43432 <primary>mailbox</primary>
43433 <secondary>symbolic link</secondary>
43434 </indexterm>
43435 If the file does exist and is a symbolic link, delivery is deferred, unless the
43436 <option>allow_symlink</option> option is set, in which case the ownership of the link is
43437 checked, and then <function>stat()</function> is called to find out about the real file, which
43438 is then subjected to the checks below. The check on the top-level link
43439 ownership prevents one user creating a link for another&#x2019;s mailbox in a sticky
43440 directory, though allowing symbolic links in this case is definitely not a good
43441 idea. If there is a chain of symbolic links, the intermediate ones are not
43442 checked.
43443 </para>
43444 </listitem>
43445 <listitem>
43446 <para>
43447 If the file already exists but is not a regular file, or if the file&#x2019;s owner
43448 and group (if the group is being checked &ndash; see <option>check_group</option> above) are
43449 different from the user and group under which the delivery is running,
43450 delivery is deferred.
43451 </para>
43452 </listitem>
43453 <listitem>
43454 <para>
43455 If the file&#x2019;s permissions are more generous than specified, they are reduced.
43456 If they are insufficient, delivery is deferred, unless <option>mode_fail_narrower</option>
43457 is set false, in which case the delivery is tried using the existing
43458 permissions.
43459 </para>
43460 </listitem>
43461 <listitem>
43462 <para>
43463 The file&#x2019;s inode number is saved, and the file is then opened for appending.
43464 If this fails because the file has vanished, <command>appendfile</command> behaves as if it
43465 hadn&#x2019;t existed (see below). For any other failures, delivery is deferred.
43466 </para>
43467 </listitem>
43468 <listitem>
43469 <para>
43470 If the file is opened successfully, check that the inode number hasn&#x2019;t
43471 changed, that it is still a regular file, and that the owner and permissions
43472 have not changed. If anything is wrong, defer delivery and freeze the message.
43473 </para>
43474 </listitem>
43475 <listitem>
43476 <para>
43477 If the file did not exist originally, defer delivery if the <option>file_must_exist</option>
43478 option is set. Otherwise, check that the file is being created in a permitted
43479 directory if the <option>create_file</option> option is set (deferring on failure), and then
43480 open for writing as a new file, with the O_EXCL and O_CREAT options,
43481 except when dealing with a symbolic link (the <option>allow_symlink</option> option must be
43482 set). In this case, which can happen if the link points to a non-existent file,
43483 the file is opened for writing using O_CREAT but not O_EXCL, because
43484 that prevents link following.
43485 </para>
43486 </listitem>
43487 <listitem>
43488 <para>
43489 <indexterm role="concept">
43490 <primary>loop</primary>
43491 <secondary>while file testing</secondary>
43492 </indexterm>
43493 If opening fails because the file exists, obey the tests given above for
43494 existing files. However, to avoid looping in a situation where the file is
43495 being continuously created and destroyed, the exists/not-exists loop is broken
43496 after 10 repetitions, and the message is then frozen.
43497 </para>
43498 </listitem>
43499 <listitem>
43500 <para>
43501 If opening fails with any other error, defer delivery.
43502 </para>
43503 </listitem>
43504 <listitem>
43505 <para>
43506 <indexterm role="concept">
43507 <primary>file</primary>
43508 <secondary>locking</secondary>
43509 </indexterm>
43510 <indexterm role="concept">
43511 <primary>locking files</primary>
43512 </indexterm>
43513 Once the file is open, unless both <option>use_fcntl_lock</option> and <option>use_flock_lock</option>
43514 are false, it is locked using <function>fcntl()</function> or <function>flock()</function> or both. If
43515 <option>use_mbx_lock</option> is false, an exclusive lock is requested in each case.
43516 However, if <option>use_mbx_lock</option> is true, Exim takes out a shared lock on the open
43517 file, and an exclusive lock on the file whose name is
43518 </para>
43519 <literallayout class="monospaced">
43520 /tmp/.&lt;device-number&gt;.&lt;inode-number&gt;
43521 </literallayout>
43522 <para>
43523 using the device and inode numbers of the open mailbox file, in accordance with
43524 the MBX locking rules. This file is created with a mode that is specified by
43525 the <option>lockfile_mode</option> option.
43526 </para>
43527 <para>
43528 If Exim fails to lock the file, there are two possible courses of action,
43529 depending on the value of the locking timeout. This is obtained from
43530 <option>lock_fcntl_timeout</option> or <option>lock_flock_timeout</option>, as appropriate.
43531 </para>
43532 <para>
43533 If the timeout value is zero, the file is closed, Exim waits for
43534 <option>lock_interval</option>, and then goes back and re-opens the file as above and tries
43535 to lock it again. This happens up to <option>lock_retries</option> times, after which the
43536 delivery is deferred.
43537 </para>
43538 <para>
43539 If the timeout has a value greater than zero, blocking calls to <function>fcntl()</function> or
43540 <function>flock()</function> are used (with the given timeout), so there has already been some
43541 waiting involved by the time locking fails. Nevertheless, Exim does not give up
43542 immediately. It retries up to
43543 </para>
43544 <literallayout class="monospaced">
43545 (lock_retries * lock_interval) / &lt;timeout&gt;
43546 </literallayout>
43547 <para>
43548 times (rounded up).
43549 </para>
43550 </listitem>
43551 </itemizedlist>
43552 <para>
43553 At the end of delivery, Exim closes the file (which releases the <function>fcntl()</function>
43554 and/or <function>flock()</function> locks) and then deletes the lock file if one was created.
43555 </para>
43556 </section>
43557 <section id="SECTopdir">
43558 <title>Operational details for delivery to a new file</title>
43559 <para>
43560 <indexterm role="concept">
43561 <primary>delivery</primary>
43562 <secondary>to single file</secondary>
43563 </indexterm>
43564 <indexterm role="concept">
43565 <primary><quote>From</quote> line</primary>
43566 </indexterm>
43567 When the <option>directory</option> option is set instead of <option>file</option>, each message is
43568 delivered into a newly-created file or set of files. When <command>appendfile</command> is
43569 activated directly from a <command>redirect</command> router, neither <option>file</option> nor
43570 <option>directory</option> is normally set, because the path for delivery is supplied by the
43571 router. (See for example, the <command>address_file</command> transport in the default
43572 configuration.) In this case, delivery is to a new file if either the path name
43573 ends in <literal>/</literal>, or the <option>maildir_format</option> or <option>mailstore_format</option> option is set.
43574 </para>
43575 <para>
43576 No locking is required while writing the message to a new file, so the various
43577 locking options of the transport are ignored. The <quote>From</quote> line that by default
43578 separates messages in a single file is not normally needed, nor is the escaping
43579 of message lines that start with <quote>From</quote>, and there is no need to ensure a
43580 newline at the end of each message. Consequently, the default values for
43581 <option>check_string</option>, <option>message_prefix</option>, and <option>message_suffix</option> are all unset when
43582 any of <option>directory</option>, <option>maildir_format</option>, or <option>mailstore_format</option> is set.
43583 </para>
43584 <para>
43585 If Exim is required to check a <option>quota</option> setting, it adds up the sizes of all
43586 the files in the delivery directory by default. However, you can specify a
43587 different directory by setting <option>quota_directory</option>. Also, for maildir
43588 deliveries (see below) the <filename>maildirfolder</filename> convention is honoured.
43589 </para>
43590 <para>
43591 <indexterm role="concept">
43592 <primary>maildir format</primary>
43593 </indexterm>
43594 <indexterm role="concept">
43595 <primary>mailstore format</primary>
43596 </indexterm>
43597 There are three different ways in which delivery to individual files can be
43598 done, controlled by the settings of the <option>maildir_format</option> and
43599 <option>mailstore_format</option> options. Note that code to support maildir or mailstore
43600 formats is not included in the binary unless SUPPORT_MAILDIR or
43601 SUPPORT_MAILSTORE, respectively, is set in <filename>Local/Makefile</filename>.
43602 </para>
43603 <para>
43604 <indexterm role="concept">
43605 <primary>directory creation</primary>
43606 </indexterm>
43607 In all three cases an attempt is made to create the directory and any necessary
43608 sub-directories if they do not exist, provided that the <option>create_directory</option>
43609 option is set (the default). The location of a created directory can be
43610 constrained by setting <option>create_file</option>. A created directory&#x2019;s mode is given by
43611 the <option>directory_mode</option> option. If creation fails, or if the
43612 <option>create_directory</option> option is not set when creation is required, delivery is
43613 deferred.
43614 </para>
43615 </section>
43616 <section id="SECTmaildirdelivery">
43617 <title>Maildir delivery</title>
43618 <para>
43619 <indexterm role="concept">
43620 <primary>maildir format</primary>
43621 <secondary>description of</secondary>
43622 </indexterm>
43623 If the <option>maildir_format</option> option is true, Exim delivers each message by writing
43624 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
43625 directory that is defined by the <option>directory</option> option (the <quote>delivery
43626 directory</quote>). If the delivery is successful, the file is renamed into the
43627 <filename>new</filename> subdirectory.
43628 </para>
43629 <para>
43630 In the file name, &lt;<emphasis>stime</emphasis>&gt; is the current time of day in seconds, and
43631 &lt;<emphasis>mtime</emphasis>&gt; is the microsecond fraction of the time. After a maildir delivery,
43632 Exim checks that the time-of-day clock has moved on by at least one microsecond
43633 before terminating the delivery process. This guarantees uniqueness for the
43634 file name. However, as a precaution, Exim calls <function>stat()</function> for the file before
43635 opening it. If any response other than ENOENT (does not exist) is given,
43636 Exim waits 2 seconds and tries again, up to <option>maildir_retries</option> times.
43637 </para>
43638 <para>
43639 Before Exim carries out a maildir delivery, it ensures that subdirectories
43640 called <filename>new</filename>, <filename>cur</filename>, and <filename>tmp</filename> exist in the delivery directory. If they
43641 do not exist, Exim tries to create them and any superior directories in their
43642 path, subject to the <option>create_directory</option> and <option>create_file</option> options. If the
43643 <option>maildirfolder_create_regex</option> option is set, and the regular expression it
43644 contains matches the delivery directory, Exim also ensures that a file called
43645 <filename>maildirfolder</filename> exists in the delivery directory. If a missing directory or
43646 <filename>maildirfolder</filename> file cannot be created, delivery is deferred.
43647 </para>
43648 <para>
43649 These features make it possible to use Exim to create all the necessary files
43650 and directories in a maildir mailbox, including subdirectories for maildir++
43651 folders. Consider this example:
43652 </para>
43653 <literallayout class="monospaced">
43654 maildir_format = true
43655 directory = /var/mail/$local_part\
43656            ${if eq{$local_part_suffix}{}{}\
43657            {/.${substr_1:$local_part_suffix}}}
43658 maildirfolder_create_regex = /\.[^/]+$
43659 </literallayout>
43660 <para>
43661 If <varname>$local_part_suffix</varname> is empty (there was no suffix for the local part),
43662 delivery is into a toplevel maildir with a name like <filename>/var/mail/pimbo</filename> (for
43663 the user called <emphasis>pimbo</emphasis>). The pattern in <option>maildirfolder_create_regex</option> does
43664 not match this name, so Exim will not look for or create the file
43665 <filename>/var/mail/pimbo/maildirfolder</filename>, though it will create
43666 <filename>/var/mail/pimbo/{cur,new,tmp}</filename> if necessary.
43667 </para>
43668 <para>
43669 However, if <varname>$local_part_suffix</varname> contains <literal>-eximusers</literal> (for example),
43670 delivery is into the maildir++ folder <filename>/var/mail/pimbo/.eximusers</filename>, which
43671 does match <option>maildirfolder_create_regex</option>. In this case, Exim will create
43672 <filename>/var/mail/pimbo/.eximusers/maildirfolder</filename> as well as the three maildir
43673 directories <filename>/var/mail/pimbo/.eximusers/{cur,new,tmp}</filename>.
43674 </para>
43675 <para>
43676 <emphasis role="bold">Warning:</emphasis> Take care when setting <option>maildirfolder_create_regex</option> that it does
43677 not inadvertently match the toplevel maildir directory, because a
43678 <filename>maildirfolder</filename> file at top level would completely break quota calculations.
43679 </para>
43680 <para>
43681 <indexterm role="concept">
43682 <primary>quota</primary>
43683 <secondary>in maildir delivery</secondary>
43684 </indexterm>
43685 <indexterm role="concept">
43686 <primary>maildir++</primary>
43687 </indexterm>
43688 If Exim is required to check a <option>quota</option> setting before a maildir delivery, and
43689 <option>quota_directory</option> is not set, it looks for a file called <filename>maildirfolder</filename> in
43690 the maildir directory (alongside <filename>new</filename>, <filename>cur</filename>, <filename>tmp</filename>). If this exists,
43691 Exim assumes the directory is a maildir++ folder directory, which is one level
43692 down from the user&#x2019;s top level mailbox directory. This causes it to start at
43693 the parent directory instead of the current directory when calculating the
43694 amount of space used.
43695 </para>
43696 <para>
43697 One problem with delivering into a multi-file mailbox is that it is
43698 computationally expensive to compute the size of the mailbox for quota
43699 checking. Various approaches have been taken to reduce the amount of work
43700 needed. The next two sections describe two of them. A third alternative is to
43701 use some external process for maintaining the size data, and use the expansion
43702 of the <option>mailbox_size</option> option as a way of importing it into Exim.
43703 </para>
43704 </section>
43705 <section id="SECID135">
43706 <title>Using tags to record message sizes</title>
43707 <para>
43708 If <option>maildir_tag</option> is set, the string is expanded for each delivery.
43709 When the maildir file is renamed into the <filename>new</filename> sub-directory, the
43710 tag is added to its name. However, if adding the tag takes the length of the
43711 name to the point where the test <function>stat()</function> call fails with ENAMETOOLONG,
43712 the tag is dropped and the maildir file is created with no tag.
43713 </para>
43714 <para>
43715 <indexterm role="variable">
43716 <primary><varname>$message_size</varname></primary>
43717 </indexterm>
43718 Tags can be used to encode the size of files in their names; see
43719 <option>quota_size_regex</option> above for an example. The expansion of <option>maildir_tag</option>
43720 happens after the message has been written. The value of the <varname>$message_size</varname>
43721 variable is set to the number of bytes actually written. If the expansion is
43722 forced to fail, the tag is ignored, but a non-forced failure causes delivery to
43723 be deferred. The expanded tag may contain any printing characters except <quote>/</quote>.
43724 Non-printing characters in the string are ignored; if the resulting string is
43725 empty, it is ignored. If it starts with an alphanumeric character, a leading
43726 colon is inserted; this default has not proven to be the path that popular
43727 maildir implementations have chosen (but changing it in Exim would break
43728 backwards compatibility).
43729 </para>
43730 <para>
43731 For one common implementation, you might set:
43732 </para>
43733 <literallayout class="monospaced">
43734 maildir_tag = ,S=${message_size}
43735 </literallayout>
43736 <para>
43737 but you should check the documentation of the other software to be sure.
43738 </para>
43739 <para>
43740 It is advisable to also set <option>quota_size_regex</option> when setting <option>maildir_tag</option>
43741 as this allows Exim to extract the size from your tag, instead of having to
43742 <function>stat()</function> each message file.
43743 </para>
43744 </section>
43745 <section id="SECID136">
43746 <title>Using a maildirsize file</title>
43747 <para>
43748 <indexterm role="concept">
43749 <primary>quota</primary>
43750 <secondary>in maildir delivery</secondary>
43751 </indexterm>
43752 <indexterm role="concept">
43753 <primary>maildir format</primary>
43754 <secondary><filename>maildirsize</filename> file</secondary>
43755 </indexterm>
43756 If <option>maildir_use_size_file</option> is true, Exim implements the maildir++ rules for
43757 storing quota and message size information in a file called <filename>maildirsize</filename>
43758 within the toplevel maildir directory. If this file does not exist, Exim
43759 creates it, setting the quota from the <option>quota</option> option of the transport. If
43760 the maildir directory itself does not exist, it is created before any attempt
43761 to write a <filename>maildirsize</filename> file.
43762 </para>
43763 <para>
43764 The <filename>maildirsize</filename> file is used to hold information about the sizes of
43765 messages in the maildir, thus speeding up quota calculations. The quota value
43766 in the file is just a cache; if the quota is changed in the transport, the new
43767 value overrides the cached value when the next message is delivered. The cache
43768 is maintained for the benefit of other programs that access the maildir and
43769 need to know the quota.
43770 </para>
43771 <para>
43772 If the <option>quota</option> option in the transport is unset or zero, the <filename>maildirsize</filename>
43773 file is maintained (with a zero quota setting), but no quota is imposed.
43774 </para>
43775 <para>
43776 A regular expression is available for controlling which directories in the
43777 maildir participate in quota calculations when a <filename>maildirsizefile</filename> is in use.
43778 See the description of the <option>maildir_quota_directory_regex</option> option above for
43779 details.
43780 </para>
43781 </section>
43782 <section id="SECID137">
43783 <title>Mailstore delivery</title>
43784 <para>
43785 <indexterm role="concept">
43786 <primary>mailstore format</primary>
43787 <secondary>description of</secondary>
43788 </indexterm>
43789 If the <option>mailstore_format</option> option is true, each message is written as two
43790 files in the given directory. A unique base name is constructed from the
43791 message id and the current delivery process, and the files that are written use
43792 this base name plus the suffixes <filename>.env</filename> and <filename>.msg</filename>. The <filename>.env</filename> file
43793 contains the message&#x2019;s envelope, and the <filename>.msg</filename> file contains the message
43794 itself. The base name is placed in the variable <varname>$mailstore_basename</varname>.
43795 </para>
43796 <para>
43797 During delivery, the envelope is first written to a file with the suffix
43798 <filename>.tmp</filename>. The <filename>.msg</filename> file is then written, and when it is complete, the
43799 <filename>.tmp</filename> file is renamed as the <filename>.env</filename> file. Programs that access messages in
43800 mailstore format should wait for the presence of both a <filename>.msg</filename> and a <filename>.env</filename>
43801 file before accessing either of them. An alternative approach is to wait for
43802 the absence of a <filename>.tmp</filename> file.
43803 </para>
43804 <para>
43805 The envelope file starts with any text defined by the <option>mailstore_prefix</option>
43806 option, expanded and terminated by a newline if there isn&#x2019;t one. Then follows
43807 the sender address on one line, then all the recipient addresses, one per line.
43808 There can be more than one recipient only if the <option>batch_max</option> option is set
43809 greater than one. Finally, <option>mailstore_suffix</option> is expanded and the result
43810 appended to the file, followed by a newline if it does not end with one.
43811 </para>
43812 <para>
43813 If expansion of <option>mailstore_prefix</option> or <option>mailstore_suffix</option> ends with a forced
43814 failure, it is ignored. Other expansion errors are treated as serious
43815 configuration errors, and delivery is deferred. The variable
43816 <varname>$mailstore_basename</varname> is available for use during these expansions.
43817 </para>
43818 </section>
43819 <section id="SECID138">
43820 <title>Non-special new file delivery</title>
43821 <para>
43822 If neither <option>maildir_format</option> nor <option>mailstore_format</option> is set, a single new
43823 file is created directly in the named directory. For example, when delivering
43824 messages into files in batched SMTP format for later delivery to some host (see
43825 section <xref linkend="SECTbatchSMTP"/>), a setting such as
43826 </para>
43827 <literallayout class="monospaced">
43828 directory = /var/bsmtp/$host
43829 </literallayout>
43830 <para>
43831 might be used. A message is written to a file with a temporary name, which is
43832 then renamed when the delivery is complete. The final name is obtained by
43833 expanding the contents of the <option>directory_file</option> option.
43834 <indexterm role="concept" startref="IIDapptra1" class="endofrange"/>
43835 <indexterm role="concept" startref="IIDapptra2" class="endofrange"/>
43836 </para>
43837 </section>
43838 </chapter>
43839
43840 <chapter id="CHID8">
43841 <title>The autoreply transport</title>
43842 <para>
43843 <indexterm role="concept" id="IIDauttra1" class="startofrange">
43844 <primary>transports</primary>
43845 <secondary><command>autoreply</command></secondary>
43846 </indexterm>
43847 <indexterm role="concept" id="IIDauttra2" class="startofrange">
43848 <primary><command>autoreply</command> transport</primary>
43849 </indexterm>
43850 The <command>autoreply</command> transport is not a true transport in that it does not cause
43851 the message to be transmitted. Instead, it generates a new mail message as an
43852 automatic reply to the incoming message. <emphasis>References:</emphasis> and
43853 <emphasis>Auto-Submitted:</emphasis> header lines are included. These are constructed according
43854 to the rules in RFCs 2822 and 3834, respectively.
43855 </para>
43856 <para>
43857 If the router that passes the message to this transport does not have the
43858 <option>unseen</option> option set, the original message (for the current recipient) is not
43859 delivered anywhere. However, when the <option>unseen</option> option is set on the router
43860 that passes the message to this transport, routing of the address continues, so
43861 another router can set up a normal message delivery.
43862 </para>
43863 <para>
43864 The <command>autoreply</command> transport is usually run as the result of mail filtering, a
43865 <quote>vacation</quote> message being the standard example. However, it can also be run
43866 directly from a router like any other transport. To reduce the possibility of
43867 message cascades, messages created by the <command>autoreply</command> transport always have
43868 empty envelope sender addresses, like bounce messages.
43869 </para>
43870 <para>
43871 The parameters of the message to be sent can be specified in the configuration
43872 by options described below. However, these are used only when the address
43873 passed to the transport does not contain its own reply information. When the
43874 transport is run as a consequence of a
43875 <option>mail</option>
43876 or <option>vacation</option> command in a filter file, the parameters of the message are
43877 supplied by the filter, and passed with the address. The transport&#x2019;s options
43878 that define the message are then ignored (so they are not usually set in this
43879 case). The message is specified entirely by the filter or by the transport; it
43880 is never built from a mixture of options. However, the <option>file_optional</option>,
43881 <option>mode</option>, and <option>return_message</option> options apply in all cases.
43882 </para>
43883 <para>
43884 <command>Autoreply</command> is implemented as a local transport. When used as a result of a
43885 command in a user&#x2019;s filter file, <command>autoreply</command> normally runs under the uid and
43886 gid of the user, and with appropriate current and home directories (see chapter
43887 <xref linkend="CHAPenvironment"/>).
43888 </para>
43889 <para>
43890 There is a subtle difference between routing a message to a <command>pipe</command> transport
43891 that generates some text to be returned to the sender, and routing it to an
43892 <command>autoreply</command> transport. This difference is noticeable only if more than one
43893 address from the same message is so handled. In the case of a pipe, the
43894 separate outputs from the different addresses are gathered up and returned to
43895 the sender in a single message, whereas if <command>autoreply</command> is used, a separate
43896 message is generated for each address that is passed to it.
43897 </para>
43898 <para>
43899 Non-printing characters are not permitted in the header lines generated for the
43900 message that <command>autoreply</command> creates, with the exception of newlines that are
43901 immediately followed by white space. If any non-printing characters are found,
43902 the transport defers.
43903 Whether characters with the top bit set count as printing characters or not is
43904 controlled by the <option>print_topbitchars</option> global option.
43905 </para>
43906 <para>
43907 If any of the generic options for manipulating headers (for example,
43908 <option>headers_add</option>) are set on an <command>autoreply</command> transport, they apply to the copy
43909 of the original message that is included in the generated message when
43910 <option>return_message</option> is set. They do not apply to the generated message itself.
43911 </para>
43912 <para>
43913 <indexterm role="variable">
43914 <primary><varname>$sender_address</varname></primary>
43915 </indexterm>
43916 If the <command>autoreply</command> transport receives return code 2 from Exim when it submits
43917 the message, indicating that there were no recipients, it does not treat this
43918 as an error. This means that autoreplies sent to <varname>$sender_address</varname> when this
43919 is empty (because the incoming message is a bounce message) do not cause
43920 problems. They are just discarded.
43921 </para>
43922 <section id="SECID139">
43923 <title>Private options for autoreply</title>
43924 <para>
43925 <indexterm role="concept">
43926 <primary>options</primary>
43927 <secondary><command>autoreply</command> transport</secondary>
43928 </indexterm>
43929 </para>
43930 <para>
43931 <indexterm role="option">
43932 <primary><option>bcc</option></primary>
43933 </indexterm>
43934 </para>
43935 <informaltable frame="all">
43936 <tgroup cols="4" colsep="0" rowsep="0">
43937 <colspec colwidth="8*" align="left"/>
43938 <colspec colwidth="6*" align="center"/>
43939 <colspec colwidth="6*" align="center"/>
43940 <colspec colwidth="6*" align="right"/>
43941 <tbody>
43942 <row>
43943 <entry><option>bcc</option></entry>
43944 <entry>Use: <emphasis>autoreply</emphasis></entry>
43945 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43946 <entry>Default: <emphasis>unset</emphasis></entry>
43947 </row>
43948 </tbody>
43949 </tgroup>
43950 </informaltable>
43951 <para>
43952 This specifies the addresses that are to receive <quote>blind carbon copies</quote> of the
43953 message when the message is specified by the transport.
43954 </para>
43955 <para>
43956 <indexterm role="option">
43957 <primary><option>cc</option></primary>
43958 </indexterm>
43959 </para>
43960 <informaltable frame="all">
43961 <tgroup cols="4" colsep="0" rowsep="0">
43962 <colspec colwidth="8*" align="left"/>
43963 <colspec colwidth="6*" align="center"/>
43964 <colspec colwidth="6*" align="center"/>
43965 <colspec colwidth="6*" align="right"/>
43966 <tbody>
43967 <row>
43968 <entry><option>cc</option></entry>
43969 <entry>Use: <emphasis>autoreply</emphasis></entry>
43970 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43971 <entry>Default: <emphasis>unset</emphasis></entry>
43972 </row>
43973 </tbody>
43974 </tgroup>
43975 </informaltable>
43976 <para>
43977 This specifies recipients of the message and the contents of the <emphasis>Cc:</emphasis> header
43978 when the message is specified by the transport.
43979 </para>
43980 <para>
43981 <indexterm role="option">
43982 <primary><option>file</option></primary>
43983 </indexterm>
43984 </para>
43985 <informaltable frame="all">
43986 <tgroup cols="4" colsep="0" rowsep="0">
43987 <colspec colwidth="8*" align="left"/>
43988 <colspec colwidth="6*" align="center"/>
43989 <colspec colwidth="6*" align="center"/>
43990 <colspec colwidth="6*" align="right"/>
43991 <tbody>
43992 <row>
43993 <entry><option>file</option></entry>
43994 <entry>Use: <emphasis>autoreply</emphasis></entry>
43995 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43996 <entry>Default: <emphasis>unset</emphasis></entry>
43997 </row>
43998 </tbody>
43999 </tgroup>
44000 </informaltable>
44001 <para>
44002 The contents of the file are sent as the body of the message when the message
44003 is specified by the transport. If both <option>file</option> and <option>text</option> are set, the text
44004 string comes first.
44005 </para>
44006 <para>
44007 <indexterm role="option">
44008 <primary><option>file_expand</option></primary>
44009 </indexterm>
44010 </para>
44011 <informaltable frame="all">
44012 <tgroup cols="4" colsep="0" rowsep="0">
44013 <colspec colwidth="8*" align="left"/>
44014 <colspec colwidth="6*" align="center"/>
44015 <colspec colwidth="6*" align="center"/>
44016 <colspec colwidth="6*" align="right"/>
44017 <tbody>
44018 <row>
44019 <entry><option>file_expand</option></entry>
44020 <entry>Use: <emphasis>autoreply</emphasis></entry>
44021 <entry>Type: <emphasis>boolean</emphasis></entry>
44022 <entry>Default: <emphasis>false</emphasis></entry>
44023 </row>
44024 </tbody>
44025 </tgroup>
44026 </informaltable>
44027 <para>
44028 If this is set, the contents of the file named by the <option>file</option> option are
44029 subjected to string expansion as they are added to the message.
44030 </para>
44031 <para>
44032 <indexterm role="option">
44033 <primary><option>file_optional</option></primary>
44034 </indexterm>
44035 </para>
44036 <informaltable frame="all">
44037 <tgroup cols="4" colsep="0" rowsep="0">
44038 <colspec colwidth="8*" align="left"/>
44039 <colspec colwidth="6*" align="center"/>
44040 <colspec colwidth="6*" align="center"/>
44041 <colspec colwidth="6*" align="right"/>
44042 <tbody>
44043 <row>
44044 <entry><option>file_optional</option></entry>
44045 <entry>Use: <emphasis>autoreply</emphasis></entry>
44046 <entry>Type: <emphasis>boolean</emphasis></entry>
44047 <entry>Default: <emphasis>false</emphasis></entry>
44048 </row>
44049 </tbody>
44050 </tgroup>
44051 </informaltable>
44052 <para>
44053 If this option is true, no error is generated if the file named by the <option>file</option>
44054 option or passed with the address does not exist or cannot be read.
44055 </para>
44056 <para>
44057 <indexterm role="option">
44058 <primary><option>from</option></primary>
44059 </indexterm>
44060 </para>
44061 <informaltable frame="all">
44062 <tgroup cols="4" colsep="0" rowsep="0">
44063 <colspec colwidth="8*" align="left"/>
44064 <colspec colwidth="6*" align="center"/>
44065 <colspec colwidth="6*" align="center"/>
44066 <colspec colwidth="6*" align="right"/>
44067 <tbody>
44068 <row>
44069 <entry><option>from</option></entry>
44070 <entry>Use: <emphasis>autoreply</emphasis></entry>
44071 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44072 <entry>Default: <emphasis>unset</emphasis></entry>
44073 </row>
44074 </tbody>
44075 </tgroup>
44076 </informaltable>
44077 <para>
44078 This specifies the contents of the <emphasis>From:</emphasis> header when the message is
44079 specified by the transport.
44080 </para>
44081 <para>
44082 <indexterm role="option">
44083 <primary><option>headers</option></primary>
44084 </indexterm>
44085 </para>
44086 <informaltable frame="all">
44087 <tgroup cols="4" colsep="0" rowsep="0">
44088 <colspec colwidth="8*" align="left"/>
44089 <colspec colwidth="6*" align="center"/>
44090 <colspec colwidth="6*" align="center"/>
44091 <colspec colwidth="6*" align="right"/>
44092 <tbody>
44093 <row>
44094 <entry><option>headers</option></entry>
44095 <entry>Use: <emphasis>autoreply</emphasis></entry>
44096 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44097 <entry>Default: <emphasis>unset</emphasis></entry>
44098 </row>
44099 </tbody>
44100 </tgroup>
44101 </informaltable>
44102 <para>
44103 This specifies additional RFC 2822 headers that are to be added to the message
44104 when the message is specified by the transport. Several can be given by using
44105 <quote>\n</quote> to separate them. There is no check on the format.
44106 </para>
44107 <para>
44108 <indexterm role="option">
44109 <primary><option>log</option></primary>
44110 </indexterm>
44111 </para>
44112 <informaltable frame="all">
44113 <tgroup cols="4" colsep="0" rowsep="0">
44114 <colspec colwidth="8*" align="left"/>
44115 <colspec colwidth="6*" align="center"/>
44116 <colspec colwidth="6*" align="center"/>
44117 <colspec colwidth="6*" align="right"/>
44118 <tbody>
44119 <row>
44120 <entry><option>log</option></entry>
44121 <entry>Use: <emphasis>autoreply</emphasis></entry>
44122 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44123 <entry>Default: <emphasis>unset</emphasis></entry>
44124 </row>
44125 </tbody>
44126 </tgroup>
44127 </informaltable>
44128 <para>
44129 This option names a file in which a record of every message sent is logged when
44130 the message is specified by the transport.
44131 </para>
44132 <para>
44133 <indexterm role="option">
44134 <primary><option>mode</option></primary>
44135 </indexterm>
44136 </para>
44137 <informaltable frame="all">
44138 <tgroup cols="4" colsep="0" rowsep="0">
44139 <colspec colwidth="8*" align="left"/>
44140 <colspec colwidth="6*" align="center"/>
44141 <colspec colwidth="6*" align="center"/>
44142 <colspec colwidth="6*" align="right"/>
44143 <tbody>
44144 <row>
44145 <entry><option>mode</option></entry>
44146 <entry>Use: <emphasis>autoreply</emphasis></entry>
44147 <entry>Type: <emphasis>octal integer</emphasis></entry>
44148 <entry>Default: <emphasis>0600</emphasis></entry>
44149 </row>
44150 </tbody>
44151 </tgroup>
44152 </informaltable>
44153 <para>
44154 If either the log file or the <quote>once</quote> file has to be created, this mode is
44155 used.
44156 </para>
44157 <para>
44158 <indexterm role="option">
44159 <primary><option>never_mail</option></primary>
44160 </indexterm>
44161 </para>
44162 <informaltable frame="all">
44163 <tgroup cols="4" colsep="0" rowsep="0">
44164 <colspec colwidth="8*" align="left"/>
44165 <colspec colwidth="6*" align="center"/>
44166 <colspec colwidth="6*" align="center"/>
44167 <colspec colwidth="6*" align="right"/>
44168 <tbody>
44169 <row>
44170 <entry><option>never_mail</option></entry>
44171 <entry>Use: <emphasis>autoreply</emphasis></entry>
44172 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
44173 <entry>Default: <emphasis>unset</emphasis></entry>
44174 </row>
44175 </tbody>
44176 </tgroup>
44177 </informaltable>
44178 <para>
44179 If any run of the transport creates a message with a recipient that matches any
44180 item in the list, that recipient is quietly discarded. If all recipients are
44181 discarded, no message is created. This applies both when the recipients are
44182 generated by a filter and when they are specified in the transport.
44183 </para>
44184 <para>
44185 <indexterm role="option">
44186 <primary><option>once</option></primary>
44187 </indexterm>
44188 </para>
44189 <informaltable frame="all">
44190 <tgroup cols="4" colsep="0" rowsep="0">
44191 <colspec colwidth="8*" align="left"/>
44192 <colspec colwidth="6*" align="center"/>
44193 <colspec colwidth="6*" align="center"/>
44194 <colspec colwidth="6*" align="right"/>
44195 <tbody>
44196 <row>
44197 <entry><option>once</option></entry>
44198 <entry>Use: <emphasis>autoreply</emphasis></entry>
44199 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44200 <entry>Default: <emphasis>unset</emphasis></entry>
44201 </row>
44202 </tbody>
44203 </tgroup>
44204 </informaltable>
44205 <para>
44206 This option names a file or DBM database in which a record of each <emphasis>To:</emphasis>
44207 recipient is kept when the message is specified by the transport. <emphasis role="bold">Note</emphasis>:
44208 This does not apply to <emphasis>Cc:</emphasis> or <emphasis>Bcc:</emphasis> recipients.
44209 </para>
44210 <para>
44211 If <option>once</option> is unset, or is set to an empty string, the message is always sent.
44212 By default, if <option>once</option> is set to a non-empty file name, the message
44213 is not sent if a potential recipient is already listed in the database.
44214 However, if the <option>once_repeat</option> option specifies a time greater than zero, the
44215 message is sent if that much time has elapsed since a message was last sent to
44216 this recipient. A setting of zero time for <option>once_repeat</option> (the default)
44217 prevents a message from being sent a second time &ndash; in this case, zero means
44218 infinity.
44219 </para>
44220 <para>
44221 If <option>once_file_size</option> is zero, a DBM database is used to remember recipients,
44222 and it is allowed to grow as large as necessary. If <option>once_file_size</option> is set
44223 greater than zero, it changes the way Exim implements the <option>once</option> option.
44224 Instead of using a DBM file to record every recipient it sends to, it uses a
44225 regular file, whose size will never get larger than the given value.
44226 </para>
44227 <para>
44228 In the file, Exim keeps a linear list of recipient addresses and the times at
44229 which they were sent messages. If the file is full when a new address needs to
44230 be added, the oldest address is dropped. If <option>once_repeat</option> is not set, this
44231 means that a given recipient may receive multiple messages, but at
44232 unpredictable intervals that depend on the rate of turnover of addresses in the
44233 file. If <option>once_repeat</option> is set, it specifies a maximum time between repeats.
44234 </para>
44235 <para>
44236 <indexterm role="option">
44237 <primary><option>once_file_size</option></primary>
44238 </indexterm>
44239 </para>
44240 <informaltable frame="all">
44241 <tgroup cols="4" colsep="0" rowsep="0">
44242 <colspec colwidth="8*" align="left"/>
44243 <colspec colwidth="6*" align="center"/>
44244 <colspec colwidth="6*" align="center"/>
44245 <colspec colwidth="6*" align="right"/>
44246 <tbody>
44247 <row>
44248 <entry><option>once_file_size</option></entry>
44249 <entry>Use: <emphasis>autoreply</emphasis></entry>
44250 <entry>Type: <emphasis>integer</emphasis></entry>
44251 <entry>Default: <emphasis>0</emphasis></entry>
44252 </row>
44253 </tbody>
44254 </tgroup>
44255 </informaltable>
44256 <para>
44257 See <option>once</option> above.
44258 </para>
44259 <para>
44260 <indexterm role="option">
44261 <primary><option>once_repeat</option></primary>
44262 </indexterm>
44263 </para>
44264 <informaltable frame="all">
44265 <tgroup cols="4" colsep="0" rowsep="0">
44266 <colspec colwidth="8*" align="left"/>
44267 <colspec colwidth="6*" align="center"/>
44268 <colspec colwidth="6*" align="center"/>
44269 <colspec colwidth="6*" align="right"/>
44270 <tbody>
44271 <row>
44272 <entry><option>once_repeat</option></entry>
44273 <entry>Use: <emphasis>autoreply</emphasis></entry>
44274 <entry>Type: <emphasis>time</emphasis>&dagger;<emphasis></emphasis></entry>
44275 <entry>Default: <emphasis>0s</emphasis></entry>
44276 </row>
44277 </tbody>
44278 </tgroup>
44279 </informaltable>
44280 <para>
44281 See <option>once</option> above.
44282 After expansion, the value of this option must be a valid time value.
44283 </para>
44284 <para>
44285 <indexterm role="option">
44286 <primary><option>reply_to</option></primary>
44287 </indexterm>
44288 </para>
44289 <informaltable frame="all">
44290 <tgroup cols="4" colsep="0" rowsep="0">
44291 <colspec colwidth="8*" align="left"/>
44292 <colspec colwidth="6*" align="center"/>
44293 <colspec colwidth="6*" align="center"/>
44294 <colspec colwidth="6*" align="right"/>
44295 <tbody>
44296 <row>
44297 <entry><option>reply_to</option></entry>
44298 <entry>Use: <emphasis>autoreply</emphasis></entry>
44299 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44300 <entry>Default: <emphasis>unset</emphasis></entry>
44301 </row>
44302 </tbody>
44303 </tgroup>
44304 </informaltable>
44305 <para>
44306 This specifies the contents of the <emphasis>Reply-To:</emphasis> header when the message is
44307 specified by the transport.
44308 </para>
44309 <para>
44310 <indexterm role="option">
44311 <primary><option>return_message</option></primary>
44312 </indexterm>
44313 </para>
44314 <informaltable frame="all">
44315 <tgroup cols="4" colsep="0" rowsep="0">
44316 <colspec colwidth="8*" align="left"/>
44317 <colspec colwidth="6*" align="center"/>
44318 <colspec colwidth="6*" align="center"/>
44319 <colspec colwidth="6*" align="right"/>
44320 <tbody>
44321 <row>
44322 <entry><option>return_message</option></entry>
44323 <entry>Use: <emphasis>autoreply</emphasis></entry>
44324 <entry>Type: <emphasis>boolean</emphasis></entry>
44325 <entry>Default: <emphasis>false</emphasis></entry>
44326 </row>
44327 </tbody>
44328 </tgroup>
44329 </informaltable>
44330 <para>
44331 If this is set, a copy of the original message is returned with the new
44332 message, subject to the maximum size set in the <option>return_size_limit</option> global
44333 configuration option.
44334 </para>
44335 <para>
44336 <indexterm role="option">
44337 <primary><option>subject</option></primary>
44338 </indexterm>
44339 </para>
44340 <informaltable frame="all">
44341 <tgroup cols="4" colsep="0" rowsep="0">
44342 <colspec colwidth="8*" align="left"/>
44343 <colspec colwidth="6*" align="center"/>
44344 <colspec colwidth="6*" align="center"/>
44345 <colspec colwidth="6*" align="right"/>
44346 <tbody>
44347 <row>
44348 <entry><option>subject</option></entry>
44349 <entry>Use: <emphasis>autoreply</emphasis></entry>
44350 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44351 <entry>Default: <emphasis>unset</emphasis></entry>
44352 </row>
44353 </tbody>
44354 </tgroup>
44355 </informaltable>
44356 <para>
44357 This specifies the contents of the <emphasis>Subject:</emphasis> header when the message is
44358 specified by the transport. It is tempting to quote the original subject in
44359 automatic responses. For example:
44360 </para>
44361 <literallayout class="monospaced">
44362 subject = Re: $h_subject:
44363 </literallayout>
44364 <para>
44365 There is a danger in doing this, however. It may allow a third party to
44366 subscribe your users to an opt-in mailing list, provided that the list accepts
44367 bounce messages as subscription confirmations. Well-managed lists require a
44368 non-bounce message to confirm a subscription, so the danger is relatively
44369 small.
44370 </para>
44371 <para>
44372 <indexterm role="option">
44373 <primary><option>text</option></primary>
44374 </indexterm>
44375 </para>
44376 <informaltable frame="all">
44377 <tgroup cols="4" colsep="0" rowsep="0">
44378 <colspec colwidth="8*" align="left"/>
44379 <colspec colwidth="6*" align="center"/>
44380 <colspec colwidth="6*" align="center"/>
44381 <colspec colwidth="6*" align="right"/>
44382 <tbody>
44383 <row>
44384 <entry><option>text</option></entry>
44385 <entry>Use: <emphasis>autoreply</emphasis></entry>
44386 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44387 <entry>Default: <emphasis>unset</emphasis></entry>
44388 </row>
44389 </tbody>
44390 </tgroup>
44391 </informaltable>
44392 <para>
44393 This specifies a single string to be used as the body of the message when the
44394 message is specified by the transport. If both <option>text</option> and <option>file</option> are set,
44395 the text comes first.
44396 </para>
44397 <para>
44398 <indexterm role="option">
44399 <primary><option>to</option></primary>
44400 </indexterm>
44401 </para>
44402 <informaltable frame="all">
44403 <tgroup cols="4" colsep="0" rowsep="0">
44404 <colspec colwidth="8*" align="left"/>
44405 <colspec colwidth="6*" align="center"/>
44406 <colspec colwidth="6*" align="center"/>
44407 <colspec colwidth="6*" align="right"/>
44408 <tbody>
44409 <row>
44410 <entry><option>to</option></entry>
44411 <entry>Use: <emphasis>autoreply</emphasis></entry>
44412 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44413 <entry>Default: <emphasis>unset</emphasis></entry>
44414 </row>
44415 </tbody>
44416 </tgroup>
44417 </informaltable>
44418 <para>
44419 This specifies recipients of the message and the contents of the <emphasis>To:</emphasis> header
44420 when the message is specified by the transport.
44421 <indexterm role="concept" startref="IIDauttra1" class="endofrange"/>
44422 <indexterm role="concept" startref="IIDauttra2" class="endofrange"/>
44423 </para>
44424 </section>
44425 </chapter>
44426
44427 <chapter id="CHAPLMTP">
44428 <title>The lmtp transport</title>
44429 <para>
44430 <indexterm role="concept">
44431 <primary>transports</primary>
44432 <secondary><command>lmtp</command></secondary>
44433 </indexterm>
44434 <indexterm role="concept">
44435 <primary><command>lmtp</command> transport</primary>
44436 </indexterm>
44437 <indexterm role="concept">
44438 <primary>LMTP</primary>
44439 <secondary>over a pipe</secondary>
44440 </indexterm>
44441 <indexterm role="concept">
44442 <primary>LMTP</primary>
44443 <secondary>over a socket</secondary>
44444 </indexterm>
44445 The <command>lmtp</command> transport runs the LMTP protocol (RFC 2033) over a pipe to a
44446 specified command
44447 or by interacting with a Unix domain socket.
44448 This transport is something of a cross between the <command>pipe</command> and <command>smtp</command>
44449 transports. Exim also has support for using LMTP over TCP/IP; this is
44450 implemented as an option for the <command>smtp</command> transport. Because LMTP is expected
44451 to be of minority interest, the default build-time configure in <filename>src/EDITME</filename>
44452 has it commented out. You need to ensure that
44453 </para>
44454 <literallayout class="monospaced">
44455 TRANSPORT_LMTP=yes
44456 </literallayout>
44457 <para>
44458 <indexterm role="concept">
44459 <primary>options</primary>
44460 <secondary><command>lmtp</command> transport</secondary>
44461 </indexterm>
44462 is present in your <filename>Local/Makefile</filename> in order to have the <command>lmtp</command> transport
44463 included in the Exim binary. The private options of the <command>lmtp</command> transport are
44464 as follows:
44465 </para>
44466 <para>
44467 <indexterm role="option">
44468 <primary><option>batch_id</option></primary>
44469 </indexterm>
44470 </para>
44471 <informaltable frame="all">
44472 <tgroup cols="4" colsep="0" rowsep="0">
44473 <colspec colwidth="8*" align="left"/>
44474 <colspec colwidth="6*" align="center"/>
44475 <colspec colwidth="6*" align="center"/>
44476 <colspec colwidth="6*" align="right"/>
44477 <tbody>
44478 <row>
44479 <entry><option>batch_id</option></entry>
44480 <entry>Use: <emphasis>lmtp</emphasis></entry>
44481 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44482 <entry>Default: <emphasis>unset</emphasis></entry>
44483 </row>
44484 </tbody>
44485 </tgroup>
44486 </informaltable>
44487 <para>
44488 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
44489 </para>
44490 <para>
44491 <indexterm role="option">
44492 <primary><option>batch_max</option></primary>
44493 </indexterm>
44494 </para>
44495 <informaltable frame="all">
44496 <tgroup cols="4" colsep="0" rowsep="0">
44497 <colspec colwidth="8*" align="left"/>
44498 <colspec colwidth="6*" align="center"/>
44499 <colspec colwidth="6*" align="center"/>
44500 <colspec colwidth="6*" align="right"/>
44501 <tbody>
44502 <row>
44503 <entry><option>batch_max</option></entry>
44504 <entry>Use: <emphasis>lmtp</emphasis></entry>
44505 <entry>Type: <emphasis>integer</emphasis></entry>
44506 <entry>Default: <emphasis>1</emphasis></entry>
44507 </row>
44508 </tbody>
44509 </tgroup>
44510 </informaltable>
44511 <para>
44512 This limits the number of addresses that can be handled in a single delivery.
44513 Most LMTP servers can handle several addresses at once, so it is normally a
44514 good idea to increase this value. See the description of local delivery
44515 batching in chapter <xref linkend="CHAPbatching"/>.
44516 </para>
44517 <para>
44518 <indexterm role="option">
44519 <primary><option>command</option></primary>
44520 </indexterm>
44521 </para>
44522 <informaltable frame="all">
44523 <tgroup cols="4" colsep="0" rowsep="0">
44524 <colspec colwidth="8*" align="left"/>
44525 <colspec colwidth="6*" align="center"/>
44526 <colspec colwidth="6*" align="center"/>
44527 <colspec colwidth="6*" align="right"/>
44528 <tbody>
44529 <row>
44530 <entry><option>command</option></entry>
44531 <entry>Use: <emphasis>lmtp</emphasis></entry>
44532 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44533 <entry>Default: <emphasis>unset</emphasis></entry>
44534 </row>
44535 </tbody>
44536 </tgroup>
44537 </informaltable>
44538 <para>
44539 This option must be set if <option>socket</option> is not set. The string is a command which
44540 is run in a separate process. It is split up into a command name and list of
44541 arguments, each of which is separately expanded (so expansion cannot change the
44542 number of arguments). The command is run directly, not via a shell. The message
44543 is passed to the new process using the standard input and output to operate the
44544 LMTP protocol.
44545 </para>
44546 <para>
44547 <indexterm role="option">
44548 <primary><option>ignore_quota</option></primary>
44549 </indexterm>
44550 </para>
44551 <informaltable frame="all">
44552 <tgroup cols="4" colsep="0" rowsep="0">
44553 <colspec colwidth="8*" align="left"/>
44554 <colspec colwidth="6*" align="center"/>
44555 <colspec colwidth="6*" align="center"/>
44556 <colspec colwidth="6*" align="right"/>
44557 <tbody>
44558 <row>
44559 <entry><option>ignore_quota</option></entry>
44560 <entry>Use: <emphasis>lmtp</emphasis></entry>
44561 <entry>Type: <emphasis>boolean</emphasis></entry>
44562 <entry>Default: <emphasis>false</emphasis></entry>
44563 </row>
44564 </tbody>
44565 </tgroup>
44566 </informaltable>
44567 <para>
44568 <indexterm role="concept">
44569 <primary>LMTP</primary>
44570 <secondary>ignoring quota errors</secondary>
44571 </indexterm>
44572 If this option is set true, the string <literal>IGNOREQUOTA</literal> is added to RCPT
44573 commands, provided that the LMTP server has advertised support for IGNOREQUOTA
44574 in its response to the LHLO command.
44575 </para>
44576 <para>
44577 <indexterm role="option">
44578 <primary><option>socket</option></primary>
44579 </indexterm>
44580 </para>
44581 <informaltable frame="all">
44582 <tgroup cols="4" colsep="0" rowsep="0">
44583 <colspec colwidth="8*" align="left"/>
44584 <colspec colwidth="6*" align="center"/>
44585 <colspec colwidth="6*" align="center"/>
44586 <colspec colwidth="6*" align="right"/>
44587 <tbody>
44588 <row>
44589 <entry><option>socket</option></entry>
44590 <entry>Use: <emphasis>lmtp</emphasis></entry>
44591 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44592 <entry>Default: <emphasis>unset</emphasis></entry>
44593 </row>
44594 </tbody>
44595 </tgroup>
44596 </informaltable>
44597 <para>
44598 This option must be set if <option>command</option> is not set. The result of expansion must
44599 be the name of a Unix domain socket. The transport connects to the socket and
44600 delivers the message to it using the LMTP protocol.
44601 </para>
44602 <para>
44603 <indexterm role="option">
44604 <primary><option>timeout</option></primary>
44605 </indexterm>
44606 </para>
44607 <informaltable frame="all">
44608 <tgroup cols="4" colsep="0" rowsep="0">
44609 <colspec colwidth="8*" align="left"/>
44610 <colspec colwidth="6*" align="center"/>
44611 <colspec colwidth="6*" align="center"/>
44612 <colspec colwidth="6*" align="right"/>
44613 <tbody>
44614 <row>
44615 <entry><option>timeout</option></entry>
44616 <entry>Use: <emphasis>lmtp</emphasis></entry>
44617 <entry>Type: <emphasis>time</emphasis></entry>
44618 <entry>Default: <emphasis>5m</emphasis></entry>
44619 </row>
44620 </tbody>
44621 </tgroup>
44622 </informaltable>
44623 <para>
44624 The transport is aborted if the created process or Unix domain socket does not
44625 respond to LMTP commands or message input within this timeout. Delivery
44626 is deferred, and will be tried again later. Here is an example of a typical
44627 LMTP transport:
44628 </para>
44629 <literallayout class="monospaced">
44630 lmtp:
44631   driver = lmtp
44632   command = /some/local/lmtp/delivery/program
44633   batch_max = 20
44634   user = exim
44635 </literallayout>
44636 <para>
44637 This delivers up to 20 addresses at a time, in a mixture of domains if
44638 necessary, running as the user <emphasis>exim</emphasis>.
44639 </para>
44640 </chapter>
44641
44642 <chapter id="CHAPpipetransport">
44643 <title>The pipe transport</title>
44644 <para>
44645 <indexterm role="concept" id="IIDpiptra1" class="startofrange">
44646 <primary>transports</primary>
44647 <secondary><command>pipe</command></secondary>
44648 </indexterm>
44649 <indexterm role="concept" id="IIDpiptra2" class="startofrange">
44650 <primary><command>pipe</command> transport</primary>
44651 </indexterm>
44652 The <command>pipe</command> transport is used to deliver messages via a pipe to a command
44653 running in another process. One example is the use of <command>pipe</command> as a
44654 pseudo-remote transport for passing messages to some other delivery mechanism
44655 (such as UUCP). Another is the use by individual users to automatically process
44656 their incoming messages. The <command>pipe</command> transport can be used in one of the
44657 following ways:
44658 </para>
44659 <itemizedlist>
44660 <listitem>
44661 <para>
44662 <indexterm role="variable">
44663 <primary><varname>$local_part</varname></primary>
44664 </indexterm>
44665 A router routes one address to a transport in the normal way, and the
44666 transport is configured as a <command>pipe</command> transport. In this case, <varname>$local_part</varname>
44667 contains the local part of the address (as usual), and the command that is run
44668 is specified by the <option>command</option> option on the transport.
44669 </para>
44670 </listitem>
44671 <listitem>
44672 <para>
44673 <indexterm role="variable">
44674 <primary><varname>$pipe_addresses</varname></primary>
44675 </indexterm>
44676 If the <option>batch_max</option> option is set greater than 1 (the default is 1), the
44677 transport can handle more than one address in a single run. In this case, when
44678 more than one address is routed to the transport, <varname>$local_part</varname> is not set
44679 (because it is not unique). However, the pseudo-variable <varname>$pipe_addresses</varname>
44680 (described in section <xref linkend="SECThowcommandrun"/> below) contains all the addresses
44681 that are routed to the transport.
44682 </para>
44683 </listitem>
44684 <listitem>
44685 <para>
44686 <indexterm role="variable">
44687 <primary><varname>$address_pipe</varname></primary>
44688 </indexterm>
44689 A router redirects an address directly to a pipe command (for example, from an
44690 alias or forward file). In this case, <varname>$address_pipe</varname> contains the text of the
44691 pipe command, and the <option>command</option> option on the transport is ignored unless
44692 <option>force_command</option> is set. If only one address is being transported
44693 (<option>batch_max</option> is not greater than one, or only one address was redirected to
44694 this pipe command), <varname>$local_part</varname> contains the local part that was redirected.
44695 </para>
44696 </listitem>
44697 </itemizedlist>
44698 <para>
44699 The <command>pipe</command> transport is a non-interactive delivery method. Exim can also
44700 deliver messages over pipes using the LMTP interactive protocol. This is
44701 implemented by the <command>lmtp</command> transport.
44702 </para>
44703 <para>
44704 In the case when <command>pipe</command> is run as a consequence of an entry in a local user&#x2019;s
44705 <filename>.forward</filename> file, the command runs under the uid and gid of that user. In
44706 other cases, the uid and gid have to be specified explicitly, either on the
44707 transport or on the router that handles the address. Current and <quote>home</quote>
44708 directories are also controllable. See chapter <xref linkend="CHAPenvironment"/> for
44709 details of the local delivery environment and chapter <xref linkend="CHAPbatching"/>
44710 for a discussion of local delivery batching.
44711 </para>
44712 <section id="SECID140">
44713 <title>Concurrent delivery</title>
44714 <para>
44715 If two messages arrive at almost the same time, and both are routed to a pipe
44716 delivery, the two pipe transports may be run concurrently. You must ensure that
44717 any pipe commands you set up are robust against this happening. If the commands
44718 write to a file, the <option>exim_lock</option> utility might be of use.
44719 Alternatively the <option>max_parallel</option> option could be used with a value
44720 of "1" to enforce serialization.
44721 </para>
44722 </section>
44723 <section id="SECID141">
44724 <title>Returned status and data</title>
44725 <para>
44726 <indexterm role="concept">
44727 <primary><command>pipe</command> transport</primary>
44728 <secondary>returned data</secondary>
44729 </indexterm>
44730 If the command exits with a non-zero return code, the delivery is deemed to
44731 have failed, unless either the <option>ignore_status</option> option is set (in which case
44732 the return code is treated as zero), or the return code is one of those listed
44733 in the <option>temp_errors</option> option, which are interpreted as meaning <quote>try again
44734 later</quote>. In this case, delivery is deferred. Details of a permanent failure are
44735 logged, but are not included in the bounce message, which merely contains
44736 <quote>local delivery failed</quote>.
44737 </para>
44738 <para>
44739 If the command exits on a signal and the <option>freeze_signal</option> option is set then
44740 the message will be frozen in the queue. If that option is not set, a bounce
44741 will be sent as normal.
44742 </para>
44743 <para>
44744 If the return code is greater than 128 and the command being run is a shell
44745 script, it normally means that the script was terminated by a signal whose
44746 value is the return code minus 128. The <option>freeze_signal</option> option does not
44747 apply in this case.
44748 </para>
44749 <para>
44750 If Exim is unable to run the command (that is, if <function>execve()</function> fails), the
44751 return code is set to 127. This is the value that a shell returns if it is
44752 asked to run a non-existent command. The wording for the log line suggests that
44753 a non-existent command may be the problem.
44754 </para>
44755 <para>
44756 The <option>return_output</option> option can affect the result of a pipe delivery. If it is
44757 set and the command produces any output on its standard output or standard
44758 error streams, the command is considered to have failed, even if it gave a zero
44759 return code or if <option>ignore_status</option> is set. The output from the command is
44760 included as part of the bounce message. The <option>return_fail_output</option> option is
44761 similar, except that output is returned only when the command exits with a
44762 failure return code, that is, a value other than zero or a code that matches
44763 <option>temp_errors</option>.
44764 </para>
44765 </section>
44766 <section id="SECThowcommandrun">
44767 <title>How the command is run</title>
44768 <para>
44769 <indexterm role="concept">
44770 <primary><command>pipe</command> transport</primary>
44771 <secondary>path for command</secondary>
44772 </indexterm>
44773 The command line is (by default) broken down into a command name and arguments
44774 by the <command>pipe</command> transport itself. The <option>allow_commands</option> and
44775 <option>restrict_to_path</option> options can be used to restrict the commands that may be
44776 run.
44777 </para>
44778 <para>
44779 <indexterm role="concept">
44780 <primary>quoting</primary>
44781 <secondary>in pipe command</secondary>
44782 </indexterm>
44783 Unquoted arguments are delimited by white space. If an argument appears in
44784 double quotes, backslash is interpreted as an escape character in the usual
44785 way. If an argument appears in single quotes, no escaping is done.
44786 </para>
44787 <para>
44788 String expansion is applied to the command line except when it comes from a
44789 traditional <filename>.forward</filename> file (commands from a filter file are expanded). The
44790 expansion is applied to each argument in turn rather than to the whole line.
44791 For this reason, any string expansion item that contains white space must be
44792 quoted so as to be contained within a single argument. A setting such as
44793 </para>
44794 <literallayout class="monospaced">
44795 command = /some/path ${if eq{$local_part}{postmaster}{xx}{yy}}
44796 </literallayout>
44797 <para>
44798 will not work, because the expansion item gets split between several
44799 arguments. You have to write
44800 </para>
44801 <literallayout class="monospaced">
44802 command = /some/path "${if eq{$local_part}{postmaster}{xx}{yy}}"
44803 </literallayout>
44804 <para>
44805 to ensure that it is all in one argument. The expansion is done in this way,
44806 argument by argument, so that the number of arguments cannot be changed as a
44807 result of expansion, and quotes or backslashes in inserted variables do not
44808 interact with external quoting. However, this leads to problems if you want to
44809 generate multiple arguments (or the command name plus arguments) from a single
44810 expansion. In this situation, the simplest solution is to use a shell. For
44811 example:
44812 </para>
44813 <literallayout class="monospaced">
44814 command = /bin/sh -c ${lookup{$local_part}lsearch{/some/file}}
44815 </literallayout>
44816 <para>
44817 <indexterm role="concept">
44818 <primary>transport</primary>
44819 <secondary>filter</secondary>
44820 </indexterm>
44821 <indexterm role="concept">
44822 <primary>filter</primary>
44823 <secondary>transport filter</secondary>
44824 </indexterm>
44825 <indexterm role="variable">
44826 <primary><varname>$pipe_addresses</varname></primary>
44827 </indexterm>
44828 Special handling takes place when an argument consists of precisely the text
44829 <literal>$pipe_addresses</literal>. This is not a general expansion variable; the only
44830 place this string is recognized is when it appears as an argument for a pipe or
44831 transport filter command. It causes each address that is being handled to be
44832 inserted in the argument list at that point <emphasis>as a separate argument</emphasis>. This
44833 avoids any problems with spaces or shell metacharacters, and is of use when a
44834 <command>pipe</command> transport is handling groups of addresses in a batch.
44835 </para>
44836 <para>
44837 If <option>force_command</option> is enabled on the transport, Special handling takes place
44838 for an argument that consists of precisely the text <literal>$address_pipe</literal>.  It
44839 is handled similarly to <varname>$pipe_addresses</varname> above.  It is expanded and each
44840 argument is inserted in the argument list at that point
44841 <emphasis>as a separate argument</emphasis>.  The <literal>$address_pipe</literal> item does not need to be
44842 the only item in the argument; in fact, if it were then <option>force_command</option>
44843 should behave as a no-op.  Rather, it should be used to adjust the command
44844 run while preserving the argument vector separation.
44845 </para>
44846 <para>
44847 After splitting up into arguments and expansion, the resulting command is run
44848 in a subprocess directly from the transport, <emphasis>not</emphasis> under a shell. The
44849 message that is being delivered is supplied on the standard input, and the
44850 standard output and standard error are both connected to a single pipe that is
44851 read by Exim. The <option>max_output</option> option controls how much output the command
44852 may produce, and the <option>return_output</option> and <option>return_fail_output</option> options
44853 control what is done with it.
44854 </para>
44855 <para>
44856 Not running the command under a shell (by default) lessens the security risks
44857 in cases when a command from a user&#x2019;s filter file is built out of data that was
44858 taken from an incoming message. If a shell is required, it can of course be
44859 explicitly specified as the command to be run. However, there are circumstances
44860 where existing commands (for example, in <filename>.forward</filename> files) expect to be run
44861 under a shell and cannot easily be modified. To allow for these cases, there is
44862 an option called <option>use_shell</option>, which changes the way the <command>pipe</command> transport
44863 works. Instead of breaking up the command line as just described, it expands it
44864 as a single string and passes the result to <filename>/bin/sh</filename>. The
44865 <option>restrict_to_path</option> option and the <varname>$pipe_addresses</varname> facility cannot be used
44866 with <option>use_shell</option>, and the whole mechanism is inherently less secure.
44867 </para>
44868 </section>
44869 <section id="SECTpipeenv">
44870 <title>Environment variables</title>
44871 <para>
44872 <indexterm role="concept">
44873 <primary><command>pipe</command> transport</primary>
44874 <secondary>environment for command</secondary>
44875 </indexterm>
44876 <indexterm role="concept">
44877 <primary>environment</primary>
44878 <secondary><command>pipe</command> transport</secondary>
44879 </indexterm>
44880 The environment variables listed below are set up when the command is invoked.
44881 This list is a compromise for maximum compatibility with other MTAs. Note that
44882 the <option>environment</option> option can be used to add additional variables to this
44883 environment. The environment for the <command>pipe</command> transport is not subject
44884 to the <option>add_environment</option> and <option>keep_environment</option> main config options.
44885 </para>
44886 <literallayout>
44887 <literal>DOMAIN            </literal>   the domain of the address
44888 <literal>HOME              </literal>   the home directory, if set
44889 <literal>HOST              </literal>   the host name when called from a router (see below)
44890 <literal>LOCAL_PART        </literal>   see below
44891 <literal>LOCAL_PART_PREFIX </literal>   see below
44892 <literal>LOCAL_PART_SUFFIX </literal>   see below
44893 <literal>LOGNAME           </literal>   see below
44894 <literal>MESSAGE_ID        </literal>   Exim&#x2019;s local ID for the message
44895 <literal>PATH              </literal>   as specified by the <option>path</option> option below
44896 <literal>QUALIFY_DOMAIN    </literal>   the sender qualification domain
44897 <literal>RECIPIENT         </literal>   the complete recipient address
44898 <literal>SENDER            </literal>   the sender of the message (empty if a bounce)
44899 <literal>SHELL             </literal>   <literal>/bin/sh</literal>
44900 <literal>TZ                </literal>   the value of the <option>timezone</option> option, if set
44901 <literal>USER              </literal>   see below
44902 </literallayout>
44903 <para>
44904 When a <command>pipe</command> transport is called directly from (for example) an <command>accept</command>
44905 router, LOCAL_PART is set to the local part of the address. When it is
44906 called as a result of a forward or alias expansion, LOCAL_PART is set to
44907 the local part of the address that was expanded. In both cases, any affixes are
44908 removed from the local part, and made available in LOCAL_PART_PREFIX and
44909 LOCAL_PART_SUFFIX, respectively. LOGNAME and USER are set to the
44910 same value as LOCAL_PART for compatibility with other MTAs.
44911 </para>
44912 <para>
44913 <indexterm role="concept">
44914 <primary>HOST</primary>
44915 </indexterm>
44916 HOST is set only when a <command>pipe</command> transport is called from a router that
44917 associates hosts with an address, typically when using <command>pipe</command> as a
44918 pseudo-remote transport. HOST is set to the first host name specified by
44919 the router.
44920 </para>
44921 <para>
44922 <indexterm role="concept">
44923 <primary>HOME</primary>
44924 </indexterm>
44925 If the transport&#x2019;s generic <option>home_directory</option> option is set, its value is used
44926 for the HOME environment variable. Otherwise, a home directory may be set
44927 by the router&#x2019;s <option>transport_home_directory</option> option, which defaults to the
44928 user&#x2019;s home directory if <option>check_local_user</option> is set.
44929 </para>
44930 </section>
44931 <section id="SECID142">
44932 <title>Private options for pipe</title>
44933 <para>
44934 <indexterm role="concept">
44935 <primary>options</primary>
44936 <secondary><command>pipe</command> transport</secondary>
44937 </indexterm>
44938 </para>
44939 <para>
44940 <indexterm role="option">
44941 <primary><option>allow_commands</option></primary>
44942 </indexterm>
44943 </para>
44944 <informaltable frame="all">
44945 <tgroup cols="4" colsep="0" rowsep="0">
44946 <colspec colwidth="8*" align="left"/>
44947 <colspec colwidth="6*" align="center"/>
44948 <colspec colwidth="6*" align="center"/>
44949 <colspec colwidth="6*" align="right"/>
44950 <tbody>
44951 <row>
44952 <entry><option>allow_commands</option></entry>
44953 <entry>Use: <emphasis>pipe</emphasis></entry>
44954 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
44955 <entry>Default: <emphasis>unset</emphasis></entry>
44956 </row>
44957 </tbody>
44958 </tgroup>
44959 </informaltable>
44960 <para>
44961 <indexterm role="concept">
44962 <primary><command>pipe</command> transport</primary>
44963 <secondary>permitted commands</secondary>
44964 </indexterm>
44965 The string is expanded, and is then interpreted as a colon-separated list of
44966 permitted commands. If <option>restrict_to_path</option> is not set, the only commands
44967 permitted are those in the <option>allow_commands</option> list. They need not be absolute
44968 paths; the <option>path</option> option is still used for relative paths. If
44969 <option>restrict_to_path</option> is set with <option>allow_commands</option>, the command must either be
44970 in the <option>allow_commands</option> list, or a name without any slashes that is found on
44971 the path. In other words, if neither <option>allow_commands</option> nor
44972 <option>restrict_to_path</option> is set, there is no restriction on the command, but
44973 otherwise only commands that are permitted by one or the other are allowed. For
44974 example, if
44975 </para>
44976 <literallayout class="monospaced">
44977 allow_commands = /usr/bin/vacation
44978 </literallayout>
44979 <para>
44980 and <option>restrict_to_path</option> is not set, the only permitted command is
44981 <filename>/usr/bin/vacation</filename>. The <option>allow_commands</option> option may not be set if
44982 <option>use_shell</option> is set.
44983 </para>
44984 <para>
44985 <indexterm role="option">
44986 <primary><option>batch_id</option></primary>
44987 </indexterm>
44988 </para>
44989 <informaltable frame="all">
44990 <tgroup cols="4" colsep="0" rowsep="0">
44991 <colspec colwidth="8*" align="left"/>
44992 <colspec colwidth="6*" align="center"/>
44993 <colspec colwidth="6*" align="center"/>
44994 <colspec colwidth="6*" align="right"/>
44995 <tbody>
44996 <row>
44997 <entry><option>batch_id</option></entry>
44998 <entry>Use: <emphasis>pipe</emphasis></entry>
44999 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45000 <entry>Default: <emphasis>unset</emphasis></entry>
45001 </row>
45002 </tbody>
45003 </tgroup>
45004 </informaltable>
45005 <para>
45006 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
45007 </para>
45008 <para>
45009 <indexterm role="option">
45010 <primary><option>batch_max</option></primary>
45011 </indexterm>
45012 </para>
45013 <informaltable frame="all">
45014 <tgroup cols="4" colsep="0" rowsep="0">
45015 <colspec colwidth="8*" align="left"/>
45016 <colspec colwidth="6*" align="center"/>
45017 <colspec colwidth="6*" align="center"/>
45018 <colspec colwidth="6*" align="right"/>
45019 <tbody>
45020 <row>
45021 <entry><option>batch_max</option></entry>
45022 <entry>Use: <emphasis>pipe</emphasis></entry>
45023 <entry>Type: <emphasis>integer</emphasis></entry>
45024 <entry>Default: <emphasis>1</emphasis></entry>
45025 </row>
45026 </tbody>
45027 </tgroup>
45028 </informaltable>
45029 <para>
45030 This limits the number of addresses that can be handled in a single delivery.
45031 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
45032 </para>
45033 <para>
45034 <indexterm role="option">
45035 <primary><option>check_string</option></primary>
45036 </indexterm>
45037 </para>
45038 <informaltable frame="all">
45039 <tgroup cols="4" colsep="0" rowsep="0">
45040 <colspec colwidth="8*" align="left"/>
45041 <colspec colwidth="6*" align="center"/>
45042 <colspec colwidth="6*" align="center"/>
45043 <colspec colwidth="6*" align="right"/>
45044 <tbody>
45045 <row>
45046 <entry><option>check_string</option></entry>
45047 <entry>Use: <emphasis>pipe</emphasis></entry>
45048 <entry>Type: <emphasis>string</emphasis></entry>
45049 <entry>Default: <emphasis>unset</emphasis></entry>
45050 </row>
45051 </tbody>
45052 </tgroup>
45053 </informaltable>
45054 <para>
45055 As <command>pipe</command> writes the message, the start of each line is tested for matching
45056 <option>check_string</option>, and if it does, the initial matching characters are replaced
45057 by the contents of <option>escape_string</option>, provided both are set. The value of
45058 <option>check_string</option> is a literal string, not a regular expression, and the case of
45059 any letters it contains is significant. When <option>use_bsmtp</option> is set, the contents
45060 of <option>check_string</option> and <option>escape_string</option> are forced to values that implement
45061 the SMTP escaping protocol. Any settings made in the configuration file are
45062 ignored.
45063 </para>
45064 <para>
45065 <indexterm role="option">
45066 <primary><option>command</option></primary>
45067 </indexterm>
45068 </para>
45069 <informaltable frame="all">
45070 <tgroup cols="4" colsep="0" rowsep="0">
45071 <colspec colwidth="8*" align="left"/>
45072 <colspec colwidth="6*" align="center"/>
45073 <colspec colwidth="6*" align="center"/>
45074 <colspec colwidth="6*" align="right"/>
45075 <tbody>
45076 <row>
45077 <entry><option>command</option></entry>
45078 <entry>Use: <emphasis>pipe</emphasis></entry>
45079 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45080 <entry>Default: <emphasis>unset</emphasis></entry>
45081 </row>
45082 </tbody>
45083 </tgroup>
45084 </informaltable>
45085 <para>
45086 This option need not be set when <command>pipe</command> is being used to deliver to pipes
45087 obtained directly from address redirections. In other cases, the option must be
45088 set, to provide a command to be run. It need not yield an absolute path (see
45089 the <option>path</option> option below). The command is split up into separate arguments by
45090 Exim, and each argument is separately expanded, as described in section
45091 <xref linkend="SECThowcommandrun"/> above.
45092 </para>
45093 <para>
45094 <indexterm role="option">
45095 <primary><option>environment</option></primary>
45096 </indexterm>
45097 </para>
45098 <informaltable frame="all">
45099 <tgroup cols="4" colsep="0" rowsep="0">
45100 <colspec colwidth="8*" align="left"/>
45101 <colspec colwidth="6*" align="center"/>
45102 <colspec colwidth="6*" align="center"/>
45103 <colspec colwidth="6*" align="right"/>
45104 <tbody>
45105 <row>
45106 <entry><option>environment</option></entry>
45107 <entry>Use: <emphasis>pipe</emphasis></entry>
45108 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45109 <entry>Default: <emphasis>unset</emphasis></entry>
45110 </row>
45111 </tbody>
45112 </tgroup>
45113 </informaltable>
45114 <para>
45115 <indexterm role="concept">
45116 <primary><command>pipe</command> transport</primary>
45117 <secondary>environment for command</secondary>
45118 </indexterm>
45119 <indexterm role="concept">
45120 <primary>environment</primary>
45121 <secondary><command>pipe</command> transport</secondary>
45122 </indexterm>
45123 This option is used to add additional variables to the environment in which the
45124 command runs (see section <xref linkend="SECTpipeenv"/> for the default list). Its value is
45125 a string which is expanded, and then interpreted as a colon-separated list of
45126 environment settings of the form &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt;.
45127 </para>
45128 <para>
45129 <indexterm role="option">
45130 <primary><option>escape_string</option></primary>
45131 </indexterm>
45132 </para>
45133 <informaltable frame="all">
45134 <tgroup cols="4" colsep="0" rowsep="0">
45135 <colspec colwidth="8*" align="left"/>
45136 <colspec colwidth="6*" align="center"/>
45137 <colspec colwidth="6*" align="center"/>
45138 <colspec colwidth="6*" align="right"/>
45139 <tbody>
45140 <row>
45141 <entry><option>escape_string</option></entry>
45142 <entry>Use: <emphasis>pipe</emphasis></entry>
45143 <entry>Type: <emphasis>string</emphasis></entry>
45144 <entry>Default: <emphasis>unset</emphasis></entry>
45145 </row>
45146 </tbody>
45147 </tgroup>
45148 </informaltable>
45149 <para>
45150 See <option>check_string</option> above.
45151 </para>
45152 <para>
45153 <indexterm role="option">
45154 <primary><option>freeze_exec_fail</option></primary>
45155 </indexterm>
45156 </para>
45157 <informaltable frame="all">
45158 <tgroup cols="4" colsep="0" rowsep="0">
45159 <colspec colwidth="8*" align="left"/>
45160 <colspec colwidth="6*" align="center"/>
45161 <colspec colwidth="6*" align="center"/>
45162 <colspec colwidth="6*" align="right"/>
45163 <tbody>
45164 <row>
45165 <entry><option>freeze_exec_fail</option></entry>
45166 <entry>Use: <emphasis>pipe</emphasis></entry>
45167 <entry>Type: <emphasis>boolean</emphasis></entry>
45168 <entry>Default: <emphasis>false</emphasis></entry>
45169 </row>
45170 </tbody>
45171 </tgroup>
45172 </informaltable>
45173 <para>
45174 <indexterm role="concept">
45175 <primary>exec failure</primary>
45176 </indexterm>
45177 <indexterm role="concept">
45178 <primary>failure of exec</primary>
45179 </indexterm>
45180 <indexterm role="concept">
45181 <primary><command>pipe</command> transport</primary>
45182 <secondary>failure of exec</secondary>
45183 </indexterm>
45184 Failure to exec the command in a pipe transport is by default treated like
45185 any other failure while running the command. However, if <option>freeze_exec_fail</option>
45186 is set, failure to exec is treated specially, and causes the message to be
45187 frozen, whatever the setting of <option>ignore_status</option>.
45188 </para>
45189 <para>
45190 <indexterm role="option">
45191 <primary><option>freeze_signal</option></primary>
45192 </indexterm>
45193 </para>
45194 <informaltable frame="all">
45195 <tgroup cols="4" colsep="0" rowsep="0">
45196 <colspec colwidth="8*" align="left"/>
45197 <colspec colwidth="6*" align="center"/>
45198 <colspec colwidth="6*" align="center"/>
45199 <colspec colwidth="6*" align="right"/>
45200 <tbody>
45201 <row>
45202 <entry><option>freeze_signal</option></entry>
45203 <entry>Use: <emphasis>pipe</emphasis></entry>
45204 <entry>Type: <emphasis>boolean</emphasis></entry>
45205 <entry>Default: <emphasis>false</emphasis></entry>
45206 </row>
45207 </tbody>
45208 </tgroup>
45209 </informaltable>
45210 <para>
45211 <indexterm role="concept">
45212 <primary>signal exit</primary>
45213 </indexterm>
45214 <indexterm role="concept">
45215 <primary><command>pipe</command> transport</primary>
45216 <secondary>,</secondary>
45217 </indexterm>
45218 Normally if the process run by a command in a pipe transport exits on a signal,
45219 a bounce message is sent. If <option>freeze_signal</option> is set, the message will be
45220 frozen in Exim&#x2019;s queue instead.
45221 </para>
45222 <para>
45223 <indexterm role="option">
45224 <primary><option>force_command</option></primary>
45225 </indexterm>
45226 </para>
45227 <informaltable frame="all">
45228 <tgroup cols="4" colsep="0" rowsep="0">
45229 <colspec colwidth="8*" align="left"/>
45230 <colspec colwidth="6*" align="center"/>
45231 <colspec colwidth="6*" align="center"/>
45232 <colspec colwidth="6*" align="right"/>
45233 <tbody>
45234 <row>
45235 <entry><option>force_command</option></entry>
45236 <entry>Use: <emphasis>pipe</emphasis></entry>
45237 <entry>Type: <emphasis>boolean</emphasis></entry>
45238 <entry>Default: <emphasis>false</emphasis></entry>
45239 </row>
45240 </tbody>
45241 </tgroup>
45242 </informaltable>
45243 <para>
45244 <indexterm role="concept">
45245 <primary>force command</primary>
45246 </indexterm>
45247 <indexterm role="concept">
45248 <primary><command>pipe</command> transport</primary>
45249 <secondary>,</secondary>
45250 </indexterm>
45251 Normally when a router redirects an address directly to a pipe command
45252 the <option>command</option> option on the transport is ignored.  If <option>force_command</option>
45253 is set, the <option>command</option> option will used. This is especially
45254 useful for forcing a wrapper or additional argument to be added to the
45255 command. For example:
45256 </para>
45257 <literallayout class="monospaced">
45258 command = /usr/bin/remote_exec myhost -- $address_pipe
45259 force_command
45260 </literallayout>
45261 <para>
45262 Note that <varname>$address_pipe</varname> is handled specially in <option>command</option> when
45263 <option>force_command</option> is set, expanding out to the original argument vector as
45264 separate items, similarly to a Unix shell <literal>"$@"</literal> construct.
45265 </para>
45266 <para>
45267 <indexterm role="option">
45268 <primary><option>ignore_status</option></primary>
45269 </indexterm>
45270 </para>
45271 <informaltable frame="all">
45272 <tgroup cols="4" colsep="0" rowsep="0">
45273 <colspec colwidth="8*" align="left"/>
45274 <colspec colwidth="6*" align="center"/>
45275 <colspec colwidth="6*" align="center"/>
45276 <colspec colwidth="6*" align="right"/>
45277 <tbody>
45278 <row>
45279 <entry><option>ignore_status</option></entry>
45280 <entry>Use: <emphasis>pipe</emphasis></entry>
45281 <entry>Type: <emphasis>boolean</emphasis></entry>
45282 <entry>Default: <emphasis>false</emphasis></entry>
45283 </row>
45284 </tbody>
45285 </tgroup>
45286 </informaltable>
45287 <para>
45288 If this option is true, the status returned by the subprocess that is set up to
45289 run the command is ignored, and Exim behaves as if zero had been returned.
45290 Otherwise, a non-zero status or termination by signal causes an error return
45291 from the transport unless the status value is one of those listed in
45292 <option>temp_errors</option>; these cause the delivery to be deferred and tried again later.
45293 </para>
45294 <para>
45295 <emphasis role="bold">Note</emphasis>: This option does not apply to timeouts, which do not return a status.
45296 See the <option>timeout_defer</option> option for how timeouts are handled.
45297 </para>
45298 <para>
45299 <indexterm role="option">
45300 <primary><option>log_defer_output</option></primary>
45301 </indexterm>
45302 </para>
45303 <informaltable frame="all">
45304 <tgroup cols="4" colsep="0" rowsep="0">
45305 <colspec colwidth="8*" align="left"/>
45306 <colspec colwidth="6*" align="center"/>
45307 <colspec colwidth="6*" align="center"/>
45308 <colspec colwidth="6*" align="right"/>
45309 <tbody>
45310 <row>
45311 <entry><option>log_defer_output</option></entry>
45312 <entry>Use: <emphasis>pipe</emphasis></entry>
45313 <entry>Type: <emphasis>boolean</emphasis></entry>
45314 <entry>Default: <emphasis>false</emphasis></entry>
45315 </row>
45316 </tbody>
45317 </tgroup>
45318 </informaltable>
45319 <para>
45320 <indexterm role="concept">
45321 <primary><command>pipe</command> transport</primary>
45322 <secondary>logging output</secondary>
45323 </indexterm>
45324 If this option is set, and the status returned by the command is
45325 one of the codes listed in <option>temp_errors</option> (that is, delivery was deferred),
45326 and any output was produced on stdout or stderr, the first line of it is
45327 written to the main log.
45328 </para>
45329 <para>
45330 <indexterm role="option">
45331 <primary><option>log_fail_output</option></primary>
45332 </indexterm>
45333 </para>
45334 <informaltable frame="all">
45335 <tgroup cols="4" colsep="0" rowsep="0">
45336 <colspec colwidth="8*" align="left"/>
45337 <colspec colwidth="6*" align="center"/>
45338 <colspec colwidth="6*" align="center"/>
45339 <colspec colwidth="6*" align="right"/>
45340 <tbody>
45341 <row>
45342 <entry><option>log_fail_output</option></entry>
45343 <entry>Use: <emphasis>pipe</emphasis></entry>
45344 <entry>Type: <emphasis>boolean</emphasis></entry>
45345 <entry>Default: <emphasis>false</emphasis></entry>
45346 </row>
45347 </tbody>
45348 </tgroup>
45349 </informaltable>
45350 <para>
45351 If this option is set, and the command returns any output on stdout or
45352 stderr, and also ends with a return code that is neither zero nor one of
45353 the return codes listed in <option>temp_errors</option> (that is, the delivery
45354 failed), the first line of output is written to the main log. This
45355 option and <option>log_output</option> are mutually exclusive.  Only one of them may
45356 be set.
45357 </para>
45358 <para>
45359 <indexterm role="option">
45360 <primary><option>log_output</option></primary>
45361 </indexterm>
45362 </para>
45363 <informaltable frame="all">
45364 <tgroup cols="4" colsep="0" rowsep="0">
45365 <colspec colwidth="8*" align="left"/>
45366 <colspec colwidth="6*" align="center"/>
45367 <colspec colwidth="6*" align="center"/>
45368 <colspec colwidth="6*" align="right"/>
45369 <tbody>
45370 <row>
45371 <entry><option>log_output</option></entry>
45372 <entry>Use: <emphasis>pipe</emphasis></entry>
45373 <entry>Type: <emphasis>boolean</emphasis></entry>
45374 <entry>Default: <emphasis>false</emphasis></entry>
45375 </row>
45376 </tbody>
45377 </tgroup>
45378 </informaltable>
45379 <para>
45380 If this option is set and the command returns any output on stdout or
45381 stderr, the first line of output is written to the main log, whatever
45382 the return code. This option and <option>log_fail_output</option> are mutually
45383 exclusive. Only one of them may be set.
45384 </para>
45385 <para>
45386 <indexterm role="option">
45387 <primary><option>max_output</option></primary>
45388 </indexterm>
45389 </para>
45390 <informaltable frame="all">
45391 <tgroup cols="4" colsep="0" rowsep="0">
45392 <colspec colwidth="8*" align="left"/>
45393 <colspec colwidth="6*" align="center"/>
45394 <colspec colwidth="6*" align="center"/>
45395 <colspec colwidth="6*" align="right"/>
45396 <tbody>
45397 <row>
45398 <entry><option>max_output</option></entry>
45399 <entry>Use: <emphasis>pipe</emphasis></entry>
45400 <entry>Type: <emphasis>integer</emphasis></entry>
45401 <entry>Default: <emphasis>20K</emphasis></entry>
45402 </row>
45403 </tbody>
45404 </tgroup>
45405 </informaltable>
45406 <para>
45407 This specifies the maximum amount of output that the command may produce on its
45408 standard output and standard error file combined. If the limit is exceeded, the
45409 process running the command is killed. This is intended as a safety measure to
45410 catch runaway processes. The limit is applied independently of the settings of
45411 the options that control what is done with such output (for example,
45412 <option>return_output</option>). Because of buffering effects, the amount of output may
45413 exceed the limit by a small amount before Exim notices.
45414 </para>
45415 <para>
45416 <indexterm role="option">
45417 <primary><option>message_prefix</option></primary>
45418 </indexterm>
45419 </para>
45420 <informaltable frame="all">
45421 <tgroup cols="4" colsep="0" rowsep="0">
45422 <colspec colwidth="8*" align="left"/>
45423 <colspec colwidth="6*" align="center"/>
45424 <colspec colwidth="6*" align="center"/>
45425 <colspec colwidth="6*" align="right"/>
45426 <tbody>
45427 <row>
45428 <entry><option>message_prefix</option></entry>
45429 <entry>Use: <emphasis>pipe</emphasis></entry>
45430 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45431 <entry>Default: <emphasis>see below</emphasis></entry>
45432 </row>
45433 </tbody>
45434 </tgroup>
45435 </informaltable>
45436 <para>
45437 The string specified here is expanded and output at the start of every message.
45438 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is
45439 </para>
45440 <literallayout class="monospaced">
45441 message_prefix = \
45442   From ${if def:return_path{$return_path}{MAILER-DAEMON}}\
45443   ${tod_bsdinbox}\n
45444 </literallayout>
45445 <para>
45446 <indexterm role="concept">
45447 <primary>Cyrus</primary>
45448 </indexterm>
45449 <indexterm role="concept">
45450 <primary><option>tmail</option></primary>
45451 </indexterm>
45452 <indexterm role="concept">
45453 <primary><quote>From</quote> line</primary>
45454 </indexterm>
45455 This is required by the commonly used <filename>/usr/bin/vacation</filename> program.
45456 However, it must <emphasis>not</emphasis> be present if delivery is to the Cyrus IMAP server,
45457 or to the <option>tmail</option> local delivery agent. The prefix can be suppressed by
45458 setting
45459 </para>
45460 <literallayout class="monospaced">
45461 message_prefix =
45462 </literallayout>
45463 <para>
45464 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
45465 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_prefix</option>.
45466 </para>
45467 <para>
45468 <indexterm role="option">
45469 <primary><option>message_suffix</option></primary>
45470 </indexterm>
45471 </para>
45472 <informaltable frame="all">
45473 <tgroup cols="4" colsep="0" rowsep="0">
45474 <colspec colwidth="8*" align="left"/>
45475 <colspec colwidth="6*" align="center"/>
45476 <colspec colwidth="6*" align="center"/>
45477 <colspec colwidth="6*" align="right"/>
45478 <tbody>
45479 <row>
45480 <entry><option>message_suffix</option></entry>
45481 <entry>Use: <emphasis>pipe</emphasis></entry>
45482 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45483 <entry>Default: <emphasis>see below</emphasis></entry>
45484 </row>
45485 </tbody>
45486 </tgroup>
45487 </informaltable>
45488 <para>
45489 The string specified here is expanded and output at the end of every message.
45490 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is a single newline.
45491 The suffix can be suppressed by setting
45492 </para>
45493 <literallayout class="monospaced">
45494 message_suffix =
45495 </literallayout>
45496 <para>
45497 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
45498 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_suffix</option>.
45499 </para>
45500 <para>
45501 <indexterm role="option">
45502 <primary><option>path</option></primary>
45503 </indexterm>
45504 </para>
45505 <informaltable frame="all">
45506 <tgroup cols="4" colsep="0" rowsep="0">
45507 <colspec colwidth="8*" align="left"/>
45508 <colspec colwidth="6*" align="center"/>
45509 <colspec colwidth="6*" align="center"/>
45510 <colspec colwidth="6*" align="right"/>
45511 <tbody>
45512 <row>
45513 <entry><option>path</option></entry>
45514 <entry>Use: <emphasis>pipe</emphasis></entry>
45515 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45516 <entry>Default: <emphasis>/bin:/usr/bin</emphasis></entry>
45517 </row>
45518 </tbody>
45519 </tgroup>
45520 </informaltable>
45521 <para>
45522 This option is expanded and
45523 specifies the string that is set up in the PATH environment
45524 variable of the subprocess.
45525 If the <option>command</option> option does not yield an absolute path name, the command is
45526 sought in the PATH directories, in the usual way. <emphasis role="bold">Warning</emphasis>: This does not
45527 apply to a command specified as a transport filter.
45528 </para>
45529 <para>
45530 <indexterm role="option">
45531 <primary><option>permit_coredump</option></primary>
45532 </indexterm>
45533 </para>
45534 <informaltable frame="all">
45535 <tgroup cols="4" colsep="0" rowsep="0">
45536 <colspec colwidth="8*" align="left"/>
45537 <colspec colwidth="6*" align="center"/>
45538 <colspec colwidth="6*" align="center"/>
45539 <colspec colwidth="6*" align="right"/>
45540 <tbody>
45541 <row>
45542 <entry><option>permit_coredump</option></entry>
45543 <entry>Use: <emphasis>pipe</emphasis></entry>
45544 <entry>Type: <emphasis>boolean</emphasis></entry>
45545 <entry>Default: <emphasis>false</emphasis></entry>
45546 </row>
45547 </tbody>
45548 </tgroup>
45549 </informaltable>
45550 <para>
45551 Normally Exim inhibits core-dumps during delivery.  If you have a need to get
45552 a core-dump of a pipe command, enable this command.  This enables core-dumps
45553 during delivery and affects both the Exim binary and the pipe command run.
45554 It is recommended that this option remain off unless and until you have a need
45555 for it and that this only be enabled when needed, as the risk of excessive
45556 resource consumption can be quite high.  Note also that Exim is typically
45557 installed as a setuid binary and most operating systems will inhibit coredumps
45558 of these by default, so further OS-specific action may be required.
45559 </para>
45560 <para>
45561 <indexterm role="option">
45562 <primary><option>pipe_as_creator</option></primary>
45563 </indexterm>
45564 </para>
45565 <informaltable frame="all">
45566 <tgroup cols="4" colsep="0" rowsep="0">
45567 <colspec colwidth="8*" align="left"/>
45568 <colspec colwidth="6*" align="center"/>
45569 <colspec colwidth="6*" align="center"/>
45570 <colspec colwidth="6*" align="right"/>
45571 <tbody>
45572 <row>
45573 <entry><option>pipe_as_creator</option></entry>
45574 <entry>Use: <emphasis>pipe</emphasis></entry>
45575 <entry>Type: <emphasis>boolean</emphasis></entry>
45576 <entry>Default: <emphasis>false</emphasis></entry>
45577 </row>
45578 </tbody>
45579 </tgroup>
45580 </informaltable>
45581 <para>
45582 <indexterm role="concept">
45583 <primary>uid (user id)</primary>
45584 <secondary>local delivery</secondary>
45585 </indexterm>
45586 If the generic <option>user</option> option is not set and this option is true, the delivery
45587 process is run under the uid that was in force when Exim was originally called
45588 to accept the message. If the group id is not otherwise set (via the generic
45589 <option>group</option> option), the gid that was in force when Exim was originally called to
45590 accept the message is used.
45591 </para>
45592 <para>
45593 <indexterm role="option">
45594 <primary><option>restrict_to_path</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>restrict_to_path</option></entry>
45606 <entry>Use: <emphasis>pipe</emphasis></entry>
45607 <entry>Type: <emphasis>boolean</emphasis></entry>
45608 <entry>Default: <emphasis>false</emphasis></entry>
45609 </row>
45610 </tbody>
45611 </tgroup>
45612 </informaltable>
45613 <para>
45614 When this option is set, any command name not listed in <option>allow_commands</option> must
45615 contain no slashes. The command is searched for only in the directories listed
45616 in the <option>path</option> option. This option is intended for use in the case when a pipe
45617 command has been generated from a user&#x2019;s <filename>.forward</filename> file. This is usually
45618 handled by a <command>pipe</command> transport called <option>address_pipe</option>.
45619 </para>
45620 <para>
45621 <indexterm role="option">
45622 <primary><option>return_fail_output</option></primary>
45623 </indexterm>
45624 </para>
45625 <informaltable frame="all">
45626 <tgroup cols="4" colsep="0" rowsep="0">
45627 <colspec colwidth="8*" align="left"/>
45628 <colspec colwidth="6*" align="center"/>
45629 <colspec colwidth="6*" align="center"/>
45630 <colspec colwidth="6*" align="right"/>
45631 <tbody>
45632 <row>
45633 <entry><option>return_fail_output</option></entry>
45634 <entry>Use: <emphasis>pipe</emphasis></entry>
45635 <entry>Type: <emphasis>boolean</emphasis></entry>
45636 <entry>Default: <emphasis>false</emphasis></entry>
45637 </row>
45638 </tbody>
45639 </tgroup>
45640 </informaltable>
45641 <para>
45642 If this option is true, and the command produced any output and ended with a
45643 return code other than zero or one of the codes listed in <option>temp_errors</option> (that
45644 is, the delivery failed), the output is returned in the bounce message.
45645 However, if the message has a null sender (that is, it is itself a bounce
45646 message), output from the command is discarded. This option and
45647 <option>return_output</option> are mutually exclusive. Only one of them may be set.
45648 </para>
45649 <para>
45650 <indexterm role="option">
45651 <primary><option>return_output</option></primary>
45652 </indexterm>
45653 </para>
45654 <informaltable frame="all">
45655 <tgroup cols="4" colsep="0" rowsep="0">
45656 <colspec colwidth="8*" align="left"/>
45657 <colspec colwidth="6*" align="center"/>
45658 <colspec colwidth="6*" align="center"/>
45659 <colspec colwidth="6*" align="right"/>
45660 <tbody>
45661 <row>
45662 <entry><option>return_output</option></entry>
45663 <entry>Use: <emphasis>pipe</emphasis></entry>
45664 <entry>Type: <emphasis>boolean</emphasis></entry>
45665 <entry>Default: <emphasis>false</emphasis></entry>
45666 </row>
45667 </tbody>
45668 </tgroup>
45669 </informaltable>
45670 <para>
45671 If this option is true, and the command produced any output, the delivery is
45672 deemed to have failed whatever the return code from the command, and the output
45673 is returned in the bounce message. Otherwise, the output is just discarded.
45674 However, if the message has a null sender (that is, it is a bounce message),
45675 output from the command is always discarded, whatever the setting of this
45676 option. This option and <option>return_fail_output</option> are mutually exclusive. Only one
45677 of them may be set.
45678 </para>
45679 <para>
45680 <indexterm role="option">
45681 <primary><option>temp_errors</option></primary>
45682 </indexterm>
45683 </para>
45684 <informaltable frame="all">
45685 <tgroup cols="4" colsep="0" rowsep="0">
45686 <colspec colwidth="8*" align="left"/>
45687 <colspec colwidth="6*" align="center"/>
45688 <colspec colwidth="6*" align="center"/>
45689 <colspec colwidth="6*" align="right"/>
45690 <tbody>
45691 <row>
45692 <entry><option>temp_errors</option></entry>
45693 <entry>Use: <emphasis>pipe</emphasis></entry>
45694 <entry>Type: <emphasis>string list</emphasis></entry>
45695 <entry>Default: <emphasis>see below</emphasis></entry>
45696 </row>
45697 </tbody>
45698 </tgroup>
45699 </informaltable>
45700 <para>
45701 <indexterm role="concept">
45702 <primary><command>pipe</command> transport</primary>
45703 <secondary>temporary failure</secondary>
45704 </indexterm>
45705 This option contains either a colon-separated list of numbers, or a single
45706 asterisk. If <option>ignore_status</option> is false
45707 and <option>return_output</option> is not set,
45708 and the command exits with a non-zero return code, the failure is treated as
45709 temporary and the delivery is deferred if the return code matches one of the
45710 numbers, or if the setting is a single asterisk. Otherwise, non-zero return
45711 codes are treated as permanent errors. The default setting contains the codes
45712 defined by EX_TEMPFAIL and EX_CANTCREAT in <filename>sysexits.h</filename>. If Exim is
45713 compiled on a system that does not define these macros, it assumes values of 75
45714 and 73, respectively.
45715 </para>
45716 <para>
45717 <indexterm role="option">
45718 <primary><option>timeout</option></primary>
45719 </indexterm>
45720 </para>
45721 <informaltable frame="all">
45722 <tgroup cols="4" colsep="0" rowsep="0">
45723 <colspec colwidth="8*" align="left"/>
45724 <colspec colwidth="6*" align="center"/>
45725 <colspec colwidth="6*" align="center"/>
45726 <colspec colwidth="6*" align="right"/>
45727 <tbody>
45728 <row>
45729 <entry><option>timeout</option></entry>
45730 <entry>Use: <emphasis>pipe</emphasis></entry>
45731 <entry>Type: <emphasis>time</emphasis></entry>
45732 <entry>Default: <emphasis>1h</emphasis></entry>
45733 </row>
45734 </tbody>
45735 </tgroup>
45736 </informaltable>
45737 <para>
45738 If the command fails to complete within this time, it is killed. This normally
45739 causes the delivery to fail (but see <option>timeout_defer</option>). A zero time interval
45740 specifies no timeout. In order to ensure that any subprocesses created by the
45741 command are also killed, Exim makes the initial process a process group leader,
45742 and kills the whole process group on a timeout. However, this can be defeated
45743 if one of the processes starts a new process group.
45744 </para>
45745 <para>
45746 <indexterm role="option">
45747 <primary><option>timeout_defer</option></primary>
45748 </indexterm>
45749 </para>
45750 <informaltable frame="all">
45751 <tgroup cols="4" colsep="0" rowsep="0">
45752 <colspec colwidth="8*" align="left"/>
45753 <colspec colwidth="6*" align="center"/>
45754 <colspec colwidth="6*" align="center"/>
45755 <colspec colwidth="6*" align="right"/>
45756 <tbody>
45757 <row>
45758 <entry><option>timeout_defer</option></entry>
45759 <entry>Use: <emphasis>pipe</emphasis></entry>
45760 <entry>Type: <emphasis>boolean</emphasis></entry>
45761 <entry>Default: <emphasis>false</emphasis></entry>
45762 </row>
45763 </tbody>
45764 </tgroup>
45765 </informaltable>
45766 <para>
45767 A timeout in a <command>pipe</command> transport, either in the command that the transport
45768 runs, or in a transport filter that is associated with it, is by default
45769 treated as a hard error, and the delivery fails. However, if <option>timeout_defer</option>
45770 is set true, both kinds of timeout become temporary errors, causing the
45771 delivery to be deferred.
45772 </para>
45773 <para>
45774 <indexterm role="option">
45775 <primary><option>umask</option></primary>
45776 </indexterm>
45777 </para>
45778 <informaltable frame="all">
45779 <tgroup cols="4" colsep="0" rowsep="0">
45780 <colspec colwidth="8*" align="left"/>
45781 <colspec colwidth="6*" align="center"/>
45782 <colspec colwidth="6*" align="center"/>
45783 <colspec colwidth="6*" align="right"/>
45784 <tbody>
45785 <row>
45786 <entry><option>umask</option></entry>
45787 <entry>Use: <emphasis>pipe</emphasis></entry>
45788 <entry>Type: <emphasis>octal integer</emphasis></entry>
45789 <entry>Default: <emphasis>022</emphasis></entry>
45790 </row>
45791 </tbody>
45792 </tgroup>
45793 </informaltable>
45794 <para>
45795 This specifies the umask setting for the subprocess that runs the command.
45796 </para>
45797 <para>
45798 <indexterm role="option">
45799 <primary><option>use_bsmtp</option></primary>
45800 </indexterm>
45801 </para>
45802 <informaltable frame="all">
45803 <tgroup cols="4" colsep="0" rowsep="0">
45804 <colspec colwidth="8*" align="left"/>
45805 <colspec colwidth="6*" align="center"/>
45806 <colspec colwidth="6*" align="center"/>
45807 <colspec colwidth="6*" align="right"/>
45808 <tbody>
45809 <row>
45810 <entry><option>use_bsmtp</option></entry>
45811 <entry>Use: <emphasis>pipe</emphasis></entry>
45812 <entry>Type: <emphasis>boolean</emphasis></entry>
45813 <entry>Default: <emphasis>false</emphasis></entry>
45814 </row>
45815 </tbody>
45816 </tgroup>
45817 </informaltable>
45818 <para>
45819 <indexterm role="concept">
45820 <primary>envelope sender</primary>
45821 </indexterm>
45822 If this option is set true, the <command>pipe</command> transport writes messages in <quote>batch
45823 SMTP</quote> format, with the envelope sender and recipient(s) included as SMTP
45824 commands. If you want to include a leading HELO command with such messages,
45825 you can do so by setting the <option>message_prefix</option> option. See section
45826 <xref linkend="SECTbatchSMTP"/> for details of batch SMTP.
45827 </para>
45828 <para>
45829 <indexterm role="option">
45830 <primary><option>use_classresources</option></primary>
45831 </indexterm>
45832 </para>
45833 <informaltable frame="all">
45834 <tgroup cols="4" colsep="0" rowsep="0">
45835 <colspec colwidth="8*" align="left"/>
45836 <colspec colwidth="6*" align="center"/>
45837 <colspec colwidth="6*" align="center"/>
45838 <colspec colwidth="6*" align="right"/>
45839 <tbody>
45840 <row>
45841 <entry><option>use_classresources</option></entry>
45842 <entry>Use: <emphasis>pipe</emphasis></entry>
45843 <entry>Type: <emphasis>boolean</emphasis></entry>
45844 <entry>Default: <emphasis>false</emphasis></entry>
45845 </row>
45846 </tbody>
45847 </tgroup>
45848 </informaltable>
45849 <para>
45850 <indexterm role="concept">
45851 <primary>class resources (BSD)</primary>
45852 </indexterm>
45853 This option is available only when Exim is running on FreeBSD, NetBSD, or
45854 BSD/OS. If it is set true, the <function>setclassresources()</function> function is used to set
45855 resource limits when a <command>pipe</command> transport is run to perform a delivery. The
45856 limits for the uid under which the pipe is to run are obtained from the login
45857 class database.
45858 </para>
45859 <para>
45860 <indexterm role="option">
45861 <primary><option>use_crlf</option></primary>
45862 </indexterm>
45863 </para>
45864 <informaltable frame="all">
45865 <tgroup cols="4" colsep="0" rowsep="0">
45866 <colspec colwidth="8*" align="left"/>
45867 <colspec colwidth="6*" align="center"/>
45868 <colspec colwidth="6*" align="center"/>
45869 <colspec colwidth="6*" align="right"/>
45870 <tbody>
45871 <row>
45872 <entry><option>use_crlf</option></entry>
45873 <entry>Use: <emphasis>pipe</emphasis></entry>
45874 <entry>Type: <emphasis>boolean</emphasis></entry>
45875 <entry>Default: <emphasis>false</emphasis></entry>
45876 </row>
45877 </tbody>
45878 </tgroup>
45879 </informaltable>
45880 <para>
45881 <indexterm role="concept">
45882 <primary>carriage return</primary>
45883 </indexterm>
45884 <indexterm role="concept">
45885 <primary>linefeed</primary>
45886 </indexterm>
45887 This option causes lines to be terminated with the two-character CRLF sequence
45888 (carriage return, linefeed) instead of just a linefeed character. In the case
45889 of batched SMTP, the byte sequence written to the pipe is then an exact image
45890 of what would be sent down a real SMTP connection.
45891 </para>
45892 <para>
45893 The contents of the <option>message_prefix</option> and <option>message_suffix</option> options are
45894 written verbatim, so must contain their own carriage return characters if these
45895 are needed. When <option>use_bsmtp</option> is not set, the default values for both
45896 <option>message_prefix</option> and <option>message_suffix</option> end with a single linefeed, so their
45897 values must be changed to end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
45898 </para>
45899 <para>
45900 <indexterm role="option">
45901 <primary><option>use_shell</option></primary>
45902 </indexterm>
45903 </para>
45904 <informaltable frame="all">
45905 <tgroup cols="4" colsep="0" rowsep="0">
45906 <colspec colwidth="8*" align="left"/>
45907 <colspec colwidth="6*" align="center"/>
45908 <colspec colwidth="6*" align="center"/>
45909 <colspec colwidth="6*" align="right"/>
45910 <tbody>
45911 <row>
45912 <entry><option>use_shell</option></entry>
45913 <entry>Use: <emphasis>pipe</emphasis></entry>
45914 <entry>Type: <emphasis>boolean</emphasis></entry>
45915 <entry>Default: <emphasis>false</emphasis></entry>
45916 </row>
45917 </tbody>
45918 </tgroup>
45919 </informaltable>
45920 <para>
45921 <indexterm role="variable">
45922 <primary><varname>$pipe_addresses</varname></primary>
45923 </indexterm>
45924 If this option is set, it causes the command to be passed to <filename>/bin/sh</filename>
45925 instead of being run directly from the transport, as described in section
45926 <xref linkend="SECThowcommandrun"/>. This is less secure, but is needed in some situations
45927 where the command is expected to be run under a shell and cannot easily be
45928 modified. The <option>allow_commands</option> and <option>restrict_to_path</option> options, and the
45929 <literal>$pipe_addresses</literal> facility are incompatible with <option>use_shell</option>. The
45930 command is expanded as a single string, and handed to <filename>/bin/sh</filename> as data for
45931 its <option>-c</option> option.
45932 </para>
45933 </section>
45934 <section id="SECID143">
45935 <title>Using an external local delivery agent</title>
45936 <para>
45937 <indexterm role="concept">
45938 <primary>local delivery</primary>
45939 <secondary>using an external agent</secondary>
45940 </indexterm>
45941 <indexterm role="concept">
45942 <primary><emphasis>procmail</emphasis></primary>
45943 </indexterm>
45944 <indexterm role="concept">
45945 <primary>external local delivery</primary>
45946 </indexterm>
45947 <indexterm role="concept">
45948 <primary>delivery</primary>
45949 <secondary><emphasis>procmail</emphasis></secondary>
45950 </indexterm>
45951 <indexterm role="concept">
45952 <primary>delivery</primary>
45953 <secondary>by external agent</secondary>
45954 </indexterm>
45955 The <command>pipe</command> transport can be used to pass all messages that require local
45956 delivery to a separate local delivery agent such as <option>procmail</option>. When doing
45957 this, care must be taken to ensure that the pipe is run under an appropriate
45958 uid and gid. In some configurations one wants this to be a uid that is trusted
45959 by the delivery agent to supply the correct sender of the message. It may be
45960 necessary to recompile or reconfigure the delivery agent so that it trusts an
45961 appropriate user. The following is an example transport and router
45962 configuration for <option>procmail</option>:
45963 </para>
45964 <literallayout class="monospaced">
45965 # transport
45966 procmail_pipe:
45967   driver = pipe
45968   command = /usr/local/bin/procmail -d $local_part
45969   return_path_add
45970   delivery_date_add
45971   envelope_to_add
45972   check_string = "From "
45973   escape_string = "&gt;From "
45974   umask = 077
45975   user = $local_part
45976   group = mail
45977
45978 # router
45979 procmail:
45980   driver = accept
45981   check_local_user
45982   transport = procmail_pipe
45983 </literallayout>
45984 <para>
45985 In this example, the pipe is run as the local user, but with the group set to
45986 <emphasis>mail</emphasis>. An alternative is to run the pipe as a specific user such as <emphasis>mail</emphasis>
45987 or <emphasis>exim</emphasis>, but in this case you must arrange for <option>procmail</option> to trust that
45988 user to supply a correct sender address. If you do not specify either a
45989 <option>group</option> or a <option>user</option> option, the pipe command is run as the local user. The
45990 home directory is the user&#x2019;s home directory by default.
45991 </para>
45992 <para>
45993 <emphasis role="bold">Note</emphasis>: The command that the pipe transport runs does <emphasis>not</emphasis> begin with
45994 </para>
45995 <literallayout class="monospaced">
45996 IFS=" "
45997 </literallayout>
45998 <para>
45999 as shown in some <option>procmail</option> documentation, because Exim does not by default
46000 use a shell to run pipe commands.
46001 </para>
46002 <para>
46003 <indexterm role="concept">
46004 <primary>Cyrus</primary>
46005 </indexterm>
46006 The next example shows a transport and a router for a system where local
46007 deliveries are handled by the Cyrus IMAP server.
46008 </para>
46009 <literallayout class="monospaced">
46010 # transport
46011 local_delivery_cyrus:
46012   driver = pipe
46013   command = /usr/cyrus/bin/deliver \
46014             -m ${substr_1:$local_part_suffix} -- $local_part
46015   user = cyrus
46016   group = mail
46017   return_output
46018   log_output
46019   message_prefix =
46020   message_suffix =
46021
46022 # router
46023 local_user_cyrus:
46024   driver = accept
46025   check_local_user
46026   local_part_suffix = .*
46027   transport = local_delivery_cyrus
46028 </literallayout>
46029 <para>
46030 Note the unsetting of <option>message_prefix</option> and <option>message_suffix</option>, and the use of
46031 <option>return_output</option> to cause any text written by Cyrus to be returned to the
46032 sender.
46033 <indexterm role="concept" startref="IIDpiptra1" class="endofrange"/>
46034 <indexterm role="concept" startref="IIDpiptra2" class="endofrange"/>
46035 </para>
46036 </section>
46037 </chapter>
46038
46039 <chapter id="CHAPsmtptrans">
46040 <title>The smtp transport</title>
46041 <para>
46042 <indexterm role="concept" id="IIDsmttra1" class="startofrange">
46043 <primary>transports</primary>
46044 <secondary><command>smtp</command></secondary>
46045 </indexterm>
46046 <indexterm role="concept" id="IIDsmttra2" class="startofrange">
46047 <primary><command>smtp</command> transport</primary>
46048 </indexterm>
46049 The <command>smtp</command> transport delivers messages over TCP/IP connections using the SMTP
46050 or LMTP protocol. The list of hosts to try can either be taken from the address
46051 that is being processed (having been set up by the router), or specified
46052 explicitly for the transport. Timeout and retry processing (see chapter
46053 <xref linkend="CHAPretry"/>) is applied to each IP address independently.
46054 </para>
46055 <section id="SECID144">
46056 <title>Multiple messages on a single connection</title>
46057 <para>
46058 The sending of multiple messages over a single TCP/IP connection can arise in
46059 two ways:
46060 </para>
46061 <itemizedlist>
46062 <listitem>
46063 <para>
46064 If a message contains more than <option>max_rcpt</option> (see below) addresses that are
46065 routed to the same host, more than one copy of the message has to be sent to
46066 that host. In this situation, multiple copies may be sent in a single run of
46067 the <command>smtp</command> transport over a single TCP/IP connection. (What Exim actually
46068 does when it has too many addresses to send in one message also depends on the
46069 value of the global <option>remote_max_parallel</option> option. Details are given in
46070 section <xref linkend="SECToutSMTPTCP"/>.)
46071 </para>
46072 </listitem>
46073 <listitem>
46074 <para>
46075 <indexterm role="concept">
46076 <primary>hints database</primary>
46077 <secondary>remembering routing</secondary>
46078 </indexterm>
46079 When a message has been successfully delivered over a TCP/IP connection, Exim
46080 looks in its hints database to see if there are any other messages awaiting a
46081 connection to the same host. If there are, a new delivery process is started
46082 for one of them, and the current TCP/IP connection is passed on to it. The new
46083 process may in turn send multiple copies and possibly create yet another
46084 process.
46085 </para>
46086 </listitem>
46087 </itemizedlist>
46088 <para>
46089 For each copy sent over the same TCP/IP connection, a sequence counter is
46090 incremented, and if it ever gets to the value of <option>connection_max_messages</option>,
46091 no further messages are sent over that connection.
46092 </para>
46093 </section>
46094 <section id="SECID145">
46095 <title>Use of the $host and $host_address variables</title>
46096 <para>
46097 <indexterm role="variable">
46098 <primary><varname>$host</varname></primary>
46099 </indexterm>
46100 <indexterm role="variable">
46101 <primary><varname>$host_address</varname></primary>
46102 </indexterm>
46103 At the start of a run of the <command>smtp</command> transport, the values of <varname>$host</varname> and
46104 <varname>$host_address</varname> are the name and IP address of the first host on the host list
46105 passed by the router. However, when the transport is about to connect to a
46106 specific host, and while it is connected to that host, <varname>$host</varname> and
46107 <varname>$host_address</varname> are set to the values for that host. These are the values
46108 that are in force when the <option>helo_data</option>, <option>hosts_try_auth</option>, <option>interface</option>,
46109 <option>serialize_hosts</option>, and the various TLS options are expanded.
46110 </para>
46111 </section>
46112 <section id="usecippeer">
46113 <title>Use of $tls_cipher and $tls_peerdn</title>
46114 <para>
46115 <indexterm role="variable">
46116 <primary><varname>$tls_bits</varname></primary>
46117 </indexterm>
46118 <indexterm role="variable">
46119 <primary><varname>$tls_cipher</varname></primary>
46120 </indexterm>
46121 <indexterm role="variable">
46122 <primary><varname>$tls_peerdn</varname></primary>
46123 </indexterm>
46124 <indexterm role="variable">
46125 <primary><varname>$tls_sni</varname></primary>
46126 </indexterm>
46127 At the start of a run of the <command>smtp</command> transport, the values of <varname>$tls_bits</varname>,
46128 <varname>$tls_cipher</varname>, <varname>$tls_peerdn</varname> and <varname>$tls_sni</varname>
46129 are the values that were set when the message was received.
46130 These are the values that are used for options that are expanded before any
46131 SMTP connections are made. Just before each connection is made, these four
46132 variables are emptied. If TLS is subsequently started, they are set to the
46133 appropriate values for the outgoing connection, and these are the values that
46134 are in force when any authenticators are run and when the
46135 <option>authenticated_sender</option> option is expanded.
46136 </para>
46137 <para>
46138 These variables are deprecated in favour of <varname>$tls_in_cipher</varname> et. al.
46139 and will be removed in a future release.
46140 </para>
46141 </section>
46142 <section id="SECID146">
46143 <title>Private options for smtp</title>
46144 <para>
46145 <indexterm role="concept">
46146 <primary>options</primary>
46147 <secondary><command>smtp</command> transport</secondary>
46148 </indexterm>
46149 The private options of the <command>smtp</command> transport are as follows:
46150 </para>
46151 <para>
46152 <indexterm role="option">
46153 <primary><option>address_retry_include_sender</option></primary>
46154 </indexterm>
46155 </para>
46156 <informaltable frame="all">
46157 <tgroup cols="4" colsep="0" rowsep="0">
46158 <colspec colwidth="8*" align="left"/>
46159 <colspec colwidth="6*" align="center"/>
46160 <colspec colwidth="6*" align="center"/>
46161 <colspec colwidth="6*" align="right"/>
46162 <tbody>
46163 <row>
46164 <entry><option>address_retry_include_sender</option></entry>
46165 <entry>Use: <emphasis>smtp</emphasis></entry>
46166 <entry>Type: <emphasis>boolean</emphasis></entry>
46167 <entry>Default: <emphasis>true</emphasis></entry>
46168 </row>
46169 </tbody>
46170 </tgroup>
46171 </informaltable>
46172 <para>
46173 <indexterm role="concept">
46174 <primary>4<emphasis>xx</emphasis> responses</primary>
46175 <secondary>retrying after</secondary>
46176 </indexterm>
46177 When an address is delayed because of a 4<emphasis>xx</emphasis> response to a RCPT command, it
46178 is the combination of sender and recipient that is delayed in subsequent queue
46179 runs until the retry time is reached. You can delay the recipient without
46180 reference to the sender (which is what earlier versions of Exim did), by
46181 setting <option>address_retry_include_sender</option> false. However, this can lead to
46182 problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT commands.
46183 </para>
46184 <para>
46185 <indexterm role="option">
46186 <primary><option>allow_localhost</option></primary>
46187 </indexterm>
46188 </para>
46189 <informaltable frame="all">
46190 <tgroup cols="4" colsep="0" rowsep="0">
46191 <colspec colwidth="8*" align="left"/>
46192 <colspec colwidth="6*" align="center"/>
46193 <colspec colwidth="6*" align="center"/>
46194 <colspec colwidth="6*" align="right"/>
46195 <tbody>
46196 <row>
46197 <entry><option>allow_localhost</option></entry>
46198 <entry>Use: <emphasis>smtp</emphasis></entry>
46199 <entry>Type: <emphasis>boolean</emphasis></entry>
46200 <entry>Default: <emphasis>false</emphasis></entry>
46201 </row>
46202 </tbody>
46203 </tgroup>
46204 </informaltable>
46205 <para>
46206 <indexterm role="concept">
46207 <primary>local host</primary>
46208 <secondary>sending to</secondary>
46209 </indexterm>
46210 <indexterm role="concept">
46211 <primary>fallback</primary>
46212 <secondary>hosts specified on transport</secondary>
46213 </indexterm>
46214 When a host specified in <option>hosts</option> or <option>fallback_hosts</option> (see below) turns out
46215 to be the local host, or is listed in <option>hosts_treat_as_local</option>, delivery is
46216 deferred by default. However, if <option>allow_localhost</option> is set, Exim goes on to do
46217 the delivery anyway. This should be used only in special cases when the
46218 configuration ensures that no looping will result (for example, a differently
46219 configured Exim is listening on the port to which the message is sent).
46220 </para>
46221 <para>
46222 <indexterm role="option">
46223 <primary><option>authenticated_sender</option></primary>
46224 </indexterm>
46225 </para>
46226 <informaltable frame="all">
46227 <tgroup cols="4" colsep="0" rowsep="0">
46228 <colspec colwidth="8*" align="left"/>
46229 <colspec colwidth="6*" align="center"/>
46230 <colspec colwidth="6*" align="center"/>
46231 <colspec colwidth="6*" align="right"/>
46232 <tbody>
46233 <row>
46234 <entry><option>authenticated_sender</option></entry>
46235 <entry>Use: <emphasis>smtp</emphasis></entry>
46236 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46237 <entry>Default: <emphasis>unset</emphasis></entry>
46238 </row>
46239 </tbody>
46240 </tgroup>
46241 </informaltable>
46242 <para>
46243 <indexterm role="concept">
46244 <primary>Cyrus</primary>
46245 </indexterm>
46246 When Exim has authenticated as a client, or if <option>authenticated_sender_force</option>
46247 is true, this option sets a value for the AUTH= item on outgoing MAIL commands,
46248 overriding any existing authenticated sender value. If the string expansion is
46249 forced to fail, the option is ignored. Other expansion failures cause delivery
46250 to be deferred. If the result of expansion is an empty string, that is also
46251 ignored.
46252 </para>
46253 <para>
46254 The expansion happens after the outgoing connection has been made and TLS
46255 started, if required. This means that the <varname>$host</varname>, <varname>$host_address</varname>,
46256 <varname>$tls_out_cipher</varname>, and <varname>$tls_out_peerdn</varname> variables are set according to the
46257 particular connection.
46258 </para>
46259 <para>
46260 If the SMTP session is not authenticated, the expansion of
46261 <option>authenticated_sender</option> still happens (and can cause the delivery to be
46262 deferred if it fails), but no AUTH= item is added to MAIL commands
46263 unless <option>authenticated_sender_force</option> is true.
46264 </para>
46265 <para>
46266 This option allows you to use the <command>smtp</command> transport in LMTP mode to
46267 deliver mail to Cyrus IMAP and provide the proper local part as the
46268 <quote>authenticated sender</quote>, via a setting such as:
46269 </para>
46270 <literallayout class="monospaced">
46271 authenticated_sender = $local_part
46272 </literallayout>
46273 <para>
46274 This removes the need for IMAP subfolders to be assigned special ACLs to
46275 allow direct delivery to those subfolders.
46276 </para>
46277 <para>
46278 Because of expected uses such as that just described for Cyrus (when no
46279 domain is involved), there is no checking on the syntax of the provided
46280 value.
46281 </para>
46282 <para>
46283 <indexterm role="option">
46284 <primary><option>authenticated_sender_force</option></primary>
46285 </indexterm>
46286 </para>
46287 <informaltable frame="all">
46288 <tgroup cols="4" colsep="0" rowsep="0">
46289 <colspec colwidth="8*" align="left"/>
46290 <colspec colwidth="6*" align="center"/>
46291 <colspec colwidth="6*" align="center"/>
46292 <colspec colwidth="6*" align="right"/>
46293 <tbody>
46294 <row>
46295 <entry><option>authenticated_sender_force</option></entry>
46296 <entry>Use: <emphasis>smtp</emphasis></entry>
46297 <entry>Type: <emphasis>boolean</emphasis></entry>
46298 <entry>Default: <emphasis>false</emphasis></entry>
46299 </row>
46300 </tbody>
46301 </tgroup>
46302 </informaltable>
46303 <para>
46304 If this option is set true, the <option>authenticated_sender</option> option&#x2019;s value
46305 is used for the AUTH= item on outgoing MAIL commands, even if Exim has not
46306 authenticated as a client.
46307 </para>
46308 <para>
46309 <indexterm role="option">
46310 <primary><option>command_timeout</option></primary>
46311 </indexterm>
46312 </para>
46313 <informaltable frame="all">
46314 <tgroup cols="4" colsep="0" rowsep="0">
46315 <colspec colwidth="8*" align="left"/>
46316 <colspec colwidth="6*" align="center"/>
46317 <colspec colwidth="6*" align="center"/>
46318 <colspec colwidth="6*" align="right"/>
46319 <tbody>
46320 <row>
46321 <entry><option>command_timeout</option></entry>
46322 <entry>Use: <emphasis>smtp</emphasis></entry>
46323 <entry>Type: <emphasis>time</emphasis></entry>
46324 <entry>Default: <emphasis>5m</emphasis></entry>
46325 </row>
46326 </tbody>
46327 </tgroup>
46328 </informaltable>
46329 <para>
46330 This sets a timeout for receiving a response to an SMTP command that has been
46331 sent out. It is also used when waiting for the initial banner line from the
46332 remote host. Its value must not be zero.
46333 </para>
46334 <para>
46335 <indexterm role="option">
46336 <primary><option>connect_timeout</option></primary>
46337 </indexterm>
46338 </para>
46339 <informaltable frame="all">
46340 <tgroup cols="4" colsep="0" rowsep="0">
46341 <colspec colwidth="8*" align="left"/>
46342 <colspec colwidth="6*" align="center"/>
46343 <colspec colwidth="6*" align="center"/>
46344 <colspec colwidth="6*" align="right"/>
46345 <tbody>
46346 <row>
46347 <entry><option>connect_timeout</option></entry>
46348 <entry>Use: <emphasis>smtp</emphasis></entry>
46349 <entry>Type: <emphasis>time</emphasis></entry>
46350 <entry>Default: <emphasis>5m</emphasis></entry>
46351 </row>
46352 </tbody>
46353 </tgroup>
46354 </informaltable>
46355 <para>
46356 This sets a timeout for the <function>connect()</function> function, which sets up a TCP/IP call
46357 to a remote host. A setting of zero allows the system timeout (typically
46358 several minutes) to act. To have any effect, the value of this option must be
46359 less than the system timeout. However, it has been observed that on some
46360 systems there is no system timeout, which is why the default value for this
46361 option is 5 minutes, a value recommended by RFC 1123.
46362 </para>
46363 <para>
46364 <indexterm role="option">
46365 <primary><option>connection_max_messages</option></primary>
46366 </indexterm>
46367 </para>
46368 <informaltable frame="all">
46369 <tgroup cols="4" colsep="0" rowsep="0">
46370 <colspec colwidth="8*" align="left"/>
46371 <colspec colwidth="6*" align="center"/>
46372 <colspec colwidth="6*" align="center"/>
46373 <colspec colwidth="6*" align="right"/>
46374 <tbody>
46375 <row>
46376 <entry><option>connection_max_messages</option></entry>
46377 <entry>Use: <emphasis>smtp</emphasis></entry>
46378 <entry>Type: <emphasis>integer</emphasis></entry>
46379 <entry>Default: <emphasis>500</emphasis></entry>
46380 </row>
46381 </tbody>
46382 </tgroup>
46383 </informaltable>
46384 <para>
46385 <indexterm role="concept">
46386 <primary>SMTP</primary>
46387 <secondary>passed connection</secondary>
46388 </indexterm>
46389 <indexterm role="concept">
46390 <primary>SMTP</primary>
46391 <secondary>multiple deliveries</secondary>
46392 </indexterm>
46393 <indexterm role="concept">
46394 <primary>multiple SMTP deliveries</primary>
46395 </indexterm>
46396 This controls the maximum number of separate message deliveries that are sent
46397 over a single TCP/IP connection. If the value is zero, there is no limit.
46398 For testing purposes, this value can be overridden by the <option>-oB</option> command line
46399 option.
46400 </para>
46401 <para>
46402 <indexterm role="option">
46403 <primary><option>data_timeout</option></primary>
46404 </indexterm>
46405 </para>
46406 <informaltable frame="all">
46407 <tgroup cols="4" colsep="0" rowsep="0">
46408 <colspec colwidth="8*" align="left"/>
46409 <colspec colwidth="6*" align="center"/>
46410 <colspec colwidth="6*" align="center"/>
46411 <colspec colwidth="6*" align="right"/>
46412 <tbody>
46413 <row>
46414 <entry><option>data_timeout</option></entry>
46415 <entry>Use: <emphasis>smtp</emphasis></entry>
46416 <entry>Type: <emphasis>time</emphasis></entry>
46417 <entry>Default: <emphasis>5m</emphasis></entry>
46418 </row>
46419 </tbody>
46420 </tgroup>
46421 </informaltable>
46422 <para>
46423 This sets a timeout for the transmission of each block in the data portion of
46424 the message. As a result, the overall timeout for a message depends on the size
46425 of the message. Its value must not be zero. See also <option>final_timeout</option>.
46426 </para>
46427 <para>
46428 <indexterm role="option">
46429 <primary><option>unset</option></primary>
46430 </indexterm>
46431 </para>
46432 <informaltable frame="all">
46433 <tgroup cols="4" colsep="0" rowsep="0">
46434 <colspec colwidth="8*" align="left"/>
46435 <colspec colwidth="6*" align="center"/>
46436 <colspec colwidth="6*" align="center"/>
46437 <colspec colwidth="6*" align="right"/>
46438 <tbody>
46439 <row>
46440 <entry><option>dkim_domain</option></entry>
46441 <entry>Use: <emphasis>smtp</emphasis></entry>
46442 <entry>Type: <emphasis>string</emphasis></entry>
46443 <entry>Default: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
46444 </row>
46445 </tbody>
46446 </tgroup>
46447 </informaltable>
46448 <para>
46449 <indexterm role="option">
46450 <primary><option>dkim_selector</option></primary>
46451 </indexterm>
46452 </para>
46453 <informaltable frame="all">
46454 <tgroup cols="4" colsep="0" rowsep="0">
46455 <colspec colwidth="8*" align="left"/>
46456 <colspec colwidth="6*" align="center"/>
46457 <colspec colwidth="6*" align="center"/>
46458 <colspec colwidth="6*" align="right"/>
46459 <tbody>
46460 <row>
46461 <entry><option>dkim_selector</option></entry>
46462 <entry>Use: <emphasis>smtp</emphasis></entry>
46463 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46464 <entry>Default: <emphasis>unset</emphasis></entry>
46465 </row>
46466 </tbody>
46467 </tgroup>
46468 </informaltable>
46469 <para>
46470 <indexterm role="option">
46471 <primary><option>dkim_private_key</option></primary>
46472 </indexterm>
46473 </para>
46474 <informaltable frame="all">
46475 <tgroup cols="4" colsep="0" rowsep="0">
46476 <colspec colwidth="8*" align="left"/>
46477 <colspec colwidth="6*" align="center"/>
46478 <colspec colwidth="6*" align="center"/>
46479 <colspec colwidth="6*" align="right"/>
46480 <tbody>
46481 <row>
46482 <entry><option>dkim_private_key</option></entry>
46483 <entry>Use: <emphasis>smtp</emphasis></entry>
46484 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46485 <entry>Default: <emphasis>unset</emphasis></entry>
46486 </row>
46487 </tbody>
46488 </tgroup>
46489 </informaltable>
46490 <para>
46491 <indexterm role="option">
46492 <primary><option>dkim_canon</option></primary>
46493 </indexterm>
46494 </para>
46495 <informaltable frame="all">
46496 <tgroup cols="4" colsep="0" rowsep="0">
46497 <colspec colwidth="8*" align="left"/>
46498 <colspec colwidth="6*" align="center"/>
46499 <colspec colwidth="6*" align="center"/>
46500 <colspec colwidth="6*" align="right"/>
46501 <tbody>
46502 <row>
46503 <entry><option>dkim_canon</option></entry>
46504 <entry>Use: <emphasis>smtp</emphasis></entry>
46505 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46506 <entry>Default: <emphasis>unset</emphasis></entry>
46507 </row>
46508 </tbody>
46509 </tgroup>
46510 </informaltable>
46511 <para>
46512 <indexterm role="option">
46513 <primary><option>dkim_strict</option></primary>
46514 </indexterm>
46515 </para>
46516 <informaltable frame="all">
46517 <tgroup cols="4" colsep="0" rowsep="0">
46518 <colspec colwidth="8*" align="left"/>
46519 <colspec colwidth="6*" align="center"/>
46520 <colspec colwidth="6*" align="center"/>
46521 <colspec colwidth="6*" align="right"/>
46522 <tbody>
46523 <row>
46524 <entry><option>dkim_strict</option></entry>
46525 <entry>Use: <emphasis>smtp</emphasis></entry>
46526 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46527 <entry>Default: <emphasis>unset</emphasis></entry>
46528 </row>
46529 </tbody>
46530 </tgroup>
46531 </informaltable>
46532 <para>
46533 <indexterm role="option">
46534 <primary><option>dkim_sign_headers</option></primary>
46535 </indexterm>
46536 </para>
46537 <informaltable frame="all">
46538 <tgroup cols="4" colsep="0" rowsep="0">
46539 <colspec colwidth="8*" align="left"/>
46540 <colspec colwidth="6*" align="center"/>
46541 <colspec colwidth="6*" align="center"/>
46542 <colspec colwidth="6*" align="right"/>
46543 <tbody>
46544 <row>
46545 <entry><option>dkim_sign_headers</option></entry>
46546 <entry>Use: <emphasis>smtp</emphasis></entry>
46547 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46548 <entry>Default: <emphasis>per RFC</emphasis></entry>
46549 </row>
46550 </tbody>
46551 </tgroup>
46552 </informaltable>
46553 <para>
46554 <indexterm role="option">
46555 <primary><option>dkim_hash</option></primary>
46556 </indexterm>
46557 </para>
46558 <informaltable frame="all">
46559 <tgroup cols="4" colsep="0" rowsep="0">
46560 <colspec colwidth="8*" align="left"/>
46561 <colspec colwidth="6*" align="center"/>
46562 <colspec colwidth="6*" align="center"/>
46563 <colspec colwidth="6*" align="right"/>
46564 <tbody>
46565 <row>
46566 <entry><option>dkim_hash</option></entry>
46567 <entry>Use: <emphasis>smtp</emphasis></entry>
46568 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46569 <entry>Default: <emphasis>sha256</emphasis></entry>
46570 </row>
46571 </tbody>
46572 </tgroup>
46573 </informaltable>
46574 <para>
46575 <indexterm role="option">
46576 <primary><option>dkim_identity</option></primary>
46577 </indexterm>
46578 </para>
46579 <informaltable frame="all">
46580 <tgroup cols="4" colsep="0" rowsep="0">
46581 <colspec colwidth="8*" align="left"/>
46582 <colspec colwidth="6*" align="center"/>
46583 <colspec colwidth="6*" align="center"/>
46584 <colspec colwidth="6*" align="right"/>
46585 <tbody>
46586 <row>
46587 <entry><option>dkim_identity</option></entry>
46588 <entry>Use: <emphasis>smtp</emphasis></entry>
46589 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46590 <entry>Default: <emphasis>unset</emphasis></entry>
46591 </row>
46592 </tbody>
46593 </tgroup>
46594 </informaltable>
46595 <para>
46596 DKIM signing options.  For details see section <xref linkend="SECDKIMSIGN"/>.
46597 </para>
46598 <para>
46599 <indexterm role="option">
46600 <primary><option>delay_after_cutoff</option></primary>
46601 </indexterm>
46602 </para>
46603 <informaltable frame="all">
46604 <tgroup cols="4" colsep="0" rowsep="0">
46605 <colspec colwidth="8*" align="left"/>
46606 <colspec colwidth="6*" align="center"/>
46607 <colspec colwidth="6*" align="center"/>
46608 <colspec colwidth="6*" align="right"/>
46609 <tbody>
46610 <row>
46611 <entry><option>delay_after_cutoff</option></entry>
46612 <entry>Use: <emphasis>smtp</emphasis></entry>
46613 <entry>Type: <emphasis>boolean</emphasis></entry>
46614 <entry>Default: <emphasis>true</emphasis></entry>
46615 </row>
46616 </tbody>
46617 </tgroup>
46618 </informaltable>
46619 <para>
46620 This option controls what happens when all remote IP addresses for a given
46621 domain have been inaccessible for so long that they have passed their retry
46622 cutoff times.
46623 </para>
46624 <para>
46625 In the default state, if the next retry time has not been reached for any of
46626 them, the address is bounced without trying any deliveries. In other words,
46627 Exim delays retrying an IP address after the final cutoff time until a new
46628 retry time is reached, and can therefore bounce an address without ever trying
46629 a delivery, when machines have been down for a long time. Some people are
46630 unhappy at this prospect, so...
46631 </para>
46632 <para>
46633 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
46634 addresses are past their final cutoff time, Exim tries to deliver to those
46635 IP addresses that have not been tried since the message arrived. If there are
46636 none, of if they all fail, the address is bounced. In other words, it does not
46637 delay when a new message arrives, but immediately tries those expired IP
46638 addresses that haven&#x2019;t been tried since the message arrived. If there is a
46639 continuous stream of messages for the dead hosts, unsetting
46640 <option>delay_after_cutoff</option> means that there will be many more attempts to deliver
46641 to them.
46642 </para>
46643 <para>
46644 <indexterm role="option">
46645 <primary><option>dns_qualify_single</option></primary>
46646 </indexterm>
46647 </para>
46648 <informaltable frame="all">
46649 <tgroup cols="4" colsep="0" rowsep="0">
46650 <colspec colwidth="8*" align="left"/>
46651 <colspec colwidth="6*" align="center"/>
46652 <colspec colwidth="6*" align="center"/>
46653 <colspec colwidth="6*" align="right"/>
46654 <tbody>
46655 <row>
46656 <entry><option>dns_qualify_single</option></entry>
46657 <entry>Use: <emphasis>smtp</emphasis></entry>
46658 <entry>Type: <emphasis>boolean</emphasis></entry>
46659 <entry>Default: <emphasis>true</emphasis></entry>
46660 </row>
46661 </tbody>
46662 </tgroup>
46663 </informaltable>
46664 <para>
46665 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used,
46666 and the <option>gethostbyname</option> option is false,
46667 the RES_DEFNAMES resolver option is set. See the <option>qualify_single</option> option
46668 in chapter <xref linkend="CHAPdnslookup"/> for more details.
46669 </para>
46670 <para>
46671 <indexterm role="option">
46672 <primary><option>dns_search_parents</option></primary>
46673 </indexterm>
46674 </para>
46675 <informaltable frame="all">
46676 <tgroup cols="4" colsep="0" rowsep="0">
46677 <colspec colwidth="8*" align="left"/>
46678 <colspec colwidth="6*" align="center"/>
46679 <colspec colwidth="6*" align="center"/>
46680 <colspec colwidth="6*" align="right"/>
46681 <tbody>
46682 <row>
46683 <entry><option>dns_search_parents</option></entry>
46684 <entry>Use: <emphasis>smtp</emphasis></entry>
46685 <entry>Type: <emphasis>boolean</emphasis></entry>
46686 <entry>Default: <emphasis>false</emphasis></entry>
46687 </row>
46688 </tbody>
46689 </tgroup>
46690 </informaltable>
46691 <para>
46692 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used, and the
46693 <option>gethostbyname</option> option is false, the RES_DNSRCH resolver option is set.
46694 See the <option>search_parents</option> option in chapter <xref linkend="CHAPdnslookup"/> for more
46695 details.
46696 </para>
46697 <para>
46698 <indexterm role="option">
46699 <primary><option>dnssec_request_domains</option></primary>
46700 </indexterm>
46701 </para>
46702 <informaltable frame="all">
46703 <tgroup cols="4" colsep="0" rowsep="0">
46704 <colspec colwidth="8*" align="left"/>
46705 <colspec colwidth="6*" align="center"/>
46706 <colspec colwidth="6*" align="center"/>
46707 <colspec colwidth="6*" align="right"/>
46708 <tbody>
46709 <row>
46710 <entry><option>dnssec_request_domains</option></entry>
46711 <entry>Use: <emphasis>smtp</emphasis></entry>
46712 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
46713 <entry>Default: <emphasis>unset</emphasis></entry>
46714 </row>
46715 </tbody>
46716 </tgroup>
46717 </informaltable>
46718 <para>
46719 <indexterm role="concept">
46720 <primary>MX record</primary>
46721 <secondary>security</secondary>
46722 </indexterm>
46723 <indexterm role="concept">
46724 <primary>DNSSEC</primary>
46725 <secondary>MX lookup</secondary>
46726 </indexterm>
46727 <indexterm role="concept">
46728 <primary>security</primary>
46729 <secondary>MX lookup</secondary>
46730 </indexterm>
46731 <indexterm role="concept">
46732 <primary>DNS</primary>
46733 <secondary>DNSSEC</secondary>
46734 </indexterm>
46735 DNS lookups for domains matching <option>dnssec_request_domains</option> will be done with
46736 the dnssec request bit set.
46737 This applies to all of the SRV, MX, AAAA, A lookup sequence.
46738 </para>
46739 <para>
46740 <indexterm role="option">
46741 <primary><option>dnssec_require_domains</option></primary>
46742 </indexterm>
46743 </para>
46744 <informaltable frame="all">
46745 <tgroup cols="4" colsep="0" rowsep="0">
46746 <colspec colwidth="8*" align="left"/>
46747 <colspec colwidth="6*" align="center"/>
46748 <colspec colwidth="6*" align="center"/>
46749 <colspec colwidth="6*" align="right"/>
46750 <tbody>
46751 <row>
46752 <entry><option>dnssec_require_domains</option></entry>
46753 <entry>Use: <emphasis>smtp</emphasis></entry>
46754 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
46755 <entry>Default: <emphasis>unset</emphasis></entry>
46756 </row>
46757 </tbody>
46758 </tgroup>
46759 </informaltable>
46760 <para>
46761 <indexterm role="concept">
46762 <primary>MX record</primary>
46763 <secondary>security</secondary>
46764 </indexterm>
46765 <indexterm role="concept">
46766 <primary>DNSSEC</primary>
46767 <secondary>MX lookup</secondary>
46768 </indexterm>
46769 <indexterm role="concept">
46770 <primary>security</primary>
46771 <secondary>MX lookup</secondary>
46772 </indexterm>
46773 <indexterm role="concept">
46774 <primary>DNS</primary>
46775 <secondary>DNSSEC</secondary>
46776 </indexterm>
46777 DNS lookups for domains matching <option>dnssec_require_domains</option> will be done with
46778 the dnssec request bit set.  Any returns not having the Authenticated Data bit
46779 (AD bit) set will be ignored and logged as a host-lookup failure.
46780 This applies to all of the SRV, MX, AAAA, A lookup sequence.
46781 </para>
46782 <para>
46783 <indexterm role="option">
46784 <primary><option>dscp</option></primary>
46785 </indexterm>
46786 </para>
46787 <informaltable frame="all">
46788 <tgroup cols="4" colsep="0" rowsep="0">
46789 <colspec colwidth="8*" align="left"/>
46790 <colspec colwidth="6*" align="center"/>
46791 <colspec colwidth="6*" align="center"/>
46792 <colspec colwidth="6*" align="right"/>
46793 <tbody>
46794 <row>
46795 <entry><option>dscp</option></entry>
46796 <entry>Use: <emphasis>smtp</emphasis></entry>
46797 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46798 <entry>Default: <emphasis>unset</emphasis></entry>
46799 </row>
46800 </tbody>
46801 </tgroup>
46802 </informaltable>
46803 <para>
46804 <indexterm role="concept">
46805 <primary>DCSP</primary>
46806 <secondary>outbound</secondary>
46807 </indexterm>
46808 This option causes the DSCP value associated with a socket to be set to one
46809 of a number of fixed strings or to numeric value.
46810 The <option>-bI:dscp</option> option may be used to ask Exim which names it knows of.
46811 Common values include <literal>throughput</literal>, <literal>mincost</literal>, and on newer systems
46812 <literal>ef</literal>, <literal>af41</literal>, etc.  Numeric values may be in the range 0 to 0x3F.
46813 </para>
46814 <para>
46815 The outbound packets from Exim will be marked with this value in the header
46816 (for IPv4, the TOS field; for IPv6, the TCLASS field); there is no guarantee
46817 that these values will have any effect, not be stripped by networking
46818 equipment, or do much of anything without cooperation with your Network
46819 Engineer and those of all network operators between the source and destination.
46820 </para>
46821 <para>
46822 <indexterm role="option">
46823 <primary><option>fallback_hosts</option></primary>
46824 </indexterm>
46825 </para>
46826 <informaltable frame="all">
46827 <tgroup cols="4" colsep="0" rowsep="0">
46828 <colspec colwidth="8*" align="left"/>
46829 <colspec colwidth="6*" align="center"/>
46830 <colspec colwidth="6*" align="center"/>
46831 <colspec colwidth="6*" align="right"/>
46832 <tbody>
46833 <row>
46834 <entry><option>fallback_hosts</option></entry>
46835 <entry>Use: <emphasis>smtp</emphasis></entry>
46836 <entry>Type: <emphasis>string list</emphasis></entry>
46837 <entry>Default: <emphasis>unset</emphasis></entry>
46838 </row>
46839 </tbody>
46840 </tgroup>
46841 </informaltable>
46842 <para>
46843 <indexterm role="concept">
46844 <primary>fallback</primary>
46845 <secondary>hosts specified on transport</secondary>
46846 </indexterm>
46847 String expansion is not applied to this option. The argument must be a
46848 colon-separated list of host names or IP addresses, optionally also including
46849 port numbers, though the separator can be changed, as described in section
46850 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
46851 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
46852 in section <xref linkend="SECTformatonehostitem"/>.
46853 </para>
46854 <para>
46855 Fallback hosts can also be specified on routers, which associate them with the
46856 addresses they process. As for the <option>hosts</option> option without <option>hosts_override</option>,
46857 <option>fallback_hosts</option> specified on the transport is used only if the address does
46858 not have its own associated fallback host list. Unlike <option>hosts</option>, a setting of
46859 <option>fallback_hosts</option> on an address is not overridden by <option>hosts_override</option>.
46860 However, <option>hosts_randomize</option> does apply to fallback host lists.
46861 </para>
46862 <para>
46863 If Exim is unable to deliver to any of the hosts for a particular address, and
46864 the errors are not permanent rejections, the address is put on a separate
46865 transport queue with its host list replaced by the fallback hosts, unless the
46866 address was routed via MX records and the current host was in the original MX
46867 list. In that situation, the fallback host list is not used.
46868 </para>
46869 <para>
46870 Once normal deliveries are complete, the fallback queue is delivered by
46871 re-running the same transports with the new host lists. If several failing
46872 addresses have the same fallback hosts (and <option>max_rcpt</option> permits it), a single
46873 copy of the message is sent.
46874 </para>
46875 <para>
46876 The resolution of the host names on the fallback list is controlled by the
46877 <option>gethostbyname</option> option, as for the <option>hosts</option> option. Fallback hosts apply
46878 both to cases when the host list comes with the address and when it is taken
46879 from <option>hosts</option>. This option provides a <quote>use a smart host only if delivery
46880 fails</quote> facility.
46881 </para>
46882 <para>
46883 <indexterm role="option">
46884 <primary><option>final_timeout</option></primary>
46885 </indexterm>
46886 </para>
46887 <informaltable frame="all">
46888 <tgroup cols="4" colsep="0" rowsep="0">
46889 <colspec colwidth="8*" align="left"/>
46890 <colspec colwidth="6*" align="center"/>
46891 <colspec colwidth="6*" align="center"/>
46892 <colspec colwidth="6*" align="right"/>
46893 <tbody>
46894 <row>
46895 <entry><option>final_timeout</option></entry>
46896 <entry>Use: <emphasis>smtp</emphasis></entry>
46897 <entry>Type: <emphasis>time</emphasis></entry>
46898 <entry>Default: <emphasis>10m</emphasis></entry>
46899 </row>
46900 </tbody>
46901 </tgroup>
46902 </informaltable>
46903 <para>
46904 This is the timeout that applies while waiting for the response to the final
46905 line containing just <quote>.</quote> that terminates a message. Its value must not be
46906 zero.
46907 </para>
46908 <para>
46909 <indexterm role="option">
46910 <primary><option>gethostbyname</option></primary>
46911 </indexterm>
46912 </para>
46913 <informaltable frame="all">
46914 <tgroup cols="4" colsep="0" rowsep="0">
46915 <colspec colwidth="8*" align="left"/>
46916 <colspec colwidth="6*" align="center"/>
46917 <colspec colwidth="6*" align="center"/>
46918 <colspec colwidth="6*" align="right"/>
46919 <tbody>
46920 <row>
46921 <entry><option>gethostbyname</option></entry>
46922 <entry>Use: <emphasis>smtp</emphasis></entry>
46923 <entry>Type: <emphasis>boolean</emphasis></entry>
46924 <entry>Default: <emphasis>false</emphasis></entry>
46925 </row>
46926 </tbody>
46927 </tgroup>
46928 </informaltable>
46929 <para>
46930 If this option is true when the <option>hosts</option> and/or <option>fallback_hosts</option> options are
46931 being used, names are looked up using <function>gethostbyname()</function>
46932 (or <function>getipnodebyname()</function> when available)
46933 instead of using the DNS. Of course, that function may in fact use the DNS, but
46934 it may also consult other sources of information such as <filename>/etc/hosts</filename>.
46935 </para>
46936 <para>
46937 <indexterm role="option">
46938 <primary><option>gnutls_compat_mode</option></primary>
46939 </indexterm>
46940 </para>
46941 <informaltable frame="all">
46942 <tgroup cols="4" colsep="0" rowsep="0">
46943 <colspec colwidth="8*" align="left"/>
46944 <colspec colwidth="6*" align="center"/>
46945 <colspec colwidth="6*" align="center"/>
46946 <colspec colwidth="6*" align="right"/>
46947 <tbody>
46948 <row>
46949 <entry><option>gnutls_compat_mode</option></entry>
46950 <entry>Use: <emphasis>smtp</emphasis></entry>
46951 <entry>Type: <emphasis>boolean</emphasis></entry>
46952 <entry>Default: <emphasis>unset</emphasis></entry>
46953 </row>
46954 </tbody>
46955 </tgroup>
46956 </informaltable>
46957 <para>
46958 This option controls whether GnuTLS is used in compatibility mode in an Exim
46959 server. This reduces security slightly, but improves interworking with older
46960 implementations of TLS.
46961 </para>
46962 <para>
46963 <indexterm role="option">
46964 <primary><option>helo_data</option></primary>
46965 </indexterm>
46966 </para>
46967 <informaltable frame="all">
46968 <tgroup cols="4" colsep="0" rowsep="0">
46969 <colspec colwidth="8*" align="left"/>
46970 <colspec colwidth="6*" align="center"/>
46971 <colspec colwidth="6*" align="center"/>
46972 <colspec colwidth="6*" align="right"/>
46973 <tbody>
46974 <row>
46975 <entry><option>helo_data</option></entry>
46976 <entry>Use: <emphasis>smtp</emphasis></entry>
46977 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46978 <entry>Default: <emphasis>see below</emphasis></entry>
46979 </row>
46980 </tbody>
46981 </tgroup>
46982 </informaltable>
46983 <para>
46984 <indexterm role="concept">
46985 <primary>HELO</primary>
46986 <secondary>argument, setting</secondary>
46987 </indexterm>
46988 <indexterm role="concept">
46989 <primary>EHLO</primary>
46990 <secondary>argument, setting</secondary>
46991 </indexterm>
46992 <indexterm role="concept">
46993 <primary>LHLO argument setting</primary>
46994 </indexterm>
46995 The value of this option is expanded after a connection to a another host has
46996 been set up. The result is used as the argument for the EHLO, HELO, or LHLO
46997 command that starts the outgoing SMTP or LMTP session. The default value of the
46998 option is:
46999 </para>
47000 <literallayout class="monospaced">
47001 $primary_hostname
47002 </literallayout>
47003 <para>
47004 During the expansion, the variables <varname>$host</varname> and <varname>$host_address</varname> are set to
47005 the identity of the remote host, and the variables <varname>$sending_ip_address</varname> and
47006 <varname>$sending_port</varname> are set to the local IP address and port number that are being
47007 used. These variables can be used to generate different values for different
47008 servers or different local IP addresses. For example, if you want the string
47009 that is used for <option>helo_data</option> to be obtained by a DNS lookup of the outgoing
47010 interface address, you could use this:
47011 </para>
47012 <literallayout class="monospaced">
47013 helo_data = ${lookup dnsdb{ptr=$sending_ip_address}{$value}\
47014   {$primary_hostname}}
47015 </literallayout>
47016 <para>
47017 The use of <option>helo_data</option> applies both to sending messages and when doing
47018 callouts.
47019 </para>
47020 <para>
47021 <indexterm role="option">
47022 <primary><option>hosts</option></primary>
47023 </indexterm>
47024 </para>
47025 <informaltable frame="all">
47026 <tgroup cols="4" colsep="0" rowsep="0">
47027 <colspec colwidth="8*" align="left"/>
47028 <colspec colwidth="6*" align="center"/>
47029 <colspec colwidth="6*" align="center"/>
47030 <colspec colwidth="6*" align="right"/>
47031 <tbody>
47032 <row>
47033 <entry><option>hosts</option></entry>
47034 <entry>Use: <emphasis>smtp</emphasis></entry>
47035 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
47036 <entry>Default: <emphasis>unset</emphasis></entry>
47037 </row>
47038 </tbody>
47039 </tgroup>
47040 </informaltable>
47041 <para>
47042 Hosts are associated with an address by a router such as <command>dnslookup</command>, which
47043 finds the hosts by looking up the address domain in the DNS, or by
47044 <command>manualroute</command>, which has lists of hosts in its configuration. However,
47045 email addresses can be passed to the <command>smtp</command> transport by any router, and not
47046 all of them can provide an associated list of hosts.
47047 </para>
47048 <para>
47049 The <option>hosts</option> option specifies a list of hosts to be used if the address being
47050 processed does not have any hosts associated with it. The hosts specified by
47051 <option>hosts</option> are also used, whether or not the address has its own hosts, if
47052 <option>hosts_override</option> is set.
47053 </para>
47054 <para>
47055 The string is first expanded, before being interpreted as a colon-separated
47056 list of host names or IP addresses, possibly including port numbers. The
47057 separator may be changed to something other than colon, as described in section
47058 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
47059 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
47060 in section <xref linkend="SECTformatonehostitem"/>. However, note that the <literal>/MX</literal> facility
47061 of the <command>manualroute</command> router is not available here.
47062 </para>
47063 <para>
47064 If the expansion fails, delivery is deferred. Unless the failure was caused by
47065 the inability to complete a lookup, the error is logged to the panic log as
47066 well as the main log. Host names are looked up either by searching directly for
47067 address records in the DNS or by calling <function>gethostbyname()</function> (or
47068 <function>getipnodebyname()</function> when available), depending on the setting of the
47069 <option>gethostbyname</option> option. When Exim is compiled with IPv6 support, if a host
47070 that is looked up in the DNS has both IPv4 and IPv6 addresses, both types of
47071 address are used.
47072 </para>
47073 <para>
47074 During delivery, the hosts are tried in order, subject to their retry status,
47075 unless <option>hosts_randomize</option> is set.
47076 </para>
47077 <para>
47078 <indexterm role="option">
47079 <primary><option>hosts_avoid_esmtp</option></primary>
47080 </indexterm>
47081 </para>
47082 <informaltable frame="all">
47083 <tgroup cols="4" colsep="0" rowsep="0">
47084 <colspec colwidth="8*" align="left"/>
47085 <colspec colwidth="6*" align="center"/>
47086 <colspec colwidth="6*" align="center"/>
47087 <colspec colwidth="6*" align="right"/>
47088 <tbody>
47089 <row>
47090 <entry><option>hosts_avoid_esmtp</option></entry>
47091 <entry>Use: <emphasis>smtp</emphasis></entry>
47092 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
47093 <entry>Default: <emphasis>unset</emphasis></entry>
47094 </row>
47095 </tbody>
47096 </tgroup>
47097 </informaltable>
47098 <para>
47099 <indexterm role="concept">
47100 <primary>ESMTP, avoiding use of</primary>
47101 </indexterm>
47102 <indexterm role="concept">
47103 <primary>HELO</primary>
47104 <secondary>forcing use of</secondary>
47105 </indexterm>
47106 <indexterm role="concept">
47107 <primary>EHLO</primary>
47108 <secondary>avoiding use of</secondary>
47109 </indexterm>
47110 <indexterm role="concept">
47111 <primary>PIPELINING</primary>
47112 <secondary>avoiding the use of</secondary>
47113 </indexterm>
47114 This option is for use with broken hosts that announce ESMTP facilities (for
47115 example, PIPELINING) and then fail to implement them properly. When a host
47116 matches <option>hosts_avoid_esmtp</option>, Exim sends HELO rather than EHLO at the
47117 start of the SMTP session. This means that it cannot use any of the ESMTP
47118 facilities such as AUTH, PIPELINING, SIZE, and STARTTLS.
47119 </para>
47120 <para>
47121 <indexterm role="option">
47122 <primary><option>hosts_avoid_pipelining</option></primary>
47123 </indexterm>
47124 </para>
47125 <informaltable frame="all">
47126 <tgroup cols="4" colsep="0" rowsep="0">
47127 <colspec colwidth="8*" align="left"/>
47128 <colspec colwidth="6*" align="center"/>
47129 <colspec colwidth="6*" align="center"/>
47130 <colspec colwidth="6*" align="right"/>
47131 <tbody>
47132 <row>
47133 <entry><option>hosts_avoid_pipelining</option></entry>
47134 <entry>Use: <emphasis>smtp</emphasis></entry>
47135 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
47136 <entry>Default: <emphasis>unset</emphasis></entry>
47137 </row>
47138 </tbody>
47139 </tgroup>
47140 </informaltable>
47141 <para>
47142 <indexterm role="concept">
47143 <primary>PIPELINING</primary>
47144 <secondary>avoiding the use of</secondary>
47145 </indexterm>
47146 Exim will not use the SMTP PIPELINING extension when delivering to any host
47147 that matches this list, even if the server host advertises PIPELINING support.
47148 </para>
47149 <para>
47150 <indexterm role="option">
47151 <primary><option>hosts_avoid_tls</option></primary>
47152 </indexterm>
47153 </para>
47154 <informaltable frame="all">
47155 <tgroup cols="4" colsep="0" rowsep="0">
47156 <colspec colwidth="8*" align="left"/>
47157 <colspec colwidth="6*" align="center"/>
47158 <colspec colwidth="6*" align="center"/>
47159 <colspec colwidth="6*" align="right"/>
47160 <tbody>
47161 <row>
47162 <entry><option>hosts_avoid_tls</option></entry>
47163 <entry>Use: <emphasis>smtp</emphasis></entry>
47164 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
47165 <entry>Default: <emphasis>unset</emphasis></entry>
47166 </row>
47167 </tbody>
47168 </tgroup>
47169 </informaltable>
47170 <para>
47171 <indexterm role="concept">
47172 <primary>TLS</primary>
47173 <secondary>avoiding for certain hosts</secondary>
47174 </indexterm>
47175 Exim will not try to start a TLS session when delivering to any host that
47176 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
47177 </para>
47178 <para>
47179 <indexterm role="option">
47180 <primary><option>hosts_verify_avoid_tls</option></primary>
47181 </indexterm>
47182 </para>
47183 <informaltable frame="all">
47184 <tgroup cols="4" colsep="0" rowsep="0">
47185 <colspec colwidth="8*" align="left"/>
47186 <colspec colwidth="6*" align="center"/>
47187 <colspec colwidth="6*" align="center"/>
47188 <colspec colwidth="6*" align="right"/>
47189 <tbody>
47190 <row>
47191 <entry><option>hosts_verify_avoid_tls</option></entry>
47192 <entry>Use: <emphasis>smtp</emphasis></entry>
47193 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
47194 <entry>Default: <emphasis>unset</emphasis></entry>
47195 </row>
47196 </tbody>
47197 </tgroup>
47198 </informaltable>
47199 <para>
47200 <indexterm role="concept">
47201 <primary>TLS</primary>
47202 <secondary>avoiding for certain hosts</secondary>
47203 </indexterm>
47204 Exim will not try to start a TLS session for a verify callout,
47205 or when delivering in cutthrough mode,
47206 to any host that matches this list.
47207 </para>
47208 <para>
47209 <indexterm role="option">
47210 <primary><option>hosts_max_try</option></primary>
47211 </indexterm>
47212 </para>
47213 <informaltable frame="all">
47214 <tgroup cols="4" colsep="0" rowsep="0">
47215 <colspec colwidth="8*" align="left"/>
47216 <colspec colwidth="6*" align="center"/>
47217 <colspec colwidth="6*" align="center"/>
47218 <colspec colwidth="6*" align="right"/>
47219 <tbody>
47220 <row>
47221 <entry><option>hosts_max_try</option></entry>
47222 <entry>Use: <emphasis>smtp</emphasis></entry>
47223 <entry>Type: <emphasis>integer</emphasis></entry>
47224 <entry>Default: <emphasis>5</emphasis></entry>
47225 </row>
47226 </tbody>
47227 </tgroup>
47228 </informaltable>
47229 <para>
47230 <indexterm role="concept">
47231 <primary>host</primary>
47232 <secondary>maximum number to try</secondary>
47233 </indexterm>
47234 <indexterm role="concept">
47235 <primary>limit</primary>
47236 <secondary>number of hosts tried</secondary>
47237 </indexterm>
47238 <indexterm role="concept">
47239 <primary>limit</primary>
47240 <secondary>number of MX tried</secondary>
47241 </indexterm>
47242 <indexterm role="concept">
47243 <primary>MX record</primary>
47244 <secondary>maximum tried</secondary>
47245 </indexterm>
47246 This option limits the number of IP addresses that are tried for any one
47247 delivery in cases where there are temporary delivery errors. Section
47248 <xref linkend="SECTvalhosmax"/> describes in detail how the value of this option is used.
47249 </para>
47250 <para>
47251 <indexterm role="option">
47252 <primary><option>hosts_max_try_hardlimit</option></primary>
47253 </indexterm>
47254 </para>
47255 <informaltable frame="all">
47256 <tgroup cols="4" colsep="0" rowsep="0">
47257 <colspec colwidth="8*" align="left"/>
47258 <colspec colwidth="6*" align="center"/>
47259 <colspec colwidth="6*" align="center"/>
47260 <colspec colwidth="6*" align="right"/>
47261 <tbody>
47262 <row>
47263 <entry><option>hosts_max_try_hardlimit</option></entry>
47264 <entry>Use: <emphasis>smtp</emphasis></entry>
47265 <entry>Type: <emphasis>integer</emphasis></entry>
47266 <entry>Default: <emphasis>50</emphasis></entry>
47267 </row>
47268 </tbody>
47269 </tgroup>
47270 </informaltable>
47271 <para>
47272 This is an additional check on the maximum number of IP addresses that Exim
47273 tries for any one delivery. Section <xref linkend="SECTvalhosmax"/> describes its use and
47274 why it exists.
47275 </para>
47276 <para>
47277 <indexterm role="option">
47278 <primary><option>hosts_nopass_tls</option></primary>
47279 </indexterm>
47280 </para>
47281 <informaltable frame="all">
47282 <tgroup cols="4" colsep="0" rowsep="0">
47283 <colspec colwidth="8*" align="left"/>
47284 <colspec colwidth="6*" align="center"/>
47285 <colspec colwidth="6*" align="center"/>
47286 <colspec colwidth="6*" align="right"/>
47287 <tbody>
47288 <row>
47289 <entry><option>hosts_nopass_tls</option></entry>
47290 <entry>Use: <emphasis>smtp</emphasis></entry>
47291 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
47292 <entry>Default: <emphasis>unset</emphasis></entry>
47293 </row>
47294 </tbody>
47295 </tgroup>
47296 </informaltable>
47297 <para>
47298 <indexterm role="concept">
47299 <primary>TLS</primary>
47300 <secondary>passing connection</secondary>
47301 </indexterm>
47302 <indexterm role="concept">
47303 <primary>multiple SMTP deliveries</primary>
47304 </indexterm>
47305 <indexterm role="concept">
47306 <primary>TLS</primary>
47307 <secondary>multiple message deliveries</secondary>
47308 </indexterm>
47309 For any host that matches this list, a connection on which a TLS session has
47310 been started will not be passed to a new delivery process for sending another
47311 message on the same connection. See section <xref linkend="SECTmulmessam"/> for an
47312 explanation of when this might be needed.
47313 </para>
47314 <para revisionflag="changed">
47315 <indexterm role="option">
47316 <primary><option>hosts_noproxy_tls</option></primary>
47317 </indexterm>
47318 </para>
47319 <informaltable frame="all" revisionflag="changed">
47320 <tgroup cols="4" colsep="0" rowsep="0">
47321 <colspec colwidth="8*" align="left"/>
47322 <colspec colwidth="6*" align="center"/>
47323 <colspec colwidth="6*" align="center"/>
47324 <colspec colwidth="6*" align="right"/>
47325 <tbody>
47326 <row>
47327 <entry><option>hosts_noproxy_tls</option></entry>
47328 <entry>Use: <emphasis>smtp</emphasis></entry>
47329 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
47330 <entry>Default: <emphasis>*</emphasis></entry>
47331 </row>
47332 </tbody>
47333 </tgroup>
47334 </informaltable>
47335 <para revisionflag="changed">
47336 <indexterm role="concept">
47337 <primary>TLS</primary>
47338 <secondary>passing connection</secondary>
47339 </indexterm>
47340 <indexterm role="concept">
47341 <primary>multiple SMTP deliveries</primary>
47342 </indexterm>
47343 <indexterm role="concept">
47344 <primary>TLS</primary>
47345 <secondary>multiple message deliveries</secondary>
47346 </indexterm>
47347 For any host that matches this list, a TLS session which has
47348 been started will not be passed to a new delivery process for sending another
47349 message on the same session.
47350 </para>
47351 <para revisionflag="changed">
47352 The traditional implementation closes down TLS and re-starts it in the new
47353 process, on the same open TCP connection, for each successive message
47354 sent.  If permitted by this option a pipe to to the new process is set up
47355 instead, and the original process maintains the TLS connection and proxies
47356 the SMTP connection from and to the new process and any subsequents.
47357 The new process has no access to TLS information, so cannot include it in
47358 logging.
47359 </para>
47360 <para>
47361 <indexterm role="option">
47362 <primary><option>hosts_override</option></primary>
47363 </indexterm>
47364 </para>
47365 <informaltable frame="all">
47366 <tgroup cols="4" colsep="0" rowsep="0">
47367 <colspec colwidth="8*" align="left"/>
47368 <colspec colwidth="6*" align="center"/>
47369 <colspec colwidth="6*" align="center"/>
47370 <colspec colwidth="6*" align="right"/>
47371 <tbody>
47372 <row>
47373 <entry><option>hosts_override</option></entry>
47374 <entry>Use: <emphasis>smtp</emphasis></entry>
47375 <entry>Type: <emphasis>boolean</emphasis></entry>
47376 <entry>Default: <emphasis>false</emphasis></entry>
47377 </row>
47378 </tbody>
47379 </tgroup>
47380 </informaltable>
47381 <para>
47382 If this option is set and the <option>hosts</option> option is also set, any hosts that are
47383 attached to the address are ignored, and instead the hosts specified by the
47384 <option>hosts</option> option are always used. This option does not apply to
47385 <option>fallback_hosts</option>.
47386 </para>
47387 <para>
47388 <indexterm role="option">
47389 <primary><option>hosts_randomize</option></primary>
47390 </indexterm>
47391 </para>
47392 <informaltable frame="all">
47393 <tgroup cols="4" colsep="0" rowsep="0">
47394 <colspec colwidth="8*" align="left"/>
47395 <colspec colwidth="6*" align="center"/>
47396 <colspec colwidth="6*" align="center"/>
47397 <colspec colwidth="6*" align="right"/>
47398 <tbody>
47399 <row>
47400 <entry><option>hosts_randomize</option></entry>
47401 <entry>Use: <emphasis>smtp</emphasis></entry>
47402 <entry>Type: <emphasis>boolean</emphasis></entry>
47403 <entry>Default: <emphasis>false</emphasis></entry>
47404 </row>
47405 </tbody>
47406 </tgroup>
47407 </informaltable>
47408 <para>
47409 <indexterm role="concept">
47410 <primary>randomized host list</primary>
47411 </indexterm>
47412 <indexterm role="concept">
47413 <primary>host</primary>
47414 <secondary>list of; randomized</secondary>
47415 </indexterm>
47416 <indexterm role="concept">
47417 <primary>fallback</primary>
47418 <secondary>randomized hosts</secondary>
47419 </indexterm>
47420 If this option is set, and either the list of hosts is taken from the
47421 <option>hosts</option> or the <option>fallback_hosts</option> option, or the hosts supplied by the router
47422 were not obtained from MX records (this includes fallback hosts from the
47423 router), and were not randomized by the router, the order of trying the hosts
47424 is randomized each time the transport runs. Randomizing the order of a host
47425 list can be used to do crude load sharing.
47426 </para>
47427 <para>
47428 When <option>hosts_randomize</option> is true, a host list may be split into groups whose
47429 order is separately randomized. This makes it possible to set up MX-like
47430 behaviour. The boundaries between groups are indicated by an item that is just
47431 <literal>+</literal> in the host list. For example:
47432 </para>
47433 <literallayout class="monospaced">
47434 hosts = host1:host2:host3:+:host4:host5
47435 </literallayout>
47436 <para>
47437 The order of the first three hosts and the order of the last two hosts is
47438 randomized for each use, but the first three always end up before the last two.
47439 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored.
47440 </para>
47441 <para>
47442 <indexterm role="option">
47443 <primary><option>hosts_require_auth</option></primary>
47444 </indexterm>
47445 </para>
47446 <informaltable frame="all">
47447 <tgroup cols="4" colsep="0" rowsep="0">
47448 <colspec colwidth="8*" align="left"/>
47449 <colspec colwidth="6*" align="center"/>
47450 <colspec colwidth="6*" align="center"/>
47451 <colspec colwidth="6*" align="right"/>
47452 <tbody>
47453 <row>
47454 <entry><option>hosts_require_auth</option></entry>
47455 <entry>Use: <emphasis>smtp</emphasis></entry>
47456 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
47457 <entry>Default: <emphasis>unset</emphasis></entry>
47458 </row>
47459 </tbody>
47460 </tgroup>
47461 </informaltable>
47462 <para>
47463 <indexterm role="concept">
47464 <primary>authentication</primary>
47465 <secondary>required by client</secondary>
47466 </indexterm>
47467 This option provides a list of servers for which authentication must succeed
47468 before Exim will try to transfer a message. If authentication fails for
47469 servers which are not in this list, Exim tries to send unauthenticated. If
47470 authentication fails for one of these servers, delivery is deferred. This
47471 temporary error is detectable in the retry rules, so it can be turned into a
47472 hard failure if required. See also <option>hosts_try_auth</option>, and chapter
47473 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
47474 </para>
47475 <para>
47476 <indexterm role="option">
47477 <primary><option>hosts_request_ocsp</option></primary>
47478 </indexterm>
47479 </para>
47480 <informaltable frame="all">
47481 <tgroup cols="4" colsep="0" rowsep="0">
47482 <colspec colwidth="8*" align="left"/>
47483 <colspec colwidth="6*" align="center"/>
47484 <colspec colwidth="6*" align="center"/>
47485 <colspec colwidth="6*" align="right"/>
47486 <tbody>
47487 <row>
47488 <entry><option>hosts_request_ocsp</option></entry>
47489 <entry>Use: <emphasis>smtp</emphasis></entry>
47490 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
47491 <entry>Default: <emphasis>*</emphasis></entry>
47492 </row>
47493 </tbody>
47494 </tgroup>
47495 </informaltable>
47496 <para>
47497 <indexterm role="concept">
47498 <primary>TLS</primary>
47499 <secondary>requiring for certain servers</secondary>
47500 </indexterm>
47501 Exim will request a Certificate Status on a
47502 TLS session for any host that matches this list.
47503 <option>tls_verify_certificates</option> should also be set for the transport.
47504 </para>
47505 <para>
47506 <indexterm role="option">
47507 <primary><option>hosts_require_ocsp</option></primary>
47508 </indexterm>
47509 </para>
47510 <informaltable frame="all">
47511 <tgroup cols="4" colsep="0" rowsep="0">
47512 <colspec colwidth="8*" align="left"/>
47513 <colspec colwidth="6*" align="center"/>
47514 <colspec colwidth="6*" align="center"/>
47515 <colspec colwidth="6*" align="right"/>
47516 <tbody>
47517 <row>
47518 <entry><option>hosts_require_ocsp</option></entry>
47519 <entry>Use: <emphasis>smtp</emphasis></entry>
47520 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
47521 <entry>Default: <emphasis>unset</emphasis></entry>
47522 </row>
47523 </tbody>
47524 </tgroup>
47525 </informaltable>
47526 <para>
47527 <indexterm role="concept">
47528 <primary>TLS</primary>
47529 <secondary>requiring for certain servers</secondary>
47530 </indexterm>
47531 Exim will request, and check for a valid Certificate Status being given, on a
47532 TLS session for any host that matches this list.
47533 <option>tls_verify_certificates</option> should also be set for the transport.
47534 </para>
47535 <para>
47536 <indexterm role="option">
47537 <primary><option>hosts_require_tls</option></primary>
47538 </indexterm>
47539 </para>
47540 <informaltable frame="all">
47541 <tgroup cols="4" colsep="0" rowsep="0">
47542 <colspec colwidth="8*" align="left"/>
47543 <colspec colwidth="6*" align="center"/>
47544 <colspec colwidth="6*" align="center"/>
47545 <colspec colwidth="6*" align="right"/>
47546 <tbody>
47547 <row>
47548 <entry><option>hosts_require_tls</option></entry>
47549 <entry>Use: <emphasis>smtp</emphasis></entry>
47550 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
47551 <entry>Default: <emphasis>unset</emphasis></entry>
47552 </row>
47553 </tbody>
47554 </tgroup>
47555 </informaltable>
47556 <para>
47557 <indexterm role="concept">
47558 <primary>TLS</primary>
47559 <secondary>requiring for certain servers</secondary>
47560 </indexterm>
47561 Exim will insist on using a TLS session when delivering to any host that
47562 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
47563 <emphasis role="bold">Note</emphasis>: This option affects outgoing mail only. To insist on TLS for
47564 incoming messages, use an appropriate ACL.
47565 </para>
47566 <para>
47567 <indexterm role="option">
47568 <primary><option>hosts_try_auth</option></primary>
47569 </indexterm>
47570 </para>
47571 <informaltable frame="all">
47572 <tgroup cols="4" colsep="0" rowsep="0">
47573 <colspec colwidth="8*" align="left"/>
47574 <colspec colwidth="6*" align="center"/>
47575 <colspec colwidth="6*" align="center"/>
47576 <colspec colwidth="6*" align="right"/>
47577 <tbody>
47578 <row>
47579 <entry><option>hosts_try_auth</option></entry>
47580 <entry>Use: <emphasis>smtp</emphasis></entry>
47581 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
47582 <entry>Default: <emphasis>unset</emphasis></entry>
47583 </row>
47584 </tbody>
47585 </tgroup>
47586 </informaltable>
47587 <para>
47588 <indexterm role="concept">
47589 <primary>authentication</primary>
47590 <secondary>optional in client</secondary>
47591 </indexterm>
47592 This option provides a list of servers to which, provided they announce
47593 authentication support, Exim will attempt to authenticate as a client when it
47594 connects. If authentication fails, Exim will try to transfer the message
47595 unauthenticated. See also <option>hosts_require_auth</option>, and chapter
47596 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
47597 </para>
47598 <para>
47599 <indexterm role="option">
47600 <primary><option>hosts_try_chunking</option></primary>
47601 </indexterm>
47602 </para>
47603 <informaltable frame="all">
47604 <tgroup cols="4" colsep="0" rowsep="0">
47605 <colspec colwidth="8*" align="left"/>
47606 <colspec colwidth="6*" align="center"/>
47607 <colspec colwidth="6*" align="center"/>
47608 <colspec colwidth="6*" align="right"/>
47609 <tbody>
47610 <row>
47611 <entry><option>hosts_try_chunking</option></entry>
47612 <entry>Use: <emphasis>smtp</emphasis></entry>
47613 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
47614 <entry>Default: <emphasis>*</emphasis></entry>
47615 </row>
47616 </tbody>
47617 </tgroup>
47618 </informaltable>
47619 <para>
47620 <indexterm role="concept">
47621 <primary>CHUNKING</primary>
47622 <secondary>enabling, in client</secondary>
47623 </indexterm>
47624 <indexterm role="concept">
47625 <primary>BDAT</primary>
47626 <secondary>SMTP command</secondary>
47627 </indexterm>
47628 <indexterm role="concept">
47629 <primary>RFC 3030</primary>
47630 <secondary>CHUNKING</secondary>
47631 </indexterm>
47632 This option provides a list of servers to which, provided they announce
47633 CHUNKING support, Exim will attempt to use BDAT commands rather than DATA.
47634 BDAT will not be used in conjunction with a transport filter.
47635 </para>
47636 <para>
47637 <indexterm role="option">
47638 <primary><option>hosts_try_fastopen</option></primary>
47639 </indexterm>
47640 </para>
47641 <informaltable frame="all">
47642 <tgroup cols="4" colsep="0" rowsep="0">
47643 <colspec colwidth="8*" align="left"/>
47644 <colspec colwidth="6*" align="center"/>
47645 <colspec colwidth="6*" align="center"/>
47646 <colspec colwidth="6*" align="right"/>
47647 <tbody>
47648 <row>
47649 <entry><option>hosts_try_fastopen</option></entry>
47650 <entry>Use: <emphasis>smtp</emphasis></entry>
47651 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
47652 <entry>Default: <emphasis>unset</emphasis></entry>
47653 </row>
47654 </tbody>
47655 </tgroup>
47656 </informaltable>
47657 <para>
47658 <indexterm role="concept">
47659 <primary>fast open, TCP</primary>
47660 <secondary>enabling, in client</secondary>
47661 </indexterm>
47662 <indexterm role="concept">
47663 <primary>TCP Fast Open</primary>
47664 <secondary>enabling, in client</secondary>
47665 </indexterm>
47666 <indexterm role="concept">
47667 <primary>RFC 7413</primary>
47668 <secondary>TCP Fast Open</secondary>
47669 </indexterm>
47670 This option provides a list of servers to which, provided
47671 the facility is supported by this system, Exim will attempt to
47672 perform a TCP Fast Open.
47673 No data is sent on the SYN segment but, if the remote server also
47674 supports the facility, it can send its SMTP banner immediately after
47675 the SYN,ACK segment.  This can save up to one round-trip time.
47676 </para>
47677 <para>
47678 The facility is only active for previously-contacted servers,
47679 as the initiator must present a cookie in the SYN segment.
47680 </para>
47681 <para>
47682 On (at least some) current Linux distributions the facility must be enabled
47683 in the kernel by the sysadmin before the support is usable.
47684 There is no option for control of the server side; if the system supports
47685 it it is always enebled.  Note that legthy operations in the connect ACL,
47686 such as DNSBL lookups, will still delay the emission of the SMTP banner.
47687 </para>
47688 <para>
47689 <indexterm role="option">
47690 <primary><option>hosts_try_prdr</option></primary>
47691 </indexterm>
47692 </para>
47693 <informaltable frame="all">
47694 <tgroup cols="4" colsep="0" rowsep="0">
47695 <colspec colwidth="8*" align="left"/>
47696 <colspec colwidth="6*" align="center"/>
47697 <colspec colwidth="6*" align="center"/>
47698 <colspec colwidth="6*" align="right"/>
47699 <tbody>
47700 <row>
47701 <entry><option>hosts_try_prdr</option></entry>
47702 <entry>Use: <emphasis>smtp</emphasis></entry>
47703 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
47704 <entry>Default: <emphasis>*</emphasis></entry>
47705 </row>
47706 </tbody>
47707 </tgroup>
47708 </informaltable>
47709 <para>
47710 <indexterm role="concept">
47711 <primary>PRDR</primary>
47712 <secondary>enabling, optional in client</secondary>
47713 </indexterm>
47714 This option provides a list of servers to which, provided they announce
47715 PRDR support, Exim will attempt to negotiate PRDR
47716 for multi-recipient messages.
47717 The option can usually be left as default.
47718 </para>
47719 <para>
47720 <indexterm role="option">
47721 <primary><option>interface</option></primary>
47722 </indexterm>
47723 </para>
47724 <informaltable frame="all">
47725 <tgroup cols="4" colsep="0" rowsep="0">
47726 <colspec colwidth="8*" align="left"/>
47727 <colspec colwidth="6*" align="center"/>
47728 <colspec colwidth="6*" align="center"/>
47729 <colspec colwidth="6*" align="right"/>
47730 <tbody>
47731 <row>
47732 <entry><option>interface</option></entry>
47733 <entry>Use: <emphasis>smtp</emphasis></entry>
47734 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
47735 <entry>Default: <emphasis>unset</emphasis></entry>
47736 </row>
47737 </tbody>
47738 </tgroup>
47739 </informaltable>
47740 <para>
47741 <indexterm role="concept">
47742 <primary>bind IP address</primary>
47743 </indexterm>
47744 <indexterm role="concept">
47745 <primary>IP address</primary>
47746 <secondary>binding</secondary>
47747 </indexterm>
47748 <indexterm role="variable">
47749 <primary><varname>$host</varname></primary>
47750 </indexterm>
47751 <indexterm role="variable">
47752 <primary><varname>$host_address</varname></primary>
47753 </indexterm>
47754 This option specifies which interface to bind to when making an outgoing SMTP
47755 call. The value is an IP address, not an interface name such as
47756 <literal>eth0</literal>. Do not confuse this with the interface address that was used when a
47757 message was received, which is in <varname>$received_ip_address</varname>, formerly known as
47758 <varname>$interface_address</varname>. The name was changed to minimize confusion with the
47759 outgoing interface address. There is no variable that contains an outgoing
47760 interface address because, unless it is set by this option, its value is
47761 unknown.
47762 </para>
47763 <para>
47764 During the expansion of the <option>interface</option> option the variables <varname>$host</varname> and
47765 <varname>$host_address</varname> refer to the host to which a connection is about to be made
47766 during the expansion of the string. Forced expansion failure, or an empty
47767 string result causes the option to be ignored. Otherwise, after expansion, the
47768 string must be a list of IP addresses, colon-separated by default, but the
47769 separator can be changed in the usual way. For example:
47770 </para>
47771 <literallayout class="monospaced">
47772 interface = &lt;; 192.168.123.123 ; 3ffe:ffff:836f::fe86:a061
47773 </literallayout>
47774 <para>
47775 The first interface of the correct type (IPv4 or IPv6) is used for the outgoing
47776 connection. If none of them are the correct type, the option is ignored. If
47777 <option>interface</option> is not set, or is ignored, the system&#x2019;s IP functions choose which
47778 interface to use if the host has more than one.
47779 </para>
47780 <para>
47781 <indexterm role="option">
47782 <primary><option>keepalive</option></primary>
47783 </indexterm>
47784 </para>
47785 <informaltable frame="all">
47786 <tgroup cols="4" colsep="0" rowsep="0">
47787 <colspec colwidth="8*" align="left"/>
47788 <colspec colwidth="6*" align="center"/>
47789 <colspec colwidth="6*" align="center"/>
47790 <colspec colwidth="6*" align="right"/>
47791 <tbody>
47792 <row>
47793 <entry><option>keepalive</option></entry>
47794 <entry>Use: <emphasis>smtp</emphasis></entry>
47795 <entry>Type: <emphasis>boolean</emphasis></entry>
47796 <entry>Default: <emphasis>true</emphasis></entry>
47797 </row>
47798 </tbody>
47799 </tgroup>
47800 </informaltable>
47801 <para>
47802 <indexterm role="concept">
47803 <primary>keepalive</primary>
47804 <secondary>on outgoing connection</secondary>
47805 </indexterm>
47806 This option controls the setting of SO_KEEPALIVE on outgoing TCP/IP socket
47807 connections. When set, it causes the kernel to probe idle connections
47808 periodically, by sending packets with <quote>old</quote> sequence numbers. The other end
47809 of the connection should send a acknowledgment if the connection is still okay
47810 or a reset if the connection has been aborted. The reason for doing this is
47811 that it has the beneficial effect of freeing up certain types of connection
47812 that can get stuck when the remote host is disconnected without tidying up the
47813 TCP/IP call properly. The keepalive mechanism takes several hours to detect
47814 unreachable hosts.
47815 </para>
47816 <para>
47817 <indexterm role="option">
47818 <primary><option>lmtp_ignore_quota</option></primary>
47819 </indexterm>
47820 </para>
47821 <informaltable frame="all">
47822 <tgroup cols="4" colsep="0" rowsep="0">
47823 <colspec colwidth="8*" align="left"/>
47824 <colspec colwidth="6*" align="center"/>
47825 <colspec colwidth="6*" align="center"/>
47826 <colspec colwidth="6*" align="right"/>
47827 <tbody>
47828 <row>
47829 <entry><option>lmtp_ignore_quota</option></entry>
47830 <entry>Use: <emphasis>smtp</emphasis></entry>
47831 <entry>Type: <emphasis>boolean</emphasis></entry>
47832 <entry>Default: <emphasis>false</emphasis></entry>
47833 </row>
47834 </tbody>
47835 </tgroup>
47836 </informaltable>
47837 <para>
47838 <indexterm role="concept">
47839 <primary>LMTP</primary>
47840 <secondary>ignoring quota errors</secondary>
47841 </indexterm>
47842 If this option is set true when the <option>protocol</option> option is set to <quote>lmtp</quote>, the
47843 string <literal>IGNOREQUOTA</literal> is added to RCPT commands, provided that the LMTP server
47844 has advertised support for IGNOREQUOTA in its response to the LHLO command.
47845 </para>
47846 <para>
47847 <indexterm role="option">
47848 <primary><option>max_rcpt</option></primary>
47849 </indexterm>
47850 </para>
47851 <informaltable frame="all">
47852 <tgroup cols="4" colsep="0" rowsep="0">
47853 <colspec colwidth="8*" align="left"/>
47854 <colspec colwidth="6*" align="center"/>
47855 <colspec colwidth="6*" align="center"/>
47856 <colspec colwidth="6*" align="right"/>
47857 <tbody>
47858 <row>
47859 <entry><option>max_rcpt</option></entry>
47860 <entry>Use: <emphasis>smtp</emphasis></entry>
47861 <entry>Type: <emphasis>integer</emphasis></entry>
47862 <entry>Default: <emphasis>100</emphasis></entry>
47863 </row>
47864 </tbody>
47865 </tgroup>
47866 </informaltable>
47867 <para>
47868 <indexterm role="concept">
47869 <primary>RCPT</primary>
47870 <secondary>maximum number of outgoing</secondary>
47871 </indexterm>
47872 This option limits the number of RCPT commands that are sent in a single
47873 SMTP message transaction. Each set of addresses is treated independently, and
47874 so can cause parallel connections to the same host if <option>remote_max_parallel</option>
47875 permits this.
47876 </para>
47877 <para>
47878 <indexterm role="option">
47879 <primary><option>multi_domain</option></primary>
47880 </indexterm>
47881 </para>
47882 <informaltable frame="all">
47883 <tgroup cols="4" colsep="0" rowsep="0">
47884 <colspec colwidth="8*" align="left"/>
47885 <colspec colwidth="6*" align="center"/>
47886 <colspec colwidth="6*" align="center"/>
47887 <colspec colwidth="6*" align="right"/>
47888 <tbody>
47889 <row>
47890 <entry><option>multi_domain</option></entry>
47891 <entry>Use: <emphasis>smtp</emphasis></entry>
47892 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
47893 <entry>Default: <emphasis>true</emphasis></entry>
47894 </row>
47895 </tbody>
47896 </tgroup>
47897 </informaltable>
47898 <para>
47899 <indexterm role="variable">
47900 <primary><varname>$domain</varname></primary>
47901 </indexterm>
47902 When this option is set, the <command>smtp</command> transport can handle a number of
47903 addresses containing a mixture of different domains provided they all resolve
47904 to the same list of hosts. Turning the option off restricts the transport to
47905 handling only one domain at a time. This is useful if you want to use
47906 <varname>$domain</varname> in an expansion for the transport, because it is set only when there
47907 is a single domain involved in a remote delivery.
47908 </para>
47909 <para>
47910 It is expanded per-address and can depend on any of
47911 <varname>$address_data</varname>, <varname>$domain_data</varname>, <varname>$local_part_data</varname>,
47912 <varname>$host</varname>, <varname>$host_address</varname> and <varname>$host_port</varname>.
47913 </para>
47914 <para>
47915 <indexterm role="option">
47916 <primary><option>port</option></primary>
47917 </indexterm>
47918 </para>
47919 <informaltable frame="all">
47920 <tgroup cols="4" colsep="0" rowsep="0">
47921 <colspec colwidth="8*" align="left"/>
47922 <colspec colwidth="6*" align="center"/>
47923 <colspec colwidth="6*" align="center"/>
47924 <colspec colwidth="6*" align="right"/>
47925 <tbody>
47926 <row>
47927 <entry><option>port</option></entry>
47928 <entry>Use: <emphasis>smtp</emphasis></entry>
47929 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47930 <entry>Default: <emphasis>see below</emphasis></entry>
47931 </row>
47932 </tbody>
47933 </tgroup>
47934 </informaltable>
47935 <para>
47936 <indexterm role="concept">
47937 <primary>port</primary>
47938 <secondary>sending TCP/IP</secondary>
47939 </indexterm>
47940 <indexterm role="concept">
47941 <primary>TCP/IP</primary>
47942 <secondary>setting outgoing port</secondary>
47943 </indexterm>
47944 This option specifies the TCP/IP port on the server to which Exim connects.
47945 <emphasis role="bold">Note:</emphasis> Do not confuse this with the port that was used when a message was
47946 received, which is in <varname>$received_port</varname>, formerly known as <varname>$interface_port</varname>.
47947 The name was changed to minimize confusion with the outgoing port. There is no
47948 variable that contains an outgoing port.
47949 </para>
47950 <para>
47951 If the value of this option begins with a digit it is taken as a port number;
47952 otherwise it is looked up using <function>getservbyname()</function>. The default value is
47953 normally <quote>smtp</quote>, but if <option>protocol</option> is set to <quote>lmtp</quote>, the default is
47954 <quote>lmtp</quote>. If the expansion fails, or if a port number cannot be found, delivery
47955 is deferred.
47956 </para>
47957 <para>
47958 <indexterm role="option">
47959 <primary><option>protocol</option></primary>
47960 </indexterm>
47961 </para>
47962 <informaltable frame="all">
47963 <tgroup cols="4" colsep="0" rowsep="0">
47964 <colspec colwidth="8*" align="left"/>
47965 <colspec colwidth="6*" align="center"/>
47966 <colspec colwidth="6*" align="center"/>
47967 <colspec colwidth="6*" align="right"/>
47968 <tbody>
47969 <row>
47970 <entry><option>protocol</option></entry>
47971 <entry>Use: <emphasis>smtp</emphasis></entry>
47972 <entry>Type: <emphasis>string</emphasis></entry>
47973 <entry>Default: <emphasis>smtp</emphasis></entry>
47974 </row>
47975 </tbody>
47976 </tgroup>
47977 </informaltable>
47978 <para>
47979 <indexterm role="concept">
47980 <primary>LMTP</primary>
47981 <secondary>over TCP/IP</secondary>
47982 </indexterm>
47983 <indexterm role="concept">
47984 <primary>ssmtp protocol</primary>
47985 <secondary>outbound</secondary>
47986 </indexterm>
47987 <indexterm role="concept">
47988 <primary>TLS</primary>
47989 <secondary>SSL-on-connect outbound</secondary>
47990 </indexterm>
47991 <indexterm role="variable">
47992 <primary><varname>$port</varname></primary>
47993 </indexterm>
47994 If this option is set to <quote>lmtp</quote> instead of <quote>smtp</quote>, the default value for
47995 the <option>port</option> option changes to <quote>lmtp</quote>, and the transport operates the LMTP
47996 protocol (RFC 2033) instead of SMTP. This protocol is sometimes used for local
47997 deliveries into closed message stores. Exim also has support for running LMTP
47998 over a pipe to a local process &ndash; see chapter <xref linkend="CHAPLMTP"/>.
47999 </para>
48000 <para>
48001 If this option is set to <quote>smtps</quote>, the default value for the <option>port</option> option
48002 changes to <quote>smtps</quote>, and the transport initiates TLS immediately after
48003 connecting, as an outbound SSL-on-connect, instead of using STARTTLS to upgrade.
48004 The Internet standards bodies strongly discourage use of this mode.
48005 </para>
48006 <para>
48007 <indexterm role="option">
48008 <primary><option>retry_include_ip_address</option></primary>
48009 </indexterm>
48010 </para>
48011 <informaltable frame="all">
48012 <tgroup cols="4" colsep="0" rowsep="0">
48013 <colspec colwidth="8*" align="left"/>
48014 <colspec colwidth="6*" align="center"/>
48015 <colspec colwidth="6*" align="center"/>
48016 <colspec colwidth="6*" align="right"/>
48017 <tbody>
48018 <row>
48019 <entry><option>retry_include_ip_address</option></entry>
48020 <entry>Use: <emphasis>smtp</emphasis></entry>
48021 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
48022 <entry>Default: <emphasis>true</emphasis></entry>
48023 </row>
48024 </tbody>
48025 </tgroup>
48026 </informaltable>
48027 <para>
48028 Exim normally includes both the host name and the IP address in the key it
48029 constructs for indexing retry data after a temporary delivery failure. This
48030 means that when one of several IP addresses for a host is failing, it gets
48031 tried periodically (controlled by the retry rules), but use of the other IP
48032 addresses is not affected.
48033 </para>
48034 <para>
48035 However, in some dialup environments hosts are assigned a different IP address
48036 each time they connect. In this situation the use of the IP address as part of
48037 the retry key leads to undesirable behaviour. Setting this option false causes
48038 Exim to use only the host name.
48039 Since it is expanded it can be made to depend on the host or domain.
48040 </para>
48041 <para>
48042 <indexterm role="option">
48043 <primary><option>serialize_hosts</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>serialize_hosts</option></entry>
48055 <entry>Use: <emphasis>smtp</emphasis></entry>
48056 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
48057 <entry>Default: <emphasis>unset</emphasis></entry>
48058 </row>
48059 </tbody>
48060 </tgroup>
48061 </informaltable>
48062 <para>
48063 <indexterm role="concept">
48064 <primary>serializing connections</primary>
48065 </indexterm>
48066 <indexterm role="concept">
48067 <primary>host</primary>
48068 <secondary>serializing connections</secondary>
48069 </indexterm>
48070 Because Exim operates in a distributed manner, if several messages for the same
48071 host arrive at around the same time, more than one simultaneous connection to
48072 the remote host can occur. This is not usually a problem except when there is a
48073 slow link between the hosts. In that situation it may be helpful to restrict
48074 Exim to one connection at a time. This can be done by setting
48075 <option>serialize_hosts</option> to match the relevant hosts.
48076 </para>
48077 <para>
48078 <indexterm role="concept">
48079 <primary>hints database</primary>
48080 <secondary>serializing deliveries to a host</secondary>
48081 </indexterm>
48082 Exim implements serialization by means of a hints database in which a record is
48083 written whenever a process connects to one of the restricted hosts. The record
48084 is deleted when the connection is completed. Obviously there is scope for
48085 records to get left lying around if there is a system or program crash. To
48086 guard against this, Exim ignores any records that are more than six hours old.
48087 </para>
48088 <para>
48089 If you set up this kind of serialization, you should also arrange to delete the
48090 relevant hints database whenever your system reboots. The names of the files
48091 start with <filename>misc</filename> and they are kept in the <filename>spool/db</filename> directory. There
48092 may be one or two files, depending on the type of DBM in use. The same files
48093 are used for ETRN serialization.
48094 </para>
48095 <para>
48096 See also the <option>max_parallel</option> generic transport option.
48097 </para>
48098 <para>
48099 <indexterm role="option">
48100 <primary><option>size_addition</option></primary>
48101 </indexterm>
48102 </para>
48103 <informaltable frame="all">
48104 <tgroup cols="4" colsep="0" rowsep="0">
48105 <colspec colwidth="8*" align="left"/>
48106 <colspec colwidth="6*" align="center"/>
48107 <colspec colwidth="6*" align="center"/>
48108 <colspec colwidth="6*" align="right"/>
48109 <tbody>
48110 <row>
48111 <entry><option>size_addition</option></entry>
48112 <entry>Use: <emphasis>smtp</emphasis></entry>
48113 <entry>Type: <emphasis>integer</emphasis></entry>
48114 <entry>Default: <emphasis>1024</emphasis></entry>
48115 </row>
48116 </tbody>
48117 </tgroup>
48118 </informaltable>
48119 <para>
48120 <indexterm role="concept">
48121 <primary>SMTP</primary>
48122 <secondary>SIZE</secondary>
48123 </indexterm>
48124 <indexterm role="concept">
48125 <primary>message</primary>
48126 <secondary>size issue for transport filter</secondary>
48127 </indexterm>
48128 <indexterm role="concept">
48129 <primary>size</primary>
48130 <secondary>of message</secondary>
48131 </indexterm>
48132 <indexterm role="concept">
48133 <primary>transport</primary>
48134 <secondary>filter</secondary>
48135 </indexterm>
48136 <indexterm role="concept">
48137 <primary>filter</primary>
48138 <secondary>transport filter</secondary>
48139 </indexterm>
48140 If a remote SMTP server indicates that it supports the SIZE option of the
48141 MAIL command, Exim uses this to pass over the message size at the start of
48142 an SMTP transaction. It adds the value of <option>size_addition</option> to the value it
48143 sends, to allow for headers and other text that may be added during delivery by
48144 configuration options or in a transport filter. It may be necessary to increase
48145 this if a lot of text is added to messages.
48146 </para>
48147 <para>
48148 Alternatively, if the value of <option>size_addition</option> is set negative, it disables
48149 the use of the SIZE option altogether.
48150 </para>
48151 <para>
48152 <indexterm role="option">
48153 <primary><option>socks_proxy</option></primary>
48154 </indexterm>
48155 </para>
48156 <informaltable frame="all">
48157 <tgroup cols="4" colsep="0" rowsep="0">
48158 <colspec colwidth="8*" align="left"/>
48159 <colspec colwidth="6*" align="center"/>
48160 <colspec colwidth="6*" align="center"/>
48161 <colspec colwidth="6*" align="right"/>
48162 <tbody>
48163 <row>
48164 <entry><option>socks_proxy</option></entry>
48165 <entry>Use: <emphasis>smtp</emphasis></entry>
48166 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48167 <entry>Default: <emphasis>unset</emphasis></entry>
48168 </row>
48169 </tbody>
48170 </tgroup>
48171 </informaltable>
48172 <para>
48173 <indexterm role="concept">
48174 <primary>proxy</primary>
48175 <secondary>SOCKS</secondary>
48176 </indexterm>
48177 This option enables use of SOCKS proxies for connections made by the
48178 transport.  For details see section <xref linkend="SECTproxySOCKS"/>.
48179 </para>
48180 <para>
48181 <indexterm role="option">
48182 <primary><option>tls_certificate</option></primary>
48183 </indexterm>
48184 </para>
48185 <informaltable frame="all">
48186 <tgroup cols="4" colsep="0" rowsep="0">
48187 <colspec colwidth="8*" align="left"/>
48188 <colspec colwidth="6*" align="center"/>
48189 <colspec colwidth="6*" align="center"/>
48190 <colspec colwidth="6*" align="right"/>
48191 <tbody>
48192 <row>
48193 <entry><option>tls_certificate</option></entry>
48194 <entry>Use: <emphasis>smtp</emphasis></entry>
48195 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48196 <entry>Default: <emphasis>unset</emphasis></entry>
48197 </row>
48198 </tbody>
48199 </tgroup>
48200 </informaltable>
48201 <para>
48202 <indexterm role="concept">
48203 <primary>TLS</primary>
48204 <secondary>client certificate, location of</secondary>
48205 </indexterm>
48206 <indexterm role="concept">
48207 <primary>certificate</primary>
48208 <secondary>client, location of</secondary>
48209 </indexterm>
48210 <indexterm role="variable">
48211 <primary><varname>$host</varname></primary>
48212 </indexterm>
48213 <indexterm role="variable">
48214 <primary><varname>$host_address</varname></primary>
48215 </indexterm>
48216 The value of this option must be the absolute path to a file which contains the
48217 client&#x2019;s certificate, for possible use when sending a message over an encrypted
48218 connection. The values of <varname>$host</varname> and <varname>$host_address</varname> are set to the name and
48219 address of the server during the expansion. See chapter <xref linkend="CHAPTLS"/> for
48220 details of TLS.
48221 </para>
48222 <para>
48223 <emphasis role="bold">Note</emphasis>: This option must be set if you want Exim to be able to use a TLS
48224 certificate when sending messages as a client. The global option of the same
48225 name specifies the certificate for Exim as a server; it is not automatically
48226 assumed that the same certificate should be used when Exim is operating as a
48227 client.
48228 </para>
48229 <para>
48230 <indexterm role="option">
48231 <primary><option>tls_crl</option></primary>
48232 </indexterm>
48233 </para>
48234 <informaltable frame="all">
48235 <tgroup cols="4" colsep="0" rowsep="0">
48236 <colspec colwidth="8*" align="left"/>
48237 <colspec colwidth="6*" align="center"/>
48238 <colspec colwidth="6*" align="center"/>
48239 <colspec colwidth="6*" align="right"/>
48240 <tbody>
48241 <row>
48242 <entry><option>tls_crl</option></entry>
48243 <entry>Use: <emphasis>smtp</emphasis></entry>
48244 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48245 <entry>Default: <emphasis>unset</emphasis></entry>
48246 </row>
48247 </tbody>
48248 </tgroup>
48249 </informaltable>
48250 <para>
48251 <indexterm role="concept">
48252 <primary>TLS</primary>
48253 <secondary>client certificate revocation list</secondary>
48254 </indexterm>
48255 <indexterm role="concept">
48256 <primary>certificate</primary>
48257 <secondary>revocation list for client</secondary>
48258 </indexterm>
48259 This option specifies a certificate revocation list. The expanded value must
48260 be the name of a file that contains a CRL in PEM format.
48261 </para>
48262 <para>
48263 <indexterm role="option">
48264 <primary><option>tls_dh_min_bits</option></primary>
48265 </indexterm>
48266 </para>
48267 <informaltable frame="all">
48268 <tgroup cols="4" colsep="0" rowsep="0">
48269 <colspec colwidth="8*" align="left"/>
48270 <colspec colwidth="6*" align="center"/>
48271 <colspec colwidth="6*" align="center"/>
48272 <colspec colwidth="6*" align="right"/>
48273 <tbody>
48274 <row>
48275 <entry><option>tls_dh_min_bits</option></entry>
48276 <entry>Use: <emphasis>smtp</emphasis></entry>
48277 <entry>Type: <emphasis>integer</emphasis></entry>
48278 <entry>Default: <emphasis>1024</emphasis></entry>
48279 </row>
48280 </tbody>
48281 </tgroup>
48282 </informaltable>
48283 <para>
48284 <indexterm role="concept">
48285 <primary>TLS</primary>
48286 <secondary>Diffie-Hellman minimum acceptable size</secondary>
48287 </indexterm>
48288 When establishing a TLS session, if a ciphersuite which uses Diffie-Hellman
48289 key agreement is negotiated, the server will provide a large prime number
48290 for use.  This option establishes the minimum acceptable size of that number.
48291 If the parameter offered by the server is too small, then the TLS handshake
48292 will fail.
48293 </para>
48294 <para>
48295 Only supported when using GnuTLS.
48296 </para>
48297 <para>
48298 <indexterm role="option">
48299 <primary><option>tls_privatekey</option></primary>
48300 </indexterm>
48301 </para>
48302 <informaltable frame="all">
48303 <tgroup cols="4" colsep="0" rowsep="0">
48304 <colspec colwidth="8*" align="left"/>
48305 <colspec colwidth="6*" align="center"/>
48306 <colspec colwidth="6*" align="center"/>
48307 <colspec colwidth="6*" align="right"/>
48308 <tbody>
48309 <row>
48310 <entry><option>tls_privatekey</option></entry>
48311 <entry>Use: <emphasis>smtp</emphasis></entry>
48312 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48313 <entry>Default: <emphasis>unset</emphasis></entry>
48314 </row>
48315 </tbody>
48316 </tgroup>
48317 </informaltable>
48318 <para>
48319 <indexterm role="concept">
48320 <primary>TLS</primary>
48321 <secondary>client private key, location of</secondary>
48322 </indexterm>
48323 <indexterm role="variable">
48324 <primary><varname>$host</varname></primary>
48325 </indexterm>
48326 <indexterm role="variable">
48327 <primary><varname>$host_address</varname></primary>
48328 </indexterm>
48329 The value of this option must be the absolute path to a file which contains the
48330 client&#x2019;s private key. This is used when sending a message over an encrypted
48331 connection using a client certificate. The values of <varname>$host</varname> and
48332 <varname>$host_address</varname> are set to the name and address of the server during the
48333 expansion. If this option is unset, or the expansion is forced to fail, or the
48334 result is an empty string, the private key is assumed to be in the same file as
48335 the certificate. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
48336 </para>
48337 <para>
48338 <indexterm role="option">
48339 <primary><option>tls_require_ciphers</option></primary>
48340 </indexterm>
48341 </para>
48342 <informaltable frame="all">
48343 <tgroup cols="4" colsep="0" rowsep="0">
48344 <colspec colwidth="8*" align="left"/>
48345 <colspec colwidth="6*" align="center"/>
48346 <colspec colwidth="6*" align="center"/>
48347 <colspec colwidth="6*" align="right"/>
48348 <tbody>
48349 <row>
48350 <entry><option>tls_require_ciphers</option></entry>
48351 <entry>Use: <emphasis>smtp</emphasis></entry>
48352 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48353 <entry>Default: <emphasis>unset</emphasis></entry>
48354 </row>
48355 </tbody>
48356 </tgroup>
48357 </informaltable>
48358 <para>
48359 <indexterm role="concept">
48360 <primary>TLS</primary>
48361 <secondary>requiring specific ciphers</secondary>
48362 </indexterm>
48363 <indexterm role="concept">
48364 <primary>cipher</primary>
48365 <secondary>requiring specific</secondary>
48366 </indexterm>
48367 <indexterm role="variable">
48368 <primary><varname>$host</varname></primary>
48369 </indexterm>
48370 <indexterm role="variable">
48371 <primary><varname>$host_address</varname></primary>
48372 </indexterm>
48373 The value of this option must be a list of permitted cipher suites, for use
48374 when setting up an outgoing encrypted connection. (There is a global option of
48375 the same name for controlling incoming connections.) The values of <varname>$host</varname> and
48376 <varname>$host_address</varname> are set to the name and address of the server during the
48377 expansion. See chapter <xref linkend="CHAPTLS"/> for details of TLS; note that this option
48378 is used in different ways by OpenSSL and GnuTLS (see sections
48379 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>). For GnuTLS, the order of the
48380 ciphers is a preference order.
48381 </para>
48382 <para>
48383 <indexterm role="option">
48384 <primary><option>tls_sni</option></primary>
48385 </indexterm>
48386 </para>
48387 <informaltable frame="all">
48388 <tgroup cols="4" colsep="0" rowsep="0">
48389 <colspec colwidth="8*" align="left"/>
48390 <colspec colwidth="6*" align="center"/>
48391 <colspec colwidth="6*" align="center"/>
48392 <colspec colwidth="6*" align="right"/>
48393 <tbody>
48394 <row>
48395 <entry><option>tls_sni</option></entry>
48396 <entry>Use: <emphasis>smtp</emphasis></entry>
48397 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48398 <entry>Default: <emphasis>unset</emphasis></entry>
48399 </row>
48400 </tbody>
48401 </tgroup>
48402 </informaltable>
48403 <para>
48404 <indexterm role="concept">
48405 <primary>TLS</primary>
48406 <secondary>Server Name Indication</secondary>
48407 </indexterm>
48408 <indexterm role="variable">
48409 <primary><varname>$tls_sni</varname></primary>
48410 </indexterm>
48411 If this option is set then it sets the $tls_out_sni variable and causes any
48412 TLS session to pass this value as the Server Name Indication extension to
48413 the remote side, which can be used by the remote side to select an appropriate
48414 certificate and private key for the session.
48415 </para>
48416 <para>
48417 See <xref linkend="SECTtlssni"/> for more information.
48418 </para>
48419 <para>
48420 Note that for OpenSSL, this feature requires a build of OpenSSL that supports
48421 TLS extensions.
48422 </para>
48423 <para>
48424 <indexterm role="option">
48425 <primary><option>tls_tempfail_tryclear</option></primary>
48426 </indexterm>
48427 </para>
48428 <informaltable frame="all">
48429 <tgroup cols="4" colsep="0" rowsep="0">
48430 <colspec colwidth="8*" align="left"/>
48431 <colspec colwidth="6*" align="center"/>
48432 <colspec colwidth="6*" align="center"/>
48433 <colspec colwidth="6*" align="right"/>
48434 <tbody>
48435 <row>
48436 <entry><option>tls_tempfail_tryclear</option></entry>
48437 <entry>Use: <emphasis>smtp</emphasis></entry>
48438 <entry>Type: <emphasis>boolean</emphasis></entry>
48439 <entry>Default: <emphasis>true</emphasis></entry>
48440 </row>
48441 </tbody>
48442 </tgroup>
48443 </informaltable>
48444 <para>
48445 <indexterm role="concept">
48446 <primary>4<emphasis>xx</emphasis> responses</primary>
48447 <secondary>to STARTTLS</secondary>
48448 </indexterm>
48449 When the server host is not in <option>hosts_require_tls</option>, and there is a problem in
48450 setting up a TLS session, this option determines whether or not Exim should try
48451 to deliver the message unencrypted. If it is set false, delivery to the
48452 current host is deferred; if there are other hosts, they are tried. If this
48453 option is set true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis>
48454 response to STARTTLS. Also, if STARTTLS is accepted, but the subsequent
48455 TLS negotiation fails, Exim closes the current connection (because it is in an
48456 unknown state), opens a new one to the same host, and then tries the delivery
48457 in clear.
48458 </para>
48459 <para>
48460 <indexterm role="option">
48461 <primary><option>tls_try_verify_hosts</option></primary>
48462 </indexterm>
48463 </para>
48464 <informaltable frame="all">
48465 <tgroup cols="4" colsep="0" rowsep="0">
48466 <colspec colwidth="8*" align="left"/>
48467 <colspec colwidth="6*" align="center"/>
48468 <colspec colwidth="6*" align="center"/>
48469 <colspec colwidth="6*" align="right"/>
48470 <tbody>
48471 <row>
48472 <entry><option>tls_try_verify_hosts</option></entry>
48473 <entry>Use: <emphasis>smtp</emphasis></entry>
48474 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
48475 <entry>Default: <emphasis>*</emphasis></entry>
48476 </row>
48477 </tbody>
48478 </tgroup>
48479 </informaltable>
48480 <para>
48481 <indexterm role="concept">
48482 <primary>TLS</primary>
48483 <secondary>server certificate verification</secondary>
48484 </indexterm>
48485 <indexterm role="concept">
48486 <primary>certificate</primary>
48487 <secondary>verification of server</secondary>
48488 </indexterm>
48489 This option gives a list of hosts for which, on encrypted connections,
48490 certificate verification will be tried but need not succeed.
48491 The <option>tls_verify_certificates</option> option must also be set.
48492 Note that unless the host is in this list
48493 TLS connections will be denied to hosts using self-signed certificates
48494 when <option>tls_verify_certificates</option> is matched.
48495 The <varname>$tls_out_certificate_verified</varname> variable is set when
48496 certificate verification succeeds.
48497 </para>
48498 <para>
48499 <indexterm role="option">
48500 <primary><option>tls_verify_cert_hostnames</option></primary>
48501 </indexterm>
48502 </para>
48503 <informaltable frame="all">
48504 <tgroup cols="4" colsep="0" rowsep="0">
48505 <colspec colwidth="8*" align="left"/>
48506 <colspec colwidth="6*" align="center"/>
48507 <colspec colwidth="6*" align="center"/>
48508 <colspec colwidth="6*" align="right"/>
48509 <tbody>
48510 <row>
48511 <entry><option>tls_verify_cert_hostnames</option></entry>
48512 <entry>Use: <emphasis>smtp</emphasis></entry>
48513 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
48514 <entry>Default: <emphasis>*</emphasis></entry>
48515 </row>
48516 </tbody>
48517 </tgroup>
48518 </informaltable>
48519 <para>
48520 <indexterm role="concept">
48521 <primary>TLS</primary>
48522 <secondary>server certificate hostname verification</secondary>
48523 </indexterm>
48524 <indexterm role="concept">
48525 <primary>certificate</primary>
48526 <secondary>verification of server</secondary>
48527 </indexterm>
48528 This option give a list of hosts for which,
48529 while verifying the server certificate,
48530 checks will be included on the host name
48531 (note that this will generally be the result of a DNS MX lookup)
48532 versus Subject and Subject-Alternate-Name fields.  Wildcard names are permitted
48533 limited to being the initial component of a 3-or-more component FQDN.
48534 </para>
48535 <para>
48536 There is no equivalent checking on client certificates.
48537 </para>
48538 <para>
48539 <indexterm role="option">
48540 <primary><option>tls_verify_certificates</option></primary>
48541 </indexterm>
48542 </para>
48543 <informaltable frame="all">
48544 <tgroup cols="4" colsep="0" rowsep="0">
48545 <colspec colwidth="8*" align="left"/>
48546 <colspec colwidth="6*" align="center"/>
48547 <colspec colwidth="6*" align="center"/>
48548 <colspec colwidth="6*" align="right"/>
48549 <tbody>
48550 <row>
48551 <entry><option>tls_verify_certificates</option></entry>
48552 <entry>Use: <emphasis>smtp</emphasis></entry>
48553 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48554 <entry>Default: <emphasis>system</emphasis></entry>
48555 </row>
48556 </tbody>
48557 </tgroup>
48558 </informaltable>
48559 <para>
48560 <indexterm role="concept">
48561 <primary>TLS</primary>
48562 <secondary>server certificate verification</secondary>
48563 </indexterm>
48564 <indexterm role="concept">
48565 <primary>certificate</primary>
48566 <secondary>verification of server</secondary>
48567 </indexterm>
48568 <indexterm role="variable">
48569 <primary><varname>$host</varname></primary>
48570 </indexterm>
48571 <indexterm role="variable">
48572 <primary><varname>$host_address</varname></primary>
48573 </indexterm>
48574 The value of this option must be either the
48575 word "system"
48576 or the absolute path to
48577 a file or directory containing permitted certificates for servers,
48578 for use when setting up an encrypted connection.
48579 </para>
48580 <para>
48581 The "system" value for the option will use a location compiled into the SSL library.
48582 This is not available for GnuTLS versions preceding 3.0.20; a value of "system"
48583 is taken as empty and an explicit location
48584 must be specified.
48585 </para>
48586 <para>
48587 The use of a directory for the option value is not available for GnuTLS versions
48588 preceding 3.3.6 and a single file must be used.
48589 </para>
48590 <para>
48591 With OpenSSL the certificates specified
48592 explicitly
48593 either by file or directory
48594 are added to those given by the system default location.
48595 </para>
48596 <para>
48597 The values of <varname>$host</varname> and
48598 <varname>$host_address</varname> are set to the name and address of the server during the
48599 expansion of this option. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
48600 </para>
48601 <para>
48602 For back-compatibility,
48603 if neither tls_verify_hosts nor tls_try_verify_hosts are set
48604 (a single-colon empty list counts as being set)
48605 and certificate verification fails the TLS connection is closed.
48606 </para>
48607 <para>
48608 <indexterm role="option">
48609 <primary><option>tls_verify_hosts</option></primary>
48610 </indexterm>
48611 </para>
48612 <informaltable frame="all">
48613 <tgroup cols="4" colsep="0" rowsep="0">
48614 <colspec colwidth="8*" align="left"/>
48615 <colspec colwidth="6*" align="center"/>
48616 <colspec colwidth="6*" align="center"/>
48617 <colspec colwidth="6*" align="right"/>
48618 <tbody>
48619 <row>
48620 <entry><option>tls_verify_hosts</option></entry>
48621 <entry>Use: <emphasis>smtp</emphasis></entry>
48622 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
48623 <entry>Default: <emphasis>unset</emphasis></entry>
48624 </row>
48625 </tbody>
48626 </tgroup>
48627 </informaltable>
48628 <para>
48629 <indexterm role="concept">
48630 <primary>TLS</primary>
48631 <secondary>server certificate verification</secondary>
48632 </indexterm>
48633 <indexterm role="concept">
48634 <primary>certificate</primary>
48635 <secondary>verification of server</secondary>
48636 </indexterm>
48637 This option gives a list of hosts for which, on encrypted connections,
48638 certificate verification must succeed.
48639 The <option>tls_verify_certificates</option> option must also be set.
48640 If both this option and <option>tls_try_verify_hosts</option> are unset
48641 operation is as if this option selected all hosts.
48642 </para>
48643 </section>
48644 <section id="SECTvalhosmax">
48645 <title>How the limits for the number of hosts to try are used</title>
48646 <para>
48647 <indexterm role="concept">
48648 <primary>host</primary>
48649 <secondary>maximum number to try</secondary>
48650 </indexterm>
48651 <indexterm role="concept">
48652 <primary>limit</primary>
48653 <secondary>hosts; maximum number tried</secondary>
48654 </indexterm>
48655 There are two options that are concerned with the number of hosts that are
48656 tried when an SMTP delivery takes place. They are <option>hosts_max_try</option> and
48657 <option>hosts_max_try_hardlimit</option>.
48658 </para>
48659 <para>
48660 The <option>hosts_max_try</option> option limits the number of hosts that are tried
48661 for a single delivery. However, despite the term <quote>host</quote> in its name, the
48662 option actually applies to each IP address independently. In other words, a
48663 multihomed host is treated as several independent hosts, just as it is for
48664 retrying.
48665 </para>
48666 <para>
48667 Many of the larger ISPs have multiple MX records which often point to
48668 multihomed hosts. As a result, a list of a dozen or more IP addresses may be
48669 created as a result of routing one of these domains.
48670 </para>
48671 <para>
48672 Trying every single IP address on such a long list does not seem sensible; if
48673 several at the top of the list fail, it is reasonable to assume there is some
48674 problem that is likely to affect all of them. Roughly speaking, the value of
48675 <option>hosts_max_try</option> is the maximum number that are tried before deferring the
48676 delivery. However, the logic cannot be quite that simple.
48677 </para>
48678 <para>
48679 Firstly, IP addresses that are skipped because their retry times have not
48680 arrived do not count, and in addition, addresses that are past their retry
48681 limits are also not counted, even when they are tried. This means that when
48682 some IP addresses are past their retry limits, more than the value of
48683 <option>hosts_max_retry</option> may be tried. The reason for this behaviour is to ensure
48684 that all IP addresses are considered before timing out an email address (but
48685 see below for an exception).
48686 </para>
48687 <para>
48688 Secondly, when the <option>hosts_max_try</option> limit is reached, Exim looks down the host
48689 list to see if there is a subsequent host with a different (higher valued) MX.
48690 If there is, that host is considered next, and the current IP address is used
48691 but not counted. This behaviour helps in the case of a domain with a retry rule
48692 that hardly ever delays any hosts, as is now explained:
48693 </para>
48694 <para>
48695 Consider the case of a long list of hosts with one MX value, and a few with a
48696 higher MX value. If <option>hosts_max_try</option> is small (the default is 5) only a few
48697 hosts at the top of the list are tried at first. With the default retry rule,
48698 which specifies increasing retry times, the higher MX hosts are eventually
48699 tried when those at the top of the list are skipped because they have not
48700 reached their retry times.
48701 </para>
48702 <para>
48703 However, it is common practice to put a fixed short retry time on domains for
48704 large ISPs, on the grounds that their servers are rarely down for very long.
48705 Unfortunately, these are exactly the domains that tend to resolve to long lists
48706 of hosts. The short retry time means that the lowest MX hosts are tried every
48707 time. The attempts may be in a different order because of random sorting, but
48708 without the special MX check, the higher MX hosts would never be tried until
48709 all the lower MX hosts had timed out (which might be several days), because
48710 there are always some lower MX hosts that have reached their retry times. With
48711 the special check, Exim considers at least one IP address from each MX value at
48712 every delivery attempt, even if the <option>hosts_max_try</option> limit has already been
48713 reached.
48714 </para>
48715 <para>
48716 The above logic means that <option>hosts_max_try</option> is not a hard limit, and in
48717 particular, Exim normally eventually tries all the IP addresses before timing
48718 out an email address. When <option>hosts_max_try</option> was implemented, this seemed a
48719 reasonable thing to do. Recently, however, some lunatic DNS configurations have
48720 been set up with hundreds of IP addresses for some domains. It can
48721 take a very long time indeed for an address to time out in these cases.
48722 </para>
48723 <para>
48724 The <option>hosts_max_try_hardlimit</option> option was added to help with this problem.
48725 Exim never tries more than this number of IP addresses; if it hits this limit
48726 and they are all timed out, the email address is bounced, even though not all
48727 possible IP addresses have been tried.
48728 <indexterm role="concept" startref="IIDsmttra1" class="endofrange"/>
48729 <indexterm role="concept" startref="IIDsmttra2" class="endofrange"/>
48730 </para>
48731 </section>
48732 </chapter>
48733
48734 <chapter id="CHAPrewrite">
48735 <title>Address rewriting</title>
48736 <para>
48737 <indexterm role="concept" id="IIDaddrew" class="startofrange">
48738 <primary>rewriting</primary>
48739 <secondary>addresses</secondary>
48740 </indexterm>
48741 There are some circumstances in which Exim automatically rewrites domains in
48742 addresses. The two most common are when an address is given without a domain
48743 (referred to as an <quote>unqualified address</quote>) or when an address contains an
48744 abbreviated domain that is expanded by DNS lookup.
48745 </para>
48746 <para>
48747 Unqualified envelope addresses are accepted only for locally submitted
48748 messages, or for messages that are received from hosts matching
48749 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
48750 appropriate. Unqualified addresses in header lines are qualified if they are in
48751 locally submitted messages, or messages from hosts that are permitted to send
48752 unqualified envelope addresses. Otherwise, unqualified addresses in header
48753 lines are neither qualified nor rewritten.
48754 </para>
48755 <para>
48756 One situation in which Exim does <emphasis>not</emphasis> automatically rewrite a domain is
48757 when it is the name of a CNAME record in the DNS. The older RFCs suggest that
48758 such a domain should be rewritten using the <quote>canonical</quote> name, and some MTAs
48759 do this. The new RFCs do not contain this suggestion.
48760 </para>
48761 <section id="SECID147">
48762 <title>Explicitly configured address rewriting</title>
48763 <para>
48764 This chapter describes the rewriting rules that can be used in the
48765 main rewrite section of the configuration file, and also in the generic
48766 <option>headers_rewrite</option> option that can be set on any transport.
48767 </para>
48768 <para>
48769 Some people believe that configured address rewriting is a Mortal Sin.
48770 Others believe that life is not possible without it. Exim provides the
48771 facility; you do not have to use it.
48772 </para>
48773 <para>
48774 The main rewriting rules that appear in the <quote>rewrite</quote> section of the
48775 configuration file are applied to addresses in incoming messages, both envelope
48776 addresses and addresses in header lines. Each rule specifies the types of
48777 address to which it applies.
48778 </para>
48779 <para>
48780 Whether or not addresses in header lines are rewritten depends on the origin of
48781 the headers and the type of rewriting. Global rewriting, that is, rewriting
48782 rules from the rewrite section of the configuration file, is applied only to
48783 those headers that were received with the message. Header lines that are added
48784 by ACLs or by a system filter or by individual routers or transports (which
48785 are specific to individual recipient addresses) are not rewritten by the global
48786 rules.
48787 </para>
48788 <para>
48789 Rewriting at transport time, by means of the <option>headers_rewrite</option> option,
48790 applies all headers except those added by routers and transports. That is, as
48791 well as the headers that were received with the message, it also applies to
48792 headers that were added by an ACL or a system filter.
48793 </para>
48794 <para>
48795 In general, rewriting addresses from your own system or domain has some
48796 legitimacy. Rewriting other addresses should be done only with great care and
48797 in special circumstances. The author of Exim believes that rewriting should be
48798 used sparingly, and mainly for <quote>regularizing</quote> addresses in your own domains.
48799 Although it can sometimes be used as a routing tool, this is very strongly
48800 discouraged.
48801 </para>
48802 <para>
48803 There are two commonly encountered circumstances where rewriting is used, as
48804 illustrated by these examples:
48805 </para>
48806 <itemizedlist>
48807 <listitem>
48808 <para>
48809 The company whose domain is <emphasis>hitch.fict.example</emphasis> has a number of hosts that
48810 exchange mail with each other behind a firewall, but there is only a single
48811 gateway to the outer world. The gateway rewrites <emphasis>*.hitch.fict.example</emphasis> as
48812 <emphasis>hitch.fict.example</emphasis> when sending mail off-site.
48813 </para>
48814 </listitem>
48815 <listitem>
48816 <para>
48817 A host rewrites the local parts of its own users so that, for example,
48818 <emphasis>fp42@hitch.fict.example</emphasis> becomes <emphasis>Ford.Prefect@hitch.fict.example</emphasis>.
48819 </para>
48820 </listitem>
48821 </itemizedlist>
48822 </section>
48823 <section id="SECID148">
48824 <title>When does rewriting happen?</title>
48825 <para>
48826 <indexterm role="concept">
48827 <primary>rewriting</primary>
48828 <secondary>timing of</secondary>
48829 </indexterm>
48830 <indexterm role="concept">
48831 <primary>access control lists (ACLs)</primary>
48832 <secondary>rewriting addresses in</secondary>
48833 </indexterm>
48834 Configured address rewriting can take place at several different stages of a
48835 message&#x2019;s processing.
48836 </para>
48837 <para>
48838 <indexterm role="variable">
48839 <primary><varname>$sender_address</varname></primary>
48840 </indexterm>
48841 At the start of an ACL for MAIL, the sender address may have been rewritten
48842 by a special SMTP-time rewrite rule (see section <xref linkend="SECTrewriteS"/>), but no
48843 ordinary rewrite rules have yet been applied. If, however, the sender address
48844 is verified in the ACL, it is rewritten before verification, and remains
48845 rewritten thereafter. The subsequent value of <varname>$sender_address</varname> is the
48846 rewritten address. This also applies if sender verification happens in a
48847 RCPT ACL. Otherwise, when the sender address is not verified, it is
48848 rewritten as soon as a message&#x2019;s header lines have been received.
48849 </para>
48850 <para>
48851 <indexterm role="variable">
48852 <primary><varname>$domain</varname></primary>
48853 </indexterm>
48854 <indexterm role="variable">
48855 <primary><varname>$local_part</varname></primary>
48856 </indexterm>
48857 Similarly, at the start of an ACL for RCPT, the current recipient&#x2019;s address
48858 may have been rewritten by a special SMTP-time rewrite rule, but no ordinary
48859 rewrite rules have yet been applied to it. However, the behaviour is different
48860 from the sender address when a recipient is verified. The address is rewritten
48861 for the verification, but the rewriting is not remembered at this stage. The
48862 value of <varname>$local_part</varname> and <varname>$domain</varname> after verification are always the same
48863 as they were before (that is, they contain the unrewritten &ndash; except for
48864 SMTP-time rewriting &ndash; address).
48865 </para>
48866 <para>
48867 As soon as a message&#x2019;s header lines have been received, all the envelope
48868 recipient addresses are permanently rewritten, and rewriting is also applied to
48869 the addresses in the header lines (if configured). This happens before adding
48870 any header lines that were specified in MAIL or RCPT ACLs, and
48871 <indexterm role="concept">
48872 <primary><function>local_scan()</function> function</primary>
48873 <secondary>address rewriting; timing of</secondary>
48874 </indexterm>
48875 before the DATA ACL and <function>local_scan()</function> functions are run.
48876 </para>
48877 <para>
48878 When an address is being routed, either for delivery or for verification,
48879 rewriting is applied immediately to child addresses that are generated by
48880 redirection, unless <option>no_rewrite</option> is set on the router.
48881 </para>
48882 <para>
48883 <indexterm role="concept">
48884 <primary>envelope sender</primary>
48885 <secondary>rewriting at transport time</secondary>
48886 </indexterm>
48887 <indexterm role="concept">
48888 <primary>rewriting</primary>
48889 <secondary>at transport time</secondary>
48890 </indexterm>
48891 <indexterm role="concept">
48892 <primary>header lines</primary>
48893 <secondary>rewriting at transport time</secondary>
48894 </indexterm>
48895 At transport time, additional rewriting of addresses in header lines can be
48896 specified by setting the generic <option>headers_rewrite</option> option on a transport.
48897 This option contains rules that are identical in form to those in the rewrite
48898 section of the configuration file. They are applied to the original message
48899 header lines and any that were added by ACLs or a system filter. They are not
48900 applied to header lines that are added by routers or the transport.
48901 </para>
48902 <para>
48903 The outgoing envelope sender can be rewritten by means of the <option>return_path</option>
48904 transport option. However, it is not possible to rewrite envelope recipients at
48905 transport time.
48906 </para>
48907 </section>
48908 <section id="SECID149">
48909 <title>Testing the rewriting rules that apply on input</title>
48910 <para>
48911 <indexterm role="concept">
48912 <primary>rewriting</primary>
48913 <secondary>testing</secondary>
48914 </indexterm>
48915 <indexterm role="concept">
48916 <primary>testing</primary>
48917 <secondary>rewriting</secondary>
48918 </indexterm>
48919 Exim&#x2019;s input rewriting configuration appears in a part of the run time
48920 configuration file headed by <quote>begin rewrite</quote>. It can be tested by the
48921 <option>-brw</option> command line option. This takes an address (which can be a full RFC
48922 2822 address) as its argument. The output is a list of how the address would be
48923 transformed by the rewriting rules for each of the different places it might
48924 appear in an incoming message, that is, for each different header and for the
48925 envelope sender and recipient fields. For example,
48926 </para>
48927 <literallayout class="monospaced">
48928 exim -brw ph10@exim.workshop.example
48929 </literallayout>
48930 <para>
48931 might produce the output
48932 </para>
48933 <literallayout class="monospaced">
48934 sender: Philip.Hazel@exim.workshop.example
48935 from: Philip.Hazel@exim.workshop.example
48936 to: ph10@exim.workshop.example
48937 cc: ph10@exim.workshop.example
48938 bcc: ph10@exim.workshop.example
48939 reply-to: Philip.Hazel@exim.workshop.example
48940 env-from: Philip.Hazel@exim.workshop.example
48941 env-to: ph10@exim.workshop.example
48942 </literallayout>
48943 <para>
48944 which shows that rewriting has been set up for that address when used in any of
48945 the source fields, but not when it appears as a recipient address. At the
48946 present time, there is no equivalent way of testing rewriting rules that are
48947 set for a particular transport.
48948 </para>
48949 </section>
48950 <section id="SECID150">
48951 <title>Rewriting rules</title>
48952 <para>
48953 <indexterm role="concept">
48954 <primary>rewriting</primary>
48955 <secondary>rules</secondary>
48956 </indexterm>
48957 The rewrite section of the configuration file consists of lines of rewriting
48958 rules in the form
48959 </para>
48960 <literallayout>
48961 &lt;<emphasis>source pattern</emphasis>&gt;  &lt;<emphasis>replacement</emphasis>&gt;  &lt;<emphasis>flags</emphasis>&gt;
48962 </literallayout>
48963 <para>
48964 Rewriting rules that are specified for the <option>headers_rewrite</option> generic
48965 transport option are given as a colon-separated list. Each item in the list
48966 takes the same form as a line in the main rewriting configuration (except that
48967 any colons must be doubled, of course).
48968 </para>
48969 <para>
48970 The formats of source patterns and replacement strings are described below.
48971 Each is terminated by white space, unless enclosed in double quotes, in which
48972 case normal quoting conventions apply inside the quotes. The flags are single
48973 characters which may appear in any order. Spaces and tabs between them are
48974 ignored.
48975 </para>
48976 <para>
48977 For each address that could potentially be rewritten, the rules are scanned in
48978 order, and replacements for the address from earlier rules can themselves be
48979 replaced by later rules (but see the <quote>q</quote> and <quote>R</quote> flags).
48980 </para>
48981 <para>
48982 The order in which addresses are rewritten is undefined, may change between
48983 releases, and must not be relied on, with one exception: when a message is
48984 received, the envelope sender is always rewritten first, before any header
48985 lines are rewritten. For example, the replacement string for a rewrite of an
48986 address in <emphasis>To:</emphasis> must not assume that the message&#x2019;s address in <emphasis>From:</emphasis> has
48987 (or has not) already been rewritten. However, a rewrite of <emphasis>From:</emphasis> may assume
48988 that the envelope sender has already been rewritten.
48989 </para>
48990 <para>
48991 <indexterm role="variable">
48992 <primary><varname>$domain</varname></primary>
48993 </indexterm>
48994 <indexterm role="variable">
48995 <primary><varname>$local_part</varname></primary>
48996 </indexterm>
48997 The variables <varname>$local_part</varname> and <varname>$domain</varname> can be used in the replacement
48998 string to refer to the address that is being rewritten. Note that lookup-driven
48999 rewriting can be done by a rule of the form
49000 </para>
49001 <literallayout class="monospaced">
49002 *@*   ${lookup ...
49003 </literallayout>
49004 <para>
49005 where the lookup key uses <varname>$1</varname> and <varname>$2</varname> or <varname>$local_part</varname> and <varname>$domain</varname> to
49006 refer to the address that is being rewritten.
49007 </para>
49008 </section>
49009 <section id="SECID151">
49010 <title>Rewriting patterns</title>
49011 <para>
49012 <indexterm role="concept">
49013 <primary>rewriting</primary>
49014 <secondary>patterns</secondary>
49015 </indexterm>
49016 <indexterm role="concept">
49017 <primary>address list</primary>
49018 <secondary>in a rewriting pattern</secondary>
49019 </indexterm>
49020 The source pattern in a rewriting rule is any item which may appear in an
49021 address list (see section <xref linkend="SECTaddresslist"/>). It is in fact processed as a
49022 single-item address list, which means that it is expanded before being tested
49023 against the address. As always, if you use a regular expression as a pattern,
49024 you must take care to escape dollar and backslash characters, or use the <literal>\N</literal>
49025 facility to suppress string expansion within the regular expression.
49026 </para>
49027 <para>
49028 Domains in patterns should be given in lower case. Local parts in patterns are
49029 case-sensitive. If you want to do case-insensitive matching of local parts, you
49030 can use a regular expression that starts with <literal>^(?i)</literal>.
49031 </para>
49032 <para>
49033 <indexterm role="concept">
49034 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
49035 <secondary>in rewriting rules</secondary>
49036 </indexterm>
49037 After matching, the numerical variables <varname>$1</varname>, <varname>$2</varname>, etc. may be set,
49038 depending on the type of match which occurred. These can be used in the
49039 replacement string to insert portions of the incoming address. <varname>$0</varname> always
49040 refers to the complete incoming address. When a regular expression is used, the
49041 numerical variables are set from its capturing subexpressions. For other types
49042 of pattern they are set as follows:
49043 </para>
49044 <itemizedlist>
49045 <listitem>
49046 <para>
49047 If a local part or domain starts with an asterisk, the numerical variables
49048 refer to the character strings matched by asterisks, with <varname>$1</varname> associated with
49049 the first asterisk, and <varname>$2</varname> with the second, if present. For example, if the
49050 pattern
49051 </para>
49052 <literallayout class="monospaced">
49053 *queen@*.fict.example
49054 </literallayout>
49055 <para>
49056 is matched against the address <emphasis>hearts-queen@wonderland.fict.example</emphasis> then
49057 </para>
49058 <literallayout class="monospaced">
49059 $0 = hearts-queen@wonderland.fict.example
49060 $1 = hearts-
49061 $2 = wonderland
49062 </literallayout>
49063 <para>
49064 Note that if the local part does not start with an asterisk, but the domain
49065 does, it is <varname>$1</varname> that contains the wild part of the domain.
49066 </para>
49067 </listitem>
49068 <listitem>
49069 <para>
49070 If the domain part of the pattern is a partial lookup, the wild and fixed parts
49071 of the domain are placed in the next available numerical variables. Suppose,
49072 for example, that the address <emphasis>foo@bar.baz.example</emphasis> is processed by a
49073 rewriting rule of the form
49074 </para>
49075 <literallayout>
49076 <literal>*@partial-dbm;/some/dbm/file</literal>    &lt;<emphasis>replacement string</emphasis>&gt;
49077 </literallayout>
49078 <para>
49079 and the key in the file that matches the domain is <literal>*.baz.example</literal>. Then
49080 </para>
49081 <literallayout class="monospaced">
49082 $1 = foo
49083 $2 = bar
49084 $3 = baz.example
49085 </literallayout>
49086 <para>
49087 If the address <emphasis>foo@baz.example</emphasis> is looked up, this matches the same
49088 wildcard file entry, and in this case <varname>$2</varname> is set to the empty string, but
49089 <varname>$3</varname> is still set to <emphasis>baz.example</emphasis>. If a non-wild key is matched in a
49090 partial lookup, <varname>$2</varname> is again set to the empty string and <varname>$3</varname> is set to the
49091 whole domain. For non-partial domain lookups, no numerical variables are set.
49092 </para>
49093 </listitem>
49094 </itemizedlist>
49095 </section>
49096 <section id="SECID152">
49097 <title>Rewriting replacements</title>
49098 <para>
49099 <indexterm role="concept">
49100 <primary>rewriting</primary>
49101 <secondary>replacements</secondary>
49102 </indexterm>
49103 If the replacement string for a rule is a single asterisk, addresses that
49104 match the pattern and the flags are <emphasis>not</emphasis> rewritten, and no subsequent
49105 rewriting rules are scanned. For example,
49106 </para>
49107 <literallayout class="monospaced">
49108 hatta@lookingglass.fict.example  *  f
49109 </literallayout>
49110 <para>
49111 specifies that <emphasis>hatta@lookingglass.fict.example</emphasis> is never to be rewritten in
49112 <emphasis>From:</emphasis> headers.
49113 </para>
49114 <para>
49115 <indexterm role="variable">
49116 <primary><varname>$domain</varname></primary>
49117 </indexterm>
49118 <indexterm role="variable">
49119 <primary><varname>$local_part</varname></primary>
49120 </indexterm>
49121 If the replacement string is not a single asterisk, it is expanded, and must
49122 yield a fully qualified address. Within the expansion, the variables
49123 <varname>$local_part</varname> and <varname>$domain</varname> refer to the address that is being rewritten.
49124 Any letters they contain retain their original case &ndash; they are not lower
49125 cased. The numerical variables are set up according to the type of pattern that
49126 matched the address, as described above. If the expansion is forced to fail by
49127 the presence of <quote>fail</quote> in a conditional or lookup item, rewriting by the
49128 current rule is abandoned, but subsequent rules may take effect. Any other
49129 expansion failure causes the entire rewriting operation to be abandoned, and an
49130 entry written to the panic log.
49131 </para>
49132 </section>
49133 <section id="SECID153">
49134 <title>Rewriting flags</title>
49135 <para>
49136 There are three different kinds of flag that may appear on rewriting rules:
49137 </para>
49138 <itemizedlist>
49139 <listitem>
49140 <para>
49141 Flags that specify which headers and envelope addresses to rewrite: E, F, T, b,
49142 c, f, h, r, s, t.
49143 </para>
49144 </listitem>
49145 <listitem>
49146 <para>
49147 A flag that specifies rewriting at SMTP time: S.
49148 </para>
49149 </listitem>
49150 <listitem>
49151 <para>
49152 Flags that control the rewriting process: Q, q, R, w.
49153 </para>
49154 </listitem>
49155 </itemizedlist>
49156 <para>
49157 For rules that are part of the <option>headers_rewrite</option> generic transport option,
49158 E, F, T, and S are not permitted.
49159 </para>
49160 </section>
49161 <section id="SECID154">
49162 <title>Flags specifying which headers and envelope addresses to rewrite</title>
49163 <para>
49164 <indexterm role="concept">
49165 <primary>rewriting</primary>
49166 <secondary>flags</secondary>
49167 </indexterm>
49168 If none of the following flag letters, nor the <quote>S</quote> flag (see section
49169 <xref linkend="SECTrewriteS"/>) are present, a main rewriting rule applies to all headers
49170 and to both the sender and recipient fields of the envelope, whereas a
49171 transport-time rewriting rule just applies to all headers. Otherwise, the
49172 rewriting rule is skipped unless the relevant addresses are being processed.
49173 </para>
49174 <literallayout>
49175 <literal>E</literal>       rewrite all envelope fields
49176 <literal>F</literal>       rewrite the envelope From field
49177 <literal>T</literal>       rewrite the envelope To field
49178 <literal>b</literal>       rewrite the <emphasis>Bcc:</emphasis> header
49179 <literal>c</literal>       rewrite the <emphasis>Cc:</emphasis> header
49180 <literal>f</literal>       rewrite the <emphasis>From:</emphasis> header
49181 <literal>h</literal>       rewrite all headers
49182 <literal>r</literal>       rewrite the <emphasis>Reply-To:</emphasis> header
49183 <literal>s</literal>       rewrite the <emphasis>Sender:</emphasis> header
49184 <literal>t</literal>       rewrite the <emphasis>To:</emphasis> header
49185 </literallayout>
49186 <para>
49187 "All headers" means all of the headers listed above that can be selected
49188 individually, plus their <emphasis>Resent-</emphasis> versions. It does not include
49189 other headers such as <emphasis>Subject:</emphasis> etc.
49190 </para>
49191 <para>
49192 You should be particularly careful about rewriting <emphasis>Sender:</emphasis> headers, and
49193 restrict this to special known cases in your own domains.
49194 </para>
49195 </section>
49196 <section id="SECTrewriteS">
49197 <title>The SMTP-time rewriting flag</title>
49198 <para>
49199 <indexterm role="concept">
49200 <primary>SMTP</primary>
49201 <secondary>rewriting malformed addresses</secondary>
49202 </indexterm>
49203 <indexterm role="concept">
49204 <primary>RCPT</primary>
49205 <secondary>rewriting argument of</secondary>
49206 </indexterm>
49207 <indexterm role="concept">
49208 <primary>MAIL</primary>
49209 <secondary>rewriting argument of</secondary>
49210 </indexterm>
49211 The rewrite flag <quote>S</quote> specifies a rewrite of incoming envelope addresses at
49212 SMTP time, as soon as an address is received in a MAIL or RCPT command, and
49213 before any other processing; even before syntax checking. The pattern is
49214 required to be a regular expression, and it is matched against the whole of the
49215 data for the command, including any surrounding angle brackets.
49216 </para>
49217 <para>
49218 <indexterm role="variable">
49219 <primary><varname>$domain</varname></primary>
49220 </indexterm>
49221 <indexterm role="variable">
49222 <primary><varname>$local_part</varname></primary>
49223 </indexterm>
49224 This form of rewrite rule allows for the handling of addresses that are not
49225 compliant with RFCs 2821 and 2822 (for example, <quote>bang paths</quote> in batched SMTP
49226 input). Because the input is not required to be a syntactically valid address,
49227 the variables <varname>$local_part</varname> and <varname>$domain</varname> are not available during the
49228 expansion of the replacement string. The result of rewriting replaces the
49229 original address in the MAIL or RCPT command.
49230 </para>
49231 </section>
49232 <section id="SECID155">
49233 <title>Flags controlling the rewriting process</title>
49234 <para>
49235 There are four flags which control the way the rewriting process works. These
49236 take effect only when a rule is invoked, that is, when the address is of the
49237 correct type (matches the flags) and matches the pattern:
49238 </para>
49239 <itemizedlist>
49240 <listitem>
49241 <para>
49242 If the <quote>Q</quote> flag is set on a rule, the rewritten address is permitted to be an
49243 unqualified local part. It is qualified with <option>qualify_recipient</option>. In the
49244 absence of <quote>Q</quote> the rewritten address must always include a domain.
49245 </para>
49246 </listitem>
49247 <listitem>
49248 <para>
49249 If the <quote>q</quote> flag is set on a rule, no further rewriting rules are considered,
49250 even if no rewriting actually takes place because of a <quote>fail</quote> in the
49251 expansion. The <quote>q</quote> flag is not effective if the address is of the wrong type
49252 (does not match the flags) or does not match the pattern.
49253 </para>
49254 </listitem>
49255 <listitem>
49256 <para>
49257 The <quote>R</quote> flag causes a successful rewriting rule to be re-applied to the new
49258 address, up to ten times. It can be combined with the <quote>q</quote> flag, to stop
49259 rewriting once it fails to match (after at least one successful rewrite).
49260 </para>
49261 </listitem>
49262 <listitem>
49263 <para>
49264 <indexterm role="concept">
49265 <primary>rewriting</primary>
49266 <secondary>whole addresses</secondary>
49267 </indexterm>
49268 When an address in a header is rewritten, the rewriting normally applies only
49269 to the working part of the address, with any comments and RFC 2822 <quote>phrase</quote>
49270 left unchanged. For example, rewriting might change
49271 </para>
49272 <literallayout class="monospaced">
49273 From: Ford Prefect &lt;fp42@restaurant.hitch.fict.example&gt;
49274 </literallayout>
49275 <para>
49276 into
49277 </para>
49278 <literallayout class="monospaced">
49279 From: Ford Prefect &lt;prefectf@hitch.fict.example&gt;
49280 </literallayout>
49281 <para>
49282 <indexterm role="concept">
49283 <primary>RFC 2047</primary>
49284 </indexterm>
49285 Sometimes there is a need to replace the whole address item, and this can be
49286 done by adding the flag letter <quote>w</quote> to a rule. If this is set on a rule that
49287 causes an address in a header line to be rewritten, the entire address is
49288 replaced, not just the working part. The replacement must be a complete RFC
49289 2822 address, including the angle brackets if necessary. If text outside angle
49290 brackets contains a character whose value is greater than 126 or less than 32
49291 (except for tab), the text is encoded according to RFC 2047. The character set
49292 is taken from <option>headers_charset</option>, which gets its default at build time.
49293 </para>
49294 <para>
49295 When the <quote>w</quote> flag is set on a rule that causes an envelope address to be
49296 rewritten, all but the working part of the replacement address is discarded.
49297 </para>
49298 </listitem>
49299 </itemizedlist>
49300 </section>
49301 <section id="SECID156">
49302 <title>Rewriting examples</title>
49303 <para>
49304 Here is an example of the two common rewriting paradigms:
49305 </para>
49306 <literallayout class="monospaced">
49307 *@*.hitch.fict.example  $1@hitch.fict.example
49308 *@hitch.fict.example    ${lookup{$1}dbm{/etc/realnames}\
49309                      {$value}fail}@hitch.fict.example bctfrF
49310 </literallayout>
49311 <para>
49312 Note the use of <quote>fail</quote> in the lookup expansion in the second rule, forcing
49313 the string expansion to fail if the lookup does not succeed. In this context it
49314 has the effect of leaving the original address unchanged, but Exim goes on to
49315 consider subsequent rewriting rules, if any, because the <quote>q</quote> flag is not
49316 present in that rule. An alternative to <quote>fail</quote> would be to supply <varname>$1</varname>
49317 explicitly, which would cause the rewritten address to be the same as before,
49318 at the cost of a small bit of processing. Not supplying either of these is an
49319 error, since the rewritten address would then contain no local part.
49320 </para>
49321 <para>
49322 The first example above replaces the domain with a superior, more general
49323 domain. This may not be desirable for certain local parts. If the rule
49324 </para>
49325 <literallayout class="monospaced">
49326 root@*.hitch.fict.example  *
49327 </literallayout>
49328 <para>
49329 were inserted before the first rule, rewriting would be suppressed for the
49330 local part <emphasis>root</emphasis> at any domain ending in <emphasis>hitch.fict.example</emphasis>.
49331 </para>
49332 <para>
49333 Rewriting can be made conditional on a number of tests, by making use of
49334 <varname>${if</varname> in the expansion item. For example, to apply a rewriting rule only to
49335 messages that originate outside the local host:
49336 </para>
49337 <literallayout class="monospaced">
49338 *@*.hitch.fict.example  "${if !eq {$sender_host_address}{}\
49339                          {$1@hitch.fict.example}fail}"
49340 </literallayout>
49341 <para>
49342 The replacement string is quoted in this example because it contains white
49343 space.
49344 </para>
49345 <para>
49346 <indexterm role="concept">
49347 <primary>rewriting</primary>
49348 <secondary>bang paths</secondary>
49349 </indexterm>
49350 <indexterm role="concept">
49351 <primary>bang paths</primary>
49352 <secondary>rewriting</secondary>
49353 </indexterm>
49354 Exim does not handle addresses in the form of <quote>bang paths</quote>. If it sees such
49355 an address it treats it as an unqualified local part which it qualifies with
49356 the local qualification domain (if the source of the message is local or if the
49357 remote host is permitted to send unqualified addresses). Rewriting can
49358 sometimes be used to handle simple bang paths with a fixed number of
49359 components. For example, the rule
49360 </para>
49361 <literallayout class="monospaced">
49362 \N^([^!]+)!(.*)@your.domain.example$\N   $2@$1
49363 </literallayout>
49364 <para>
49365 rewrites a two-component bang path <emphasis>host.name!user</emphasis> as the domain address
49366 <emphasis>user@host.name</emphasis>. However, there is a security implication in using this as
49367 a global rewriting rule for envelope addresses. It can provide a backdoor
49368 method for using your system as a relay, because the incoming addresses appear
49369 to be local. If the bang path addresses are received via SMTP, it is safer to
49370 use the <quote>S</quote> flag to rewrite them as they are received, so that relay checking
49371 can be done on the rewritten addresses.
49372 <indexterm role="concept" startref="IIDaddrew" class="endofrange"/>
49373 </para>
49374 </section>
49375 </chapter>
49376
49377 <chapter id="CHAPretry">
49378 <title>Retry configuration</title>
49379 <para>
49380 <indexterm role="concept" id="IIDretconf1" class="startofrange">
49381 <primary>retry</primary>
49382 <secondary>configuration, description of</secondary>
49383 </indexterm>
49384 <indexterm role="concept" id="IIDregconf2" class="startofrange">
49385 <primary>configuration file</primary>
49386 <secondary>retry section</secondary>
49387 </indexterm>
49388 The <quote>retry</quote> section of the runtime configuration file contains a list of
49389 retry rules that control how often Exim tries to deliver messages that cannot
49390 be delivered at the first attempt. If there are no retry rules (the section is
49391 empty or not present), there are no retries. In this situation, temporary
49392 errors are treated as permanent. The default configuration contains a single,
49393 general-purpose retry rule (see section <xref linkend="SECID57"/>). The <option>-brt</option> command
49394 line option can be used to test which retry rule will be used for a given
49395 address, domain and error.
49396 </para>
49397 <para>
49398 The most common cause of retries is temporary failure to deliver to a remote
49399 host because the host is down, or inaccessible because of a network problem.
49400 Exim&#x2019;s retry processing in this case is applied on a per-host (strictly, per IP
49401 address) basis, not on a per-message basis. Thus, if one message has recently
49402 been delayed, delivery of a new message to the same host is not immediately
49403 tried, but waits for the host&#x2019;s retry time to arrive. If the <option>retry_defer</option>
49404 log selector is set, the message
49405 <indexterm role="concept">
49406 <primary>retry</primary>
49407 <secondary>time not reached</secondary>
49408 </indexterm>
49409 <quote>retry time not reached</quote> is written to the main log whenever a delivery is
49410 skipped for this reason. Section <xref linkend="SECToutSMTPerr"/> contains more details of
49411 the handling of errors during remote deliveries.
49412 </para>
49413 <para>
49414 Retry processing applies to routing as well as to delivering, except as covered
49415 in the next paragraph. The retry rules do not distinguish between these
49416 actions. It is not possible, for example, to specify different behaviour for
49417 failures to route the domain <emphasis>snark.fict.example</emphasis> and failures to deliver to
49418 the host <emphasis>snark.fict.example</emphasis>. I didn&#x2019;t think anyone would ever need this
49419 added complication, so did not implement it. However, although they share the
49420 same retry rule, the actual retry times for routing and transporting a given
49421 domain are maintained independently.
49422 </para>
49423 <para>
49424 When a delivery is not part of a queue run (typically an immediate delivery on
49425 receipt of a message), the routers are always run, and local deliveries are
49426 always attempted, even if retry times are set for them. This makes for better
49427 behaviour if one particular message is causing problems (for example, causing
49428 quota overflow, or provoking an error in a filter file). If such a delivery
49429 suffers a temporary failure, the retry data is updated as normal, and
49430 subsequent delivery attempts from queue runs occur only when the retry time for
49431 the local address is reached.
49432 </para>
49433 <section id="SECID157">
49434 <title>Changing retry rules</title>
49435 <para>
49436 If you change the retry rules in your configuration, you should consider
49437 whether or not to delete the retry data that is stored in Exim&#x2019;s spool area in
49438 files with names like <filename>db/retry</filename>. Deleting any of Exim&#x2019;s hints files is
49439 always safe; that is why they are called <quote>hints</quote>.
49440 </para>
49441 <para>
49442 The hints retry data contains suggested retry times based on the previous
49443 rules. In the case of a long-running problem with a remote host, it might
49444 record the fact that the host has timed out. If your new rules increase the
49445 timeout time for such a host, you should definitely remove the old retry data
49446 and let Exim recreate it, based on the new rules. Otherwise Exim might bounce
49447 messages that it should now be retaining.
49448 </para>
49449 </section>
49450 <section id="SECID158">
49451 <title>Format of retry rules</title>
49452 <para>
49453 <indexterm role="concept">
49454 <primary>retry</primary>
49455 <secondary>rules</secondary>
49456 </indexterm>
49457 Each retry rule occupies one line and consists of three or four parts,
49458 separated by white space: a pattern, an error name, an optional list of sender
49459 addresses, and a list of retry parameters. The pattern and sender lists must be
49460 enclosed in double quotes if they contain white space. The rules are searched
49461 in order until one is found where the pattern, error name, and sender list (if
49462 present) match the failing host or address, the error that occurred, and the
49463 message&#x2019;s sender, respectively.
49464 </para>
49465 <para>
49466 The pattern is any single item that may appear in an address list (see section
49467 <xref linkend="SECTaddresslist"/>). It is in fact processed as a one-item address list,
49468 which means that it is expanded before being tested against the address that
49469 has been delayed. A negated address list item is permitted. Address
49470 list processing treats a plain domain name as if it were preceded by <quote>*@</quote>,
49471 which makes it possible for many retry rules to start with just a domain. For
49472 example,
49473 </para>
49474 <literallayout class="monospaced">
49475 lookingglass.fict.example        *  F,24h,30m;
49476 </literallayout>
49477 <para>
49478 provides a rule for any address in the <emphasis>lookingglass.fict.example</emphasis> domain,
49479 whereas
49480 </para>
49481 <literallayout class="monospaced">
49482 alice@lookingglass.fict.example  *  F,24h,30m;
49483 </literallayout>
49484 <para>
49485 applies only to temporary failures involving the local part <option>alice</option>.
49486 In practice, almost all rules start with a domain name pattern without a local
49487 part.
49488 </para>
49489 <para>
49490 <indexterm role="concept">
49491 <primary>regular expressions</primary>
49492 <secondary>in retry rules</secondary>
49493 </indexterm>
49494 <emphasis role="bold">Warning</emphasis>: If you use a regular expression in a retry rule pattern, it
49495 must match a complete address, not just a domain, because that is how regular
49496 expressions work in address lists.
49497 </para>
49498 <literallayout>
49499 <literal>^\Nxyz\d+\.abc\.example$\N        *  G,1h,10m,2</literal>     <option>Wrong</option>
49500 <literal>^\N[^@]+@xyz\d+\.abc\.example$\N  *  G,1h,10m,2</literal>     <option>Right</option>
49501 </literallayout>
49502 </section>
49503 <section id="SECID159">
49504 <title>Choosing which retry rule to use for address errors</title>
49505 <para>
49506 When Exim is looking for a retry rule after a routing attempt has failed (for
49507 example, after a DNS timeout), each line in the retry configuration is tested
49508 against the complete address only if <option>retry_use_local_part</option> is set for the
49509 router. Otherwise, only the domain is used, except when matching against a
49510 regular expression, when the local part of the address is replaced with <quote>*</quote>.
49511 A domain on its own can match a domain pattern, or a pattern that starts with
49512 <quote>*@</quote>. By default, <option>retry_use_local_part</option> is true for routers where
49513 <option>check_local_user</option> is true, and false for other routers.
49514 </para>
49515 <para>
49516 Similarly, when Exim is looking for a retry rule after a local delivery has
49517 failed (for example, after a mailbox full error), each line in the retry
49518 configuration is tested against the complete address only if
49519 <option>retry_use_local_part</option> is set for the transport (it defaults true for all
49520 local transports).
49521 </para>
49522 <para>
49523 <indexterm role="concept">
49524 <primary>4<emphasis>xx</emphasis> responses</primary>
49525 <secondary>retry rules for</secondary>
49526 </indexterm>
49527 However, when Exim is looking for a retry rule after a remote delivery attempt
49528 suffers an address error (a 4<emphasis>xx</emphasis> SMTP response for a recipient address), the
49529 whole address is always used as the key when searching the retry rules. The
49530 rule that is found is used to create a retry time for the combination of the
49531 failing address and the message&#x2019;s sender. It is the combination of sender and
49532 recipient that is delayed in subsequent queue runs until its retry time is
49533 reached. You can delay the recipient without regard to the sender by setting
49534 <option>address_retry_include_sender</option> false in the <command>smtp</command> transport but this can
49535 lead to problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT
49536 commands.
49537 </para>
49538 </section>
49539 <section id="SECID160">
49540 <title>Choosing which retry rule to use for host and message errors</title>
49541 <para>
49542 For a temporary error that is not related to an individual address (for
49543 example, a connection timeout), each line in the retry configuration is checked
49544 twice. First, the name of the remote host is used as a domain name (preceded by
49545 <quote>*@</quote> when matching a regular expression). If this does not match the line,
49546 the domain from the email address is tried in a similar fashion. For example,
49547 suppose the MX records for <emphasis>a.b.c.example</emphasis> are
49548 </para>
49549 <literallayout class="monospaced">
49550 a.b.c.example  MX  5  x.y.z.example
49551                MX  6  p.q.r.example
49552                MX  7  m.n.o.example
49553 </literallayout>
49554 <para>
49555 and the retry rules are
49556 </para>
49557 <literallayout class="monospaced">
49558 p.q.r.example    *      F,24h,30m;
49559 a.b.c.example    *      F,4d,45m;
49560 </literallayout>
49561 <para>
49562 and a delivery to the host <emphasis>x.y.z.example</emphasis> suffers a connection failure. The
49563 first rule matches neither the host nor the domain, so Exim looks at the second
49564 rule. This does not match the host, but it does match the domain, so it is used
49565 to calculate the retry time for the host <emphasis>x.y.z.example</emphasis>. Meanwhile, Exim
49566 tries to deliver to <emphasis>p.q.r.example</emphasis>. If this also suffers a host error, the
49567 first retry rule is used, because it matches the host.
49568 </para>
49569 <para>
49570 In other words, temporary failures to deliver to host <emphasis>p.q.r.example</emphasis> use the
49571 first rule to determine retry times, but for all the other hosts for the domain
49572 <emphasis>a.b.c.example</emphasis>, the second rule is used. The second rule is also used if
49573 routing to <emphasis>a.b.c.example</emphasis> suffers a temporary failure.
49574 </para>
49575 <para>
49576 <emphasis role="bold">Note</emphasis>: The host name is used when matching the patterns, not its IP address.
49577 However, if a message is routed directly to an IP address without the use of a
49578 host name, for example, if a <command>manualroute</command> router contains a setting such as:
49579 </para>
49580 <literallayout class="monospaced">
49581 route_list = *.a.example  192.168.34.23
49582 </literallayout>
49583 <para>
49584 then the <quote>host name</quote> that is used when searching for a retry rule is the
49585 textual form of the IP address.
49586 </para>
49587 </section>
49588 <section id="SECID161">
49589 <title>Retry rules for specific errors</title>
49590 <para>
49591 <indexterm role="concept">
49592 <primary>retry</primary>
49593 <secondary>specific errors; specifying</secondary>
49594 </indexterm>
49595 The second field in a retry rule is the name of a particular error, or an
49596 asterisk, which matches any error. The errors that can be tested for are:
49597 </para>
49598 <variablelist>
49599 <varlistentry>
49600 <term><option>auth_failed</option></term>
49601 <listitem>
49602 <para>
49603 Authentication failed when trying to send to a host in the
49604 <option>hosts_require_auth</option> list in an <command>smtp</command> transport.
49605 </para>
49606 </listitem></varlistentry>
49607 <varlistentry>
49608 <term><option>data_4xx</option></term>
49609 <listitem>
49610 <para>
49611 A 4<emphasis>xx</emphasis> error was received for an outgoing DATA command, either immediately
49612 after the command, or after sending the message&#x2019;s data.
49613 </para>
49614 </listitem></varlistentry>
49615 <varlistentry>
49616 <term><option>mail_4xx</option></term>
49617 <listitem>
49618 <para>
49619 A 4<emphasis>xx</emphasis> error was received for an outgoing MAIL command.
49620 </para>
49621 </listitem></varlistentry>
49622 <varlistentry>
49623 <term><option>rcpt_4xx</option></term>
49624 <listitem>
49625 <para>
49626 A 4<emphasis>xx</emphasis> error was received for an outgoing RCPT command.
49627 </para>
49628 </listitem></varlistentry>
49629 </variablelist>
49630 <para>
49631 For the three 4<emphasis>xx</emphasis> errors, either the first or both of the x&#x2019;s can be given
49632 as specific digits, for example: <literal>mail_45x</literal> or <literal>rcpt_436</literal>. For example, to
49633 recognize 452 errors given to RCPT commands for addresses in a certain domain,
49634 and have retries every ten minutes with a one-hour timeout, you could set up a
49635 retry rule of this form:
49636 </para>
49637 <literallayout class="monospaced">
49638 the.domain.name  rcpt_452   F,1h,10m
49639 </literallayout>
49640 <para>
49641 These errors apply to both outgoing SMTP (the <command>smtp</command> transport) and outgoing
49642 LMTP (either the <command>lmtp</command> transport, or the <command>smtp</command> transport in LMTP mode).
49643 </para>
49644 <variablelist>
49645 <varlistentry>
49646 <term><option>lost_connection</option></term>
49647 <listitem>
49648 <para>
49649 A server unexpectedly closed the SMTP connection. There may, of course,
49650 legitimate reasons for this (host died, network died), but if it repeats a lot
49651 for the same host, it indicates something odd.
49652 </para>
49653 </listitem></varlistentry>
49654 <varlistentry>
49655 <term><option>lookup</option></term>
49656 <listitem>
49657 <para>
49658 A DNS lookup for a host failed.
49659 Note that a <option>dnslookup</option> router will need to have matched
49660 its <option>fail_defer_domains</option> option for this retry type to be usable.
49661 Also note that a <option>manualroute</option> router will probably need
49662 its <option>host_find_failed</option> option set to <option>defer</option>.
49663 </para>
49664 </listitem></varlistentry>
49665 <varlistentry>
49666 <term><option>refused_MX</option></term>
49667 <listitem>
49668 <para>
49669 A connection to a host obtained from an MX record was refused.
49670 </para>
49671 </listitem></varlistentry>
49672 <varlistentry>
49673 <term><option>refused_A</option></term>
49674 <listitem>
49675 <para>
49676 A connection to a host not obtained from an MX record was refused.
49677 </para>
49678 </listitem></varlistentry>
49679 <varlistentry>
49680 <term><option>refused</option></term>
49681 <listitem>
49682 <para>
49683 A connection was refused.
49684 </para>
49685 </listitem></varlistentry>
49686 <varlistentry>
49687 <term><option>timeout_connect_MX</option></term>
49688 <listitem>
49689 <para>
49690 A connection attempt to a host obtained from an MX record timed out.
49691 </para>
49692 </listitem></varlistentry>
49693 <varlistentry>
49694 <term><option>timeout_connect_A</option></term>
49695 <listitem>
49696 <para>
49697 A connection attempt to a host not obtained from an MX record timed out.
49698 </para>
49699 </listitem></varlistentry>
49700 <varlistentry>
49701 <term><option>timeout_connect</option></term>
49702 <listitem>
49703 <para>
49704 A connection attempt timed out.
49705 </para>
49706 </listitem></varlistentry>
49707 <varlistentry>
49708 <term><option>timeout_MX</option></term>
49709 <listitem>
49710 <para>
49711 There was a timeout while connecting or during an SMTP session with a host
49712 obtained from an MX record.
49713 </para>
49714 </listitem></varlistentry>
49715 <varlistentry>
49716 <term><option>timeout_A</option></term>
49717 <listitem>
49718 <para>
49719 There was a timeout while connecting or during an SMTP session with a host not
49720 obtained from an MX record.
49721 </para>
49722 </listitem></varlistentry>
49723 <varlistentry>
49724 <term><option>timeout</option></term>
49725 <listitem>
49726 <para>
49727 There was a timeout while connecting or during an SMTP session.
49728 </para>
49729 </listitem></varlistentry>
49730 <varlistentry>
49731 <term><option>tls_required</option></term>
49732 <listitem>
49733 <para>
49734 The server was required to use TLS (it matched <option>hosts_require_tls</option> in the
49735 <command>smtp</command> transport), but either did not offer TLS, or it responded with 4<emphasis>xx</emphasis>
49736 to STARTTLS, or there was a problem setting up the TLS connection.
49737 </para>
49738 </listitem></varlistentry>
49739 <varlistentry>
49740 <term><option>quota</option></term>
49741 <listitem>
49742 <para>
49743 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
49744 transport.
49745 </para>
49746 </listitem></varlistentry>
49747 <varlistentry>
49748 <term><option>quota_</option>&lt;<emphasis>time</emphasis>&gt;</term>
49749 <listitem>
49750 <para>
49751 <indexterm role="concept">
49752 <primary>quota</primary>
49753 <secondary>error testing in retry rule</secondary>
49754 </indexterm>
49755 <indexterm role="concept">
49756 <primary>retry</primary>
49757 <secondary>quota error testing</secondary>
49758 </indexterm>
49759 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
49760 transport, and the mailbox has not been accessed for &lt;<emphasis>time</emphasis>&gt;. For example,
49761 <emphasis>quota_4d</emphasis> applies to a quota error when the mailbox has not been accessed
49762 for four days.
49763 </para>
49764 </listitem></varlistentry>
49765 </variablelist>
49766 <para>
49767 <indexterm role="concept">
49768 <primary>mailbox</primary>
49769 <secondary>time of last read</secondary>
49770 </indexterm>
49771 The idea of <option>quota_</option>&lt;<emphasis>time</emphasis>&gt; is to make it possible to have shorter
49772 timeouts when the mailbox is full and is not being read by its owner. Ideally,
49773 it should be based on the last time that the user accessed the mailbox.
49774 However, it is not always possible to determine this. Exim uses the following
49775 heuristic rules:
49776 </para>
49777 <itemizedlist>
49778 <listitem>
49779 <para>
49780 If the mailbox is a single file, the time of last access (the <quote>atime</quote>) is
49781 used. As no new messages are being delivered (because the mailbox is over
49782 quota), Exim does not access the file, so this is the time of last user access.
49783 </para>
49784 </listitem>
49785 <listitem>
49786 <para>
49787 <indexterm role="concept">
49788 <primary>maildir format</primary>
49789 <secondary>time of last read</secondary>
49790 </indexterm>
49791 For a maildir delivery, the time of last modification of the <filename>new</filename>
49792 subdirectory is used. As the mailbox is over quota, no new files are created in
49793 the <filename>new</filename> subdirectory, because no new messages are being delivered. Any
49794 change to the <filename>new</filename> subdirectory is therefore assumed to be the result of an
49795 MUA moving a new message to the <filename>cur</filename> directory when it is first read. The
49796 time that is used is therefore the last time that the user read a new message.
49797 </para>
49798 </listitem>
49799 <listitem>
49800 <para>
49801 For other kinds of multi-file mailbox, the time of last access cannot be
49802 obtained, so a retry rule that uses this type of error field is never matched.
49803 </para>
49804 </listitem>
49805 </itemizedlist>
49806 <para>
49807 The quota errors apply both to system-enforced quotas and to Exim&#x2019;s own quota
49808 mechanism in the <command>appendfile</command> transport. The <emphasis>quota</emphasis> error also applies
49809 when a local delivery is deferred because a partition is full (the ENOSPC
49810 error).
49811 </para>
49812 </section>
49813 <section id="SECID162">
49814 <title>Retry rules for specified senders</title>
49815 <para>
49816 <indexterm role="concept">
49817 <primary>retry</primary>
49818 <secondary>rules; sender-specific</secondary>
49819 </indexterm>
49820 You can specify retry rules that apply only when the failing message has a
49821 specific sender. In particular, this can be used to define retry rules that
49822 apply only to bounce messages. The third item in a retry rule can be of this
49823 form:
49824 </para>
49825 <literallayout>
49826 <literal>senders=</literal>&lt;<emphasis>address list</emphasis>&gt;
49827 </literallayout>
49828 <para>
49829 The retry timings themselves are then the fourth item. For example:
49830 </para>
49831 <literallayout class="monospaced">
49832 *   rcpt_4xx   senders=:   F,1h,30m
49833 </literallayout>
49834 <para>
49835 matches recipient 4<emphasis>xx</emphasis> errors for bounce messages sent to any address at any
49836 host. If the address list contains white space, it must be enclosed in quotes.
49837 For example:
49838 </para>
49839 <literallayout class="monospaced">
49840 a.domain  rcpt_452  senders="xb.dom : yc.dom"  G,8h,10m,1.5
49841 </literallayout>
49842 <para>
49843 <emphasis role="bold">Warning</emphasis>: This facility can be unhelpful if it is used for host errors
49844 (which do not depend on the recipient). The reason is that the sender is used
49845 only to match the retry rule. Once the rule has been found for a host error,
49846 its contents are used to set a retry time for the host, and this will apply to
49847 all messages, not just those with specific senders.
49848 </para>
49849 <para>
49850 When testing retry rules using <option>-brt</option>, you can supply a sender using the
49851 <option>-f</option> command line option, like this:
49852 </para>
49853 <literallayout class="monospaced">
49854 exim -f "" -brt user@dom.ain
49855 </literallayout>
49856 <para>
49857 If you do not set <option>-f</option> with <option>-brt</option>, a retry rule that contains a senders
49858 list is never matched.
49859 </para>
49860 </section>
49861 <section id="SECID163">
49862 <title>Retry parameters</title>
49863 <para>
49864 <indexterm role="concept">
49865 <primary>retry</primary>
49866 <secondary>parameters in rules</secondary>
49867 </indexterm>
49868 The third (or fourth, if a senders list is present) field in a retry rule is a
49869 sequence of retry parameter sets, separated by semicolons. Each set consists of
49870 </para>
49871 <literallayout>
49872 &lt;<emphasis>letter</emphasis>&gt;,&lt;<emphasis>cutoff time</emphasis>&gt;,&lt;<emphasis>arguments</emphasis>&gt;
49873 </literallayout>
49874 <para>
49875 The letter identifies the algorithm for computing a new retry time; the cutoff
49876 time is the time beyond which this algorithm no longer applies, and the
49877 arguments vary the algorithm&#x2019;s action. The cutoff time is measured from the
49878 time that the first failure for the domain (combined with the local part if
49879 relevant) was detected, not from the time the message was received.
49880 </para>
49881 <para>
49882 <indexterm role="concept">
49883 <primary>retry</primary>
49884 <secondary>algorithms</secondary>
49885 </indexterm>
49886 <indexterm role="concept">
49887 <primary>retry</primary>
49888 <secondary>fixed intervals</secondary>
49889 </indexterm>
49890 <indexterm role="concept">
49891 <primary>retry</primary>
49892 <secondary>increasing intervals</secondary>
49893 </indexterm>
49894 <indexterm role="concept">
49895 <primary>retry</primary>
49896 <secondary>random intervals</secondary>
49897 </indexterm>
49898 The available algorithms are:
49899 </para>
49900 <itemizedlist>
49901 <listitem>
49902 <para>
49903 <emphasis>F</emphasis>: retry at fixed intervals. There is a single time parameter specifying
49904 the interval.
49905 </para>
49906 </listitem>
49907 <listitem>
49908 <para>
49909 <emphasis>G</emphasis>: retry at geometrically increasing intervals. The first argument
49910 specifies a starting value for the interval, and the second a multiplier, which
49911 is used to increase the size of the interval at each retry.
49912 </para>
49913 </listitem>
49914 <listitem>
49915 <para>
49916 <emphasis>H</emphasis>: retry at randomized intervals. The arguments are as for <emphasis>G</emphasis>. For each
49917 retry, the previous interval is multiplied by the factor in order to get a
49918 maximum for the next interval. The minimum interval is the first argument of
49919 the parameter, and an actual interval is chosen randomly between them. Such a
49920 rule has been found to be helpful in cluster configurations when all the
49921 members of the cluster restart at once, and may therefore synchronize their
49922 queue processing times.
49923 </para>
49924 </listitem>
49925 </itemizedlist>
49926 <para>
49927 When computing the next retry time, the algorithm definitions are scanned in
49928 order until one whose cutoff time has not yet passed is reached. This is then
49929 used to compute a new retry time that is later than the current time. In the
49930 case of fixed interval retries, this simply means adding the interval to the
49931 current time. For geometrically increasing intervals, retry intervals are
49932 computed from the rule&#x2019;s parameters until one that is greater than the previous
49933 interval is found. The main configuration variable
49934 <indexterm role="concept">
49935 <primary>limit</primary>
49936 <secondary>retry interval</secondary>
49937 </indexterm>
49938 <indexterm role="concept">
49939 <primary>retry</primary>
49940 <secondary>interval, maximum</secondary>
49941 </indexterm>
49942 <indexterm role="option">
49943 <primary><option>retry_interval_max</option></primary>
49944 </indexterm>
49945 <option>retry_interval_max</option> limits the maximum interval between retries. It
49946 cannot be set greater than <literal>24h</literal>, which is its default value.
49947 </para>
49948 <para>
49949 A single remote domain may have a number of hosts associated with it, and each
49950 host may have more than one IP address. Retry algorithms are selected on the
49951 basis of the domain name, but are applied to each IP address independently. If,
49952 for example, a host has two IP addresses and one is unusable, Exim will
49953 generate retry times for it and will not try to use it until its next retry
49954 time comes. Thus the good IP address is likely to be tried first most of the
49955 time.
49956 </para>
49957 <para>
49958 <indexterm role="concept">
49959 <primary>hints database</primary>
49960 <secondary>use for retrying</secondary>
49961 </indexterm>
49962 Retry times are hints rather than promises. Exim does not make any attempt to
49963 run deliveries exactly at the computed times. Instead, a queue runner process
49964 starts delivery processes for delayed messages periodically, and these attempt
49965 new deliveries only for those addresses that have passed their next retry time.
49966 If a new message arrives for a deferred address, an immediate delivery attempt
49967 occurs only if the address has passed its retry time. In the absence of new
49968 messages, the minimum time between retries is the interval between queue runner
49969 processes. There is not much point in setting retry times of five minutes if
49970 your queue runners happen only once an hour, unless there are a significant
49971 number of incoming messages (which might be the case on a system that is
49972 sending everything to a smart host, for example).
49973 </para>
49974 <para>
49975 The data in the retry hints database can be inspected by using the
49976 <emphasis>exim_dumpdb</emphasis> or <emphasis>exim_fixdb</emphasis> utility programs (see chapter
49977 <xref linkend="CHAPutils"/>). The latter utility can also be used to change the data. The
49978 <emphasis>exinext</emphasis> utility script can be used to find out what the next retry times
49979 are for the hosts associated with a particular mail domain, and also for local
49980 deliveries that have been deferred.
49981 </para>
49982 </section>
49983 <section id="SECID164">
49984 <title>Retry rule examples</title>
49985 <para>
49986 Here are some example retry rules:
49987 </para>
49988 <literallayout class="monospaced">
49989 alice@wonderland.fict.example quota_5d  F,7d,3h
49990 wonderland.fict.example       quota_5d
49991 wonderland.fict.example       *         F,1h,15m; G,2d,1h,2;
49992 lookingglass.fict.example     *         F,24h,30m;
49993 *                 refused_A   F,2h,20m;
49994 *                 *           F,2h,15m; G,16h,1h,1.5; F,5d,8h
49995 </literallayout>
49996 <para>
49997 The first rule sets up special handling for mail to
49998 <emphasis>alice@wonderland.fict.example</emphasis> when there is an over-quota error and the
49999 mailbox has not been read for at least 5 days. Retries continue every three
50000 hours for 7 days. The second rule handles over-quota errors for all other local
50001 parts at <emphasis>wonderland.fict.example</emphasis>; the absence of a local part has the same
50002 effect as supplying <quote>*@</quote>. As no retry algorithms are supplied, messages that
50003 fail are bounced immediately if the mailbox has not been read for at least 5
50004 days.
50005 </para>
50006 <para>
50007 The third rule handles all other errors at <emphasis>wonderland.fict.example</emphasis>; retries
50008 happen every 15 minutes for an hour, then with geometrically increasing
50009 intervals until two days have passed since a delivery first failed. After the
50010 first hour there is a delay of one hour, then two hours, then four hours, and
50011 so on (this is a rather extreme example).
50012 </para>
50013 <para>
50014 The fourth rule controls retries for the domain <emphasis>lookingglass.fict.example</emphasis>.
50015 They happen every 30 minutes for 24 hours only. The remaining two rules handle
50016 all other domains, with special action for connection refusal from hosts that
50017 were not obtained from an MX record.
50018 </para>
50019 <para>
50020 The final rule in a retry configuration should always have asterisks in the
50021 first two fields so as to provide a general catch-all for any addresses that do
50022 not have their own special handling. This example tries every 15 minutes for 2
50023 hours, then with intervals starting at one hour and increasing by a factor of
50024 1.5 up to 16 hours, then every 8 hours up to 5 days.
50025 </para>
50026 </section>
50027 <section id="SECID165">
50028 <title>Timeout of retry data</title>
50029 <para>
50030 <indexterm role="concept">
50031 <primary>timeout</primary>
50032 <secondary>of retry data</secondary>
50033 </indexterm>
50034 <indexterm role="option">
50035 <primary><option>retry_data_expire</option></primary>
50036 </indexterm>
50037 <indexterm role="concept">
50038 <primary>hints database</primary>
50039 <secondary>data expiry</secondary>
50040 </indexterm>
50041 <indexterm role="concept">
50042 <primary>retry</primary>
50043 <secondary>timeout of data</secondary>
50044 </indexterm>
50045 Exim timestamps the data that it writes to its retry hints database. When it
50046 consults the data during a delivery it ignores any that is older than the value
50047 set in <option>retry_data_expire</option> (default 7 days). If, for example, a host hasn&#x2019;t
50048 been tried for 7 days, Exim will try to deliver to it immediately a message
50049 arrives, and if that fails, it will calculate a retry time as if it were
50050 failing for the first time.
50051 </para>
50052 <para>
50053 This improves the behaviour for messages routed to rarely-used hosts such as MX
50054 backups. If such a host was down at one time, and happens to be down again when
50055 Exim tries a month later, using the old retry data would imply that it had been
50056 down all the time, which is not a justified assumption.
50057 </para>
50058 <para>
50059 If a host really is permanently dead, this behaviour causes a burst of retries
50060 every now and again, but only if messages routed to it are rare. If there is a
50061 message at least once every 7 days the retry data never expires.
50062 </para>
50063 </section>
50064 <section id="SECID166">
50065 <title>Long-term failures</title>
50066 <para>
50067 <indexterm role="concept">
50068 <primary>delivery failure, long-term</primary>
50069 </indexterm>
50070 <indexterm role="concept">
50071 <primary>retry</primary>
50072 <secondary>after long-term failure</secondary>
50073 </indexterm>
50074 Special processing happens when an email address has been failing for so long
50075 that the cutoff time for the last algorithm is reached. For example, using the
50076 default retry rule:
50077 </para>
50078 <literallayout class="monospaced">
50079 * * F,2h,15m; G,16h,1h,1.5; F,4d,6h
50080 </literallayout>
50081 <para>
50082 the cutoff time is four days. Reaching the retry cutoff is independent of how
50083 long any specific message has been failing; it is the length of continuous
50084 failure for the recipient address that counts.
50085 </para>
50086 <para>
50087 When the cutoff time is reached for a local delivery, or for all the IP
50088 addresses associated with a remote delivery, a subsequent delivery failure
50089 causes Exim to give up on the address, and a bounce message is generated.
50090 In order to cater for new messages that use the failing address, a next retry
50091 time is still computed from the final algorithm, and is used as follows:
50092 </para>
50093 <para>
50094 For local deliveries, one delivery attempt is always made for any subsequent
50095 messages. If this delivery fails, the address fails immediately. The
50096 post-cutoff retry time is not used.
50097 </para>
50098 <para>
50099 If the delivery is remote, there are two possibilities, controlled by the
50100 <indexterm role="option">
50101 <primary><option>delay_after_cutoff</option></primary>
50102 </indexterm>
50103 <option>delay_after_cutoff</option> option of the <command>smtp</command> transport. The option is true by
50104 default. Until the post-cutoff retry time for one of the IP addresses is
50105 reached, the failing email address is bounced immediately, without a delivery
50106 attempt taking place. After that time, one new delivery attempt is made to
50107 those IP addresses that are past their retry times, and if that still fails,
50108 the address is bounced and new retry times are computed.
50109 </para>
50110 <para>
50111 In other words, when all the hosts for a given email address have been failing
50112 for a long time, Exim bounces rather then defers until one of the hosts&#x2019; retry
50113 times is reached. Then it tries once, and bounces if that attempt fails. This
50114 behaviour ensures that few resources are wasted in repeatedly trying to deliver
50115 to a broken destination, but if the host does recover, Exim will eventually
50116 notice.
50117 </para>
50118 <para>
50119 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
50120 addresses are past their final cutoff time, Exim tries to deliver to those IP
50121 addresses that have not been tried since the message arrived. If there are
50122 no suitable IP addresses, or if they all fail, the address is bounced. In other
50123 words, it does not delay when a new message arrives, but tries the expired
50124 addresses immediately, unless they have been tried since the message arrived.
50125 If there is a continuous stream of messages for the failing domains, setting
50126 <option>delay_after_cutoff</option> false means that there will be many more attempts to
50127 deliver to permanently failing IP addresses than when <option>delay_after_cutoff</option> is
50128 true.
50129 </para>
50130 </section>
50131 <section id="SECID167">
50132 <title>Deliveries that work intermittently</title>
50133 <para>
50134 <indexterm role="concept">
50135 <primary>retry</primary>
50136 <secondary>intermittently working deliveries</secondary>
50137 </indexterm>
50138 Some additional logic is needed to cope with cases where a host is
50139 intermittently available, or when a message has some attribute that prevents
50140 its delivery when others to the same address get through. In this situation,
50141 because some messages are successfully delivered, the <quote>retry clock</quote> for the
50142 host or address keeps getting reset by the successful deliveries, and so
50143 failing messages remain on the queue for ever because the cutoff time is never
50144 reached.
50145 </para>
50146 <para>
50147 Two exceptional actions are applied to prevent this happening. The first
50148 applies to errors that are related to a message rather than a remote host.
50149 Section <xref linkend="SECToutSMTPerr"/> has a discussion of the different kinds of error;
50150 examples of message-related errors are 4<emphasis>xx</emphasis> responses to MAIL or DATA
50151 commands, and quota failures. For this type of error, if a message&#x2019;s arrival
50152 time is earlier than the <quote>first failed</quote> time for the error, the earlier time
50153 is used when scanning the retry rules to decide when to try next and when to
50154 time out the address.
50155 </para>
50156 <para>
50157 The exceptional second action applies in all cases. If a message has been on
50158 the queue for longer than the cutoff time of any applicable retry rule for a
50159 given address, a delivery is attempted for that address, even if it is not yet
50160 time, and if this delivery fails, the address is timed out. A new retry time is
50161 not computed in this case, so that other messages for the same address are
50162 considered immediately.
50163 <indexterm role="concept" startref="IIDretconf1" class="endofrange"/>
50164 <indexterm role="concept" startref="IIDregconf2" class="endofrange"/>
50165 </para>
50166 </section>
50167 </chapter>
50168
50169 <chapter id="CHAPSMTPAUTH">
50170 <title>SMTP authentication</title>
50171 <para>
50172 <indexterm role="concept" id="IIDauthconf1" class="startofrange">
50173 <primary>SMTP</primary>
50174 <secondary>authentication configuration</secondary>
50175 </indexterm>
50176 <indexterm role="concept" id="IIDauthconf2" class="startofrange">
50177 <primary>authentication</primary>
50178 </indexterm>
50179 The <quote>authenticators</quote> section of Exim&#x2019;s run time configuration is concerned
50180 with SMTP authentication. This facility is an extension to the SMTP protocol,
50181 described in RFC 2554, which allows a client SMTP host to authenticate itself
50182 to a server. This is a common way for a server to recognize clients that are
50183 permitted to use it as a relay. SMTP authentication is not of relevance to the
50184 transfer of mail between servers that have no managerial connection with each
50185 other.
50186 </para>
50187 <para>
50188 <indexterm role="concept">
50189 <primary>AUTH</primary>
50190 <secondary>description of</secondary>
50191 </indexterm>
50192 Very briefly, the way SMTP authentication works is as follows:
50193 </para>
50194 <itemizedlist>
50195 <listitem>
50196 <para>
50197 The server advertises a number of authentication <emphasis>mechanisms</emphasis> in response to
50198 the client&#x2019;s EHLO command.
50199 </para>
50200 </listitem>
50201 <listitem>
50202 <para>
50203 The client issues an AUTH command, naming a specific mechanism. The command
50204 may, optionally, contain some authentication data.
50205 </para>
50206 </listitem>
50207 <listitem>
50208 <para>
50209 The server may issue one or more <emphasis>challenges</emphasis>, to which the client must send
50210 appropriate responses. In simple authentication mechanisms, the challenges are
50211 just prompts for user names and passwords. The server does not have to issue
50212 any challenges &ndash; in some mechanisms the relevant data may all be transmitted
50213 with the AUTH command.
50214 </para>
50215 </listitem>
50216 <listitem>
50217 <para>
50218 The server either accepts or denies authentication.
50219 </para>
50220 </listitem>
50221 <listitem>
50222 <para>
50223 If authentication succeeds, the client may optionally make use of the AUTH
50224 option on the MAIL command to pass an authenticated sender in subsequent
50225 mail transactions. Authentication lasts for the remainder of the SMTP
50226 connection.
50227 </para>
50228 </listitem>
50229 <listitem>
50230 <para>
50231 If authentication fails, the client may give up, or it may try a different
50232 authentication mechanism, or it may try transferring mail over the
50233 unauthenticated connection.
50234 </para>
50235 </listitem>
50236 </itemizedlist>
50237 <para>
50238 If you are setting up a client, and want to know which authentication
50239 mechanisms the server supports, you can use Telnet to connect to port 25 (the
50240 SMTP port) on the server, and issue an EHLO command. The response to this
50241 includes the list of supported mechanisms. For example:
50242 </para>
50243 <literallayout>
50244 <literal>$ </literal><emphasis role="bold"><literal>telnet server.example 25</literal></emphasis>
50245 <literal>Trying 192.168.34.25...</literal>
50246 <literal>Connected to server.example.</literal>
50247 <literal>Escape character is &#x0027;^]&#x0027;.</literal>
50248 <literal>220 server.example ESMTP Exim 4.20 ...</literal>
50249 <emphasis role="bold"><literal>ehlo client.example</literal></emphasis>
50250 <literal>250-server.example Hello client.example [10.8.4.5]</literal>
50251 <literal>250-SIZE 52428800</literal>
50252 <literal>250-PIPELINING</literal>
50253 <literal>250-AUTH PLAIN</literal>
50254 <literal>250 HELP</literal>
50255 </literallayout>
50256 <para>
50257 The second-last line of this example output shows that the server supports
50258 authentication using the PLAIN mechanism. In Exim, the different authentication
50259 mechanisms are configured by specifying <emphasis>authenticator</emphasis> drivers. Like the
50260 routers and transports, which authenticators are included in the binary is
50261 controlled by build-time definitions. The following are currently available,
50262 included by setting
50263 </para>
50264 <literallayout class="monospaced">
50265 AUTH_CRAM_MD5=yes
50266 AUTH_CYRUS_SASL=yes
50267 AUTH_DOVECOT=yes
50268 AUTH_GSASL=yes
50269 AUTH_HEIMDAL_GSSAPI=yes
50270 AUTH_PLAINTEXT=yes
50271 AUTH_SPA=yes
50272 AUTH_TLS=yes
50273 </literallayout>
50274 <para>
50275 in <filename>Local/Makefile</filename>, respectively. The first of these supports the CRAM-MD5
50276 authentication mechanism (RFC 2195), and the second provides an interface to
50277 the Cyrus SASL authentication library.
50278 The third is an interface to Dovecot&#x2019;s authentication system, delegating the
50279 work via a socket interface.
50280 The fourth provides an interface to the GNU SASL authentication library, which
50281 provides mechanisms but typically not data sources.
50282 The fifth provides direct access to Heimdal GSSAPI, geared for Kerberos, but
50283 supporting setting a server keytab.
50284 The sixth can be configured to support
50285 the PLAIN authentication mechanism (RFC 2595) or the LOGIN mechanism, which is
50286 not formally documented, but used by several MUAs. The seventh authenticator
50287 supports Microsoft&#x2019;s <emphasis>Secure Password Authentication</emphasis> mechanism.
50288 The eighth is an Exim authenticator but not an SMTP one;
50289 instead it can use information from a TLS negotiation.
50290 </para>
50291 <para>
50292 The authenticators are configured using the same syntax as other drivers (see
50293 section <xref linkend="SECTfordricon"/>). If no authenticators are required, no
50294 authentication section need be present in the configuration file. Each
50295 authenticator can in principle have both server and client functions. When Exim
50296 is receiving SMTP mail, it is acting as a server; when it is sending out
50297 messages over SMTP, it is acting as a client. Authenticator configuration
50298 options are provided for use in both these circumstances.
50299 </para>
50300 <para>
50301 To make it clear which options apply to which situation, the prefixes
50302 <option>server_</option> and <option>client_</option> are used on option names that are specific to
50303 either the server or the client function, respectively. Server and client
50304 functions are disabled if none of their options are set. If an authenticator is
50305 to be used for both server and client functions, a single definition, using
50306 both sets of options, is required. For example:
50307 </para>
50308 <literallayout class="monospaced">
50309 cram:
50310   driver = cram_md5
50311   public_name = CRAM-MD5
50312   server_secret = ${if eq{$auth1}{ph10}{secret1}fail}
50313   client_name = ph10
50314   client_secret = secret2
50315 </literallayout>
50316 <para>
50317 The <option>server_</option> option is used when Exim is acting as a server, and the
50318 <option>client_</option> options when it is acting as a client.
50319 </para>
50320 <para>
50321 Descriptions of the individual authenticators are given in subsequent chapters.
50322 The remainder of this chapter covers the generic options for the
50323 authenticators, followed by general discussion of the way authentication works
50324 in Exim.
50325 </para>
50326 <para>
50327 <emphasis role="bold">Beware:</emphasis> the meaning of <varname>$auth1</varname>, <varname>$auth2</varname>, ... varies on a per-driver and
50328 per-mechanism basis.  Please read carefully to determine which variables hold
50329 account labels such as usercodes and which hold passwords or other
50330 authenticating data.
50331 </para>
50332 <para>
50333 Note that some mechanisms support two different identifiers for accounts: the
50334 <emphasis>authentication id</emphasis> and the <emphasis>authorization id</emphasis>.  The contractions <emphasis>authn</emphasis>
50335 and <emphasis>authz</emphasis> are commonly encountered.  The American spelling is standard here.
50336 Conceptually, authentication data such as passwords are tied to the identifier
50337 used to authenticate; servers may have rules to permit one user to act as a
50338 second user, so that after login the session is treated as though that second
50339 user had logged in.  That second user is the <emphasis>authorization id</emphasis>.  A robust
50340 configuration might confirm that the <emphasis>authz</emphasis> field is empty or matches the
50341 <emphasis>authn</emphasis> field.  Often this is just ignored.  The <emphasis>authn</emphasis> can be considered
50342 as verified data, the <emphasis>authz</emphasis> as an unverified request which the server might
50343 choose to honour.
50344 </para>
50345 <para>
50346 A <emphasis>realm</emphasis> is a text string, typically a domain name, presented by a server
50347 to a client to help it select an account and credentials to use.  In some
50348 mechanisms, the client and server provably agree on the realm, but clients
50349 typically can not treat the realm as secure data to be blindly trusted.
50350 </para>
50351 <section id="SECID168">
50352 <title>Generic options for authenticators</title>
50353 <para>
50354 <indexterm role="concept">
50355 <primary>authentication</primary>
50356 <secondary>generic options</secondary>
50357 </indexterm>
50358 <indexterm role="concept">
50359 <primary>options</primary>
50360 <secondary>generic; for authenticators</secondary>
50361 </indexterm>
50362 </para>
50363 <para>
50364 <indexterm role="option">
50365 <primary><option>client_condition</option></primary>
50366 </indexterm>
50367 </para>
50368 <informaltable frame="all">
50369 <tgroup cols="4" colsep="0" rowsep="0">
50370 <colspec colwidth="8*" align="left"/>
50371 <colspec colwidth="6*" align="center"/>
50372 <colspec colwidth="6*" align="center"/>
50373 <colspec colwidth="6*" align="right"/>
50374 <tbody>
50375 <row>
50376 <entry><option>client_condition</option></entry>
50377 <entry>Use: <emphasis>authenticators</emphasis></entry>
50378 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50379 <entry>Default: <emphasis>unset</emphasis></entry>
50380 </row>
50381 </tbody>
50382 </tgroup>
50383 </informaltable>
50384 <para>
50385 When Exim is authenticating as a client, it skips any authenticator whose
50386 <option>client_condition</option> expansion yields <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>. This can be
50387 used, for example, to skip plain text authenticators when the connection is not
50388 encrypted by a setting such as:
50389 </para>
50390 <literallayout class="monospaced">
50391 client_condition = ${if !eq{$tls_out_cipher}{}}
50392 </literallayout>
50393 <para>
50394 <indexterm role="option">
50395 <primary><option>client_set_id</option></primary>
50396 </indexterm>
50397 </para>
50398 <informaltable frame="all">
50399 <tgroup cols="4" colsep="0" rowsep="0">
50400 <colspec colwidth="8*" align="left"/>
50401 <colspec colwidth="6*" align="center"/>
50402 <colspec colwidth="6*" align="center"/>
50403 <colspec colwidth="6*" align="right"/>
50404 <tbody>
50405 <row>
50406 <entry><option>client_set_id</option></entry>
50407 <entry>Use: <emphasis>authenticators</emphasis></entry>
50408 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50409 <entry>Default: <emphasis>unset</emphasis></entry>
50410 </row>
50411 </tbody>
50412 </tgroup>
50413 </informaltable>
50414 <para>
50415 When client authentication succeeds, this condition is expanded; the
50416 result is used in the log lines for outbound messages.
50417 Typically it will be the user name used for authentication.
50418 </para>
50419 <para>
50420 <indexterm role="option">
50421 <primary><option>driver</option></primary>
50422 </indexterm>
50423 </para>
50424 <informaltable frame="all">
50425 <tgroup cols="4" colsep="0" rowsep="0">
50426 <colspec colwidth="8*" align="left"/>
50427 <colspec colwidth="6*" align="center"/>
50428 <colspec colwidth="6*" align="center"/>
50429 <colspec colwidth="6*" align="right"/>
50430 <tbody>
50431 <row>
50432 <entry><option>driver</option></entry>
50433 <entry>Use: <emphasis>authenticators</emphasis></entry>
50434 <entry>Type: <emphasis>string</emphasis></entry>
50435 <entry>Default: <emphasis>unset</emphasis></entry>
50436 </row>
50437 </tbody>
50438 </tgroup>
50439 </informaltable>
50440 <para>
50441 This option must always be set. It specifies which of the available
50442 authenticators is to be used.
50443 </para>
50444 <para>
50445 <indexterm role="option">
50446 <primary><option>public_name</option></primary>
50447 </indexterm>
50448 </para>
50449 <informaltable frame="all">
50450 <tgroup cols="4" colsep="0" rowsep="0">
50451 <colspec colwidth="8*" align="left"/>
50452 <colspec colwidth="6*" align="center"/>
50453 <colspec colwidth="6*" align="center"/>
50454 <colspec colwidth="6*" align="right"/>
50455 <tbody>
50456 <row>
50457 <entry><option>public_name</option></entry>
50458 <entry>Use: <emphasis>authenticators</emphasis></entry>
50459 <entry>Type: <emphasis>string</emphasis></entry>
50460 <entry>Default: <emphasis>unset</emphasis></entry>
50461 </row>
50462 </tbody>
50463 </tgroup>
50464 </informaltable>
50465 <para>
50466 This option specifies the name of the authentication mechanism that the driver
50467 implements, and by which it is known to the outside world. These names should
50468 contain only upper case letters, digits, underscores, and hyphens (RFC 2222),
50469 but Exim in fact matches them caselessly. If <option>public_name</option> is not set, it
50470 defaults to the driver&#x2019;s instance name.
50471 </para>
50472 <para>
50473 <indexterm role="option">
50474 <primary><option>server_advertise_condition</option></primary>
50475 </indexterm>
50476 </para>
50477 <informaltable frame="all">
50478 <tgroup cols="4" colsep="0" rowsep="0">
50479 <colspec colwidth="8*" align="left"/>
50480 <colspec colwidth="6*" align="center"/>
50481 <colspec colwidth="6*" align="center"/>
50482 <colspec colwidth="6*" align="right"/>
50483 <tbody>
50484 <row>
50485 <entry><option>server_advertise_condition</option></entry>
50486 <entry>Use: <emphasis>authenticators</emphasis></entry>
50487 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50488 <entry>Default: <emphasis>unset</emphasis></entry>
50489 </row>
50490 </tbody>
50491 </tgroup>
50492 </informaltable>
50493 <para>
50494 When a server is about to advertise an authentication mechanism, the condition
50495 is expanded. If it yields the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the
50496 mechanism is not advertised.
50497 If the expansion fails, the mechanism is not advertised. If the failure was not
50498 forced, and was not caused by a lookup defer, the incident is logged.
50499 See section <xref linkend="SECTauthexiser"/> below for further discussion.
50500 </para>
50501 <para>
50502 <indexterm role="option">
50503 <primary><option>server_condition</option></primary>
50504 </indexterm>
50505 </para>
50506 <informaltable frame="all">
50507 <tgroup cols="4" colsep="0" rowsep="0">
50508 <colspec colwidth="8*" align="left"/>
50509 <colspec colwidth="6*" align="center"/>
50510 <colspec colwidth="6*" align="center"/>
50511 <colspec colwidth="6*" align="right"/>
50512 <tbody>
50513 <row>
50514 <entry><option>server_condition</option></entry>
50515 <entry>Use: <emphasis>authenticators</emphasis></entry>
50516 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50517 <entry>Default: <emphasis>unset</emphasis></entry>
50518 </row>
50519 </tbody>
50520 </tgroup>
50521 </informaltable>
50522 <para>
50523 This option must be set for a <option>plaintext</option> server authenticator, where it
50524 is used directly to control authentication. See section <xref linkend="SECTplainserver"/>
50525 for details.
50526 </para>
50527 <para>
50528 For the <command>gsasl</command> authenticator, this option is required for various
50529 mechanisms; see chapter <xref linkend="CHAPgsasl"/> for details.
50530 </para>
50531 <para>
50532 For the other authenticators, <option>server_condition</option> can be used as an additional
50533 authentication or authorization mechanism that is applied after the other
50534 authenticator conditions succeed. If it is set, it is expanded when the
50535 authenticator would otherwise return a success code. If the expansion is forced
50536 to fail, authentication fails. Any other expansion failure causes a temporary
50537 error code to be returned. If the result of a successful expansion is an empty
50538 string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
50539 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds. For any
50540 other result, a temporary error code is returned, with the expanded string as
50541 the error text.
50542 </para>
50543 <para>
50544 <indexterm role="option">
50545 <primary><option>server_debug_print</option></primary>
50546 </indexterm>
50547 </para>
50548 <informaltable frame="all">
50549 <tgroup cols="4" colsep="0" rowsep="0">
50550 <colspec colwidth="8*" align="left"/>
50551 <colspec colwidth="6*" align="center"/>
50552 <colspec colwidth="6*" align="center"/>
50553 <colspec colwidth="6*" align="right"/>
50554 <tbody>
50555 <row>
50556 <entry><option>server_debug_print</option></entry>
50557 <entry>Use: <emphasis>authenticators</emphasis></entry>
50558 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50559 <entry>Default: <emphasis>unset</emphasis></entry>
50560 </row>
50561 </tbody>
50562 </tgroup>
50563 </informaltable>
50564 <para>
50565 If this option is set and authentication debugging is enabled (see the <option>-d</option>
50566 command line option), the string is expanded and included in the debugging
50567 output when the authenticator is run as a server. This can help with checking
50568 out the values of variables.
50569 If expansion of the string fails, the error message is written to the debugging
50570 output, and Exim carries on processing.
50571 </para>
50572 <para>
50573 <indexterm role="option">
50574 <primary><option>server_set_id</option></primary>
50575 </indexterm>
50576 </para>
50577 <informaltable frame="all">
50578 <tgroup cols="4" colsep="0" rowsep="0">
50579 <colspec colwidth="8*" align="left"/>
50580 <colspec colwidth="6*" align="center"/>
50581 <colspec colwidth="6*" align="center"/>
50582 <colspec colwidth="6*" align="right"/>
50583 <tbody>
50584 <row>
50585 <entry><option>server_set_id</option></entry>
50586 <entry>Use: <emphasis>authenticators</emphasis></entry>
50587 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50588 <entry>Default: <emphasis>unset</emphasis></entry>
50589 </row>
50590 </tbody>
50591 </tgroup>
50592 </informaltable>
50593 <para>
50594 <indexterm role="variable">
50595 <primary><varname>$authenticated_id</varname></primary>
50596 </indexterm>
50597 When an Exim server successfully authenticates a client, this string is
50598 expanded using data from the authentication, and preserved for any incoming
50599 messages in the variable <varname>$authenticated_id</varname>. It is also included in the log
50600 lines for incoming messages. For example, a user/password authenticator
50601 configuration might preserve the user name that was used to authenticate, and
50602 refer to it subsequently during delivery of the message.
50603 If expansion fails, the option is ignored.
50604 </para>
50605 <para>
50606 <indexterm role="option">
50607 <primary><option>server_mail_auth_condition</option></primary>
50608 </indexterm>
50609 </para>
50610 <informaltable frame="all">
50611 <tgroup cols="4" colsep="0" rowsep="0">
50612 <colspec colwidth="8*" align="left"/>
50613 <colspec colwidth="6*" align="center"/>
50614 <colspec colwidth="6*" align="center"/>
50615 <colspec colwidth="6*" align="right"/>
50616 <tbody>
50617 <row>
50618 <entry><option>server_mail_auth_condition</option></entry>
50619 <entry>Use: <emphasis>authenticators</emphasis></entry>
50620 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50621 <entry>Default: <emphasis>unset</emphasis></entry>
50622 </row>
50623 </tbody>
50624 </tgroup>
50625 </informaltable>
50626 <para>
50627 This option allows a server to discard authenticated sender addresses supplied
50628 as part of MAIL commands in SMTP connections that are authenticated by the
50629 driver on which <option>server_mail_auth_condition</option> is set. The option is not used
50630 as part of the authentication process; instead its (unexpanded) value is
50631 remembered for later use.
50632 How it is used is described in the following section.
50633 </para>
50634 </section>
50635 <section id="SECTauthparamail">
50636 <title>The AUTH parameter on MAIL commands</title>
50637 <para>
50638 <indexterm role="concept">
50639 <primary>authentication</primary>
50640 <secondary>sender; authenticated</secondary>
50641 </indexterm>
50642 <indexterm role="concept">
50643 <primary>AUTH</primary>
50644 <secondary>on MAIL command</secondary>
50645 </indexterm>
50646 When a client supplied an AUTH= item on a MAIL command, Exim applies
50647 the following checks before accepting it as the authenticated sender of the
50648 message:
50649 </para>
50650 <itemizedlist>
50651 <listitem>
50652 <para>
50653 If the connection is not using extended SMTP (that is, HELO was used rather
50654 than EHLO), the use of AUTH= is a syntax error.
50655 </para>
50656 </listitem>
50657 <listitem>
50658 <para>
50659 If the value of the AUTH= parameter is <quote>&lt;&gt;</quote>, it is ignored.
50660 </para>
50661 </listitem>
50662 <listitem>
50663 <para>
50664 <indexterm role="variable">
50665 <primary><varname>$authenticated_sender</varname></primary>
50666 </indexterm>
50667 If <option>acl_smtp_mailauth</option> is defined, the ACL it specifies is run. While it is
50668 running, the value of <varname>$authenticated_sender</varname> is set to the value obtained
50669 from the AUTH= parameter. If the ACL does not yield <quote>accept</quote>, the value of
50670 <varname>$authenticated_sender</varname> is deleted. The <option>acl_smtp_mailauth</option> ACL may not
50671 return <quote>drop</quote> or <quote>discard</quote>. If it defers, a temporary error code (451) is
50672 given for the MAIL command.
50673 </para>
50674 </listitem>
50675 <listitem>
50676 <para>
50677 If <option>acl_smtp_mailauth</option> is not defined, the value of the AUTH= parameter
50678 is accepted and placed in <varname>$authenticated_sender</varname> only if the client has
50679 authenticated.
50680 </para>
50681 </listitem>
50682 <listitem>
50683 <para>
50684 If the AUTH= value was accepted by either of the two previous rules, and
50685 the client has authenticated, and the authenticator has a setting for the
50686 <option>server_mail_auth_condition</option>, the condition is checked at this point. The
50687 valued that was saved from the authenticator is expanded. If the expansion
50688 fails, or yields an empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the value of
50689 <varname>$authenticated_sender</varname> is deleted. If the expansion yields any other value,
50690 the value of <varname>$authenticated_sender</varname> is retained and passed on with the
50691 message.
50692 </para>
50693 </listitem>
50694 </itemizedlist>
50695 <para>
50696 When <varname>$authenticated_sender</varname> is set for a message, it is passed on to other
50697 hosts to which Exim authenticates as a client. Do not confuse this value with
50698 <varname>$authenticated_id</varname>, which is a string obtained from the authentication
50699 process, and which is not usually a complete email address.
50700 </para>
50701 <para>
50702 <indexterm role="variable">
50703 <primary><varname>$sender_address</varname></primary>
50704 </indexterm>
50705 Whenever an AUTH= value is ignored, the incident is logged. The ACL for
50706 MAIL, if defined, is run after AUTH= is accepted or ignored. It can
50707 therefore make use of <varname>$authenticated_sender</varname>. The converse is not true: the
50708 value of <varname>$sender_address</varname> is not yet set up when the <option>acl_smtp_mailauth</option>
50709 ACL is run.
50710 </para>
50711 </section>
50712 <section id="SECTauthexiser">
50713 <title>Authentication on an Exim server</title>
50714 <para>
50715 <indexterm role="concept">
50716 <primary>authentication</primary>
50717 <secondary>on an Exim server</secondary>
50718 </indexterm>
50719 When Exim receives an EHLO command, it advertises the public names of those
50720 authenticators that are configured as servers, subject to the following
50721 conditions:
50722 </para>
50723 <itemizedlist>
50724 <listitem>
50725 <para>
50726 The client host must match <option>auth_advertise_hosts</option> (default *).
50727 </para>
50728 </listitem>
50729 <listitem>
50730 <para>
50731 It the <option>server_advertise_condition</option> option is set, its expansion must not
50732 yield the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>.
50733 </para>
50734 </listitem>
50735 </itemizedlist>
50736 <para>
50737 The order in which the authenticators are defined controls the order in which
50738 the mechanisms are advertised.
50739 </para>
50740 <para>
50741 Some mail clients (for example, some versions of Netscape) require the user to
50742 provide a name and password for authentication whenever AUTH is advertised,
50743 even though authentication may not in fact be needed (for example, Exim may be
50744 set up to allow unconditional relaying from the client by an IP address check).
50745 You can make such clients more friendly by not advertising AUTH to them.
50746 For example, if clients on the 10.9.8.0/24 network are permitted (by the ACL
50747 that runs for RCPT) to relay without authentication, you should set
50748 </para>
50749 <literallayout class="monospaced">
50750 auth_advertise_hosts = ! 10.9.8.0/24
50751 </literallayout>
50752 <para>
50753 so that no authentication mechanisms are advertised to them.
50754 </para>
50755 <para>
50756 The <option>server_advertise_condition</option> controls the advertisement of individual
50757 authentication mechanisms. For example, it can be used to restrict the
50758 advertisement of a particular mechanism to encrypted connections, by a setting
50759 such as:
50760 </para>
50761 <literallayout class="monospaced">
50762 server_advertise_condition = ${if eq{$tls_in_cipher}{}{no}{yes}}
50763 </literallayout>
50764 <para>
50765 <indexterm role="variable">
50766 <primary><varname>$tls_in_cipher</varname></primary>
50767 </indexterm>
50768 If the session is encrypted, <varname>$tls_in_cipher</varname> is not empty, and so the expansion
50769 yields <quote>yes</quote>, which allows the advertisement to happen.
50770 </para>
50771 <para>
50772 When an Exim server receives an AUTH command from a client, it rejects it
50773 immediately if AUTH was not advertised in response to an earlier EHLO
50774 command. This is the case if
50775 </para>
50776 <itemizedlist>
50777 <listitem>
50778 <para>
50779 The client host does not match <option>auth_advertise_hosts</option>; or
50780 </para>
50781 </listitem>
50782 <listitem>
50783 <para>
50784 No authenticators are configured with server options; or
50785 </para>
50786 </listitem>
50787 <listitem>
50788 <para>
50789 Expansion of <option>server_advertise_condition</option> blocked the advertising of all the
50790 server authenticators.
50791 </para>
50792 </listitem>
50793 </itemizedlist>
50794 <para>
50795 Otherwise, Exim runs the ACL specified by <option>acl_smtp_auth</option> in order
50796 to decide whether to accept the command. If <option>acl_smtp_auth</option> is not set,
50797 AUTH is accepted from any client host.
50798 </para>
50799 <para>
50800 If AUTH is not rejected by the ACL, Exim searches its configuration for a
50801 server authentication mechanism that was advertised in response to EHLO and
50802 that matches the one named in the AUTH command. If it finds one, it runs
50803 the appropriate authentication protocol, and authentication either succeeds or
50804 fails. If there is no matching advertised mechanism, the AUTH command is
50805 rejected with a 504 error.
50806 </para>
50807 <para>
50808 <indexterm role="variable">
50809 <primary><varname>$received_protocol</varname></primary>
50810 </indexterm>
50811 <indexterm role="variable">
50812 <primary><varname>$sender_host_authenticated</varname></primary>
50813 </indexterm>
50814 When a message is received from an authenticated host, the value of
50815 <varname>$received_protocol</varname> is set to <quote>esmtpa</quote> or <quote>esmtpsa</quote> instead of <quote>esmtp</quote>
50816 or <quote>esmtps</quote>, and <varname>$sender_host_authenticated</varname> contains the name (not the
50817 public name) of the authenticator driver that successfully authenticated the
50818 client from which the message was received. This variable is empty if there was
50819 no successful authentication.
50820 </para>
50821 </section>
50822 <section id="SECID169">
50823 <title>Testing server authentication</title>
50824 <para>
50825 <indexterm role="concept">
50826 <primary>authentication</primary>
50827 <secondary>testing a server</secondary>
50828 </indexterm>
50829 <indexterm role="concept">
50830 <primary>AUTH</primary>
50831 <secondary>testing a server</secondary>
50832 </indexterm>
50833 <indexterm role="concept">
50834 <primary>base64 encoding</primary>
50835 <secondary>creating authentication test data</secondary>
50836 </indexterm>
50837 Exim&#x2019;s <option>-bh</option> option can be useful for testing server authentication
50838 configurations. The data for the AUTH command has to be sent using base64
50839 encoding. A quick way to produce such data for testing is the following Perl
50840 script:
50841 </para>
50842 <literallayout class="monospaced">
50843 use MIME::Base64;
50844 printf ("%s", encode_base64(eval "\"$ARGV[0]\""));
50845 </literallayout>
50846 <para>
50847 <indexterm role="concept">
50848 <primary>binary zero</primary>
50849 <secondary>in authentication data</secondary>
50850 </indexterm>
50851 This interprets its argument as a Perl string, and then encodes it. The
50852 interpretation as a Perl string allows binary zeros, which are required for
50853 some kinds of authentication, to be included in the data. For example, a
50854 command line to run this script on such data might be
50855 </para>
50856 <literallayout class="monospaced">
50857 encode '\0user\0password'
50858 </literallayout>
50859 <para>
50860 Note the use of single quotes to prevent the shell interpreting the
50861 backslashes, so that they can be interpreted by Perl to specify characters
50862 whose code value is zero.
50863 </para>
50864 <para>
50865 <emphasis role="bold">Warning 1</emphasis>: If either of the user or password strings starts with an octal
50866 digit, you must use three zeros instead of one after the leading backslash. If
50867 you do not, the octal digit that starts your string will be incorrectly
50868 interpreted as part of the code for the first character.
50869 </para>
50870 <para>
50871 <emphasis role="bold">Warning 2</emphasis>: If there are characters in the strings that Perl interprets
50872 specially, you must use a Perl escape to prevent them being misinterpreted. For
50873 example, a command such as
50874 </para>
50875 <literallayout class="monospaced">
50876 encode '\0user@domain.com\0pas$$word'
50877 </literallayout>
50878 <para>
50879 gives an incorrect answer because of the unescaped <quote>@</quote> and <quote>$</quote> characters.
50880 </para>
50881 <para>
50882 If you have the <option>mimencode</option> command installed, another way to do produce
50883 base64-encoded strings is to run the command
50884 </para>
50885 <literallayout class="monospaced">
50886 echo -e -n `\0user\0password' | mimencode
50887 </literallayout>
50888 <para>
50889 The <option>-e</option> option of <option>echo</option> enables the interpretation of backslash escapes
50890 in the argument, and the <option>-n</option> option specifies no newline at the end of its
50891 output. However, not all versions of <option>echo</option> recognize these options, so you
50892 should check your version before relying on this suggestion.
50893 </para>
50894 </section>
50895 <section id="SECID170">
50896 <title>Authentication by an Exim client</title>
50897 <para>
50898 <indexterm role="concept">
50899 <primary>authentication</primary>
50900 <secondary>on an Exim client</secondary>
50901 </indexterm>
50902 The <command>smtp</command> transport has two options called <option>hosts_require_auth</option> and
50903 <option>hosts_try_auth</option>. When the <command>smtp</command> transport connects to a server that
50904 announces support for authentication, and the host matches an entry in either
50905 of these options, Exim (as a client) tries to authenticate as follows:
50906 </para>
50907 <itemizedlist>
50908 <listitem>
50909 <para>
50910 For each authenticator that is configured as a client, in the order in which
50911 they are defined in the configuration, it searches the authentication
50912 mechanisms announced by the server for one whose name matches the public name
50913 of the authenticator.
50914 </para>
50915 </listitem>
50916 <listitem>
50917 <para>
50918 <indexterm role="variable">
50919 <primary><varname>$host</varname></primary>
50920 </indexterm>
50921 <indexterm role="variable">
50922 <primary><varname>$host_address</varname></primary>
50923 </indexterm>
50924 When it finds one that matches, it runs the authenticator&#x2019;s client code. The
50925 variables <varname>$host</varname> and <varname>$host_address</varname> are available for any string expansions
50926 that the client might do. They are set to the server&#x2019;s name and IP address. If
50927 any expansion is forced to fail, the authentication attempt is abandoned, and
50928 Exim moves on to the next authenticator. Otherwise an expansion failure causes
50929 delivery to be deferred.
50930 </para>
50931 </listitem>
50932 <listitem>
50933 <para>
50934 If the result of the authentication attempt is a temporary error or a timeout,
50935 Exim abandons trying to send the message to the host for the moment. It will
50936 try again later. If there are any backup hosts available, they are tried in the
50937 usual way.
50938 </para>
50939 </listitem>
50940 <listitem>
50941 <para>
50942 If the response to authentication is a permanent error (5<emphasis>xx</emphasis> code), Exim
50943 carries on searching the list of authenticators and tries another one if
50944 possible. If all authentication attempts give permanent errors, or if there are
50945 no attempts because no mechanisms match (or option expansions force failure),
50946 what happens depends on whether the host matches <option>hosts_require_auth</option> or
50947 <option>hosts_try_auth</option>. In the first case, a temporary error is generated, and
50948 delivery is deferred. The error can be detected in the retry rules, and thereby
50949 turned into a permanent error if you wish. In the second case, Exim tries to
50950 deliver the message unauthenticated.
50951 </para>
50952 </listitem>
50953 </itemizedlist>
50954 <para>
50955 Note that the hostlist test for whether to do authentication can be
50956 confused if name-IP lookups change between the time the peer is decided
50957 on and the transport running.  For example, with a manualroute
50958 router given a host name, and DNS "round-robin" use by that name: if
50959 the local resolver cache times out between the router and the transport
50960 running, the transport may get an IP for the name for its authentication
50961 check which does not match the connection peer IP.
50962 No authentication will then be done, despite the names being identical.
50963 </para>
50964 <para>
50965 For such cases use a separate transport which always authenticates.
50966 </para>
50967 <para>
50968 <indexterm role="concept">
50969 <primary>AUTH</primary>
50970 <secondary>on MAIL command</secondary>
50971 </indexterm>
50972 When Exim has authenticated itself to a remote server, it adds the AUTH
50973 parameter to the MAIL commands it sends, if it has an authenticated sender for
50974 the message. If the message came from a remote host, the authenticated sender
50975 is the one that was receiving on an incoming MAIL command, provided that the
50976 incoming connection was authenticated and the <option>server_mail_auth</option> condition
50977 allowed the authenticated sender to be retained. If a local process calls Exim
50978 to send a message, the sender address that is built from the login name and
50979 <option>qualify_domain</option> is treated as authenticated. However, if the
50980 <option>authenticated_sender</option> option is set on the <command>smtp</command> transport, it overrides
50981 the authenticated sender that was received with the message.
50982 <indexterm role="concept" startref="IIDauthconf1" class="endofrange"/>
50983 <indexterm role="concept" startref="IIDauthconf2" class="endofrange"/>
50984 </para>
50985 </section>
50986 </chapter>
50987
50988 <chapter id="CHAPplaintext">
50989 <title>The plaintext authenticator</title>
50990 <para>
50991 <indexterm role="concept" id="IIDplaiauth1" class="startofrange">
50992 <primary><command>plaintext</command> authenticator</primary>
50993 </indexterm>
50994 <indexterm role="concept" id="IIDplaiauth2" class="startofrange">
50995 <primary>authenticators</primary>
50996 <secondary><command>plaintext</command></secondary>
50997 </indexterm>
50998 The <command>plaintext</command> authenticator can be configured to support the PLAIN and
50999 LOGIN authentication mechanisms, both of which transfer authentication data as
51000 plain (unencrypted) text (though base64 encoded). The use of plain text is a
51001 security risk; you are strongly advised to insist on the use of SMTP encryption
51002 (see chapter <xref linkend="CHAPTLS"/>) if you use the PLAIN or LOGIN mechanisms. If you do
51003 use unencrypted plain text, you should not use the same passwords for SMTP
51004 connections as you do for login accounts.
51005 </para>
51006 <section id="SECID171">
51007 <title>Plaintext options</title>
51008 <para>
51009 <indexterm role="concept">
51010 <primary>options</primary>
51011 <secondary><command>plaintext</command> authenticator (server)</secondary>
51012 </indexterm>
51013 When configured as a server, <command>plaintext</command> uses the following options:
51014 </para>
51015 <para>
51016 <indexterm role="option">
51017 <primary><option>server_condition</option></primary>
51018 </indexterm>
51019 </para>
51020 <informaltable frame="all">
51021 <tgroup cols="4" colsep="0" rowsep="0">
51022 <colspec colwidth="8*" align="left"/>
51023 <colspec colwidth="6*" align="center"/>
51024 <colspec colwidth="6*" align="center"/>
51025 <colspec colwidth="6*" align="right"/>
51026 <tbody>
51027 <row>
51028 <entry><option>server_condition</option></entry>
51029 <entry>Use: <emphasis>authenticators</emphasis></entry>
51030 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51031 <entry>Default: <emphasis>unset</emphasis></entry>
51032 </row>
51033 </tbody>
51034 </tgroup>
51035 </informaltable>
51036 <para>
51037 This is actually a global authentication option, but it must be set in order to
51038 configure the <command>plaintext</command> driver as a server. Its use is described below.
51039 </para>
51040 <para>
51041 <indexterm role="option">
51042 <primary><option>server_prompts</option></primary>
51043 </indexterm>
51044 </para>
51045 <informaltable frame="all">
51046 <tgroup cols="4" colsep="0" rowsep="0">
51047 <colspec colwidth="8*" align="left"/>
51048 <colspec colwidth="6*" align="center"/>
51049 <colspec colwidth="6*" align="center"/>
51050 <colspec colwidth="6*" align="right"/>
51051 <tbody>
51052 <row>
51053 <entry><option>server_prompts</option></entry>
51054 <entry>Use: <emphasis>plaintext</emphasis></entry>
51055 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51056 <entry>Default: <emphasis>unset</emphasis></entry>
51057 </row>
51058 </tbody>
51059 </tgroup>
51060 </informaltable>
51061 <para>
51062 The contents of this option, after expansion, must be a colon-separated list of
51063 prompt strings. If expansion fails, a temporary authentication rejection is
51064 given.
51065 </para>
51066 </section>
51067 <section id="SECTplainserver">
51068 <title>Using plaintext in a server</title>
51069 <para>
51070 <indexterm role="concept">
51071 <primary>AUTH</primary>
51072 <secondary>in <command>plaintext</command> authenticator</secondary>
51073 </indexterm>
51074 <indexterm role="concept">
51075 <primary>binary zero</primary>
51076 <secondary>in <command>plaintext</command> authenticator</secondary>
51077 </indexterm>
51078 <indexterm role="concept">
51079 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
51080 <secondary>in <command>plaintext</command> authenticator</secondary>
51081 </indexterm>
51082 <indexterm role="variable">
51083 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
51084 </indexterm>
51085 <indexterm role="concept">
51086 <primary>base64 encoding</primary>
51087 <secondary>in <command>plaintext</command> authenticator</secondary>
51088 </indexterm>
51089 </para>
51090 <para>
51091 When running as a server, <command>plaintext</command> performs the authentication test by
51092 expanding a string. The data sent by the client with the AUTH command, or in
51093 response to subsequent prompts, is base64 encoded, and so may contain any byte
51094 values when decoded. If any data is supplied with the command, it is treated as
51095 a list of strings, separated by NULs (binary zeros), the first three of which
51096 are placed in the expansion variables <varname>$auth1</varname>, <varname>$auth2</varname>, and <varname>$auth3</varname>
51097 (neither LOGIN nor PLAIN uses more than three strings).
51098 </para>
51099 <para>
51100 For compatibility with previous releases of Exim, the values are also placed in
51101 the expansion variables <varname>$1</varname>, <varname>$2</varname>, and <varname>$3</varname>. However, the use of these
51102 variables for this purpose is now deprecated, as it can lead to confusion in
51103 string expansions that also use them for other things.
51104 </para>
51105 <para>
51106 If there are more strings in <option>server_prompts</option> than the number of strings
51107 supplied with the AUTH command, the remaining prompts are used to obtain more
51108 data. Each response from the client may be a list of NUL-separated strings.
51109 </para>
51110 <para>
51111 <indexterm role="variable">
51112 <primary><varname>$authenticated_id</varname></primary>
51113 </indexterm>
51114 Once a sufficient number of data strings have been received,
51115 <option>server_condition</option> is expanded. If the expansion is forced to fail,
51116 authentication fails. Any other expansion failure causes a temporary error code
51117 to be returned. If the result of a successful expansion is an empty string,
51118 <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
51119 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds and the
51120 generic <option>server_set_id</option> option is expanded and saved in <varname>$authenticated_id</varname>.
51121 For any other result, a temporary error code is returned, with the expanded
51122 string as the error text
51123 </para>
51124 <para>
51125 <emphasis role="bold">Warning</emphasis>: If you use a lookup in the expansion to find the user&#x2019;s
51126 password, be sure to make the authentication fail if the user is unknown.
51127 There are good and bad examples at the end of the next section.
51128 </para>
51129 </section>
51130 <section id="SECID172">
51131 <title>The PLAIN authentication mechanism</title>
51132 <para>
51133 <indexterm role="concept">
51134 <primary>PLAIN authentication mechanism</primary>
51135 </indexterm>
51136 <indexterm role="concept">
51137 <primary>authentication</primary>
51138 <secondary>PLAIN mechanism</secondary>
51139 </indexterm>
51140 <indexterm role="concept">
51141 <primary>binary zero</primary>
51142 <secondary>in <command>plaintext</command> authenticator</secondary>
51143 </indexterm>
51144 The PLAIN authentication mechanism (RFC 2595) specifies that three strings be
51145 sent as one item of data (that is, one combined string containing two NUL
51146 separators). The data is sent either as part of the AUTH command, or
51147 subsequently in response to an empty prompt from the server.
51148 </para>
51149 <para>
51150 The second and third strings are a user name and a corresponding password.
51151 Using a single fixed user name and password as an example, this could be
51152 configured as follows:
51153 </para>
51154 <literallayout class="monospaced">
51155 fixed_plain:
51156   driver = plaintext
51157   public_name = PLAIN
51158   server_prompts = :
51159   server_condition = \
51160     ${if and {{eq{$auth2}{username}}{eq{$auth3}{mysecret}}}}
51161   server_set_id = $auth2
51162 </literallayout>
51163 <para>
51164 Note that the default result strings from <option>if</option> (<quote>true</quote> or an empty string)
51165 are exactly what we want here, so they need not be specified. Obviously, if the
51166 password contains expansion-significant characters such as dollar, backslash,
51167 or closing brace, they have to be escaped.
51168 </para>
51169 <para>
51170 The <option>server_prompts</option> setting specifies a single, empty prompt (empty items at
51171 the end of a string list are ignored). If all the data comes as part of the
51172 AUTH command, as is commonly the case, the prompt is not used. This
51173 authenticator is advertised in the response to EHLO as
51174 </para>
51175 <literallayout class="monospaced">
51176 250-AUTH PLAIN
51177 </literallayout>
51178 <para>
51179 and a client host can authenticate itself by sending the command
51180 </para>
51181 <literallayout class="monospaced">
51182 AUTH PLAIN AHVzZXJuYW1lAG15c2VjcmV0
51183 </literallayout>
51184 <para>
51185 As this contains three strings (more than the number of prompts), no further
51186 data is required from the client. Alternatively, the client may just send
51187 </para>
51188 <literallayout class="monospaced">
51189 AUTH PLAIN
51190 </literallayout>
51191 <para>
51192 to initiate authentication, in which case the server replies with an empty
51193 prompt. The client must respond with the combined data string.
51194 </para>
51195 <para>
51196 The data string is base64 encoded, as required by the RFC. This example,
51197 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;
51198 represents a zero byte. This is split up into three strings, the first of which
51199 is empty. The <option>server_condition</option> option in the authenticator checks that the
51200 second two are <literal>username</literal> and <literal>mysecret</literal> respectively.
51201 </para>
51202 <para>
51203 Having just one fixed user name and password, as in this example, is not very
51204 realistic, though for a small organization with only a handful of
51205 authenticating clients it could make sense.
51206 </para>
51207 <para>
51208 A more sophisticated instance of this authenticator could use the user name in
51209 <varname>$auth2</varname> to look up a password in a file or database, and maybe do an encrypted
51210 comparison (see <option>crypteq</option> in chapter <xref linkend="CHAPexpand"/>). Here is a example of
51211 this approach, where the passwords are looked up in a DBM file. <emphasis role="bold">Warning</emphasis>:
51212 This is an incorrect example:
51213 </para>
51214 <literallayout class="monospaced">
51215 server_condition = \
51216   ${if eq{$auth3}{${lookup{$auth2}dbm{/etc/authpwd}}}}
51217 </literallayout>
51218 <para>
51219 The expansion uses the user name (<varname>$auth2</varname>) as the key to look up a password,
51220 which it then compares to the supplied password (<varname>$auth3</varname>). Why is this example
51221 incorrect? It works fine for existing users, but consider what happens if a
51222 non-existent user name is given. The lookup fails, but as no success/failure
51223 strings are given for the lookup, it yields an empty string. Thus, to defeat
51224 the authentication, all a client has to do is to supply a non-existent user
51225 name and an empty password. The correct way of writing this test is:
51226 </para>
51227 <literallayout class="monospaced">
51228 server_condition = ${lookup{$auth2}dbm{/etc/authpwd}\
51229   {${if eq{$value}{$auth3}}} {false}}
51230 </literallayout>
51231 <para>
51232 In this case, if the lookup succeeds, the result is checked; if the lookup
51233 fails, <quote>false</quote> is returned and authentication fails. If <option>crypteq</option> is being
51234 used instead of <option>eq</option>, the first example is in fact safe, because <option>crypteq</option>
51235 always fails if its second argument is empty. However, the second way of
51236 writing the test makes the logic clearer.
51237 </para>
51238 </section>
51239 <section id="SECID173">
51240 <title>The LOGIN authentication mechanism</title>
51241 <para>
51242 <indexterm role="concept">
51243 <primary>LOGIN authentication mechanism</primary>
51244 </indexterm>
51245 <indexterm role="concept">
51246 <primary>authentication</primary>
51247 <secondary>LOGIN mechanism</secondary>
51248 </indexterm>
51249 The LOGIN authentication mechanism is not documented in any RFC, but is in use
51250 in a number of programs. No data is sent with the AUTH command. Instead, a
51251 user name and password are supplied separately, in response to prompts. The
51252 plaintext authenticator can be configured to support this as in this example:
51253 </para>
51254 <literallayout class="monospaced">
51255 fixed_login:
51256   driver = plaintext
51257   public_name = LOGIN
51258   server_prompts = User Name : Password
51259   server_condition = \
51260     ${if and {{eq{$auth1}{username}}{eq{$auth2}{mysecret}}}}
51261   server_set_id = $auth1
51262 </literallayout>
51263 <para>
51264 Because of the way plaintext operates, this authenticator accepts data supplied
51265 with the AUTH command (in contravention of the specification of LOGIN), but
51266 if the client does not supply it (as is the case for LOGIN clients), the prompt
51267 strings are used to obtain two data items.
51268 </para>
51269 <para>
51270 Some clients are very particular about the precise text of the prompts. For
51271 example, Outlook Express is reported to recognize only <quote>Username:</quote> and
51272 <quote>Password:</quote>. Here is an example of a LOGIN authenticator that uses those
51273 strings. It uses the <option>ldapauth</option> expansion condition to check the user
51274 name and password by binding to an LDAP server:
51275 </para>
51276 <literallayout class="monospaced">
51277 login:
51278   driver = plaintext
51279   public_name = LOGIN
51280   server_prompts = Username:: : Password::
51281   server_condition = ${if and{{ \
51282     !eq{}{$auth1} }{ \
51283     ldapauth{\
51284       user="uid=${quote_ldap_dn:$auth1},ou=people,o=example.org" \
51285       pass=${quote:$auth2} \
51286       ldap://ldap.example.org/} }} }
51287   server_set_id = uid=$auth1,ou=people,o=example.org
51288 </literallayout>
51289 <para>
51290 We have to check that the username is not empty before using it, because LDAP
51291 does not permit empty DN components. We must also use the <option>quote_ldap_dn</option>
51292 operator to correctly quote the DN for authentication. However, the basic
51293 <option>quote</option> operator, rather than any of the LDAP quoting operators, is the
51294 correct one to use for the password, because quoting is needed only to make
51295 the password conform to the Exim syntax. At the LDAP level, the password is an
51296 uninterpreted string.
51297 </para>
51298 </section>
51299 <section id="SECID174">
51300 <title>Support for different kinds of authentication</title>
51301 <para>
51302 A number of string expansion features are provided for the purpose of
51303 interfacing to different ways of user authentication. These include checking
51304 traditionally encrypted passwords from <filename>/etc/passwd</filename> (or equivalent), PAM,
51305 Radius, <option>ldapauth</option>, <emphasis>pwcheck</emphasis>, and <emphasis>saslauthd</emphasis>. For details see section
51306 <xref linkend="SECTexpcond"/>.
51307 </para>
51308 </section>
51309 <section id="SECID175">
51310 <title>Using plaintext in a client</title>
51311 <para>
51312 <indexterm role="concept">
51313 <primary>options</primary>
51314 <secondary><command>plaintext</command> authenticator (client)</secondary>
51315 </indexterm>
51316 The <command>plaintext</command> authenticator has two client options:
51317 </para>
51318 <para>
51319 <indexterm role="option">
51320 <primary><option>client_ignore_invalid_base64</option></primary>
51321 </indexterm>
51322 </para>
51323 <informaltable frame="all">
51324 <tgroup cols="4" colsep="0" rowsep="0">
51325 <colspec colwidth="8*" align="left"/>
51326 <colspec colwidth="6*" align="center"/>
51327 <colspec colwidth="6*" align="center"/>
51328 <colspec colwidth="6*" align="right"/>
51329 <tbody>
51330 <row>
51331 <entry><option>client_ignore_invalid_base64</option></entry>
51332 <entry>Use: <emphasis>plaintext</emphasis></entry>
51333 <entry>Type: <emphasis>boolean</emphasis></entry>
51334 <entry>Default: <emphasis>false</emphasis></entry>
51335 </row>
51336 </tbody>
51337 </tgroup>
51338 </informaltable>
51339 <para>
51340 If the client receives a server prompt that is not a valid base64 string,
51341 authentication is abandoned by default. However, if this option is set true,
51342 the error in the challenge is ignored and the client sends the response as
51343 usual.
51344 </para>
51345 <para>
51346 <indexterm role="option">
51347 <primary><option>client_send</option></primary>
51348 </indexterm>
51349 </para>
51350 <informaltable frame="all">
51351 <tgroup cols="4" colsep="0" rowsep="0">
51352 <colspec colwidth="8*" align="left"/>
51353 <colspec colwidth="6*" align="center"/>
51354 <colspec colwidth="6*" align="center"/>
51355 <colspec colwidth="6*" align="right"/>
51356 <tbody>
51357 <row>
51358 <entry><option>client_send</option></entry>
51359 <entry>Use: <emphasis>plaintext</emphasis></entry>
51360 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51361 <entry>Default: <emphasis>unset</emphasis></entry>
51362 </row>
51363 </tbody>
51364 </tgroup>
51365 </informaltable>
51366 <para>
51367 The string is a colon-separated list of authentication data strings. Each
51368 string is independently expanded before being sent to the server. The first
51369 string is sent with the AUTH command; any more strings are sent in response
51370 to prompts from the server. Before each string is expanded, the value of the
51371 most recent prompt is placed in the next <varname>$auth</varname>&lt;<emphasis>n</emphasis>&gt; variable, starting
51372 with <varname>$auth1</varname> for the first prompt. Up to three prompts are stored in this
51373 way. Thus, the prompt that is received in response to sending the first string
51374 (with the AUTH command) can be used in the expansion of the second string, and
51375 so on. If an invalid base64 string is received when
51376 <option>client_ignore_invalid_base64</option> is set, an empty string is put in the
51377 <varname>$auth</varname>&lt;<emphasis>n</emphasis>&gt; variable.
51378 </para>
51379 <para>
51380 <emphasis role="bold">Note</emphasis>: You cannot use expansion to create multiple strings, because
51381 splitting takes priority and happens first.
51382 </para>
51383 <para>
51384 Because the PLAIN authentication mechanism requires NUL (binary zero) bytes in
51385 the data, further processing is applied to each string before it is sent. If
51386 there are any single circumflex characters in the string, they are converted to
51387 NULs. Should an actual circumflex be required as data, it must be doubled in
51388 the string.
51389 </para>
51390 <para>
51391 This is an example of a client configuration that implements the PLAIN
51392 authentication mechanism with a fixed user name and password:
51393 </para>
51394 <literallayout class="monospaced">
51395 fixed_plain:
51396   driver = plaintext
51397   public_name = PLAIN
51398   client_send = ^username^mysecret
51399 </literallayout>
51400 <para>
51401 The lack of colons means that the entire text is sent with the AUTH
51402 command, with the circumflex characters converted to NULs. A similar example
51403 that uses the LOGIN mechanism is:
51404 </para>
51405 <literallayout class="monospaced">
51406 fixed_login:
51407   driver = plaintext
51408   public_name = LOGIN
51409   client_send = : username : mysecret
51410 </literallayout>
51411 <para>
51412 The initial colon means that the first string is empty, so no data is sent with
51413 the AUTH command itself. The remaining strings are sent in response to
51414 prompts.
51415 <indexterm role="concept" startref="IIDplaiauth1" class="endofrange"/>
51416 <indexterm role="concept" startref="IIDplaiauth2" class="endofrange"/>
51417 </para>
51418 </section>
51419 </chapter>
51420
51421 <chapter id="CHID9">
51422 <title>The cram_md5 authenticator</title>
51423 <para>
51424 <indexterm role="concept" id="IIDcramauth1" class="startofrange">
51425 <primary><command>cram_md5</command> authenticator</primary>
51426 </indexterm>
51427 <indexterm role="concept" id="IIDcramauth2" class="startofrange">
51428 <primary>authenticators</primary>
51429 <secondary><command>cram_md5</command></secondary>
51430 </indexterm>
51431 <indexterm role="concept">
51432 <primary>CRAM-MD5 authentication mechanism</primary>
51433 </indexterm>
51434 <indexterm role="concept">
51435 <primary>authentication</primary>
51436 <secondary>CRAM-MD5 mechanism</secondary>
51437 </indexterm>
51438 The CRAM-MD5 authentication mechanism is described in RFC 2195. The server
51439 sends a challenge string to the client, and the response consists of a user
51440 name and the CRAM-MD5 digest of the challenge string combined with a secret
51441 string (password) which is known to both server and client. Thus, the secret
51442 is not sent over the network as plain text, which makes this authenticator more
51443 secure than <command>plaintext</command>. However, the downside is that the secret has to be
51444 available in plain text at either end.
51445 </para>
51446 <section id="SECID176">
51447 <title>Using cram_md5 as a server</title>
51448 <para>
51449 <indexterm role="concept">
51450 <primary>options</primary>
51451 <secondary><command>cram_md5</command> authenticator (server)</secondary>
51452 </indexterm>
51453 This authenticator has one server option, which must be set to configure the
51454 authenticator as a server:
51455 </para>
51456 <para>
51457 <indexterm role="option">
51458 <primary><option>server_secret</option></primary>
51459 </indexterm>
51460 </para>
51461 <informaltable frame="all">
51462 <tgroup cols="4" colsep="0" rowsep="0">
51463 <colspec colwidth="8*" align="left"/>
51464 <colspec colwidth="6*" align="center"/>
51465 <colspec colwidth="6*" align="center"/>
51466 <colspec colwidth="6*" align="right"/>
51467 <tbody>
51468 <row>
51469 <entry><option>server_secret</option></entry>
51470 <entry>Use: <emphasis>cram_md5</emphasis></entry>
51471 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51472 <entry>Default: <emphasis>unset</emphasis></entry>
51473 </row>
51474 </tbody>
51475 </tgroup>
51476 </informaltable>
51477 <para>
51478 <indexterm role="concept">
51479 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
51480 <secondary>in <command>cram_md5</command> authenticator</secondary>
51481 </indexterm>
51482 When the server receives the client&#x2019;s response, the user name is placed in
51483 the expansion variable <varname>$auth1</varname>, and <option>server_secret</option> is expanded to
51484 obtain the password for that user. The server then computes the CRAM-MD5 digest
51485 that the client should have sent, and checks that it received the correct
51486 string. If the expansion of <option>server_secret</option> is forced to fail, authentication
51487 fails. If the expansion fails for some other reason, a temporary error code is
51488 returned to the client.
51489 </para>
51490 <para>
51491 For compatibility with previous releases of Exim, the user name is also placed
51492 in <varname>$1</varname>. However, the use of this variables for this purpose is now
51493 deprecated, as it can lead to confusion in string expansions that also use
51494 numeric variables for other things.
51495 </para>
51496 <para>
51497 For example, the following authenticator checks that the user name given by the
51498 client is <quote>ph10</quote>, and if so, uses <quote>secret</quote> as the password. For any other
51499 user name, authentication fails.
51500 </para>
51501 <literallayout class="monospaced">
51502 fixed_cram:
51503   driver = cram_md5
51504   public_name = CRAM-MD5
51505   server_secret = ${if eq{$auth1}{ph10}{secret}fail}
51506   server_set_id = $auth1
51507 </literallayout>
51508 <para>
51509 <indexterm role="variable">
51510 <primary><varname>$authenticated_id</varname></primary>
51511 </indexterm>
51512 If authentication succeeds, the setting of <option>server_set_id</option> preserves the user
51513 name in <varname>$authenticated_id</varname>. A more typical configuration might look up the
51514 secret string in a file, using the user name as the key. For example:
51515 </para>
51516 <literallayout class="monospaced">
51517 lookup_cram:
51518   driver = cram_md5
51519   public_name = CRAM-MD5
51520   server_secret = ${lookup{$auth1}lsearch{/etc/authpwd}\
51521                   {$value}fail}
51522   server_set_id = $auth1
51523 </literallayout>
51524 <para>
51525 Note that this expansion explicitly forces failure if the lookup fails
51526 because <varname>$auth1</varname> contains an unknown user name.
51527 </para>
51528 <para>
51529 As another example, if you wish to re-use a Cyrus SASL sasldb2 file without
51530 using the relevant libraries, you need to know the realm to specify in the
51531 lookup and then ask for the <quote>userPassword</quote> attribute for that user in that
51532 realm, with:
51533 </para>
51534 <literallayout class="monospaced">
51535 cyrusless_crammd5:
51536   driver = cram_md5
51537   public_name = CRAM-MD5
51538   server_secret = ${lookup{$auth1:mail.example.org:userPassword}\
51539                   dbmjz{/etc/sasldb2}{$value}fail}
51540   server_set_id = $auth1
51541 </literallayout>
51542 </section>
51543 <section id="SECID177">
51544 <title>Using cram_md5 as a client</title>
51545 <para>
51546 <indexterm role="concept">
51547 <primary>options</primary>
51548 <secondary><command>cram_md5</command> authenticator (client)</secondary>
51549 </indexterm>
51550 When used as a client, the <command>cram_md5</command> authenticator has two options:
51551 </para>
51552 <para>
51553 <indexterm role="option">
51554 <primary><option>client_name</option></primary>
51555 </indexterm>
51556 </para>
51557 <informaltable frame="all">
51558 <tgroup cols="4" colsep="0" rowsep="0">
51559 <colspec colwidth="8*" align="left"/>
51560 <colspec colwidth="6*" align="center"/>
51561 <colspec colwidth="6*" align="center"/>
51562 <colspec colwidth="6*" align="right"/>
51563 <tbody>
51564 <row>
51565 <entry><option>client_name</option></entry>
51566 <entry>Use: <emphasis>cram_md5</emphasis></entry>
51567 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51568 <entry>Default: <emphasis>the primary host name</emphasis></entry>
51569 </row>
51570 </tbody>
51571 </tgroup>
51572 </informaltable>
51573 <para>
51574 This string is expanded, and the result used as the user name data when
51575 computing the response to the server&#x2019;s challenge.
51576 </para>
51577 <para>
51578 <indexterm role="option">
51579 <primary><option>client_secret</option></primary>
51580 </indexterm>
51581 </para>
51582 <informaltable frame="all">
51583 <tgroup cols="4" colsep="0" rowsep="0">
51584 <colspec colwidth="8*" align="left"/>
51585 <colspec colwidth="6*" align="center"/>
51586 <colspec colwidth="6*" align="center"/>
51587 <colspec colwidth="6*" align="right"/>
51588 <tbody>
51589 <row>
51590 <entry><option>client_secret</option></entry>
51591 <entry>Use: <emphasis>cram_md5</emphasis></entry>
51592 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51593 <entry>Default: <emphasis>unset</emphasis></entry>
51594 </row>
51595 </tbody>
51596 </tgroup>
51597 </informaltable>
51598 <para>
51599 This option must be set for the authenticator to work as a client. Its value is
51600 expanded and the result used as the secret string when computing the response.
51601 </para>
51602 <para>
51603 <indexterm role="variable">
51604 <primary><varname>$host</varname></primary>
51605 </indexterm>
51606 <indexterm role="variable">
51607 <primary><varname>$host_address</varname></primary>
51608 </indexterm>
51609 Different user names and secrets can be used for different servers by referring
51610 to <varname>$host</varname> or <varname>$host_address</varname> in the options. Forced failure of either
51611 expansion string is treated as an indication that this authenticator is not
51612 prepared to handle this case. Exim moves on to the next configured client
51613 authenticator. Any other expansion failure causes Exim to give up trying to
51614 send the message to the current server.
51615 </para>
51616 <para>
51617 A simple example configuration of a <command>cram_md5</command> authenticator, using fixed
51618 strings, is:
51619 </para>
51620 <literallayout class="monospaced">
51621 fixed_cram:
51622   driver = cram_md5
51623   public_name = CRAM-MD5
51624   client_name = ph10
51625   client_secret = secret
51626 </literallayout>
51627 <para>
51628 <indexterm role="concept" startref="IIDcramauth1" class="endofrange"/>
51629 <indexterm role="concept" startref="IIDcramauth2" class="endofrange"/>
51630 </para>
51631 </section>
51632 </chapter>
51633
51634 <chapter id="CHID10">
51635 <title>The cyrus_sasl authenticator</title>
51636 <para>
51637 <indexterm role="concept" id="IIDcyrauth1" class="startofrange">
51638 <primary><command>cyrus_sasl</command> authenticator</primary>
51639 </indexterm>
51640 <indexterm role="concept" id="IIDcyrauth2" class="startofrange">
51641 <primary>authenticators</primary>
51642 <secondary><command>cyrus_sasl</command></secondary>
51643 </indexterm>
51644 <indexterm role="concept">
51645 <primary>Cyrus</primary>
51646 <secondary>SASL library</secondary>
51647 </indexterm>
51648 <indexterm role="concept">
51649 <primary>Kerberos</primary>
51650 </indexterm>
51651 The code for this authenticator was provided by Matthew Byng-Maddick of A L
51652 Digital Ltd (<emphasis role="bold"><ulink url="http://www.aldigital.co.uk">http://www.aldigital.co.uk</ulink></emphasis>).
51653 </para>
51654 <para>
51655 The <command>cyrus_sasl</command> authenticator provides server support for the Cyrus SASL
51656 library implementation of the RFC 2222 (<quote>Simple Authentication and Security
51657 Layer</quote>). This library supports a number of authentication mechanisms,
51658 including PLAIN and LOGIN, but also several others that Exim does not support
51659 directly. In particular, there is support for Kerberos authentication.
51660 </para>
51661 <para>
51662 The <command>cyrus_sasl</command> authenticator provides a gatewaying mechanism directly to
51663 the Cyrus interface, so if your Cyrus library can do, for example, CRAM-MD5,
51664 then so can the <command>cyrus_sasl</command> authenticator. By default it uses the public
51665 name of the driver to determine which mechanism to support.
51666 </para>
51667 <para>
51668 Where access to some kind of secret file is required, for example in GSSAPI
51669 or CRAM-MD5, it is worth noting that the authenticator runs as the Exim
51670 user, and that the Cyrus SASL library has no way of escalating privileges
51671 by default. You may also find you need to set environment variables,
51672 depending on the driver you are using.
51673 </para>
51674 <para>
51675 The application name provided by Exim is <quote>exim</quote>, so various SASL options may
51676 be set in <filename>exim.conf</filename> in your SASL directory. If you are using GSSAPI for
51677 Kerberos, note that because of limitations in the GSSAPI interface,
51678 changing the server keytab might need to be communicated down to the Kerberos
51679 layer independently. The mechanism for doing so is dependent upon the Kerberos
51680 implementation.
51681 </para>
51682 <para>
51683 For example, for older releases of Heimdal, the environment variable KRB5_KTNAME
51684 may be set to point to an alternative keytab file. Exim will pass this
51685 variable through from its own inherited environment when started as root or the
51686 Exim user. The keytab file needs to be readable by the Exim user.
51687 With newer releases of Heimdal, a setuid Exim may cause Heimdal to discard the
51688 environment variable.  In practice, for those releases, the Cyrus authenticator
51689 is not a suitable interface for GSSAPI (Kerberos) support.  Instead, consider
51690 the <command>heimdal_gssapi</command> authenticator, described in chapter <xref linkend="CHAPheimdalgss"/>
51691 </para>
51692 <section id="SECID178">
51693 <title>Using cyrus_sasl as a server</title>
51694 <para>
51695 The <command>cyrus_sasl</command> authenticator has four private options. It puts the username
51696 (on a successful authentication) into <varname>$auth1</varname>. For compatibility with
51697 previous releases of Exim, the username is also placed in <varname>$1</varname>. However, the
51698 use of this variable for this purpose is now deprecated, as it can lead to
51699 confusion in string expansions that also use numeric variables for other
51700 things.
51701 </para>
51702 <para>
51703 <indexterm role="option">
51704 <primary><option>server_hostname</option></primary>
51705 </indexterm>
51706 </para>
51707 <informaltable frame="all">
51708 <tgroup cols="4" colsep="0" rowsep="0">
51709 <colspec colwidth="8*" align="left"/>
51710 <colspec colwidth="6*" align="center"/>
51711 <colspec colwidth="6*" align="center"/>
51712 <colspec colwidth="6*" align="right"/>
51713 <tbody>
51714 <row>
51715 <entry><option>server_hostname</option></entry>
51716 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
51717 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51718 <entry>Default: <emphasis>see below</emphasis></entry>
51719 </row>
51720 </tbody>
51721 </tgroup>
51722 </informaltable>
51723 <para>
51724 This option selects the hostname that is used when communicating with the
51725 library. The default value is <literal>$primary_hostname</literal>. It is up to the underlying
51726 SASL plug-in what it does with this data.
51727 </para>
51728 <para>
51729 <indexterm role="option">
51730 <primary><option>server_mech</option></primary>
51731 </indexterm>
51732 </para>
51733 <informaltable frame="all">
51734 <tgroup cols="4" colsep="0" rowsep="0">
51735 <colspec colwidth="8*" align="left"/>
51736 <colspec colwidth="6*" align="center"/>
51737 <colspec colwidth="6*" align="center"/>
51738 <colspec colwidth="6*" align="right"/>
51739 <tbody>
51740 <row>
51741 <entry><option>server_mech</option></entry>
51742 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
51743 <entry>Type: <emphasis>string</emphasis></entry>
51744 <entry>Default: <emphasis>see below</emphasis></entry>
51745 </row>
51746 </tbody>
51747 </tgroup>
51748 </informaltable>
51749 <para>
51750 This option selects the authentication mechanism this driver should use. The
51751 default is the value of the generic <option>public_name</option> option. This option allows
51752 you to use a different underlying mechanism from the advertised name. For
51753 example:
51754 </para>
51755 <literallayout class="monospaced">
51756 sasl:
51757   driver = cyrus_sasl
51758   public_name = X-ANYTHING
51759   server_mech = CRAM-MD5
51760   server_set_id = $auth1
51761 </literallayout>
51762 <para>
51763 <indexterm role="option">
51764 <primary><option>server_realm</option></primary>
51765 </indexterm>
51766 </para>
51767 <informaltable frame="all">
51768 <tgroup cols="4" colsep="0" rowsep="0">
51769 <colspec colwidth="8*" align="left"/>
51770 <colspec colwidth="6*" align="center"/>
51771 <colspec colwidth="6*" align="center"/>
51772 <colspec colwidth="6*" align="right"/>
51773 <tbody>
51774 <row>
51775 <entry><option>server_realm</option></entry>
51776 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
51777 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51778 <entry>Default: <emphasis>unset</emphasis></entry>
51779 </row>
51780 </tbody>
51781 </tgroup>
51782 </informaltable>
51783 <para>
51784 This specifies the SASL realm that the server claims to be in.
51785 </para>
51786 <para>
51787 <indexterm role="option">
51788 <primary><option>server_service</option></primary>
51789 </indexterm>
51790 </para>
51791 <informaltable frame="all">
51792 <tgroup cols="4" colsep="0" rowsep="0">
51793 <colspec colwidth="8*" align="left"/>
51794 <colspec colwidth="6*" align="center"/>
51795 <colspec colwidth="6*" align="center"/>
51796 <colspec colwidth="6*" align="right"/>
51797 <tbody>
51798 <row>
51799 <entry><option>server_service</option></entry>
51800 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
51801 <entry>Type: <emphasis>string</emphasis></entry>
51802 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
51803 </row>
51804 </tbody>
51805 </tgroup>
51806 </informaltable>
51807 <para>
51808 This is the SASL service that the server claims to implement.
51809 </para>
51810 <para>
51811 For straightforward cases, you do not need to set any of the authenticator&#x2019;s
51812 private options. All you need to do is to specify an appropriate mechanism as
51813 the public name. Thus, if you have a SASL library that supports CRAM-MD5 and
51814 PLAIN, you could have two authenticators as follows:
51815 </para>
51816 <literallayout class="monospaced">
51817 sasl_cram_md5:
51818   driver = cyrus_sasl
51819   public_name = CRAM-MD5
51820   server_set_id = $auth1
51821
51822 sasl_plain:
51823   driver = cyrus_sasl
51824   public_name = PLAIN
51825   server_set_id = $auth2
51826 </literallayout>
51827 <para>
51828 Cyrus SASL does implement the LOGIN authentication method, even though it is
51829 not a standard method. It is disabled by default in the source distribution,
51830 but it is present in many binary distributions.
51831 <indexterm role="concept" startref="IIDcyrauth1" class="endofrange"/>
51832 <indexterm role="concept" startref="IIDcyrauth2" class="endofrange"/>
51833 </para>
51834 </section>
51835 </chapter>
51836
51837 <chapter id="CHAPdovecot">
51838 <title>The dovecot authenticator</title>
51839 <para>
51840 <indexterm role="concept" id="IIDdcotauth1" class="startofrange">
51841 <primary><command>dovecot</command> authenticator</primary>
51842 </indexterm>
51843 <indexterm role="concept" id="IIDdcotauth2" class="startofrange">
51844 <primary>authenticators</primary>
51845 <secondary><command>dovecot</command></secondary>
51846 </indexterm>
51847 This authenticator is an interface to the authentication facility of the
51848 Dovecot POP/IMAP server, which can support a number of authentication methods.
51849 Note that Dovecot must be configured to use auth-client not auth-userdb.
51850 If you are using Dovecot to authenticate POP/IMAP clients, it might be helpful
51851 to use the same mechanisms for SMTP authentication. This is a server
51852 authenticator only. There is only one option:
51853 </para>
51854 <para>
51855 <indexterm role="option">
51856 <primary><option>server_socket</option></primary>
51857 </indexterm>
51858 </para>
51859 <informaltable frame="all">
51860 <tgroup cols="4" colsep="0" rowsep="0">
51861 <colspec colwidth="8*" align="left"/>
51862 <colspec colwidth="6*" align="center"/>
51863 <colspec colwidth="6*" align="center"/>
51864 <colspec colwidth="6*" align="right"/>
51865 <tbody>
51866 <row>
51867 <entry><option>server_socket</option></entry>
51868 <entry>Use: <emphasis>dovecot</emphasis></entry>
51869 <entry>Type: <emphasis>string</emphasis></entry>
51870 <entry>Default: <emphasis>unset</emphasis></entry>
51871 </row>
51872 </tbody>
51873 </tgroup>
51874 </informaltable>
51875 <para>
51876 This option must specify the socket that is the interface to Dovecot
51877 authentication. The <option>public_name</option> option must specify an authentication
51878 mechanism that Dovecot is configured to support. You can have several
51879 authenticators for different mechanisms. For example:
51880 </para>
51881 <literallayout class="monospaced">
51882 dovecot_plain:
51883   driver = dovecot
51884   public_name = PLAIN
51885   server_socket = /var/run/dovecot/auth-client
51886   server_set_id = $auth1
51887
51888 dovecot_ntlm:
51889   driver = dovecot
51890   public_name = NTLM
51891   server_socket = /var/run/dovecot/auth-client
51892   server_set_id = $auth1
51893 </literallayout>
51894 <para>
51895 If the SMTP connection is encrypted, or if <varname>$sender_host_address</varname> is equal to
51896 <varname>$received_ip_address</varname> (that is, the connection is local), the <quote>secured</quote>
51897 option is passed in the Dovecot authentication command. If, for a TLS
51898 connection, a client certificate has been verified, the <quote>valid-client-cert</quote>
51899 option is passed. When authentication succeeds, the identity of the user
51900 who authenticated is placed in <varname>$auth1</varname>.
51901 <indexterm role="concept" startref="IIDdcotauth1" class="endofrange"/>
51902 <indexterm role="concept" startref="IIDdcotauth2" class="endofrange"/>
51903 </para>
51904 </chapter>
51905
51906 <chapter id="CHAPgsasl">
51907 <title>The gsasl authenticator</title>
51908 <para>
51909 <indexterm role="concept" id="IIDgsaslauth1" class="startofrange">
51910 <primary><command>gsasl</command> authenticator</primary>
51911 </indexterm>
51912 <indexterm role="concept" id="IIDgsaslauth2" class="startofrange">
51913 <primary>authenticators</primary>
51914 <secondary><command>gsasl</command></secondary>
51915 </indexterm>
51916 <indexterm role="concept">
51917 <primary>authentication</primary>
51918 <secondary>GNU SASL</secondary>
51919 </indexterm>
51920 <indexterm role="concept">
51921 <primary>authentication</primary>
51922 <secondary>SASL</secondary>
51923 </indexterm>
51924 <indexterm role="concept">
51925 <primary>authentication</primary>
51926 <secondary>EXTERNAL</secondary>
51927 </indexterm>
51928 <indexterm role="concept">
51929 <primary>authentication</primary>
51930 <secondary>ANONYMOUS</secondary>
51931 </indexterm>
51932 <indexterm role="concept">
51933 <primary>authentication</primary>
51934 <secondary>PLAIN</secondary>
51935 </indexterm>
51936 <indexterm role="concept">
51937 <primary>authentication</primary>
51938 <secondary>LOGIN</secondary>
51939 </indexterm>
51940 <indexterm role="concept">
51941 <primary>authentication</primary>
51942 <secondary>DIGEST-MD5</secondary>
51943 </indexterm>
51944 <indexterm role="concept">
51945 <primary>authentication</primary>
51946 <secondary>CRAM-MD5</secondary>
51947 </indexterm>
51948 <indexterm role="concept">
51949 <primary>authentication</primary>
51950 <secondary>SCRAM-SHA-1</secondary>
51951 </indexterm>
51952 The <command>gsasl</command> authenticator provides server integration for the GNU SASL
51953 library and the mechanisms it provides.  This is new as of the 4.80 release
51954 and there are a few areas where the library does not let Exim smoothly
51955 scale to handle future authentication mechanisms, so no guarantee can be
51956 made that any particular new authentication mechanism will be supported
51957 without code changes in Exim.
51958 </para>
51959 <para>
51960 <indexterm role="option">
51961 <primary><option>server_channelbinding</option></primary>
51962 </indexterm>
51963 </para>
51964 <informaltable frame="all">
51965 <tgroup cols="4" colsep="0" rowsep="0">
51966 <colspec colwidth="8*" align="left"/>
51967 <colspec colwidth="6*" align="center"/>
51968 <colspec colwidth="6*" align="center"/>
51969 <colspec colwidth="6*" align="right"/>
51970 <tbody>
51971 <row>
51972 <entry><option>server_channelbinding</option></entry>
51973 <entry>Use: <emphasis>gsasl</emphasis></entry>
51974 <entry>Type: <emphasis>boolean</emphasis></entry>
51975 <entry>Default: <emphasis>false</emphasis></entry>
51976 </row>
51977 </tbody>
51978 </tgroup>
51979 </informaltable>
51980 <para>
51981 Some authentication mechanisms are able to use external context at both ends
51982 of the session to bind the authentication to that context, and fail the
51983 authentication process if that context differs.  Specifically, some TLS
51984 ciphersuites can provide identifying information about the cryptographic
51985 context.
51986 </para>
51987 <para>
51988 This means that certificate identity and verification becomes a non-issue,
51989 as a man-in-the-middle attack will cause the correct client and server to
51990 see different identifiers and authentication will fail.
51991 </para>
51992 <para>
51993 This is currently only supported when using the GnuTLS library.  This is
51994 only usable by mechanisms which support "channel binding"; at time of
51995 writing, that&#x2019;s the SCRAM family.
51996 </para>
51997 <para>
51998 This defaults off to ensure smooth upgrade across Exim releases, in case
51999 this option causes some clients to start failing.  Some future release
52000 of Exim may switch the default to be true.
52001 </para>
52002 <para>
52003 <indexterm role="option">
52004 <primary><option>server_hostname</option></primary>
52005 </indexterm>
52006 </para>
52007 <informaltable frame="all">
52008 <tgroup cols="4" colsep="0" rowsep="0">
52009 <colspec colwidth="8*" align="left"/>
52010 <colspec colwidth="6*" align="center"/>
52011 <colspec colwidth="6*" align="center"/>
52012 <colspec colwidth="6*" align="right"/>
52013 <tbody>
52014 <row>
52015 <entry><option>server_hostname</option></entry>
52016 <entry>Use: <emphasis>gsasl</emphasis></entry>
52017 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52018 <entry>Default: <emphasis>see below</emphasis></entry>
52019 </row>
52020 </tbody>
52021 </tgroup>
52022 </informaltable>
52023 <para>
52024 This option selects the hostname that is used when communicating with the
52025 library. The default value is <literal>$primary_hostname</literal>.
52026 Some mechanisms will use this data.
52027 </para>
52028 <para>
52029 <indexterm role="option">
52030 <primary><option>server_mech</option></primary>
52031 </indexterm>
52032 </para>
52033 <informaltable frame="all">
52034 <tgroup cols="4" colsep="0" rowsep="0">
52035 <colspec colwidth="8*" align="left"/>
52036 <colspec colwidth="6*" align="center"/>
52037 <colspec colwidth="6*" align="center"/>
52038 <colspec colwidth="6*" align="right"/>
52039 <tbody>
52040 <row>
52041 <entry><option>server_mech</option></entry>
52042 <entry>Use: <emphasis>gsasl</emphasis></entry>
52043 <entry>Type: <emphasis>string</emphasis></entry>
52044 <entry>Default: <emphasis>see below</emphasis></entry>
52045 </row>
52046 </tbody>
52047 </tgroup>
52048 </informaltable>
52049 <para>
52050 This option selects the authentication mechanism this driver should use. The
52051 default is the value of the generic <option>public_name</option> option. This option allows
52052 you to use a different underlying mechanism from the advertised name. For
52053 example:
52054 </para>
52055 <literallayout class="monospaced">
52056 sasl:
52057   driver = gsasl
52058   public_name = X-ANYTHING
52059   server_mech = CRAM-MD5
52060   server_set_id = $auth1
52061 </literallayout>
52062 <para>
52063 <indexterm role="option">
52064 <primary><option>server_password</option></primary>
52065 </indexterm>
52066 </para>
52067 <informaltable frame="all">
52068 <tgroup cols="4" colsep="0" rowsep="0">
52069 <colspec colwidth="8*" align="left"/>
52070 <colspec colwidth="6*" align="center"/>
52071 <colspec colwidth="6*" align="center"/>
52072 <colspec colwidth="6*" align="right"/>
52073 <tbody>
52074 <row>
52075 <entry><option>server_password</option></entry>
52076 <entry>Use: <emphasis>gsasl</emphasis></entry>
52077 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52078 <entry>Default: <emphasis>unset</emphasis></entry>
52079 </row>
52080 </tbody>
52081 </tgroup>
52082 </informaltable>
52083 <para>
52084 Various mechanisms need access to the cleartext password on the server, so
52085 that proof-of-possession can be demonstrated on the wire, without sending
52086 the password itself.
52087 </para>
52088 <para>
52089 The data available for lookup varies per mechanism.
52090 In all cases, <varname>$auth1</varname> is set to the <emphasis>authentication id</emphasis>.
52091 The <varname>$auth2</varname> variable will always be the <emphasis>authorization id</emphasis> (<emphasis>authz</emphasis>)
52092 if available, else the empty string.
52093 The <varname>$auth3</varname> variable will always be the <emphasis>realm</emphasis> if available,
52094 else the empty string.
52095 </para>
52096 <para>
52097 A forced failure will cause authentication to defer.
52098 </para>
52099 <para>
52100 If using this option, it may make sense to set the <option>server_condition</option>
52101 option to be simply "true".
52102 </para>
52103 <para>
52104 <indexterm role="option">
52105 <primary><option>server_realm</option></primary>
52106 </indexterm>
52107 </para>
52108 <informaltable frame="all">
52109 <tgroup cols="4" colsep="0" rowsep="0">
52110 <colspec colwidth="8*" align="left"/>
52111 <colspec colwidth="6*" align="center"/>
52112 <colspec colwidth="6*" align="center"/>
52113 <colspec colwidth="6*" align="right"/>
52114 <tbody>
52115 <row>
52116 <entry><option>server_realm</option></entry>
52117 <entry>Use: <emphasis>gsasl</emphasis></entry>
52118 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52119 <entry>Default: <emphasis>unset</emphasis></entry>
52120 </row>
52121 </tbody>
52122 </tgroup>
52123 </informaltable>
52124 <para>
52125 This specifies the SASL realm that the server claims to be in.
52126 Some mechanisms will use this data.
52127 </para>
52128 <para>
52129 <indexterm role="option">
52130 <primary><option>server_scram_iter</option></primary>
52131 </indexterm>
52132 </para>
52133 <informaltable frame="all">
52134 <tgroup cols="4" colsep="0" rowsep="0">
52135 <colspec colwidth="8*" align="left"/>
52136 <colspec colwidth="6*" align="center"/>
52137 <colspec colwidth="6*" align="center"/>
52138 <colspec colwidth="6*" align="right"/>
52139 <tbody>
52140 <row>
52141 <entry><option>server_scram_iter</option></entry>
52142 <entry>Use: <emphasis>gsasl</emphasis></entry>
52143 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52144 <entry>Default: <emphasis>unset</emphasis></entry>
52145 </row>
52146 </tbody>
52147 </tgroup>
52148 </informaltable>
52149 <para>
52150 This option provides data for the SCRAM family of mechanisms.
52151 <varname>$auth1</varname> is not available at evaluation time.
52152 (This may change, as we receive feedback on use)
52153 </para>
52154 <para>
52155 <indexterm role="option">
52156 <primary><option>server_scram_salt</option></primary>
52157 </indexterm>
52158 </para>
52159 <informaltable frame="all">
52160 <tgroup cols="4" colsep="0" rowsep="0">
52161 <colspec colwidth="8*" align="left"/>
52162 <colspec colwidth="6*" align="center"/>
52163 <colspec colwidth="6*" align="center"/>
52164 <colspec colwidth="6*" align="right"/>
52165 <tbody>
52166 <row>
52167 <entry><option>server_scram_salt</option></entry>
52168 <entry>Use: <emphasis>gsasl</emphasis></entry>
52169 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52170 <entry>Default: <emphasis>unset</emphasis></entry>
52171 </row>
52172 </tbody>
52173 </tgroup>
52174 </informaltable>
52175 <para>
52176 This option provides data for the SCRAM family of mechanisms.
52177 <varname>$auth1</varname> is not available at evaluation time.
52178 (This may change, as we receive feedback on use)
52179 </para>
52180 <para>
52181 <indexterm role="option">
52182 <primary><option>server_service</option></primary>
52183 </indexterm>
52184 </para>
52185 <informaltable frame="all">
52186 <tgroup cols="4" colsep="0" rowsep="0">
52187 <colspec colwidth="8*" align="left"/>
52188 <colspec colwidth="6*" align="center"/>
52189 <colspec colwidth="6*" align="center"/>
52190 <colspec colwidth="6*" align="right"/>
52191 <tbody>
52192 <row>
52193 <entry><option>server_service</option></entry>
52194 <entry>Use: <emphasis>gsasl</emphasis></entry>
52195 <entry>Type: <emphasis>string</emphasis></entry>
52196 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
52197 </row>
52198 </tbody>
52199 </tgroup>
52200 </informaltable>
52201 <para>
52202 This is the SASL service that the server claims to implement.
52203 Some mechanisms will use this data.
52204 </para>
52205 <section id="SECTgsaslauthvar">
52206 <title><command>gsasl</command> auth variables</title>
52207 <para>
52208 <indexterm role="variable">
52209 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
52210 </indexterm>
52211 These may be set when evaluating specific options, as detailed above.
52212 They will also be set when evaluating <option>server_condition</option>.
52213 </para>
52214 <para>
52215 Unless otherwise stated below, the <command>gsasl</command> integration will use the following
52216 meanings for these variables:
52217 </para>
52218 <itemizedlist>
52219 <listitem>
52220 <para>
52221 <indexterm role="variable">
52222 <primary><varname>$auth1</varname></primary>
52223 </indexterm>
52224 <varname>$auth1</varname>: the <emphasis>authentication id</emphasis>
52225 </para>
52226 </listitem>
52227 <listitem>
52228 <para>
52229 <indexterm role="variable">
52230 <primary><varname>$auth2</varname></primary>
52231 </indexterm>
52232 <varname>$auth2</varname>: the <emphasis>authorization id</emphasis>
52233 </para>
52234 </listitem>
52235 <listitem>
52236 <para>
52237 <indexterm role="variable">
52238 <primary><varname>$auth3</varname></primary>
52239 </indexterm>
52240 <varname>$auth3</varname>: the <emphasis>realm</emphasis>
52241 </para>
52242 </listitem>
52243 </itemizedlist>
52244 <para>
52245 On a per-mechanism basis:
52246 </para>
52247 <itemizedlist>
52248 <listitem>
52249 <para>
52250 <indexterm role="concept">
52251 <primary>authentication</primary>
52252 <secondary>EXTERNAL</secondary>
52253 </indexterm>
52254 EXTERNAL: only <varname>$auth1</varname> is set, to the possibly empty <emphasis>authorization id</emphasis>;
52255 the <option>server_condition</option> option must be present.
52256 </para>
52257 </listitem>
52258 <listitem>
52259 <para>
52260 <indexterm role="concept">
52261 <primary>authentication</primary>
52262 <secondary>ANONYMOUS</secondary>
52263 </indexterm>
52264 ANONYMOUS: only <varname>$auth1</varname> is set, to the possibly empty <emphasis>anonymous token</emphasis>;
52265 the <option>server_condition</option> option must be present.
52266 </para>
52267 </listitem>
52268 <listitem>
52269 <para>
52270 <indexterm role="concept">
52271 <primary>authentication</primary>
52272 <secondary>GSSAPI</secondary>
52273 </indexterm>
52274 GSSAPI: <varname>$auth1</varname> will be set to the <emphasis>GSSAPI Display Name</emphasis>;
52275 <varname>$auth2</varname> will be set to the <emphasis>authorization id</emphasis>,
52276 the <option>server_condition</option> option must be present.
52277 </para>
52278 </listitem>
52279 </itemizedlist>
52280 <para>
52281 An <emphasis>anonymous token</emphasis> is something passed along as an unauthenticated
52282 identifier; this is analogous to FTP anonymous authentication passing an
52283 email address, or software-identifier@, as the "password".
52284 </para>
52285 <para>
52286 An example showing the password having the realm specified in the callback
52287 and demonstrating a Cyrus SASL to GSASL migration approach is:
52288 </para>
52289 <literallayout class="monospaced">
52290 gsasl_cyrusless_crammd5:
52291   driver = gsasl
52292   public_name = CRAM-MD5
52293   server_realm = imap.example.org
52294   server_password = ${lookup{$auth1:$auth3:userPassword}\
52295                     dbmjz{/etc/sasldb2}{$value}fail}
52296   server_set_id = ${quote:$auth1}
52297   server_condition = yes
52298 </literallayout>
52299 </section>
52300 </chapter>
52301
52302 <chapter id="CHAPheimdalgss">
52303 <title>The heimdal_gssapi authenticator</title>
52304 <para>
52305 <indexterm role="concept" id="IIDheimdalgssauth1" class="startofrange">
52306 <primary><command>heimdal_gssapi</command> authenticator</primary>
52307 </indexterm>
52308 <indexterm role="concept" id="IIDheimdalgssauth2" class="startofrange">
52309 <primary>authenticators</primary>
52310 <secondary><command>heimdal_gssapi</command></secondary>
52311 </indexterm>
52312 <indexterm role="concept">
52313 <primary>authentication</primary>
52314 <secondary>GSSAPI</secondary>
52315 </indexterm>
52316 <indexterm role="concept">
52317 <primary>authentication</primary>
52318 <secondary>Kerberos</secondary>
52319 </indexterm>
52320 The <command>heimdal_gssapi</command> authenticator provides server integration for the
52321 Heimdal GSSAPI/Kerberos library, permitting Exim to set a keytab pathname
52322 reliably.
52323 </para>
52324 <para>
52325 <indexterm role="option">
52326 <primary><option>server_hostname</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_hostname</option></entry>
52338 <entry>Use: <emphasis>heimdal_gssapi</emphasis></entry>
52339 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52340 <entry>Default: <emphasis>see below</emphasis></entry>
52341 </row>
52342 </tbody>
52343 </tgroup>
52344 </informaltable>
52345 <para>
52346 This option selects the hostname that is used, with <option>server_service</option>,
52347 for constructing the GSS server name, as a <emphasis>GSS_C_NT_HOSTBASED_SERVICE</emphasis>
52348 identifier.  The default value is <literal>$primary_hostname</literal>.
52349 </para>
52350 <para>
52351 <indexterm role="option">
52352 <primary><option>server_keytab</option></primary>
52353 </indexterm>
52354 </para>
52355 <informaltable frame="all">
52356 <tgroup cols="4" colsep="0" rowsep="0">
52357 <colspec colwidth="8*" align="left"/>
52358 <colspec colwidth="6*" align="center"/>
52359 <colspec colwidth="6*" align="center"/>
52360 <colspec colwidth="6*" align="right"/>
52361 <tbody>
52362 <row>
52363 <entry><option>server_keytab</option></entry>
52364 <entry>Use: <emphasis>heimdal_gssapi</emphasis></entry>
52365 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52366 <entry>Default: <emphasis>unset</emphasis></entry>
52367 </row>
52368 </tbody>
52369 </tgroup>
52370 </informaltable>
52371 <para>
52372 If set, then Heimdal will not use the system default keytab (typically
52373 <filename>/etc/krb5.keytab</filename>) but instead the pathname given in this option.
52374 The value should be a pathname, with no <quote>file:</quote> prefix.
52375 </para>
52376 <para>
52377 <indexterm role="option">
52378 <primary><option>server_service</option></primary>
52379 </indexterm>
52380 </para>
52381 <informaltable frame="all">
52382 <tgroup cols="4" colsep="0" rowsep="0">
52383 <colspec colwidth="8*" align="left"/>
52384 <colspec colwidth="6*" align="center"/>
52385 <colspec colwidth="6*" align="center"/>
52386 <colspec colwidth="6*" align="right"/>
52387 <tbody>
52388 <row>
52389 <entry><option>server_service</option></entry>
52390 <entry>Use: <emphasis>heimdal_gssapi</emphasis></entry>
52391 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52392 <entry>Default: <emphasis>smtp</emphasis></entry>
52393 </row>
52394 </tbody>
52395 </tgroup>
52396 </informaltable>
52397 <para>
52398 This option specifies the service identifier used, in conjunction with
52399 <option>server_hostname</option>, for building the identifier for finding credentials
52400 from the keytab.
52401 </para>
52402 <section id="SECTheimdalgssauthvar">
52403 <title><command>heimdal_gssapi</command> auth variables</title>
52404 <para>
52405 Beware that these variables will typically include a realm, thus will appear
52406 to be roughly like an email address already.  The <emphasis>authzid</emphasis> in <varname>$auth2</varname> is
52407 not verified, so a malicious client can set it to anything.
52408 </para>
52409 <para>
52410 The <varname>$auth1</varname> field should be safely trustable as a value from the Key
52411 Distribution Center.  Note that these are not quite email addresses.
52412 Each identifier is for a role, and so the left-hand-side may include a
52413 role suffix.  For instance, <quote>joe/admin@EXAMPLE.ORG</quote>.
52414 </para>
52415 <para>
52416 <indexterm role="variable">
52417 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
52418 </indexterm>
52419 </para>
52420 <itemizedlist>
52421 <listitem>
52422 <para>
52423 <indexterm role="variable">
52424 <primary><varname>$auth1</varname></primary>
52425 </indexterm>
52426 <varname>$auth1</varname>: the <emphasis>authentication id</emphasis>, set to the GSS Display Name.
52427 </para>
52428 </listitem>
52429 <listitem>
52430 <para>
52431 <indexterm role="variable">
52432 <primary><varname>$auth2</varname></primary>
52433 </indexterm>
52434 <varname>$auth2</varname>: the <emphasis>authorization id</emphasis>, sent within SASL encapsulation after
52435 authentication.  If that was empty, this will also be set to the
52436 GSS Display Name.
52437 </para>
52438 </listitem>
52439 </itemizedlist>
52440 </section>
52441 </chapter>
52442
52443 <chapter id="CHAPspa">
52444 <title>The spa authenticator</title>
52445 <para>
52446 <indexterm role="concept" id="IIDspaauth1" class="startofrange">
52447 <primary><command>spa</command> authenticator</primary>
52448 </indexterm>
52449 <indexterm role="concept" id="IIDspaauth2" class="startofrange">
52450 <primary>authenticators</primary>
52451 <secondary><command>spa</command></secondary>
52452 </indexterm>
52453 <indexterm role="concept">
52454 <primary>authentication</primary>
52455 <secondary>Microsoft Secure Password</secondary>
52456 </indexterm>
52457 <indexterm role="concept">
52458 <primary>authentication</primary>
52459 <secondary>NTLM</secondary>
52460 </indexterm>
52461 <indexterm role="concept">
52462 <primary>Microsoft Secure Password Authentication</primary>
52463 </indexterm>
52464 <indexterm role="concept">
52465 <primary>NTLM authentication</primary>
52466 </indexterm>
52467 The <command>spa</command> authenticator provides client support for Microsoft&#x2019;s <emphasis>Secure
52468 Password Authentication</emphasis> mechanism,
52469 which is also sometimes known as NTLM (NT LanMan). The code for client side of
52470 this authenticator was contributed by Marc Prud&#x2019;hommeaux, and much of it is
52471 taken from the Samba project (<emphasis role="bold"><ulink url="http://www.samba.org">http://www.samba.org</ulink></emphasis>). The code for the
52472 server side was subsequently contributed by Tom Kistner. The mechanism works as
52473 follows:
52474 </para>
52475 <itemizedlist>
52476 <listitem>
52477 <para>
52478 After the AUTH command has been accepted, the client sends an SPA
52479 authentication request based on the user name and optional domain.
52480 </para>
52481 </listitem>
52482 <listitem>
52483 <para>
52484 The server sends back a challenge.
52485 </para>
52486 </listitem>
52487 <listitem>
52488 <para>
52489 The client builds a challenge response which makes use of the user&#x2019;s password
52490 and sends it to the server, which then accepts or rejects it.
52491 </para>
52492 </listitem>
52493 </itemizedlist>
52494 <para>
52495 Encryption is used to protect the password in transit.
52496 </para>
52497 <section id="SECID179">
52498 <title>Using spa as a server</title>
52499 <para>
52500 <indexterm role="concept">
52501 <primary>options</primary>
52502 <secondary><command>spa</command> authenticator (server)</secondary>
52503 </indexterm>
52504 The <command>spa</command> authenticator has just one server option:
52505 </para>
52506 <para>
52507 <indexterm role="option">
52508 <primary><option>server_password</option></primary>
52509 </indexterm>
52510 </para>
52511 <informaltable frame="all">
52512 <tgroup cols="4" colsep="0" rowsep="0">
52513 <colspec colwidth="8*" align="left"/>
52514 <colspec colwidth="6*" align="center"/>
52515 <colspec colwidth="6*" align="center"/>
52516 <colspec colwidth="6*" align="right"/>
52517 <tbody>
52518 <row>
52519 <entry><option>server_password</option></entry>
52520 <entry>Use: <emphasis>spa</emphasis></entry>
52521 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52522 <entry>Default: <emphasis>unset</emphasis></entry>
52523 </row>
52524 </tbody>
52525 </tgroup>
52526 </informaltable>
52527 <para>
52528 <indexterm role="concept">
52529 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
52530 <secondary>in <command>spa</command> authenticator</secondary>
52531 </indexterm>
52532 This option is expanded, and the result must be the cleartext password for the
52533 authenticating user, whose name is at this point in <varname>$auth1</varname>. For
52534 compatibility with previous releases of Exim, the user name is also placed in
52535 <varname>$1</varname>. However, the use of this variable for this purpose is now deprecated, as
52536 it can lead to confusion in string expansions that also use numeric variables
52537 for other things. For example:
52538 </para>
52539 <literallayout class="monospaced">
52540 spa:
52541   driver = spa
52542   public_name = NTLM
52543   server_password = \
52544     ${lookup{$auth1}lsearch{/etc/exim/spa_clearpass}{$value}fail}
52545 </literallayout>
52546 <para>
52547 If the expansion is forced to fail, authentication fails. Any other expansion
52548 failure causes a temporary error code to be returned.
52549 </para>
52550 </section>
52551 <section id="SECID180">
52552 <title>Using spa as a client</title>
52553 <para>
52554 <indexterm role="concept">
52555 <primary>options</primary>
52556 <secondary><command>spa</command> authenticator (client)</secondary>
52557 </indexterm>
52558 The <command>spa</command> authenticator has the following client options:
52559 </para>
52560 <para>
52561 <indexterm role="option">
52562 <primary><option>client_domain</option></primary>
52563 </indexterm>
52564 </para>
52565 <informaltable frame="all">
52566 <tgroup cols="4" colsep="0" rowsep="0">
52567 <colspec colwidth="8*" align="left"/>
52568 <colspec colwidth="6*" align="center"/>
52569 <colspec colwidth="6*" align="center"/>
52570 <colspec colwidth="6*" align="right"/>
52571 <tbody>
52572 <row>
52573 <entry><option>client_domain</option></entry>
52574 <entry>Use: <emphasis>spa</emphasis></entry>
52575 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52576 <entry>Default: <emphasis>unset</emphasis></entry>
52577 </row>
52578 </tbody>
52579 </tgroup>
52580 </informaltable>
52581 <para>
52582 This option specifies an optional domain for the authentication.
52583 </para>
52584 <para>
52585 <indexterm role="option">
52586 <primary><option>client_password</option></primary>
52587 </indexterm>
52588 </para>
52589 <informaltable frame="all">
52590 <tgroup cols="4" colsep="0" rowsep="0">
52591 <colspec colwidth="8*" align="left"/>
52592 <colspec colwidth="6*" align="center"/>
52593 <colspec colwidth="6*" align="center"/>
52594 <colspec colwidth="6*" align="right"/>
52595 <tbody>
52596 <row>
52597 <entry><option>client_password</option></entry>
52598 <entry>Use: <emphasis>spa</emphasis></entry>
52599 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52600 <entry>Default: <emphasis>unset</emphasis></entry>
52601 </row>
52602 </tbody>
52603 </tgroup>
52604 </informaltable>
52605 <para>
52606 This option specifies the user&#x2019;s password, and must be set.
52607 </para>
52608 <para>
52609 <indexterm role="option">
52610 <primary><option>client_username</option></primary>
52611 </indexterm>
52612 </para>
52613 <informaltable frame="all">
52614 <tgroup cols="4" colsep="0" rowsep="0">
52615 <colspec colwidth="8*" align="left"/>
52616 <colspec colwidth="6*" align="center"/>
52617 <colspec colwidth="6*" align="center"/>
52618 <colspec colwidth="6*" align="right"/>
52619 <tbody>
52620 <row>
52621 <entry><option>client_username</option></entry>
52622 <entry>Use: <emphasis>spa</emphasis></entry>
52623 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52624 <entry>Default: <emphasis>unset</emphasis></entry>
52625 </row>
52626 </tbody>
52627 </tgroup>
52628 </informaltable>
52629 <para>
52630 This option specifies the user name, and must be set. Here is an example of a
52631 configuration of this authenticator for use with the mail servers at
52632 <emphasis>msn.com</emphasis>:
52633 </para>
52634 <literallayout class="monospaced">
52635 msn:
52636   driver = spa
52637   public_name = MSN
52638   client_username = msn/msn_username
52639   client_password = msn_plaintext_password
52640   client_domain = DOMAIN_OR_UNSET
52641 </literallayout>
52642 <para>
52643 <indexterm role="concept" startref="IIDspaauth1" class="endofrange"/>
52644 <indexterm role="concept" startref="IIDspaauth2" class="endofrange"/>
52645 </para>
52646 </section>
52647 </chapter>
52648
52649 <chapter id="CHAPtlsauth">
52650 <title>The tls authenticator</title>
52651 <para>
52652 <indexterm role="concept" id="IIDtlsauth1" class="startofrange">
52653 <primary><command>tls</command> authenticator</primary>
52654 </indexterm>
52655 <indexterm role="concept" id="IIDtlsauth2" class="startofrange">
52656 <primary>authenticators</primary>
52657 <secondary><command>tls</command></secondary>
52658 </indexterm>
52659 <indexterm role="concept">
52660 <primary>authentication</primary>
52661 <secondary>Client Certificate</secondary>
52662 </indexterm>
52663 <indexterm role="concept">
52664 <primary>authentication</primary>
52665 <secondary>X509</secondary>
52666 </indexterm>
52667 <indexterm role="concept">
52668 <primary>Certificate-based authentication</primary>
52669 </indexterm>
52670 The <command>tls</command> authenticator provides server support for
52671 authentication based on client certificates.
52672 </para>
52673 <para>
52674 It is not an SMTP authentication mechanism and is not
52675 advertised by the server as part of the SMTP EHLO response.
52676 It is an Exim authenticator in the sense that it affects
52677 the protocol element of the log line, can be tested for
52678 by the <option>authenticated</option> ACL condition, and can set
52679 the <varname>$authenticated_id</varname> variable.
52680 </para>
52681 <para>
52682 The client must present a verifiable certificate,
52683 for which it must have been requested via the
52684 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> main options
52685 (see <xref linkend="CHAPTLS"/>).
52686 </para>
52687 <para>
52688 If an authenticator of this type is configured it is
52689 run before any SMTP-level communication is done,
52690 and can authenticate the connection.
52691 If it does, SMTP authentication is not offered.
52692 </para>
52693 <para>
52694 A maximum of one authenticator of this type may be present.
52695 </para>
52696 <para>
52697 <indexterm role="concept">
52698 <primary>options</primary>
52699 <secondary><command>tls</command> authenticator (server)</secondary>
52700 </indexterm>
52701 The <command>tls</command> authenticator has three server options:
52702 </para>
52703 <para>
52704 <indexterm role="option">
52705 <primary><option>server_param1</option></primary>
52706 </indexterm>
52707 </para>
52708 <informaltable frame="all">
52709 <tgroup cols="4" colsep="0" rowsep="0">
52710 <colspec colwidth="8*" align="left"/>
52711 <colspec colwidth="6*" align="center"/>
52712 <colspec colwidth="6*" align="center"/>
52713 <colspec colwidth="6*" align="right"/>
52714 <tbody>
52715 <row>
52716 <entry><option>server_param1</option></entry>
52717 <entry>Use: <emphasis>tls</emphasis></entry>
52718 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52719 <entry>Default: <emphasis>unset</emphasis></entry>
52720 </row>
52721 </tbody>
52722 </tgroup>
52723 </informaltable>
52724 <para>
52725 <indexterm role="concept">
52726 <primary>variables (<varname>$auth1</varname> <varname>$auth2</varname> etc)</primary>
52727 <secondary>in <command>tls</command> authenticator</secondary>
52728 </indexterm>
52729 This option is expanded after the TLS negotiation and
52730 the result is placed in <varname>$auth1</varname>.
52731 If the expansion is forced to fail, authentication fails. Any other expansion
52732 failure causes a temporary error code to be returned.
52733 </para>
52734 <para>
52735 <indexterm role="option">
52736 <primary><option>server_param2</option></primary>
52737 </indexterm>
52738 </para>
52739 <informaltable frame="all">
52740 <tgroup cols="4" colsep="0" rowsep="0">
52741 <colspec colwidth="8*" align="left"/>
52742 <colspec colwidth="6*" align="center"/>
52743 <colspec colwidth="6*" align="center"/>
52744 <colspec colwidth="6*" align="right"/>
52745 <tbody>
52746 <row>
52747 <entry><option>server_param2</option></entry>
52748 <entry>Use: <emphasis>tls</emphasis></entry>
52749 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52750 <entry>Default: <emphasis>unset</emphasis></entry>
52751 </row>
52752 </tbody>
52753 </tgroup>
52754 </informaltable>
52755 <para>
52756 <indexterm role="option">
52757 <primary><option>server_param3</option></primary>
52758 </indexterm>
52759 </para>
52760 <informaltable frame="all">
52761 <tgroup cols="4" colsep="0" rowsep="0">
52762 <colspec colwidth="8*" align="left"/>
52763 <colspec colwidth="6*" align="center"/>
52764 <colspec colwidth="6*" align="center"/>
52765 <colspec colwidth="6*" align="right"/>
52766 <tbody>
52767 <row>
52768 <entry><option>server_param3</option></entry>
52769 <entry>Use: <emphasis>tls</emphasis></entry>
52770 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52771 <entry>Default: <emphasis>unset</emphasis></entry>
52772 </row>
52773 </tbody>
52774 </tgroup>
52775 </informaltable>
52776 <para>
52777 As above, for <varname>$auth2</varname> and <varname>$auth3</varname>.
52778 </para>
52779 <para>
52780 <option>server_param1</option> may also be spelled <option>server_param</option>.
52781 </para>
52782 <para>
52783 Example:
52784 </para>
52785 <literallayout class="monospaced">
52786 tls:
52787   driver = tls
52788   server_param1 =     ${certextract {subj_altname,mail,&gt;:} \
52789                                     {$tls_in_peercert}}
52790   server_condition =  ${if forany {$auth1} \
52791                             {!= {0} \
52792                                 {${lookup ldap{ldap:///\
52793                          mailname=${quote_ldap_dn:${lc:$item}},\
52794                          ou=users,LDAP_DC?mailid} {$value}{0} \
52795                        }    }   } }
52796   server_set_id =     ${if = {1}{${listcount:$auth1}} {$auth1}{}}
52797 </literallayout>
52798 <para>
52799 This accepts a client certificate that is verifiable against any
52800 of your configured trust-anchors
52801 (which usually means the full set of public CAs)
52802 and which has a SAN with a good account name.
52803 Note that the client cert is on the wire in-clear, including the SAN,
52804 whereas a plaintext SMTP AUTH done inside TLS is not.
52805 </para>
52806 <para>
52807 <indexterm role="concept" startref="IIDtlsauth1" class="endofrange"/>
52808 <indexterm role="concept" startref="IIDtlsauth2" class="endofrange"/>
52809 </para>
52810 <para>
52811 Note that because authentication is traditionally an SMTP operation,
52812 the <option>authenticated</option> ACL condition cannot be used in
52813 a connect- or helo-ACL.
52814 </para>
52815 </chapter>
52816
52817 <chapter id="CHAPTLS">
52818 <title>Encrypted SMTP connections using TLS/SSL</title>
52819 <titleabbrev>Encrypted SMTP connections</titleabbrev>
52820 <para>
52821 <indexterm role="concept" id="IIDencsmtp1" class="startofrange">
52822 <primary>encryption</primary>
52823 <secondary>on SMTP connection</secondary>
52824 </indexterm>
52825 <indexterm role="concept" id="IIDencsmtp2" class="startofrange">
52826 <primary>SMTP</primary>
52827 <secondary>encryption</secondary>
52828 </indexterm>
52829 <indexterm role="concept">
52830 <primary>TLS</primary>
52831 <secondary>on SMTP connection</secondary>
52832 </indexterm>
52833 <indexterm role="concept">
52834 <primary>OpenSSL</primary>
52835 </indexterm>
52836 <indexterm role="concept">
52837 <primary>GnuTLS</primary>
52838 </indexterm>
52839 Support for TLS (Transport Layer Security), formerly known as SSL (Secure
52840 Sockets Layer), is implemented by making use of the OpenSSL library or the
52841 GnuTLS library (Exim requires GnuTLS release 1.0 or later). There is no
52842 cryptographic code in the Exim distribution itself for implementing TLS. In
52843 order to use this feature you must install OpenSSL or GnuTLS, and then build a
52844 version of Exim that includes TLS support (see section <xref linkend="SECTinctlsssl"/>).
52845 You also need to understand the basic concepts of encryption at a managerial
52846 level, and in particular, the way that public keys, private keys, and
52847 certificates are used.
52848 </para>
52849 <para>
52850 RFC 3207 defines how SMTP connections can make use of encryption. Once a
52851 connection is established, the client issues a STARTTLS command. If the
52852 server accepts this, the client and the server negotiate an encryption
52853 mechanism. If the negotiation succeeds, the data that subsequently passes
52854 between them is encrypted.
52855 </para>
52856 <para>
52857 Exim&#x2019;s ACLs can detect whether the current SMTP session is encrypted or not,
52858 and if so, what cipher suite is in use, whether the client supplied a
52859 certificate, and whether or not that certificate was verified. This makes it
52860 possible for an Exim server to deny or accept certain commands based on the
52861 encryption state.
52862 </para>
52863 <para>
52864 <emphasis role="bold">Warning</emphasis>: Certain types of firewall and certain anti-virus products can
52865 disrupt TLS connections. You need to turn off SMTP scanning for these products
52866 in order to get TLS to work.
52867 </para>
52868 <section id="SECID284">
52869 <title>Support for the legacy <quote>ssmtp</quote> (aka <quote>smtps</quote>) protocol</title>
52870 <para>
52871 <indexterm role="concept">
52872 <primary>ssmtp protocol</primary>
52873 </indexterm>
52874 <indexterm role="concept">
52875 <primary>smtps protocol</primary>
52876 </indexterm>
52877 <indexterm role="concept">
52878 <primary>SMTP</primary>
52879 <secondary>ssmtp protocol</secondary>
52880 </indexterm>
52881 <indexterm role="concept">
52882 <primary>SMTP</primary>
52883 <secondary>smtps protocol</secondary>
52884 </indexterm>
52885 Early implementations of encrypted SMTP used a different TCP port from normal
52886 SMTP, and expected an encryption negotiation to start immediately, instead of
52887 waiting for a STARTTLS command from the client using the standard SMTP
52888 port. The protocol was called <quote>ssmtp</quote> or <quote>smtps</quote>, and port 465 was
52889 allocated for this purpose.
52890 </para>
52891 <para>
52892 This approach was abandoned when encrypted SMTP was standardized, but there are
52893 still some legacy clients that use it. Exim supports these clients by means of
52894 the <option>tls_on_connect_ports</option> global option. Its value must be a list of port
52895 numbers; the most common use is expected to be:
52896 </para>
52897 <literallayout class="monospaced">
52898 tls_on_connect_ports = 465
52899 </literallayout>
52900 <para>
52901 The port numbers specified by this option apply to all SMTP connections, both
52902 via the daemon and via <emphasis>inetd</emphasis>. You still need to specify all the ports that
52903 the daemon uses (by setting <option>daemon_smtp_ports</option> or <option>local_interfaces</option> or
52904 the <option>-oX</option> command line option) because <option>tls_on_connect_ports</option> does not add
52905 an extra port &ndash; rather, it specifies different behaviour on a port that is
52906 defined elsewhere.
52907 </para>
52908 <para>
52909 There is also a <option>-tls-on-connect</option> command line option. This overrides
52910 <option>tls_on_connect_ports</option>; it forces the legacy behaviour for all ports.
52911 </para>
52912 </section>
52913 <section id="SECTopenvsgnu">
52914 <title>OpenSSL vs GnuTLS</title>
52915 <para>
52916 <indexterm role="concept">
52917 <primary>TLS</primary>
52918 <secondary>OpenSSL <emphasis>vs</emphasis> GnuTLS</secondary>
52919 </indexterm>
52920 The first TLS support in Exim was implemented using OpenSSL. Support for GnuTLS
52921 followed later, when the first versions of GnuTLS were released. To build Exim
52922 to use GnuTLS, you need to set
52923 </para>
52924 <literallayout class="monospaced">
52925 USE_GNUTLS=yes
52926 </literallayout>
52927 <para>
52928 in Local/Makefile, in addition to
52929 </para>
52930 <literallayout class="monospaced">
52931 SUPPORT_TLS=yes
52932 </literallayout>
52933 <para>
52934 You must also set TLS_LIBS and TLS_INCLUDE appropriately, so that the
52935 include files and libraries for GnuTLS can be found.
52936 </para>
52937 <para>
52938 There are some differences in usage when using GnuTLS instead of OpenSSL:
52939 </para>
52940 <itemizedlist>
52941 <listitem>
52942 <para>
52943 The <option>tls_verify_certificates</option> option
52944 cannot be the path of a directory
52945 for GnuTLS versions before 3.3.6
52946 (for later versions, or OpenSSL, it can be either).
52947 </para>
52948 </listitem>
52949 <listitem>
52950 <para>
52951 The default value for <option>tls_dhparam</option> differs for historical reasons.
52952 </para>
52953 </listitem>
52954 <listitem>
52955 <para>
52956 <indexterm role="variable">
52957 <primary><varname>$tls_in_peerdn</varname></primary>
52958 </indexterm>
52959 <indexterm role="variable">
52960 <primary><varname>$tls_out_peerdn</varname></primary>
52961 </indexterm>
52962 Distinguished Name (DN) strings reported by the OpenSSL library use a slash for
52963 separating fields; GnuTLS uses commas, in accordance with RFC 2253. This
52964 affects the value of the <varname>$tls_in_peerdn</varname> and <varname>$tls_out_peerdn</varname> variables.
52965 </para>
52966 </listitem>
52967 <listitem>
52968 <para>
52969 OpenSSL identifies cipher suites using hyphens as separators, for example:
52970 DES-CBC3-SHA. GnuTLS historically used underscores, for example:
52971 RSA_ARCFOUR_SHA. What is more, OpenSSL complains if underscores are present
52972 in a cipher list. To make life simpler, Exim changes underscores to hyphens
52973 for OpenSSL and passes the string unchanged to GnuTLS (expecting the library
52974 to handle its own older variants) when processing lists of cipher suites in the
52975 <option>tls_require_ciphers</option> options (the global option and the <command>smtp</command> transport
52976 option).
52977 </para>
52978 </listitem>
52979 <listitem>
52980 <para>
52981 The <option>tls_require_ciphers</option> options operate differently, as described in the
52982 sections <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
52983 </para>
52984 </listitem>
52985 <listitem>
52986 <para>
52987 The <option>tls_dh_min_bits</option> SMTP transport option is only honoured by GnuTLS.
52988 When using OpenSSL, this option is ignored.
52989 (If an API is found to let OpenSSL be configured in this way,
52990 let the Exim Maintainers know and we&#x2019;ll likely use it).
52991 </para>
52992 </listitem>
52993 <listitem>
52994 <para revisionflag="changed">
52995 With GnuTLS, if an explicit list is used for the <option>tls_privatekey</option> main option
52996 main option, it must be ordered to match the <option>tls_certificate</option> list.
52997 </para>
52998 </listitem>
52999 <listitem>
53000 <para>
53001 Some other recently added features may only be available in one or the other.
53002 This should be documented with the feature.  If the documentation does not
53003 explicitly state that the feature is infeasible in the other TLS
53004 implementation, then patches are welcome.
53005 </para>
53006 </listitem>
53007 </itemizedlist>
53008 </section>
53009 <section id="SECTgnutlsparam">
53010 <title>GnuTLS parameter computation</title>
53011 <para>
53012 This section only applies if <option>tls_dhparam</option> is set to <literal>historic</literal> or to
53013 an explicit path; if the latter, then the text about generation still applies,
53014 but not the chosen filename.
53015 By default, as of Exim 4.80 a hard-coded D-H prime is used.
53016 See the documentation of <option>tls_dhparam</option> for more information.
53017 </para>
53018 <para>
53019 GnuTLS uses D-H parameters that may take a substantial amount of time
53020 to compute. It is unreasonable to re-compute them for every TLS session.
53021 Therefore, Exim keeps this data in a file in its spool directory, called
53022 <filename>gnutls-params-NNNN</filename> for some value of NNNN, corresponding to the number
53023 of bits requested.
53024 The file is owned by the Exim user and is readable only by
53025 its owner. Every Exim process that start up GnuTLS reads the D-H
53026 parameters from this file. If the file does not exist, the first Exim process
53027 that needs it computes the data and writes it to a temporary file which is
53028 renamed once it is complete. It does not matter if several Exim processes do
53029 this simultaneously (apart from wasting a few resources). Once a file is in
53030 place, new Exim processes immediately start using it.
53031 </para>
53032 <para>
53033 For maximum security, the parameters that are stored in this file should be
53034 recalculated periodically, the frequency depending on your paranoia level.
53035 If you are avoiding using the fixed D-H primes published in RFCs, then you
53036 are concerned about some advanced attacks and will wish to do this; if you do
53037 not regenerate then you might as well stick to the standard primes.
53038 </para>
53039 <para>
53040 Arranging this is easy in principle; just delete the file when you want new
53041 values to be computed. However, there may be a problem. The calculation of new
53042 parameters needs random numbers, and these are obtained from <filename>/dev/random</filename>.
53043 If the system is not very active, <filename>/dev/random</filename> may delay returning data
53044 until enough randomness (entropy) is available. This may cause Exim to hang for
53045 a substantial amount of time, causing timeouts on incoming connections.
53046 </para>
53047 <para>
53048 The solution is to generate the parameters externally to Exim. They are stored
53049 in <filename>gnutls-params-N</filename> in PEM format, which means that they can be
53050 generated externally using the <command>certtool</command> command that is part of GnuTLS.
53051 </para>
53052 <para>
53053 To replace the parameters with new ones, instead of deleting the file
53054 and letting Exim re-create it, you can generate new parameters using
53055 <command>certtool</command> and, when this has been done, replace Exim&#x2019;s cache file by
53056 renaming. The relevant commands are something like this:
53057 </para>
53058 <literallayout class="monospaced">
53059 # ls
53060 [ look for file; assume gnutls-params-2236 is the most recent ]
53061 # rm -f new-params
53062 # touch new-params
53063 # chown exim:exim new-params
53064 # chmod 0600 new-params
53065 # certtool --generate-dh-params --bits 2236 &gt;&gt;new-params
53066 # openssl dhparam -noout -text -in new-params | head
53067 [ check the first line, make sure it's not more than 2236;
53068   if it is, then go back to the start ("rm") and repeat
53069   until the size generated is at most the size requested ]
53070 # chmod 0400 new-params
53071 # mv new-params gnutls-params-2236
53072 </literallayout>
53073 <para>
53074 If Exim never has to generate the parameters itself, the possibility of
53075 stalling is removed.
53076 </para>
53077 <para>
53078 The filename changed in Exim 4.80, to gain the -bits suffix.  The value which
53079 Exim will choose depends upon the version of GnuTLS in use.  For older GnuTLS,
53080 the value remains hard-coded in Exim as 1024.  As of GnuTLS 2.12.x, there is
53081 a way for Exim to ask for the "normal" number of bits for D-H public-key usage,
53082 and Exim does so.  This attempt to remove Exim from TLS policy decisions
53083 failed, as GnuTLS 2.12 returns a value higher than the current hard-coded limit
53084 of the NSS library.  Thus Exim gains the <option>tls_dh_max_bits</option> global option,
53085 which applies to all D-H usage, client or server.  If the value returned by
53086 GnuTLS is greater than <option>tls_dh_max_bits</option> then the value will be clamped down
53087 to <option>tls_dh_max_bits</option>.  The default value has been set at the current NSS
53088 limit, which is still much higher than Exim historically used.
53089 </para>
53090 <para>
53091 The filename and bits used will change as the GnuTLS maintainers change the
53092 value for their parameter <literal>GNUTLS_SEC_PARAM_NORMAL</literal>, as clamped by
53093 <option>tls_dh_max_bits</option>.  At the time of writing (mid 2012), GnuTLS 2.12 recommends
53094 2432 bits, while NSS is limited to 2236 bits.
53095 </para>
53096 <para>
53097 In fact, the requested value will be *lower* than <option>tls_dh_max_bits</option>, to
53098 increase the chance of the generated prime actually being within acceptable
53099 bounds, as GnuTLS has been observed to overshoot.  Note the check step in the
53100 procedure above.  There is no sane procedure available to Exim to double-check
53101 the size of the generated prime, so it might still be too large.
53102 </para>
53103 </section>
53104 <section id="SECTreqciphssl">
53105 <title>Requiring specific ciphers in OpenSSL</title>
53106 <para>
53107 <indexterm role="concept">
53108 <primary>TLS</primary>
53109 <secondary>requiring specific ciphers (OpenSSL)</secondary>
53110 </indexterm>
53111 <indexterm role="option">
53112 <primary><option>tls_require_ciphers</option></primary>
53113 <secondary>OpenSSL</secondary>
53114 </indexterm>
53115 There is a function in the OpenSSL library that can be passed a list of cipher
53116 suites before the cipher negotiation takes place. This specifies which ciphers
53117 are acceptable. The list is colon separated and may contain names like
53118 DES-CBC3-SHA. Exim passes the expanded value of <option>tls_require_ciphers</option>
53119 directly to this function call.
53120 Many systems will install the OpenSSL manual-pages, so you may have
53121 <emphasis>ciphers(1)</emphasis> available to you.
53122 The following quotation from the OpenSSL
53123 documentation specifies what forms of item are allowed in the cipher string:
53124 </para>
53125 <itemizedlist>
53126 <listitem>
53127 <para>
53128 It can consist of a single cipher suite such as RC4-SHA.
53129 </para>
53130 </listitem>
53131 <listitem>
53132 <para>
53133 It can represent a list of cipher suites containing a certain algorithm,
53134 or cipher suites of a certain type. For example SHA1 represents all
53135 ciphers suites using the digest algorithm SHA1 and SSLv3 represents all
53136 SSL v3 algorithms.
53137 </para>
53138 </listitem>
53139 <listitem>
53140 <para>
53141 Lists of cipher suites can be combined in a single cipher string using
53142 the + character. This is used as a logical and operation. For example
53143 SHA1+DES represents all cipher suites containing the SHA1 and the DES
53144 algorithms.
53145 </para>
53146 </listitem>
53147 </itemizedlist>
53148 <para>
53149 Each cipher string can be optionally preceded by one of the characters <literal>!</literal>,
53150 <literal>-</literal> or <literal>+</literal>.
53151 </para>
53152 <itemizedlist>
53153 <listitem>
53154 <para>
53155 If <literal>!</literal> is used, the ciphers are permanently deleted from the list. The
53156 ciphers deleted can never reappear in the list even if they are explicitly
53157 stated.
53158 </para>
53159 </listitem>
53160 <listitem>
53161 <para>
53162 If <literal>-</literal> is used, the ciphers are deleted from the list, but some or all
53163 of the ciphers can be added again by later options.
53164 </para>
53165 </listitem>
53166 <listitem>
53167 <para>
53168 If <literal>+</literal> is used, the ciphers are moved to the end of the list. This
53169 option does not add any new ciphers; it just moves matching existing ones.
53170 </para>
53171 </listitem>
53172 </itemizedlist>
53173 <para>
53174 If none of these characters is present, the string is interpreted as
53175 a list of ciphers to be appended to the current preference list. If the list
53176 includes any ciphers already present they will be ignored: that is, they will
53177 not be moved to the end of the list.
53178 </para>
53179 <para>
53180 The OpenSSL <emphasis>ciphers(1)</emphasis> command may be used to test the results of a given
53181 string:
53182 </para>
53183 <literallayout class="monospaced">
53184 # note single-quotes to get ! past any shell history expansion
53185 $ openssl ciphers 'HIGH:!MD5:!SHA1'
53186 </literallayout>
53187 <para>
53188 This example will let the library defaults be permitted on the MX port, where
53189 there&#x2019;s probably no identity verification anyway, but ups the ante on the
53190 submission ports where the administrator might have some influence on the
53191 choice of clients used:
53192 </para>
53193 <literallayout class="monospaced">
53194 # OpenSSL variant; see man ciphers(1)
53195 tls_require_ciphers = ${if =={$received_port}{25}\
53196                            {DEFAULT}\
53197                            {HIGH:!MD5:!SHA1}}
53198 </literallayout>
53199 <para revisionflag="changed">
53200 This example will prefer ECDSA-authenticated ciphers over RSA ones:
53201 </para>
53202 <literallayout class="monospaced" revisionflag="changed">
53203 tls_require_ciphers = ECDSA:RSA:!COMPLEMENTOFDEFAULT
53204 </literallayout>
53205 </section>
53206 <section id="SECTreqciphgnu">
53207 <title>Requiring specific ciphers or other parameters in GnuTLS</title>
53208 <para>
53209 <indexterm role="concept">
53210 <primary>GnuTLS</primary>
53211 <secondary>specifying parameters for</secondary>
53212 </indexterm>
53213 <indexterm role="concept">
53214 <primary>TLS</primary>
53215 <secondary>specifying ciphers (GnuTLS)</secondary>
53216 </indexterm>
53217 <indexterm role="concept">
53218 <primary>TLS</primary>
53219 <secondary>specifying key exchange methods (GnuTLS)</secondary>
53220 </indexterm>
53221 <indexterm role="concept">
53222 <primary>TLS</primary>
53223 <secondary>specifying MAC algorithms (GnuTLS)</secondary>
53224 </indexterm>
53225 <indexterm role="concept">
53226 <primary>TLS</primary>
53227 <secondary>specifying protocols (GnuTLS)</secondary>
53228 </indexterm>
53229 <indexterm role="concept">
53230 <primary>TLS</primary>
53231 <secondary>specifying priority string (GnuTLS)</secondary>
53232 </indexterm>
53233 <indexterm role="option">
53234 <primary><option>tls_require_ciphers</option></primary>
53235 <secondary>GnuTLS</secondary>
53236 </indexterm>
53237 The GnuTLS library allows the caller to provide a "priority string", documented
53238 as part of the <function>gnutls_priority_init</function> function.  This is very similar to the
53239 ciphersuite specification in OpenSSL.
53240 </para>
53241 <para>
53242 The <option>tls_require_ciphers</option> option is treated as the GnuTLS priority string
53243 and controls both protocols and ciphers.
53244 </para>
53245 <para>
53246 The <option>tls_require_ciphers</option> option is available both as an global option,
53247 controlling how Exim behaves as a server, and also as an option of the
53248 <command>smtp</command> transport, controlling how Exim behaves as a client.  In both cases
53249 the value is string expanded.  The resulting string is not an Exim list and
53250 the string is given to the GnuTLS library, so that Exim does not need to be
53251 aware of future feature enhancements of GnuTLS.
53252 </para>
53253 <para>
53254 Documentation of the strings accepted may be found in the GnuTLS manual, under
53255 "Priority strings".  This is online as
53256 <emphasis role="bold"><ulink url="http://www.gnutls.org/manual/html_node/Priority-Strings.html">http://www.gnutls.org/manual/html_node/Priority-Strings.html</ulink></emphasis>,
53257 but beware that this relates to GnuTLS 3, which may be newer than the version
53258 installed on your system.  If you are using GnuTLS 3,
53259 then the example code
53260 <emphasis role="bold"><ulink url="http://www.gnutls.org/manual/gnutls.html#Listing-the-ciphersuites-in-a-priority-string">http://www.gnutls.org/manual/gnutls.html#Listing-the-ciphersuites-in-a-priority-string</ulink></emphasis>
53261 on that site can be used to test a given string.
53262 </para>
53263 <para>
53264 For example:
53265 </para>
53266 <literallayout class="monospaced">
53267 # Disable older versions of protocols
53268 tls_require_ciphers = NORMAL:%LATEST_RECORD_VERSION:-VERS-SSL3.0
53269 </literallayout>
53270 <para>
53271 Prior to Exim 4.80, an older API of GnuTLS was used, and Exim supported three
53272 additional options, "<option>gnutls_require_kx</option>", "<option>gnutls_require_mac</option>" and
53273 "<option>gnutls_require_protocols</option>".  <option>tls_require_ciphers</option> was an Exim list.
53274 </para>
53275 <para>
53276 This example will let the library defaults be permitted on the MX port, where
53277 there&#x2019;s probably no identity verification anyway, and lowers security further
53278 by increasing compatibility; but this ups the ante on the submission ports
53279 where the administrator might have some influence on the choice of clients
53280 used:
53281 </para>
53282 <literallayout class="monospaced">
53283 # GnuTLS variant
53284 tls_require_ciphers = ${if =={$received_port}{25}\
53285                            {NORMAL:%COMPAT}\
53286                            {SECURE128}}
53287 </literallayout>
53288 </section>
53289 <section id="SECID182">
53290 <title>Configuring an Exim server to use TLS</title>
53291 <para>
53292 <indexterm role="concept">
53293 <primary>TLS</primary>
53294 <secondary>configuring an Exim server</secondary>
53295 </indexterm>
53296 When Exim has been built with TLS support, it advertises the availability of
53297 the STARTTLS command to client hosts that match <option>tls_advertise_hosts</option>,
53298 but not to any others. The default value of this option is *, which means
53299 that STARTTLS is alway advertised.  Set it to blank to never advertise;
53300 this is reasonble for systems that want to use TLS only as a client.
53301 </para>
53302 <para>
53303 If STARTTLS is to be used you
53304 need to set some other options in order to make TLS available.
53305 </para>
53306 <para>
53307 If a client issues a STARTTLS command and there is some configuration
53308 problem in the server, the command is rejected with a 454 error. If the client
53309 persists in trying to issue SMTP commands, all except QUIT are rejected
53310 with the error
53311 </para>
53312 <literallayout class="monospaced">
53313 554 Security failure
53314 </literallayout>
53315 <para>
53316 If a STARTTLS command is issued within an existing TLS session, it is
53317 rejected with a 554 error code.
53318 </para>
53319 <para>
53320 To enable TLS operations on a server, the <option>tls_advertise_hosts</option> option
53321 must be set to match some hosts. The default is * which matches all hosts.
53322 </para>
53323 <para>
53324 If this is all you do, TLS encryption will be enabled but not authentication -
53325 meaning that the peer has no assurance it is actually you he is talking to.
53326 You gain protection from a passive sniffer listening on the wire but not
53327 from someone able to intercept the communication.
53328 </para>
53329 <para>
53330 Further protection requires some further configuration at the server end.
53331 </para>
53332 <para>
53333 To make TLS work you need to set, in the server,
53334 </para>
53335 <literallayout class="monospaced">
53336 tls_certificate = /some/file/name
53337 tls_privatekey = /some/file/name
53338 </literallayout>
53339 <para>
53340 These options are, in fact, expanded strings, so you can make them depend on
53341 the identity of the client that is connected if you wish. The first file
53342 contains the server&#x2019;s X509 certificate, and the second contains the private key
53343 that goes with it. These files need to be
53344 PEM format and readable by the Exim user, and must
53345 always be given as full path names.
53346 The key must not be password-protected.
53347 They can be the same file if both the
53348 certificate and the key are contained within it. If <option>tls_privatekey</option> is not
53349 set, or if its expansion is forced to fail or results in an empty string, this
53350 is assumed to be the case. The certificate file may also contain intermediate
53351 certificates that need to be sent to the client to enable it to authenticate
53352 the server&#x2019;s certificate.
53353 </para>
53354 <para revisionflag="changed">
53355 For dual-stack (eg. RSA and ECDSA) configurations, these options can be
53356 colon-separated lists of file paths.  Ciphers using given authentication
53357 algorithms require the presence of a suitable certificate to supply the
53358 public-key.  The server selects among the certificates to present to the
53359 client depending on the selected cipher, hence the priority ordering for
53360 ciphers will affect which certificate is used.
53361 </para>
53362 <para>
53363 If you do not understand about certificates and keys, please try to find a
53364 source of this background information, which is not Exim-specific. (There are a
53365 few comments below in section <xref linkend="SECTcerandall"/>.)
53366 </para>
53367 <para>
53368 <emphasis role="bold">Note</emphasis>: These options do not apply when Exim is operating as a client &ndash;
53369 they apply only in the case of a server. If you need to use a certificate in an
53370 Exim client, you must set the options of the same names in an <command>smtp</command>
53371 transport.
53372 </para>
53373 <para>
53374 With just these options, an Exim server will be able to use TLS. It does not
53375 require the client to have a certificate (but see below for how to insist on
53376 this). There is one other option that may be needed in other situations. If
53377 </para>
53378 <literallayout class="monospaced">
53379 tls_dhparam = /some/file/name
53380 </literallayout>
53381 <para>
53382 is set, the SSL library is initialized for the use of Diffie-Hellman ciphers
53383 with the parameters contained in the file.
53384 Set this to <literal>none</literal> to disable use of DH entirely, by making no prime
53385 available:
53386 </para>
53387 <literallayout class="monospaced">
53388 tls_dhparam = none
53389 </literallayout>
53390 <para>
53391 This may also be set to a string identifying a standard prime to be used for
53392 DH; if it is set to <literal>default</literal> or, for OpenSSL, is unset, then the prime
53393 used is <literal>ike23</literal>.  There are a few standard primes available, see the
53394 documentation for <option>tls_dhparam</option> for the complete list.
53395 </para>
53396 <para>
53397 See the command
53398 </para>
53399 <literallayout class="monospaced">
53400 openssl dhparam
53401 </literallayout>
53402 <para>
53403 for a way of generating file data.
53404 </para>
53405 <para>
53406 The strings supplied for these three options are expanded every time a client
53407 host connects. It is therefore possible to use different certificates and keys
53408 for different hosts, if you so wish, by making use of the client&#x2019;s IP address
53409 in <varname>$sender_host_address</varname> to control the expansion. If a string expansion is
53410 forced to fail, Exim behaves as if the option is not set.
53411 </para>
53412 <para>
53413 <indexterm role="concept">
53414 <primary>cipher</primary>
53415 <secondary>logging</secondary>
53416 </indexterm>
53417 <indexterm role="concept">
53418 <primary>log</primary>
53419 <secondary>TLS cipher</secondary>
53420 </indexterm>
53421 <indexterm role="variable">
53422 <primary><varname>$tls_in_cipher</varname></primary>
53423 </indexterm>
53424 The variable <varname>$tls_in_cipher</varname> is set to the cipher suite that was negotiated for
53425 an incoming TLS connection. It is included in the <emphasis>Received:</emphasis> header of an
53426 incoming message (by default &ndash; you can, of course, change this), and it is
53427 also included in the log line that records a message&#x2019;s arrival, keyed by
53428 <quote>X=</quote>, unless the <option>tls_cipher</option> log selector is turned off. The <option>encrypted</option>
53429 condition can be used to test for specific cipher suites in ACLs.
53430 </para>
53431 <para>
53432 Once TLS has been established, the ACLs that run for subsequent SMTP commands
53433 can check the name of the cipher suite and vary their actions accordingly. The
53434 cipher suite names vary, depending on which TLS library is being used. For
53435 example, OpenSSL uses the name DES-CBC3-SHA for the cipher suite which in other
53436 contexts is known as TLS_RSA_WITH_3DES_EDE_CBC_SHA. Check the OpenSSL or GnuTLS
53437 documentation for more details.
53438 </para>
53439 <para>
53440 For outgoing SMTP deliveries, <varname>$tls_out_cipher</varname> is used and logged
53441 (again depending on the <option>tls_cipher</option> log selector).
53442 </para>
53443 </section>
53444 <section id="SECID183">
53445 <title>Requesting and verifying client certificates</title>
53446 <para>
53447 <indexterm role="concept">
53448 <primary>certificate</primary>
53449 <secondary>verification of client</secondary>
53450 </indexterm>
53451 <indexterm role="concept">
53452 <primary>TLS</primary>
53453 <secondary>client certificate verification</secondary>
53454 </indexterm>
53455 If you want an Exim server to request a certificate when negotiating a TLS
53456 session with a client, you must set either <option>tls_verify_hosts</option> or
53457 <option>tls_try_verify_hosts</option>. You can, of course, set either of them to * to
53458 apply to all TLS connections. For any host that matches one of these options,
53459 Exim requests a certificate as part of the setup of the TLS session. The
53460 contents of the certificate are verified by comparing it with a list of
53461 expected certificates.
53462 These may be the system default set (depending on library version),
53463 an explicit file or,
53464 depending on library version, a directory, identified by
53465 <option>tls_verify_certificates</option>.
53466 </para>
53467 <para>
53468 A file can contain multiple certificates, concatenated end to end. If a
53469 directory is used
53470 (OpenSSL only),
53471 each certificate must be in a separate file, with a name (or a symbolic link)
53472 of the form &lt;<emphasis>hash</emphasis>&gt;.0, where &lt;<emphasis>hash</emphasis>&gt; is a hash value constructed from the
53473 certificate. You can compute the relevant hash by running the command
53474 </para>
53475 <literallayout class="monospaced">
53476 openssl x509 -hash -noout -in /cert/file
53477 </literallayout>
53478 <para>
53479 where <filename>/cert/file</filename> contains a single certificate.
53480 </para>
53481 <para>
53482 The difference between <option>tls_verify_hosts</option> and <option>tls_try_verify_hosts</option> is
53483 what happens if the client does not supply a certificate, or if the certificate
53484 does not match any of the certificates in the collection named by
53485 <option>tls_verify_certificates</option>. If the client matches <option>tls_verify_hosts</option>, the
53486 attempt to set up a TLS session is aborted, and the incoming connection is
53487 dropped. If the client matches <option>tls_try_verify_hosts</option>, the (encrypted) SMTP
53488 session continues. ACLs that run for subsequent SMTP commands can detect the
53489 fact that no certificate was verified, and vary their actions accordingly. For
53490 example, you can insist on a certificate before accepting a message for
53491 relaying, but not when the message is destined for local delivery.
53492 </para>
53493 <para>
53494 <indexterm role="variable">
53495 <primary><varname>$tls_in_peerdn</varname></primary>
53496 </indexterm>
53497 When a client supplies a certificate (whether it verifies or not), the value of
53498 the Distinguished Name of the certificate is made available in the variable
53499 <varname>$tls_in_peerdn</varname> during subsequent processing of the message.
53500 </para>
53501 <para>
53502 <indexterm role="concept">
53503 <primary>log</primary>
53504 <secondary>distinguished name</secondary>
53505 </indexterm>
53506 Because it is often a long text string, it is not included in the log line or
53507 <emphasis>Received:</emphasis> header by default. You can arrange for it to be logged, keyed by
53508 <quote>DN=</quote>, by setting the <option>tls_peerdn</option> log selector, and you can use
53509 <option>received_header_text</option> to change the <emphasis>Received:</emphasis> header. When no
53510 certificate is supplied, <varname>$tls_in_peerdn</varname> is empty.
53511 </para>
53512 </section>
53513 <section id="SECID184">
53514 <title>Revoked certificates</title>
53515 <para>
53516 <indexterm role="concept">
53517 <primary>TLS</primary>
53518 <secondary>revoked certificates</secondary>
53519 </indexterm>
53520 <indexterm role="concept">
53521 <primary>revocation list</primary>
53522 </indexterm>
53523 <indexterm role="concept">
53524 <primary>certificate</primary>
53525 <secondary>revocation list</secondary>
53526 </indexterm>
53527 <indexterm role="concept">
53528 <primary>OCSP</primary>
53529 <secondary>stapling</secondary>
53530 </indexterm>
53531 Certificate issuing authorities issue Certificate Revocation Lists (CRLs) when
53532 certificates are revoked. If you have such a list, you can pass it to an Exim
53533 server using the global option called <option>tls_crl</option> and to an Exim client using
53534 an identically named option for the <command>smtp</command> transport. In each case, the value
53535 of the option is expanded and must then be the name of a file that contains a
53536 CRL in PEM format.
53537 The downside is that clients have to periodically re-download a potentially huge
53538 file from every certificate authority they know of.
53539 </para>
53540 <para>
53541 The way with most moving parts at query time is Online Certificate
53542 Status Protocol (OCSP), where the client verifies the certificate
53543 against an OCSP server run by the CA.  This lets the CA track all
53544 usage of the certs.  It requires running software with access to the
53545 private key of the CA, to sign the responses to the OCSP queries.  OCSP
53546 is based on HTTP and can be proxied accordingly.
53547 </para>
53548 <para>
53549 The only widespread OCSP server implementation (known to this writer)
53550 comes as part of OpenSSL and aborts on an invalid request, such as
53551 connecting to the port and then disconnecting.  This requires
53552 re-entering the passphrase each time some random client does this.
53553 </para>
53554 <para>
53555 The third way is OCSP Stapling; in this, the server using a certificate
53556 issued by the CA periodically requests an OCSP proof of validity from
53557 the OCSP server, then serves it up inline as part of the TLS
53558 negotiation.   This approach adds no extra round trips, does not let the
53559 CA track users, scales well with number of certs issued by the CA and is
53560 resilient to temporary OCSP server failures, as long as the server
53561 starts retrying to fetch an OCSP proof some time before its current
53562 proof expires.  The downside is that it requires server support.
53563 </para>
53564 <para>
53565 Unless Exim is built with the support disabled,
53566 or with GnuTLS earlier than version 3.3.16 / 3.4.8
53567 support for OCSP stapling is included.
53568 </para>
53569 <para>
53570 There is a global option called <option>tls_ocsp_file</option>.
53571 The file specified therein is expected to be in DER format, and contain
53572 an OCSP proof.  Exim will serve it as part of the TLS handshake.  This
53573 option will be re-expanded for SNI, if the <option>tls_certificate</option> option
53574 contains <literal>tls_in_sni</literal>, as per other TLS options.
53575 </para>
53576 <para>
53577 Exim does not at this time implement any support for fetching a new OCSP
53578 proof.  The burden is on the administrator to handle this, outside of
53579 Exim.  The file specified should be replaced atomically, so that the
53580 contents are always valid.  Exim will expand the <option>tls_ocsp_file</option> option
53581 on each connection, so a new file will be handled transparently on the
53582 next connection.
53583 </para>
53584 <para>
53585 When built with OpenSSL Exim will check for a valid next update timestamp
53586 in the OCSP proof; if not present, or if the proof has expired, it will be
53587 ignored.
53588 </para>
53589 <para>
53590 For the client to be able to verify the stapled OCSP the server must
53591 also supply, in its stapled information, any intermediate
53592 certificates for the chain leading to the OCSP proof from the signer
53593 of the server certificate.  There may be zero or one such. These
53594 intermediate certificates should be added to the server OCSP stapling
53595 file named by <option>tls_ocsp_file</option>.
53596 </para>
53597 <para>
53598 Note that the proof only covers the terminal server certificate,
53599 not any of the chain from CA to it.
53600 </para>
53601 <para>
53602 There is no current way to staple a proof for a client certificate.
53603 </para>
53604 <literallayout class="monospaced">
53605   A helper script "ocsp_fetch.pl" for fetching a proof from a CA
53606   OCSP server is supplied.  The server URL may be included in the
53607   server certificate, if the CA is helpful.
53608
53609   One failure mode seen was the OCSP Signer cert expiring before the end
53610   of validity of the OCSP proof. The checking done by Exim/OpenSSL
53611   noted this as invalid overall, but the re-fetch script did not.
53612 </literallayout>
53613 </section>
53614 <section id="SECID185">
53615 <title>Configuring an Exim client to use TLS</title>
53616 <para>
53617 <indexterm role="concept">
53618 <primary>cipher</primary>
53619 <secondary>logging</secondary>
53620 </indexterm>
53621 <indexterm role="concept">
53622 <primary>log</primary>
53623 <secondary>TLS cipher</secondary>
53624 </indexterm>
53625 <indexterm role="concept">
53626 <primary>log</primary>
53627 <secondary>distinguished name</secondary>
53628 </indexterm>
53629 <indexterm role="concept">
53630 <primary>TLS</primary>
53631 <secondary>configuring an Exim client</secondary>
53632 </indexterm>
53633 The <option>tls_cipher</option> and <option>tls_peerdn</option> log selectors apply to outgoing SMTP
53634 deliveries as well as to incoming, the latter one causing logging of the
53635 server certificate&#x2019;s DN. The remaining client configuration for TLS is all
53636 within the <command>smtp</command> transport.
53637 </para>
53638 <para>
53639 It is not necessary to set any options to have TLS work in the <command>smtp</command>
53640 transport. If Exim is built with TLS support, and TLS is advertised by a
53641 server, the <command>smtp</command> transport always tries to start a TLS session. However,
53642 this can be prevented by setting <option>hosts_avoid_tls</option> (an option of the
53643 transport) to a list of server hosts for which TLS should not be used.
53644 </para>
53645 <para>
53646 If you do not want Exim to attempt to send messages unencrypted when an attempt
53647 to set up an encrypted connection fails in any way, you can set
53648 <option>hosts_require_tls</option> to a list of hosts for which encryption is mandatory. For
53649 those hosts, delivery is always deferred if an encrypted connection cannot be
53650 set up. If there are any other hosts for the address, they are tried in the
53651 usual way.
53652 </para>
53653 <para>
53654 When the server host is not in <option>hosts_require_tls</option>, Exim may try to deliver
53655 the message unencrypted. It always does this if the response to STARTTLS is
53656 a 5<emphasis>xx</emphasis> code. For a temporary error code, or for a failure to negotiate a TLS
53657 session after a success response code, what happens is controlled by the
53658 <option>tls_tempfail_tryclear</option> option of the <command>smtp</command> transport. If it is false,
53659 delivery to this host is deferred, and other hosts (if available) are tried. If
53660 it is true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis> response to
53661 STARTTLS, and if STARTTLS is accepted, but the subsequent TLS
53662 negotiation fails, Exim closes the current connection (because it is in an
53663 unknown state), opens a new one to the same host, and then tries the delivery
53664 unencrypted.
53665 </para>
53666 <para>
53667 The <option>tls_certificate</option> and <option>tls_privatekey</option> options of the <command>smtp</command>
53668 transport provide the client with a certificate, which is passed to the server
53669 if it requests it. If the server is Exim, it will request a certificate only if
53670 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> matches the client.
53671 </para>
53672 <para>
53673 If the <option>tls_verify_certificates</option> option is set on the <command>smtp</command> transport, it
53674 specifies a collection of expected server certificates.
53675 These may be
53676 the system default set (depending on library version),
53677 a file,
53678 or (depending on library version) a directory.
53679 The client verifies the server&#x2019;s certificate
53680 against this collection, taking into account any revoked certificates that are
53681 in the list defined by <option>tls_crl</option>.
53682 Failure to verify fails the TLS connection unless either of the
53683 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> options are set.
53684 </para>
53685 <para>
53686 The <option>tls_verify_hosts</option> and <option>tls_try_verify_hosts</option> options restrict
53687 certificate verification to the listed servers.  Verification either must
53688 or need not succeed respectively.
53689 </para>
53690 <para>
53691 The <command>smtp</command> transport has two OCSP-related options:
53692 <option>hosts_require_ocsp</option>; a host-list for which a Certificate Status
53693 is requested and required for the connection to proceed.  The default
53694 value is empty.
53695 <option>hosts_request_ocsp</option>; a host-list for which (additionally)
53696 a Certificate Status is requested (but not necessarily verified).  The default
53697 value is "*" meaning that requests are made unless configured
53698 otherwise.
53699 </para>
53700 <para>
53701 The host(s) should also be in <option>hosts_require_tls</option>, and
53702 <option>tls_verify_certificates</option> configured for the transport,
53703 for OCSP to be relevant.
53704 </para>
53705 <para>
53706 If
53707 <option>tls_require_ciphers</option> is set on the <command>smtp</command> transport, it must contain a
53708 list of permitted cipher suites. If either of these checks fails, delivery to
53709 the current host is abandoned, and the <command>smtp</command> transport tries to deliver to
53710 alternative hosts, if any.
53711 </para>
53712 <para>
53713  <emphasis role="bold">Note</emphasis>:
53714 These options must be set in the <command>smtp</command> transport for Exim to use TLS when it
53715 is operating as a client. Exim does not assume that a server certificate (set
53716 by the global options of the same name) should also be used when operating as a
53717 client.
53718 </para>
53719 <para>
53720 <indexterm role="variable">
53721 <primary><varname>$host</varname></primary>
53722 </indexterm>
53723 <indexterm role="variable">
53724 <primary><varname>$host_address</varname></primary>
53725 </indexterm>
53726 All the TLS options in the <command>smtp</command> transport are expanded before use, with
53727 <varname>$host</varname> and <varname>$host_address</varname> containing the name and address of the server to
53728 which the client is connected. Forced failure of an expansion causes Exim to
53729 behave as if the relevant option were unset.
53730 </para>
53731 <para>
53732 <indexterm role="variable">
53733 <primary><varname>$tls_out_bits</varname></primary>
53734 </indexterm>
53735 <indexterm role="variable">
53736 <primary><varname>$tls_out_cipher</varname></primary>
53737 </indexterm>
53738 <indexterm role="variable">
53739 <primary><varname>$tls_out_peerdn</varname></primary>
53740 </indexterm>
53741 <indexterm role="variable">
53742 <primary><varname>$tls_out_sni</varname></primary>
53743 </indexterm>
53744 Before an SMTP connection is established, the
53745 <varname>$tls_out_bits</varname>, <varname>$tls_out_cipher</varname>, <varname>$tls_out_peerdn</varname> and <varname>$tls_out_sni</varname>
53746 variables are emptied. (Until the first connection, they contain the values
53747 that were set when the message was received.) If STARTTLS is subsequently
53748 successfully obeyed, these variables are set to the relevant values for the
53749 outgoing connection.
53750 </para>
53751 </section>
53752 <section id="SECTtlssni">
53753 <title>Use of TLS Server Name Indication</title>
53754 <para>
53755 <indexterm role="concept">
53756 <primary>TLS</primary>
53757 <secondary>Server Name Indication</secondary>
53758 </indexterm>
53759 <indexterm role="variable">
53760 <primary><varname>$tls_in_sni</varname></primary>
53761 </indexterm>
53762 <indexterm role="option">
53763 <primary><option>tls_in_sni</option></primary>
53764 </indexterm>
53765 With TLS1.0 or above, there is an extension mechanism by which extra
53766 information can be included at various points in the protocol.  One of these
53767 extensions, documented in RFC 6066 (and before that RFC 4366) is
53768 <quote>Server Name Indication</quote>, commonly <quote>SNI</quote>.  This extension is sent by the
53769 client in the initial handshake, so that the server can examine the servername
53770 within and possibly choose to use different certificates and keys (and more)
53771 for this session.
53772 </para>
53773 <para>
53774 This is analogous to HTTP&#x2019;s <quote>Host:</quote> header, and is the main mechanism by
53775 which HTTPS-enabled web-sites can be virtual-hosted, many sites to one IP
53776 address.
53777 </para>
53778 <para>
53779 With SMTP to MX, there are the same problems here as in choosing the identity
53780 against which to validate a certificate: you can&#x2019;t rely on insecure DNS to
53781 provide the identity which you then cryptographically verify.  So this will
53782 be of limited use in that environment.
53783 </para>
53784 <para>
53785 With SMTP to Submission, there is a well-defined hostname which clients are
53786 connecting to and can validate certificates against.  Thus clients <emphasis role="bold">can</emphasis>
53787 choose to include this information in the TLS negotiation.  If this becomes
53788 wide-spread, then hosters can choose to present different certificates to
53789 different clients.  Or even negotiate different cipher suites.
53790 </para>
53791 <para>
53792 The <option>tls_sni</option> option on an SMTP transport is an expanded string; the result,
53793 if not empty, will be sent on a TLS session as part of the handshake.  There&#x2019;s
53794 nothing more to it.  Choosing a sensible value not derived insecurely is the
53795 only point of caution.  The <varname>$tls_out_sni</varname> variable will be set to this string
53796 for the lifetime of the client connection (including during authentication).
53797 </para>
53798 <para>
53799 Except during SMTP client sessions, if <varname>$tls_in_sni</varname> is set then it is a string
53800 received from a client.
53801 It can be logged with the <option>log_selector</option> item <literal>+tls_sni</literal>.
53802 </para>
53803 <para>
53804 If the string <literal>tls_in_sni</literal> appears in the main section&#x2019;s <option>tls_certificate</option>
53805 option (prior to expansion) then the following options will be re-expanded
53806 during TLS session handshake, to permit alternative values to be chosen:
53807 </para>
53808 <itemizedlist>
53809 <listitem>
53810 <para>
53811 <indexterm role="variable">
53812 <primary><option>tls_certificate</option></primary>
53813 </indexterm>
53814 <option>tls_certificate</option>
53815 </para>
53816 </listitem>
53817 <listitem>
53818 <para>
53819 <indexterm role="variable">
53820 <primary><option>tls_crl</option></primary>
53821 </indexterm>
53822 <option>tls_crl</option>
53823 </para>
53824 </listitem>
53825 <listitem>
53826 <para>
53827 <indexterm role="variable">
53828 <primary><option>tls_privatekey</option></primary>
53829 </indexterm>
53830 <option>tls_privatekey</option>
53831 </para>
53832 </listitem>
53833 <listitem>
53834 <para>
53835 <indexterm role="variable">
53836 <primary><option>tls_verify_certificates</option></primary>
53837 </indexterm>
53838 <option>tls_verify_certificates</option>
53839 </para>
53840 </listitem>
53841 <listitem>
53842 <para>
53843 <indexterm role="variable">
53844 <primary><option>tls_ocsp_file</option></primary>
53845 </indexterm>
53846 <option>tls_ocsp_file</option>
53847 </para>
53848 </listitem>
53849 </itemizedlist>
53850 <para>
53851 Great care should be taken to deal with matters of case, various injection
53852 attacks in the string (<literal>../</literal> or SQL), and ensuring that a valid filename
53853 can always be referenced; it is important to remember that <varname>$tls_in_sni</varname> is
53854 arbitrary unverified data provided prior to authentication.
53855 Further, the initial certificate is loaded before SNI is arrived, so
53856 an expansion for <option>tls_certificate</option> must have a default which is used
53857 when <varname>$tls_in_sni</varname> is empty.
53858 </para>
53859 <para>
53860 The Exim developers are proceeding cautiously and so far no other TLS options
53861 are re-expanded.
53862 </para>
53863 <para>
53864 When Exim is built against OpenSSL, OpenSSL must have been built with support
53865 for TLS Extensions.  This holds true for OpenSSL 1.0.0+ and 0.9.8+ with
53866 enable-tlsext in EXTRACONFIGURE.  If you invoke <command>openssl s_client -h</command> and
53867 see <literal>-servername</literal> in the output, then OpenSSL has support.
53868 </para>
53869 <para>
53870 When Exim is built against GnuTLS, SNI support is available as of GnuTLS
53871 0.5.10.  (Its presence predates the current API which Exim uses, so if Exim
53872 built, then you have SNI support).
53873 </para>
53874 </section>
53875 <section id="SECTmulmessam">
53876 <title>Multiple messages on the same encrypted TCP/IP connection</title>
53877 <para>
53878 <indexterm role="concept">
53879 <primary>multiple SMTP deliveries with TLS</primary>
53880 </indexterm>
53881 <indexterm role="concept">
53882 <primary>TLS</primary>
53883 <secondary>multiple message deliveries</secondary>
53884 </indexterm>
53885 </para>
53886 <para revisionflag="changed">
53887 Exim sends multiple messages down the same TCP/IP connection by starting up
53888 an entirely new delivery process for each message, passing the socket from
53889 one process to the next. This implementation does not fit well with the use
53890 of TLS, because there is quite a lot of state information associated with a TLS
53891 connection, not just a socket identification. Passing all the state information
53892 to a new process is not feasible. Consequently, for sending using TLS Exim
53893 starts an additional proxy process for handling the encryption, piping the
53894 unencrypted data stream from and to the delivery processes.
53895 </para>
53896 <para revisionflag="changed">
53897 An older mode of operation can be enabled on a per-host basis by the
53898 <option>hosts_noproxy_tls</option> option on the <command>smtp</command> transport.  If the host matches
53899 this list the proxy process descibed above is not used; instead Exim
53900 </para>
53901 <para>
53902 shuts down an existing TLS session being run by the delivery process
53903 before passing the socket to a new process. The new process may then
53904 try to start a new TLS session, and if successful, may try to re-authenticate
53905 if AUTH is in use, before sending the next message.
53906 </para>
53907 <para>
53908 The RFC is not clear as to whether or not an SMTP session continues in clear
53909 after TLS has been shut down, or whether TLS may be restarted again later, as
53910 just described. However, if the server is Exim, this shutdown and
53911 reinitialization works. It is not known which (if any) other servers operate
53912 successfully if the client closes a TLS session and continues with unencrypted
53913 SMTP, but there are certainly some that do not work. For such servers, Exim
53914 should not pass the socket to another process, because the failure of the
53915 subsequent attempt to use it would cause Exim to record a temporary host error,
53916 and delay other deliveries to that host.
53917 </para>
53918 <para>
53919 To test for this case, Exim sends an EHLO command to the server after
53920 closing down the TLS session. If this fails in any way, the connection is
53921 closed instead of being passed to a new delivery process, but no retry
53922 information is recorded.
53923 </para>
53924 <para>
53925 There is also a manual override; you can set <option>hosts_nopass_tls</option> on the
53926 <command>smtp</command> transport to match those hosts for which Exim should not pass
53927 connections to new processes if TLS has been used.
53928 </para>
53929 </section>
53930 <section id="SECTcerandall">
53931 <title>Certificates and all that</title>
53932 <para>
53933 <indexterm role="concept">
53934 <primary>certificate</primary>
53935 <secondary>references to discussion</secondary>
53936 </indexterm>
53937 In order to understand fully how TLS works, you need to know about
53938 certificates, certificate signing, and certificate authorities. This is not the
53939 place to give a tutorial, especially as I do not know very much about it
53940 myself. Some helpful introduction can be found in the FAQ for the SSL addition
53941 to Apache, currently at
53942 </para>
53943 <literallayout>
53944 <emphasis role="bold"><ulink url="http://www.modssl.org/docs/2.7/ssl_faq.html#ToC24">http://www.modssl.org/docs/2.7/ssl_faq.html#ToC24</ulink></emphasis>
53945 </literallayout>
53946 <para>
53947 Other parts of the <emphasis>modssl</emphasis> documentation are also helpful, and have
53948 links to further files.
53949 Eric Rescorla&#x2019;s book, <emphasis>SSL and TLS</emphasis>, published by Addison-Wesley (ISBN
53950 0-201-61598-3), contains both introductory and more in-depth descriptions.
53951 Some sample programs taken from the book are available from
53952 </para>
53953 <literallayout>
53954 <emphasis role="bold"><ulink url="http://www.rtfm.com/openssl-examples/">http://www.rtfm.com/openssl-examples/</ulink></emphasis>
53955 </literallayout>
53956 </section>
53957 <section id="SECID186">
53958 <title>Certificate chains</title>
53959 <para>
53960 The file named by <option>tls_certificate</option> may contain more than one
53961 certificate. This is useful in the case where the certificate that is being
53962 sent is validated by an intermediate certificate which the other end does
53963 not have. Multiple certificates must be in the correct order in the file.
53964 First the host&#x2019;s certificate itself, then the first intermediate
53965 certificate to validate the issuer of the host certificate, then the next
53966 intermediate certificate to validate the issuer of the first intermediate
53967 certificate, and so on, until finally (optionally) the root certificate.
53968 The root certificate must already be trusted by the recipient for
53969 validation to succeed, of course, but if it&#x2019;s not preinstalled, sending the
53970 root certificate along with the rest makes it available for the user to
53971 install if the receiving end is a client MUA that can interact with a user.
53972 </para>
53973 <para>
53974 Note that certificates using MD5 are unlikely to work on today&#x2019;s Internet;
53975 even if your libraries allow loading them for use in Exim when acting as a
53976 server, increasingly clients will not accept such certificates.  The error
53977 diagnostics in such a case can be frustratingly vague.
53978 </para>
53979 </section>
53980 <section id="SECID187">
53981 <title>Self-signed certificates</title>
53982 <para>
53983 <indexterm role="concept">
53984 <primary>certificate</primary>
53985 <secondary>self-signed</secondary>
53986 </indexterm>
53987 You can create a self-signed certificate using the <emphasis>req</emphasis> command provided
53988 with OpenSSL, like this:
53989 </para>
53990 <literallayout class="monospaced">
53991 openssl req -x509 -newkey rsa:1024 -keyout file1 -out file2 \
53992             -days 9999 -nodes
53993 </literallayout>
53994 <para>
53995 <filename>file1</filename> and <filename>file2</filename> can be the same file; the key and the certificate are
53996 delimited and so can be identified independently. The <option>-days</option> option
53997 specifies a period for which the certificate is valid. The <option>-nodes</option> option is
53998 important: if you do not set it, the key is encrypted with a passphrase
53999 that you are prompted for, and any use that is made of the key causes more
54000 prompting for the passphrase. This is not helpful if you are going to use
54001 this certificate and key in an MTA, where prompting is not possible.
54002 </para>
54003 <para>
54004 NB: we are now past the point where 9999 days takes us past the 32-bit Unix
54005 epoch.  If your system uses unsigned time_t (most do) and is 32-bit, then
54006 the above command might produce a date in the past.  Think carefully about
54007 the lifetime of the systems you&#x2019;re deploying, and either reduce the duration
54008 of the certificate or reconsider your platform deployment.  (At time of
54009 writing, reducing the duration is the most likely choice, but the inexorable
54010 progression of time takes us steadily towards an era where this will not
54011 be a sensible resolution).
54012 </para>
54013 <para>
54014 A self-signed certificate made in this way is sufficient for testing, and
54015 may be adequate for all your requirements if you are mainly interested in
54016 encrypting transfers, and not in secure identification.
54017 </para>
54018 <para>
54019 However, many clients require that the certificate presented by the server be a
54020 user (also called <quote>leaf</quote> or <quote>site</quote>) certificate, and not a self-signed
54021 certificate. In this situation, the self-signed certificate described above
54022 must be installed on the client host as a trusted root <emphasis>certification
54023 authority</emphasis> (CA), and the certificate used by Exim must be a user certificate
54024 signed with that self-signed certificate.
54025 </para>
54026 <para>
54027 For information on creating self-signed CA certificates and using them to sign
54028 user certificates, see the <emphasis>General implementation overview</emphasis> chapter of the
54029 Open-source PKI book, available online at
54030 <emphasis role="bold"><ulink url="http://ospkibook.sourceforge.net/">http://ospkibook.sourceforge.net/</ulink></emphasis>.
54031 <indexterm role="concept" startref="IIDencsmtp1" class="endofrange"/>
54032 <indexterm role="concept" startref="IIDencsmtp2" class="endofrange"/>
54033 </para>
54034 </section>
54035 </chapter>
54036
54037 <chapter id="CHAPACL">
54038 <title>Access control lists</title>
54039 <para>
54040 <indexterm role="concept" id="IIDacl" class="startofrange">
54041 <primary>access control lists (ACLs)</primary>
54042 <secondary>description</secondary>
54043 </indexterm>
54044 <indexterm role="concept">
54045 <primary>control of incoming mail</primary>
54046 </indexterm>
54047 <indexterm role="concept">
54048 <primary>message</primary>
54049 <secondary>controlling incoming</secondary>
54050 </indexterm>
54051 <indexterm role="concept">
54052 <primary>policy control</primary>
54053 <secondary>access control lists</secondary>
54054 </indexterm>
54055 Access Control Lists (ACLs) are defined in a separate section of the run time
54056 configuration file, headed by <quote>begin acl</quote>. Each ACL definition starts with a
54057 name, terminated by a colon. Here is a complete ACL section that contains just
54058 one very small ACL:
54059 </para>
54060 <literallayout class="monospaced">
54061 begin acl
54062 small_acl:
54063   accept   hosts = one.host.only
54064 </literallayout>
54065 <para>
54066 You can have as many lists as you like in the ACL section, and the order in
54067 which they appear does not matter. The lists are self-terminating.
54068 </para>
54069 <para>
54070 The majority of ACLs are used to control Exim&#x2019;s behaviour when it receives
54071 certain SMTP commands. This applies both to incoming TCP/IP connections, and
54072 when a local process submits a message using SMTP by specifying the <option>-bs</option>
54073 option. The most common use is for controlling which recipients are accepted
54074 in incoming messages. In addition, you can define an ACL that is used to check
54075 local non-SMTP messages. The default configuration file contains an example of
54076 a realistic ACL for checking RCPT commands. This is discussed in chapter
54077 <xref linkend="CHAPdefconfil"/>.
54078 </para>
54079 <section id="SECID188">
54080 <title>Testing ACLs</title>
54081 <para>
54082 The <option>-bh</option> command line option provides a way of testing your ACL
54083 configuration locally by running a fake SMTP session with which you interact.
54084 </para>
54085 </section>
54086 <section id="SECID189">
54087 <title>Specifying when ACLs are used</title>
54088 <para>
54089 <indexterm role="concept">
54090 <primary>access control lists (ACLs)</primary>
54091 <secondary>options for specifying</secondary>
54092 </indexterm>
54093 In order to cause an ACL to be used, you have to name it in one of the relevant
54094 options in the main part of the configuration. These options are:
54095 <indexterm role="concept">
54096 <primary>AUTH</primary>
54097 <secondary>ACL for</secondary>
54098 </indexterm>
54099 <indexterm role="concept">
54100 <primary>DATA</primary>
54101 <secondary>ACLs for</secondary>
54102 </indexterm>
54103 <indexterm role="concept">
54104 <primary>ETRN</primary>
54105 <secondary>ACL for</secondary>
54106 </indexterm>
54107 <indexterm role="concept">
54108 <primary>EXPN</primary>
54109 <secondary>ACL for</secondary>
54110 </indexterm>
54111 <indexterm role="concept">
54112 <primary>HELO</primary>
54113 <secondary>ACL for</secondary>
54114 </indexterm>
54115 <indexterm role="concept">
54116 <primary>EHLO</primary>
54117 <secondary>ACL for</secondary>
54118 </indexterm>
54119 <indexterm role="concept">
54120 <primary>DKIM</primary>
54121 <secondary>ACL for</secondary>
54122 </indexterm>
54123 <indexterm role="concept">
54124 <primary>MAIL</primary>
54125 <secondary>ACL for</secondary>
54126 </indexterm>
54127 <indexterm role="concept">
54128 <primary>QUIT, ACL for</primary>
54129 </indexterm>
54130 <indexterm role="concept">
54131 <primary>RCPT</primary>
54132 <secondary>ACL for</secondary>
54133 </indexterm>
54134 <indexterm role="concept">
54135 <primary>STARTTLS, ACL for</primary>
54136 </indexterm>
54137 <indexterm role="concept">
54138 <primary>VRFY</primary>
54139 <secondary>ACL for</secondary>
54140 </indexterm>
54141 <indexterm role="concept">
54142 <primary>SMTP</primary>
54143 <secondary>connection, ACL for</secondary>
54144 </indexterm>
54145 <indexterm role="concept">
54146 <primary>non-SMTP messages</primary>
54147 <secondary>ACLs for</secondary>
54148 </indexterm>
54149 <indexterm role="concept">
54150 <primary>MIME content scanning</primary>
54151 <secondary>ACL for</secondary>
54152 </indexterm>
54153 <indexterm role="concept">
54154 <primary>PRDR</primary>
54155 <secondary>ACL for</secondary>
54156 </indexterm>
54157 </para>
54158 <informaltable frame="none">
54159 <tgroup cols="2" colsep="0" rowsep="0">
54160 <colspec colwidth="140pt" align="left"/>
54161 <colspec colwidth="254pt" align="left"/>
54162 <tbody>
54163 <row>
54164 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp</option></entry>
54165 <entry>ACL for non-SMTP messages</entry>
54166 </row>
54167 <row>
54168 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp_mime</option></entry>
54169 <entry>ACL for non-SMTP MIME parts</entry>
54170 </row>
54171 <row>
54172 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp_start</option></entry>
54173 <entry>ACL at start of non-SMTP message</entry>
54174 </row>
54175 <row>
54176 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_auth</option></entry>
54177 <entry>ACL for AUTH</entry>
54178 </row>
54179 <row>
54180 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_connect</option></entry>
54181 <entry>ACL for start of SMTP connection</entry>
54182 </row>
54183 <row>
54184 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_data</option></entry>
54185 <entry>ACL after DATA is complete</entry>
54186 </row>
54187 <row>
54188 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_data_prdr</option></entry>
54189 <entry>ACL for each recipient, after DATA is complete</entry>
54190 </row>
54191 <row>
54192 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_dkim</option></entry>
54193 <entry>ACL for each DKIM signer</entry>
54194 </row>
54195 <row>
54196 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_etrn</option></entry>
54197 <entry>ACL for ETRN</entry>
54198 </row>
54199 <row>
54200 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_expn</option></entry>
54201 <entry>ACL for EXPN</entry>
54202 </row>
54203 <row>
54204 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_helo</option></entry>
54205 <entry>ACL for HELO or EHLO</entry>
54206 </row>
54207 <row>
54208 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mail</option></entry>
54209 <entry>ACL for MAIL</entry>
54210 </row>
54211 <row>
54212 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mailauth</option></entry>
54213 <entry>ACL for the AUTH parameter of MAIL</entry>
54214 </row>
54215 <row>
54216 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mime</option></entry>
54217 <entry>ACL for content-scanning MIME parts</entry>
54218 </row>
54219 <row>
54220 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_notquit</option></entry>
54221 <entry>ACL for non-QUIT terminations</entry>
54222 </row>
54223 <row>
54224 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_predata</option></entry>
54225 <entry>ACL at start of DATA command</entry>
54226 </row>
54227 <row>
54228 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_quit</option></entry>
54229 <entry>ACL for QUIT</entry>
54230 </row>
54231 <row>
54232 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_rcpt</option></entry>
54233 <entry>ACL for RCPT</entry>
54234 </row>
54235 <row>
54236 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_starttls</option></entry>
54237 <entry>ACL for STARTTLS</entry>
54238 </row>
54239 <row>
54240 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_vrfy</option></entry>
54241 <entry>ACL for VRFY</entry>
54242 </row>
54243 </tbody>
54244 </tgroup>
54245 </informaltable>
54246 <para>
54247 For example, if you set
54248 </para>
54249 <literallayout class="monospaced">
54250 acl_smtp_rcpt = small_acl
54251 </literallayout>
54252 <para>
54253 the little ACL defined above is used whenever Exim receives a RCPT command
54254 in an SMTP dialogue. The majority of policy tests on incoming messages can be
54255 done when RCPT commands arrive. A rejection of RCPT should cause the
54256 sending MTA to give up on the recipient address contained in the RCPT
54257 command, whereas rejection at other times may cause the client MTA to keep on
54258 trying to deliver the message. It is therefore recommended that you do as much
54259 testing as possible at RCPT time.
54260 </para>
54261 </section>
54262 <section id="SECID190">
54263 <title>The non-SMTP ACLs</title>
54264 <para>
54265 <indexterm role="concept">
54266 <primary>non-SMTP messages</primary>
54267 <secondary>ACLs for</secondary>
54268 </indexterm>
54269 The non-SMTP ACLs apply to all non-interactive incoming messages, that is, they
54270 apply to batched SMTP as well as to non-SMTP messages. (Batched SMTP is not
54271 really SMTP.) Many of the ACL conditions (for example, host tests, and tests on
54272 the state of the SMTP connection such as encryption and authentication) are not
54273 relevant and are forbidden in these ACLs. However, the sender and recipients
54274 are known, so the <option>senders</option> and <option>sender_domains</option> conditions and the
54275 <varname>$sender_address</varname> and <varname>$recipients</varname> variables can be used. Variables such as
54276 <varname>$authenticated_sender</varname> are also available. You can specify added header lines
54277 in any of these ACLs.
54278 </para>
54279 <para>
54280 The <option>acl_not_smtp_start</option> ACL is run right at the start of receiving a
54281 non-SMTP message, before any of the message has been read. (This is the
54282 analogue of the <option>acl_smtp_predata</option> ACL for SMTP input.) In the case of
54283 batched SMTP input, it runs after the DATA command has been reached. The
54284 result of this ACL is ignored; it cannot be used to reject a message. If you
54285 really need to, you could set a value in an ACL variable here and reject based
54286 on that in the <option>acl_not_smtp</option> ACL. However, this ACL can be used to set
54287 controls, and in particular, it can be used to set
54288 </para>
54289 <literallayout class="monospaced">
54290 control = suppress_local_fixups
54291 </literallayout>
54292 <para>
54293 This cannot be used in the other non-SMTP ACLs because by the time they are
54294 run, it is too late.
54295 </para>
54296 <para>
54297 The <option>acl_not_smtp_mime</option> ACL is available only when Exim is compiled with the
54298 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
54299 </para>
54300 <para>
54301 The <option>acl_not_smtp</option> ACL is run just before the <function>local_scan()</function> function. Any
54302 kind of rejection is treated as permanent, because there is no way of sending a
54303 temporary error for these kinds of message.
54304 </para>
54305 </section>
54306 <section id="SECID191">
54307 <title>The SMTP connect ACL</title>
54308 <para>
54309 <indexterm role="concept">
54310 <primary>SMTP</primary>
54311 <secondary>connection, ACL for</secondary>
54312 </indexterm>
54313 <indexterm role="option">
54314 <primary><option>smtp_banner</option></primary>
54315 </indexterm>
54316 The ACL test specified by <option>acl_smtp_connect</option> happens at the start of an SMTP
54317 session, after the test specified by <option>host_reject_connection</option> (which is now
54318 an anomaly) and any TCP Wrappers testing (if configured). If the connection is
54319 accepted by an <option>accept</option> verb that has a <option>message</option> modifier, the contents of
54320 the message override the banner message that is otherwise specified by the
54321 <option>smtp_banner</option> option.
54322 </para>
54323 </section>
54324 <section id="SECID192">
54325 <title>The EHLO/HELO ACL</title>
54326 <para>
54327 <indexterm role="concept">
54328 <primary>EHLO</primary>
54329 <secondary>ACL for</secondary>
54330 </indexterm>
54331 <indexterm role="concept">
54332 <primary>HELO</primary>
54333 <secondary>ACL for</secondary>
54334 </indexterm>
54335 The ACL test specified by <option>acl_smtp_helo</option> happens when the client issues an
54336 EHLO or HELO command, after the tests specified by <option>helo_accept_junk_hosts</option>,
54337 <option>helo_allow_chars</option>, <option>helo_verify_hosts</option>, and <option>helo_try_verify_hosts</option>.
54338 Note that a client may issue more than one EHLO or HELO command in an SMTP
54339 session, and indeed is required to issue a new EHLO or HELO after successfully
54340 setting up encryption following a STARTTLS command.
54341 </para>
54342 <para>
54343 Note also that a deny neither forces the client to go away nor means that
54344 mail will be refused on the connection.  Consider checking for
54345 <varname>$sender_helo_name</varname> being defined in a MAIL or RCPT ACL to do that.
54346 </para>
54347 <para>
54348 If the command is accepted by an <option>accept</option> verb that has a <option>message</option>
54349 modifier, the message may not contain more than one line (it will be truncated
54350 at the first newline and a panic logged if it does). Such a message cannot
54351 affect the EHLO options that are listed on the second and subsequent lines of
54352 an EHLO response.
54353 </para>
54354 </section>
54355 <section id="SECID193">
54356 <title>The DATA ACLs</title>
54357 <para>
54358 <indexterm role="concept">
54359 <primary>DATA</primary>
54360 <secondary>ACLs for</secondary>
54361 </indexterm>
54362 Two ACLs are associated with the DATA command, because it is two-stage
54363 command, with two responses being sent to the client.
54364 When the DATA command is received, the ACL defined by <option>acl_smtp_predata</option>
54365 is obeyed. This gives you control after all the RCPT commands, but before
54366 the message itself is received. It offers the opportunity to give a negative
54367 response to the DATA command before the data is transmitted. Header lines
54368 added by MAIL or RCPT ACLs are not visible at this time, but any that
54369 are defined here are visible when the <option>acl_smtp_data</option> ACL is run.
54370 </para>
54371 <para>
54372 You cannot test the contents of the message, for example, to verify addresses
54373 in the headers, at RCPT time or when the DATA command is received. Such
54374 tests have to appear in the ACL that is run after the message itself has been
54375 received, before the final response to the DATA command is sent. This is
54376 the ACL specified by <option>acl_smtp_data</option>, which is the second ACL that is
54377 associated with the DATA command.
54378 </para>
54379 <para>
54380 <indexterm role="concept">
54381 <primary>CHUNKING</primary>
54382 <secondary>BDAT command</secondary>
54383 </indexterm>
54384 <indexterm role="concept">
54385 <primary>BDAT</primary>
54386 <secondary>SMTP command</secondary>
54387 </indexterm>
54388 <indexterm role="concept">
54389 <primary>RFC 3030</primary>
54390 <secondary>CHUNKING</secondary>
54391 </indexterm>
54392 If CHUNKING was advertised and a BDAT command sequence is received,
54393 the <option>acl_smtp_predata</option> ACL is not run.
54394 The <option>acl_smtp_data</option> is run after the last BDAT command and all of
54395 the data specified is received.
54396 </para>
54397 <para>
54398 For both of these ACLs, it is not possible to reject individual recipients. An
54399 error response rejects the entire message. Unfortunately, it is known that some
54400 MTAs do not treat hard (5<emphasis>xx</emphasis>) responses to the DATA command (either
54401 before or after the data) correctly &ndash; they keep the message on their queues
54402 and try again later, but that is their problem, though it does waste some of
54403 your resources.
54404 </para>
54405 <para>
54406 The <option>acl_smtp_data</option> ACL is run after
54407 the <option>acl_smtp_data_prdr</option>,
54408 the <option>acl_smtp_dkim</option>
54409 and the <option>acl_smtp_mime</option> ACLs.
54410 </para>
54411 </section>
54412 <section id="SECTDKIMACL">
54413 <title>The SMTP DKIM ACL</title>
54414 <para>
54415 The <option>acl_smtp_dkim</option> ACL is available only when Exim is compiled with DKIM support
54416 enabled (which is the default).
54417 </para>
54418 <para>
54419 The ACL test specified by <option>acl_smtp_dkim</option> happens after a message has been
54420 received, and is executed for each DKIM signature found in a message.  If not
54421 otherwise specified, the default action is to accept.
54422 </para>
54423 <para>
54424 This ACL is evaluated before <option>acl_smtp_mime</option> and <option>acl_smtp_data</option>.
54425 </para>
54426 <para>
54427 For details on the operation of DKIM, see chapter <xref linkend="CHAPdkim"/>.
54428 </para>
54429 </section>
54430 <section id="SECID194">
54431 <title>The SMTP MIME ACL</title>
54432 <para>
54433 The <option>acl_smtp_mime</option> option is available only when Exim is compiled with the
54434 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
54435 </para>
54436 <para>
54437 This ACL is evaluated after <option>acl_smtp_dkim</option> but before <option>acl_smtp_data</option>.
54438 </para>
54439 </section>
54440 <section id="SECTPRDRACL">
54441 <title>The SMTP PRDR ACL</title>
54442 <para>
54443 <indexterm role="concept">
54444 <primary>PRDR</primary>
54445 <secondary>ACL for</secondary>
54446 </indexterm>
54447 <indexterm role="option">
54448 <primary><option>prdr_enable</option></primary>
54449 </indexterm>
54450 The <option>acl_smtp_data_prdr</option> ACL is available only when Exim is compiled
54451 with PRDR support enabled (which is the default).
54452 It becomes active only when the PRDR feature is negotiated between
54453 client and server for a message, and more than one recipient
54454 has been accepted.
54455 </para>
54456 <para>
54457 The ACL test specified by <option>acl_smtp_data_prdr</option> happens after a message
54458 has been received, and is executed once for each recipient of the message
54459 with <varname>$local_part</varname> and <varname>$domain</varname> valid.
54460 The test may accept, defer or deny for individual recipients.
54461 The <option>acl_smtp_data</option> will still be called after this ACL and
54462 can reject the message overall, even if this ACL has accepted it
54463 for some or all recipients.
54464 </para>
54465 <para>
54466 PRDR may be used to support per-user content filtering.  Without it
54467 one must defer any recipient after the first that has a different
54468 content-filter configuration.  With PRDR, the RCPT-time check
54469 <indexterm role="concept">
54470 <primary>PRDR</primary>
54471 <secondary>variable for</secondary>
54472 </indexterm>
54473 for this can be disabled when the variable <varname>$prdr_requested</varname>
54474 is <quote>yes</quote>.
54475 Any required difference in behaviour of the main DATA-time
54476 ACL should however depend on the PRDR-time ACL having run, as Exim
54477 will avoid doing so in some situations (e.g.  single-recipient mails).
54478 </para>
54479 <para>
54480 See also the <option>prdr_enable</option> global option
54481 and the <option>hosts_try_prdr</option> smtp transport option.
54482 </para>
54483 <para>
54484 This ACL is evaluated after <option>acl_smtp_dkim</option> but before <option>acl_smtp_data</option>.
54485 If the ACL is not defined, processing completes as if
54486 the feature was not requested by the client.
54487 </para>
54488 </section>
54489 <section id="SECTQUITACL">
54490 <title>The QUIT ACL</title>
54491 <para>
54492 <indexterm role="concept">
54493 <primary>QUIT, ACL for</primary>
54494 </indexterm>
54495 The ACL for the SMTP QUIT command is anomalous, in that the outcome of the ACL
54496 does not affect the response code to QUIT, which is always 221. Thus, the ACL
54497 does not in fact control any access.
54498 For this reason, it may only accept
54499 or warn as its final result.
54500 </para>
54501 <para>
54502 This ACL can be used for tasks such as custom logging at the end of an SMTP
54503 session. For example, you can use ACL variables in other ACLs to count
54504 messages, recipients, etc., and log the totals at QUIT time using one or
54505 more <option>logwrite</option> modifiers on a <option>warn</option> verb.
54506 </para>
54507 <para>
54508 <emphasis role="bold">Warning</emphasis>: Only the <varname>$acl_c</varname><emphasis>x</emphasis> variables can be used for this, because
54509 the <varname>$acl_m</varname><emphasis>x</emphasis> variables are reset at the end of each incoming message.
54510 </para>
54511 <para>
54512 You do not need to have a final <option>accept</option>, but if you do, you can use a
54513 <option>message</option> modifier to specify custom text that is sent as part of the 221
54514 response to QUIT.
54515 </para>
54516 <para>
54517 This ACL is run only for a <quote>normal</quote> QUIT. For certain kinds of disastrous
54518 failure (for example, failure to open a log file, or when Exim is bombing out
54519 because it has detected an unrecoverable error), all SMTP commands from the
54520 client are given temporary error responses until QUIT is received or the
54521 connection is closed. In these special cases, the QUIT ACL does not run.
54522 </para>
54523 </section>
54524 <section id="SECTNOTQUITACL">
54525 <title>The not-QUIT ACL</title>
54526 <para>
54527 <indexterm role="variable">
54528 <primary><varname>$acl_smtp_notquit</varname></primary>
54529 </indexterm>
54530 The not-QUIT ACL, specified by <option>acl_smtp_notquit</option>, is run in most cases when
54531 an SMTP session ends without sending QUIT. However, when Exim itself is in bad
54532 trouble, such as being unable to write to its log files, this ACL is not run,
54533 because it might try to do things (such as write to log files) that make the
54534 situation even worse.
54535 </para>
54536 <para>
54537 Like the QUIT ACL, this ACL is provided to make it possible to do customized
54538 logging or to gather statistics, and its outcome is ignored. The <option>delay</option>
54539 modifier is forbidden in this ACL, and the only permitted verbs are <option>accept</option>
54540 and <option>warn</option>.
54541 </para>
54542 <para>
54543 <indexterm role="variable">
54544 <primary><varname>$smtp_notquit_reason</varname></primary>
54545 </indexterm>
54546 When the not-QUIT ACL is running, the variable <varname>$smtp_notquit_reason</varname> is set
54547 to a string that indicates the reason for the termination of the SMTP
54548 connection. The possible values are:
54549 </para>
54550 <informaltable frame="none">
54551 <tgroup cols="2" colsep="0" rowsep="0">
54552 <colspec colwidth="196pt" align="left"/>
54553 <colspec colwidth="254pt" align="left"/>
54554 <tbody>
54555 <row>
54556 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>acl-drop</literal></entry>
54557 <entry>Another ACL issued a <option>drop</option> command</entry>
54558 </row>
54559 <row>
54560 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>bad-commands</literal></entry>
54561 <entry>Too many unknown or non-mail commands</entry>
54562 </row>
54563 <row>
54564 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>command-timeout</literal></entry>
54565 <entry>Timeout while reading SMTP commands</entry>
54566 </row>
54567 <row>
54568 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>connection-lost</literal></entry>
54569 <entry>The SMTP connection has been lost</entry>
54570 </row>
54571 <row>
54572 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>data-timeout</literal></entry>
54573 <entry>Timeout while reading message data</entry>
54574 </row>
54575 <row>
54576 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>local-scan-error</literal></entry>
54577 <entry>The <function>local_scan()</function> function crashed</entry>
54578 </row>
54579 <row>
54580 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>local-scan-timeout</literal></entry>
54581 <entry>The <function>local_scan()</function> function timed out</entry>
54582 </row>
54583 <row>
54584 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>signal-exit</literal></entry>
54585 <entry>SIGTERM or SIGINT</entry>
54586 </row>
54587 <row>
54588 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>synchronization-error</literal></entry>
54589 <entry>SMTP synchronization error</entry>
54590 </row>
54591 <row>
54592 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>tls-failed</literal></entry>
54593 <entry>TLS failed to start</entry>
54594 </row>
54595 </tbody>
54596 </tgroup>
54597 </informaltable>
54598 <para>
54599 In most cases when an SMTP connection is closed without having received QUIT,
54600 Exim sends an SMTP response message before actually closing the connection.
54601 With the exception of the <literal>acl-drop</literal> case, the default message can be
54602 overridden by the <option>message</option> modifier in the not-QUIT ACL. In the case of a
54603 <option>drop</option> verb in another ACL, it is the message from the other ACL that is
54604 used.
54605 </para>
54606 </section>
54607 <section id="SECID195">
54608 <title>Finding an ACL to use</title>
54609 <para>
54610 <indexterm role="concept">
54611 <primary>access control lists (ACLs)</primary>
54612 <secondary>finding which to use</secondary>
54613 </indexterm>
54614 The value of an <option>acl_smtp_</option><emphasis>xxx</emphasis> option is expanded before use, so
54615 you can use different ACLs in different circumstances. For example,
54616 </para>
54617 <literallayout class="monospaced">
54618 acl_smtp_rcpt = ${if ={25}{$interface_port} \
54619                      {acl_check_rcpt} {acl_check_rcpt_submit} }
54620 </literallayout>
54621 <para>
54622 In the default configuration file there are some example settings for
54623 providing an RFC 4409 message submission service on port 587 and a
54624 non-standard <quote>smtps</quote> service on port 465. You can use a string
54625 expansion like this to choose an ACL for MUAs on these ports which is
54626 more appropriate for this purpose than the default ACL on port 25.
54627 </para>
54628 <para>
54629 The expanded string does not have to be the name of an ACL in the
54630 configuration file; there are other possibilities. Having expanded the
54631 string, Exim searches for an ACL as follows:
54632 </para>
54633 <itemizedlist>
54634 <listitem>
54635 <para>
54636 If the string begins with a slash, Exim uses it as a file name, and reads its
54637 contents as an ACL. The lines are processed in the same way as lines in the
54638 Exim configuration file. In particular, continuation lines are supported, blank
54639 lines are ignored, as are lines whose first non-whitespace character is <quote>#</quote>.
54640 If the file does not exist or cannot be read, an error occurs (typically
54641 causing a temporary failure of whatever caused the ACL to be run). For example:
54642 </para>
54643 <literallayout class="monospaced">
54644 acl_smtp_data = /etc/acls/\
54645   ${lookup{$sender_host_address}lsearch\
54646   {/etc/acllist}{$value}{default}}
54647 </literallayout>
54648 <para>
54649 This looks up an ACL file to use on the basis of the host&#x2019;s IP address, falling
54650 back to a default if the lookup fails. If an ACL is successfully read from a
54651 file, it is retained in memory for the duration of the Exim process, so that it
54652 can be re-used without having to re-read the file.
54653 </para>
54654 </listitem>
54655 <listitem>
54656 <para>
54657 If the string does not start with a slash, and does not contain any spaces,
54658 Exim searches the ACL section of the configuration for an ACL whose name
54659 matches the string.
54660 </para>
54661 </listitem>
54662 <listitem>
54663 <para>
54664 If no named ACL is found, or if the string contains spaces, Exim parses
54665 the string as an inline ACL. This can save typing in cases where you just
54666 want to have something like
54667 </para>
54668 <literallayout class="monospaced">
54669 acl_smtp_vrfy = accept
54670 </literallayout>
54671 <para>
54672 in order to allow free use of the VRFY command. Such a string may contain
54673 newlines; it is processed in the same way as an ACL that is read from a file.
54674 </para>
54675 </listitem>
54676 </itemizedlist>
54677 </section>
54678 <section id="SECID196">
54679 <title>ACL return codes</title>
54680 <para>
54681 <indexterm role="concept">
54682 <primary>access control lists (ACLs)</primary>
54683 <secondary>return codes</secondary>
54684 </indexterm>
54685 Except for the QUIT ACL, which does not affect the SMTP return code (see
54686 section <xref linkend="SECTQUITACL"/> above), the result of running an ACL is either
54687 <quote>accept</quote> or <quote>deny</quote>, or, if some test cannot be completed (for example, if a
54688 database is down), <quote>defer</quote>. These results cause 2<emphasis>xx</emphasis>, 5<emphasis>xx</emphasis>, and 4<emphasis>xx</emphasis>
54689 return codes, respectively, to be used in the SMTP dialogue. A fourth return,
54690 <quote>error</quote>, occurs when there is an error such as invalid syntax in the ACL.
54691 This also causes a 4<emphasis>xx</emphasis> return code.
54692 </para>
54693 <para>
54694 For the non-SMTP ACL, <quote>defer</quote> and <quote>error</quote> are treated in the same way as
54695 <quote>deny</quote>, because there is no mechanism for passing temporary errors to the
54696 submitters of non-SMTP messages.
54697 </para>
54698 <para>
54699 ACLs that are relevant to message reception may also return <quote>discard</quote>. This
54700 has the effect of <quote>accept</quote>, but causes either the entire message or an
54701 individual recipient address to be discarded. In other words, it is a
54702 blackholing facility. Use it with care.
54703 </para>
54704 <para>
54705 If the ACL for MAIL returns <quote>discard</quote>, all recipients are discarded, and no
54706 ACL is run for subsequent RCPT commands. The effect of <quote>discard</quote> in a
54707 RCPT ACL is to discard just the one recipient address. If there are no
54708 recipients left when the message&#x2019;s data is received, the DATA ACL is not
54709 run. A <quote>discard</quote> return from the DATA or the non-SMTP ACL discards all the
54710 remaining recipients. The <quote>discard</quote> return is not permitted for the
54711 <option>acl_smtp_predata</option> ACL.
54712 </para>
54713 <para>
54714 If the ACL for VRFY returns <quote>accept</quote>, a recipient verify (without callout)
54715 is done on the address and the result determines the SMTP response.
54716 </para>
54717 <para>
54718 <indexterm role="concept">
54719 <primary><function>local_scan()</function> function</primary>
54720 <secondary>when all recipients discarded</secondary>
54721 </indexterm>
54722 The <function>local_scan()</function> function is always run, even if there are no remaining
54723 recipients; it may create new recipients.
54724 </para>
54725 </section>
54726 <section id="SECID197">
54727 <title>Unset ACL options</title>
54728 <para>
54729 <indexterm role="concept">
54730 <primary>access control lists (ACLs)</primary>
54731 <secondary>unset options</secondary>
54732 </indexterm>
54733 The default actions when any of the <option>acl_</option><emphasis>xxx</emphasis> options are unset are not
54734 all the same. <emphasis role="bold">Note</emphasis>: These defaults apply only when the relevant ACL is
54735 not defined at all. For any defined ACL, the default action when control
54736 reaches the end of the ACL statements is <quote>deny</quote>.
54737 </para>
54738 <para>
54739 For <option>acl_smtp_quit</option> and <option>acl_not_smtp_start</option> there is no default because
54740 these two are ACLs that are used only for their side effects. They cannot be
54741 used to accept or reject anything.
54742 </para>
54743 <para>
54744 For <option>acl_not_smtp</option>, <option>acl_smtp_auth</option>, <option>acl_smtp_connect</option>,
54745 <option>acl_smtp_data</option>, <option>acl_smtp_helo</option>, <option>acl_smtp_mail</option>, <option>acl_smtp_mailauth</option>,
54746 <option>acl_smtp_mime</option>, <option>acl_smtp_predata</option>, and <option>acl_smtp_starttls</option>, the action
54747 when the ACL is not defined is <quote>accept</quote>.
54748 </para>
54749 <para>
54750 For the others (<option>acl_smtp_etrn</option>, <option>acl_smtp_expn</option>, <option>acl_smtp_rcpt</option>, and
54751 <option>acl_smtp_vrfy</option>), the action when the ACL is not defined is <quote>deny</quote>.
54752 This means that <option>acl_smtp_rcpt</option> must be defined in order to receive any
54753 messages over an SMTP connection. For an example, see the ACL in the default
54754 configuration file.
54755 </para>
54756 </section>
54757 <section id="SECID198">
54758 <title>Data for message ACLs</title>
54759 <para>
54760 <indexterm role="concept">
54761 <primary>access control lists (ACLs)</primary>
54762 <secondary>data for message ACL</secondary>
54763 </indexterm>
54764 <indexterm role="variable">
54765 <primary><varname>$domain</varname></primary>
54766 </indexterm>
54767 <indexterm role="variable">
54768 <primary><varname>$local_part</varname></primary>
54769 </indexterm>
54770 <indexterm role="variable">
54771 <primary><varname>$sender_address</varname></primary>
54772 </indexterm>
54773 <indexterm role="variable">
54774 <primary><varname>$sender_host_address</varname></primary>
54775 </indexterm>
54776 <indexterm role="variable">
54777 <primary><varname>$smtp_command</varname></primary>
54778 </indexterm>
54779 When a MAIL or RCPT ACL, or either of the DATA ACLs, is running, the variables
54780 that contain information about the host and the message&#x2019;s sender (for example,
54781 <varname>$sender_host_address</varname> and <varname>$sender_address</varname>) are set, and can be used in ACL
54782 statements. In the case of RCPT (but not MAIL or DATA), <varname>$domain</varname> and
54783 <varname>$local_part</varname> are set from the argument address. The entire SMTP command
54784 is available in <varname>$smtp_command</varname>.
54785 </para>
54786 <para>
54787 When an ACL for the AUTH parameter of MAIL is running, the variables that
54788 contain information about the host are set, but <varname>$sender_address</varname> is not yet
54789 set. Section <xref linkend="SECTauthparamail"/> contains a discussion of this parameter and
54790 how it is used.
54791 </para>
54792 <para>
54793 <indexterm role="variable">
54794 <primary><varname>$message_size</varname></primary>
54795 </indexterm>
54796 The <varname>$message_size</varname> variable is set to the value of the SIZE parameter on
54797 the MAIL command at MAIL, RCPT and pre-data time, or to -1 if
54798 that parameter is not given. The value is updated to the true message size by
54799 the time the final DATA ACL is run (after the message data has been
54800 received).
54801 </para>
54802 <para>
54803 <indexterm role="variable">
54804 <primary><varname>$rcpt_count</varname></primary>
54805 </indexterm>
54806 <indexterm role="variable">
54807 <primary><varname>$recipients_count</varname></primary>
54808 </indexterm>
54809 The <varname>$rcpt_count</varname> variable increases by one for each RCPT command received.
54810 The <varname>$recipients_count</varname> variable increases by one each time a RCPT command is
54811 accepted, so while an ACL for RCPT is being processed, it contains the number
54812 of previously accepted recipients. At DATA time (for both the DATA ACLs),
54813 <varname>$rcpt_count</varname> contains the total number of RCPT commands, and
54814 <varname>$recipients_count</varname> contains the total number of accepted recipients.
54815 </para>
54816 </section>
54817 <section id="SECTdatfornon">
54818 <title>Data for non-message ACLs</title>
54819 <para>
54820 <indexterm role="concept">
54821 <primary>access control lists (ACLs)</primary>
54822 <secondary>data for non-message ACL</secondary>
54823 </indexterm>
54824 <indexterm role="variable">
54825 <primary><varname>$smtp_command_argument</varname></primary>
54826 </indexterm>
54827 <indexterm role="variable">
54828 <primary><varname>$smtp_command</varname></primary>
54829 </indexterm>
54830 When an ACL is being run for AUTH, EHLO, ETRN, EXPN, HELO, STARTTLS, or VRFY,
54831 the remainder of the SMTP command line is placed in <varname>$smtp_command_argument</varname>,
54832 and the entire SMTP command is available in <varname>$smtp_command</varname>.
54833 These variables can be tested using a <option>condition</option> condition. For example,
54834 here is an ACL for use with AUTH, which insists that either the session is
54835 encrypted, or the CRAM-MD5 authentication method is used. In other words, it
54836 does not permit authentication methods that use cleartext passwords on
54837 unencrypted connections.
54838 </para>
54839 <literallayout class="monospaced">
54840 acl_check_auth:
54841   accept encrypted = *
54842   accept condition = ${if eq{${uc:$smtp_command_argument}}\
54843                      {CRAM-MD5}}
54844   deny   message   = TLS encryption or CRAM-MD5 required
54845 </literallayout>
54846 <para>
54847 (Another way of applying this restriction is to arrange for the authenticators
54848 that use cleartext passwords not to be advertised when the connection is not
54849 encrypted. You can use the generic <option>server_advertise_condition</option> authenticator
54850 option to do this.)
54851 </para>
54852 </section>
54853 <section id="SECID199">
54854 <title>Format of an ACL</title>
54855 <para>
54856 <indexterm role="concept">
54857 <primary>access control lists (ACLs)</primary>
54858 <secondary>format of</secondary>
54859 </indexterm>
54860 <indexterm role="concept">
54861 <primary>access control lists (ACLs)</primary>
54862 <secondary>verbs, definition of</secondary>
54863 </indexterm>
54864 An individual ACL consists of a number of statements. Each statement starts
54865 with a verb, optionally followed by a number of conditions and <quote>modifiers</quote>.
54866 Modifiers can change the way the verb operates, define error and log messages,
54867 set variables, insert delays, and vary the processing of accepted messages.
54868 </para>
54869 <para>
54870 If all the conditions are met, the verb is obeyed. The same condition may be
54871 used (with different arguments) more than once in the same statement. This
54872 provides a means of specifying an <quote>and</quote> conjunction between conditions. For
54873 example:
54874 </para>
54875 <literallayout class="monospaced">
54876 deny  dnslists = list1.example
54877       dnslists = list2.example
54878 </literallayout>
54879 <para>
54880 If there are no conditions, the verb is always obeyed. Exim stops evaluating
54881 the conditions and modifiers when it reaches a condition that fails. What
54882 happens then depends on the verb (and in one case, on a special modifier). Not
54883 all the conditions make sense at every testing point. For example, you cannot
54884 test a sender address in the ACL that is run for a VRFY command.
54885 </para>
54886 </section>
54887 <section id="SECID200">
54888 <title>ACL verbs</title>
54889 <para>
54890 The ACL verbs are as follows:
54891 </para>
54892 <itemizedlist>
54893 <listitem>
54894 <para>
54895 <indexterm role="concept">
54896 <primary><option>accept</option> ACL verb</primary>
54897 </indexterm>
54898 <option>accept</option>: If all the conditions are met, the ACL returns <quote>accept</quote>. If any
54899 of the conditions are not met, what happens depends on whether <option>endpass</option>
54900 appears among the conditions (for syntax see below). If the failing condition
54901 is before <option>endpass</option>, control is passed to the next ACL statement; if it is
54902 after <option>endpass</option>, the ACL returns <quote>deny</quote>. Consider this statement, used to
54903 check a RCPT command:
54904 </para>
54905 <literallayout class="monospaced">
54906 accept domains = +local_domains
54907        endpass
54908        verify = recipient
54909 </literallayout>
54910 <para>
54911 If the recipient domain does not match the <option>domains</option> condition, control
54912 passes to the next statement. If it does match, the recipient is verified, and
54913 the command is accepted if verification succeeds. However, if verification
54914 fails, the ACL yields <quote>deny</quote>, because the failing condition is after
54915 <option>endpass</option>.
54916 </para>
54917 <para>
54918 The <option>endpass</option> feature has turned out to be confusing to many people, so its
54919 use is not recommended nowadays. It is always possible to rewrite an ACL so
54920 that <option>endpass</option> is not needed, and it is no longer used in the default
54921 configuration.
54922 </para>
54923 <para>
54924 <indexterm role="concept">
54925 <primary><option>message</option> ACL modifier</primary>
54926 <secondary>with <option>accept</option></secondary>
54927 </indexterm>
54928 If a <option>message</option> modifier appears on an <option>accept</option> statement, its action
54929 depends on whether or not <option>endpass</option> is present. In the absence of <option>endpass</option>
54930 (when an <option>accept</option> verb either accepts or passes control to the next
54931 statement), <option>message</option> can be used to vary the message that is sent when an
54932 SMTP command is accepted. For example, in a RCPT ACL you could have:
54933 </para>
54934 <literallayout>
54935 <literal>accept  </literal>&lt;<emphasis>some conditions</emphasis>&gt;
54936 <literal>        message = OK, I will allow you through today</literal>
54937 </literallayout>
54938 <para>
54939 You can specify an SMTP response code, optionally followed by an <quote>extended
54940 response code</quote> at the start of the message, but the first digit must be the
54941 same as would be sent by default, which is 2 for an <option>accept</option> verb.
54942 </para>
54943 <para>
54944 If <option>endpass</option> is present in an <option>accept</option> statement, <option>message</option> specifies
54945 an error message that is used when access is denied. This behaviour is retained
54946 for backward compatibility, but current <quote>best practice</quote> is to avoid the use
54947 of <option>endpass</option>.
54948 </para>
54949 </listitem>
54950 <listitem>
54951 <para>
54952 <indexterm role="concept">
54953 <primary><option>defer</option> ACL verb</primary>
54954 </indexterm>
54955 <option>defer</option>: If all the conditions are true, the ACL returns <quote>defer</quote> which, in
54956 an SMTP session, causes a 4<emphasis>xx</emphasis> response to be given. For a non-SMTP ACL,
54957 <option>defer</option> is the same as <option>deny</option>, because there is no way of sending a
54958 temporary error. For a RCPT command, <option>defer</option> is much the same as using a
54959 <command>redirect</command> router and <literal>:defer:</literal> while verifying, but the <option>defer</option> verb can
54960 be used in any ACL, and even for a recipient it might be a simpler approach.
54961 </para>
54962 </listitem>
54963 <listitem>
54964 <para>
54965 <indexterm role="concept">
54966 <primary><option>deny</option> ACL verb</primary>
54967 </indexterm>
54968 <option>deny</option>: If all the conditions are met, the ACL returns <quote>deny</quote>. If any of
54969 the conditions are not met, control is passed to the next ACL statement. For
54970 example,
54971 </para>
54972 <literallayout class="monospaced">
54973 deny dnslists = blackholes.mail-abuse.org
54974 </literallayout>
54975 <para>
54976 rejects commands from hosts that are on a DNS black list.
54977 </para>
54978 </listitem>
54979 <listitem>
54980 <para>
54981 <indexterm role="concept">
54982 <primary><option>discard</option> ACL verb</primary>
54983 </indexterm>
54984 <option>discard</option>: This verb behaves like <option>accept</option>, except that it returns
54985 <quote>discard</quote> from the ACL instead of <quote>accept</quote>. It is permitted only on ACLs
54986 that are concerned with receiving messages. When all the conditions are true,
54987 the sending entity receives a <quote>success</quote> response. However, <option>discard</option> causes
54988 recipients to be discarded. If it is used in an ACL for RCPT, just the one
54989 recipient is discarded; if used for MAIL, DATA or in the non-SMTP ACL, all the
54990 message&#x2019;s recipients are discarded. Recipients that are discarded before DATA
54991 do not appear in the log line when the <option>received_recipients</option> log selector is set.
54992 </para>
54993 <para>
54994 If the <option>log_message</option> modifier is set when <option>discard</option> operates,
54995 its contents are added to the line that is automatically written to the log.
54996 The <option>message</option> modifier operates exactly as it does for <option>accept</option>.
54997 </para>
54998 </listitem>
54999 <listitem>
55000 <para>
55001 <indexterm role="concept">
55002 <primary><option>drop</option> ACL verb</primary>
55003 </indexterm>
55004 <option>drop</option>: This verb behaves like <option>deny</option>, except that an SMTP connection is
55005 forcibly closed after the 5<emphasis>xx</emphasis> error message has been sent. For example:
55006 </para>
55007 <literallayout class="monospaced">
55008 drop   message   = I don't take more than 20 RCPTs
55009        condition = ${if &gt; {$rcpt_count}{20}}
55010 </literallayout>
55011 <para>
55012 There is no difference between <option>deny</option> and <option>drop</option> for the connect-time ACL.
55013 The connection is always dropped after sending a 550 response.
55014 </para>
55015 </listitem>
55016 <listitem>
55017 <para>
55018 <indexterm role="concept">
55019 <primary><option>require</option> ACL verb</primary>
55020 </indexterm>
55021 <option>require</option>: If all the conditions are met, control is passed to the next ACL
55022 statement. If any of the conditions are not met, the ACL returns <quote>deny</quote>. For
55023 example, when checking a RCPT command,
55024 </para>
55025 <literallayout class="monospaced">
55026 require message = Sender did not verify
55027         verify  = sender
55028 </literallayout>
55029 <para>
55030 passes control to subsequent statements only if the message&#x2019;s sender can be
55031 verified. Otherwise, it rejects the command. Note the positioning of the
55032 <option>message</option> modifier, before the <option>verify</option> condition. The reason for this is
55033 discussed in section <xref linkend="SECTcondmodproc"/>.
55034 </para>
55035 </listitem>
55036 <listitem>
55037 <para>
55038 <indexterm role="concept">
55039 <primary><option>warn</option> ACL verb</primary>
55040 </indexterm>
55041 <option>warn</option>: If all the conditions are true, a line specified by the
55042 <option>log_message</option> modifier is written to Exim&#x2019;s main log. Control always passes
55043 to the next ACL statement. If any condition is false, the log line is not
55044 written. If an identical log line is requested several times in the same
55045 message, only one copy is actually written to the log. If you want to force
55046 duplicates to be written, use the <option>logwrite</option> modifier instead.
55047 </para>
55048 <para>
55049 If <option>log_message</option> is not present, a <option>warn</option> verb just checks its conditions
55050 and obeys any <quote>immediate</quote> modifiers (such as <option>control</option>, <option>set</option>,
55051 <option>logwrite</option>, <option>add_header</option>, and <option>remove_header</option>) that appear before the
55052 first failing condition. There is more about adding header lines in section
55053 <xref linkend="SECTaddheadacl"/>.
55054 </para>
55055 <para>
55056 If any condition on a <option>warn</option> statement cannot be completed (that is, there is
55057 some sort of defer), the log line specified by <option>log_message</option> is not written.
55058 This does not include the case of a forced failure from a lookup, which
55059 is considered to be a successful completion. After a defer, no further
55060 conditions or modifiers in the <option>warn</option> statement are processed. The incident
55061 is logged, and the ACL continues to be processed, from the next statement
55062 onwards.
55063 </para>
55064 <para>
55065 <indexterm role="variable">
55066 <primary><varname>$acl_verify_message</varname></primary>
55067 </indexterm>
55068 When one of the <option>warn</option> conditions is an address verification that fails, the
55069 text of the verification failure message is in <varname>$acl_verify_message</varname>. If you
55070 want this logged, you must set it up explicitly. For example:
55071 </para>
55072 <literallayout class="monospaced">
55073 warn   !verify = sender
55074        log_message = sender verify failed: $acl_verify_message
55075 </literallayout>
55076 </listitem>
55077 </itemizedlist>
55078 <para>
55079 At the end of each ACL there is an implicit unconditional <option>deny</option>.
55080 </para>
55081 <para>
55082 As you can see from the examples above, the conditions and modifiers are
55083 written one to a line, with the first one on the same line as the verb, and
55084 subsequent ones on following lines. If you have a very long condition, you can
55085 continue it onto several physical lines by the usual backslash continuation
55086 mechanism. It is conventional to align the conditions vertically.
55087 </para>
55088 </section>
55089 <section id="SECTaclvariables">
55090 <title>ACL variables</title>
55091 <para>
55092 <indexterm role="concept">
55093 <primary>access control lists (ACLs)</primary>
55094 <secondary>variables</secondary>
55095 </indexterm>
55096 There are some special variables that can be set during ACL processing. They
55097 can be used to pass information between different ACLs, different invocations
55098 of the same ACL in the same SMTP connection, and between ACLs and the routers,
55099 transports, and filters that are used to deliver a message. The names of these
55100 variables must begin with <varname>$acl_c</varname> or <varname>$acl_m</varname>, followed either by a digit or
55101 an underscore, but the remainder of the name can be any sequence of
55102 alphanumeric characters and underscores that you choose. There is no limit on
55103 the number of ACL variables. The two sets act as follows:
55104 </para>
55105 <itemizedlist>
55106 <listitem>
55107 <para>
55108 The values of those variables whose names begin with <varname>$acl_c</varname> persist
55109 throughout an SMTP connection. They are never reset. Thus, a value that is set
55110 while receiving one message is still available when receiving the next message
55111 on the same SMTP connection.
55112 </para>
55113 </listitem>
55114 <listitem>
55115 <para>
55116 The values of those variables whose names begin with <varname>$acl_m</varname> persist only
55117 while a message is being received. They are reset afterwards. They are also
55118 reset by MAIL, RSET, EHLO, HELO, and after starting up a TLS session.
55119 </para>
55120 </listitem>
55121 </itemizedlist>
55122 <para>
55123 When a message is accepted, the current values of all the ACL variables are
55124 preserved with the message and are subsequently made available at delivery
55125 time. The ACL variables are set by a modifier called <option>set</option>. For example:
55126 </para>
55127 <literallayout class="monospaced">
55128 accept hosts = whatever
55129        set acl_m4 = some value
55130 accept authenticated = *
55131        set acl_c_auth = yes
55132 </literallayout>
55133 <para>
55134 <emphasis role="bold">Note</emphasis>: A leading dollar sign is not used when naming a variable that is to
55135 be set. If you want to set a variable without taking any action, you can use a
55136 <option>warn</option> verb without any other modifiers or conditions.
55137 </para>
55138 <para>
55139 <indexterm role="option">
55140 <primary><option>strict_acl_vars</option></primary>
55141 </indexterm>
55142 What happens if a syntactically valid but undefined ACL variable is
55143 referenced depends on the setting of the <option>strict_acl_vars</option> option. If it is
55144 false (the default), an empty string is substituted; if it is true, an
55145 error is generated.
55146 </para>
55147 <para>
55148 Versions of Exim before 4.64 have a limited set of numbered variables, but
55149 their names are compatible, so there is no problem with upgrading.
55150 </para>
55151 </section>
55152 <section id="SECTcondmodproc">
55153 <title>Condition and modifier processing</title>
55154 <para>
55155 <indexterm role="concept">
55156 <primary>access control lists (ACLs)</primary>
55157 <secondary>conditions; processing</secondary>
55158 </indexterm>
55159 <indexterm role="concept">
55160 <primary>access control lists (ACLs)</primary>
55161 <secondary>modifiers; processing</secondary>
55162 </indexterm>
55163 An exclamation mark preceding a condition negates its result. For example:
55164 </para>
55165 <literallayout class="monospaced">
55166 deny   domains = *.dom.example
55167       !verify  = recipient
55168 </literallayout>
55169 <para>
55170 causes the ACL to return <quote>deny</quote> if the recipient domain ends in
55171 <emphasis>dom.example</emphasis> and the recipient address cannot be verified. Sometimes
55172 negation can be used on the right-hand side of a condition. For example, these
55173 two statements are equivalent:
55174 </para>
55175 <literallayout class="monospaced">
55176 deny  hosts = !192.168.3.4
55177 deny !hosts =  192.168.3.4
55178 </literallayout>
55179 <para>
55180 However, for many conditions (<option>verify</option> being a good example), only left-hand
55181 side negation of the whole condition is possible.
55182 </para>
55183 <para>
55184 The arguments of conditions and modifiers are expanded. A forced failure
55185 of an expansion causes a condition to be ignored, that is, it behaves as if the
55186 condition is true. Consider these two statements:
55187 </para>
55188 <literallayout class="monospaced">
55189 accept  senders = ${lookup{$host_name}lsearch\
55190                   {/some/file}{$value}fail}
55191 accept  senders = ${lookup{$host_name}lsearch\
55192                   {/some/file}{$value}{}}
55193 </literallayout>
55194 <para>
55195 Each attempts to look up a list of acceptable senders. If the lookup succeeds,
55196 the returned list is searched, but if the lookup fails the behaviour is
55197 different in the two cases. The <option>fail</option> in the first statement causes the
55198 condition to be ignored, leaving no further conditions. The <option>accept</option> verb
55199 therefore succeeds. The second statement, however, generates an empty list when
55200 the lookup fails. No sender can match an empty list, so the condition fails,
55201 and therefore the <option>accept</option> also fails.
55202 </para>
55203 <para>
55204 ACL modifiers appear mixed in with conditions in ACL statements. Some of them
55205 specify actions that are taken as the conditions for a statement are checked;
55206 others specify text for messages that are used when access is denied or a
55207 warning is generated. The <option>control</option> modifier affects the way an incoming
55208 message is handled.
55209 </para>
55210 <para>
55211 The positioning of the modifiers in an ACL statement is important, because the
55212 processing of a verb ceases as soon as its outcome is known. Only those
55213 modifiers that have already been encountered will take effect. For example,
55214 consider this use of the <option>message</option> modifier:
55215 </para>
55216 <literallayout class="monospaced">
55217 require message = Can't verify sender
55218         verify  = sender
55219         message = Can't verify recipient
55220         verify  = recipient
55221         message = This message cannot be used
55222 </literallayout>
55223 <para>
55224 If sender verification fails, Exim knows that the result of the statement is
55225 <quote>deny</quote>, so it goes no further. The first <option>message</option> modifier has been seen,
55226 so its text is used as the error message. If sender verification succeeds, but
55227 recipient verification fails, the second message is used. If recipient
55228 verification succeeds, the third message becomes <quote>current</quote>, but is never used
55229 because there are no more conditions to cause failure.
55230 </para>
55231 <para>
55232 For the <option>deny</option> verb, on the other hand, it is always the last <option>message</option>
55233 modifier that is used, because all the conditions must be true for rejection to
55234 happen. Specifying more than one <option>message</option> modifier does not make sense, and
55235 the message can even be specified after all the conditions. For example:
55236 </para>
55237 <literallayout class="monospaced">
55238 deny   hosts = ...
55239       !senders = *@my.domain.example
55240        message = Invalid sender from client host
55241 </literallayout>
55242 <para>
55243 The <quote>deny</quote> result does not happen until the end of the statement is reached,
55244 by which time Exim has set up the message.
55245 </para>
55246 </section>
55247 <section id="SECTACLmodi">
55248 <title>ACL modifiers</title>
55249 <para>
55250 <indexterm role="concept">
55251 <primary>access control lists (ACLs)</primary>
55252 <secondary>modifiers; list of</secondary>
55253 </indexterm>
55254 The ACL modifiers are as follows:
55255 </para>
55256 <variablelist>
55257 <varlistentry>
55258 <term><emphasis role="bold">add_header</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
55259 <listitem>
55260 <para>
55261 This modifier specifies one or more header lines that are to be added to an
55262 incoming message, assuming, of course, that the message is ultimately
55263 accepted. For details, see section <xref linkend="SECTaddheadacl"/>.
55264 </para>
55265 </listitem></varlistentry>
55266 <varlistentry>
55267 <term><emphasis role="bold">continue</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
55268 <listitem>
55269 <para>
55270 <indexterm role="concept">
55271 <primary><option>continue</option> ACL modifier</primary>
55272 </indexterm>
55273 <indexterm role="concept">
55274 <primary>database</primary>
55275 <secondary>updating in ACL</secondary>
55276 </indexterm>
55277 This modifier does nothing of itself, and processing of the ACL always
55278 continues with the next condition or modifier. The value of <option>continue</option> is in
55279 the side effects of expanding its argument. Typically this could be used to
55280 update a database. It is really just a syntactic tidiness, to avoid having to
55281 write rather ugly lines like this:
55282 </para>
55283 <literallayout>
55284 <literal>condition = ${if eq{0}{</literal>&lt;<emphasis>some expansion</emphasis>&gt;<literal>}{true}{true}}</literal>
55285 </literallayout>
55286 <para>
55287 Instead, all you need is
55288 </para>
55289 <literallayout>
55290 <literal>continue = </literal>&lt;<emphasis>some expansion</emphasis>&gt;
55291 </literallayout>
55292 </listitem></varlistentry>
55293 <varlistentry>
55294 <term><emphasis role="bold">control</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
55295 <listitem>
55296 <para>
55297 <indexterm role="concept">
55298 <primary><option>control</option> ACL modifier</primary>
55299 </indexterm>
55300 This modifier affects the subsequent processing of the SMTP connection or of an
55301 incoming message that is accepted. The effect of the first type of control
55302 lasts for the duration of the connection, whereas the effect of the second type
55303 lasts only until the current message has been received. The message-specific
55304 controls always apply to the whole message, not to individual recipients,
55305 even if the <option>control</option> modifier appears in a RCPT ACL.
55306 </para>
55307 <para>
55308 As there are now quite a few controls that can be applied, they are described
55309 separately in section <xref linkend="SECTcontrols"/>. The <option>control</option> modifier can be used
55310 in several different ways. For example:
55311 </para>
55312 <itemizedlist>
55313 <listitem>
55314 <para>
55315 It can be at the end of an <option>accept</option> statement:
55316 </para>
55317 <literallayout class="monospaced">
55318     accept  ...some conditions
55319             control = queue_only
55320 </literallayout>
55321 <para>
55322 In this case, the control is applied when this statement yields <quote>accept</quote>, in
55323 other words, when the conditions are all true.
55324 </para>
55325 </listitem>
55326 <listitem>
55327 <para>
55328 It can be in the middle of an <option>accept</option> statement:
55329 </para>
55330 <literallayout class="monospaced">
55331     accept  ...some conditions...
55332             control = queue_only
55333             ...some more conditions...
55334 </literallayout>
55335 <para>
55336 If the first set of conditions are true, the control is applied, even if the
55337 statement does not accept because one of the second set of conditions is false.
55338 In this case, some subsequent statement must yield <quote>accept</quote> for the control
55339 to be relevant.
55340 </para>
55341 </listitem>
55342 <listitem>
55343 <para>
55344 It can be used with <option>warn</option> to apply the control, leaving the
55345 decision about accepting or denying to a subsequent verb. For
55346 example:
55347 </para>
55348 <literallayout class="monospaced">
55349     warn    ...some conditions...
55350             control = freeze
55351     accept  ...
55352 </literallayout>
55353 <para>
55354 This example of <option>warn</option> does not contain <option>message</option>, <option>log_message</option>, or
55355 <option>logwrite</option>, so it does not add anything to the message and does not write a
55356 log entry.
55357 </para>
55358 </listitem>
55359 <listitem>
55360 <para>
55361 If you want to apply a control unconditionally, you can use it with a
55362 <option>require</option> verb. For example:
55363 </para>
55364 <literallayout class="monospaced">
55365     require  control = no_multiline_responses
55366 </literallayout>
55367 </listitem>
55368 </itemizedlist>
55369 </listitem></varlistentry>
55370 <varlistentry>
55371 <term><emphasis role="bold">delay</emphasis>&nbsp;=&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
55372 <listitem>
55373 <para>
55374 <indexterm role="concept">
55375 <primary><option>delay</option> ACL modifier</primary>
55376 </indexterm>
55377 <indexterm role="option">
55378 <primary><option>-bh</option></primary>
55379 </indexterm>
55380 This modifier may appear in any ACL except notquit. It causes Exim to wait for
55381 the time interval before proceeding. However, when testing Exim using the
55382 <option>-bh</option> option, the delay is not actually imposed (an appropriate message is
55383 output instead). The time is given in the usual Exim notation, and the delay
55384 happens as soon as the modifier is processed. In an SMTP session, pending
55385 output is flushed before the delay is imposed.
55386 </para>
55387 <para>
55388 Like <option>control</option>, <option>delay</option> can be used with <option>accept</option> or <option>deny</option>, for
55389 example:
55390 </para>
55391 <literallayout class="monospaced">
55392 deny    ...some conditions...
55393         delay = 30s
55394 </literallayout>
55395 <para>
55396 The delay happens if all the conditions are true, before the statement returns
55397 <quote>deny</quote>. Compare this with:
55398 </para>
55399 <literallayout class="monospaced">
55400 deny    delay = 30s
55401         ...some conditions...
55402 </literallayout>
55403 <para>
55404 which waits for 30s before processing the conditions. The <option>delay</option> modifier
55405 can also be used with <option>warn</option> and together with <option>control</option>:
55406 </para>
55407 <literallayout class="monospaced">
55408 warn    ...some conditions...
55409         delay = 2m
55410         control = freeze
55411 accept  ...
55412 </literallayout>
55413 <para>
55414 If <option>delay</option> is encountered when the SMTP PIPELINING extension is in use,
55415 responses to several commands are no longer buffered and sent in one packet (as
55416 they would normally be) because all output is flushed before imposing the
55417 delay. This optimization is disabled so that a number of small delays do not
55418 appear to the client as one large aggregated delay that might provoke an
55419 unwanted timeout. You can, however, disable output flushing for <option>delay</option> by
55420 using a <option>control</option> modifier to set <option>no_delay_flush</option>.
55421 </para>
55422 </listitem></varlistentry>
55423 <varlistentry>
55424 <term><emphasis role="bold">endpass</emphasis></term>
55425 <listitem>
55426 <para>
55427 <indexterm role="concept">
55428 <primary><option>endpass</option> ACL modifier</primary>
55429 </indexterm>
55430 This modifier, which has no argument, is recognized only in <option>accept</option> and
55431 <option>discard</option> statements. It marks the boundary between the conditions whose
55432 failure causes control to pass to the next statement, and the conditions whose
55433 failure causes the ACL to return <quote>deny</quote>. This concept has proved to be
55434 confusing to some people, so the use of <option>endpass</option> is no longer recommended as
55435 <quote>best practice</quote>. See the description of <option>accept</option> above for more details.
55436 </para>
55437 </listitem></varlistentry>
55438 <varlistentry>
55439 <term><emphasis role="bold">log_message</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
55440 <listitem>
55441 <para>
55442 <indexterm role="concept">
55443 <primary><option>log_message</option> ACL modifier</primary>
55444 </indexterm>
55445 This modifier sets up a message that is used as part of the log message if the
55446 ACL denies access or a <option>warn</option> statement&#x2019;s conditions are true. For example:
55447 </para>
55448 <literallayout class="monospaced">
55449 require log_message = wrong cipher suite $tls_in_cipher
55450         encrypted   = DES-CBC3-SHA
55451 </literallayout>
55452 <para>
55453 <option>log_message</option> is also used when recipients are discarded by <option>discard</option>. For
55454 example:
55455 </para>
55456 <literallayout>
55457 <literal>discard </literal>&lt;<emphasis>some conditions</emphasis>&gt;
55458 <literal>        log_message = Discarded $local_part@$domain because...</literal>
55459 </literallayout>
55460 <para>
55461 When access is denied, <option>log_message</option> adds to any underlying error message
55462 that may exist because of a condition failure. For example, while verifying a
55463 recipient address, a <emphasis>:fail:</emphasis> redirection might have already set up a
55464 message.
55465 </para>
55466 <para>
55467 The message may be defined before the conditions to which it applies, because
55468 the string expansion does not happen until Exim decides that access is to be
55469 denied. This means that any variables that are set by the condition are
55470 available for inclusion in the message. For example, the <varname>$dnslist_</varname>&lt;<emphasis>xxx</emphasis>&gt;
55471 variables are set after a DNS black list lookup succeeds. If the expansion of
55472 <option>log_message</option> fails, or if the result is an empty string, the modifier is
55473 ignored.
55474 </para>
55475 <para>
55476 <indexterm role="variable">
55477 <primary><varname>$acl_verify_message</varname></primary>
55478 </indexterm>
55479 If you want to use a <option>warn</option> statement to log the result of an address
55480 verification, you can use <varname>$acl_verify_message</varname> to include the verification
55481 error message.
55482 </para>
55483 <para>
55484 If <option>log_message</option> is used with a <option>warn</option> statement, <quote>Warning:</quote> is added to
55485 the start of the logged message. If the same warning log message is requested
55486 more than once while receiving  a single email message, only one copy is
55487 actually logged. If you want to log multiple copies, use <option>logwrite</option> instead
55488 of <option>log_message</option>. In the absence of <option>log_message</option> and <option>logwrite</option>, nothing
55489 is logged for a successful <option>warn</option> statement.
55490 </para>
55491 <para>
55492 If <option>log_message</option> is not present and there is no underlying error message (for
55493 example, from the failure of address verification), but <option>message</option> is present,
55494 the <option>message</option> text is used for logging rejections. However, if any text for
55495 logging contains newlines, only the first line is logged. In the absence of
55496 both <option>log_message</option> and <option>message</option>, a default built-in message is used for
55497 logging rejections.
55498 </para>
55499 </listitem></varlistentry>
55500 <varlistentry>
55501 <term><emphasis role="bold">log_reject_target</emphasis>&nbsp;=&nbsp;&lt;<emphasis>log name list</emphasis>&gt;</term>
55502 <listitem>
55503 <para>
55504 <indexterm role="concept">
55505 <primary><option>log_reject_target</option> ACL modifier</primary>
55506 </indexterm>
55507 <indexterm role="concept">
55508 <primary>logging in ACL</primary>
55509 <secondary>specifying which log</secondary>
55510 </indexterm>
55511 This modifier makes it possible to specify which logs are used for messages
55512 about ACL rejections. Its argument is a colon-separated list of words that can
55513 be <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote>. The default is <literal>main:reject</literal>. The list
55514 may be empty, in which case a rejection is not logged at all. For example, this
55515 ACL fragment writes no logging information when access is denied:
55516 </para>
55517 <literallayout>
55518 <literal>deny </literal>&lt;<emphasis>some conditions</emphasis>&gt;
55519 <literal>     log_reject_target =</literal>
55520 </literallayout>
55521 <para>
55522 This modifier can be used in SMTP and non-SMTP ACLs. It applies to both
55523 permanent and temporary rejections. Its effect lasts for the rest of the
55524 current ACL.
55525 </para>
55526 </listitem></varlistentry>
55527 <varlistentry>
55528 <term><emphasis role="bold">logwrite</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
55529 <listitem>
55530 <para>
55531 <indexterm role="concept">
55532 <primary><option>logwrite</option> ACL modifier</primary>
55533 </indexterm>
55534 <indexterm role="concept">
55535 <primary>logging in ACL</primary>
55536 <secondary>immediate</secondary>
55537 </indexterm>
55538 This modifier writes a message to a log file as soon as it is encountered when
55539 processing an ACL. (Compare <option>log_message</option>, which, except in the case of
55540 <option>warn</option> and <option>discard</option>, is used only if the ACL statement denies
55541 access.) The <option>logwrite</option> modifier can be used to log special incidents in
55542 ACLs. For example:
55543 </para>
55544 <literallayout>
55545 <literal>accept </literal>&lt;<emphasis>some special conditions</emphasis>&gt;
55546 <literal>       control  = freeze</literal>
55547 <literal>       logwrite = froze message because ...</literal>
55548 </literallayout>
55549 <para>
55550 By default, the message is written to the main log. However, it may begin
55551 with a colon, followed by a comma-separated list of log names, and then
55552 another colon, to specify exactly which logs are to be written. For
55553 example:
55554 </para>
55555 <literallayout class="monospaced">
55556 logwrite = :main,reject: text for main and reject logs
55557 logwrite = :panic: text for panic log only
55558 </literallayout>
55559 </listitem></varlistentry>
55560 <varlistentry>
55561 <term><emphasis role="bold">message</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
55562 <listitem>
55563 <para>
55564 <indexterm role="concept">
55565 <primary><option>message</option> ACL modifier</primary>
55566 </indexterm>
55567 This modifier sets up a text string that is expanded and used as a response
55568 message when an ACL statement terminates the ACL with an <quote>accept</quote>, <quote>deny</quote>,
55569 or <quote>defer</quote> response. (In the case of the <option>accept</option> and <option>discard</option> verbs,
55570 there is some complication if <option>endpass</option> is involved; see the description of
55571 <option>accept</option> for details.)
55572 </para>
55573 <para>
55574 The expansion of the message happens at the time Exim decides that the ACL is
55575 to end, not at the time it processes <option>message</option>. If the expansion fails, or
55576 generates an empty string, the modifier is ignored. Here is an example where
55577 <option>message</option> must be specified first, because the ACL ends with a rejection if
55578 the <option>hosts</option> condition fails:
55579 </para>
55580 <literallayout class="monospaced">
55581 require  message = Host not recognized
55582          hosts = 10.0.0.0/8
55583 </literallayout>
55584 <para>
55585 (Once a condition has failed, no further conditions or modifiers are
55586 processed.)
55587 </para>
55588 <para>
55589 <indexterm role="concept">
55590 <primary>SMTP</primary>
55591 <secondary>error codes</secondary>
55592 </indexterm>
55593 <indexterm role="option">
55594 <primary><option>smtp_banner</option></primary>
55595 </indexterm>
55596 For ACLs that are triggered by SMTP commands, the message is returned as part
55597 of the SMTP response. The use of <option>message</option> with <option>accept</option> (or <option>discard</option>)
55598 is meaningful only for SMTP, as no message is returned when a non-SMTP message
55599 is accepted. In the case of the connect ACL, accepting with a message modifier
55600 overrides the value of <option>smtp_banner</option>. For the EHLO/HELO ACL, a customized
55601 accept message may not contain more than one line (otherwise it will be
55602 truncated at the first newline and a panic logged), and it cannot affect the
55603 EHLO options.
55604 </para>
55605 <para>
55606 When SMTP is involved, the message may begin with an overriding response code,
55607 consisting of three digits optionally followed by an <quote>extended response code</quote>
55608 of the form <emphasis>n.n.n</emphasis>, each code being followed by a space. For example:
55609 </para>
55610 <literallayout class="monospaced">
55611 deny  message = 599 1.2.3 Host not welcome
55612       hosts = 192.168.34.0/24
55613 </literallayout>
55614 <para>
55615 The first digit of the supplied response code must be the same as would be sent
55616 by default. A panic occurs if it is not. Exim uses a 550 code when it denies
55617 access, but for the predata ACL, note that the default success code is 354, not
55618 2<emphasis>xx</emphasis>.
55619 </para>
55620 <para>
55621 Notwithstanding the previous paragraph, for the QUIT ACL, unlike the others,
55622 the message modifier cannot override the 221 response code.
55623 </para>
55624 <para>
55625 The text in a <option>message</option> modifier is literal; any quotes are taken as
55626 literals, but because the string is expanded, backslash escapes are processed
55627 anyway. If the message contains newlines, this gives rise to a multi-line SMTP
55628 response.
55629 </para>
55630 <para>
55631 <indexterm role="variable">
55632 <primary><varname>$acl_verify_message</varname></primary>
55633 </indexterm>
55634 For ACLs that are called by an <option>acl =</option> ACL condition, the message is
55635 stored in <varname>$acl_verify_message</varname>, from which the calling ACL may use it.
55636 </para>
55637 <para>
55638 If <option>message</option> is used on a statement that verifies an address, the message
55639 specified overrides any message that is generated by the verification process.
55640 However, the original message is available in the variable
55641 <varname>$acl_verify_message</varname>, so you can incorporate it into your message if you
55642 wish. In particular, if you want the text from <option>:fail:</option> items in <command>redirect</command>
55643 routers to be passed back as part of the SMTP response, you should either not
55644 use a <option>message</option> modifier, or make use of <varname>$acl_verify_message</varname>.
55645 </para>
55646 <para>
55647 For compatibility with previous releases of Exim, a <option>message</option> modifier that
55648 is used with a <option>warn</option> verb behaves in a similar way to the <option>add_header</option>
55649 modifier, but this usage is now deprecated. However, <option>message</option> acts only when
55650 all the conditions are true, wherever it appears in an ACL command, whereas
55651 <option>add_header</option> acts as soon as it is encountered. If <option>message</option> is used with
55652 <option>warn</option> in an ACL that is not concerned with receiving a message, it has no
55653 effect.
55654 </para>
55655 </listitem></varlistentry>
55656 <varlistentry>
55657 <term><emphasis role="bold">queue</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
55658 <listitem>
55659 <para>
55660 This modifier specifies the use of a named queue for spool files
55661 for the message.
55662 It can only be used before the message is received (i.e. not in
55663 the DATA ACL).
55664 This could be used, for example, for known high-volume burst sources
55665 of traffic, or for quarantine of messages.
55666 Separate queue-runner processes will be needed for named queues.
55667 If the text after expansion is empty, the default queue is used.
55668 </para>
55669 </listitem></varlistentry>
55670 <varlistentry>
55671 <term><emphasis role="bold">remove_header</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
55672 <listitem>
55673 <para>
55674 This modifier specifies one or more header names in a colon-separated list
55675  that are to be removed from an incoming message, assuming, of course, that
55676 the message is ultimately accepted. For details, see section <xref linkend="SECTremoveheadacl"/>.
55677 </para>
55678 </listitem></varlistentry>
55679 <varlistentry>
55680 <term><emphasis role="bold">set</emphasis>&nbsp;&lt;<emphasis>acl_name</emphasis>&gt;&nbsp;=&nbsp;&lt;<emphasis>value</emphasis>&gt;</term>
55681 <listitem>
55682 <para>
55683 <indexterm role="concept">
55684 <primary><option>set</option> ACL modifier</primary>
55685 </indexterm>
55686 This modifier puts a value into one of the ACL variables (see section
55687 <xref linkend="SECTaclvariables"/>).
55688 </para>
55689 </listitem></varlistentry>
55690 <varlistentry>
55691 <term><emphasis role="bold">udpsend</emphasis>&nbsp;=&nbsp;&lt;<emphasis>parameters</emphasis>&gt;</term>
55692 <listitem>
55693 <para>
55694 <indexterm role="concept">
55695 <primary>UDP communications</primary>
55696 </indexterm>
55697 This modifier sends a UDP packet, for purposes such as statistics
55698 collection or behaviour monitoring. The parameters are expanded, and
55699 the result of the expansion must be a colon-separated list consisting
55700 of a destination server, port number, and the packet contents. The
55701 server can be specified as a host name or IPv4 or IPv6 address. The
55702 separator can be changed with the usual angle bracket syntax. For
55703 example, you might want to collect information on which hosts connect
55704 when:
55705 </para>
55706 <literallayout class="monospaced">
55707 udpsend = &lt;; 2001:dB8::dead:beef ; 1234 ;\
55708              $tod_zulu $sender_host_address
55709 </literallayout>
55710 </listitem></varlistentry>
55711 </variablelist>
55712 </section>
55713 <section id="SECTcontrols">
55714 <title>Use of the control modifier</title>
55715 <para>
55716 <indexterm role="concept">
55717 <primary><option>control</option> ACL modifier</primary>
55718 </indexterm>
55719 The <option>control</option> modifier supports the following settings:
55720 </para>
55721 <variablelist>
55722 <varlistentry>
55723 <term><emphasis role="bold">control&nbsp;=&nbsp;allow_auth_unadvertised</emphasis></term>
55724 <listitem>
55725 <para>
55726 This modifier allows a client host to use the SMTP AUTH command even when it
55727 has not been advertised in response to EHLO. Furthermore, because there are
55728 apparently some really broken clients that do this, Exim will accept AUTH after
55729 HELO (rather than EHLO) when this control is set. It should be used only if you
55730 really need it, and you should limit its use to those broken clients that do
55731 not work without it. For example:
55732 </para>
55733 <literallayout class="monospaced">
55734 warn hosts   = 192.168.34.25
55735      control = allow_auth_unadvertised
55736 </literallayout>
55737 <para>
55738 Normally, when an Exim server receives an AUTH command, it checks the name of
55739 the authentication mechanism that is given in the command to ensure that it
55740 matches an advertised mechanism. When this control is set, the check that a
55741 mechanism has been advertised is bypassed. Any configured mechanism can be used
55742 by the client. This control is permitted only in the connection and HELO ACLs.
55743 </para>
55744 </listitem></varlistentry>
55745 <varlistentry>
55746 <term><emphasis role="bold">control&nbsp;=&nbsp;caseful_local_part</emphasis></term>
55747 <term><emphasis role="bold">control&nbsp;=&nbsp;caselower_local_part</emphasis></term>
55748 <listitem>
55749 <para>
55750 <indexterm role="concept">
55751 <primary>access control lists (ACLs)</primary>
55752 <secondary>case of local part in</secondary>
55753 </indexterm>
55754 <indexterm role="concept">
55755 <primary>case of local parts</primary>
55756 </indexterm>
55757 <indexterm role="variable">
55758 <primary><varname>$local_part</varname></primary>
55759 </indexterm>
55760 These two controls are permitted only in the ACL specified by <option>acl_smtp_rcpt</option>
55761 (that is, during RCPT processing). By default, the contents of <varname>$local_part</varname>
55762 are lower cased before ACL processing. If <quote>caseful_local_part</quote> is specified,
55763 any uppercase letters in the original local part are restored in <varname>$local_part</varname>
55764 for the rest of the ACL, or until a control that sets <quote>caselower_local_part</quote>
55765 is encountered.
55766 </para>
55767 <para>
55768 These controls affect only the current recipient. Moreover, they apply only to
55769 local part handling that takes place directly in the ACL (for example, as a key
55770 in lookups). If a test to verify the recipient is obeyed, the case-related
55771 handling of the local part during the verification is controlled by the router
55772 configuration (see the <option>caseful_local_part</option> generic router option).
55773 </para>
55774 <para>
55775 This facility could be used, for example, to add a spam score to local parts
55776 containing upper case letters. For example, using <varname>$acl_m4</varname> to accumulate the
55777 spam score:
55778 </para>
55779 <literallayout class="monospaced">
55780 warn  control = caseful_local_part
55781       set acl_m4 = ${eval:\
55782                      $acl_m4 + \
55783                      ${if match{$local_part}{[A-Z]}{1}{0}}\
55784                     }
55785       control = caselower_local_part
55786 </literallayout>
55787 <para>
55788 Notice that we put back the lower cased version afterwards, assuming that
55789 is what is wanted for subsequent tests.
55790 </para>
55791 </listitem></varlistentry>
55792 <varlistentry>
55793 <term><emphasis role="bold">control&nbsp;=&nbsp;cutthrough_delivery/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
55794 <listitem>
55795 <para>
55796 <indexterm role="concept">
55797 <primary>access control lists (ACLs)</primary>
55798 <secondary>cutthrough routing</secondary>
55799 </indexterm>
55800 <indexterm role="concept">
55801 <primary>cutthrough</primary>
55802 <secondary>requesting</secondary>
55803 </indexterm>
55804 This option requests delivery be attempted while the item is being received.
55805 </para>
55806 <para>
55807 The option is usable in the RCPT ACL.
55808 If enabled for a message received via smtp and routed to an smtp transport,
55809 and only one transport, interface, destination host and port combination
55810 is used for all recipients of the message,
55811 then the delivery connection is made while the receiving connection is open
55812 and data is copied from one to the other.
55813 </para>
55814 <para>
55815 An attempt to set this option for any recipient but the first
55816 for a mail will be quietly ignored.
55817 If a recipient-verify callout
55818 (with use_sender)
55819 connection is subsequently
55820 requested in the same ACL it is held open and used for
55821 any subsequent recipients and the data,
55822 otherwise one is made after the initial RCPT ACL completes.
55823 </para>
55824 <para>
55825 Note that routers are used in verify mode,
55826 and cannot depend on content of received headers.
55827 Note also that headers cannot be
55828 modified by any of the post-data ACLs (DATA, MIME and DKIM).
55829 Headers may be modified by routers (subject to the above) and transports.
55830 </para>
55831 <para revisionflag="changed">
55832 The Received-By: header is generated as soon as the body reception starts,
55833 rather than the traditional time after the full message is received;
55834 this will affect the timestamp.
55835 </para>
55836 <para>
55837 All the usual ACLs are called; if one results in the message being
55838 rejected, all effort spent in delivery (including the costs on
55839 the ultimate destination) will be wasted.
55840 Note that in the case of data-time ACLs this includes the entire
55841 message body.
55842 </para>
55843 <para>
55844 Cutthrough delivery is not supported via transport-filters or when DKIM signing
55845 of outgoing messages is done, because it sends data to the ultimate destination
55846 before the entire message has been received from the source.
55847 It is not supported for messages received with the SMTP PRDR
55848 or CHUNKING
55849 options in use.
55850 </para>
55851 <para>
55852 Should the ultimate destination system positively accept or reject the mail,
55853 a corresponding indication is given to the source system and nothing is queued.
55854 If the item is successfully delivered in cutthrough mode
55855 the delivery log lines are tagged with "&gt;&gt;" rather than "=&gt;" and appear
55856 before the acceptance "&lt;=" line.
55857 </para>
55858 <para>
55859 If there is a temporary error the item is queued for later delivery in the
55860 usual fashion.
55861 This behaviour can be adjusted by appending the option <emphasis role="bold">defer=</emphasis>&lt;<emphasis>value</emphasis>&gt;
55862 to the control; the default value is <quote>spool</quote> and the alternate value
55863 <quote>pass</quote> copies an SMTP defer response from the target back to the initiator
55864 and does not queue the message.
55865 Note that this is independent of any recipient verify conditions in the ACL.
55866 </para>
55867 <para>
55868 Delivery in this mode avoids the generation of a bounce mail to a
55869 (possibly faked)
55870 sender when the destination system is doing content-scan based rejection.
55871 </para>
55872 </listitem></varlistentry>
55873 <varlistentry>
55874 <term><emphasis role="bold">control&nbsp;=&nbsp;debug/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
55875 <listitem>
55876 <para>
55877 <indexterm role="concept">
55878 <primary>access control lists (ACLs)</primary>
55879 <secondary>enabling debug logging</secondary>
55880 </indexterm>
55881 <indexterm role="concept">
55882 <primary>debugging</primary>
55883 <secondary>enabling from an ACL</secondary>
55884 </indexterm>
55885 This control turns on debug logging, almost as though Exim had been invoked
55886 with <literal>-d</literal>, with the output going to a new logfile in the usual logs directory,
55887 by default called <emphasis>debuglog</emphasis>.
55888 The filename can be adjusted with the <emphasis>tag</emphasis> option, which
55889 may access any variables already defined.  The logging may be adjusted with
55890 the <emphasis>opts</emphasis> option, which takes the same values as the <literal>-d</literal> command-line
55891 option.
55892 Logging started this way may be stopped, and the file removed,
55893 with the <emphasis>kill</emphasis> option.
55894 Some examples (which depend on variables that don&#x2019;t exist in all
55895 contexts):
55896 </para>
55897 <literallayout class="monospaced">
55898       control = debug
55899       control = debug/tag=.$sender_host_address
55900       control = debug/opts=+expand+acl
55901       control = debug/tag=.$message_exim_id/opts=+expand
55902       control = debug/kill
55903 </literallayout>
55904 </listitem></varlistentry>
55905 <varlistentry>
55906 <term><emphasis role="bold">control&nbsp;=&nbsp;dkim_disable_verify</emphasis></term>
55907 <listitem>
55908 <para>
55909 <indexterm role="concept">
55910 <primary>disable DKIM verify</primary>
55911 </indexterm>
55912 <indexterm role="concept">
55913 <primary>DKIM</primary>
55914 <secondary>disable verify</secondary>
55915 </indexterm>
55916 This control turns off DKIM verification processing entirely.  For details on
55917 the operation and configuration of DKIM, see chapter <xref linkend="CHAPdkim"/>.
55918 </para>
55919 </listitem></varlistentry>
55920 <varlistentry>
55921 <term><emphasis role="bold">control&nbsp;=&nbsp;dscp/</emphasis>&lt;<emphasis>value</emphasis>&gt;</term>
55922 <listitem>
55923 <para>
55924 <indexterm role="concept">
55925 <primary>access control lists (ACLs)</primary>
55926 <secondary>setting DSCP value</secondary>
55927 </indexterm>
55928 <indexterm role="concept">
55929 <primary>DSCP</primary>
55930 <secondary>inbound</secondary>
55931 </indexterm>
55932 This option causes the DSCP value associated with the socket for the inbound
55933 connection to be adjusted to a given value, given as one of a number of fixed
55934 strings or to numeric value.
55935 The <option>-bI:dscp</option> option may be used to ask Exim which names it knows of.
55936 Common values include <literal>throughput</literal>, <literal>mincost</literal>, and on newer systems
55937 <literal>ef</literal>, <literal>af41</literal>, etc.  Numeric values may be in the range 0 to 0x3F.
55938 </para>
55939 <para>
55940 The outbound packets from Exim will be marked with this value in the header
55941 (for IPv4, the TOS field; for IPv6, the TCLASS field); there is no guarantee
55942 that these values will have any effect, not be stripped by networking
55943 equipment, or do much of anything without cooperation with your Network
55944 Engineer and those of all network operators between the source and destination.
55945 </para>
55946 </listitem></varlistentry>
55947 <varlistentry>
55948 <term><emphasis role="bold">control&nbsp;=&nbsp;enforce_sync</emphasis></term>
55949 <term><emphasis role="bold">control&nbsp;=&nbsp;no_enforce_sync</emphasis></term>
55950 <listitem>
55951 <para>
55952 <indexterm role="concept">
55953 <primary>SMTP</primary>
55954 <secondary>synchronization checking</secondary>
55955 </indexterm>
55956 <indexterm role="concept">
55957 <primary>synchronization checking in SMTP</primary>
55958 </indexterm>
55959 These controls make it possible to be selective about when SMTP synchronization
55960 is enforced. The global option <option>smtp_enforce_sync</option> specifies the initial
55961 state of the switch (it is true by default). See the description of this option
55962 in chapter <xref linkend="CHAPmainconfig"/> for details of SMTP synchronization checking.
55963 </para>
55964 <para>
55965 The effect of these two controls lasts for the remainder of the SMTP
55966 connection. They can appear in any ACL except the one for the non-SMTP
55967 messages. The most straightforward place to put them is in the ACL defined by
55968 <option>acl_smtp_connect</option>, which is run at the start of an incoming SMTP connection,
55969 before the first synchronization check. The expected use is to turn off the
55970 synchronization checks for badly-behaved hosts that you nevertheless need to
55971 work with.
55972 </para>
55973 </listitem></varlistentry>
55974 <varlistentry>
55975 <term><emphasis role="bold">control&nbsp;=&nbsp;fakedefer/</emphasis>&lt;<emphasis>message</emphasis>&gt;</term>
55976 <listitem>
55977 <para>
55978 <indexterm role="concept">
55979 <primary>fake defer</primary>
55980 </indexterm>
55981 <indexterm role="concept">
55982 <primary>defer, fake</primary>
55983 </indexterm>
55984 This control works in exactly the same way as <option>fakereject</option> (described below)
55985 except that it causes an SMTP 450 response after the message data instead of a
55986 550 response. You must take care when using <option>fakedefer</option> because it causes the
55987 messages to be duplicated when the sender retries. Therefore, you should not
55988 use <option>fakedefer</option> if the message is to be delivered normally.
55989 </para>
55990 </listitem></varlistentry>
55991 <varlistentry>
55992 <term><emphasis role="bold">control&nbsp;=&nbsp;fakereject/</emphasis>&lt;<emphasis>message</emphasis>&gt;</term>
55993 <listitem>
55994 <para>
55995 <indexterm role="concept">
55996 <primary>fake rejection</primary>
55997 </indexterm>
55998 <indexterm role="concept">
55999 <primary>rejection, fake</primary>
56000 </indexterm>
56001 This control is permitted only for the MAIL, RCPT, and DATA ACLs, in other
56002 words, only when an SMTP message is being received. If Exim accepts the
56003 message, instead the final 250 response, a 550 rejection message is sent.
56004 However, Exim proceeds to deliver the message as normal. The control applies
56005 only to the current message, not to any subsequent ones that may be received in
56006 the same SMTP connection.
56007 </para>
56008 <para>
56009 The text for the 550 response is taken from the <option>control</option> modifier. If no
56010 message is supplied, the following is used:
56011 </para>
56012 <literallayout class="monospaced">
56013 550-Your message has been rejected but is being
56014 550-kept for evaluation.
56015 550-If it was a legitimate message, it may still be
56016 550 delivered to the target recipient(s).
56017 </literallayout>
56018 <para>
56019 This facility should be used with extreme caution.
56020 </para>
56021 </listitem></varlistentry>
56022 <varlistentry>
56023 <term><emphasis role="bold">control&nbsp;=&nbsp;freeze</emphasis></term>
56024 <listitem>
56025 <para>
56026 <indexterm role="concept">
56027 <primary>frozen messages</primary>
56028 <secondary>forcing in ACL</secondary>
56029 </indexterm>
56030 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
56031 other words, only when a message is being received. If the message is accepted,
56032 it is placed on Exim&#x2019;s queue and frozen. The control applies only to the
56033 current message, not to any subsequent ones that may be received in the same
56034 SMTP connection.
56035 </para>
56036 <para>
56037 This modifier can optionally be followed by <literal>/no_tell</literal>. If the global option
56038 <option>freeze_tell</option> is set, it is ignored for the current message (that is, nobody
56039 is told about the freezing), provided all the <emphasis role="bold">control=freeze</emphasis> modifiers that
56040 are obeyed for the current message have the <literal>/no_tell</literal> option.
56041 </para>
56042 </listitem></varlistentry>
56043 <varlistentry>
56044 <term><emphasis role="bold">control&nbsp;=&nbsp;no_delay_flush</emphasis></term>
56045 <listitem>
56046 <para>
56047 <indexterm role="concept">
56048 <primary>SMTP</primary>
56049 <secondary>output flushing, disabling for delay</secondary>
56050 </indexterm>
56051 Exim normally flushes SMTP output before implementing a delay in an ACL, to
56052 avoid unexpected timeouts in clients when the SMTP PIPELINING extension is in
56053 use. This control, as long as it is encountered before the <option>delay</option> modifier,
56054 disables such output flushing.
56055 </para>
56056 </listitem></varlistentry>
56057 <varlistentry>
56058 <term><emphasis role="bold">control&nbsp;=&nbsp;no_callout_flush</emphasis></term>
56059 <listitem>
56060 <para>
56061 <indexterm role="concept">
56062 <primary>SMTP</primary>
56063 <secondary>output flushing, disabling for callout</secondary>
56064 </indexterm>
56065 Exim normally flushes SMTP output before performing a callout in an ACL, to
56066 avoid unexpected timeouts in clients when the SMTP PIPELINING extension is in
56067 use. This control, as long as it is encountered before the <option>verify</option> condition
56068 that causes the callout, disables such output flushing.
56069 </para>
56070 </listitem></varlistentry>
56071 <varlistentry>
56072 <term><emphasis role="bold">control&nbsp;=&nbsp;no_mbox_unspool</emphasis></term>
56073 <listitem>
56074 <para>
56075 This control is available when Exim is compiled with the content scanning
56076 extension. Content scanning may require a copy of the current message, or parts
56077 of it, to be written in <quote>mbox format</quote> to a spool file, for passing to a virus
56078 or spam scanner. Normally, such copies are deleted when they are no longer
56079 needed. If this control is set, the copies are not deleted. The control applies
56080 only to the current message, not to any subsequent ones that may be received in
56081 the same SMTP connection. It is provided for debugging purposes and is unlikely
56082 to be useful in production.
56083 </para>
56084 </listitem></varlistentry>
56085 <varlistentry>
56086 <term><emphasis role="bold">control&nbsp;=&nbsp;no_multiline_responses</emphasis></term>
56087 <listitem>
56088 <para>
56089 <indexterm role="concept">
56090 <primary>multiline responses, suppressing</primary>
56091 </indexterm>
56092 This control is permitted for any ACL except the one for non-SMTP messages.
56093 It seems that there are broken clients in use that cannot handle multiline
56094 SMTP responses, despite the fact that RFC 821 defined them over 20 years ago.
56095 </para>
56096 <para>
56097 If this control is set, multiline SMTP responses from ACL rejections are
56098 suppressed. One way of doing this would have been to put out these responses as
56099 one long line. However, RFC 2821 specifies a maximum of 512 bytes per response
56100 (<quote>use multiline responses for more</quote> it says &ndash; ha!), and some of the
56101 responses might get close to that. So this facility, which is after all only a
56102 sop to broken clients, is implemented by doing two very easy things:
56103 </para>
56104 <itemizedlist>
56105 <listitem>
56106 <para>
56107 Extra information that is normally output as part of a rejection caused by
56108 sender verification failure is omitted. Only the final line (typically <quote>sender
56109 verification failed</quote>) is sent.
56110 </para>
56111 </listitem>
56112 <listitem>
56113 <para>
56114 If a <option>message</option> modifier supplies a multiline response, only the first
56115 line is output.
56116 </para>
56117 </listitem>
56118 </itemizedlist>
56119 <para>
56120 The setting of the switch can, of course, be made conditional on the
56121 calling host. Its effect lasts until the end of the SMTP connection.
56122 </para>
56123 </listitem></varlistentry>
56124 <varlistentry>
56125 <term><emphasis role="bold">control&nbsp;=&nbsp;no_pipelining</emphasis></term>
56126 <listitem>
56127 <para>
56128 <indexterm role="concept">
56129 <primary>PIPELINING</primary>
56130 <secondary>suppressing advertising</secondary>
56131 </indexterm>
56132 This control turns off the advertising of the PIPELINING extension to SMTP in
56133 the current session. To be useful, it must be obeyed before Exim sends its
56134 response to an EHLO command. Therefore, it should normally appear in an ACL
56135 controlled by <option>acl_smtp_connect</option> or <option>acl_smtp_helo</option>. See also
56136 <option>pipelining_advertise_hosts</option>.
56137 </para>
56138 </listitem></varlistentry>
56139 <varlistentry>
56140 <term><emphasis role="bold">control&nbsp;=&nbsp;queue_only</emphasis></term>
56141 <listitem>
56142 <para>
56143 <indexterm role="option">
56144 <primary><option>queue_only</option></primary>
56145 </indexterm>
56146 <indexterm role="concept">
56147 <primary>queueing incoming messages</primary>
56148 </indexterm>
56149 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
56150 other words, only when a message is being received. If the message is accepted,
56151 it is placed on Exim&#x2019;s queue and left there for delivery by a subsequent queue
56152 runner. No immediate delivery process is started. In other words, it has the
56153 effect as the <option>queue_only</option> global option. However, the control applies only
56154 to the current message, not to any subsequent ones that may be received in the
56155 same SMTP connection.
56156 </para>
56157 </listitem></varlistentry>
56158 <varlistentry>
56159 <term><emphasis role="bold">control&nbsp;=&nbsp;submission/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
56160 <listitem>
56161 <para>
56162 <indexterm role="concept">
56163 <primary>message</primary>
56164 <secondary>submission</secondary>
56165 </indexterm>
56166 <indexterm role="concept">
56167 <primary>submission mode</primary>
56168 </indexterm>
56169 This control is permitted only for the MAIL, RCPT, and start of data ACLs (the
56170 latter is the one defined by <option>acl_smtp_predata</option>). Setting it tells Exim that
56171 the current message is a submission from a local MUA. In this case, Exim
56172 operates in <quote>submission mode</quote>, and applies certain fixups to the message if
56173 necessary. For example, it adds a <emphasis>Date:</emphasis> header line if one is not present.
56174 This control is not permitted in the <option>acl_smtp_data</option> ACL, because that is too
56175 late (the message has already been created).
56176 </para>
56177 <para>
56178 Chapter <xref linkend="CHAPmsgproc"/> describes the processing that Exim applies to
56179 messages. Section <xref linkend="SECTsubmodnon"/> covers the processing that happens in
56180 submission mode; the available options for this control are described there.
56181 The control applies only to the current message, not to any subsequent ones
56182 that may be received in the same SMTP connection.
56183 </para>
56184 </listitem></varlistentry>
56185 <varlistentry>
56186 <term><emphasis role="bold">control&nbsp;=&nbsp;suppress_local_fixups</emphasis></term>
56187 <listitem>
56188 <para>
56189 <indexterm role="concept">
56190 <primary>submission fixups, suppressing</primary>
56191 </indexterm>
56192 This control applies to locally submitted (non TCP/IP) messages, and is the
56193 complement of <literal>control = submission</literal>. It disables the fixups that are
56194 normally applied to locally-submitted messages. Specifically:
56195 </para>
56196 <itemizedlist>
56197 <listitem>
56198 <para>
56199 Any <emphasis>Sender:</emphasis> header line is left alone (in this respect, it is a
56200 dynamic version of <option>local_sender_retain</option>).
56201 </para>
56202 </listitem>
56203 <listitem>
56204 <para>
56205 No <emphasis>Message-ID:</emphasis>, <emphasis>From:</emphasis>, or <emphasis>Date:</emphasis> header lines are added.
56206 </para>
56207 </listitem>
56208 <listitem>
56209 <para>
56210 There is no check that <emphasis>From:</emphasis> corresponds to the actual sender.
56211 </para>
56212 </listitem>
56213 </itemizedlist>
56214 <para>
56215 This control may be useful when a remotely-originated message is accepted,
56216 passed to some scanning program, and then re-submitted for delivery. It can be
56217 used only in the <option>acl_smtp_mail</option>, <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>,
56218 and <option>acl_not_smtp_start</option> ACLs, because it has to be set before the message&#x2019;s
56219 data is read.
56220 </para>
56221 <para>
56222 <emphasis role="bold">Note:</emphasis> This control applies only to the current message, not to any others
56223 that are being submitted at the same time using <option>-bs</option> or <option>-bS</option>.
56224 </para>
56225 </listitem></varlistentry>
56226 <varlistentry>
56227 <term><emphasis role="bold">control&nbsp;=&nbsp;utf8_downconvert</emphasis></term>
56228 <listitem>
56229 <para>
56230 This control enables conversion of UTF-8 in message addresses
56231 to a-label form.
56232 For details see section <xref linkend="SECTi18nMTA"/>.
56233 </para>
56234 </listitem></varlistentry>
56235 </variablelist>
56236 </section>
56237 <section id="SECTsummesfix">
56238 <title>Summary of message fixup control</title>
56239 <para>
56240 All four possibilities for message fixups can be specified:
56241 </para>
56242 <itemizedlist>
56243 <listitem>
56244 <para>
56245 Locally submitted, fixups applied: the default.
56246 </para>
56247 </listitem>
56248 <listitem>
56249 <para>
56250 Locally submitted, no fixups applied: use
56251 <literal>control = suppress_local_fixups</literal>.
56252 </para>
56253 </listitem>
56254 <listitem>
56255 <para>
56256 Remotely submitted, no fixups applied: the default.
56257 </para>
56258 </listitem>
56259 <listitem>
56260 <para>
56261 Remotely submitted, fixups applied: use <literal>control = submission</literal>.
56262 </para>
56263 </listitem>
56264 </itemizedlist>
56265 </section>
56266 <section id="SECTaddheadacl">
56267 <title>Adding header lines in ACLs</title>
56268 <para>
56269 <indexterm role="concept">
56270 <primary>header lines</primary>
56271 <secondary>adding in an ACL</secondary>
56272 </indexterm>
56273 <indexterm role="concept">
56274 <primary>header lines</primary>
56275 <secondary>position of added lines</secondary>
56276 </indexterm>
56277 <indexterm role="concept">
56278 <primary><option>add_header</option> ACL modifier</primary>
56279 </indexterm>
56280 The <option>add_header</option> modifier can be used to add one or more extra header lines
56281 to an incoming message, as in this example:
56282 </para>
56283 <literallayout class="monospaced">
56284 warn dnslists = sbl.spamhaus.org : \
56285                 dialup.mail-abuse.org
56286      add_header = X-blacklisted-at: $dnslist_domain
56287 </literallayout>
56288 <para>
56289 The <option>add_header</option> modifier is permitted in the MAIL, RCPT, PREDATA, DATA,
56290 MIME, DKIM, and non-SMTP ACLs (in other words, those that are concerned with
56291 receiving a message). The message must ultimately be accepted for
56292 <option>add_header</option> to have any significant effect. You can use <option>add_header</option> with
56293 any ACL verb, including <option>deny</option> (though this is potentially useful only in a
56294 RCPT ACL).
56295 </para>
56296 <para>
56297 Headers will not be added to the message if the modifier is used in
56298 DATA, MIME or DKIM ACLs for a message delivered by cutthrough routing.
56299 </para>
56300 <para>
56301 Leading and trailing newlines are removed from
56302 the data for the <option>add_header</option> modifier; if it then
56303 contains one or more newlines that
56304 are not followed by a space or a tab, it is assumed to contain multiple header
56305 lines. Each one is checked for valid syntax; <literal>X-ACL-Warn:</literal> is added to the
56306 front of any line that is not a valid header line.
56307 </para>
56308 <para>
56309 Added header lines are accumulated during the MAIL, RCPT, and predata ACLs.
56310 They are added to the message before processing the DATA and MIME ACLs.
56311 However, if an identical header line is requested more than once, only one copy
56312 is actually added to the message. Further header lines may be accumulated
56313 during the DATA and MIME ACLs, after which they are added to the message, again
56314 with duplicates suppressed. Thus, it is possible to add two identical header
56315 lines to an SMTP message, but only if one is added before DATA and one after.
56316 In the case of non-SMTP messages, new headers are accumulated during the
56317 non-SMTP ACLs, and are added to the message after all the ACLs have run. If a
56318 message is rejected after DATA or by the non-SMTP ACL, all added header lines
56319 are included in the entry that is written to the reject log.
56320 </para>
56321 <para>
56322 <indexterm role="concept">
56323 <primary>header lines</primary>
56324 <secondary>added; visibility of</secondary>
56325 </indexterm>
56326 Header lines are not visible in string expansions
56327 of message headers
56328 until they are added to the
56329 message. It follows that header lines defined in the MAIL, RCPT, and predata
56330 ACLs are not visible until the DATA ACL and MIME ACLs are run. Similarly,
56331 header lines that are added by the DATA or MIME ACLs are not visible in those
56332 ACLs. Because of this restriction, you cannot use header lines as a way of
56333 passing data between (for example) the MAIL and RCPT ACLs. If you want to do
56334 this, you can use ACL variables, as described in section
56335 <xref linkend="SECTaclvariables"/>.
56336 </para>
56337 <para>
56338 The list of headers yet to be added is given by the <option>$headers_added</option> variable.
56339 </para>
56340 <para>
56341 The <option>add_header</option> modifier acts immediately as it is encountered during the
56342 processing of an ACL. Notice the difference between these two cases:
56343 </para>
56344 <literallayout>
56345 <literal>accept add_header = ADDED: some text</literal>
56346 <literal>       </literal>&lt;<emphasis>some condition</emphasis>&gt;
56347
56348 <literal>accept </literal>&lt;<emphasis>some condition</emphasis>&gt;
56349 <literal>       add_header = ADDED: some text</literal>
56350 </literallayout>
56351 <para>
56352 In the first case, the header line is always added, whether or not the
56353 condition is true. In the second case, the header line is added only if the
56354 condition is true. Multiple occurrences of <option>add_header</option> may occur in the same
56355 ACL statement. All those that are encountered before a condition fails are
56356 honoured.
56357 </para>
56358 <para>
56359 <indexterm role="concept">
56360 <primary><option>warn</option> ACL verb</primary>
56361 </indexterm>
56362 For compatibility with previous versions of Exim, a <option>message</option> modifier for a
56363 <option>warn</option> verb acts in the same way as <option>add_header</option>, except that it takes
56364 effect only if all the conditions are true, even if it appears before some of
56365 them. Furthermore, only the last occurrence of <option>message</option> is honoured. This
56366 usage of <option>message</option> is now deprecated. If both <option>add_header</option> and <option>message</option>
56367 are present on a <option>warn</option> verb, both are processed according to their
56368 specifications.
56369 </para>
56370 <para>
56371 By default, new header lines are added to a message at the end of the existing
56372 header lines. However, you can specify that any particular header line should
56373 be added right at the start (before all the <emphasis>Received:</emphasis> lines), immediately
56374 after the first block of <emphasis>Received:</emphasis> lines, or immediately before any line
56375 that is not a <emphasis>Received:</emphasis> or <emphasis>Resent-something:</emphasis> header.
56376 </para>
56377 <para>
56378 This is done by specifying <quote>:at_start:</quote>, <quote>:after_received:</quote>, or
56379 <quote>:at_start_rfc:</quote> (or, for completeness, <quote>:at_end:</quote>) before the text of the
56380 header line, respectively. (Header text cannot start with a colon, as there has
56381 to be a header name first.) For example:
56382 </para>
56383 <literallayout class="monospaced">
56384 warn add_header = \
56385        :after_received:X-My-Header: something or other...
56386 </literallayout>
56387 <para>
56388 If more than one header line is supplied in a single <option>add_header</option> modifier,
56389 each one is treated independently and can therefore be placed differently. If
56390 you add more than one line at the start, or after the Received: block, they end
56391 up in reverse order.
56392 </para>
56393 <para>
56394 <emphasis role="bold">Warning</emphasis>: This facility currently applies only to header lines that are
56395 added in an ACL. It does NOT work for header lines that are added in a
56396 system filter or in a router or transport.
56397 </para>
56398 </section>
56399 <section id="SECTremoveheadacl">
56400 <title>Removing header lines in ACLs</title>
56401 <para>
56402 <indexterm role="concept">
56403 <primary>header lines</primary>
56404 <secondary>removing in an ACL</secondary>
56405 </indexterm>
56406 <indexterm role="concept">
56407 <primary>header lines</primary>
56408 <secondary>position of removed lines</secondary>
56409 </indexterm>
56410 <indexterm role="concept">
56411 <primary><option>remove_header</option> ACL modifier</primary>
56412 </indexterm>
56413 The <option>remove_header</option> modifier can be used to remove one or more header lines
56414 from an incoming message, as in this example:
56415 </para>
56416 <literallayout class="monospaced">
56417 warn   message        = Remove internal headers
56418        remove_header  = x-route-mail1 : x-route-mail2
56419 </literallayout>
56420 <para>
56421 The <option>remove_header</option> modifier is permitted in the MAIL, RCPT, PREDATA, DATA,
56422 MIME, DKIM, and non-SMTP ACLs (in other words, those that are concerned with
56423 receiving a message). The message must ultimately be accepted for
56424 <option>remove_header</option> to have any significant effect. You can use <option>remove_header</option>
56425 with any ACL verb, including <option>deny</option>, though this is really not useful for
56426 any verb that doesn&#x2019;t result in a delivered message.
56427 </para>
56428 <para>
56429 Headers will not be removed from the message if the modifier is used in
56430 DATA, MIME or DKIM ACLs for a message delivered by cutthrough routing.
56431 </para>
56432 <para>
56433 More than one header can be removed at the same time by using a colon separated
56434 list of header names. The header matching is case insensitive. Wildcards are
56435 not permitted, nor is list expansion performed, so you cannot use hostlists to
56436 create a list of headers, however both connection and message variable expansion
56437 are performed (<option>$acl_c_*</option> and <option>$acl_m_*</option>), illustrated in this example:
56438 </para>
56439 <literallayout class="monospaced">
56440 warn   hosts           = +internal_hosts
56441        set acl_c_ihdrs = x-route-mail1 : x-route-mail2
56442 warn   message         = Remove internal headers
56443        remove_header   = $acl_c_ihdrs
56444 </literallayout>
56445 <para>
56446 Removed header lines are accumulated during the MAIL, RCPT, and predata ACLs.
56447 They are removed from the message before processing the DATA and MIME ACLs.
56448 There is no harm in attempting to remove the same header twice nor is removing
56449 a non-existent header. Further header lines to be removed may be accumulated
56450 during the DATA and MIME ACLs, after which they are removed from the message,
56451 if present. In the case of non-SMTP messages, headers to be removed are
56452 accumulated during the non-SMTP ACLs, and are removed from the message after
56453 all the ACLs have run. If a message is rejected after DATA or by the non-SMTP
56454 ACL, there really is no effect because there is no logging of what headers
56455 would have been removed.
56456 </para>
56457 <para>
56458 <indexterm role="concept">
56459 <primary>header lines</primary>
56460 <secondary>removed; visibility of</secondary>
56461 </indexterm>
56462 Header lines are not visible in string expansions until the DATA phase when it
56463 is received. Any header lines removed in the MAIL, RCPT, and predata ACLs are
56464 not visible in the DATA ACL and MIME ACLs. Similarly, header lines that are
56465 removed by the DATA or MIME ACLs are still visible in those ACLs. Because of
56466 this restriction, you cannot use header lines as a way of controlling data
56467 passed between (for example) the MAIL and RCPT ACLs. If you want to do this,
56468 you should instead use ACL variables, as described in section
56469 <xref linkend="SECTaclvariables"/>.
56470 </para>
56471 <para>
56472 The <option>remove_header</option> modifier acts immediately as it is encountered during the
56473 processing of an ACL. Notice the difference between these two cases:
56474 </para>
56475 <literallayout>
56476 <literal>accept remove_header = X-Internal</literal>
56477 <literal>       </literal>&lt;<emphasis>some condition</emphasis>&gt;
56478
56479 <literal>accept </literal>&lt;<emphasis>some condition</emphasis>&gt;
56480 <literal>       remove_header = X-Internal</literal>
56481 </literallayout>
56482 <para>
56483 In the first case, the header line is always removed, whether or not the
56484 condition is true. In the second case, the header line is removed only if the
56485 condition is true. Multiple occurrences of <option>remove_header</option> may occur in the
56486 same ACL statement. All those that are encountered before a condition fails
56487 are honoured.
56488 </para>
56489 <para>
56490 <emphasis role="bold">Warning</emphasis>: This facility currently applies only to header lines that are
56491 present during ACL processing. It does NOT remove header lines that are added
56492 in a system filter or in a router or transport.
56493 </para>
56494 </section>
56495 <section id="SECTaclconditions">
56496 <title>ACL conditions</title>
56497 <para>
56498 <indexterm role="concept">
56499 <primary>access control lists (ACLs)</primary>
56500 <secondary>conditions; list of</secondary>
56501 </indexterm>
56502 Some of the conditions listed in this section are available only when Exim is
56503 compiled with the content-scanning extension. They are included here briefly
56504 for completeness. More detailed descriptions can be found in the discussion on
56505 content scanning in chapter <xref linkend="CHAPexiscan"/>.
56506 </para>
56507 <para>
56508 Not all conditions are relevant in all circumstances. For example, testing
56509 senders and recipients does not make sense in an ACL that is being run as the
56510 result of the arrival of an ETRN command, and checks on message headers can be
56511 done only in the ACLs specified by <option>acl_smtp_data</option> and <option>acl_not_smtp</option>. You
56512 can use the same condition (with different parameters) more than once in the
56513 same ACL statement. This provides a way of specifying an <quote>and</quote> conjunction.
56514 The conditions are as follows:
56515 </para>
56516 <variablelist>
56517 <varlistentry>
56518 <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>
56519 <listitem>
56520 <para>
56521 <indexterm role="concept">
56522 <primary>access control lists (ACLs)</primary>
56523 <secondary>nested</secondary>
56524 </indexterm>
56525 <indexterm role="concept">
56526 <primary>access control lists (ACLs)</primary>
56527 <secondary>indirect</secondary>
56528 </indexterm>
56529 <indexterm role="concept">
56530 <primary>access control lists (ACLs)</primary>
56531 <secondary>arguments</secondary>
56532 </indexterm>
56533 <indexterm role="concept">
56534 <primary><option>acl</option> ACL condition</primary>
56535 </indexterm>
56536 The possible values of the argument are the same as for the
56537 <option>acl_smtp_</option><emphasis>xxx</emphasis> options. The named or inline ACL is run. If it returns
56538 <quote>accept</quote> the condition is true; if it returns <quote>deny</quote> the condition is
56539 false. If it returns <quote>defer</quote>, the current ACL returns <quote>defer</quote> unless the
56540 condition is on a <option>warn</option> verb. In that case, a <quote>defer</quote> return makes the
56541 condition false. This means that further processing of the <option>warn</option> verb
56542 ceases, but processing of the ACL continues.
56543 </para>
56544 <para>
56545 If the argument is a named ACL, up to nine space-separated optional values
56546 can be appended; they appear within the called ACL in $acl_arg1 to $acl_arg9,
56547 and $acl_narg is set to the count of values.
56548 Previous values of these variables are restored after the call returns.
56549 The name and values are expanded separately.
56550 Note that spaces in complex expansions which are used as arguments
56551 will act as argument separators.
56552 </para>
56553 <para>
56554 If the nested <option>acl</option> returns <quote>drop</quote> and the outer condition denies access,
56555 the connection is dropped. If it returns <quote>discard</quote>, the verb must be
56556 <option>accept</option> or <option>discard</option>, and the action is taken immediately &ndash; no further
56557 conditions are tested.
56558 </para>
56559 <para>
56560 ACLs may be nested up to 20 deep; the limit exists purely to catch runaway
56561 loops. This condition allows you to use different ACLs in different
56562 circumstances. For example, different ACLs can be used to handle RCPT commands
56563 for different local users or different local domains.
56564 </para>
56565 </listitem></varlistentry>
56566 <varlistentry>
56567 <term><emphasis role="bold">authenticated&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string&nbsp;list</emphasis>&gt;</term>
56568 <listitem>
56569 <para>
56570 <indexterm role="concept">
56571 <primary><option>authenticated</option> ACL condition</primary>
56572 </indexterm>
56573 <indexterm role="concept">
56574 <primary>authentication</primary>
56575 <secondary>ACL checking</secondary>
56576 </indexterm>
56577 <indexterm role="concept">
56578 <primary>access control lists (ACLs)</primary>
56579 <secondary>testing for authentication</secondary>
56580 </indexterm>
56581 If the SMTP connection is not authenticated, the condition is false. Otherwise,
56582 the name of the authenticator is tested against the list. To test for
56583 authentication by any authenticator, you can set
56584 </para>
56585 <literallayout class="monospaced">
56586 authenticated = *
56587 </literallayout>
56588 </listitem></varlistentry>
56589 <varlistentry>
56590 <term><emphasis role="bold">condition&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string</emphasis>&gt;</term>
56591 <listitem>
56592 <para>
56593 <indexterm role="concept">
56594 <primary><option>condition</option> ACL condition</primary>
56595 </indexterm>
56596 <indexterm role="concept">
56597 <primary>customizing</primary>
56598 <secondary>ACL condition</secondary>
56599 </indexterm>
56600 <indexterm role="concept">
56601 <primary>access control lists (ACLs)</primary>
56602 <secondary>customized test</secondary>
56603 </indexterm>
56604 <indexterm role="concept">
56605 <primary>access control lists (ACLs)</primary>
56606 <secondary>testing, customized</secondary>
56607 </indexterm>
56608 This feature allows you to make up custom conditions. If the result of
56609 expanding the string is an empty string, the number zero, or one of the strings
56610 <quote>no</quote> or <quote>false</quote>, the condition is false. If the result is any non-zero
56611 number, or one of the strings <quote>yes</quote> or <quote>true</quote>, the condition is true. For
56612 any other value, some error is assumed to have occurred, and the ACL returns
56613 <quote>defer</quote>. However, if the expansion is forced to fail, the condition is
56614 ignored. The effect is to treat it as true, whether it is positive or
56615 negative.
56616 </para>
56617 </listitem></varlistentry>
56618 <varlistentry>
56619 <term><emphasis role="bold">decode&nbsp;=&nbsp;</emphasis>&lt;<emphasis>location</emphasis>&gt;</term>
56620 <listitem>
56621 <para>
56622 <indexterm role="concept">
56623 <primary><option>decode</option> ACL condition</primary>
56624 </indexterm>
56625 This condition is available only when Exim is compiled with the
56626 content-scanning extension, and it is allowed only in the ACL defined by
56627 <option>acl_smtp_mime</option>. It causes the current MIME part to be decoded into a file.
56628 If all goes well, the condition is true. It is false only if there are
56629 problems such as a syntax error or a memory shortage. For more details, see
56630 chapter <xref linkend="CHAPexiscan"/>.
56631 </para>
56632 </listitem></varlistentry>
56633 <varlistentry>
56634 <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>
56635 <listitem>
56636 <para>
56637 <indexterm role="concept">
56638 <primary><option>dnslists</option> ACL condition</primary>
56639 </indexterm>
56640 <indexterm role="concept">
56641 <primary>DNS list</primary>
56642 <secondary>in ACL</secondary>
56643 </indexterm>
56644 <indexterm role="concept">
56645 <primary>black list (DNS)</primary>
56646 </indexterm>
56647 <indexterm role="concept">
56648 <primary>access control lists (ACLs)</primary>
56649 <secondary>testing a DNS list</secondary>
56650 </indexterm>
56651 This condition checks for entries in DNS black lists. These are also known as
56652 <quote>RBL lists</quote>, after the original Realtime Blackhole List, but note that the
56653 use of the lists at <emphasis>mail-abuse.org</emphasis> now carries a charge. There are too many
56654 different variants of this condition to describe briefly here. See sections
56655 <xref linkend="SECTmorednslists"/>&ndash;<xref linkend="SECTmorednslistslast"/> for details.
56656 </para>
56657 </listitem></varlistentry>
56658 <varlistentry>
56659 <term><emphasis role="bold">domains&nbsp;=&nbsp;</emphasis>&lt;<emphasis>domain&nbsp;list</emphasis>&gt;</term>
56660 <listitem>
56661 <para>
56662 <indexterm role="concept">
56663 <primary><option>domains</option> ACL condition</primary>
56664 </indexterm>
56665 <indexterm role="concept">
56666 <primary>domain</primary>
56667 <secondary>ACL checking</secondary>
56668 </indexterm>
56669 <indexterm role="concept">
56670 <primary>access control lists (ACLs)</primary>
56671 <secondary>testing a recipient domain</secondary>
56672 </indexterm>
56673 <indexterm role="variable">
56674 <primary><varname>$domain_data</varname></primary>
56675 </indexterm>
56676 This condition is relevant only after a RCPT command. It checks that the domain
56677 of the recipient address is in the domain list. If percent-hack processing is
56678 enabled, it is done before this test is done. If the check succeeds with a
56679 lookup, the result of the lookup is placed in <varname>$domain_data</varname> until the next
56680 <option>domains</option> test.
56681 </para>
56682 <para>
56683 <emphasis role="bold">Note carefully</emphasis> (because many people seem to fall foul of this): you cannot
56684 use <option>domains</option> in a DATA ACL.
56685 </para>
56686 </listitem></varlistentry>
56687 <varlistentry>
56688 <term><emphasis role="bold">encrypted&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string&nbsp;list</emphasis>&gt;</term>
56689 <listitem>
56690 <para>
56691 <indexterm role="concept">
56692 <primary><option>encrypted</option> ACL condition</primary>
56693 </indexterm>
56694 <indexterm role="concept">
56695 <primary>encryption</primary>
56696 <secondary>checking in an ACL</secondary>
56697 </indexterm>
56698 <indexterm role="concept">
56699 <primary>access control lists (ACLs)</primary>
56700 <secondary>testing for encryption</secondary>
56701 </indexterm>
56702 If the SMTP connection is not encrypted, the condition is false. Otherwise, the
56703 name of the cipher suite in use is tested against the list. To test for
56704 encryption without testing for any specific cipher suite(s), set
56705 </para>
56706 <literallayout class="monospaced">
56707 encrypted = *
56708 </literallayout>
56709 </listitem></varlistentry>
56710 <varlistentry>
56711 <term><emphasis role="bold">hosts&nbsp;=&nbsp;</emphasis>&lt;<emphasis>host&nbsp;list</emphasis>&gt;</term>
56712 <listitem>
56713 <para>
56714 <indexterm role="concept">
56715 <primary><option>hosts</option> ACL condition</primary>
56716 </indexterm>
56717 <indexterm role="concept">
56718 <primary>host</primary>
56719 <secondary>ACL checking</secondary>
56720 </indexterm>
56721 <indexterm role="concept">
56722 <primary>access control lists (ACLs)</primary>
56723 <secondary>testing the client host</secondary>
56724 </indexterm>
56725 This condition tests that the calling host matches the host list. If you have
56726 name lookups or wildcarded host names and IP addresses in the same host list,
56727 you should normally put the IP addresses first. For example, you could have:
56728 </para>
56729 <literallayout class="monospaced">
56730 accept hosts = 10.9.8.7 : dbm;/etc/friendly/hosts
56731 </literallayout>
56732 <para>
56733 The lookup in this example uses the host name for its key. This is implied by
56734 the lookup type <quote>dbm</quote>. (For a host address lookup you would use <quote>net-dbm</quote>
56735 and it wouldn&#x2019;t matter which way round you had these two items.)
56736 </para>
56737 <para>
56738 The reason for the problem with host names lies in the left-to-right way that
56739 Exim processes lists. It can test IP addresses without doing any DNS lookups,
56740 but when it reaches an item that requires a host name, it fails if it cannot
56741 find a host name to compare with the pattern. If the above list is given in the
56742 opposite order, the <option>accept</option> statement fails for a host whose name cannot be
56743 found, even if its IP address is 10.9.8.7.
56744 </para>
56745 <para>
56746 If you really do want to do the name check first, and still recognize the IP
56747 address even if the name lookup fails, you can rewrite the ACL like this:
56748 </para>
56749 <literallayout class="monospaced">
56750 accept hosts = dbm;/etc/friendly/hosts
56751 accept hosts = 10.9.8.7
56752 </literallayout>
56753 <para>
56754 The default action on failing to find the host name is to assume that the host
56755 is not in the list, so the first <option>accept</option> statement fails. The second
56756 statement can then check the IP address.
56757 </para>
56758 <para>
56759 <indexterm role="variable">
56760 <primary><varname>$host_data</varname></primary>
56761 </indexterm>
56762 If a <option>hosts</option> condition is satisfied by means of a lookup, the result
56763 of the lookup is made available in the <varname>$host_data</varname> variable. This
56764 allows you, for example, to set up a statement like this:
56765 </para>
56766 <literallayout class="monospaced">
56767 deny  hosts = net-lsearch;/some/file
56768 message = $host_data
56769 </literallayout>
56770 <para>
56771 which gives a custom error message for each denied host.
56772 </para>
56773 </listitem></varlistentry>
56774 <varlistentry>
56775 <term><emphasis role="bold">local_parts&nbsp;=&nbsp;</emphasis>&lt;<emphasis>local&nbsp;part&nbsp;list</emphasis>&gt;</term>
56776 <listitem>
56777 <para>
56778 <indexterm role="concept">
56779 <primary><option>local_parts</option> ACL condition</primary>
56780 </indexterm>
56781 <indexterm role="concept">
56782 <primary>local part</primary>
56783 <secondary>ACL checking</secondary>
56784 </indexterm>
56785 <indexterm role="concept">
56786 <primary>access control lists (ACLs)</primary>
56787 <secondary>testing a local part</secondary>
56788 </indexterm>
56789 <indexterm role="variable">
56790 <primary><varname>$local_part_data</varname></primary>
56791 </indexterm>
56792 This condition is relevant only after a RCPT command. It checks that the local
56793 part of the recipient address is in the list. If percent-hack processing is
56794 enabled, it is done before this test. If the check succeeds with a lookup, the
56795 result of the lookup is placed in <varname>$local_part_data</varname>, which remains set until
56796 the next <option>local_parts</option> test.
56797 </para>
56798 </listitem></varlistentry>
56799 <varlistentry>
56800 <term><emphasis role="bold">malware&nbsp;=&nbsp;</emphasis>&lt;<emphasis>option</emphasis>&gt;</term>
56801 <listitem>
56802 <para>
56803 <indexterm role="concept">
56804 <primary><option>malware</option> ACL condition</primary>
56805 </indexterm>
56806 <indexterm role="concept">
56807 <primary>access control lists (ACLs)</primary>
56808 <secondary>virus scanning</secondary>
56809 </indexterm>
56810 <indexterm role="concept">
56811 <primary>access control lists (ACLs)</primary>
56812 <secondary>scanning for viruses</secondary>
56813 </indexterm>
56814 This condition is available only when Exim is compiled with the
56815 content-scanning extension. It causes the incoming message to be scanned for
56816 viruses. For details, see chapter <xref linkend="CHAPexiscan"/>.
56817 </para>
56818 </listitem></varlistentry>
56819 <varlistentry>
56820 <term><emphasis role="bold">mime_regex&nbsp;=&nbsp;</emphasis>&lt;<emphasis>list&nbsp;of&nbsp;regular&nbsp;expressions</emphasis>&gt;</term>
56821 <listitem>
56822 <para>
56823 <indexterm role="concept">
56824 <primary><option>mime_regex</option> ACL condition</primary>
56825 </indexterm>
56826 <indexterm role="concept">
56827 <primary>access control lists (ACLs)</primary>
56828 <secondary>testing by regex matching</secondary>
56829 </indexterm>
56830 This condition is available only when Exim is compiled with the
56831 content-scanning extension, and it is allowed only in the ACL defined by
56832 <option>acl_smtp_mime</option>. It causes the current MIME part to be scanned for a match
56833 with any of the regular expressions. For details, see chapter
56834 <xref linkend="CHAPexiscan"/>.
56835 </para>
56836 </listitem></varlistentry>
56837 <varlistentry>
56838 <term><emphasis role="bold">ratelimit&nbsp;=&nbsp;</emphasis>&lt;<emphasis>parameters</emphasis>&gt;</term>
56839 <listitem>
56840 <para>
56841 <indexterm role="concept">
56842 <primary>rate limiting</primary>
56843 </indexterm>
56844 This condition can be used to limit the rate at which a user or host submits
56845 messages. Details are given in section <xref linkend="SECTratelimiting"/>.
56846 </para>
56847 </listitem></varlistentry>
56848 <varlistentry>
56849 <term><emphasis role="bold">recipients&nbsp;=&nbsp;</emphasis>&lt;<emphasis>address&nbsp;list</emphasis>&gt;</term>
56850 <listitem>
56851 <para>
56852 <indexterm role="concept">
56853 <primary><option>recipients</option> ACL condition</primary>
56854 </indexterm>
56855 <indexterm role="concept">
56856 <primary>recipient</primary>
56857 <secondary>ACL checking</secondary>
56858 </indexterm>
56859 <indexterm role="concept">
56860 <primary>access control lists (ACLs)</primary>
56861 <secondary>testing a recipient</secondary>
56862 </indexterm>
56863 This condition is relevant only after a RCPT command. It checks the entire
56864 recipient address against a list of recipients.
56865 </para>
56866 </listitem></varlistentry>
56867 <varlistentry>
56868 <term><emphasis role="bold">regex&nbsp;=&nbsp;</emphasis>&lt;<emphasis>list&nbsp;of&nbsp;regular&nbsp;expressions</emphasis>&gt;</term>
56869 <listitem>
56870 <para>
56871 <indexterm role="concept">
56872 <primary><option>regex</option> ACL condition</primary>
56873 </indexterm>
56874 <indexterm role="concept">
56875 <primary>access control lists (ACLs)</primary>
56876 <secondary>testing by regex matching</secondary>
56877 </indexterm>
56878 This condition is available only when Exim is compiled with the
56879 content-scanning extension, and is available only in the DATA, MIME, and
56880 non-SMTP ACLs. It causes the incoming message to be scanned for a match with
56881 any of the regular expressions. For details, see chapter <xref linkend="CHAPexiscan"/>.
56882 </para>
56883 </listitem></varlistentry>
56884 <varlistentry>
56885 <term><emphasis role="bold">sender_domains&nbsp;=&nbsp;</emphasis>&lt;<emphasis>domain&nbsp;list</emphasis>&gt;</term>
56886 <listitem>
56887 <para>
56888 <indexterm role="concept">
56889 <primary><option>sender_domains</option> ACL condition</primary>
56890 </indexterm>
56891 <indexterm role="concept">
56892 <primary>sender</primary>
56893 <secondary>ACL checking</secondary>
56894 </indexterm>
56895 <indexterm role="concept">
56896 <primary>access control lists (ACLs)</primary>
56897 <secondary>testing a sender domain</secondary>
56898 </indexterm>
56899 <indexterm role="variable">
56900 <primary><varname>$domain</varname></primary>
56901 </indexterm>
56902 <indexterm role="variable">
56903 <primary><varname>$sender_address_domain</varname></primary>
56904 </indexterm>
56905 This condition tests the domain of the sender of the message against the given
56906 domain list. <emphasis role="bold">Note</emphasis>: The domain of the sender address is in
56907 <varname>$sender_address_domain</varname>. It is <emphasis>not</emphasis> put in <varname>$domain</varname> during the testing
56908 of this condition. This is an exception to the general rule for testing domain
56909 lists. It is done this way so that, if this condition is used in an ACL for a
56910 RCPT command, the recipient&#x2019;s domain (which is in <varname>$domain</varname>) can be used to
56911 influence the sender checking.
56912 </para>
56913 <para>
56914 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
56915 relaying, because sender addresses are easily, and commonly, forged.
56916 </para>
56917 </listitem></varlistentry>
56918 <varlistentry>
56919 <term><emphasis role="bold">senders&nbsp;=&nbsp;</emphasis>&lt;<emphasis>address&nbsp;list</emphasis>&gt;</term>
56920 <listitem>
56921 <para>
56922 <indexterm role="concept">
56923 <primary><option>senders</option> ACL condition</primary>
56924 </indexterm>
56925 <indexterm role="concept">
56926 <primary>sender</primary>
56927 <secondary>ACL checking</secondary>
56928 </indexterm>
56929 <indexterm role="concept">
56930 <primary>access control lists (ACLs)</primary>
56931 <secondary>testing a sender</secondary>
56932 </indexterm>
56933 This condition tests the sender of the message against the given list. To test
56934 for a bounce message, which has an empty sender, set
56935 </para>
56936 <literallayout class="monospaced">
56937 senders = :
56938 </literallayout>
56939 <para>
56940 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
56941 relaying, because sender addresses are easily, and commonly, forged.
56942 </para>
56943 </listitem></varlistentry>
56944 <varlistentry>
56945 <term><emphasis role="bold">spam&nbsp;=&nbsp;</emphasis>&lt;<emphasis>username</emphasis>&gt;</term>
56946 <listitem>
56947 <para>
56948 <indexterm role="concept">
56949 <primary><option>spam</option> ACL condition</primary>
56950 </indexterm>
56951 <indexterm role="concept">
56952 <primary>access control lists (ACLs)</primary>
56953 <secondary>scanning for spam</secondary>
56954 </indexterm>
56955 This condition is available only when Exim is compiled with the
56956 content-scanning extension. It causes the incoming message to be scanned by
56957 SpamAssassin. For details, see chapter <xref linkend="CHAPexiscan"/>.
56958 </para>
56959 </listitem></varlistentry>
56960 <varlistentry>
56961 <term><emphasis role="bold">verify&nbsp;=&nbsp;certificate</emphasis></term>
56962 <listitem>
56963 <para>
56964 <indexterm role="concept">
56965 <primary><option>verify</option> ACL condition</primary>
56966 </indexterm>
56967 <indexterm role="concept">
56968 <primary>TLS</primary>
56969 <secondary>client certificate verification</secondary>
56970 </indexterm>
56971 <indexterm role="concept">
56972 <primary>certificate</primary>
56973 <secondary>verification of client</secondary>
56974 </indexterm>
56975 <indexterm role="concept">
56976 <primary>access control lists (ACLs)</primary>
56977 <secondary>certificate verification</secondary>
56978 </indexterm>
56979 <indexterm role="concept">
56980 <primary>access control lists (ACLs)</primary>
56981 <secondary>testing a TLS certificate</secondary>
56982 </indexterm>
56983 This condition is true in an SMTP session if the session is encrypted, and a
56984 certificate was received from the client, and the certificate was verified. The
56985 server requests a certificate only if the client matches <option>tls_verify_hosts</option>
56986 or <option>tls_try_verify_hosts</option> (see chapter <xref linkend="CHAPTLS"/>).
56987 </para>
56988 </listitem></varlistentry>
56989 <varlistentry>
56990 <term><emphasis role="bold">verify&nbsp;=&nbsp;csa</emphasis></term>
56991 <listitem>
56992 <para>
56993 <indexterm role="concept">
56994 <primary>CSA verification</primary>
56995 </indexterm>
56996 This condition checks whether the sending host (the client) is authorized to
56997 send email. Details of how this works are given in section
56998 <xref linkend="SECTverifyCSA"/>.
56999 </para>
57000 </listitem></varlistentry>
57001 <varlistentry>
57002 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_names_ascii</emphasis></term>
57003 <listitem>
57004 <para>
57005 <indexterm role="concept">
57006 <primary><option>verify</option> ACL condition</primary>
57007 </indexterm>
57008 <indexterm role="concept">
57009 <primary>access control lists (ACLs)</primary>
57010 <secondary>verifying header names only ASCII</secondary>
57011 </indexterm>
57012 <indexterm role="concept">
57013 <primary>header lines</primary>
57014 <secondary>verifying header names only ASCII</secondary>
57015 </indexterm>
57016 <indexterm role="concept">
57017 <primary>verifying</primary>
57018 <secondary>header names only ASCII</secondary>
57019 </indexterm>
57020 This condition is relevant only in an ACL that is run after a message has been
57021 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
57022 <option>acl_not_smtp</option>.  It checks all header names (not the content) to make sure
57023 there are no non-ASCII characters, also excluding control characters.  The
57024 allowable characters are decimal ASCII values 33 through 126.
57025 </para>
57026 <para>
57027 Exim itself will handle headers with non-ASCII characters, but it can cause
57028 problems for downstream applications, so this option will allow their
57029 detection and rejection in the DATA ACL&#x2019;s.
57030 </para>
57031 </listitem></varlistentry>
57032 <varlistentry>
57033 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_sender/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
57034 <listitem>
57035 <para>
57036 <indexterm role="concept">
57037 <primary><option>verify</option> ACL condition</primary>
57038 </indexterm>
57039 <indexterm role="concept">
57040 <primary>access control lists (ACLs)</primary>
57041 <secondary>verifying sender in the header</secondary>
57042 </indexterm>
57043 <indexterm role="concept">
57044 <primary>header lines</primary>
57045 <secondary>verifying the sender in</secondary>
57046 </indexterm>
57047 <indexterm role="concept">
57048 <primary>sender</primary>
57049 <secondary>verifying in header</secondary>
57050 </indexterm>
57051 <indexterm role="concept">
57052 <primary>verifying</primary>
57053 <secondary>sender in header</secondary>
57054 </indexterm>
57055 This condition is relevant only in an ACL that is run after a message has been
57056 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
57057 <option>acl_not_smtp</option>. It checks that there is a verifiable address in at least one
57058 of the <emphasis>Sender:</emphasis>, <emphasis>Reply-To:</emphasis>, or <emphasis>From:</emphasis> header lines. Such an address
57059 is loosely thought of as a <quote>sender</quote> address (hence the name of the test).
57060 However, an address that appears in one of these headers need not be an address
57061 that accepts bounce messages; only sender addresses in envelopes are required
57062 to accept bounces. Therefore, if you use the callout option on this check, you
57063 might want to arrange for a non-empty address in the MAIL command.
57064 </para>
57065 <para>
57066 Details of address verification and the options are given later, starting at
57067 section <xref linkend="SECTaddressverification"/> (callouts are described in section
57068 <xref linkend="SECTcallver"/>). You can combine this condition with the <option>senders</option>
57069 condition to restrict it to bounce messages only:
57070 </para>
57071 <literallayout class="monospaced">
57072 deny    senders = :
57073         message = A valid sender header is required for bounces
57074        !verify  = header_sender
57075 </literallayout>
57076 </listitem></varlistentry>
57077 <varlistentry>
57078 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_syntax</emphasis></term>
57079 <listitem>
57080 <para>
57081 <indexterm role="concept">
57082 <primary><option>verify</option> ACL condition</primary>
57083 </indexterm>
57084 <indexterm role="concept">
57085 <primary>access control lists (ACLs)</primary>
57086 <secondary>verifying header syntax</secondary>
57087 </indexterm>
57088 <indexterm role="concept">
57089 <primary>header lines</primary>
57090 <secondary>verifying syntax</secondary>
57091 </indexterm>
57092 <indexterm role="concept">
57093 <primary>verifying</primary>
57094 <secondary>header syntax</secondary>
57095 </indexterm>
57096 This condition is relevant only in an ACL that is run after a message has been
57097 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
57098 <option>acl_not_smtp</option>. It checks the syntax of all header lines that can contain
57099 lists of addresses (<emphasis>Sender:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>,
57100 and <emphasis>Bcc:</emphasis>), returning true if there are no problems.
57101 Unqualified addresses (local parts without domains) are
57102 permitted only in locally generated messages and from hosts that match
57103 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
57104 appropriate.
57105 </para>
57106 <para>
57107 Note that this condition is a syntax check only. However, a common spamming
57108 ploy used to be to send syntactically invalid headers such as
57109 </para>
57110 <literallayout class="monospaced">
57111 To: @
57112 </literallayout>
57113 <para>
57114 and this condition can be used to reject such messages, though they are not as
57115 common as they used to be.
57116 </para>
57117 </listitem></varlistentry>
57118 <varlistentry>
57119 <term><emphasis role="bold">verify&nbsp;=&nbsp;helo</emphasis></term>
57120 <listitem>
57121 <para>
57122 <indexterm role="concept">
57123 <primary><option>verify</option> ACL condition</primary>
57124 </indexterm>
57125 <indexterm role="concept">
57126 <primary>access control lists (ACLs)</primary>
57127 <secondary>verifying HELO/EHLO</secondary>
57128 </indexterm>
57129 <indexterm role="concept">
57130 <primary>HELO</primary>
57131 <secondary>verifying</secondary>
57132 </indexterm>
57133 <indexterm role="concept">
57134 <primary>EHLO</primary>
57135 <secondary>verifying</secondary>
57136 </indexterm>
57137 <indexterm role="concept">
57138 <primary>verifying</primary>
57139 <secondary>EHLO</secondary>
57140 </indexterm>
57141 <indexterm role="concept">
57142 <primary>verifying</primary>
57143 <secondary>HELO</secondary>
57144 </indexterm>
57145 This condition is true if a HELO or EHLO command has been received from the
57146 client host, and its contents have been verified. If there has been no previous
57147 attempt to verify the HELO/EHLO contents, it is carried out when this
57148 condition is encountered. See the description of the <option>helo_verify_hosts</option> and
57149 <option>helo_try_verify_hosts</option> options for details of how to request verification
57150 independently of this condition.
57151 </para>
57152 <para>
57153 For SMTP input that does not come over TCP/IP (the <option>-bs</option> command line
57154 option), this condition is always true.
57155 </para>
57156 </listitem></varlistentry>
57157 <varlistentry>
57158 <term><emphasis role="bold">verify&nbsp;=&nbsp;not_blind</emphasis></term>
57159 <listitem>
57160 <para>
57161 <indexterm role="concept">
57162 <primary>verifying</primary>
57163 <secondary>not blind</secondary>
57164 </indexterm>
57165 <indexterm role="concept">
57166 <primary>bcc recipients, verifying none</primary>
57167 </indexterm>
57168 This condition checks that there are no blind (bcc) recipients in the message.
57169 Every envelope recipient must appear either in a <emphasis>To:</emphasis> header line or in a
57170 <emphasis>Cc:</emphasis> header line for this condition to be true. Local parts are checked
57171 case-sensitively; domains are checked case-insensitively. If <emphasis>Resent-To:</emphasis> or
57172 <emphasis>Resent-Cc:</emphasis> header lines exist, they are also checked. This condition can be
57173 used only in a DATA or non-SMTP ACL.
57174 </para>
57175 <para>
57176 There are, of course, many legitimate messages that make use of blind (bcc)
57177 recipients. This check should not be used on its own for blocking messages.
57178 </para>
57179 </listitem></varlistentry>
57180 <varlistentry>
57181 <term><emphasis role="bold">verify&nbsp;=&nbsp;recipient/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
57182 <listitem>
57183 <para>
57184 <indexterm role="concept">
57185 <primary><option>verify</option> ACL condition</primary>
57186 </indexterm>
57187 <indexterm role="concept">
57188 <primary>access control lists (ACLs)</primary>
57189 <secondary>verifying recipient</secondary>
57190 </indexterm>
57191 <indexterm role="concept">
57192 <primary>recipient</primary>
57193 <secondary>verifying</secondary>
57194 </indexterm>
57195 <indexterm role="concept">
57196 <primary>verifying</primary>
57197 <secondary>recipient</secondary>
57198 </indexterm>
57199 <indexterm role="variable">
57200 <primary><varname>$address_data</varname></primary>
57201 </indexterm>
57202 This condition is relevant only after a RCPT command. It verifies the current
57203 recipient. Details of address verification are given later, starting at section
57204 <xref linkend="SECTaddressverification"/>. After a recipient has been verified, the value
57205 of <varname>$address_data</varname> is the last value that was set while routing the address.
57206 This applies even if the verification fails. When an address that is being
57207 verified is redirected to a single address, verification continues with the new
57208 address, and in that case, the subsequent value of <varname>$address_data</varname> is the
57209 value for the child address.
57210 </para>
57211 </listitem></varlistentry>
57212 <varlistentry>
57213 <term><emphasis role="bold">verify&nbsp;=&nbsp;reverse_host_lookup/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
57214 <listitem>
57215 <para>
57216 <indexterm role="concept">
57217 <primary><option>verify</option> ACL condition</primary>
57218 </indexterm>
57219 <indexterm role="concept">
57220 <primary>access control lists (ACLs)</primary>
57221 <secondary>verifying host reverse lookup</secondary>
57222 </indexterm>
57223 <indexterm role="concept">
57224 <primary>host</primary>
57225 <secondary>verifying reverse lookup</secondary>
57226 </indexterm>
57227 This condition ensures that a verified host name has been looked up from the IP
57228 address of the client host. (This may have happened already if the host name
57229 was needed for checking a host list, or if the host matched <option>host_lookup</option>.)
57230 Verification ensures that the host name obtained from a reverse DNS lookup, or
57231 one of its aliases, does, when it is itself looked up in the DNS, yield the
57232 original IP address.
57233 </para>
57234 <para>
57235 There is one possible option, <literal>defer_ok</literal>.  If this is present and a
57236 DNS operation returns a temporary error, the verify condition succeeds.
57237 </para>
57238 <para>
57239 If this condition is used for a locally generated message (that is, when there
57240 is no client host involved), it always succeeds.
57241 </para>
57242 </listitem></varlistentry>
57243 <varlistentry>
57244 <term><emphasis role="bold">verify&nbsp;=&nbsp;sender/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
57245 <listitem>
57246 <para>
57247 <indexterm role="concept">
57248 <primary><option>verify</option> ACL condition</primary>
57249 </indexterm>
57250 <indexterm role="concept">
57251 <primary>access control lists (ACLs)</primary>
57252 <secondary>verifying sender</secondary>
57253 </indexterm>
57254 <indexterm role="concept">
57255 <primary>sender</primary>
57256 <secondary>verifying</secondary>
57257 </indexterm>
57258 <indexterm role="concept">
57259 <primary>verifying</primary>
57260 <secondary>sender</secondary>
57261 </indexterm>
57262 This condition is relevant only after a MAIL or RCPT command, or after a
57263 message has been received (the <option>acl_smtp_data</option> or <option>acl_not_smtp</option> ACLs). If
57264 the message&#x2019;s sender is empty (that is, this is a bounce message), the
57265 condition is true. Otherwise, the sender address is verified.
57266 </para>
57267 <para>
57268 <indexterm role="variable">
57269 <primary><varname>$address_data</varname></primary>
57270 </indexterm>
57271 <indexterm role="variable">
57272 <primary><varname>$sender_address_data</varname></primary>
57273 </indexterm>
57274 If there is data in the <varname>$address_data</varname> variable at the end of routing, its
57275 value is placed in <varname>$sender_address_data</varname> at the end of verification. This
57276 value can be used in subsequent conditions and modifiers in the same ACL
57277 statement. It does not persist after the end of the current statement. If you
57278 want to preserve the value for longer, you can save it in an ACL variable.
57279 </para>
57280 <para>
57281 Details of verification are given later, starting at section
57282 <xref linkend="SECTaddressverification"/>. Exim caches the result of sender verification,
57283 to avoid doing it more than once per message.
57284 </para>
57285 </listitem></varlistentry>
57286 <varlistentry>
57287 <term><emphasis role="bold">verify&nbsp;=&nbsp;sender=</emphasis>&lt;<emphasis>address</emphasis>&gt;<emphasis role="bold">/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
57288 <listitem>
57289 <para>
57290 <indexterm role="concept">
57291 <primary><option>verify</option> ACL condition</primary>
57292 </indexterm>
57293 This is a variation of the previous option, in which a modified address is
57294 verified as a sender.
57295 </para>
57296 <para>
57297 Note that &#x2019;/&#x2019; is legal in local-parts; if the address may have such
57298 (eg. is generated from the received message)
57299 they must be protected from the options parsing by doubling:
57300 </para>
57301 <literallayout class="monospaced">
57302 verify = sender=${sg{${address:$h_sender:}}{/}{//}}
57303 </literallayout>
57304 </listitem></varlistentry>
57305 </variablelist>
57306 </section>
57307 <section id="SECTmorednslists">
57308 <title>Using DNS lists</title>
57309 <para>
57310 <indexterm role="concept">
57311 <primary>DNS list</primary>
57312 <secondary>in ACL</secondary>
57313 </indexterm>
57314 <indexterm role="concept">
57315 <primary>black list (DNS)</primary>
57316 </indexterm>
57317 <indexterm role="concept">
57318 <primary>access control lists (ACLs)</primary>
57319 <secondary>testing a DNS list</secondary>
57320 </indexterm>
57321 In its simplest form, the <option>dnslists</option> condition tests whether the calling host
57322 is on at least one of a number of DNS lists by looking up the inverted IP
57323 address in one or more DNS domains. (Note that DNS list domains are not mail
57324 domains, so the <literal>+</literal> syntax for named lists doesn&#x2019;t work - it is used for
57325 special options instead.) For example, if the calling host&#x2019;s IP
57326 address is 192.168.62.43, and the ACL statement is
57327 </para>
57328 <literallayout class="monospaced">
57329 deny dnslists = blackholes.mail-abuse.org : \
57330                 dialups.mail-abuse.org
57331 </literallayout>
57332 <para>
57333 the following records are looked up:
57334 </para>
57335 <literallayout class="monospaced">
57336 43.62.168.192.blackholes.mail-abuse.org
57337 43.62.168.192.dialups.mail-abuse.org
57338 </literallayout>
57339 <para>
57340 As soon as Exim finds an existing DNS record, processing of the list stops.
57341 Thus, multiple entries on the list provide an <quote>or</quote> conjunction. If you want
57342 to test that a host is on more than one list (an <quote>and</quote> conjunction), you can
57343 use two separate conditions:
57344 </para>
57345 <literallayout class="monospaced">
57346 deny dnslists = blackholes.mail-abuse.org
57347      dnslists = dialups.mail-abuse.org
57348 </literallayout>
57349 <para>
57350 If a DNS lookup times out or otherwise fails to give a decisive answer, Exim
57351 behaves as if the host does not match the list item, that is, as if the DNS
57352 record does not exist. If there are further items in the DNS list, they are
57353 processed.
57354 </para>
57355 <para>
57356 This is usually the required action when <option>dnslists</option> is used with <option>deny</option>
57357 (which is the most common usage), because it prevents a DNS failure from
57358 blocking mail. However, you can change this behaviour by putting one of the
57359 following special items in the list:
57360 </para>
57361 <literallayout>
57362 <literal>+include_unknown </literal>   behave as if the item is on the list
57363 <literal>+exclude_unknown </literal>   behave as if the item is not on the list (default)
57364 <literal>+defer_unknown   </literal>   give a temporary error
57365 </literallayout>
57366 <para>
57367 <indexterm role="concept">
57368 <primary><literal>+include_unknown</literal></primary>
57369 </indexterm>
57370 <indexterm role="concept">
57371 <primary><literal>+exclude_unknown</literal></primary>
57372 </indexterm>
57373 <indexterm role="concept">
57374 <primary><literal>+defer_unknown</literal></primary>
57375 </indexterm>
57376 Each of these applies to any subsequent items on the list. For example:
57377 </para>
57378 <literallayout class="monospaced">
57379 deny dnslists = +defer_unknown : foo.bar.example
57380 </literallayout>
57381 <para>
57382 Testing the list of domains stops as soon as a match is found. If you want to
57383 warn for one list and block for another, you can use two different statements:
57384 </para>
57385 <literallayout class="monospaced">
57386 deny  dnslists = blackholes.mail-abuse.org
57387 warn  message  = X-Warn: sending host is on dialups list
57388       dnslists = dialups.mail-abuse.org
57389 </literallayout>
57390 <para>
57391 <indexterm role="concept">
57392 <primary>caching</primary>
57393 <secondary>of dns lookup</secondary>
57394 </indexterm>
57395 <indexterm role="concept">
57396 <primary>DNS</primary>
57397 <secondary>TTL</secondary>
57398 </indexterm>
57399 DNS list lookups are cached by Exim for the duration of the SMTP session
57400 (but limited by the DNS return TTL value),
57401 so a lookup based on the IP address is done at most once for any incoming
57402 connection (assuming long-enough TTL).
57403 Exim does not share information between multiple incoming
57404 connections (but your local name server cache should be active).
57405 </para>
57406 </section>
57407 <section id="SECID201">
57408 <title>Specifying the IP address for a DNS list lookup</title>
57409 <para>
57410 <indexterm role="concept">
57411 <primary>DNS list</primary>
57412 <secondary>keyed by explicit IP address</secondary>
57413 </indexterm>
57414 By default, the IP address that is used in a DNS list lookup is the IP address
57415 of the calling host. However, you can specify another IP address by listing it
57416 after the domain name, introduced by a slash. For example:
57417 </para>
57418 <literallayout class="monospaced">
57419 deny dnslists = black.list.tld/192.168.1.2
57420 </literallayout>
57421 <para>
57422 This feature is not very helpful with explicit IP addresses; it is intended for
57423 use with IP addresses that are looked up, for example, the IP addresses of the
57424 MX hosts or nameservers of an email sender address. For an example, see section
57425 <xref linkend="SECTmulkeyfor"/> below.
57426 </para>
57427 </section>
57428 <section id="SECID202">
57429 <title>DNS lists keyed on domain names</title>
57430 <para>
57431 <indexterm role="concept">
57432 <primary>DNS list</primary>
57433 <secondary>keyed by domain name</secondary>
57434 </indexterm>
57435 There are some lists that are keyed on domain names rather than inverted IP
57436 addresses (see for example the <emphasis>domain based zones</emphasis> link at
57437 <emphasis role="bold"><ulink url="http://www.rfc-ignorant.org/">http://www.rfc-ignorant.org/</ulink></emphasis>). No reversing of components is used
57438 with these lists. You can change the name that is looked up in a DNS list by
57439 listing it after the domain name, introduced by a slash. For example,
57440 </para>
57441 <literallayout class="monospaced">
57442 deny  message  = Sender's domain is listed at $dnslist_domain
57443       dnslists = dsn.rfc-ignorant.org/$sender_address_domain
57444 </literallayout>
57445 <para>
57446 This particular example is useful only in ACLs that are obeyed after the
57447 RCPT or DATA commands, when a sender address is available. If (for
57448 example) the message&#x2019;s sender is <emphasis>user@tld.example</emphasis> the name that is looked
57449 up by this example is
57450 </para>
57451 <literallayout class="monospaced">
57452 tld.example.dsn.rfc-ignorant.org
57453 </literallayout>
57454 <para>
57455 A single <option>dnslists</option> condition can contain entries for both names and IP
57456 addresses. For example:
57457 </para>
57458 <literallayout class="monospaced">
57459 deny dnslists = sbl.spamhaus.org : \
57460                 dsn.rfc-ignorant.org/$sender_address_domain
57461 </literallayout>
57462 <para>
57463 The first item checks the sending host&#x2019;s IP address; the second checks a domain
57464 name. The whole condition is true if either of the DNS lookups succeeds.
57465 </para>
57466 </section>
57467 <section id="SECTmulkeyfor">
57468 <title>Multiple explicit keys for a DNS list</title>
57469 <para>
57470 <indexterm role="concept">
57471 <primary>DNS list</primary>
57472 <secondary>multiple keys for</secondary>
57473 </indexterm>
57474 The syntax described above for looking up explicitly-defined values (either
57475 names or IP addresses) in a DNS blacklist is a simplification. After the domain
57476 name for the DNS list, what follows the slash can in fact be a list of items.
57477 As with all lists in Exim, the default separator is a colon. However, because
57478 this is a sublist within the list of DNS blacklist domains, it is necessary
57479 either to double the separators like this:
57480 </para>
57481 <literallayout class="monospaced">
57482 dnslists = black.list.tld/name.1::name.2
57483 </literallayout>
57484 <para>
57485 or to change the separator character, like this:
57486 </para>
57487 <literallayout class="monospaced">
57488 dnslists = black.list.tld/&lt;;name.1;name.2
57489 </literallayout>
57490 <para>
57491 If an item in the list is an IP address, it is inverted before the DNS
57492 blacklist domain is appended. If it is not an IP address, no inversion
57493 occurs. Consider this condition:
57494 </para>
57495 <literallayout class="monospaced">
57496 dnslists = black.list.tld/&lt;;192.168.1.2;a.domain
57497 </literallayout>
57498 <para>
57499 The DNS lookups that occur are:
57500 </para>
57501 <literallayout class="monospaced">
57502 2.1.168.192.black.list.tld
57503 a.domain.black.list.tld
57504 </literallayout>
57505 <para>
57506 Once a DNS record has been found (that matches a specific IP return
57507 address, if specified &ndash; see section <xref linkend="SECTaddmatcon"/>), no further lookups
57508 are done. If there is a temporary DNS error, the rest of the sublist of domains
57509 or IP addresses is tried. A temporary error for the whole dnslists item occurs
57510 only if no other DNS lookup in this sublist succeeds. In other words, a
57511 successful lookup for any of the items in the sublist overrides a temporary
57512 error for a previous item.
57513 </para>
57514 <para>
57515 The ability to supply a list of items after the slash is in some sense just a
57516 syntactic convenience. These two examples have the same effect:
57517 </para>
57518 <literallayout class="monospaced">
57519 dnslists = black.list.tld/a.domain : black.list.tld/b.domain
57520 dnslists = black.list.tld/a.domain::b.domain
57521 </literallayout>
57522 <para>
57523 However, when the data for the list is obtained from a lookup, the second form
57524 is usually much more convenient. Consider this example:
57525 </para>
57526 <literallayout class="monospaced">
57527 deny message  = The mail servers for the domain \
57528                 $sender_address_domain \
57529                 are listed at $dnslist_domain ($dnslist_value); \
57530                 see $dnslist_text.
57531      dnslists = sbl.spamhaus.org/&lt;|${lookup dnsdb {&gt;|a=&lt;|\
57532                                    ${lookup dnsdb {&gt;|mxh=\
57533                                    $sender_address_domain} }} }
57534 </literallayout>
57535 <para>
57536 Note the use of <literal>&gt;|</literal> in the dnsdb lookup to specify the separator for
57537 multiple DNS records. The inner dnsdb lookup produces a list of MX hosts
57538 and the outer dnsdb lookup finds the IP addresses for these hosts. The result
57539 of expanding the condition might be something like this:
57540 </para>
57541 <literallayout class="monospaced">
57542 dnslists = sbl.spamhaus.org/&lt;|192.168.2.3|192.168.5.6|...
57543 </literallayout>
57544 <para>
57545 Thus, this example checks whether or not the IP addresses of the sender
57546 domain&#x2019;s mail servers are on the Spamhaus black list.
57547 </para>
57548 <para>
57549 The key that was used for a successful DNS list lookup is put into the variable
57550 <varname>$dnslist_matched</varname> (see section <xref linkend="SECID204"/>).
57551 </para>
57552 </section>
57553 <section id="SECID203">
57554 <title>Data returned by DNS lists</title>
57555 <para>
57556 <indexterm role="concept">
57557 <primary>DNS list</primary>
57558 <secondary>data returned from</secondary>
57559 </indexterm>
57560 DNS lists are constructed using address records in the DNS. The original RBL
57561 just used the address 127.0.0.1 on the right hand side of each record, but the
57562 RBL+ list and some other lists use a number of values with different meanings.
57563 The values used on the RBL+ list are:
57564 </para>
57565 <literallayout>
57566 127.1.0.1  RBL
57567 127.1.0.2  DUL
57568 127.1.0.3  DUL and RBL
57569 127.1.0.4  RSS
57570 127.1.0.5  RSS and RBL
57571 127.1.0.6  RSS and DUL
57572 127.1.0.7  RSS and DUL and RBL
57573 </literallayout>
57574 <para>
57575 Section <xref linkend="SECTaddmatcon"/> below describes how you can distinguish between
57576 different values. Some DNS lists may return more than one address record;
57577 see section <xref linkend="SECThanmuldnsrec"/> for details of how they are checked.
57578 </para>
57579 </section>
57580 <section id="SECID204">
57581 <title>Variables set from DNS lists</title>
57582 <para>
57583 <indexterm role="concept">
57584 <primary>expansion</primary>
57585 <secondary>variables, set from DNS list</secondary>
57586 </indexterm>
57587 <indexterm role="concept">
57588 <primary>DNS list</primary>
57589 <secondary>variables set from</secondary>
57590 </indexterm>
57591 <indexterm role="variable">
57592 <primary><varname>$dnslist_domain</varname></primary>
57593 </indexterm>
57594 <indexterm role="variable">
57595 <primary><varname>$dnslist_matched</varname></primary>
57596 </indexterm>
57597 <indexterm role="variable">
57598 <primary><varname>$dnslist_text</varname></primary>
57599 </indexterm>
57600 <indexterm role="variable">
57601 <primary><varname>$dnslist_value</varname></primary>
57602 </indexterm>
57603 When an entry is found in a DNS list, the variable <varname>$dnslist_domain</varname> contains
57604 the name of the overall domain that matched (for example,
57605 <literal>spamhaus.example</literal>), <varname>$dnslist_matched</varname> contains the key within that domain
57606 (for example, <literal>192.168.5.3</literal>), and <varname>$dnslist_value</varname> contains the data from
57607 the DNS record. When the key is an IP address, it is not reversed in
57608 <varname>$dnslist_matched</varname> (though it is, of course, in the actual lookup). In simple
57609 cases, for example:
57610 </para>
57611 <literallayout class="monospaced">
57612 deny dnslists = spamhaus.example
57613 </literallayout>
57614 <para>
57615 the key is also available in another variable (in this case,
57616 <varname>$sender_host_address</varname>). In more complicated cases, however, this is not true.
57617 For example, using a data lookup (as described in section <xref linkend="SECTmulkeyfor"/>)
57618 might generate a dnslists lookup like this:
57619 </para>
57620 <literallayout class="monospaced">
57621 deny dnslists = spamhaus.example/&lt;|192.168.1.2|192.168.6.7|...
57622 </literallayout>
57623 <para>
57624 If this condition succeeds, the value in <varname>$dnslist_matched</varname> might be
57625 <literal>192.168.6.7</literal> (for example).
57626 </para>
57627 <para>
57628 If more than one address record is returned by the DNS lookup, all the IP
57629 addresses are included in <varname>$dnslist_value</varname>, separated by commas and spaces.
57630 The variable <varname>$dnslist_text</varname> contains the contents of any associated TXT
57631 record. For lists such as RBL+ the TXT record for a merged entry is often not
57632 very meaningful. See section <xref linkend="SECTmordetinf"/> for a way of obtaining more
57633 information.
57634 </para>
57635 <para>
57636 You can use the DNS list variables in <option>message</option> or <option>log_message</option> modifiers
57637 &ndash; although these appear before the condition in the ACL, they are not
57638 expanded until after it has failed. For example:
57639 </para>
57640 <literallayout class="monospaced">
57641 deny    hosts = !+local_networks
57642         message = $sender_host_address is listed \
57643                   at $dnslist_domain
57644         dnslists = rbl-plus.mail-abuse.example
57645 </literallayout>
57646 </section>
57647 <section id="SECTaddmatcon">
57648 <title>Additional matching conditions for DNS lists</title>
57649 <para>
57650 <indexterm role="concept">
57651 <primary>DNS list</primary>
57652 <secondary>matching specific returned data</secondary>
57653 </indexterm>
57654 You can add an equals sign and an IP address after a <option>dnslists</option> domain name
57655 in order to restrict its action to DNS records with a matching right hand side.
57656 For example,
57657 </para>
57658 <literallayout class="monospaced">
57659 deny dnslists = rblplus.mail-abuse.org=127.0.0.2
57660 </literallayout>
57661 <para>
57662 rejects only those hosts that yield 127.0.0.2. Without this additional data,
57663 any address record is considered to be a match. For the moment, we assume
57664 that the DNS lookup returns just one record. Section <xref linkend="SECThanmuldnsrec"/>
57665 describes how multiple records are handled.
57666 </para>
57667 <para>
57668 More than one IP address may be given for checking, using a comma as a
57669 separator. These are alternatives &ndash; if any one of them matches, the
57670 <option>dnslists</option> condition is true. For example:
57671 </para>
57672 <literallayout class="monospaced">
57673 deny  dnslists = a.b.c=127.0.0.2,127.0.0.3
57674 </literallayout>
57675 <para>
57676 If you want to specify a constraining address list and also specify names or IP
57677 addresses to be looked up, the constraining address list must be specified
57678 first. For example:
57679 </para>
57680 <literallayout class="monospaced">
57681 deny dnslists = dsn.rfc-ignorant.org\
57682                 =127.0.0.2/$sender_address_domain
57683 </literallayout>
57684 <para>
57685 If the character <literal>&amp;</literal> is used instead of <literal>=</literal>, the comparison for each
57686 listed IP address is done by a bitwise <quote>and</quote> instead of by an equality test.
57687 In other words, the listed addresses are used as bit masks. The comparison is
57688 true if all the bits in the mask are present in the address that is being
57689 tested. For example:
57690 </para>
57691 <literallayout class="monospaced">
57692 dnslists = a.b.c&amp;0.0.0.3
57693 </literallayout>
57694 <para>
57695 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
57696 want to test whether one bit or another bit is present (as opposed to both
57697 being present), you must use multiple values. For example:
57698 </para>
57699 <literallayout class="monospaced">
57700 dnslists = a.b.c&amp;0.0.0.1,0.0.0.2
57701 </literallayout>
57702 <para>
57703 matches if the final component of the address is an odd number or two times
57704 an odd number.
57705 </para>
57706 </section>
57707 <section id="SECID205">
57708 <title>Negated DNS matching conditions</title>
57709 <para>
57710 You can supply a negative list of IP addresses as part of a <option>dnslists</option>
57711 condition. Whereas
57712 </para>
57713 <literallayout class="monospaced">
57714 deny  dnslists = a.b.c=127.0.0.2,127.0.0.3
57715 </literallayout>
57716 <para>
57717 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
57718 IP address yielded by the list is either 127.0.0.2 or 127.0.0.3</quote>,
57719 </para>
57720 <literallayout class="monospaced">
57721 deny  dnslists = a.b.c!=127.0.0.2,127.0.0.3
57722 </literallayout>
57723 <para>
57724 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
57725 IP address yielded by the list is not 127.0.0.2 and not 127.0.0.3</quote>. In other
57726 words, the result of the test is inverted if an exclamation mark appears before
57727 the <literal>=</literal> (or the <literal>&amp;</literal>) sign.
57728 </para>
57729 <para>
57730 <emphasis role="bold">Note</emphasis>: This kind of negation is not the same as negation in a domain,
57731 host, or address list (which is why the syntax is different).
57732 </para>
57733 <para>
57734 If you are using just one list, the negation syntax does not gain you much. The
57735 previous example is precisely equivalent to
57736 </para>
57737 <literallayout class="monospaced">
57738 deny  dnslists = a.b.c
57739      !dnslists = a.b.c=127.0.0.2,127.0.0.3
57740 </literallayout>
57741 <para>
57742 However, if you are using multiple lists, the negation syntax is clearer.
57743 Consider this example:
57744 </para>
57745 <literallayout class="monospaced">
57746 deny  dnslists = sbl.spamhaus.org : \
57747                  list.dsbl.org : \
57748                  dnsbl.njabl.org!=127.0.0.3 : \
57749                  relays.ordb.org
57750 </literallayout>
57751 <para>
57752 Using only positive lists, this would have to be:
57753 </para>
57754 <literallayout class="monospaced">
57755 deny  dnslists = sbl.spamhaus.org : \
57756                  list.dsbl.org
57757 deny  dnslists = dnsbl.njabl.org
57758      !dnslists = dnsbl.njabl.org=127.0.0.3
57759 deny  dnslists = relays.ordb.org
57760 </literallayout>
57761 <para>
57762 which is less clear, and harder to maintain.
57763 </para>
57764 </section>
57765 <section id="SECThanmuldnsrec">
57766 <title>Handling multiple DNS records from a DNS list</title>
57767 <para>
57768 A DNS lookup for a <option>dnslists</option> condition may return more than one DNS record,
57769 thereby providing more than one IP address. When an item in a <option>dnslists</option> list
57770 is followed by <literal>=</literal> or <literal>&amp;</literal> and a list of IP addresses, in order to restrict
57771 the match to specific results from the DNS lookup, there are two ways in which
57772 the checking can be handled. For example, consider the condition:
57773 </para>
57774 <literallayout class="monospaced">
57775 dnslists = a.b.c=127.0.0.1
57776 </literallayout>
57777 <para>
57778 What happens if the DNS lookup for the incoming IP address yields both
57779 127.0.0.1 and 127.0.0.2 by means of two separate DNS records? Is the
57780 condition true because at least one given value was found, or is it false
57781 because at least one of the found values was not listed? And how does this
57782 affect negated conditions? Both possibilities are provided for with the help of
57783 additional separators <literal>==</literal> and <literal>=&amp;</literal>.
57784 </para>
57785 <itemizedlist>
57786 <listitem>
57787 <para>
57788 If <literal>=</literal> or <literal>&amp;</literal> is used, the condition is true if any one of the looked up
57789 IP addresses matches one of the listed addresses. For the example above, the
57790 condition is true because 127.0.0.1 matches.
57791 </para>
57792 </listitem>
57793 <listitem>
57794 <para>
57795 If <literal>==</literal> or <literal>=&amp;</literal> is used, the condition is true only if every one of the
57796 looked up IP addresses matches one of the listed addresses. If the condition is
57797 changed to:
57798 </para>
57799 <literallayout class="monospaced">
57800 dnslists = a.b.c==127.0.0.1
57801 </literallayout>
57802 <para>
57803 and the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
57804 false because 127.0.0.2 is not listed. You would need to have:
57805 </para>
57806 <literallayout class="monospaced">
57807 dnslists = a.b.c==127.0.0.1,127.0.0.2
57808 </literallayout>
57809 <para>
57810 for the condition to be true.
57811 </para>
57812 </listitem>
57813 </itemizedlist>
57814 <para>
57815 When <literal>!</literal> is used to negate IP address matching, it inverts the result, giving
57816 the precise opposite of the behaviour above. Thus:
57817 </para>
57818 <itemizedlist>
57819 <listitem>
57820 <para>
57821 If <literal>!=</literal> or <literal>!&amp;</literal> is used, the condition is true if none of the looked up IP
57822 addresses matches one of the listed addresses. Consider:
57823 </para>
57824 <literallayout class="monospaced">
57825 dnslists = a.b.c!&amp;0.0.0.1
57826 </literallayout>
57827 <para>
57828 If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
57829 false because 127.0.0.1 matches.
57830 </para>
57831 </listitem>
57832 <listitem>
57833 <para>
57834 If <literal>!==</literal> or <literal>!=&amp;</literal> is used, the condition is true if there is at least one
57835 looked up IP address that does not match. Consider:
57836 </para>
57837 <literallayout class="monospaced">
57838 dnslists = a.b.c!=&amp;0.0.0.1
57839 </literallayout>
57840 <para>
57841 If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
57842 true, because 127.0.0.2 does not match. You would need to have:
57843 </para>
57844 <literallayout class="monospaced">
57845 dnslists = a.b.c!=&amp;0.0.0.1,0.0.0.2
57846 </literallayout>
57847 <para>
57848 for the condition to be false.
57849 </para>
57850 </listitem>
57851 </itemizedlist>
57852 <para>
57853 When the DNS lookup yields only a single IP address, there is no difference
57854 between <literal>=</literal> and <literal>==</literal> and between <literal>&amp;</literal> and <literal>=&amp;</literal>.
57855 </para>
57856 </section>
57857 <section id="SECTmordetinf">
57858 <title>Detailed information from merged DNS lists</title>
57859 <para>
57860 <indexterm role="concept">
57861 <primary>DNS list</primary>
57862 <secondary>information from merged</secondary>
57863 </indexterm>
57864 When the facility for restricting the matching IP values in a DNS list is used,
57865 the text from the TXT record that is set in <varname>$dnslist_text</varname> may not reflect
57866 the true reason for rejection. This happens when lists are merged and the IP
57867 address in the A record is used to distinguish them; unfortunately there is
57868 only one TXT record. One way round this is not to use merged lists, but that
57869 can be inefficient because it requires multiple DNS lookups where one would do
57870 in the vast majority of cases when the host of interest is not on any of the
57871 lists.
57872 </para>
57873 <para>
57874 A less inefficient way of solving this problem is available. If
57875 two domain names, comma-separated, are given, the second is used first to
57876 do an initial check, making use of any IP value restrictions that are set.
57877 If there is a match, the first domain is used, without any IP value
57878 restrictions, to get the TXT record. As a byproduct of this, there is also
57879 a check that the IP being tested is indeed on the first list. The first
57880 domain is the one that is put in <varname>$dnslist_domain</varname>. For example:
57881 </para>
57882 <literallayout class="monospaced">
57883 reject message  = \
57884          rejected because $sender_host_address is blacklisted \
57885          at $dnslist_domain\n$dnslist_text
57886        dnslists = \
57887          sbl.spamhaus.org,sbl-xbl.spamhaus.org=127.0.0.2 : \
57888          dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
57889 </literallayout>
57890 <para>
57891 For the first blacklist item, this starts by doing a lookup in
57892 <emphasis>sbl-xbl.spamhaus.org</emphasis> and testing for a 127.0.0.2 return. If there is a
57893 match, it then looks in <emphasis>sbl.spamhaus.org</emphasis>, without checking the return
57894 value, and as long as something is found, it looks for the corresponding TXT
57895 record. If there is no match in <emphasis>sbl-xbl.spamhaus.org</emphasis>, nothing more is done.
57896 The second blacklist item is processed similarly.
57897 </para>
57898 <para>
57899 If you are interested in more than one merged list, the same list must be
57900 given several times, but because the results of the DNS lookups are cached,
57901 the DNS calls themselves are not repeated. For example:
57902 </para>
57903 <literallayout class="monospaced">
57904 reject dnslists = \
57905          http.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.2 : \
57906          socks.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.3 : \
57907          misc.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.4 : \
57908          dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
57909 </literallayout>
57910 <para>
57911 In this case there is one lookup in <emphasis>dnsbl.sorbs.net</emphasis>, and if none of the IP
57912 values matches (or if no record is found), this is the only lookup that is
57913 done. Only if there is a match is one of the more specific lists consulted.
57914 </para>
57915 </section>
57916 <section id="SECTmorednslistslast">
57917 <title>DNS lists and IPv6</title>
57918 <para>
57919 <indexterm role="concept">
57920 <primary>IPv6</primary>
57921 <secondary>DNS black lists</secondary>
57922 </indexterm>
57923 <indexterm role="concept">
57924 <primary>DNS list</primary>
57925 <secondary>IPv6 usage</secondary>
57926 </indexterm>
57927 If Exim is asked to do a dnslist lookup for an IPv6 address, it inverts it
57928 nibble by nibble. For example, if the calling host&#x2019;s IP address is
57929 3ffe:ffff:836f:0a00:000a:0800:200a:c031, Exim might look up
57930 </para>
57931 <literallayout class="monospaced">
57932 1.3.0.c.a.0.0.2.0.0.8.0.a.0.0.0.0.0.a.0.f.6.3.8.
57933   f.f.f.f.e.f.f.3.blackholes.mail-abuse.org
57934 </literallayout>
57935 <para>
57936 (split over two lines here to fit on the page). Unfortunately, some of the DNS
57937 lists contain wildcard records, intended for IPv4, that interact badly with
57938 IPv6. For example, the DNS entry
57939 </para>
57940 <literallayout class="monospaced">
57941 *.3.some.list.example.    A    127.0.0.1
57942 </literallayout>
57943 <para>
57944 is probably intended to put the entire 3.0.0.0/8 IPv4 network on the list.
57945 Unfortunately, it also matches the entire 3::/4 IPv6 network.
57946 </para>
57947 <para>
57948 You can exclude IPv6 addresses from DNS lookups by making use of a suitable
57949 <option>condition</option> condition, as in this example:
57950 </para>
57951 <literallayout class="monospaced">
57952 deny   condition = ${if isip4{$sender_host_address}}
57953        dnslists  = some.list.example
57954 </literallayout>
57955 <para>
57956 If an explicit key is being used for a DNS lookup and it may be an IPv6
57957 address you should specify alternate list separators for both the outer
57958 (DNS list name) list and inner (lookup keys) list:
57959 </para>
57960 <literallayout class="monospaced">
57961        dnslists = &lt;; dnsbl.example.com/&lt;|$acl_m_addrslist
57962 </literallayout>
57963 </section>
57964 <section id="SECTratelimiting">
57965 <title>Rate limiting incoming messages</title>
57966 <para>
57967 <indexterm role="concept">
57968 <primary>rate limiting</primary>
57969 <secondary>client sending</secondary>
57970 </indexterm>
57971 <indexterm role="concept">
57972 <primary>limiting client sending rates</primary>
57973 </indexterm>
57974 <indexterm role="option">
57975 <primary><option>smtp_ratelimit_*</option></primary>
57976 </indexterm>
57977 The <option>ratelimit</option> ACL condition can be used to measure and control the rate at
57978 which clients can send email. This is more powerful than the
57979 <option>smtp_ratelimit_*</option> options, because those options control the rate of
57980 commands in a single SMTP session only, whereas the <option>ratelimit</option> condition
57981 works across all connections (concurrent and sequential) from the same client
57982 host. The syntax of the <option>ratelimit</option> condition is:
57983 </para>
57984 <literallayout>
57985 <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;
57986 </literallayout>
57987 <para>
57988 If the average client sending rate is less than <emphasis>m</emphasis> messages per time
57989 period <emphasis>p</emphasis> then the condition is false; otherwise it is true.
57990 </para>
57991 <para>
57992 As a side-effect, the <option>ratelimit</option> condition sets the expansion variable
57993 <varname>$sender_rate</varname> to the client&#x2019;s computed rate, <varname>$sender_rate_limit</varname> to the
57994 configured value of <emphasis>m</emphasis>, and <varname>$sender_rate_period</varname> to the configured value
57995 of <emphasis>p</emphasis>.
57996 </para>
57997 <para>
57998 The parameter <emphasis>p</emphasis> is the smoothing time constant, in the form of an Exim
57999 time interval, for example, <literal>8h</literal> for eight hours. A larger time constant
58000 means that it takes Exim longer to forget a client&#x2019;s past behaviour. The
58001 parameter <emphasis>m</emphasis> is the maximum number of messages that a client is permitted to
58002 send in each time interval. It also specifies the number of messages permitted
58003 in a fast burst. By increasing both <emphasis>m</emphasis> and <emphasis>p</emphasis> but keeping <emphasis>m/p</emphasis>
58004 constant, you can allow a client to send more messages in a burst without
58005 changing its long-term sending rate limit. Conversely, if <emphasis>m</emphasis> and <emphasis>p</emphasis> are
58006 both small, messages must be sent at an even rate.
58007 </para>
58008 <para>
58009 There is a script in <filename>util/ratelimit.pl</filename> which extracts sending rates from
58010 log files, to assist with choosing appropriate settings for <emphasis>m</emphasis> and <emphasis>p</emphasis>
58011 when deploying the <option>ratelimit</option> ACL condition. The script prints usage
58012 instructions when it is run with no arguments.
58013 </para>
58014 <para>
58015 The key is used to look up the data for calculating the client&#x2019;s average
58016 sending rate. This data is stored in Exim&#x2019;s spool directory, alongside the
58017 retry and other hints databases. The default key is <varname>$sender_host_address</varname>,
58018 which means Exim computes the sending rate of each client host IP address.
58019 By changing the key you can change how Exim identifies clients for the purpose
58020 of ratelimiting. For example, to limit the sending rate of each authenticated
58021 user, independent of the computer they are sending from, set the key to
58022 <varname>$authenticated_id</varname>. You must ensure that the lookup key is meaningful; for
58023 example, <varname>$authenticated_id</varname> is only meaningful if the client has
58024 authenticated (which you can check with the <option>authenticated</option> ACL condition).
58025 </para>
58026 <para>
58027 The lookup key does not have to identify clients: If you want to limit the
58028 rate at which a recipient receives messages, you can use the key
58029 <literal>$local_part@$domain</literal> with the <option>per_rcpt</option> option (see below) in a RCPT
58030 ACL.
58031 </para>
58032 <para>
58033 Each <option>ratelimit</option> condition can have up to four options. A <option>per_*</option> option
58034 specifies what Exim measures the rate of, for example messages or recipients
58035 or bytes. You can adjust the measurement using the <option>unique=</option> and/or
58036 <option>count=</option> options. You can also control when Exim updates the recorded rate
58037 using a <option>strict</option>, <option>leaky</option>, or <option>readonly</option> option. The options are
58038 separated by a slash, like the other parameters. They may appear in any order.
58039 </para>
58040 <para>
58041 Internally, Exim appends the smoothing constant <emphasis>p</emphasis> onto the lookup key with
58042 any options that alter the meaning of the stored data. The limit <emphasis>m</emphasis> is not
58043 stored, so you can alter the configured maximum rate and Exim will still
58044 remember clients&#x2019; past behaviour. If you change the <option>per_*</option> mode or add or
58045 remove the <option>unique=</option> option, the lookup key changes so Exim will forget past
58046 behaviour. The lookup key is not affected by changes to the update mode and
58047 the <option>count=</option> option.
58048 </para>
58049 </section>
58050 <section id="ratoptmea">
58051 <title>Ratelimit options for what is being measured</title>
58052 <para>
58053 <indexterm role="concept">
58054 <primary>rate limiting</primary>
58055 <secondary>per_* options</secondary>
58056 </indexterm>
58057 The <option>per_conn</option> option limits the client&#x2019;s connection rate. It is not
58058 normally used in the <option>acl_not_smtp</option>, <option>acl_not_smtp_mime</option>, or
58059 <option>acl_not_smtp_start</option> ACLs.
58060 </para>
58061 <para>
58062 The <option>per_mail</option> option limits the client&#x2019;s rate of sending messages. This is
58063 the default if none of the <option>per_*</option> options is specified. It can be used in
58064 <option>acl_smtp_mail</option>, <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>, <option>acl_smtp_mime</option>,
58065 <option>acl_smtp_data</option>, or <option>acl_not_smtp</option>.
58066 </para>
58067 <para>
58068 The <option>per_byte</option> option limits the sender&#x2019;s email bandwidth. It can be used in
58069 the same ACLs as the <option>per_mail</option> option, though it is best to use this option
58070 in the <option>acl_smtp_mime</option>, <option>acl_smtp_data</option> or <option>acl_not_smtp</option> ACLs; if it is
58071 used in an earlier ACL, Exim relies on the SIZE parameter given by the client
58072 in its MAIL command, which may be inaccurate or completely missing. You can
58073 follow the limit <emphasis>m</emphasis> in the configuration with K, M, or G to specify limits
58074 in kilobytes, megabytes, or gigabytes, respectively.
58075 </para>
58076 <para>
58077 The <option>per_rcpt</option> option causes Exim to limit the rate at which recipients are
58078 accepted. It can be used in the <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>,
58079 <option>acl_smtp_mime</option>, <option>acl_smtp_data</option>, or <option>acl_smtp_rcpt</option> ACLs. In
58080 <option>acl_smtp_rcpt</option> the rate is updated one recipient at a time; in the other
58081 ACLs the rate is updated with the total (accepted) recipient count in one go. Note that
58082 in either case the rate limiting engine will see a message with many
58083 recipients as a large high-speed burst.
58084 </para>
58085 <para>
58086 The <option>per_addr</option> option is like the <option>per_rcpt</option> option, except it counts the
58087 number of different recipients that the client has sent messages to in the
58088 last time period. That is, if the client repeatedly sends messages to the same
58089 recipient, its measured rate is not increased. This option can only be used in
58090 <option>acl_smtp_rcpt</option>.
58091 </para>
58092 <para>
58093 The <option>per_cmd</option> option causes Exim to recompute the rate every time the
58094 condition is processed. This can be used to limit the rate of any SMTP
58095 command. If it is used in multiple ACLs it can limit the aggregate rate of
58096 multiple different commands.
58097 </para>
58098 <para>
58099 The <option>count=</option> option can be used to alter how much Exim adds to the client&#x2019;s
58100 measured rate. For example, the <option>per_byte</option> option is equivalent to
58101 <literal>per_mail/count=$message_size</literal>. If there is no <option>count=</option> option, Exim
58102 increases the measured rate by one (except for the <option>per_rcpt</option> option in ACLs
58103 other than <option>acl_smtp_rcpt</option>). The count does not have to be an integer.
58104 </para>
58105 <para>
58106 The <option>unique=</option> option is described in section <xref linkend="ratoptuniq"/> below.
58107 </para>
58108 </section>
58109 <section id="ratoptupd">
58110 <title>Ratelimit update modes</title>
58111 <para>
58112 <indexterm role="concept">
58113 <primary>rate limiting</primary>
58114 <secondary>reading data without updating</secondary>
58115 </indexterm>
58116 You can specify one of three options with the <option>ratelimit</option> condition to
58117 control when its database is updated. This section describes the <option>readonly</option>
58118 mode, and the next section describes the <option>strict</option> and <option>leaky</option> modes.
58119 </para>
58120 <para>
58121 If the <option>ratelimit</option> condition is used in <option>readonly</option> mode, Exim looks up a
58122 previously-computed rate to check against the limit.
58123 </para>
58124 <para>
58125 For example, you can test the client&#x2019;s sending rate and deny it access (when
58126 it is too fast) in the connect ACL. If the client passes this check then it
58127 can go on to send a message, in which case its recorded rate will be updated
58128 in the MAIL ACL. Subsequent connections from the same client will check this
58129 new rate.
58130 </para>
58131 <literallayout class="monospaced">
58132 acl_check_connect:
58133  deny ratelimit = 100 / 5m / readonly
58134     log_message = RATE CHECK: $sender_rate/$sender_rate_period \
58135                   (max $sender_rate_limit)
58136 # ...
58137 acl_check_mail:
58138  warn ratelimit = 100 / 5m / strict
58139     log_message = RATE UPDATE: $sender_rate/$sender_rate_period \
58140                   (max $sender_rate_limit)
58141 </literallayout>
58142 <para>
58143 If Exim encounters multiple <option>ratelimit</option> conditions with the same key when
58144 processing a message then it may increase the client&#x2019;s measured rate more than
58145 it should. For example, this will happen if you check the <option>per_rcpt</option> option
58146 in both <option>acl_smtp_rcpt</option> and <option>acl_smtp_data</option>. However it&#x2019;s OK to check the
58147 same <option>ratelimit</option> condition multiple times in the same ACL. You can avoid any
58148 multiple update problems by using the <option>readonly</option> option on later ratelimit
58149 checks.
58150 </para>
58151 <para>
58152 The <option>per_*</option> options described above do not make sense in some ACLs. If you
58153 use a <option>per_*</option> option in an ACL where it is not normally permitted then the
58154 update mode defaults to <option>readonly</option> and you cannot specify the <option>strict</option> or
58155 <option>leaky</option> modes. In other ACLs the default update mode is <option>leaky</option> (see the
58156 next section) so you must specify the <option>readonly</option> option explicitly.
58157 </para>
58158 </section>
58159 <section id="ratoptfast">
58160 <title>Ratelimit options for handling fast clients</title>
58161 <para>
58162 <indexterm role="concept">
58163 <primary>rate limiting</primary>
58164 <secondary>strict and leaky modes</secondary>
58165 </indexterm>
58166 If a client&#x2019;s average rate is greater than the maximum, the rate limiting
58167 engine can react in two possible ways, depending on the presence of the
58168 <option>strict</option> or <option>leaky</option> update modes. This is independent of the other
58169 counter-measures (such as rejecting the message) that may be specified by the
58170 rest of the ACL.
58171 </para>
58172 <para>
58173 The <option>leaky</option> (default) option means that the client&#x2019;s recorded rate is not
58174 updated if it is above the limit. The effect of this is that Exim measures the
58175 client&#x2019;s average rate of successfully sent email, which cannot be greater than
58176 the maximum allowed. If the client is over the limit it may suffer some
58177 counter-measures (as specified in the ACL), but it will still be able to send
58178 email at the configured maximum rate, whatever the rate of its attempts. This
58179 is generally the better choice if you have clients that retry automatically.
58180 For example, it does not prevent a sender with an over-aggressive retry rate
58181 from getting any email through.
58182 </para>
58183 <para>
58184 The <option>strict</option> option means that the client&#x2019;s recorded rate is always
58185 updated. The effect of this is that Exim measures the client&#x2019;s average rate
58186 of attempts to send email, which can be much higher than the maximum it is
58187 actually allowed. If the client is over the limit it may be subjected to
58188 counter-measures by the ACL. It must slow down and allow sufficient time to
58189 pass that its computed rate falls below the maximum before it can send email
58190 again. The time (the number of smoothing periods) it must wait and not
58191 attempt to send mail can be calculated with this formula:
58192 </para>
58193 <literallayout class="monospaced">
58194         ln(peakrate/maxrate)
58195 </literallayout>
58196 </section>
58197 <section id="ratoptuniq">
58198 <title>Limiting the rate of different events</title>
58199 <para>
58200 <indexterm role="concept">
58201 <primary>rate limiting</primary>
58202 <secondary>counting unique events</secondary>
58203 </indexterm>
58204 The <option>ratelimit</option> <option>unique=</option> option controls a mechanism for counting the
58205 rate of different events. For example, the <option>per_addr</option> option uses this
58206 mechanism to count the number of different recipients that the client has
58207 sent messages to in the last time period; it is equivalent to
58208 <literal>per_rcpt/unique=$local_part@$domain</literal>. You could use this feature to
58209 measure the rate that a client uses different sender addresses with the
58210 options <literal>per_mail/unique=$sender_address</literal>.
58211 </para>
58212 <para>
58213 For each <option>ratelimit</option> key Exim stores the set of <option>unique=</option> values that it
58214 has seen for that key. The whole set is thrown away when it is older than the
58215 rate smoothing period <emphasis>p</emphasis>, so each different event is counted at most once
58216 per period. In the <option>leaky</option> update mode, an event that causes the client to
58217 go over the limit is not added to the set, in the same way that the client&#x2019;s
58218 recorded rate is not updated in the same situation.
58219 </para>
58220 <para>
58221 When you combine the <option>unique=</option> and <option>readonly</option> options, the specific
58222 <option>unique=</option> value is ignored, and Exim just retrieves the client&#x2019;s stored
58223 rate.
58224 </para>
58225 <para>
58226 The <option>unique=</option> mechanism needs more space in the ratelimit database than the
58227 other <option>ratelimit</option> options in order to store the event set. The number of
58228 unique values is potentially as large as the rate limit, so the extra space
58229 required increases with larger limits.
58230 </para>
58231 <para>
58232 The uniqueification is not perfect: there is a small probability that Exim
58233 will think a new event has happened before. If the sender&#x2019;s rate is less than
58234 the limit, Exim should be more than 99.9% correct. However in <option>strict</option> mode
58235 the measured rate can go above the limit, in which case Exim may under-count
58236 events by a significant margin. Fortunately, if the rate is high enough (2.7
58237 times the limit) that the false positive rate goes above 9%, then Exim will
58238 throw away the over-full event set before the measured rate falls below the
58239 limit. Therefore the only harm should be that exceptionally high sending rates
58240 are logged incorrectly; any countermeasures you configure will be as effective
58241 as intended.
58242 </para>
58243 </section>
58244 <section id="useratlim">
58245 <title>Using rate limiting</title>
58246 <para>
58247 Exim&#x2019;s other ACL facilities are used to define what counter-measures are taken
58248 when the rate limit is exceeded. This might be anything from logging a warning
58249 (for example, while measuring existing sending rates in order to define
58250 policy), through time delays to slow down fast senders, up to rejecting the
58251 message. For example:
58252 </para>
58253 <literallayout class="monospaced">
58254 # Log all senders' rates
58255 warn ratelimit = 0 / 1h / strict
58256      log_message = Sender rate $sender_rate / $sender_rate_period
58257
58258 # Slow down fast senders; note the need to truncate $sender_rate
58259 # at the decimal point.
58260 warn ratelimit = 100 / 1h / per_rcpt / strict
58261      delay     = ${eval: ${sg{$sender_rate}{[.].*}{}} - \
58262                    $sender_rate_limit }s
58263
58264 # Keep authenticated users under control
58265 deny authenticated = *
58266      ratelimit = 100 / 1d / strict / $authenticated_id
58267
58268 # System-wide rate limit
58269 defer message = Sorry, too busy. Try again later.
58270      ratelimit = 10 / 1s / $primary_hostname
58271
58272 # Restrict incoming rate from each host, with a default
58273 # set using a macro and special cases looked up in a table.
58274 defer message = Sender rate exceeds $sender_rate_limit \
58275                messages per $sender_rate_period
58276      ratelimit = ${lookup {$sender_host_address} \
58277                    cdb {DB/ratelimits.cdb} \
58278                    {$value} {RATELIMIT} }
58279 </literallayout>
58280 <para>
58281 <emphasis role="bold">Warning</emphasis>: If you have a busy server with a lot of <option>ratelimit</option> tests,
58282 especially with the <option>per_rcpt</option> option, you may suffer from a performance
58283 bottleneck caused by locking on the ratelimit hints database. Apart from
58284 making your ACLs less complicated, you can reduce the problem by using a
58285 RAM disk for Exim&#x2019;s hints directory (usually <filename>/var/spool/exim/db/</filename>). However
58286 this means that Exim will lose its hints data after a reboot (including retry
58287 hints, the callout cache, and ratelimit data).
58288 </para>
58289 </section>
58290 <section id="SECTaddressverification">
58291 <title>Address verification</title>
58292 <para>
58293 <indexterm role="concept">
58294 <primary>verifying address</primary>
58295 <secondary>options for</secondary>
58296 </indexterm>
58297 <indexterm role="concept">
58298 <primary>policy control</primary>
58299 <secondary>address verification</secondary>
58300 </indexterm>
58301 Several of the <option>verify</option> conditions described in section
58302 <xref linkend="SECTaclconditions"/> cause addresses to be verified. Section
58303 <xref linkend="SECTsenaddver"/> discusses the reporting of sender verification failures.
58304 The verification conditions can be followed by options that modify the
58305 verification process. The options are separated from the keyword and from each
58306 other by slashes, and some of them contain parameters. For example:
58307 </para>
58308 <literallayout class="monospaced">
58309 verify = sender/callout
58310 verify = recipient/defer_ok/callout=10s,defer_ok
58311 </literallayout>
58312 <para>
58313 The first stage of address verification, which always happens, is to run the
58314 address through the routers, in <quote>verify mode</quote>. Routers can detect the
58315 difference between verification and routing for delivery, and their actions can
58316 be varied by a number of generic options such as <option>verify</option> and <option>verify_only</option>
58317 (see chapter <xref linkend="CHAProutergeneric"/>). If routing fails, verification fails.
58318 The available options are as follows:
58319 </para>
58320 <itemizedlist>
58321 <listitem>
58322 <para>
58323 If the <option>callout</option> option is specified, successful routing to one or more
58324 remote hosts is followed by a <quote>callout</quote> to those hosts as an additional
58325 check. Callouts and their sub-options are discussed in the next section.
58326 </para>
58327 </listitem>
58328 <listitem>
58329 <para>
58330 If there is a defer error while doing verification routing, the ACL
58331 normally returns <quote>defer</quote>. However, if you include <option>defer_ok</option> in the
58332 options, the condition is forced to be true instead. Note that this is a main
58333 verification option as well as a suboption for callouts.
58334 </para>
58335 </listitem>
58336 <listitem>
58337 <para>
58338 The <option>no_details</option> option is covered in section <xref linkend="SECTsenaddver"/>, which
58339 discusses the reporting of sender address verification failures.
58340 </para>
58341 </listitem>
58342 <listitem>
58343 <para>
58344 The <option>success_on_redirect</option> option causes verification always to succeed
58345 immediately after a successful redirection. By default, if a redirection
58346 generates just one address, that address is also verified. See further
58347 discussion in section <xref linkend="SECTredirwhilveri"/>.
58348 </para>
58349 </listitem>
58350 </itemizedlist>
58351 <para>
58352 <indexterm role="concept">
58353 <primary>verifying address</primary>
58354 <secondary>differentiating failures</secondary>
58355 </indexterm>
58356 <indexterm role="variable">
58357 <primary><varname>$recipient_verify_failure</varname></primary>
58358 </indexterm>
58359 <indexterm role="variable">
58360 <primary><varname>$sender_verify_failure</varname></primary>
58361 </indexterm>
58362 <indexterm role="variable">
58363 <primary><varname>$acl_verify_message</varname></primary>
58364 </indexterm>
58365 After an address verification failure, <varname>$acl_verify_message</varname> contains the
58366 error message that is associated with the failure. It can be preserved by
58367 coding like this:
58368 </para>
58369 <literallayout class="monospaced">
58370 warn  !verify = sender
58371        set acl_m0 = $acl_verify_message
58372 </literallayout>
58373 <para>
58374 If you are writing your own custom rejection message or log message when
58375 denying access, you can use this variable to include information about the
58376 verification failure.
58377 </para>
58378 <para>
58379 In addition, <varname>$sender_verify_failure</varname> or <varname>$recipient_verify_failure</varname> (as
58380 appropriate) contains one of the following words:
58381 </para>
58382 <itemizedlist>
58383 <listitem>
58384 <para>
58385 <option>qualify</option>: The address was unqualified (no domain), and the message
58386 was neither local nor came from an exempted host.
58387 </para>
58388 </listitem>
58389 <listitem>
58390 <para>
58391 <option>route</option>: Routing failed.
58392 </para>
58393 </listitem>
58394 <listitem>
58395 <para>
58396 <option>mail</option>: Routing succeeded, and a callout was attempted; rejection
58397 occurred at or before the MAIL command (that is, on initial
58398 connection, HELO, or MAIL).
58399 </para>
58400 </listitem>
58401 <listitem>
58402 <para>
58403 <option>recipient</option>: The RCPT command in a callout was rejected.
58404 </para>
58405 </listitem>
58406 <listitem>
58407 <para>
58408 <option>postmaster</option>: The postmaster check in a callout was rejected.
58409 </para>
58410 </listitem>
58411 </itemizedlist>
58412 <para>
58413 The main use of these variables is expected to be to distinguish between
58414 rejections of MAIL and rejections of RCPT in callouts.
58415 </para>
58416 </section>
58417 <section id="SECTcallver">
58418 <title>Callout verification</title>
58419 <para>
58420 <indexterm role="concept">
58421 <primary>verifying address</primary>
58422 <secondary>by callout</secondary>
58423 </indexterm>
58424 <indexterm role="concept">
58425 <primary>callout</primary>
58426 <secondary>verification</secondary>
58427 </indexterm>
58428 <indexterm role="concept">
58429 <primary>SMTP</primary>
58430 <secondary>callout verification</secondary>
58431 </indexterm>
58432 For non-local addresses, routing verifies the domain, but is unable to do any
58433 checking of the local part. There are situations where some means of verifying
58434 the local part is desirable. One way this can be done is to make an SMTP
58435 <emphasis>callback</emphasis> to a delivery host for the sender address or a <emphasis>callforward</emphasis> to
58436 a subsequent host for a recipient address, to see if the host accepts the
58437 address. We use the term <emphasis>callout</emphasis> to cover both cases. Note that for a
58438 sender address, the callback is not to the client host that is trying to
58439 deliver the message, but to one of the hosts that accepts incoming mail for the
58440 sender&#x2019;s domain.
58441 </para>
58442 <para>
58443 Exim does not do callouts by default. If you want them to happen, you must
58444 request them by setting appropriate options on the <option>verify</option> condition, as
58445 described below. This facility should be used with care, because it can add a
58446 lot of resource usage to the cost of verifying an address. However, Exim does
58447 cache the results of callouts, which helps to reduce the cost. Details of
58448 caching are in section <xref linkend="SECTcallvercache"/>.
58449 </para>
58450 <para>
58451 Recipient callouts are usually used only between hosts that are controlled by
58452 the same administration. For example, a corporate gateway host could use
58453 callouts to check for valid recipients on an internal mailserver. A successful
58454 callout does not guarantee that a real delivery to the address would succeed;
58455 on the other hand, a failing callout does guarantee that a delivery would fail.
58456 </para>
58457 <para>
58458 If the <option>callout</option> option is present on a condition that verifies an address, a
58459 second stage of verification occurs if the address is successfully routed to
58460 one or more remote hosts. The usual case is routing by a <command>dnslookup</command> or a
58461 <command>manualroute</command> router, where the router specifies the hosts. However, if a
58462 router that does not set up hosts routes to an <command>smtp</command> transport with a
58463 <option>hosts</option> setting, the transport&#x2019;s hosts are used. If an <command>smtp</command> transport has
58464 <option>hosts_override</option> set, its hosts are always used, whether or not the router
58465 supplies a host list.
58466 Callouts are only supported on <command>smtp</command> transports.
58467 </para>
58468 <para>
58469 The port that is used is taken from the transport, if it is specified and is a
58470 remote transport. (For routers that do verification only, no transport need be
58471 specified.) Otherwise, the default SMTP port is used. If a remote transport
58472 specifies an outgoing interface, this is used; otherwise the interface is not
58473 specified. Likewise, the text that is used for the HELO command is taken from
58474 the transport&#x2019;s <option>helo_data</option> option; if there is no transport, the value of
58475 <varname>$smtp_active_hostname</varname> is used.
58476 </para>
58477 <para>
58478 For a sender callout check, Exim makes SMTP connections to the remote hosts, to
58479 test whether a bounce message could be delivered to the sender address. The
58480 following SMTP commands are sent:
58481 </para>
58482 <literallayout>
58483 <literal>HELO </literal>&lt;<emphasis>local host name</emphasis>&gt;
58484 <literal>MAIL FROM:&lt;&gt;</literal>
58485 <literal>RCPT TO:</literal>&lt;<emphasis>the address to be tested</emphasis>&gt;
58486 <literal>QUIT</literal>
58487 </literallayout>
58488 <para>
58489 LHLO is used instead of HELO if the transport&#x2019;s <option>protocol</option> option is
58490 set to <quote>lmtp</quote>.
58491 </para>
58492 <para>
58493 The callout may use EHLO, AUTH and/or STARTTLS given appropriate option
58494 settings.
58495 </para>
58496 <para>
58497 A recipient callout check is similar. By default, it also uses an empty address
58498 for the sender. This default is chosen because most hosts do not make use of
58499 the sender address when verifying a recipient. Using the same address means
58500 that a single cache entry can be used for each recipient. Some sites, however,
58501 do make use of the sender address when verifying. These are catered for by the
58502 <option>use_sender</option> and <option>use_postmaster</option> options, described in the next section.
58503 </para>
58504 <para>
58505 If the response to the RCPT command is a 2<emphasis>xx</emphasis> code, the verification
58506 succeeds. If it is 5<emphasis>xx</emphasis>, the verification fails. For any other condition,
58507 Exim tries the next host, if any. If there is a problem with all the remote
58508 hosts, the ACL yields <quote>defer</quote>, unless the <option>defer_ok</option> parameter of the
58509 <option>callout</option> option is given, in which case the condition is forced to succeed.
58510 </para>
58511 <para>
58512 <indexterm role="concept">
58513 <primary>SMTP</primary>
58514 <secondary>output flushing, disabling for callout</secondary>
58515 </indexterm>
58516 A callout may take a little time. For this reason, Exim normally flushes SMTP
58517 output before performing a callout in an ACL, to avoid unexpected timeouts in
58518 clients when the SMTP PIPELINING extension is in use. The flushing can be
58519 disabled by using a <option>control</option> modifier to set <option>no_callout_flush</option>.
58520 </para>
58521 </section>
58522 <section id="CALLaddparcall">
58523 <title>Additional parameters for callouts</title>
58524 <para>
58525 <indexterm role="concept">
58526 <primary>callout</primary>
58527 <secondary>additional parameters for</secondary>
58528 </indexterm>
58529 The <option>callout</option> option can be followed by an equals sign and a number of
58530 optional parameters, separated by commas. For example:
58531 </para>
58532 <literallayout class="monospaced">
58533 verify = recipient/callout=10s,defer_ok
58534 </literallayout>
58535 <para>
58536 The old syntax, which had <option>callout_defer_ok</option> and <option>check_postmaster</option> as
58537 separate verify options, is retained for backwards compatibility, but is now
58538 deprecated. The additional parameters for <option>callout</option> are as follows:
58539 </para>
58540 <variablelist>
58541 <varlistentry>
58542 <term>&lt;<emphasis>a&nbsp;time&nbsp;interval</emphasis>&gt;</term>
58543 <listitem>
58544 <para>
58545 <indexterm role="concept">
58546 <primary>callout</primary>
58547 <secondary>timeout, specifying</secondary>
58548 </indexterm>
58549 This specifies the timeout that applies for the callout attempt to each host.
58550 For example:
58551 </para>
58552 <literallayout class="monospaced">
58553 verify = sender/callout=5s
58554 </literallayout>
58555 <para>
58556 The default is 30 seconds. The timeout is used for each response from the
58557 remote host. It is also used for the initial connection, unless overridden by
58558 the <option>connect</option> parameter.
58559 </para>
58560 </listitem></varlistentry>
58561 <varlistentry>
58562 <term><emphasis role="bold">connect&nbsp;=&nbsp;</emphasis>&lt;<emphasis>time&nbsp;interval</emphasis>&gt;</term>
58563 <listitem>
58564 <para>
58565 <indexterm role="concept">
58566 <primary>callout</primary>
58567 <secondary>connection timeout, specifying</secondary>
58568 </indexterm>
58569 This parameter makes it possible to set a different (usually smaller) timeout
58570 for making the SMTP connection. For example:
58571 </para>
58572 <literallayout class="monospaced">
58573 verify = sender/callout=5s,connect=1s
58574 </literallayout>
58575 <para>
58576 If not specified, this timeout defaults to the general timeout value.
58577 </para>
58578 </listitem></varlistentry>
58579 <varlistentry>
58580 <term><emphasis role="bold">defer_ok</emphasis></term>
58581 <listitem>
58582 <para>
58583 <indexterm role="concept">
58584 <primary>callout</primary>
58585 <secondary>defer, action on</secondary>
58586 </indexterm>
58587 When this parameter is present, failure to contact any host, or any other kind
58588 of temporary error, is treated as success by the ACL. However, the cache is not
58589 updated in this circumstance.
58590 </para>
58591 </listitem></varlistentry>
58592 <varlistentry>
58593 <term><emphasis role="bold">fullpostmaster</emphasis></term>
58594 <listitem>
58595 <para>
58596 <indexterm role="concept">
58597 <primary>callout</primary>
58598 <secondary>full postmaster check</secondary>
58599 </indexterm>
58600 This operates like the <option>postmaster</option> option (see below), but if the check for
58601 <emphasis>postmaster@domain</emphasis> fails, it tries just <emphasis>postmaster</emphasis>, without a domain, in
58602 accordance with the specification in RFC 2821. The RFC states that the
58603 unqualified address <emphasis>postmaster</emphasis> should be accepted.
58604 </para>
58605 </listitem></varlistentry>
58606 <varlistentry>
58607 <term><emphasis role="bold">mailfrom&nbsp;=&nbsp;</emphasis>&lt;<emphasis>email&nbsp;address</emphasis>&gt;</term>
58608 <listitem>
58609 <para>
58610 <indexterm role="concept">
58611 <primary>callout</primary>
58612 <secondary>sender when verifying header</secondary>
58613 </indexterm>
58614 When verifying addresses in header lines using the <option>header_sender</option>
58615 verification option, Exim behaves by default as if the addresses are envelope
58616 sender addresses from a message. Callout verification therefore tests to see
58617 whether a bounce message could be delivered, by using an empty address in the
58618 MAIL command. However, it is arguable that these addresses might never be used
58619 as envelope senders, and could therefore justifiably reject bounce messages
58620 (empty senders). The <option>mailfrom</option> callout parameter allows you to specify what
58621 address to use in the MAIL command. For example:
58622 </para>
58623 <literallayout class="monospaced">
58624 require  verify = header_sender/callout=mailfrom=abcd@x.y.z
58625 </literallayout>
58626 <para>
58627 This parameter is available only for the <option>header_sender</option> verification option.
58628 </para>
58629 </listitem></varlistentry>
58630 <varlistentry>
58631 <term><emphasis role="bold">maxwait&nbsp;=&nbsp;</emphasis>&lt;<emphasis>time&nbsp;interval</emphasis>&gt;</term>
58632 <listitem>
58633 <para>
58634 <indexterm role="concept">
58635 <primary>callout</primary>
58636 <secondary>overall timeout, specifying</secondary>
58637 </indexterm>
58638 This parameter sets an overall timeout for performing a callout verification.
58639 For example:
58640 </para>
58641 <literallayout class="monospaced">
58642 verify = sender/callout=5s,maxwait=30s
58643 </literallayout>
58644 <para>
58645 This timeout defaults to four times the callout timeout for individual SMTP
58646 commands. The overall timeout applies when there is more than one host that can
58647 be tried. The timeout is checked before trying the next host. This prevents
58648 very long delays if there are a large number of hosts and all are timing out
58649 (for example, when network connections are timing out).
58650 </para>
58651 </listitem></varlistentry>
58652 <varlistentry>
58653 <term><emphasis role="bold">no_cache</emphasis></term>
58654 <listitem>
58655 <para>
58656 <indexterm role="concept">
58657 <primary>callout</primary>
58658 <secondary>cache, suppressing</secondary>
58659 </indexterm>
58660 <indexterm role="concept">
58661 <primary>caching callout, suppressing</primary>
58662 </indexterm>
58663 When this parameter is given, the callout cache is neither read nor updated.
58664 </para>
58665 </listitem></varlistentry>
58666 <varlistentry>
58667 <term><emphasis role="bold">postmaster</emphasis></term>
58668 <listitem>
58669 <para>
58670 <indexterm role="concept">
58671 <primary>callout</primary>
58672 <secondary>postmaster; checking</secondary>
58673 </indexterm>
58674 When this parameter is set, a successful callout check is followed by a similar
58675 check for the local part <emphasis>postmaster</emphasis> at the same domain. If this address is
58676 rejected, the callout fails (but see <option>fullpostmaster</option> above). The result of
58677 the postmaster check is recorded in a cache record; if it is a failure, this is
58678 used to fail subsequent callouts for the domain without a connection being
58679 made, until the cache record expires.
58680 </para>
58681 </listitem></varlistentry>
58682 <varlistentry>
58683 <term><emphasis role="bold">postmaster_mailfrom&nbsp;=&nbsp;</emphasis>&lt;<emphasis>email&nbsp;address</emphasis>&gt;</term>
58684 <listitem>
58685 <para>
58686 The postmaster check uses an empty sender in the MAIL command by default.
58687 You can use this parameter to do a postmaster check using a different address.
58688 For example:
58689 </para>
58690 <literallayout class="monospaced">
58691 require  verify = sender/callout=postmaster_mailfrom=abc@x.y.z
58692 </literallayout>
58693 <para>
58694 If both <option>postmaster</option> and <option>postmaster_mailfrom</option> are present, the rightmost
58695 one overrides. The <option>postmaster</option> parameter is equivalent to this example:
58696 </para>
58697 <literallayout class="monospaced">
58698 require  verify = sender/callout=postmaster_mailfrom=
58699 </literallayout>
58700 <para>
58701 <emphasis role="bold">Warning</emphasis>: The caching arrangements for postmaster checking do not take
58702 account of the sender address. It is assumed that either the empty address or
58703 a fixed non-empty address will be used. All that Exim remembers is that the
58704 postmaster check for the domain succeeded or failed.
58705 </para>
58706 </listitem></varlistentry>
58707 <varlistentry>
58708 <term><emphasis role="bold">random</emphasis></term>
58709 <listitem>
58710 <para>
58711 <indexterm role="concept">
58712 <primary>callout</primary>
58713 <secondary><quote>random</quote> check</secondary>
58714 </indexterm>
58715 When this parameter is set, before doing the normal callout check, Exim does a
58716 check for a <quote>random</quote> local part at the same domain. The local part is not
58717 really random &ndash; it is defined by the expansion of the option
58718 <option>callout_random_local_part</option>, which defaults to
58719 </para>
58720 <literallayout class="monospaced">
58721 $primary_hostname-$tod_epoch-testing
58722 </literallayout>
58723 <para>
58724 The idea here is to try to determine whether the remote host accepts all local
58725 parts without checking. If it does, there is no point in doing callouts for
58726 specific local parts. If the <quote>random</quote> check succeeds, the result is saved in
58727 a cache record, and used to force the current and subsequent callout checks to
58728 succeed without a connection being made, until the cache record expires.
58729 </para>
58730 </listitem></varlistentry>
58731 <varlistentry>
58732 <term><emphasis role="bold">use_postmaster</emphasis></term>
58733 <listitem>
58734 <para>
58735 <indexterm role="concept">
58736 <primary>callout</primary>
58737 <secondary>sender for recipient check</secondary>
58738 </indexterm>
58739 This parameter applies to recipient callouts only. For example:
58740 </para>
58741 <literallayout class="monospaced">
58742 deny  !verify = recipient/callout=use_postmaster
58743 </literallayout>
58744 <para>
58745 <indexterm role="variable">
58746 <primary><varname>$qualify_domain</varname></primary>
58747 </indexterm>
58748 It causes a non-empty postmaster address to be used in the MAIL command when
58749 performing the callout for the recipient, and also for a <quote>random</quote> check if
58750 that is configured. The local part of the address is <literal>postmaster</literal> and the
58751 domain is the contents of <varname>$qualify_domain</varname>.
58752 </para>
58753 </listitem></varlistentry>
58754 <varlistentry>
58755 <term><emphasis role="bold">use_sender</emphasis></term>
58756 <listitem>
58757 <para>
58758 This option applies to recipient callouts only. For example:
58759 </para>
58760 <literallayout class="monospaced">
58761 require  verify = recipient/callout=use_sender
58762 </literallayout>
58763 <para>
58764 It causes the message&#x2019;s actual sender address to be used in the MAIL
58765 command when performing the callout, instead of an empty address. There is no
58766 need to use this option unless you know that the called hosts make use of the
58767 sender when checking recipients. If used indiscriminately, it reduces the
58768 usefulness of callout caching.
58769 </para>
58770 </listitem></varlistentry>
58771 <varlistentry revisionflag="changed">
58772 <term><emphasis role="bold">hold</emphasis></term>
58773 <listitem>
58774 <para revisionflag="changed">
58775 This option applies to recipient callouts only. For example:
58776 </para>
58777 <literallayout class="monospaced" revisionflag="changed">
58778 require  verify = recipient/callout=use_sender,hold
58779 </literallayout>
58780 <para revisionflag="changed">
58781 It causes the connection to be helod open and used for any further recipients
58782 and for eventual delivery (should that be done quickly).
58783 Doing this saves on TCP and SMTP startup costs, and TLS costs also
58784 when that is used for the connections.
58785 The advantage is only gained if there are no callout cache hits
58786 (which could be enforced by the no_cache option),
58787 if the use_sender option is used,
58788 if neither the random nor the use_postmaster option is used,
58789 and if no other callouts intervene.
58790 </para>
58791 </listitem></varlistentry>
58792 </variablelist>
58793 <para>
58794 If you use any of the parameters that set a non-empty sender for the MAIL
58795 command (<option>mailfrom</option>, <option>postmaster_mailfrom</option>, <option>use_postmaster</option>, or
58796 <option>use_sender</option>), you should think about possible loops. Recipient checking is
58797 usually done between two hosts that are under the same management, and the host
58798 that receives the callouts is not normally configured to do callouts itself.
58799 Therefore, it is normally safe to use <option>use_postmaster</option> or <option>use_sender</option> in
58800 these circumstances.
58801 </para>
58802 <para>
58803 However, if you use a non-empty sender address for a callout to an arbitrary
58804 host, there is the likelihood that the remote host will itself initiate a
58805 callout check back to your host. As it is checking what appears to be a message
58806 sender, it is likely to use an empty address in MAIL, thus avoiding a
58807 callout loop. However, to be on the safe side it would be best to set up your
58808 own ACLs so that they do not do sender verification checks when the recipient
58809 is the address you use for header sender or postmaster callout checking.
58810 </para>
58811 <para>
58812 Another issue to think about when using non-empty senders for callouts is
58813 caching. When you set <option>mailfrom</option> or <option>use_sender</option>, the cache record is keyed
58814 by the sender/recipient combination; thus, for any given recipient, many more
58815 actual callouts are performed than when an empty sender or postmaster is used.
58816 </para>
58817 </section>
58818 <section id="SECTcallvercache">
58819 <title>Callout caching</title>
58820 <para>
58821 <indexterm role="concept">
58822 <primary>hints database</primary>
58823 <secondary>callout cache</secondary>
58824 </indexterm>
58825 <indexterm role="concept">
58826 <primary>callout</primary>
58827 <secondary>cache, description of</secondary>
58828 </indexterm>
58829 <indexterm role="concept">
58830 <primary>caching</primary>
58831 <secondary>callout</secondary>
58832 </indexterm>
58833 Exim caches the results of callouts in order to reduce the amount of resources
58834 used, unless you specify the <option>no_cache</option> parameter with the <option>callout</option>
58835 option. A hints database called <quote>callout</quote> is used for the cache. Two
58836 different record types are used: one records the result of a callout check for
58837 a specific address, and the other records information that applies to the
58838 entire domain (for example, that it accepts the local part <emphasis>postmaster</emphasis>).
58839 </para>
58840 <para>
58841 When an original callout fails, a detailed SMTP error message is given about
58842 the failure. However, for subsequent failures use the cache data, this message
58843 is not available.
58844 </para>
58845 <para>
58846 The expiry times for negative and positive address cache records are
58847 independent, and can be set by the global options <option>callout_negative_expire</option>
58848 (default 2h) and <option>callout_positive_expire</option> (default 24h), respectively.
58849 </para>
58850 <para>
58851 If a host gives a negative response to an SMTP connection, or rejects any
58852 commands up to and including
58853 </para>
58854 <literallayout class="monospaced">
58855 MAIL FROM:&lt;&gt;
58856 </literallayout>
58857 <para>
58858 (but not including the MAIL command with a non-empty address),
58859 any callout attempt is bound to fail. Exim remembers such failures in a
58860 domain cache record, which it uses to fail callouts for the domain without
58861 making new connections, until the domain record times out. There are two
58862 separate expiry times for domain cache records:
58863 <option>callout_domain_negative_expire</option> (default 3h) and
58864 <option>callout_domain_positive_expire</option> (default 7d).
58865 </para>
58866 <para>
58867 Domain records expire when the negative expiry time is reached if callouts
58868 cannot be made for the domain, or if the postmaster check failed.
58869 Otherwise, they expire when the positive expiry time is reached. This
58870 ensures that, for example, a host that stops accepting <quote>random</quote> local parts
58871 will eventually be noticed.
58872 </para>
58873 <para>
58874 The callout caching mechanism is based on the domain of the address that is
58875 being tested. If the domain routes to several hosts, it is assumed that their
58876 behaviour will be the same.
58877 </para>
58878 </section>
58879 <section id="SECTsenaddver">
58880 <title>Sender address verification reporting</title>
58881 <para>
58882 <indexterm role="concept">
58883 <primary>verifying</primary>
58884 <secondary>suppressing error details</secondary>
58885 </indexterm>
58886 See section <xref linkend="SECTaddressverification"/> for a general discussion of
58887 verification. When sender verification fails in an ACL, the details of the
58888 failure are given as additional output lines before the 550 response to the
58889 relevant SMTP command (RCPT or DATA). For example, if sender callout is in use,
58890 you might see:
58891 </para>
58892 <literallayout class="monospaced">
58893 MAIL FROM:&lt;xyz@abc.example&gt;
58894 250 OK
58895 RCPT TO:&lt;pqr@def.example&gt;
58896 550-Verification failed for &lt;xyz@abc.example&gt;
58897 550-Called:   192.168.34.43
58898 550-Sent:     RCPT TO:&lt;xyz@abc.example&gt;
58899 550-Response: 550 Unknown local part xyz in &lt;xyz@abc.example&gt;
58900 550 Sender verification failed
58901 </literallayout>
58902 <para>
58903 If more than one RCPT command fails in the same way, the details are given
58904 only for the first of them. However, some administrators do not want to send
58905 out this much information. You can suppress the details by adding
58906 <literal>/no_details</literal> to the ACL statement that requests sender verification. For
58907 example:
58908 </para>
58909 <literallayout class="monospaced">
58910 verify = sender/no_details
58911 </literallayout>
58912 </section>
58913 <section id="SECTredirwhilveri">
58914 <title>Redirection while verifying</title>
58915 <para>
58916 <indexterm role="concept">
58917 <primary>verifying</primary>
58918 <secondary>redirection while</secondary>
58919 </indexterm>
58920 <indexterm role="concept">
58921 <primary>address redirection</primary>
58922 <secondary>while verifying</secondary>
58923 </indexterm>
58924 A dilemma arises when a local address is redirected by aliasing or forwarding
58925 during verification: should the generated addresses themselves be verified,
58926 or should the successful expansion of the original address be enough to verify
58927 it? By default, Exim takes the following pragmatic approach:
58928 </para>
58929 <itemizedlist>
58930 <listitem>
58931 <para>
58932 When an incoming address is redirected to just one child address, verification
58933 continues with the child address, and if that fails to verify, the original
58934 verification also fails.
58935 </para>
58936 </listitem>
58937 <listitem>
58938 <para>
58939 When an incoming address is redirected to more than one child address,
58940 verification does not continue. A success result is returned.
58941 </para>
58942 </listitem>
58943 </itemizedlist>
58944 <para>
58945 This seems the most reasonable behaviour for the common use of aliasing as a
58946 way of redirecting different local parts to the same mailbox. It means, for
58947 example, that a pair of alias entries of the form
58948 </para>
58949 <literallayout class="monospaced">
58950 A.Wol:   aw123
58951 aw123:   :fail: Gone away, no forwarding address
58952 </literallayout>
58953 <para>
58954 work as expected, with both local parts causing verification failure. When a
58955 redirection generates more than one address, the behaviour is more like a
58956 mailing list, where the existence of the alias itself is sufficient for
58957 verification to succeed.
58958 </para>
58959 <para>
58960 It is possible, however, to change the default behaviour so that all successful
58961 redirections count as successful verifications, however many new addresses are
58962 generated. This is specified by the <option>success_on_redirect</option> verification
58963 option. For example:
58964 </para>
58965 <literallayout class="monospaced">
58966 require verify = recipient/success_on_redirect/callout=10s
58967 </literallayout>
58968 <para>
58969 In this example, verification succeeds if a router generates a new address, and
58970 the callout does not occur, because no address was routed to a remote host.
58971 </para>
58972 <para>
58973 When verification is being tested via the <option>-bv</option> option, the treatment of
58974 redirections is as just described, unless the <option>-v</option> or any debugging option is
58975 also specified. In that case, full verification is done for every generated
58976 address and a report is output for each of them.
58977 </para>
58978 </section>
58979 <section id="SECTverifyCSA">
58980 <title>Client SMTP authorization (CSA)</title>
58981 <para>
58982 <indexterm role="concept">
58983 <primary>CSA</primary>
58984 <secondary>verifying</secondary>
58985 </indexterm>
58986 Client SMTP Authorization is a system that allows a site to advertise
58987 which machines are and are not permitted to send email. This is done by placing
58988 special SRV records in the DNS; these are looked up using the client&#x2019;s HELO
58989 domain. At the time of writing, CSA is still an Internet Draft. Client SMTP
58990 Authorization checks in Exim are performed by the ACL condition:
58991 </para>
58992 <literallayout class="monospaced">
58993 verify = csa
58994 </literallayout>
58995 <para>
58996 This fails if the client is not authorized. If there is a DNS problem, or if no
58997 valid CSA SRV record is found, or if the client is authorized, the condition
58998 succeeds. These three cases can be distinguished using the expansion variable
58999 <varname>$csa_status</varname>, which can take one of the values <quote>fail</quote>, <quote>defer</quote>,
59000 <quote>unknown</quote>, or <quote>ok</quote>. The condition does not itself defer because that would
59001 be likely to cause problems for legitimate email.
59002 </para>
59003 <para>
59004 The error messages produced by the CSA code include slightly more
59005 detail. If <varname>$csa_status</varname> is <quote>defer</quote>, this may be because of problems
59006 looking up the CSA SRV record, or problems looking up the CSA target
59007 address record. There are four reasons for <varname>$csa_status</varname> being <quote>fail</quote>:
59008 </para>
59009 <itemizedlist>
59010 <listitem>
59011 <para>
59012 The client&#x2019;s host name is explicitly not authorized.
59013 </para>
59014 </listitem>
59015 <listitem>
59016 <para>
59017 The client&#x2019;s IP address does not match any of the CSA target IP addresses.
59018 </para>
59019 </listitem>
59020 <listitem>
59021 <para>
59022 The client&#x2019;s host name is authorized but it has no valid target IP addresses
59023 (for example, the target&#x2019;s addresses are IPv6 and the client is using IPv4).
59024 </para>
59025 </listitem>
59026 <listitem>
59027 <para>
59028 The client&#x2019;s host name has no CSA SRV record but a parent domain has asserted
59029 that all subdomains must be explicitly authorized.
59030 </para>
59031 </listitem>
59032 </itemizedlist>
59033 <para>
59034 The <option>csa</option> verification condition can take an argument which is the domain to
59035 use for the DNS query. The default is:
59036 </para>
59037 <literallayout class="monospaced">
59038 verify = csa/$sender_helo_name
59039 </literallayout>
59040 <para>
59041 This implementation includes an extension to CSA. If the query domain
59042 is an address literal such as [192.0.2.95], or if it is a bare IP
59043 address, Exim searches for CSA SRV records in the reverse DNS as if
59044 the HELO domain was (for example) <emphasis>95.2.0.192.in-addr.arpa</emphasis>. Therefore it is
59045 meaningful to say:
59046 </para>
59047 <literallayout class="monospaced">
59048 verify = csa/$sender_host_address
59049 </literallayout>
59050 <para>
59051 In fact, this is the check that Exim performs if the client does not say HELO.
59052 This extension can be turned off by setting the main configuration option
59053 <option>dns_csa_use_reverse</option> to be false.
59054 </para>
59055 <para>
59056 If a CSA SRV record is not found for the domain itself, a search
59057 is performed through its parent domains for a record which might be
59058 making assertions about subdomains. The maximum depth of this search is limited
59059 using the main configuration option <option>dns_csa_search_limit</option>, which is 5 by
59060 default. Exim does not look for CSA SRV records in a top level domain, so the
59061 default settings handle HELO domains as long as seven
59062 (<emphasis>hostname.five.four.three.two.one.com</emphasis>). This encompasses the vast majority
59063 of legitimate HELO domains.
59064 </para>
59065 <para>
59066 The <emphasis>dnsdb</emphasis> lookup also has support for CSA. Although <emphasis>dnsdb</emphasis> also supports
59067 direct SRV lookups, this is not sufficient because of the extra parent domain
59068 search behaviour of CSA, and (as with PTR lookups) <emphasis>dnsdb</emphasis> also turns IP
59069 addresses into lookups in the reverse DNS space. The result of a successful
59070 lookup such as:
59071 </para>
59072 <literallayout class="monospaced">
59073 ${lookup dnsdb {csa=$sender_helo_name}}
59074 </literallayout>
59075 <para>
59076 has two space-separated fields: an authorization code and a target host name.
59077 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
59078 authorization required but absent, or <quote>?</quote> for unknown.
59079 </para>
59080 </section>
59081 <section id="SECTverifyPRVS">
59082 <title>Bounce address tag validation</title>
59083 <para>
59084 <indexterm role="concept">
59085 <primary>BATV, verifying</primary>
59086 </indexterm>
59087 Bounce address tag validation (BATV) is a scheme whereby the envelope senders
59088 of outgoing messages have a cryptographic, timestamped <quote>tag</quote> added to them.
59089 Genuine incoming bounce messages should therefore always be addressed to
59090 recipients that have a valid tag. This scheme is a way of detecting unwanted
59091 bounce messages caused by sender address forgeries (often called <quote>collateral
59092 spam</quote>), because the recipients of such messages do not include valid tags.
59093 </para>
59094 <para>
59095 There are two expansion items to help with the implementation of the BATV
59096 <quote>prvs</quote> (private signature) scheme in an Exim configuration. This scheme signs
59097 the original envelope sender address by using a simple key to add a hash of the
59098 address and some time-based randomizing information. The <option>prvs</option> expansion
59099 item creates a signed address, and the <option>prvscheck</option> expansion item checks one.
59100 The syntax of these expansion items is described in section
59101 <xref linkend="SECTexpansionitems"/>.
59102 The validity period on signed addresses is seven days.
59103 </para>
59104 <para>
59105 As an example, suppose the secret per-address keys are stored in an MySQL
59106 database. A query to look up the key for an address could be defined as a macro
59107 like this:
59108 </para>
59109 <literallayout class="monospaced">
59110 PRVSCHECK_SQL = ${lookup mysql{SELECT secret FROM batv_prvs \
59111                 WHERE sender='${quote_mysql:$prvscheck_address}'\
59112                 }{$value}}
59113 </literallayout>
59114 <para>
59115 Suppose also that the senders who make use of BATV are defined by an address
59116 list called <option>batv_senders</option>. Then, in the ACL for RCPT commands, you could
59117 use this:
59118 </para>
59119 <literallayout class="monospaced">
59120 # Bounces: drop unsigned addresses for BATV senders
59121 deny message = This address does not send an unsigned reverse path
59122      senders = :
59123      recipients = +batv_senders
59124
59125 # Bounces: In case of prvs-signed address, check signature.
59126 deny message = Invalid reverse path signature.
59127      senders = :
59128      condition  = ${prvscheck {$local_part@$domain}\
59129                   {PRVSCHECK_SQL}{1}}
59130      !condition = $prvscheck_result
59131 </literallayout>
59132 <para>
59133 The first statement rejects recipients for bounce messages that are addressed
59134 to plain BATV sender addresses, because it is known that BATV senders do not
59135 send out messages with plain sender addresses. The second statement rejects
59136 recipients that are prvs-signed, but with invalid signatures (either because
59137 the key is wrong, or the signature has timed out).
59138 </para>
59139 <para>
59140 A non-prvs-signed address is not rejected by the second statement, because the
59141 <option>prvscheck</option> expansion yields an empty string if its first argument is not a
59142 prvs-signed address, thus causing the <option>condition</option> condition to be false. If
59143 the first argument is a syntactically valid prvs-signed address, the yield is
59144 the third string (in this case <quote>1</quote>), whether or not the cryptographic and
59145 timeout checks succeed. The <varname>$prvscheck_result</varname> variable contains the result
59146 of the checks (empty for failure, <quote>1</quote> for success).
59147 </para>
59148 <para>
59149 There is one more issue you must consider when implementing prvs-signing:
59150 you have to ensure that the routers accept prvs-signed addresses and
59151 deliver them correctly. The easiest way to handle this is to use a <command>redirect</command>
59152 router to remove the signature with a configuration along these lines:
59153 </para>
59154 <literallayout class="monospaced">
59155 batv_redirect:
59156   driver = redirect
59157   data = ${prvscheck {$local_part@$domain}{PRVSCHECK_SQL}}
59158 </literallayout>
59159 <para>
59160 This works because, if the third argument of <option>prvscheck</option> is empty, the result
59161 of the expansion of a prvs-signed address is the decoded value of the original
59162 address. This router should probably be the first of your routers that handles
59163 local addresses.
59164 </para>
59165 <para>
59166 To create BATV-signed addresses in the first place, a transport of this form
59167 can be used:
59168 </para>
59169 <literallayout class="monospaced">
59170 external_smtp_batv:
59171   driver = smtp
59172   return_path = ${prvs {$return_path} \
59173                        {${lookup mysql{SELECT \
59174                        secret FROM batv_prvs WHERE \
59175                        sender='${quote_mysql:$sender_address}'} \
59176                        {$value}fail}}}
59177 </literallayout>
59178 <para>
59179 If no key can be found for the existing return path, no signing takes place.
59180 </para>
59181 </section>
59182 <section id="SECTrelaycontrol">
59183 <title>Using an ACL to control relaying</title>
59184 <para>
59185 <indexterm role="concept">
59186 <primary>access control lists (ACLs)</primary>
59187 <secondary>relay control</secondary>
59188 </indexterm>
59189 <indexterm role="concept">
59190 <primary>relaying</primary>
59191 <secondary>control by ACL</secondary>
59192 </indexterm>
59193 <indexterm role="concept">
59194 <primary>policy control</primary>
59195 <secondary>relay control</secondary>
59196 </indexterm>
59197 An MTA is said to <emphasis>relay</emphasis> a message if it receives it from some host and
59198 delivers it directly to another host as a result of a remote address contained
59199 within it. Redirecting a local address via an alias or forward file and then
59200 passing the message on to another host is not relaying,
59201 <indexterm role="concept">
59202 <primary><quote>percent hack</quote></primary>
59203 </indexterm>
59204 but a redirection as a result of the <quote>percent hack</quote> is.
59205 </para>
59206 <para>
59207 Two kinds of relaying exist, which are termed <quote>incoming</quote> and <quote>outgoing</quote>.
59208 A host which is acting as a gateway or an MX backup is concerned with incoming
59209 relaying from arbitrary hosts to a specific set of domains. On the other hand,
59210 a host which is acting as a smart host for a number of clients is concerned
59211 with outgoing relaying from those clients to the Internet at large. Often the
59212 same host is fulfilling both functions,
59213 but in principle these two kinds of relaying are entirely independent. What is
59214 not wanted is the transmission of mail from arbitrary remote hosts through your
59215 system to arbitrary domains.
59216 </para>
59217 <para>
59218 You can implement relay control by means of suitable statements in the ACL that
59219 runs for each RCPT command. For convenience, it is often easiest to use
59220 Exim&#x2019;s named list facility to define the domains and hosts involved. For
59221 example, suppose you want to do the following:
59222 </para>
59223 <itemizedlist>
59224 <listitem>
59225 <para>
59226 Deliver a number of domains to mailboxes on the local host (or process them
59227 locally in some other way). Let&#x2019;s say these are <emphasis>my.dom1.example</emphasis> and
59228 <emphasis>my.dom2.example</emphasis>.
59229 </para>
59230 </listitem>
59231 <listitem>
59232 <para>
59233 Relay mail for a number of other domains for which you are the secondary MX.
59234 These might be <emphasis>friend1.example</emphasis> and <emphasis>friend2.example</emphasis>.
59235 </para>
59236 </listitem>
59237 <listitem>
59238 <para>
59239 Relay mail from the hosts on your local LAN, to whatever domains are involved.
59240 Suppose your LAN is 192.168.45.0/24.
59241 </para>
59242 </listitem>
59243 </itemizedlist>
59244 <para>
59245 In the main part of the configuration, you put the following definitions:
59246 </para>
59247 <literallayout class="monospaced">
59248 domainlist local_domains    = my.dom1.example : my.dom2.example
59249 domainlist relay_to_domains = friend1.example : friend2.example
59250 hostlist   relay_from_hosts = 192.168.45.0/24
59251 </literallayout>
59252 <para>
59253 Now you can use these definitions in the ACL that is run for every RCPT
59254 command:
59255 </para>
59256 <literallayout class="monospaced">
59257 acl_check_rcpt:
59258   accept domains = +local_domains : +relay_to_domains
59259   accept hosts   = +relay_from_hosts
59260 </literallayout>
59261 <para>
59262 The first statement accepts any RCPT command that contains an address in
59263 the local or relay domains. For any other domain, control passes to the second
59264 statement, which accepts the command only if it comes from one of the relay
59265 hosts. In practice, you will probably want to make your ACL more sophisticated
59266 than this, for example, by including sender and recipient verification. The
59267 default configuration includes a more comprehensive example, which is described
59268 in chapter <xref linkend="CHAPdefconfil"/>.
59269 </para>
59270 </section>
59271 <section id="SECTcheralcon">
59272 <title>Checking a relay configuration</title>
59273 <para>
59274 <indexterm role="concept">
59275 <primary>relaying</primary>
59276 <secondary>checking control of</secondary>
59277 </indexterm>
59278 You can check the relay characteristics of your configuration in the same way
59279 that you can test any ACL behaviour for an incoming SMTP connection, by using
59280 the <option>-bh</option> option to run a fake SMTP session with which you interact.
59281 <indexterm role="concept" startref="IIDacl" class="endofrange"/>
59282 </para>
59283 </section>
59284 </chapter>
59285
59286 <chapter id="CHAPexiscan">
59287 <title>Content scanning at ACL time</title>
59288 <para>
59289 <indexterm role="concept" id="IIDcosca" class="startofrange">
59290 <primary>content scanning</primary>
59291 <secondary>at ACL time</secondary>
59292 </indexterm>
59293 The extension of Exim to include content scanning at ACL time, formerly known
59294 as <quote>exiscan</quote>, was originally implemented as a patch by Tom Kistner. The code
59295 was integrated into the main source for Exim release 4.50, and Tom continues to
59296 maintain it. Most of the wording of this chapter is taken from Tom&#x2019;s
59297 specification.
59298 </para>
59299 <para>
59300 It is also possible to scan the content of messages at other times. The
59301 <function>local_scan()</function> function (see chapter <xref linkend="CHAPlocalscan"/>) allows for content
59302 scanning after all the ACLs have run. A transport filter can be used to scan
59303 messages at delivery time (see the <option>transport_filter</option> option, described in
59304 chapter <xref linkend="CHAPtransportgeneric"/>).
59305 </para>
59306 <para>
59307 If you want to include the ACL-time content-scanning features when you compile
59308 Exim, you need to arrange for WITH_CONTENT_SCAN to be defined in your
59309 <filename>Local/Makefile</filename>. When you do that, the Exim binary is built with:
59310 </para>
59311 <itemizedlist>
59312 <listitem>
59313 <para>
59314 Two additional ACLs (<option>acl_smtp_mime</option> and <option>acl_not_smtp_mime</option>) that are run
59315 for all MIME parts for SMTP and non-SMTP messages, respectively.
59316 </para>
59317 </listitem>
59318 <listitem>
59319 <para>
59320 Additional ACL conditions and modifiers: <option>decode</option>, <option>malware</option>,
59321 <option>mime_regex</option>, <option>regex</option>, and <option>spam</option>. These can be used in the ACL that is
59322 run at the end of message reception (the <option>acl_smtp_data</option> ACL).
59323 </para>
59324 </listitem>
59325 <listitem>
59326 <para>
59327 An additional control feature (<quote>no_mbox_unspool</quote>) that saves spooled copies
59328 of messages, or parts of messages, for debugging purposes.
59329 </para>
59330 </listitem>
59331 <listitem>
59332 <para>
59333 Additional expansion variables that are set in the new ACL and by the new
59334 conditions.
59335 </para>
59336 </listitem>
59337 <listitem>
59338 <para>
59339 Two new main configuration options: <option>av_scanner</option> and <option>spamd_address</option>.
59340 </para>
59341 </listitem>
59342 </itemizedlist>
59343 <para>
59344 Content-scanning is continually evolving, and new features are still being
59345 added. While such features are still unstable and liable to incompatible
59346 changes, they are made available in Exim by setting options whose names begin
59347 EXPERIMENTAL_ in <filename>Local/Makefile</filename>. Such features are not documented in
59348 this manual. You can find out about them by reading the file called
59349 <filename>doc/experimental.txt</filename>.
59350 </para>
59351 <para>
59352 All the content-scanning facilities work on a MBOX copy of the message that is
59353 temporarily created in a file called:
59354 </para>
59355 <literallayout>
59356 &lt;<emphasis>spool_directory</emphasis>&gt;<literal>/scan/</literal>&lt;<emphasis>message_id</emphasis>&gt;/&lt;<emphasis>message_id</emphasis>&gt;<literal>.eml</literal>
59357 </literallayout>
59358 <para>
59359 The <filename>.eml</filename> extension is a friendly hint to virus scanners that they can
59360 expect an MBOX-like structure inside that file. The file is created when the
59361 first content scanning facility is called. Subsequent calls to content
59362 scanning conditions open the same file again. The directory is recursively
59363 removed when the <option>acl_smtp_data</option> ACL has finished running, unless
59364 </para>
59365 <literallayout class="monospaced">
59366 control = no_mbox_unspool
59367 </literallayout>
59368 <para>
59369 has been encountered. When the MIME ACL decodes files, they are put into the
59370 same directory by default.
59371 </para>
59372 <section id="SECTscanvirus">
59373 <title>Scanning for viruses</title>
59374 <para>
59375 <indexterm role="concept">
59376 <primary>virus scanning</primary>
59377 </indexterm>
59378 <indexterm role="concept">
59379 <primary>content scanning</primary>
59380 <secondary>for viruses</secondary>
59381 </indexterm>
59382 <indexterm role="concept">
59383 <primary>content scanning</primary>
59384 <secondary>the <option>malware</option> condition</secondary>
59385 </indexterm>
59386 The <option>malware</option> ACL condition lets you connect virus scanner software to Exim.
59387 It supports a <quote>generic</quote> interface to scanners called via the shell, and
59388 specialized interfaces for <quote>daemon</quote> type virus scanners, which are resident
59389 in memory and thus are much faster.
59390 </para>
59391 <para>
59392 A timeout of 2 minutes is applied to a scanner call (by default);
59393 if it expires then a defer action is taken.
59394 </para>
59395 <para>
59396 <indexterm role="option">
59397 <primary><option>av_scanner</option></primary>
59398 </indexterm>
59399 You can set the <option>av_scanner</option> option in the main part of the configuration
59400 to specify which scanner to use, together with any additional options that
59401 are needed. The basic syntax is as follows:
59402 </para>
59403 <literallayout>
59404 <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>
59405 </literallayout>
59406 <para>
59407 If you do not set <option>av_scanner</option>, it defaults to
59408 </para>
59409 <literallayout class="monospaced">
59410 av_scanner = sophie:/var/run/sophie
59411 </literallayout>
59412 <para>
59413 If the value of <option>av_scanner</option> starts with a dollar character, it is expanded
59414 before use.
59415 The usual list-parsing of the content (see <xref linkend="SECTlistconstruct"/>) applies.
59416 The following scanner types are supported in this release:
59417 </para>
59418 <variablelist>
59419 <varlistentry>
59420 <term><option>avast</option></term>
59421 <listitem>
59422 <para>
59423 <indexterm role="concept">
59424 <primary>virus scanners</primary>
59425 <secondary>avast</secondary>
59426 </indexterm>
59427 This is the scanner daemon of Avast. It has been tested with Avast Core
59428 Security (currently at version 1.1.7).
59429 You can get a trial version at <emphasis role="bold"><ulink url="http://www.avast.com">http://www.avast.com</ulink></emphasis> or for Linux
59430 at <emphasis role="bold"><ulink url="http://www.avast.com/linux-server-antivirus">http://www.avast.com/linux-server-antivirus</ulink></emphasis>.
59431 This scanner type takes one option,
59432 which can be either a full path to a UNIX socket,
59433 or host and port specifiers separated by white space.
59434 The host may be a name or an IP address; the port is either a
59435 single number or a pair of numbers with a dash between.
59436 Any further options are given, on separate lines,
59437 to the daemon as options before the main scan command.
59438 For example:
59439 </para>
59440 <literallayout class="monospaced">
59441 av_scanner = avast:/var/run/avast/scan.sock:FLAGS -fullfiles:SENSITIVITY -pup
59442 av_scanner = avast:192.168.2.22 5036
59443 </literallayout>
59444 <para>
59445 If you omit the argument, the default path
59446 <filename>/var/run/avast/scan.sock</filename>
59447 is used.
59448 If you use a remote host,
59449 you need to make Exim&#x2019;s spool directory available to it,
59450 as the scanner is passed a file path, not file contents.
59451 For information about available commands and their options you may use
59452 </para>
59453 <literallayout class="monospaced">
59454 $ socat UNIX:/var/run/avast/scan.sock STDIO:
59455     FLAGS
59456     SENSITIVITY
59457     PACK
59458 </literallayout>
59459 </listitem></varlistentry>
59460 <varlistentry>
59461 <term><option>aveserver</option></term>
59462 <listitem>
59463 <para>
59464 <indexterm role="concept">
59465 <primary>virus scanners</primary>
59466 <secondary>Kaspersky</secondary>
59467 </indexterm>
59468 This is the scanner daemon of Kaspersky Version 5. You can get a trial version
59469 at <emphasis role="bold"><ulink url="http://www.kaspersky.com">http://www.kaspersky.com</ulink></emphasis>. This scanner type takes one option,
59470 which is the path to the daemon&#x2019;s UNIX socket. The default is shown in this
59471 example:
59472 </para>
59473 <literallayout class="monospaced">
59474 av_scanner = aveserver:/var/run/aveserver
59475 </literallayout>
59476 </listitem></varlistentry>
59477 <varlistentry>
59478 <term><option>clamd</option></term>
59479 <listitem>
59480 <para>
59481 <indexterm role="concept">
59482 <primary>virus scanners</primary>
59483 <secondary>clamd</secondary>
59484 </indexterm>
59485 This daemon-type scanner is GPL and free. You can get it at
59486 <emphasis role="bold"><ulink url="http://www.clamav.net/">http://www.clamav.net/</ulink></emphasis>. Some older versions of clamd do not seem to
59487 unpack MIME containers, so it used to be recommended to unpack MIME attachments
59488 in the MIME ACL. This is no longer believed to be necessary.
59489 </para>
59490 <para>
59491 The options are a list of server specifiers, which may be
59492 a UNIX socket specification,
59493 a TCP socket specification,
59494 or a (global) option.
59495 </para>
59496 <para>
59497 A socket specification consists of a space-separated list.
59498 For a Unix socket the first element is a full path for the socket,
59499 for a TCP socket the first element is the IP address
59500 and the second a port number,
59501 Any further elements are per-server (non-global) options.
59502 These per-server options are supported:
59503 </para>
59504 <literallayout class="monospaced">
59505 retry=&lt;timespec&gt;  Retry on connect fail
59506 </literallayout>
59507 <para>
59508 The <literal>retry</literal> option specifies a time after which a single retry for
59509 a failed connect is made.  The default is to not retry.
59510 </para>
59511 <para>
59512 If a Unix socket file is specified, only one server is supported.
59513 </para>
59514 <para>
59515 Examples:
59516 </para>
59517 <literallayout class="monospaced">
59518 av_scanner = clamd:/opt/clamd/socket
59519 av_scanner = clamd:192.0.2.3 1234
59520 av_scanner = clamd:192.0.2.3 1234:local
59521 av_scanner = clamd:192.0.2.3 1234 retry=10s
59522 av_scanner = clamd:192.0.2.3 1234 : 192.0.2.4 1234
59523 </literallayout>
59524 <para>
59525 If the value of av_scanner points to a UNIX socket file or contains the
59526 <literal>local</literal>
59527 option, then the ClamAV interface will pass a filename containing the data
59528 to be scanned, which will should normally result in less I/O happening and be
59529 more efficient.  Normally in the TCP case, the data is streamed to ClamAV as
59530 Exim does not assume that there is a common filesystem with the remote host.
59531 There is an option WITH_OLD_CLAMAV_STREAM in <filename>src/EDITME</filename> available, should
59532 you be running a version of ClamAV prior to 0.95.
59533 </para>
59534 <para>
59535 The final example shows that multiple TCP targets can be specified.  Exim will
59536 randomly use one for each incoming email (i.e. it load balances them).  Note
59537 that only TCP targets may be used if specifying a list of scanners; a UNIX
59538 socket cannot be mixed in with TCP targets.  If one of the servers becomes
59539 unavailable, Exim will try the remaining one(s) until it finds one that works.
59540 When a clamd server becomes unreachable, Exim will log a message.  Exim does
59541 not keep track of scanner state between multiple messages, and the scanner
59542 selection is random, so the message will get logged in the mainlog for each
59543 email that the down scanner gets chosen first (message wrapped to be readable):
59544 </para>
59545 <literallayout class="monospaced">
59546 2013-10-09 14:30:39 1VTumd-0000Y8-BQ malware acl condition:
59547    clamd: connection to localhost, port 3310 failed
59548    (Connection refused)
59549 </literallayout>
59550 <para>
59551 If the option is unset, the default is <filename>/tmp/clamd</filename>. Thanks to David Saez for
59552 contributing the code for this scanner.
59553 </para>
59554 </listitem></varlistentry>
59555 <varlistentry>
59556 <term><option>cmdline</option></term>
59557 <listitem>
59558 <para>
59559 <indexterm role="concept">
59560 <primary>virus scanners</primary>
59561 <secondary>command line interface</secondary>
59562 </indexterm>
59563 This is the keyword for the generic command line scanner interface. It can be
59564 used to attach virus scanners that are invoked from the shell. This scanner
59565 type takes 3 mandatory options:
59566 </para>
59567 <orderedlist numeration="arabic">
59568 <listitem>
59569 <para>
59570 The full path and name of the scanner binary, with all command line options,
59571 and a placeholder (<literal>%s</literal>) for the directory to scan.
59572 </para>
59573 </listitem>
59574 <listitem>
59575 <para>
59576 A regular expression to match against the STDOUT and STDERR output of the
59577 virus scanner. If the expression matches, a virus was found. You must make
59578 absolutely sure that this expression matches on <quote>virus found</quote>. This is called
59579 the <quote>trigger</quote> expression.
59580 </para>
59581 </listitem>
59582 <listitem>
59583 <para>
59584 Another regular expression, containing exactly one pair of parentheses, to
59585 match the name of the virus found in the scanners output. This is called the
59586 <quote>name</quote> expression.
59587 </para>
59588 </listitem>
59589 </orderedlist>
59590 <para>
59591 For example, Sophos Sweep reports a virus on a line like this:
59592 </para>
59593 <literallayout class="monospaced">
59594 Virus 'W32/Magistr-B' found in file ./those.bat
59595 </literallayout>
59596 <para>
59597 For the trigger expression, we can match the phrase <quote>found in file</quote>. For the
59598 name expression, we want to extract the W32/Magistr-B string, so we can match
59599 for the single quotes left and right of it. Altogether, this makes the
59600 configuration setting:
59601 </para>
59602 <literallayout class="monospaced">
59603 av_scanner = cmdline:\
59604              /path/to/sweep -ss -all -rec -archive %s:\
59605              found in file:'(.+)'
59606 </literallayout>
59607 </listitem></varlistentry>
59608 <varlistentry>
59609 <term><option>drweb</option></term>
59610 <listitem>
59611 <para>
59612 <indexterm role="concept">
59613 <primary>virus scanners</primary>
59614 <secondary>DrWeb</secondary>
59615 </indexterm>
59616 The DrWeb daemon scanner (<emphasis role="bold"><ulink url="http://www.sald.com/">http://www.sald.com/</ulink></emphasis>) interface
59617 takes one option,
59618 either a full path to a UNIX socket,
59619 or host and port specifiers separated by white space.
59620 The host may be a name or an IP address; the port is either a
59621 single number or a pair of numbers with a dash between.
59622 For example:
59623 </para>
59624 <literallayout class="monospaced">
59625 av_scanner = drweb:/var/run/drwebd.sock
59626 av_scanner = drweb:192.168.2.20 31337
59627 </literallayout>
59628 <para>
59629 If you omit the argument, the default path <filename>/usr/local/drweb/run/drwebd.sock</filename>
59630 is used. Thanks to Alex Miller for contributing the code for this scanner.
59631 </para>
59632 </listitem></varlistentry>
59633 <varlistentry>
59634 <term><option>f-protd</option></term>
59635 <listitem>
59636 <para>
59637 <indexterm role="concept">
59638 <primary>virus scanners</primary>
59639 <secondary>f-protd</secondary>
59640 </indexterm>
59641 The f-protd scanner is accessed via HTTP over TCP.
59642 One argument is taken, being a space-separated hostname and port number
59643 (or port-range).
59644 For example:
59645 </para>
59646 <literallayout class="monospaced">
59647 av_scanner = f-protd:localhost 10200-10204
59648 </literallayout>
59649 <para>
59650 If you omit the argument, the default values show above are used.
59651 </para>
59652 </listitem></varlistentry>
59653 <varlistentry revisionflag="changed">
59654 <term><option>f-prot6d</option></term>
59655 <listitem>
59656 <para revisionflag="changed">
59657 <indexterm role="concept">
59658 <primary>virus scanners</primary>
59659 <secondary>f-prot6d</secondary>
59660 </indexterm>
59661 The f-prot6d scanner is accessed using the FPSCAND protocol over TCP.
59662 One argument is taken, being a space-separated hostname and port number.
59663 For example:
59664 </para>
59665 <literallayout class="monospaced" revisionflag="changed">
59666 av_scanner = f-prot6d:localhost 10200
59667 </literallayout>
59668 <para revisionflag="changed">
59669 If you omit the argument, the default values show above are used.
59670 </para>
59671 </listitem></varlistentry>
59672 <varlistentry>
59673 <term><option>fsecure</option></term>
59674 <listitem>
59675 <para>
59676 <indexterm role="concept">
59677 <primary>virus scanners</primary>
59678 <secondary>F-Secure</secondary>
59679 </indexterm>
59680 The F-Secure daemon scanner (<emphasis role="bold"><ulink url="http://www.f-secure.com">http://www.f-secure.com</ulink></emphasis>) takes one
59681 argument which is the path to a UNIX socket. For example:
59682 </para>
59683 <literallayout class="monospaced">
59684 av_scanner = fsecure:/path/to/.fsav
59685 </literallayout>
59686 <para>
59687 If no argument is given, the default is <filename>/var/run/.fsav</filename>. Thanks to Johan
59688 Thelmen for contributing the code for this scanner.
59689 </para>
59690 </listitem></varlistentry>
59691 <varlistentry>
59692 <term><option>kavdaemon</option></term>
59693 <listitem>
59694 <para>
59695 <indexterm role="concept">
59696 <primary>virus scanners</primary>
59697 <secondary>Kaspersky</secondary>
59698 </indexterm>
59699 This is the scanner daemon of Kaspersky Version 4. This version of the
59700 Kaspersky scanner is outdated. Please upgrade (see <option>aveserver</option> above). This
59701 scanner type takes one option, which is the path to the daemon&#x2019;s UNIX socket.
59702 For example:
59703 </para>
59704 <literallayout class="monospaced">
59705 av_scanner = kavdaemon:/opt/AVP/AvpCtl
59706 </literallayout>
59707 <para>
59708 The default path is <filename>/var/run/AvpCtl</filename>.
59709 </para>
59710 </listitem></varlistentry>
59711 <varlistentry>
59712 <term><option>mksd</option></term>
59713 <listitem>
59714 <para>
59715 <indexterm role="concept">
59716 <primary>virus scanners</primary>
59717 <secondary>mksd</secondary>
59718 </indexterm>
59719 This is a daemon type scanner that is aimed mainly at Polish users, though some
59720 parts of documentation are now available in English. You can get it at
59721 <emphasis role="bold"><ulink url="http://linux.mks.com.pl/">http://linux.mks.com.pl/</ulink></emphasis>. The only option for this scanner type is
59722 the maximum number of processes used simultaneously to scan the attachments,
59723 provided that mksd has
59724 been run with at least the same number of child processes. For example:
59725 </para>
59726 <literallayout class="monospaced">
59727 av_scanner = mksd:2
59728 </literallayout>
59729 <para>
59730 You can safely omit this option (the default value is 1).
59731 </para>
59732 </listitem></varlistentry>
59733 <varlistentry>
59734 <term><option>sock</option></term>
59735 <listitem>
59736 <para>
59737 <indexterm role="concept">
59738 <primary>virus scanners</primary>
59739 <secondary>simple socket-connected</secondary>
59740 </indexterm>
59741 This is a general-purpose way of talking to simple scanner daemons
59742 running on the local machine.
59743 There are four options:
59744 an address (which may be an IP address and port, or the path of a Unix socket),
59745 a commandline to send (may include a single %s which will be replaced with
59746 the path to the mail file to be scanned),
59747 an RE to trigger on from the returned data,
59748 and an RE to extract malware_name from the returned data.
59749 For example:
59750 </para>
59751 <literallayout class="monospaced">
59752 av_scanner = sock:127.0.0.1 6001:%s:(SPAM|VIRUS):(.*)$
59753 </literallayout>
59754 <para revisionflag="changed">
59755 Note that surrounding whitespace is stripped from each option, meaning
59756 there is no way to specify a trailing newline.
59757 The socket specifier and both regular-expressions are required.
59758 Default for the commandline is <filename>%s\n</filename> (note this does have a trailing newline);
59759 specify an empty element to get this.
59760 </para>
59761 </listitem></varlistentry>
59762 <varlistentry>
59763 <term><option>sophie</option></term>
59764 <listitem>
59765 <para>
59766 <indexterm role="concept">
59767 <primary>virus scanners</primary>
59768 <secondary>Sophos and Sophie</secondary>
59769 </indexterm>
59770 Sophie is a daemon that uses Sophos&#x2019; <option>libsavi</option> library to scan for viruses.
59771 You can get Sophie at <emphasis role="bold"><ulink url="http://www.clanfield.info/sophie/">http://www.clanfield.info/sophie/</ulink></emphasis>. The only option
59772 for this scanner type is the path to the UNIX socket that Sophie uses for
59773 client communication. For example:
59774 </para>
59775 <literallayout class="monospaced">
59776 av_scanner = sophie:/tmp/sophie
59777 </literallayout>
59778 <para>
59779 The default path is <filename>/var/run/sophie</filename>, so if you are using this, you can omit
59780 the option.
59781 </para>
59782 </listitem></varlistentry>
59783 </variablelist>
59784 <para>
59785 When <option>av_scanner</option> is correctly set, you can use the <option>malware</option> condition in
59786 the DATA ACL. <emphasis role="bold">Note</emphasis>: You cannot use the <option>malware</option> condition in the MIME
59787 ACL.
59788 </para>
59789 <para>
59790 The <option>av_scanner</option> option is expanded each time <option>malware</option> is called. This
59791 makes it possible to use different scanners. See further below for an example.
59792 The <option>malware</option> condition caches its results, so when you use it multiple times
59793 for the same message, the actual scanning process is only carried out once.
59794 However, using expandable items in <option>av_scanner</option> disables this caching, in
59795 which case each use of the <option>malware</option> condition causes a new scan of the
59796 message.
59797 </para>
59798 <para>
59799 The <option>malware</option> condition takes a right-hand argument that is expanded before
59800 use and taken as a list, slash-separated by default.
59801 The first element can then be one of
59802 </para>
59803 <itemizedlist>
59804 <listitem>
59805 <para>
59806 <quote>true</quote>, <quote>*</quote>, or <quote>1</quote>, in which case the message is scanned for viruses.
59807 The condition succeeds if a virus was found, and fail otherwise. This is the
59808 recommended usage.
59809 </para>
59810 </listitem>
59811 <listitem>
59812 <para>
59813 <quote>false</quote> or <quote>0</quote> or an empty string, in which case no scanning is done and
59814 the condition fails immediately.
59815 </para>
59816 </listitem>
59817 <listitem>
59818 <para>
59819 A regular expression, in which case the message is scanned for viruses. The
59820 condition succeeds if a virus is found and its name matches the regular
59821 expression. This allows you to take special actions on certain types of virus.
59822 Note that <quote>/</quote> characters in the RE must be doubled due to the list-processing,
59823 unless the separator is changed (in the usual way).
59824 </para>
59825 </listitem>
59826 </itemizedlist>
59827 <para>
59828 You can append a <literal>defer_ok</literal> element to the <option>malware</option> argument list to accept
59829 messages even if there is a problem with the virus scanner.
59830 Otherwise, such a problem causes the ACL to defer.
59831 </para>
59832 <para>
59833 You can append a <literal>tmo=&lt;val&gt;</literal> element to the <option>malware</option> argument list to
59834 specify a non-default timeout.  The default is two minutes.
59835 For example:
59836 </para>
59837 <literallayout class="monospaced">
59838 malware = * / defer_ok / tmo=10s
59839 </literallayout>
59840 <para>
59841 A timeout causes the ACL to defer.
59842 </para>
59843 <para>
59844 <indexterm role="variable">
59845 <primary><varname>$callout_address</varname></primary>
59846 </indexterm>
59847 When a connection is made to the scanner the expansion variable <varname>$callout_address</varname>
59848 is set to record the actual address used.
59849 </para>
59850 <para>
59851 <indexterm role="variable">
59852 <primary><varname>$malware_name</varname></primary>
59853 </indexterm>
59854 When a virus is found, the condition sets up an expansion variable called
59855 <varname>$malware_name</varname> that contains the name of the virus. You can use it in a
59856 <option>message</option> modifier that specifies the error returned to the sender, and/or in
59857 logging data.
59858 </para>
59859 <para>
59860 Beware the interaction of Exim&#x2019;s <option>message_size_limit</option> with any size limits
59861 imposed by your anti-virus scanner.
59862 </para>
59863 <para>
59864 Here is a very simple scanning example:
59865 </para>
59866 <literallayout class="monospaced">
59867 deny message = This message contains malware ($malware_name)
59868      malware = *
59869 </literallayout>
59870 <para>
59871 The next example accepts messages when there is a problem with the scanner:
59872 </para>
59873 <literallayout class="monospaced">
59874 deny message = This message contains malware ($malware_name)
59875      malware = */defer_ok
59876 </literallayout>
59877 <para>
59878 The next example shows how to use an ACL variable to scan with both sophie and
59879 aveserver. It assumes you have set:
59880 </para>
59881 <literallayout class="monospaced">
59882 av_scanner = $acl_m0
59883 </literallayout>
59884 <para>
59885 in the main Exim configuration.
59886 </para>
59887 <literallayout class="monospaced">
59888 deny message = This message contains malware ($malware_name)
59889      set acl_m0 = sophie
59890      malware = *
59891
59892 deny message = This message contains malware ($malware_name)
59893      set acl_m0 = aveserver
59894      malware = *
59895 </literallayout>
59896 </section>
59897 <section id="SECTscanspamass">
59898 <title>Scanning with SpamAssassin and Rspamd</title>
59899 <para>
59900 <indexterm role="concept">
59901 <primary>content scanning</primary>
59902 <secondary>for spam</secondary>
59903 </indexterm>
59904 <indexterm role="concept">
59905 <primary>spam scanning</primary>
59906 </indexterm>
59907 <indexterm role="concept">
59908 <primary>SpamAssassin</primary>
59909 </indexterm>
59910 <indexterm role="concept">
59911 <primary>Rspamd</primary>
59912 </indexterm>
59913 The <option>spam</option> ACL condition calls SpamAssassin&#x2019;s <option>spamd</option> daemon to get a spam
59914 score and a report for the message.
59915 Support is also provided for Rspamd.
59916 </para>
59917 <para>
59918 For more information about installation and configuration of SpamAssassin or
59919 Rspamd refer to their respective websites at
59920 <emphasis role="bold"><ulink url="http://spamassassin.apache.org">http://spamassassin.apache.org</ulink></emphasis> and <emphasis role="bold"><ulink url="http://www.rspamd.com">http://www.rspamd.com</ulink></emphasis>
59921 </para>
59922 <para>
59923 SpamAssassin can be installed with CPAN by running:
59924 </para>
59925 <literallayout class="monospaced">
59926 perl -MCPAN -e 'install Mail::SpamAssassin'
59927 </literallayout>
59928 <para>
59929 SpamAssassin has its own set of configuration files. Please review its
59930 documentation to see how you can tweak it. The default installation should work
59931 nicely, however.
59932 </para>
59933 <para>
59934 <indexterm role="option">
59935 <primary><option>spamd_address</option></primary>
59936 </indexterm>
59937 By default, SpamAssassin listens on 127.0.0.1, TCP port 783 and if you
59938 intend to use an instance running on the local host you do not need to set
59939 <option>spamd_address</option>. If you intend to use another host or port for SpamAssassin,
59940 you must set the <option>spamd_address</option> option in the global part of the Exim
59941 configuration as follows (example):
59942 </para>
59943 <literallayout class="monospaced">
59944 spamd_address = 192.168.99.45 387
59945 </literallayout>
59946 <para>
59947 The SpamAssassin protocol relies on a TCP half-close from the client.
59948 If your SpamAssassin client side is running a Linux system with an
59949 iptables firewall, consider setting
59950 <option>net.netfilter.nf_conntrack_tcp_timeout_close_wait</option> to at least the
59951 timeout, Exim uses when waiting for a response from the SpamAssassin
59952 server (currently defaulting to 120s).  With a lower value the Linux
59953 connection tracking may consider your half-closed connection as dead too
59954 soon.
59955 </para>
59956 <para>
59957 To use Rspamd (which by default listens on all local addresses
59958 on TCP port 11333)
59959 you should add <option>variant=rspamd</option> after the address/port pair, for example:
59960 </para>
59961 <literallayout class="monospaced">
59962 spamd_address = 127.0.0.1 11333 variant=rspamd
59963 </literallayout>
59964 <para>
59965 As of version 2.60, <option>SpamAssassin</option> also supports communication over UNIX
59966 sockets. If you want to us these, supply <option>spamd_address</option> with an absolute
59967 file name instead of an address/port pair:
59968 </para>
59969 <literallayout class="monospaced">
59970 spamd_address = /var/run/spamd_socket
59971 </literallayout>
59972 <para>
59973 You can have multiple <option>spamd</option> servers to improve scalability. These can
59974 reside on other hardware reachable over the network. To specify multiple
59975 <option>spamd</option> servers, put multiple address/port pairs in the <option>spamd_address</option>
59976 option, separated with colons (the separator can be changed in the usual way):
59977 </para>
59978 <literallayout class="monospaced">
59979 spamd_address = 192.168.2.10 783 : \
59980                 192.168.2.11 783 : \
59981                 192.168.2.12 783
59982 </literallayout>
59983 <para>
59984 Up to 32 <option>spamd</option> servers are supported.
59985 When a server fails to respond to the connection attempt, all other
59986 servers are tried until one succeeds. If no server responds, the <option>spam</option>
59987 condition defers.
59988 </para>
59989 <para>
59990 Unix and TCP socket specifications may be mixed in any order.
59991 Each element of the list is a list itself, space-separated by default
59992 and changeable in the usual way; take care to not double the separator.
59993 </para>
59994 <para>
59995 For TCP socket specifications a host name or IP (v4 or v6, but
59996 subject to list-separator quoting rules) address can be used,
59997 and the port can be one or a dash-separated pair.
59998 In the latter case, the range is tried in strict order.
59999 </para>
60000 <para>
60001 Elements after the first for Unix sockets, or second for TCP socket,
60002 are options.
60003 The supported options are:
60004 </para>
60005 <literallayout class="monospaced">
60006 pri=&lt;priority&gt;      Selection priority
60007 weight=&lt;value&gt;      Selection bias
60008 time=&lt;start&gt;-&lt;end&gt;  Use only between these times of day
60009 retry=&lt;timespec&gt;    Retry on connect fail
60010 tmo=&lt;timespec&gt;      Connection time limit
60011 variant=rspamd      Use Rspamd rather than SpamAssassin protocol
60012 </literallayout>
60013 <para>
60014 The <literal>pri</literal> option specifies a priority for the server within the list,
60015 higher values being tried first.
60016 The default priority is 1.
60017 </para>
60018 <para>
60019 The <literal>weight</literal> option specifies a selection bias.
60020 Within a priority set
60021 servers are queried in a random fashion, weighted by this value.
60022 The default value for selection bias is 1.
60023 </para>
60024 <para>
60025 Time specifications for the <literal>time</literal> option are &lt;hour&gt;.&lt;minute&gt;.&lt;second&gt;
60026 in the local time zone; each element being one or more digits.
60027 Either the seconds or both minutes and seconds, plus the leading <literal>.</literal>
60028 characters, may be omitted and will be taken as zero.
60029 </para>
60030 <para>
60031 Timeout specifications for the <literal>retry</literal> and <literal>tmo</literal> options
60032 are the usual Exim time interval standard, e.g. <literal>20s</literal> or <literal>1m</literal>.
60033 </para>
60034 <para>
60035 The <literal>tmo</literal> option specifies an overall timeout for communication.
60036 The default value is two minutes.
60037 </para>
60038 <para>
60039 The <literal>retry</literal> option specifies a time after which a single retry for
60040 a failed connect is made.
60041 The default is to not retry.
60042 </para>
60043 <para>
60044 The <option>spamd_address</option> variable is expanded before use if it starts with
60045 a dollar sign. In this case, the expansion may return a string that is
60046 used as the list so that multiple spamd servers can be the result of an
60047 expansion.
60048 </para>
60049 <para>
60050 <indexterm role="variable">
60051 <primary><varname>$callout_address</varname></primary>
60052 </indexterm>
60053 When a connection is made to the server the expansion variable <varname>$callout_address</varname>
60054 is set to record the actual address used.
60055 </para>
60056 </section>
60057 <section id="SECID206">
60058 <title>Calling SpamAssassin from an Exim ACL</title>
60059 <para>
60060 Here is a simple example of the use of the <option>spam</option> condition in a DATA ACL:
60061 </para>
60062 <literallayout class="monospaced">
60063 deny message = This message was classified as SPAM
60064      spam = joe
60065 </literallayout>
60066 <para>
60067 The right-hand side of the <option>spam</option> condition specifies a name. This is
60068 relevant if you have set up multiple SpamAssassin profiles. If you do not want
60069 to scan using a specific profile, but rather use the SpamAssassin system-wide
60070 default profile, you can scan for an unknown name, or simply use <quote>nobody</quote>.
60071 Rspamd does not use this setting. However, you must put something on the
60072 right-hand side.
60073 </para>
60074 <para>
60075 The name allows you to use per-domain or per-user antispam profiles in
60076 principle, but this is not straightforward in practice, because a message may
60077 have multiple recipients, not necessarily all in the same domain. Because the
60078 <option>spam</option> condition has to be called from a DATA-time ACL in order to be able to
60079 read the contents of the message, the variables <varname>$local_part</varname> and <varname>$domain</varname>
60080 are not set.
60081 Careful enforcement of single-recipient messages
60082 (e.g. by responding with defer in the recipient ACL for all recipients
60083 after the first),
60084 or the use of PRDR,
60085 <indexterm role="concept">
60086 <primary>PRDR</primary>
60087 <secondary>use for per-user SpamAssassin profiles</secondary>
60088 </indexterm>
60089 are needed to use this feature.
60090 </para>
60091 <para>
60092 The right-hand side of the <option>spam</option> condition is expanded before being used, so
60093 you can put lookups or conditions there. When the right-hand side evaluates to
60094 <quote>0</quote> or <quote>false</quote>, no scanning is done and the condition fails immediately.
60095 </para>
60096 <para>
60097 Scanning with SpamAssassin uses a lot of resources. If you scan every message,
60098 large ones may cause significant performance degradation. As most spam messages
60099 are quite small, it is recommended that you do not scan the big ones. For
60100 example:
60101 </para>
60102 <literallayout class="monospaced">
60103 deny message = This message was classified as SPAM
60104      condition = ${if &lt; {$message_size}{10K}}
60105      spam = nobody
60106 </literallayout>
60107 <para>
60108 The <option>spam</option> condition returns true if the threshold specified in the user&#x2019;s
60109 SpamAssassin profile has been matched or exceeded. If you want to use the
60110 <option>spam</option> condition for its side effects (see the variables below), you can make
60111 it always return <quote>true</quote> by appending <literal>:true</literal> to the username.
60112 </para>
60113 <para>
60114 <indexterm role="concept">
60115 <primary>spam scanning</primary>
60116 <secondary>returned variables</secondary>
60117 </indexterm>
60118 When the <option>spam</option> condition is run, it sets up a number of expansion
60119 variables.
60120 Except for <varname>$spam_report</varname>,
60121 these variables are saved with the received message so are
60122 available for use at delivery time.
60123 </para>
60124 <variablelist>
60125 <varlistentry>
60126 <term><varname>$spam_score</varname></term>
60127 <listitem>
60128 <para>
60129 The spam score of the message, for example <quote>3.4</quote> or <quote>30.5</quote>. This is useful
60130 for inclusion in log or reject messages.
60131 </para>
60132 </listitem></varlistentry>
60133 <varlistentry>
60134 <term><varname>$spam_score_int</varname></term>
60135 <listitem>
60136 <para>
60137 The spam score of the message, multiplied by ten, as an integer value. For
60138 example <quote>34</quote> or <quote>305</quote>. It may appear to disagree with <varname>$spam_score</varname>
60139 because <varname>$spam_score</varname> is rounded and <varname>$spam_score_int</varname> is truncated.
60140 The integer value is useful for numeric comparisons in conditions.
60141 </para>
60142 </listitem></varlistentry>
60143 <varlistentry>
60144 <term><varname>$spam_bar</varname></term>
60145 <listitem>
60146 <para>
60147 A string consisting of a number of <quote>+</quote> or <quote>-</quote> characters, representing the
60148 integer part of the spam score value. A spam score of 4.4 would have a
60149 <varname>$spam_bar</varname> value of <quote>++++</quote>. This is useful for inclusion in warning
60150 headers, since MUAs can match on such strings. The maximum length of the
60151 spam bar is 50 characters.
60152 </para>
60153 </listitem></varlistentry>
60154 <varlistentry>
60155 <term><varname>$spam_report</varname></term>
60156 <listitem>
60157 <para>
60158 A multiline text table, containing the full SpamAssassin report for the
60159 message. Useful for inclusion in headers or reject messages.
60160 This variable is only usable in a DATA-time ACL.
60161 Beware that SpamAssassin may return non-ASCII characters, especially
60162 when running in country-specific locales, which are not legal
60163 unencoded in headers.
60164 </para>
60165 </listitem></varlistentry>
60166 <varlistentry>
60167 <term><varname>$spam_action</varname></term>
60168 <listitem>
60169 <para>
60170 For SpamAssassin either &#x2019;reject&#x2019; or &#x2019;no action&#x2019; depending on the
60171 spam score versus threshold.
60172 For Rspamd, the recommended action.
60173 </para>
60174 </listitem></varlistentry>
60175 </variablelist>
60176 <para>
60177 The <option>spam</option> condition caches its results unless expansion in
60178 spamd_address was used. If you call it again with the same user name, it
60179 does not scan again, but rather returns the same values as before.
60180 </para>
60181 <para>
60182 The <option>spam</option> condition returns DEFER if there is any error while running
60183 the message through SpamAssassin or if the expansion of spamd_address
60184 failed. If you want to treat DEFER as FAIL (to pass on to the next ACL
60185 statement block), append <literal>/defer_ok</literal> to the right-hand side of the
60186 spam condition, like this:
60187 </para>
60188 <literallayout class="monospaced">
60189 deny message = This message was classified as SPAM
60190      spam    = joe/defer_ok
60191 </literallayout>
60192 <para>
60193 This causes messages to be accepted even if there is a problem with <option>spamd</option>.
60194 </para>
60195 <para>
60196 Here is a longer, commented example of the use of the <option>spam</option>
60197 condition:
60198 </para>
60199 <literallayout class="monospaced">
60200 # put headers in all messages (no matter if spam or not)
60201 warn  spam = nobody:true
60202       add_header = X-Spam-Score: $spam_score ($spam_bar)
60203       add_header = X-Spam-Report: $spam_report
60204
60205 # add second subject line with *SPAM* marker when message
60206 # is over threshold
60207 warn  spam = nobody
60208       add_header = Subject: *SPAM* $h_Subject:
60209
60210 # reject spam at high scores (&gt; 12)
60211 deny  message = This message scored $spam_score spam points.
60212       spam = nobody:true
60213       condition = ${if &gt;{$spam_score_int}{120}{1}{0}}
60214 </literallayout>
60215 </section>
60216 <section id="SECTscanmimepart">
60217 <title>Scanning MIME parts</title>
60218 <para>
60219 <indexterm role="concept">
60220 <primary>content scanning</primary>
60221 <secondary>MIME parts</secondary>
60222 </indexterm>
60223 <indexterm role="concept">
60224 <primary>MIME content scanning</primary>
60225 </indexterm>
60226 <indexterm role="option">
60227 <primary><option>acl_smtp_mime</option></primary>
60228 </indexterm>
60229 <indexterm role="option">
60230 <primary><option>acl_not_smtp_mime</option></primary>
60231 </indexterm>
60232 The <option>acl_smtp_mime</option> global option specifies an ACL that is called once for
60233 each MIME part of an SMTP message, including multipart types, in the sequence
60234 of their position in the message. Similarly, the <option>acl_not_smtp_mime</option> option
60235 specifies an ACL that is used for the MIME parts of non-SMTP messages. These
60236 options may both refer to the same ACL if you want the same processing in both
60237 cases.
60238 </para>
60239 <para>
60240 These ACLs are called (possibly many times) just before the <option>acl_smtp_data</option>
60241 ACL in the case of an SMTP message, or just before the <option>acl_not_smtp</option> ACL in
60242 the case of a non-SMTP message. However, a MIME ACL is called only if the
60243 message contains a <emphasis>Content-Type:</emphasis> header line. When a call to a MIME
60244 ACL does not yield <quote>accept</quote>, ACL processing is aborted and the appropriate
60245 result code is sent to the client. In the case of an SMTP message, the
60246 <option>acl_smtp_data</option> ACL is not called when this happens.
60247 </para>
60248 <para>
60249 You cannot use the <option>malware</option> or <option>spam</option> conditions in a MIME ACL; these can
60250 only be used in the DATA or non-SMTP ACLs. However, you can use the <option>regex</option>
60251 condition to match against the raw MIME part. You can also use the
60252 <option>mime_regex</option> condition to match against the decoded MIME part (see section
60253 <xref linkend="SECTscanregex"/>).
60254 </para>
60255 <para>
60256 At the start of a MIME ACL, a number of variables are set from the header
60257 information for the relevant MIME part. These are described below. The contents
60258 of the MIME part are not by default decoded into a disk file except for MIME
60259 parts whose content-type is <quote>message/rfc822</quote>. If you want to decode a MIME
60260 part into a disk file, you can use the <option>decode</option> condition. The general
60261 syntax is:
60262 </para>
60263 <literallayout>
60264 <literal>decode = [/</literal>&lt;<emphasis>path</emphasis>&gt;<literal>/]</literal>&lt;<emphasis>filename</emphasis>&gt;
60265 </literallayout>
60266 <para>
60267 The right hand side is expanded before use. After expansion,
60268 the value can be:
60269 </para>
60270 <orderedlist numeration="arabic">
60271 <listitem>
60272 <para>
60273 <quote>0</quote> or <quote>false</quote>, in which case no decoding is done.
60274 </para>
60275 </listitem>
60276 <listitem>
60277 <para>
60278 The string <quote>default</quote>. In that case, the file is put in the temporary
60279 <quote>default</quote> directory &lt;<emphasis>spool_directory</emphasis>&gt;<filename>/scan/</filename>&lt;<emphasis>message_id</emphasis>&gt;<filename>/</filename> with
60280 a sequential file name consisting of the message id and a sequence number. The
60281 full path and name is available in <varname>$mime_decoded_filename</varname> after decoding.
60282 </para>
60283 </listitem>
60284 <listitem>
60285 <para>
60286 A full path name starting with a slash. If the full name is an existing
60287 directory, it is used as a replacement for the default directory. The filename
60288 is then sequentially assigned. If the path does not exist, it is used as
60289 the full path and file name.
60290 </para>
60291 </listitem>
60292 <listitem>
60293 <para>
60294 If the string does not start with a slash, it is used as the
60295 filename, and the default path is then used.
60296 </para>
60297 </listitem>
60298 </orderedlist>
60299 <para>
60300 The <option>decode</option> condition normally succeeds. It is only false for syntax
60301 errors or unusual circumstances such as memory shortages. You can easily decode
60302 a file with its original, proposed filename using
60303 </para>
60304 <literallayout class="monospaced">
60305 decode = $mime_filename
60306 </literallayout>
60307 <para>
60308 However, you should keep in mind that <varname>$mime_filename</varname> might contain
60309 anything. If you place files outside of the default path, they are not
60310 automatically unlinked.
60311 </para>
60312 <para>
60313 For RFC822 attachments (these are messages attached to messages, with a
60314 content-type of <quote>message/rfc822</quote>), the ACL is called again in the same manner
60315 as for the primary message, only that the <varname>$mime_is_rfc822</varname> expansion
60316 variable is set (see below). Attached messages are always decoded to disk
60317 before being checked, and the files are unlinked once the check is done.
60318 </para>
60319 <para>
60320 The MIME ACL supports the <option>regex</option> and <option>mime_regex</option> conditions. These can be
60321 used to match regular expressions against raw and decoded MIME parts,
60322 respectively. They are described in section <xref linkend="SECTscanregex"/>.
60323 </para>
60324 <para>
60325 <indexterm role="concept">
60326 <primary>MIME content scanning</primary>
60327 <secondary>returned variables</secondary>
60328 </indexterm>
60329 The following list describes all expansion variables that are
60330 available in the MIME ACL:
60331 </para>
60332 <variablelist>
60333 <varlistentry>
60334 <term><varname>$mime_boundary</varname></term>
60335 <listitem>
60336 <para>
60337 If the current part is a multipart (see <varname>$mime_is_multipart</varname>) below, it should
60338 have a boundary string, which is stored in this variable. If the current part
60339 has no boundary parameter in the <emphasis>Content-Type:</emphasis> header, this variable
60340 contains the empty string.
60341 </para>
60342 </listitem></varlistentry>
60343 <varlistentry>
60344 <term><varname>$mime_charset</varname></term>
60345 <listitem>
60346 <para>
60347 This variable contains the character set identifier, if one was found in the
60348 <emphasis>Content-Type:</emphasis> header. Examples for charset identifiers are:
60349 </para>
60350 <literallayout class="monospaced">
60351 us-ascii
60352 gb2312 (Chinese)
60353 iso-8859-1
60354 </literallayout>
60355 <para>
60356 Please note that this value is not normalized, so you should do matches
60357 case-insensitively.
60358 </para>
60359 </listitem></varlistentry>
60360 <varlistentry>
60361 <term><varname>$mime_content_description</varname></term>
60362 <listitem>
60363 <para>
60364 This variable contains the normalized content of the <emphasis>Content-Description:</emphasis>
60365 header. It can contain a human-readable description of the parts content. Some
60366 implementations repeat the filename for attachments here, but they are usually
60367 only used for display purposes.
60368 </para>
60369 </listitem></varlistentry>
60370 <varlistentry>
60371 <term><varname>$mime_content_disposition</varname></term>
60372 <listitem>
60373 <para>
60374 This variable contains the normalized content of the <emphasis>Content-Disposition:</emphasis>
60375 header. You can expect strings like <quote>attachment</quote> or <quote>inline</quote> here.
60376 </para>
60377 </listitem></varlistentry>
60378 <varlistentry>
60379 <term><varname>$mime_content_id</varname></term>
60380 <listitem>
60381 <para>
60382 This variable contains the normalized content of the <emphasis>Content-ID:</emphasis> header.
60383 This is a unique ID that can be used to reference a part from another part.
60384 </para>
60385 </listitem></varlistentry>
60386 <varlistentry>
60387 <term><varname>$mime_content_size</varname></term>
60388 <listitem>
60389 <para>
60390 This variable is set only after the <option>decode</option> modifier (see above) has been
60391 successfully run. It contains the size of the decoded part in kilobytes. The
60392 size is always rounded up to full kilobytes, so only a completely empty part
60393 has a <varname>$mime_content_size</varname> of zero.
60394 </para>
60395 </listitem></varlistentry>
60396 <varlistentry>
60397 <term><varname>$mime_content_transfer_encoding</varname></term>
60398 <listitem>
60399 <para>
60400 This variable contains the normalized content of the
60401 <emphasis>Content-transfer-encoding:</emphasis> header. This is a symbolic name for an encoding
60402 type. Typical values are <quote>base64</quote> and <quote>quoted-printable</quote>.
60403 </para>
60404 </listitem></varlistentry>
60405 <varlistentry>
60406 <term><varname>$mime_content_type</varname></term>
60407 <listitem>
60408 <para>
60409 If the MIME part has a <emphasis>Content-Type:</emphasis> header, this variable contains its
60410 value, lowercased, and without any options (like <quote>name</quote> or <quote>charset</quote>). Here
60411 are some examples of popular MIME types, as they may appear in this variable:
60412 </para>
60413 <literallayout class="monospaced">
60414 text/plain
60415 text/html
60416 application/octet-stream
60417 image/jpeg
60418 audio/midi
60419 </literallayout>
60420 <para>
60421 If the MIME part has no <emphasis>Content-Type:</emphasis> header, this variable contains the
60422 empty string.
60423 </para>
60424 </listitem></varlistentry>
60425 <varlistentry>
60426 <term><varname>$mime_decoded_filename</varname></term>
60427 <listitem>
60428 <para>
60429 This variable is set only after the <option>decode</option> modifier (see above) has been
60430 successfully run. It contains the full path and file name of the file
60431 containing the decoded data.
60432 </para>
60433 </listitem></varlistentry>
60434 </variablelist>
60435 <para>
60436 <indexterm role="concept">
60437 <primary>RFC 2047</primary>
60438 </indexterm>
60439 </para>
60440 <variablelist>
60441 <varlistentry>
60442 <term><varname>$mime_filename</varname></term>
60443 <listitem>
60444 <para>
60445 This is perhaps the most important of the MIME variables. It contains a
60446 proposed filename for an attachment, if one was found in either the
60447 <emphasis>Content-Type:</emphasis> or <emphasis>Content-Disposition:</emphasis> headers. The filename will be
60448 RFC2047
60449 or RFC2231
60450 decoded, but no additional sanity checks are done.
60451  If no filename was
60452 found, this variable contains the empty string.
60453 </para>
60454 </listitem></varlistentry>
60455 <varlistentry>
60456 <term><varname>$mime_is_coverletter</varname></term>
60457 <listitem>
60458 <para>
60459 This variable attempts to differentiate the <quote>cover letter</quote> of an e-mail from
60460 attached data. It can be used to clamp down on flashy or unnecessarily encoded
60461 content in the cover letter, while not restricting attachments at all.
60462 </para>
60463 <para>
60464 The variable contains 1 (true) for a MIME part believed to be part of the
60465 cover letter, and 0 (false) for an attachment. At present, the algorithm is as
60466 follows:
60467 </para>
60468 <orderedlist numeration="arabic">
60469 <listitem>
60470 <para>
60471 The outermost MIME part of a message is always a cover letter.
60472 </para>
60473 </listitem>
60474 <listitem>
60475 <para>
60476 If a multipart/alternative or multipart/related MIME part is a cover letter,
60477 so are all MIME subparts within that multipart.
60478 </para>
60479 </listitem>
60480 <listitem>
60481 <para>
60482 If any other multipart is a cover letter, the first subpart is a cover letter,
60483 and the rest are attachments.
60484 </para>
60485 </listitem>
60486 <listitem>
60487 <para>
60488 All parts contained within an attachment multipart are attachments.
60489 </para>
60490 </listitem>
60491 </orderedlist>
60492 <para>
60493 As an example, the following will ban <quote>HTML mail</quote> (including that sent with
60494 alternative plain text), while allowing HTML files to be attached. HTML
60495 coverletter mail attached to non-HMTL coverletter mail will also be allowed:
60496 </para>
60497 <literallayout class="monospaced">
60498 deny message = HTML mail is not accepted here
60499 !condition = $mime_is_rfc822
60500 condition = $mime_is_coverletter
60501 condition = ${if eq{$mime_content_type}{text/html}{1}{0}}
60502 </literallayout>
60503 </listitem></varlistentry>
60504 <varlistentry>
60505 <term><varname>$mime_is_multipart</varname></term>
60506 <listitem>
60507 <para>
60508 This variable has the value 1 (true) when the current part has the main type
60509 <quote>multipart</quote>, for example <quote>multipart/alternative</quote> or <quote>multipart/mixed</quote>.
60510 Since multipart entities only serve as containers for other parts, you may not
60511 want to carry out specific actions on them.
60512 </para>
60513 </listitem></varlistentry>
60514 <varlistentry>
60515 <term><varname>$mime_is_rfc822</varname></term>
60516 <listitem>
60517 <para>
60518 This variable has the value 1 (true) if the current part is not a part of the
60519 checked message itself, but part of an attached message. Attached message
60520 decoding is fully recursive.
60521 </para>
60522 </listitem></varlistentry>
60523 <varlistentry>
60524 <term><varname>$mime_part_count</varname></term>
60525 <listitem>
60526 <para>
60527 This variable is a counter that is raised for each processed MIME part. It
60528 starts at zero for the very first part (which is usually a multipart). The
60529 counter is per-message, so it is reset when processing RFC822 attachments (see
60530 <varname>$mime_is_rfc822</varname>). The counter stays set after <option>acl_smtp_mime</option> is
60531 complete, so you can use it in the DATA ACL to determine the number of MIME
60532 parts of a message. For non-MIME messages, this variable contains the value -1.
60533 </para>
60534 </listitem></varlistentry>
60535 </variablelist>
60536 </section>
60537 <section id="SECTscanregex">
60538 <title>Scanning with regular expressions</title>
60539 <para>
60540 <indexterm role="concept">
60541 <primary>content scanning</primary>
60542 <secondary>with regular expressions</secondary>
60543 </indexterm>
60544 <indexterm role="concept">
60545 <primary>regular expressions</primary>
60546 <secondary>content scanning with</secondary>
60547 </indexterm>
60548 You can specify your own custom regular expression matches on the full body of
60549 the message, or on individual MIME parts.
60550 </para>
60551 <para>
60552 The <option>regex</option> condition takes one or more regular expressions as arguments and
60553 matches them against the full message (when called in the DATA ACL) or a raw
60554 MIME part (when called in the MIME ACL). The <option>regex</option> condition matches
60555 linewise, with a maximum line length of 32K characters. That means you cannot
60556 have multiline matches with the <option>regex</option> condition.
60557 </para>
60558 <para>
60559 The <option>mime_regex</option> condition can be called only in the MIME ACL. It matches up
60560 to 32K of decoded content (the whole content at once, not linewise). If the
60561 part has not been decoded with the <option>decode</option> modifier earlier in the ACL, it
60562 is decoded automatically when <option>mime_regex</option> is executed (using default path
60563 and filename values). If the decoded data is larger than  32K, only the first
60564 32K characters are checked.
60565 </para>
60566 <para>
60567 The regular expressions are passed as a colon-separated list. To include a
60568 literal colon, you must double it. Since the whole right-hand side string is
60569 expanded before being used, you must also escape dollar signs and backslashes
60570 with more backslashes, or use the <literal>\N</literal> facility to disable expansion.
60571 Here is a simple example that contains two regular expressions:
60572 </para>
60573 <literallayout class="monospaced">
60574 deny message = contains blacklisted regex ($regex_match_string)
60575      regex = [Mm]ortgage : URGENT BUSINESS PROPOSAL
60576 </literallayout>
60577 <para>
60578 The conditions returns true if any one of the regular expressions matches. The
60579 <varname>$regex_match_string</varname> expansion variable is then set up and contains the
60580 matching regular expression.
60581 The expansion variables <varname>$regex1</varname> <varname>$regex2</varname> etc
60582 are set to any substrings captured by the regular expression.
60583 </para>
60584 <para>
60585 <emphasis role="bold">Warning</emphasis>: With large messages, these conditions can be fairly
60586 CPU-intensive.
60587 </para>
60588 <para>
60589 <indexterm role="concept" startref="IIDcosca" class="endofrange"/>
60590 </para>
60591 </section>
60592 </chapter>
60593
60594 <chapter id="CHAPlocalscan">
60595 <title>Adding a local scan function to Exim</title>
60596 <titleabbrev>Local scan function</titleabbrev>
60597 <para>
60598 <indexterm role="concept" id="IIDlosca" class="startofrange">
60599 <primary><function>local_scan()</function> function</primary>
60600 <secondary>description of</secondary>
60601 </indexterm>
60602 <indexterm role="concept">
60603 <primary>customizing</primary>
60604 <secondary>input scan using C function</secondary>
60605 </indexterm>
60606 <indexterm role="concept">
60607 <primary>policy control</primary>
60608 <secondary>by local scan function</secondary>
60609 </indexterm>
60610 In these days of email worms, viruses, and ever-increasing spam, some sites
60611 want to apply a lot of checking to messages before accepting them.
60612 </para>
60613 <para>
60614 The content scanning extension (chapter <xref linkend="CHAPexiscan"/>) has facilities for
60615 passing messages to external virus and spam scanning software. You can also do
60616 a certain amount in Exim itself through string expansions and the <option>condition</option>
60617 condition in the ACL that runs after the SMTP DATA command or the ACL for
60618 non-SMTP messages (see chapter <xref linkend="CHAPACL"/>), but this has its limitations.
60619 </para>
60620 <para>
60621 To allow for further customization to a site&#x2019;s own requirements, there is the
60622 possibility of linking Exim with a private message scanning function, written
60623 in C. If you want to run code that is written in something other than C, you
60624 can of course use a little C stub to call it.
60625 </para>
60626 <para>
60627 The local scan function is run once for every incoming message, at the point
60628 when Exim is just about to accept the message.
60629 It can therefore be used to control non-SMTP messages from local processes as
60630 well as messages arriving via SMTP.
60631 </para>
60632 <para>
60633 Exim applies a timeout to calls of the local scan function, and there is an
60634 option called <option>local_scan_timeout</option> for setting it. The default is 5 minutes.
60635 Zero means <quote>no timeout</quote>.
60636 Exim also sets up signal handlers for SIGSEGV, SIGILL, SIGFPE, and SIGBUS
60637 before calling the local scan function, so that the most common types of crash
60638 are caught. If the timeout is exceeded or one of those signals is caught, the
60639 incoming message is rejected with a temporary error if it is an SMTP message.
60640 For a non-SMTP message, the message is dropped and Exim ends with a non-zero
60641 code. The incident is logged on the main and reject logs.
60642 </para>
60643 <section id="SECID207">
60644 <title>Building Exim to use a local scan function</title>
60645 <para>
60646 <indexterm role="concept">
60647 <primary><function>local_scan()</function> function</primary>
60648 <secondary>building Exim to use</secondary>
60649 </indexterm>
60650 To make use of the local scan function feature, you must tell Exim where your
60651 function is before building Exim, by setting LOCAL_SCAN_SOURCE in your
60652 <filename>Local/Makefile</filename>. A recommended place to put it is in the <filename>Local</filename>
60653 directory, so you might set
60654 </para>
60655 <literallayout class="monospaced">
60656 LOCAL_SCAN_SOURCE=Local/local_scan.c
60657 </literallayout>
60658 <para>
60659 for example. The function must be called <function>local_scan()</function>. It is called by
60660 Exim after it has received a message, when the success return code is about to
60661 be sent. This is after all the ACLs have been run. The return code from your
60662 function controls whether the message is actually accepted or not. There is a
60663 commented template function (that just accepts the message) in the file
60664 _src/local_scan.c_.
60665 </para>
60666 <para>
60667 If you want to make use of Exim&#x2019;s run time configuration file to set options
60668 for your <function>local_scan()</function> function, you must also set
60669 </para>
60670 <literallayout class="monospaced">
60671 LOCAL_SCAN_HAS_OPTIONS=yes
60672 </literallayout>
60673 <para>
60674 in <filename>Local/Makefile</filename> (see section <xref linkend="SECTconoptloc"/> below).
60675 </para>
60676 </section>
60677 <section id="SECTapiforloc">
60678 <title>API for local_scan()</title>
60679 <para>
60680 <indexterm role="concept">
60681 <primary><function>local_scan()</function> function</primary>
60682 <secondary>API description</secondary>
60683 </indexterm>
60684 You must include this line near the start of your code:
60685 </para>
60686 <literallayout class="monospaced">
60687 #include "local_scan.h"
60688 </literallayout>
60689 <para>
60690 This header file defines a number of variables and other values, and the
60691 prototype for the function itself. Exim is coded to use unsigned char values
60692 almost exclusively, and one of the things this header defines is a shorthand
60693 for <literal>unsigned char</literal> called <literal>uschar</literal>.
60694 It also contains the following macro definitions, to simplify casting character
60695 strings and pointers to character strings:
60696 </para>
60697 <literallayout class="monospaced">
60698 #define CS   (char *)
60699 #define CCS  (const char *)
60700 #define CSS  (char **)
60701 #define US   (unsigned char *)
60702 #define CUS  (const unsigned char *)
60703 #define USS  (unsigned char **)
60704 </literallayout>
60705 <para>
60706 The function prototype for <function>local_scan()</function> is:
60707 </para>
60708 <literallayout class="monospaced">
60709 extern int local_scan(int fd, uschar **return_text);
60710 </literallayout>
60711 <para>
60712 The arguments are as follows:
60713 </para>
60714 <itemizedlist>
60715 <listitem>
60716 <para>
60717 <option>fd</option> is a file descriptor for the file that contains the body of the message
60718 (the -D file). The file is open for reading and writing, but updating it is not
60719 recommended. <emphasis role="bold">Warning</emphasis>: You must <emphasis>not</emphasis> close this file descriptor.
60720 </para>
60721 <para>
60722 The descriptor is positioned at character 19 of the file, which is the first
60723 character of the body itself, because the first 19 characters are the message
60724 id followed by <literal>-D</literal> and a newline. If you rewind the file, you should use the
60725 macro SPOOL_DATA_START_OFFSET to reset to the start of the data, just in
60726 case this changes in some future version.
60727 </para>
60728 </listitem>
60729 <listitem>
60730 <para>
60731 <option>return_text</option> is an address which you can use to return a pointer to a text
60732 string at the end of the function. The value it points to on entry is NULL.
60733 </para>
60734 </listitem>
60735 </itemizedlist>
60736 <para>
60737 The function must return an <option>int</option> value which is one of the following macros:
60738 </para>
60739 <variablelist>
60740 <varlistentry>
60741 <term><literal>LOCAL_SCAN_ACCEPT</literal></term>
60742 <listitem>
60743 <para>
60744 <indexterm role="variable">
60745 <primary><varname>$local_scan_data</varname></primary>
60746 </indexterm>
60747 The message is accepted. If you pass back a string of text, it is saved with
60748 the message, and made available in the variable <varname>$local_scan_data</varname>. No
60749 newlines are permitted (if there are any, they are turned into spaces) and the
60750 maximum length of text is 1000 characters.
60751 </para>
60752 </listitem></varlistentry>
60753 <varlistentry>
60754 <term><literal>LOCAL_SCAN_ACCEPT_FREEZE</literal></term>
60755 <listitem>
60756 <para>
60757 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
60758 queued without immediate delivery, and is frozen.
60759 </para>
60760 </listitem></varlistentry>
60761 <varlistentry>
60762 <term><literal>LOCAL_SCAN_ACCEPT_QUEUE</literal></term>
60763 <listitem>
60764 <para>
60765 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
60766 queued without immediate delivery.
60767 </para>
60768 </listitem></varlistentry>
60769 <varlistentry>
60770 <term><literal>LOCAL_SCAN_REJECT</literal></term>
60771 <listitem>
60772 <para>
60773 The message is rejected; the returned text is used as an error message which is
60774 passed back to the sender and which is also logged. Newlines are permitted &ndash;
60775 they cause a multiline response for SMTP rejections, but are converted to
60776 <literal>\n</literal> in log lines. If no message is given, <quote>Administrative prohibition</quote> is
60777 used.
60778 </para>
60779 </listitem></varlistentry>
60780 <varlistentry>
60781 <term><literal>LOCAL_SCAN_TEMPREJECT</literal></term>
60782 <listitem>
60783 <para>
60784 The message is temporarily rejected; the returned text is used as an error
60785 message as for LOCAL_SCAN_REJECT. If no message is given, <quote>Temporary local
60786 problem</quote> is used.
60787 </para>
60788 </listitem></varlistentry>
60789 <varlistentry>
60790 <term><literal>LOCAL_SCAN_REJECT_NOLOGHDR</literal></term>
60791 <listitem>
60792 <para>
60793 This behaves as LOCAL_SCAN_REJECT, except that the header of the rejected
60794 message is not written to the reject log. It has the effect of unsetting the
60795 <option>rejected_header</option> log selector for just this rejection. If
60796 <option>rejected_header</option> is already unset (see the discussion of the
60797 <option>log_selection</option> option in section <xref linkend="SECTlogselector"/>), this code is the
60798 same as LOCAL_SCAN_REJECT.
60799 </para>
60800 </listitem></varlistentry>
60801 <varlistentry>
60802 <term><literal>LOCAL_SCAN_TEMPREJECT_NOLOGHDR</literal></term>
60803 <listitem>
60804 <para>
60805 This code is a variation of LOCAL_SCAN_TEMPREJECT in the same way that
60806 LOCAL_SCAN_REJECT_NOLOGHDR is a variation of LOCAL_SCAN_REJECT.
60807 </para>
60808 </listitem></varlistentry>
60809 </variablelist>
60810 <para>
60811 If the message is not being received by interactive SMTP, rejections are
60812 reported by writing to <option>stderr</option> or by sending an email, as configured by the
60813 <option>-oe</option> command line options.
60814 </para>
60815 </section>
60816 <section id="SECTconoptloc">
60817 <title>Configuration options for local_scan()</title>
60818 <para>
60819 <indexterm role="concept">
60820 <primary><function>local_scan()</function> function</primary>
60821 <secondary>configuration options</secondary>
60822 </indexterm>
60823 It is possible to have option settings in the main configuration file
60824 that set values in static variables in the <function>local_scan()</function> module. If you
60825 want to do this, you must have the line
60826 </para>
60827 <literallayout class="monospaced">
60828 LOCAL_SCAN_HAS_OPTIONS=yes
60829 </literallayout>
60830 <para>
60831 in your <filename>Local/Makefile</filename> when you build Exim. (This line is in
60832 <filename>OS/Makefile-Default</filename>, commented out). Then, in the <function>local_scan()</function> source
60833 file, you must define static variables to hold the option values, and a table
60834 to define them.
60835 </para>
60836 <para>
60837 The table must be a vector called <option>local_scan_options</option>, of type
60838 <literal>optionlist</literal>. Each entry is a triplet, consisting of a name, an option type,
60839 and a pointer to the variable that holds the value. The entries must appear in
60840 alphabetical order. Following <option>local_scan_options</option> you must also define a
60841 variable called <option>local_scan_options_count</option> that contains the number of
60842 entries in the table. Here is a short example, showing two kinds of option:
60843 </para>
60844 <literallayout class="monospaced">
60845 static int my_integer_option = 42;
60846 static uschar *my_string_option = US"a default string";
60847
60848 optionlist local_scan_options[] = {
60849   { "my_integer", opt_int,       &amp;my_integer_option },
60850   { "my_string",  opt_stringptr, &amp;my_string_option }
60851 };
60852
60853 int local_scan_options_count =
60854   sizeof(local_scan_options)/sizeof(optionlist);
60855 </literallayout>
60856 <para>
60857 The values of the variables can now be changed from Exim&#x2019;s runtime
60858 configuration file by including a local scan section as in this example:
60859 </para>
60860 <literallayout class="monospaced">
60861 begin local_scan
60862 my_integer = 99
60863 my_string = some string of text...
60864 </literallayout>
60865 <para>
60866 The available types of option data are as follows:
60867 </para>
60868 <variablelist>
60869 <varlistentry>
60870 <term><emphasis role="bold">opt_bool</emphasis></term>
60871 <listitem>
60872 <para>
60873 This specifies a boolean (true/false) option. The address should point to a
60874 variable of type <literal>BOOL</literal>, which will be set to TRUE or FALSE, which are macros
60875 that are defined as <quote>1</quote> and <quote>0</quote>, respectively. If you want to detect
60876 whether such a variable has been set at all, you can initialize it to
60877 TRUE_UNSET. (BOOL variables are integers underneath, so can hold more than two
60878 values.)
60879 </para>
60880 </listitem></varlistentry>
60881 <varlistentry>
60882 <term><emphasis role="bold">opt_fixed</emphasis></term>
60883 <listitem>
60884 <para>
60885 This specifies a fixed point number, such as is used for load averages.
60886 The address should point to a variable of type <literal>int</literal>. The value is stored
60887 multiplied by 1000, so, for example, 1.4142 is truncated and stored as 1414.
60888 </para>
60889 </listitem></varlistentry>
60890 <varlistentry>
60891 <term><emphasis role="bold">opt_int</emphasis></term>
60892 <listitem>
60893 <para>
60894 This specifies an integer; the address should point to a variable of type
60895 <literal>int</literal>. The value may be specified in any of the integer formats accepted by
60896 Exim.
60897 </para>
60898 </listitem></varlistentry>
60899 <varlistentry>
60900 <term><emphasis role="bold">opt_mkint</emphasis></term>
60901 <listitem>
60902 <para>
60903 This is the same as <option>opt_int</option>, except that when such a value is output in a
60904 <option>-bP</option> listing, if it is an exact number of kilobytes or megabytes, it is
60905 printed with the suffix K or M.
60906 </para>
60907 </listitem></varlistentry>
60908 <varlistentry>
60909 <term><emphasis role="bold">opt_octint</emphasis></term>
60910 <listitem>
60911 <para>
60912 This also specifies an integer, but the value is always interpreted as an
60913 octal integer, whether or not it starts with the digit zero, and it is
60914 always output in octal.
60915 </para>
60916 </listitem></varlistentry>
60917 <varlistentry>
60918 <term><emphasis role="bold">opt_stringptr</emphasis></term>
60919 <listitem>
60920 <para>
60921 This specifies a string value; the address must be a pointer to a
60922 variable that points to a string (for example, of type <literal>uschar *</literal>).
60923 </para>
60924 </listitem></varlistentry>
60925 <varlistentry>
60926 <term><emphasis role="bold">opt_time</emphasis></term>
60927 <listitem>
60928 <para>
60929 This specifies a time interval value. The address must point to a variable of
60930 type <literal>int</literal>. The value that is placed there is a number of seconds.
60931 </para>
60932 </listitem></varlistentry>
60933 </variablelist>
60934 <para>
60935 If the <option>-bP</option> command line option is followed by <literal>local_scan</literal>, Exim prints
60936 out the values of all the <function>local_scan()</function> options.
60937 </para>
60938 </section>
60939 <section id="SECID208">
60940 <title>Available Exim variables</title>
60941 <para>
60942 <indexterm role="concept">
60943 <primary><function>local_scan()</function> function</primary>
60944 <secondary>available Exim variables</secondary>
60945 </indexterm>
60946 The header <filename>local_scan.h</filename> gives you access to a number of C variables. These
60947 are the only ones that are guaranteed to be maintained from release to release.
60948 Note, however, that you can obtain the value of any Exim expansion variable,
60949 including <varname>$recipients</varname>, by calling <emphasis>expand_string()</emphasis>. The exported
60950 C variables are as follows:
60951 </para>
60952 <variablelist>
60953 <varlistentry>
60954 <term><emphasis role="bold">int&nbsp;body_linecount</emphasis></term>
60955 <listitem>
60956 <para>
60957 This variable contains the number of lines in the message&#x2019;s body.
60958 </para>
60959 <para revisionflag="changed">
60960 It is not valid if the <option>spool_files_wireformat</option> option is used.
60961 </para>
60962 </listitem></varlistentry>
60963 <varlistentry>
60964 <term><emphasis role="bold">int&nbsp;body_zerocount</emphasis></term>
60965 <listitem>
60966 <para>
60967 This variable contains the number of binary zero bytes in the message&#x2019;s body.
60968 </para>
60969 <para revisionflag="changed">
60970 It is not valid if the <option>spool_files_wireformat</option> option is used.
60971 </para>
60972 </listitem></varlistentry>
60973 <varlistentry>
60974 <term><emphasis role="bold">unsigned&nbsp;int&nbsp;debug_selector</emphasis></term>
60975 <listitem>
60976 <para>
60977 This variable is set to zero when no debugging is taking place. Otherwise, it
60978 is a bitmap of debugging selectors. Two bits are identified for use in
60979 <function>local_scan()</function>; they are defined as macros:
60980 </para>
60981 <itemizedlist>
60982 <listitem>
60983 <para>
60984 The <literal>D_v</literal> bit is set when <option>-v</option> was present on the command line. This is a
60985 testing option that is not privileged &ndash; any caller may set it. All the
60986 other selector bits can be set only by admin users.
60987 </para>
60988 </listitem>
60989 <listitem>
60990 <para>
60991 The <literal>D_local_scan</literal> bit is provided for use by <function>local_scan()</function>; it is set
60992 by the <literal>+local_scan</literal> debug selector. It is not included in the default set
60993 of debugging bits.
60994 </para>
60995 </listitem>
60996 </itemizedlist>
60997 <para>
60998 Thus, to write to the debugging output only when <literal>+local_scan</literal> has been
60999 selected, you should use code like this:
61000 </para>
61001 <literallayout class="monospaced">
61002 if ((debug_selector &amp; D_local_scan) != 0)
61003   debug_printf("xxx", ...);
61004 </literallayout>
61005 </listitem></varlistentry>
61006 <varlistentry>
61007 <term><emphasis role="bold">uschar&nbsp;*expand_string_message</emphasis></term>
61008 <listitem>
61009 <para>
61010 After a failing call to <emphasis>expand_string()</emphasis> (returned value NULL), the
61011 variable <option>expand_string_message</option> contains the error message, zero-terminated.
61012 </para>
61013 </listitem></varlistentry>
61014 <varlistentry>
61015 <term><emphasis role="bold">header_line&nbsp;*header_list</emphasis></term>
61016 <listitem>
61017 <para>
61018 A pointer to a chain of header lines. The <option>header_line</option> structure is
61019 discussed below.
61020 </para>
61021 </listitem></varlistentry>
61022 <varlistentry>
61023 <term><emphasis role="bold">header_line&nbsp;*header_last</emphasis></term>
61024 <listitem>
61025 <para>
61026 A pointer to the last of the header lines.
61027 </para>
61028 </listitem></varlistentry>
61029 <varlistentry>
61030 <term><emphasis role="bold">uschar&nbsp;*headers_charset</emphasis></term>
61031 <listitem>
61032 <para>
61033 The value of the <option>headers_charset</option> configuration option.
61034 </para>
61035 </listitem></varlistentry>
61036 <varlistentry>
61037 <term><emphasis role="bold">BOOL&nbsp;host_checking</emphasis></term>
61038 <listitem>
61039 <para>
61040 This variable is TRUE during a host checking session that is initiated by the
61041 <option>-bh</option> command line option.
61042 </para>
61043 </listitem></varlistentry>
61044 <varlistentry>
61045 <term><emphasis role="bold">uschar&nbsp;*interface_address</emphasis></term>
61046 <listitem>
61047 <para>
61048 The IP address of the interface that received the message, as a string. This
61049 is NULL for locally submitted messages.
61050 </para>
61051 </listitem></varlistentry>
61052 <varlistentry>
61053 <term><emphasis role="bold">int&nbsp;interface_port</emphasis></term>
61054 <listitem>
61055 <para>
61056 The port on which this message was received. When testing with the <option>-bh</option>
61057 command line option, the value of this variable is -1 unless a port has been
61058 specified via the <option>-oMi</option> option.
61059 </para>
61060 </listitem></varlistentry>
61061 <varlistentry>
61062 <term><emphasis role="bold">uschar&nbsp;*message_id</emphasis></term>
61063 <listitem>
61064 <para>
61065 This variable contains Exim&#x2019;s message id for the incoming message (the value of
61066 <varname>$message_exim_id</varname>) as a zero-terminated string.
61067 </para>
61068 </listitem></varlistentry>
61069 <varlistentry>
61070 <term><emphasis role="bold">uschar&nbsp;*received_protocol</emphasis></term>
61071 <listitem>
61072 <para>
61073 The name of the protocol by which the message was received.
61074 </para>
61075 </listitem></varlistentry>
61076 <varlistentry>
61077 <term><emphasis role="bold">int&nbsp;recipients_count</emphasis></term>
61078 <listitem>
61079 <para>
61080 The number of accepted recipients.
61081 </para>
61082 </listitem></varlistentry>
61083 <varlistentry>
61084 <term><emphasis role="bold">recipient_item&nbsp;*recipients_list</emphasis></term>
61085 <listitem>
61086 <para>
61087 <indexterm role="concept">
61088 <primary>recipient</primary>
61089 <secondary>adding in local scan</secondary>
61090 </indexterm>
61091 <indexterm role="concept">
61092 <primary>recipient</primary>
61093 <secondary>removing in local scan</secondary>
61094 </indexterm>
61095 The list of accepted recipients, held in a vector of length
61096 <option>recipients_count</option>. The <option>recipient_item</option> structure is discussed below. You
61097 can add additional recipients by calling <emphasis>receive_add_recipient()</emphasis> (see
61098 below). You can delete recipients by removing them from the vector and
61099 adjusting the value in <option>recipients_count</option>. In particular, by setting
61100 <option>recipients_count</option> to zero you remove all recipients. If you then return the
61101 value <literal>LOCAL_SCAN_ACCEPT</literal>, the message is accepted, but immediately
61102 blackholed. To replace the recipients, you can set <option>recipients_count</option> to zero
61103 and then call <emphasis>receive_add_recipient()</emphasis> as often as needed.
61104 </para>
61105 </listitem></varlistentry>
61106 <varlistentry>
61107 <term><emphasis role="bold">uschar&nbsp;*sender_address</emphasis></term>
61108 <listitem>
61109 <para>
61110 The envelope sender address. For bounce messages this is the empty string.
61111 </para>
61112 </listitem></varlistentry>
61113 <varlistentry>
61114 <term><emphasis role="bold">uschar&nbsp;*sender_host_address</emphasis></term>
61115 <listitem>
61116 <para>
61117 The IP address of the sending host, as a string. This is NULL for
61118 locally-submitted messages.
61119 </para>
61120 </listitem></varlistentry>
61121 <varlistentry>
61122 <term><emphasis role="bold">uschar&nbsp;*sender_host_authenticated</emphasis></term>
61123 <listitem>
61124 <para>
61125 The name of the authentication mechanism that was used, or NULL if the message
61126 was not received over an authenticated SMTP connection.
61127 </para>
61128 </listitem></varlistentry>
61129 <varlistentry>
61130 <term><emphasis role="bold">uschar&nbsp;*sender_host_name</emphasis></term>
61131 <listitem>
61132 <para>
61133 The name of the sending host, if known.
61134 </para>
61135 </listitem></varlistentry>
61136 <varlistentry>
61137 <term><emphasis role="bold">int&nbsp;sender_host_port</emphasis></term>
61138 <listitem>
61139 <para>
61140 The port on the sending host.
61141 </para>
61142 </listitem></varlistentry>
61143 <varlistentry>
61144 <term><emphasis role="bold">BOOL&nbsp;smtp_input</emphasis></term>
61145 <listitem>
61146 <para>
61147 This variable is TRUE for all SMTP input, including BSMTP.
61148 </para>
61149 </listitem></varlistentry>
61150 <varlistentry>
61151 <term><emphasis role="bold">BOOL&nbsp;smtp_batched_input</emphasis></term>
61152 <listitem>
61153 <para>
61154 This variable is TRUE for BSMTP input.
61155 </para>
61156 </listitem></varlistentry>
61157 <varlistentry>
61158 <term><emphasis role="bold">int&nbsp;store_pool</emphasis></term>
61159 <listitem>
61160 <para>
61161 The contents of this variable control which pool of memory is used for new
61162 requests. See section <xref linkend="SECTmemhanloc"/> for details.
61163 </para>
61164 </listitem></varlistentry>
61165 </variablelist>
61166 </section>
61167 <section id="SECID209">
61168 <title>Structure of header lines</title>
61169 <para>
61170 The <option>header_line</option> structure contains the members listed below.
61171 You can add additional header lines by calling the <emphasis>header_add()</emphasis> function
61172 (see below). You can cause header lines to be ignored (deleted) by setting
61173 their type to *.
61174 </para>
61175 <variablelist>
61176 <varlistentry>
61177 <term><emphasis role="bold">struct&nbsp;header_line&nbsp;*next</emphasis></term>
61178 <listitem>
61179 <para>
61180 A pointer to the next header line, or NULL for the last line.
61181 </para>
61182 </listitem></varlistentry>
61183 <varlistentry>
61184 <term><emphasis role="bold">int&nbsp;type</emphasis></term>
61185 <listitem>
61186 <para>
61187 A code identifying certain headers that Exim recognizes. The codes are printing
61188 characters, and are documented in chapter <xref linkend="CHAPspool"/> of this manual.
61189 Notice in particular that any header line whose type is * is not transmitted
61190 with the message. This flagging is used for header lines that have been
61191 rewritten, or are to be removed (for example, <emphasis>Envelope-sender:</emphasis> header
61192 lines.) Effectively, * means <quote>deleted</quote>.
61193 </para>
61194 </listitem></varlistentry>
61195 <varlistentry>
61196 <term><emphasis role="bold">int&nbsp;slen</emphasis></term>
61197 <listitem>
61198 <para>
61199 The number of characters in the header line, including the terminating and any
61200 internal newlines.
61201 </para>
61202 </listitem></varlistentry>
61203 <varlistentry>
61204 <term><emphasis role="bold">uschar&nbsp;*text</emphasis></term>
61205 <listitem>
61206 <para>
61207 A pointer to the text of the header. It always ends with a newline, followed by
61208 a zero byte. Internal newlines are preserved.
61209 </para>
61210 </listitem></varlistentry>
61211 </variablelist>
61212 </section>
61213 <section id="SECID210">
61214 <title>Structure of recipient items</title>
61215 <para>
61216 The <option>recipient_item</option> structure contains these members:
61217 </para>
61218 <variablelist>
61219 <varlistentry>
61220 <term><emphasis role="bold">uschar&nbsp;*address</emphasis></term>
61221 <listitem>
61222 <para>
61223 This is a pointer to the recipient address as it was received.
61224 </para>
61225 </listitem></varlistentry>
61226 <varlistentry>
61227 <term><emphasis role="bold">int&nbsp;pno</emphasis></term>
61228 <listitem>
61229 <para>
61230 This is used in later Exim processing when top level addresses are created by
61231 the <option>one_time</option> option. It is not relevant at the time <function>local_scan()</function> is run
61232 and must always contain -1 at this stage.
61233 </para>
61234 </listitem></varlistentry>
61235 <varlistentry>
61236 <term><emphasis role="bold">uschar&nbsp;*errors_to</emphasis></term>
61237 <listitem>
61238 <para>
61239 If this value is not NULL, bounce messages caused by failing to deliver to the
61240 recipient are sent to the address it contains. In other words, it overrides the
61241 envelope sender for this one recipient. (Compare the <option>errors_to</option> generic
61242 router option.) If a <function>local_scan()</function> function sets an <option>errors_to</option> field to
61243 an unqualified address, Exim qualifies it using the domain from
61244 <option>qualify_recipient</option>. When <function>local_scan()</function> is called, the <option>errors_to</option> field
61245 is NULL for all recipients.
61246 </para>
61247 </listitem></varlistentry>
61248 </variablelist>
61249 </section>
61250 <section id="SECID211">
61251 <title>Available Exim functions</title>
61252 <para>
61253 <indexterm role="concept">
61254 <primary><function>local_scan()</function> function</primary>
61255 <secondary>available Exim functions</secondary>
61256 </indexterm>
61257 The header <filename>local_scan.h</filename> gives you access to a number of Exim functions.
61258 These are the only ones that are guaranteed to be maintained from release to
61259 release:
61260 </para>
61261 <variablelist>
61262 <varlistentry>
61263 <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>
61264 <listitem>
61265 <para>
61266 This function creates a child process that runs the command specified by
61267 <option>argv</option>. The environment for the process is specified by <option>envp</option>, which can
61268 be NULL if no environment variables are to be passed. A new umask is supplied
61269 for the process in <option>newumask</option>.
61270 </para>
61271 <para>
61272 Pipes to the standard input and output of the new process are set up
61273 and returned to the caller via the <option>infdptr</option> and <option>outfdptr</option> arguments. The
61274 standard error is cloned to the standard output. If there are any file
61275 descriptors <quote>in the way</quote> in the new process, they are closed. If the final
61276 argument is TRUE, the new process is made into a process group leader.
61277 </para>
61278 <para>
61279 The function returns the pid of the new process, or -1 if things go wrong.
61280 </para>
61281 </listitem></varlistentry>
61282 <varlistentry>
61283 <term><emphasis role="bold">int&nbsp;child_close(pid_t&nbsp;pid,&nbsp;int&nbsp;timeout)</emphasis></term>
61284 <listitem>
61285 <para>
61286 This function waits for a child process to terminate, or for a timeout (in
61287 seconds) to expire. A timeout value of zero means wait as long as it takes. The
61288 return value is as follows:
61289 </para>
61290 <itemizedlist>
61291 <listitem>
61292 <para>
61293 &gt;= 0
61294 </para>
61295 <para>
61296 The process terminated by a normal exit and the value is the process
61297 ending status.
61298 </para>
61299 </listitem>
61300 <listitem>
61301 <para>
61302 &lt; 0 and &gt; &ndash;256
61303 </para>
61304 <para>
61305 The process was terminated by a signal and the value is the negation of the
61306 signal number.
61307 </para>
61308 </listitem>
61309 <listitem>
61310 <para>
61311 &ndash;256
61312 </para>
61313 <para>
61314 The process timed out.
61315 </para>
61316 </listitem>
61317 <listitem>
61318 <para>
61319 &ndash;257
61320 </para>
61321 <para>
61322 The was some other error in wait(); <option>errno</option> is still set.
61323 </para>
61324 </listitem>
61325 </itemizedlist>
61326 </listitem></varlistentry>
61327 <varlistentry>
61328 <term><emphasis role="bold">pid_t&nbsp;child_open_exim(int&nbsp;*fd)</emphasis></term>
61329 <listitem>
61330 <para>
61331 This function provide you with a means of submitting a new message to
61332 Exim. (Of course, you can also call <filename>/usr/sbin/sendmail</filename> yourself if you
61333 want, but this packages it all up for you.) The function creates a pipe,
61334 forks a subprocess that is running
61335 </para>
61336 <literallayout class="monospaced">
61337 exim -t -oem -oi -f &lt;&gt;
61338 </literallayout>
61339 <para>
61340 and returns to you (via the <literal>int *</literal> argument) a file descriptor for the pipe
61341 that is connected to the standard input. The yield of the function is the PID
61342 of the subprocess. You can then write a message to the file descriptor, with
61343 recipients in <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and/or <emphasis>Bcc:</emphasis> header lines.
61344 </para>
61345 <para>
61346 When you have finished, call <emphasis>child_close()</emphasis> to wait for the process to
61347 finish and to collect its ending status. A timeout value of zero is usually
61348 fine in this circumstance. Unless you have made a mistake with the recipient
61349 addresses, you should get a return code of zero.
61350 </para>
61351 </listitem></varlistentry>
61352 <varlistentry>
61353 <term><emphasis role="bold">pid_t&nbsp;child_open_exim2(int&nbsp;*fd,&nbsp;uschar&nbsp;*sender,&nbsp;uschar&nbsp;*sender_authentication)</emphasis></term>
61354 <listitem>
61355 <para>
61356 This function is a more sophisticated version of <emphasis>child_open()</emphasis>. The command
61357 that it runs is:
61358 </para>
61359 <literallayout>
61360 <literal>exim -t -oem -oi -f </literal><emphasis>sender</emphasis><literal> -oMas </literal><emphasis>sender_authentication</emphasis>
61361 </literallayout>
61362 <para>
61363 The third argument may be NULL, in which case the <option>-oMas</option> option is omitted.
61364 </para>
61365 </listitem></varlistentry>
61366 <varlistentry>
61367 <term><emphasis role="bold">void&nbsp;debug_printf(char&nbsp;*,&nbsp;...)</emphasis></term>
61368 <listitem>
61369 <para>
61370 This is Exim&#x2019;s debugging function, with arguments as for <emphasis>(printf()</emphasis>. The
61371 output is written to the standard error stream. If no debugging is selected,
61372 calls to <emphasis>debug_printf()</emphasis> have no effect. Normally, you should make calls
61373 conditional on the <literal>local_scan</literal> debug selector by coding like this:
61374 </para>
61375 <literallayout class="monospaced">
61376 if ((debug_selector &amp; D_local_scan) != 0)
61377   debug_printf("xxx", ...);
61378 </literallayout>
61379 </listitem></varlistentry>
61380 <varlistentry>
61381 <term><emphasis role="bold">uschar&nbsp;*expand_string(uschar&nbsp;*string)</emphasis></term>
61382 <listitem>
61383 <para>
61384 This is an interface to Exim&#x2019;s string expansion code. The return value is the
61385 expanded string, or NULL if there was an expansion failure.
61386 The C variable <option>expand_string_message</option> contains an error message after an
61387 expansion failure. If expansion does not change the string, the return value is
61388 the pointer to the input string. Otherwise, the return value points to a new
61389 block of memory that was obtained by a call to <emphasis>store_get()</emphasis>. See section
61390 <xref linkend="SECTmemhanloc"/> below for a discussion of memory handling.
61391 </para>
61392 </listitem></varlistentry>
61393 <varlistentry>
61394 <term><emphasis role="bold">void&nbsp;header_add(int&nbsp;type,&nbsp;char&nbsp;*format,&nbsp;...)</emphasis></term>
61395 <listitem>
61396 <para>
61397 This function allows you to an add additional header line at the end of the
61398 existing ones. The first argument is the type, and should normally be a space
61399 character. The second argument is a format string and any number of
61400 substitution arguments as for <function>sprintf()</function>. You may include internal newlines
61401 if you want, and you must ensure that the string ends with a newline.
61402 </para>
61403 </listitem></varlistentry>
61404 <varlistentry>
61405 <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>
61406 <listitem>
61407 <para>
61408 This function adds a new header line at a specified point in the header
61409 chain. The header itself is specified as for <emphasis>header_add()</emphasis>.
61410 </para>
61411 <para>
61412 If <option>name</option> is NULL, the new header is added at the end of the chain if
61413 <option>after</option> is true, or at the start if <option>after</option> is false. If <option>name</option> is not
61414 NULL, the header lines are searched for the first non-deleted header that
61415 matches the name. If one is found, the new header is added before it if
61416 <option>after</option> is false. If <option>after</option> is true, the new header is added after the
61417 found header and any adjacent subsequent ones with the same name (even if
61418 marked <quote>deleted</quote>). If no matching non-deleted header is found, the <option>topnot</option>
61419 option controls where the header is added. If it is true, addition is at the
61420 top; otherwise at the bottom. Thus, to add a header after all the <emphasis>Received:</emphasis>
61421 headers, or at the top if there are no <emphasis>Received:</emphasis> headers, you could use
61422 </para>
61423 <literallayout class="monospaced">
61424 header_add_at_position(TRUE, US"Received", TRUE,
61425   ' ', "X-xxx: ...");
61426 </literallayout>
61427 <para>
61428 Normally, there is always at least one non-deleted <emphasis>Received:</emphasis> header, but
61429 there may not be if <option>received_header_text</option> expands to an empty string.
61430 </para>
61431 </listitem></varlistentry>
61432 <varlistentry>
61433 <term><emphasis role="bold">void&nbsp;header_remove(int&nbsp;occurrence,&nbsp;uschar&nbsp;*name)</emphasis></term>
61434 <listitem>
61435 <para>
61436 This function removes header lines. If <option>occurrence</option> is zero or negative, all
61437 occurrences of the header are removed. If occurrence is greater than zero, that
61438 particular instance of the header is removed. If no header(s) can be found that
61439 match the specification, the function does nothing.
61440 </para>
61441 </listitem></varlistentry>
61442 <varlistentry>
61443 <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>
61444 <listitem>
61445 <para>
61446 This function tests whether the given header has the given name. It is not just
61447 a string comparison, because white space is permitted between the name and the
61448 colon. If the <option>notdel</option> argument is true, a false return is forced for all
61449 <quote>deleted</quote> headers; otherwise they are not treated specially. For example:
61450 </para>
61451 <literallayout class="monospaced">
61452 if (header_testname(h, US"X-Spam", 6, TRUE)) ...
61453 </literallayout>
61454 </listitem></varlistentry>
61455 <varlistentry>
61456 <term><emphasis role="bold">uschar&nbsp;*lss_b64encode(uschar&nbsp;*cleartext,&nbsp;int&nbsp;length)</emphasis></term>
61457 <listitem>
61458 <para>
61459 <indexterm role="concept">
61460 <primary>base64 encoding</primary>
61461 <secondary>functions for <function>local_scan()</function> use</secondary>
61462 </indexterm>
61463 This function base64-encodes a string, which is passed by address and length.
61464 The text may contain bytes of any value, including zero. The result is passed
61465 back in dynamic memory that is obtained by calling <emphasis>store_get()</emphasis>. It is
61466 zero-terminated.
61467 </para>
61468 </listitem></varlistentry>
61469 <varlistentry>
61470 <term><emphasis role="bold">int&nbsp;lss_b64decode(uschar&nbsp;*codetext,&nbsp;uschar&nbsp;**cleartext)</emphasis></term>
61471 <listitem>
61472 <para>
61473 This function decodes a base64-encoded string. Its arguments are a
61474 zero-terminated base64-encoded string and the address of a variable that is set
61475 to point to the result, which is in dynamic memory. The length of the decoded
61476 string is the yield of the function. If the input is invalid base64 data, the
61477 yield is -1. A zero byte is added to the end of the output string to make it
61478 easy to interpret as a C string (assuming it contains no zeros of its own). The
61479 added zero byte is not included in the returned count.
61480 </para>
61481 </listitem></varlistentry>
61482 <varlistentry>
61483 <term><emphasis role="bold">int&nbsp;lss_match_domain(uschar&nbsp;*domain,&nbsp;uschar&nbsp;*list)</emphasis></term>
61484 <listitem>
61485 <para>
61486 This function checks for a match in a domain list. Domains are always
61487 matched caselessly. The return value is one of the following:
61488 </para>
61489 <literallayout>
61490 <literal>OK     </literal> match succeeded
61491 <literal>FAIL   </literal> match failed
61492 <literal>DEFER  </literal> match deferred
61493 </literallayout>
61494 <para>
61495 DEFER is usually caused by some kind of lookup defer, such as the
61496 inability to contact a database.
61497 </para>
61498 </listitem></varlistentry>
61499 <varlistentry>
61500 <term><emphasis role="bold">int&nbsp;lss_match_local_part(uschar&nbsp;*localpart,&nbsp;uschar&nbsp;*list,&nbsp;BOOL&nbsp;caseless)</emphasis></term>
61501 <listitem>
61502 <para>
61503 This function checks for a match in a local part list. The third argument
61504 controls case-sensitivity. The return values are as for
61505 <emphasis>lss_match_domain()</emphasis>.
61506 </para>
61507 </listitem></varlistentry>
61508 <varlistentry>
61509 <term><emphasis role="bold">int&nbsp;lss_match_address(uschar&nbsp;*address,&nbsp;uschar&nbsp;*list,&nbsp;BOOL&nbsp;caseless)</emphasis></term>
61510 <listitem>
61511 <para>
61512 This function checks for a match in an address list. The third argument
61513 controls the case-sensitivity of the local part match. The domain is always
61514 matched caselessly. The return values are as for <emphasis>lss_match_domain()</emphasis>.
61515 </para>
61516 </listitem></varlistentry>
61517 <varlistentry>
61518 <term><emphasis role="bold">int&nbsp;lss_match_host(uschar&nbsp;*host_name,&nbsp;uschar&nbsp;*host_address,&nbsp;uschar&nbsp;*list)</emphasis></term>
61519 <listitem>
61520 <para>
61521 This function checks for a match in a host list. The most common usage is
61522 expected to be
61523 </para>
61524 <literallayout class="monospaced">
61525 lss_match_host(sender_host_name, sender_host_address, ...)
61526 </literallayout>
61527 <para>
61528 <indexterm role="variable">
61529 <primary><varname>$sender_host_address</varname></primary>
61530 </indexterm>
61531 An empty address field matches an empty item in the host list. If the host name
61532 is NULL, the name corresponding to <varname>$sender_host_address</varname> is automatically
61533 looked up if a host name is required to match an item in the list. The return
61534 values are as for <emphasis>lss_match_domain()</emphasis>, but in addition, <emphasis>lss_match_host()</emphasis>
61535 returns ERROR in the case when it had to look up a host name, but the lookup
61536 failed.
61537 </para>
61538 </listitem></varlistentry>
61539 <varlistentry>
61540 <term><emphasis role="bold">void&nbsp;log_write(unsigned&nbsp;int&nbsp;selector,&nbsp;int&nbsp;which,&nbsp;char&nbsp;*format,&nbsp;...)</emphasis></term>
61541 <listitem>
61542 <para>
61543 This function writes to Exim&#x2019;s log files. The first argument should be zero (it
61544 is concerned with <option>log_selector</option>). The second argument can be <literal>LOG_MAIN</literal> or
61545 <literal>LOG_REJECT</literal> or <literal>LOG_PANIC</literal> or the inclusive <quote>or</quote> of any combination of
61546 them. It specifies to which log or logs the message is written. The remaining
61547 arguments are a format and relevant insertion arguments. The string should not
61548 contain any newlines, not even at the end.
61549 </para>
61550 </listitem></varlistentry>
61551 <varlistentry>
61552 <term><emphasis role="bold">void&nbsp;receive_add_recipient(uschar&nbsp;*address,&nbsp;int&nbsp;pno)</emphasis></term>
61553 <listitem>
61554 <para>
61555 This function adds an additional recipient to the message. The first argument
61556 is the recipient address. If it is unqualified (has no domain), it is qualified
61557 with the <option>qualify_recipient</option> domain. The second argument must always be -1.
61558 </para>
61559 <para>
61560 This function does not allow you to specify a private <option>errors_to</option> address (as
61561 described with the structure of <option>recipient_item</option> above), because it pre-dates
61562 the addition of that field to the structure. However, it is easy to add such a
61563 value afterwards. For example:
61564 </para>
61565 <literallayout class="monospaced">
61566  receive_add_recipient(US"monitor@mydom.example", -1);
61567  recipients_list[recipients_count-1].errors_to =
61568    US"postmaster@mydom.example";
61569 </literallayout>
61570 </listitem></varlistentry>
61571 <varlistentry>
61572 <term><emphasis role="bold">BOOL&nbsp;receive_remove_recipient(uschar&nbsp;*recipient)</emphasis></term>
61573 <listitem>
61574 <para>
61575 This is a convenience function to remove a named recipient from the list of
61576 recipients. It returns true if a recipient was removed, and false if no
61577 matching recipient could be found. The argument must be a complete email
61578 address.
61579 </para>
61580 </listitem></varlistentry>
61581 </variablelist>
61582 <para>
61583 <indexterm role="concept">
61584 <primary>RFC 2047</primary>
61585 </indexterm>
61586 </para>
61587 <variablelist>
61588 <varlistentry>
61589 <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>
61590 <listitem>
61591 <para>
61592 This function decodes strings that are encoded according to RFC 2047. Typically
61593 these are the contents of header lines. First, each <quote>encoded word</quote> is decoded
61594 from the Q or B encoding into a byte-string. Then, if provided with the name of
61595 a charset encoding, and if the <function>iconv()</function> function is available, an attempt is
61596 made  to translate the result to the named character set. If this fails, the
61597 binary string is returned with an error message.
61598 </para>
61599 <para>
61600 The first argument is the string to be decoded. If <option>lencheck</option> is TRUE, the
61601 maximum MIME word length is enforced. The third argument is the target
61602 encoding, or NULL if no translation is wanted.
61603 </para>
61604 <para>
61605 <indexterm role="concept">
61606 <primary>binary zero</primary>
61607 <secondary>in RFC 2047 decoding</secondary>
61608 </indexterm>
61609 <indexterm role="concept">
61610 <primary>RFC 2047</primary>
61611 <secondary>binary zero in</secondary>
61612 </indexterm>
61613 If a binary zero is encountered in the decoded string, it is replaced by the
61614 contents of the <option>zeroval</option> argument. For use with Exim headers, the value must
61615 not be 0 because header lines are handled as zero-terminated strings.
61616 </para>
61617 <para>
61618 The function returns the result of processing the string, zero-terminated; if
61619 <option>lenptr</option> is not NULL, the length of the result is set in the variable to
61620 which it points. When <option>zeroval</option> is 0, <option>lenptr</option> should not be NULL.
61621 </para>
61622 <para>
61623 If an error is encountered, the function returns NULL and uses the <option>error</option>
61624 argument to return an error message. The variable pointed to by <option>error</option> is
61625 set to NULL if there is no error; it may be set non-NULL even when the function
61626 returns a non-NULL value if decoding was successful, but there was a problem
61627 with translation.
61628 </para>
61629 </listitem></varlistentry>
61630 <varlistentry>
61631 <term><emphasis role="bold">int&nbsp;smtp_fflush(void)</emphasis></term>
61632 <listitem>
61633 <para>
61634 This function is used in conjunction with <emphasis>smtp_printf()</emphasis>, as described
61635 below.
61636 </para>
61637 </listitem></varlistentry>
61638 <varlistentry>
61639 <term><emphasis role="bold">void&nbsp;smtp_printf(char&nbsp;*,&nbsp;...)</emphasis></term>
61640 <listitem>
61641 <para>
61642 The arguments of this function are like <function>printf()</function>; it writes to the SMTP
61643 output stream. You should use this function only when there is an SMTP output
61644 stream, that is, when the incoming message is being received via interactive
61645 SMTP. This is the case when <option>smtp_input</option> is TRUE and <option>smtp_batched_input</option>
61646 is FALSE. If you want to test for an incoming message from another host (as
61647 opposed to a local process that used the <option>-bs</option> command line option), you can
61648 test the value of <option>sender_host_address</option>, which is non-NULL when a remote host
61649 is involved.
61650 </para>
61651 <para>
61652 If an SMTP TLS connection is established, <emphasis>smtp_printf()</emphasis> uses the TLS
61653 output function, so it can be used for all forms of SMTP connection.
61654 </para>
61655 <para>
61656 Strings that are written by <emphasis>smtp_printf()</emphasis> from within <function>local_scan()</function>
61657 must start with an appropriate response code: 550 if you are going to return
61658 LOCAL_SCAN_REJECT, 451 if you are going to return
61659 LOCAL_SCAN_TEMPREJECT, and 250 otherwise. Because you are writing the
61660 initial lines of a multi-line response, the code must be followed by a hyphen
61661 to indicate that the line is not the final response line. You must also ensure
61662 that the lines you write terminate with CRLF. For example:
61663 </para>
61664 <literallayout class="monospaced">
61665 smtp_printf("550-this is some extra info\r\n");
61666 return LOCAL_SCAN_REJECT;
61667 </literallayout>
61668 <para>
61669 Note that you can also create multi-line responses by including newlines in
61670 the data returned via the <option>return_text</option> argument. The added value of using
61671 <emphasis>smtp_printf()</emphasis> is that, for instance, you could introduce delays between
61672 multiple output lines.
61673 </para>
61674 <para>
61675 The <emphasis>smtp_printf()</emphasis> function does not return any error indication, because it
61676 does not automatically flush pending output, and therefore does not test
61677 the state of the stream. (In the main code of Exim, flushing and error
61678 detection is done when Exim is ready for the next SMTP input command.) If
61679 you want to flush the output and check for an error (for example, the
61680 dropping of a TCP/IP connection), you can call <emphasis>smtp_fflush()</emphasis>, which has no
61681 arguments. It flushes the output stream, and returns a non-zero value if there
61682 is an error.
61683 </para>
61684 </listitem></varlistentry>
61685 <varlistentry>
61686 <term><emphasis role="bold">void&nbsp;*store_get(int)</emphasis></term>
61687 <listitem>
61688 <para>
61689 This function accesses Exim&#x2019;s internal store (memory) manager. It gets a new
61690 chunk of memory whose size is given by the argument. Exim bombs out if it ever
61691 runs out of memory. See the next section for a discussion of memory handling.
61692 </para>
61693 </listitem></varlistentry>
61694 <varlistentry>
61695 <term><emphasis role="bold">void&nbsp;*store_get_perm(int)</emphasis></term>
61696 <listitem>
61697 <para>
61698 This function is like <emphasis>store_get()</emphasis>, but it always gets memory from the
61699 permanent pool. See the next section for a discussion of memory handling.
61700 </para>
61701 </listitem></varlistentry>
61702 <varlistentry>
61703 <term><emphasis role="bold">uschar&nbsp;*string_copy(uschar&nbsp;*string)</emphasis></term>
61704 <listitem>
61705 <para>
61706 See below.
61707 </para>
61708 </listitem></varlistentry>
61709 <varlistentry>
61710 <term><emphasis role="bold">uschar&nbsp;*string_copyn(uschar&nbsp;*string,&nbsp;int&nbsp;length)</emphasis></term>
61711 <listitem>
61712 <para>
61713 See below.
61714 </para>
61715 </listitem></varlistentry>
61716 <varlistentry>
61717 <term><emphasis role="bold">uschar&nbsp;*string_sprintf(char&nbsp;*format,&nbsp;...)</emphasis></term>
61718 <listitem>
61719 <para>
61720 These three functions create strings using Exim&#x2019;s dynamic memory facilities.
61721 The first makes a copy of an entire string. The second copies up to a maximum
61722 number of characters, indicated by the second argument. The third uses a format
61723 and insertion arguments to create a new string. In each case, the result is a
61724 pointer to a new string in the current memory pool. See the next section for
61725 more discussion.
61726 </para>
61727 </listitem></varlistentry>
61728 </variablelist>
61729 </section>
61730 <section id="SECTmemhanloc">
61731 <title>More about Exim&#x2019;s memory handling</title>
61732 <para>
61733 <indexterm role="concept">
61734 <primary><function>local_scan()</function> function</primary>
61735 <secondary>memory handling</secondary>
61736 </indexterm>
61737 No function is provided for freeing memory, because that is never needed.
61738 The dynamic memory that Exim uses when receiving a message is automatically
61739 recycled if another message is received by the same process (this applies only
61740 to incoming SMTP connections &ndash; other input methods can supply only one
61741 message at a time). After receiving the last message, a reception process
61742 terminates.
61743 </para>
61744 <para>
61745 Because it is recycled, the normal dynamic memory cannot be used for holding
61746 data that must be preserved over a number of incoming messages on the same SMTP
61747 connection. However, Exim in fact uses two pools of dynamic memory; the second
61748 one is not recycled, and can be used for this purpose.
61749 </para>
61750 <para>
61751 If you want to allocate memory that remains available for subsequent messages
61752 in the same SMTP connection, you should set
61753 </para>
61754 <literallayout class="monospaced">
61755 store_pool = POOL_PERM
61756 </literallayout>
61757 <para>
61758 before calling the function that does the allocation. There is no need to
61759 restore the value if you do not need to; however, if you do want to revert to
61760 the normal pool, you can either restore the previous value of <option>store_pool</option> or
61761 set it explicitly to POOL_MAIN.
61762 </para>
61763 <para>
61764 The pool setting applies to all functions that get dynamic memory, including
61765 <emphasis>expand_string()</emphasis>, <emphasis>store_get()</emphasis>, and the <emphasis>string_xxx()</emphasis> functions.
61766 There is also a convenience function called <emphasis>store_get_perm()</emphasis> that gets a
61767 block of memory from the permanent pool while preserving the value of
61768 <option>store_pool</option>.
61769 <indexterm role="concept" startref="IIDlosca" class="endofrange"/>
61770 </para>
61771 </section>
61772 </chapter>
61773
61774 <chapter id="CHAPsystemfilter">
61775 <title>System-wide message filtering</title>
61776 <para>
61777 <indexterm role="concept" id="IIDsysfil1" class="startofrange">
61778 <primary>filter</primary>
61779 <secondary>system filter</secondary>
61780 </indexterm>
61781 <indexterm role="concept" id="IIDsysfil2" class="startofrange">
61782 <primary>filtering all mail</primary>
61783 </indexterm>
61784 <indexterm role="concept" id="IIDsysfil3" class="startofrange">
61785 <primary>system filter</primary>
61786 </indexterm>
61787 The previous chapters (on ACLs and the local scan function) describe checks
61788 that can be applied to messages before they are accepted by a host. There is
61789 also a mechanism for checking messages once they have been received, but before
61790 they are delivered. This is called the <emphasis>system filter</emphasis>.
61791 </para>
61792 <para>
61793 The system filter operates in a similar manner to users&#x2019; filter files, but it
61794 is run just once per message (however many recipients the message has).
61795 It should not normally be used as a substitute for routing, because <option>deliver</option>
61796 commands in a system router provide new envelope recipient addresses.
61797 The system filter must be an Exim filter. It cannot be a Sieve filter.
61798 </para>
61799 <para>
61800 The system filter is run at the start of a delivery attempt, before any routing
61801 is done. If a message fails to be completely delivered at the first attempt,
61802 the system filter is run again at the start of every retry.
61803 If you want your filter to do something only once per message, you can make use
61804 of the <option>first_delivery</option> condition in an <option>if</option> command in the filter to
61805 prevent it happening on retries.
61806 </para>
61807 <para>
61808 <indexterm role="variable">
61809 <primary><varname>$domain</varname></primary>
61810 </indexterm>
61811 <indexterm role="variable">
61812 <primary><varname>$local_part</varname></primary>
61813 </indexterm>
61814 <emphasis role="bold">Warning</emphasis>: Because the system filter runs just once, variables that are
61815 specific to individual recipient addresses, such as <varname>$local_part</varname> and
61816 <varname>$domain</varname>, are not set, and the <quote>personal</quote> condition is not meaningful. If
61817 you want to run a centrally-specified filter for each recipient address
61818 independently, you can do so by setting up a suitable <command>redirect</command> router, as
61819 described in section <xref linkend="SECTperaddfil"/> below.
61820 </para>
61821 <section id="SECID212">
61822 <title>Specifying a system filter</title>
61823 <para>
61824 <indexterm role="concept">
61825 <primary>uid (user id)</primary>
61826 <secondary>system filter</secondary>
61827 </indexterm>
61828 <indexterm role="concept">
61829 <primary>gid (group id)</primary>
61830 <secondary>system filter</secondary>
61831 </indexterm>
61832 The name of the file that contains the system filter must be specified by
61833 setting <option>system_filter</option>. If you want the filter to run under a uid and gid
61834 other than root, you must also set <option>system_filter_user</option> and
61835 <option>system_filter_group</option> as appropriate. For example:
61836 </para>
61837 <literallayout class="monospaced">
61838 system_filter = /etc/mail/exim.filter
61839 system_filter_user = exim
61840 </literallayout>
61841 <para>
61842 If a system filter generates any deliveries directly to files or pipes (via the
61843 <option>save</option> or <option>pipe</option> commands), transports to handle these deliveries must be
61844 specified by setting <option>system_filter_file_transport</option> and
61845 <option>system_filter_pipe_transport</option>, respectively. Similarly,
61846 <option>system_filter_reply_transport</option> must be set to handle any messages generated
61847 by the <option>reply</option> command.
61848 </para>
61849 </section>
61850 <section id="SECID213">
61851 <title>Testing a system filter</title>
61852 <para>
61853 You can run simple tests of a system filter in the same way as for a user
61854 filter, but you should use <option>-bF</option> rather than <option>-bf</option>, so that features that
61855 are permitted only in system filters are recognized.
61856 </para>
61857 <para>
61858 If you want to test the combined effect of a system filter and a user filter,
61859 you can use both <option>-bF</option> and <option>-bf</option> on the same command line.
61860 </para>
61861 </section>
61862 <section id="SECID214">
61863 <title>Contents of a system filter</title>
61864 <para>
61865 The language used to specify system filters is the same as for users&#x2019; filter
61866 files. It is described in the separate end-user document <emphasis>Exim&#x2019;s interface to
61867 mail filtering</emphasis>. However, there are some additional features that are
61868 available only in system filters; these are described in subsequent sections.
61869 If they are encountered in a user&#x2019;s filter file or when testing with <option>-bf</option>,
61870 they cause errors.
61871 </para>
61872 <para>
61873 <indexterm role="concept">
61874 <primary>frozen messages</primary>
61875 <secondary>manual thaw; testing in filter</secondary>
61876 </indexterm>
61877 There are two special conditions which, though available in users&#x2019; filter
61878 files, are designed for use in system filters. The condition <option>first_delivery</option>
61879 is true only for the first attempt at delivering a message, and
61880 <option>manually_thawed</option> is true only if the message has been frozen, and
61881 subsequently thawed by an admin user. An explicit forced delivery counts as a
61882 manual thaw, but thawing as a result of the <option>auto_thaw</option> setting does not.
61883 </para>
61884 <para>
61885 <emphasis role="bold">Warning</emphasis>: If a system filter uses the <option>first_delivery</option> condition to
61886 specify an <quote>unseen</quote> (non-significant) delivery, and that delivery does not
61887 succeed, it will not be tried again.
61888 If you want Exim to retry an unseen delivery until it succeeds, you should
61889 arrange to set it up every time the filter runs.
61890 </para>
61891 <para>
61892 When a system filter finishes running, the values of the variables <varname>$n0</varname> &ndash;
61893 <varname>$n9</varname> are copied into <varname>$sn0</varname> &ndash; <varname>$sn9</varname> and are thereby made available to
61894 users&#x2019; filter files. Thus a system filter can, for example, set up <quote>scores</quote>
61895 to which users&#x2019; filter files can refer.
61896 </para>
61897 </section>
61898 <section id="SECID215">
61899 <title>Additional variable for system filters</title>
61900 <para>
61901 <indexterm role="variable">
61902 <primary><varname>$recipients</varname></primary>
61903 </indexterm>
61904 The expansion variable <varname>$recipients</varname>, containing a list of all the recipients
61905 of the message (separated by commas and white space), is available in system
61906 filters. It is not available in users&#x2019; filters for privacy reasons.
61907 </para>
61908 </section>
61909 <section id="SECID216">
61910 <title>Defer, freeze, and fail commands for system filters</title>
61911 <para>
61912 <indexterm role="concept">
61913 <primary>freezing messages</primary>
61914 </indexterm>
61915 <indexterm role="concept">
61916 <primary>message</primary>
61917 <secondary>freezing</secondary>
61918 </indexterm>
61919 <indexterm role="concept">
61920 <primary>message</primary>
61921 <secondary>forced failure</secondary>
61922 </indexterm>
61923 <indexterm role="concept">
61924 <primary><option>fail</option></primary>
61925 <secondary>in system filter</secondary>
61926 </indexterm>
61927 <indexterm role="concept">
61928 <primary><option>freeze</option> in system filter</primary>
61929 </indexterm>
61930 <indexterm role="concept">
61931 <primary><option>defer</option> in system filter</primary>
61932 </indexterm>
61933 There are three extra commands (<option>defer</option>, <option>freeze</option> and <option>fail</option>) which are
61934 always available in system filters, but are not normally enabled in users&#x2019;
61935 filters. (See the <option>allow_defer</option>, <option>allow_freeze</option> and <option>allow_fail</option> options
61936 for the <command>redirect</command> router.) These commands can optionally be followed by the
61937 word <option>text</option> and a string containing an error message, for example:
61938 </para>
61939 <literallayout class="monospaced">
61940 fail text "this message looks like spam to me"
61941 </literallayout>
61942 <para>
61943 The keyword <option>text</option> is optional if the next character is a double quote.
61944 </para>
61945 <para>
61946 The <option>defer</option> command defers delivery of the original recipients of the
61947 message. The <option>fail</option> command causes all the original recipients to be failed,
61948 and a bounce message to be created. The <option>freeze</option> command suspends all
61949 delivery attempts for the original recipients. In all cases, any new deliveries
61950 that are specified by the filter are attempted as normal after the filter has
61951 run.
61952 </para>
61953 <para>
61954 The <option>freeze</option> command is ignored if the message has been manually unfrozen and
61955 not manually frozen since. This means that automatic freezing by a system
61956 filter can be used as a way of checking out suspicious messages. If a message
61957 is found to be all right, manually unfreezing it allows it to be delivered.
61958 </para>
61959 <para>
61960 <indexterm role="concept">
61961 <primary>log</primary>
61962 <secondary><option>fail</option> command log line</secondary>
61963 </indexterm>
61964 <indexterm role="concept">
61965 <primary><option>fail</option></primary>
61966 <secondary>log line; reducing</secondary>
61967 </indexterm>
61968 The text given with a fail command is used as part of the bounce message as
61969 well as being written to the log. If the message is quite long, this can fill
61970 up a lot of log space when such failures are common. To reduce the size of the
61971 log message, Exim interprets the text in a special way if it starts with the
61972 two characters <literal>&lt;&lt;</literal> and contains <literal>&gt;&gt;</literal> later. The text between these two
61973 strings is written to the log, and the rest of the text is used in the bounce
61974 message. For example:
61975 </para>
61976 <literallayout class="monospaced">
61977 fail "&lt;&lt;filter test 1&gt;&gt;Your message is rejected \
61978      because it contains attachments that we are \
61979      not prepared to receive."
61980 </literallayout>
61981 <para>
61982 <indexterm role="concept">
61983 <primary>loop</primary>
61984 <secondary>caused by <option>fail</option></secondary>
61985 </indexterm>
61986 Take great care with the <option>fail</option> command when basing the decision to fail on
61987 the contents of the message, because the bounce message will of course include
61988 the contents of the original message and will therefore trigger the <option>fail</option>
61989 command again (causing a mail loop) unless steps are taken to prevent this.
61990 Testing the <option>error_message</option> condition is one way to prevent this. You could
61991 use, for example
61992 </para>
61993 <literallayout class="monospaced">
61994 if $message_body contains "this is spam" and not error_message
61995 then fail text "spam is not wanted here" endif
61996 </literallayout>
61997 <para>
61998 though of course that might let through unwanted bounce messages. The
61999 alternative is clever checking of the body and/or headers to detect bounces
62000 generated by the filter.
62001 </para>
62002 <para>
62003 The interpretation of a system filter file ceases after a
62004 <option>defer</option>,
62005 <option>freeze</option>, or <option>fail</option> command is obeyed. However, any deliveries that were
62006 set up earlier in the filter file are honoured, so you can use a sequence such
62007 as
62008 </para>
62009 <literallayout class="monospaced">
62010 mail ...
62011 freeze
62012 </literallayout>
62013 <para>
62014 to send a specified message when the system filter is freezing (or deferring or
62015 failing) a message. The normal deliveries for the message do not, of course,
62016 take place.
62017 </para>
62018 </section>
62019 <section id="SECTaddremheasys">
62020 <title>Adding and removing headers in a system filter</title>
62021 <para>
62022 <indexterm role="concept">
62023 <primary>header lines</primary>
62024 <secondary>adding; in system filter</secondary>
62025 </indexterm>
62026 <indexterm role="concept">
62027 <primary>header lines</primary>
62028 <secondary>removing; in system filter</secondary>
62029 </indexterm>
62030 <indexterm role="concept">
62031 <primary>filter</primary>
62032 <secondary>header lines; adding/removing</secondary>
62033 </indexterm>
62034 Two filter commands that are available only in system filters are:
62035 </para>
62036 <literallayout class="monospaced">
62037 headers add &lt;string&gt;
62038 headers remove &lt;string&gt;
62039 </literallayout>
62040 <para>
62041 The argument for the <option>headers add</option> is a string that is expanded and then
62042 added to the end of the message&#x2019;s headers. It is the responsibility of the
62043 filter maintainer to make sure it conforms to RFC 2822 syntax. Leading white
62044 space is ignored, and if the string is otherwise empty, or if the expansion is
62045 forced to fail, the command has no effect.
62046 </para>
62047 <para>
62048 You can use <quote>\n</quote> within the string, followed by white space, to specify
62049 continued header lines. More than one header may be added in one command by
62050 including <quote>\n</quote> within the string without any following white space. For
62051 example:
62052 </para>
62053 <literallayout class="monospaced">
62054 headers add "X-header-1: ....\n  \
62055              continuation of X-header-1 ...\n\
62056              X-header-2: ...."
62057 </literallayout>
62058 <para>
62059 Note that the header line continuation white space after the first newline must
62060 be placed before the backslash that continues the input string, because white
62061 space after input continuations is ignored.
62062 </para>
62063 <para>
62064 The argument for <option>headers remove</option> is a colon-separated list of header names.
62065 This command applies only to those headers that are stored with the message;
62066 those that are added at delivery time (such as <emphasis>Envelope-To:</emphasis> and
62067 <emphasis>Return-Path:</emphasis>) cannot be removed by this means. If there is more than one
62068 header with the same name, they are all removed.
62069 </para>
62070 <para>
62071 The <option>headers</option> command in a system filter makes an immediate change to the set
62072 of header lines that was received with the message (with possible additions
62073 from ACL processing). Subsequent commands in the system filter operate on the
62074 modified set, which also forms the basis for subsequent message delivery.
62075 Unless further modified during routing or transporting, this set of headers is
62076 used for all recipients of the message.
62077 </para>
62078 <para>
62079 During routing and transporting, the variables that refer to the contents of
62080 header lines refer only to those lines that are in this set. Thus, header lines
62081 that are added by a system filter are visible to users&#x2019; filter files and to all
62082 routers and transports. This contrasts with the manipulation of header lines by
62083 routers and transports, which is not immediate, but which instead is saved up
62084 until the message is actually being written (see section
62085 <xref linkend="SECTheadersaddrem"/>).
62086 </para>
62087 <para>
62088 If the message is not delivered at the first attempt, header lines that were
62089 added by the system filter are stored with the message, and so are still
62090 present at the next delivery attempt. Header lines that were removed are still
62091 present, but marked <quote>deleted</quote> so that they are not transported with the
62092 message. For this reason, it is usual to make the <option>headers</option> command
62093 conditional on <option>first_delivery</option> so that the set of header lines is not
62094 modified more than once.
62095 </para>
62096 <para>
62097 Because header modification in a system filter acts immediately, you have to
62098 use an indirect approach if you want to modify the contents of a header line.
62099 For example:
62100 </para>
62101 <literallayout class="monospaced">
62102 headers add "Old-Subject: $h_subject:"
62103 headers remove "Subject"
62104 headers add "Subject: new subject (was: $h_old-subject:)"
62105 headers remove "Old-Subject"
62106 </literallayout>
62107 </section>
62108 <section id="SECID217">
62109 <title>Setting an errors address in a system filter</title>
62110 <para>
62111 <indexterm role="concept">
62112 <primary>envelope sender</primary>
62113 </indexterm>
62114 In a system filter, if a <option>deliver</option> command is followed by
62115 </para>
62116 <literallayout class="monospaced">
62117 errors_to &lt;some address&gt;
62118 </literallayout>
62119 <para>
62120 in order to change the envelope sender (and hence the error reporting) for that
62121 delivery, any address may be specified. (In a user filter, only the current
62122 user&#x2019;s address can be set.) For example, if some mail is being monitored, you
62123 might use
62124 </para>
62125 <literallayout class="monospaced">
62126 unseen deliver monitor@spying.example errors_to root@local.example
62127 </literallayout>
62128 <para>
62129 to take a copy which would not be sent back to the normal error reporting
62130 address if its delivery failed.
62131 </para>
62132 </section>
62133 <section id="SECTperaddfil">
62134 <title>Per-address filtering</title>
62135 <para>
62136 <indexterm role="variable">
62137 <primary><varname>$domain</varname></primary>
62138 </indexterm>
62139 <indexterm role="variable">
62140 <primary><varname>$local_part</varname></primary>
62141 </indexterm>
62142 In contrast to the system filter, which is run just once per message for each
62143 delivery attempt, it is also possible to set up a system-wide filtering
62144 operation that runs once for each recipient address. In this case, variables
62145 such as <varname>$local_part</varname> and <varname>$domain</varname> can be used, and indeed, the choice of
62146 filter file could be made dependent on them. This is an example of a router
62147 which implements such a filter:
62148 </para>
62149 <literallayout class="monospaced">
62150 central_filter:
62151   check_local_user
62152   driver = redirect
62153   domains = +local_domains
62154   file = /central/filters/$local_part
62155   no_verify
62156   allow_filter
62157   allow_freeze
62158 </literallayout>
62159 <para>
62160 The filter is run in a separate process under its own uid. Therefore, either
62161 <option>check_local_user</option> must be set (as above), in which case the filter is run as
62162 the local user, or the <option>user</option> option must be used to specify which user to
62163 use. If both are set, <option>user</option> overrides.
62164 </para>
62165 <para>
62166 Care should be taken to ensure that none of the commands in the filter file
62167 specify a significant delivery if the message is to go on to be delivered to
62168 its intended recipient. The router will not then claim to have dealt with the
62169 address, so it will be passed on to subsequent routers to be delivered in the
62170 normal way.
62171 <indexterm role="concept" startref="IIDsysfil1" class="endofrange"/>
62172 <indexterm role="concept" startref="IIDsysfil2" class="endofrange"/>
62173 <indexterm role="concept" startref="IIDsysfil3" class="endofrange"/>
62174 </para>
62175 </section>
62176 </chapter>
62177
62178 <chapter id="CHAPmsgproc">
62179 <title>Message processing</title>
62180 <para>
62181 <indexterm role="concept" id="IIDmesproc" class="startofrange">
62182 <primary>message</primary>
62183 <secondary>general processing</secondary>
62184 </indexterm>
62185 Exim performs various transformations on the sender and recipient addresses of
62186 all messages that it handles, and also on the messages&#x2019; header lines. Some of
62187 these are optional and configurable, while others always take place. All of
62188 this processing, except rewriting as a result of routing, and the addition or
62189 removal of header lines while delivering, happens when a message is received,
62190 before it is placed on Exim&#x2019;s queue.
62191 </para>
62192 <para>
62193 Some of the automatic processing takes place by default only for
62194 <quote>locally-originated</quote> messages. This adjective is used to describe messages
62195 that are not received over TCP/IP, but instead are passed to an Exim process on
62196 its standard input. This includes the interactive <quote>local SMTP</quote> case that is
62197 set up by the <option>-bs</option> command line option.
62198 </para>
62199 <para>
62200 <emphasis role="bold">Note</emphasis>: Messages received over TCP/IP on the loopback interface (127.0.0.1
62201 or ::1) are not considered to be locally-originated. Exim does not treat the
62202 loopback interface specially in any way.
62203 </para>
62204 <para>
62205 If you want the loopback interface to be treated specially, you must ensure
62206 that there are appropriate entries in your ACLs.
62207 </para>
62208 <section id="SECTsubmodnon">
62209 <title>Submission mode for non-local messages</title>
62210 <para>
62211 <indexterm role="concept">
62212 <primary>message</primary>
62213 <secondary>submission</secondary>
62214 </indexterm>
62215 <indexterm role="concept">
62216 <primary>submission mode</primary>
62217 </indexterm>
62218 Processing that happens automatically for locally-originated messages (unless
62219 <option>suppress_local_fixups</option> is set) can also be requested for messages that are
62220 received over TCP/IP. The term <quote>submission mode</quote> is used to describe this
62221 state. Submission mode is set by the modifier
62222 </para>
62223 <literallayout class="monospaced">
62224 control = submission
62225 </literallayout>
62226 <para>
62227 in a MAIL, RCPT, or pre-data ACL for an incoming message (see sections
62228 <xref linkend="SECTACLmodi"/> and <xref linkend="SECTcontrols"/>). This makes Exim treat the message as
62229 a local submission, and is normally used when the source of the message is
62230 known to be an MUA running on a client host (as opposed to an MTA). For
62231 example, to set submission mode for messages originating on the IPv4 loopback
62232 interface, you could include the following in the MAIL ACL:
62233 </para>
62234 <literallayout class="monospaced">
62235 warn  hosts = 127.0.0.1
62236       control = submission
62237 </literallayout>
62238 <para>
62239 <indexterm role="concept">
62240 <primary><option>sender_retain</option> submission option</primary>
62241 </indexterm>
62242 There are some options that can be used when setting submission mode. A slash
62243 is used to separate options. For example:
62244 </para>
62245 <literallayout class="monospaced">
62246 control = submission/sender_retain
62247 </literallayout>
62248 <para>
62249 Specifying <option>sender_retain</option> has the effect of setting <option>local_sender_retain</option>
62250 true and <option>local_from_check</option> false for the current incoming message. The first
62251 of these allows an existing <emphasis>Sender:</emphasis> header in the message to remain, and
62252 the second suppresses the check to ensure that <emphasis>From:</emphasis> matches the
62253 authenticated sender. With this setting, Exim still fixes up messages by adding
62254 <emphasis>Date:</emphasis> and <emphasis>Message-ID:</emphasis> header lines if they are missing, but makes no
62255 attempt to check sender authenticity in header lines.
62256 </para>
62257 <para>
62258 When <option>sender_retain</option> is not set, a submission mode setting may specify a
62259 domain to be used when generating a <emphasis>From:</emphasis> or <emphasis>Sender:</emphasis> header line. For
62260 example:
62261 </para>
62262 <literallayout class="monospaced">
62263 control = submission/domain=some.domain
62264 </literallayout>
62265 <para>
62266 The domain may be empty. How this value is used is described in sections
62267 <xref linkend="SECTthefrohea"/> and <xref linkend="SECTthesenhea"/>. There is also a <option>name</option> option
62268 that allows you to specify the user&#x2019;s full name for inclusion in a created
62269 <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis> header line. For example:
62270 </para>
62271 <literallayout class="monospaced">
62272 accept authenticated = *
62273        control = submission/domain=wonderland.example/\
62274                             name=${lookup {$authenticated_id} \
62275                                    lsearch {/etc/exim/namelist}}
62276 </literallayout>
62277 <para>
62278 Because the name may contain any characters, including slashes, the <option>name</option>
62279 option must be given last. The remainder of the string is used as the name. For
62280 the example above, if <filename>/etc/exim/namelist</filename> contains:
62281 </para>
62282 <literallayout class="monospaced">
62283 bigegg:  Humpty Dumpty
62284 </literallayout>
62285 <para>
62286 then when the sender has authenticated as <emphasis>bigegg</emphasis>, the generated <emphasis>Sender:</emphasis>
62287 line would be:
62288 </para>
62289 <literallayout class="monospaced">
62290 Sender: Humpty Dumpty &lt;bigegg@wonderland.example&gt;
62291 </literallayout>
62292 <para>
62293 <indexterm role="concept">
62294 <primary>return path</primary>
62295 <secondary>in submission mode</secondary>
62296 </indexterm>
62297 By default, submission mode forces the return path to the same address as is
62298 used to create the <emphasis>Sender:</emphasis> header. However, if <option>sender_retain</option> is
62299 specified, the return path is also left unchanged.
62300 </para>
62301 <para>
62302 <emphasis role="bold">Note</emphasis>: The changes caused by submission mode take effect after the predata
62303 ACL. This means that any sender checks performed before the fix-ups use the
62304 untrusted sender address specified by the user, not the trusted sender address
62305 specified by submission mode. Although this might be slightly unexpected, it
62306 does mean that you can configure ACL checks to spot that a user is trying to
62307 spoof another&#x2019;s address.
62308 </para>
62309 </section>
62310 <section id="SECTlineendings">
62311 <title>Line endings</title>
62312 <para>
62313 <indexterm role="concept">
62314 <primary>line endings</primary>
62315 </indexterm>
62316 <indexterm role="concept">
62317 <primary>carriage return</primary>
62318 </indexterm>
62319 <indexterm role="concept">
62320 <primary>linefeed</primary>
62321 </indexterm>
62322 RFC 2821 specifies that CRLF (two characters: carriage-return, followed by
62323 linefeed) is the line ending for messages transmitted over the Internet using
62324 SMTP over TCP/IP. However, within individual operating systems, different
62325 conventions are used. For example, Unix-like systems use just LF, but others
62326 use CRLF or just CR.
62327 </para>
62328 <para>
62329 Exim was designed for Unix-like systems, and internally, it stores messages
62330 using the system&#x2019;s convention of a single LF as a line terminator. When
62331 receiving a message, all line endings are translated to this standard format.
62332 Originally, it was thought that programs that passed messages directly to an
62333 MTA within an operating system would use that system&#x2019;s convention. Experience
62334 has shown that this is not the case; for example, there are Unix applications
62335 that use CRLF in this circumstance. For this reason, and for compatibility with
62336 other MTAs, the way Exim handles line endings for all messages is now as
62337 follows:
62338 </para>
62339 <itemizedlist>
62340 <listitem>
62341 <para>
62342 LF not preceded by CR is treated as a line ending.
62343 </para>
62344 </listitem>
62345 <listitem>
62346 <para>
62347 CR is treated as a line ending; if it is immediately followed by LF, the LF
62348 is ignored.
62349 </para>
62350 </listitem>
62351 <listitem>
62352 <para>
62353 The sequence <quote>CR, dot, CR</quote> does not terminate an incoming SMTP message,
62354 nor a local message in the state where a line containing only a dot is a
62355 terminator.
62356 </para>
62357 </listitem>
62358 <listitem>
62359 <para>
62360 If a bare CR is encountered within a header line, an extra space is added after
62361 the line terminator so as not to end the header line. The reasoning behind this
62362 is that bare CRs in header lines are most likely either to be mistakes, or
62363 people trying to play silly games.
62364 </para>
62365 </listitem>
62366 <listitem>
62367 <para>
62368 If the first header line received in a message ends with CRLF, a subsequent
62369 bare LF in a header line is treated in the same way as a bare CR in a header
62370 line.
62371 </para>
62372 </listitem>
62373 </itemizedlist>
62374 </section>
62375 <section id="SECID218">
62376 <title>Unqualified addresses</title>
62377 <para>
62378 <indexterm role="concept">
62379 <primary>unqualified addresses</primary>
62380 </indexterm>
62381 <indexterm role="concept">
62382 <primary>address</primary>
62383 <secondary>qualification</secondary>
62384 </indexterm>
62385 By default, Exim expects every envelope address it receives from an external
62386 host to be fully qualified. Unqualified addresses cause negative responses to
62387 SMTP commands. However, because SMTP is used as a means of transporting
62388 messages from MUAs running on personal workstations, there is sometimes a
62389 requirement to accept unqualified addresses from specific hosts or IP networks.
62390 </para>
62391 <para>
62392 Exim has two options that separately control which hosts may send unqualified
62393 sender or recipient addresses in SMTP commands, namely
62394 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>. In both
62395 cases, if an unqualified address is accepted, it is qualified by adding the
62396 value of <option>qualify_domain</option> or <option>qualify_recipient</option>, as appropriate.
62397 </para>
62398 <para>
62399 <indexterm role="option">
62400 <primary><option>qualify_domain</option></primary>
62401 </indexterm>
62402 <indexterm role="option">
62403 <primary><option>qualify_recipient</option></primary>
62404 </indexterm>
62405 Unqualified addresses in header lines are automatically qualified for messages
62406 that are locally originated, unless the <option>-bnq</option> option is given on the command
62407 line. For messages received over SMTP, unqualified addresses in header lines
62408 are qualified only if unqualified addresses are permitted in SMTP commands. In
62409 other words, such qualification is also controlled by
62410 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>,
62411 </para>
62412 </section>
62413 <section id="SECID219">
62414 <title>The UUCP From line</title>
62415 <para>
62416 <indexterm role="concept">
62417 <primary><quote>From</quote> line</primary>
62418 </indexterm>
62419 <indexterm role="concept">
62420 <primary>UUCP</primary>
62421 <secondary><quote>From</quote> line</secondary>
62422 </indexterm>
62423 <indexterm role="concept">
62424 <primary>sender</primary>
62425 <secondary>address</secondary>
62426 </indexterm>
62427 <indexterm role="option">
62428 <primary><option>uucp_from_pattern</option></primary>
62429 </indexterm>
62430 <indexterm role="option">
62431 <primary><option>uucp_from_sender</option></primary>
62432 </indexterm>
62433 <indexterm role="concept">
62434 <primary>envelope sender</primary>
62435 </indexterm>
62436 <indexterm role="concept">
62437 <primary>Sendmail compatibility</primary>
62438 <secondary><quote>From</quote> line</secondary>
62439 </indexterm>
62440 Messages that have come from UUCP (and some other applications) often begin
62441 with a line containing the envelope sender and a timestamp, following the word
62442 <quote>From</quote>. Examples of two common formats are:
62443 </para>
62444 <literallayout class="monospaced">
62445 From a.oakley@berlin.mus Fri Jan  5 12:35 GMT 1996
62446 From f.butler@berlin.mus Fri, 7 Jan 97 14:00:00 GMT
62447 </literallayout>
62448 <para>
62449 This line precedes the RFC 2822 header lines. For compatibility with Sendmail,
62450 Exim recognizes such lines at the start of messages that are submitted to it
62451 via the command line (that is, on the standard input). It does not recognize
62452 such lines in incoming SMTP messages, unless the sending host matches
62453 <option>ignore_fromline_hosts</option> or the <option>-bs</option> option was used for a local message
62454 and <option>ignore_fromline_local</option> is set. The recognition is controlled by a
62455 regular expression that is defined by the <option>uucp_from_pattern</option> option, whose
62456 default value matches the two common cases shown above and puts the address
62457 that follows <quote>From</quote> into <varname>$1</varname>.
62458 </para>
62459 <para>
62460 <indexterm role="concept">
62461 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
62462 <secondary>in <quote>From </quote> line handling</secondary>
62463 </indexterm>
62464 When the caller of Exim for a non-SMTP message that contains a <quote>From</quote> line is
62465 a trusted user, the message&#x2019;s sender address is constructed by expanding the
62466 contents of <option>uucp_sender_address</option>, whose default value is <quote>$1</quote>. This is
62467 then parsed as an RFC 2822 address. If there is no domain, the local part is
62468 qualified with <option>qualify_domain</option> unless it is the empty string. However, if
62469 the command line <option>-f</option> option is used, it overrides the <quote>From</quote> line.
62470 </para>
62471 <para>
62472 If the caller of Exim is not trusted, the <quote>From</quote> line is recognized, but the
62473 sender address is not changed. This is also the case for incoming SMTP messages
62474 that are permitted to contain <quote>From</quote> lines.
62475 </para>
62476 <para>
62477 Only one <quote>From</quote> line is recognized. If there is more than one, the second is
62478 treated as a data line that starts the body of the message, as it is not valid
62479 as a header line. This also happens if a <quote>From</quote> line is present in an
62480 incoming SMTP message from a source that is not permitted to send them.
62481 </para>
62482 </section>
62483 <section id="SECID220">
62484 <title>Resent- header lines</title>
62485 <para>
62486 <indexterm role="concept">
62487 <primary><option>Resent-</option> header lines</primary>
62488 </indexterm>
62489 <indexterm role="concept">
62490 <primary>header lines</primary>
62491 <secondary>Resent-</secondary>
62492 </indexterm>
62493 RFC 2822 makes provision for sets of header lines starting with the string
62494 <literal>Resent-</literal> to be added to a message when it is resent by the original
62495 recipient to somebody else. These headers are <emphasis>Resent-Date:</emphasis>,
62496 <emphasis>Resent-From:</emphasis>, <emphasis>Resent-Sender:</emphasis>, <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>,
62497 <emphasis>Resent-Bcc:</emphasis> and <emphasis>Resent-Message-ID:</emphasis>. The RFC says:
62498 </para>
62499 <blockquote>
62500 <para>
62501 <emphasis>Resent fields are strictly informational. They MUST NOT be used in the normal
62502 processing of replies or other such automatic actions on messages.</emphasis>
62503 </para>
62504 </blockquote>
62505 <para>
62506 This leaves things a bit vague as far as other processing actions such as
62507 address rewriting are concerned. Exim treats <option>Resent-</option> header lines as
62508 follows:
62509 </para>
62510 <itemizedlist>
62511 <listitem>
62512 <para>
62513 A <emphasis>Resent-From:</emphasis> line that just contains the login id of the submitting user
62514 is automatically rewritten in the same way as <emphasis>From:</emphasis> (see below).
62515 </para>
62516 </listitem>
62517 <listitem>
62518 <para>
62519 If there&#x2019;s a rewriting rule for a particular header line, it is also applied to
62520 <option>Resent-</option> header lines of the same type. For example, a rule that rewrites
62521 <emphasis>From:</emphasis> also rewrites <emphasis>Resent-From:</emphasis>.
62522 </para>
62523 </listitem>
62524 <listitem>
62525 <para>
62526 For local messages, if <emphasis>Sender:</emphasis> is removed on input, <emphasis>Resent-Sender:</emphasis> is
62527 also removed.
62528 </para>
62529 </listitem>
62530 <listitem>
62531 <para>
62532 For a locally-submitted message,
62533 if there are any <option>Resent-</option> header lines but no <emphasis>Resent-Date:</emphasis>,
62534 <emphasis>Resent-From:</emphasis>, or <emphasis>Resent-Message-Id:</emphasis>, they are added as necessary. It is
62535 the contents of <emphasis>Resent-Message-Id:</emphasis> (rather than <emphasis>Message-Id:</emphasis>) which are
62536 included in log lines in this case.
62537 </para>
62538 </listitem>
62539 <listitem>
62540 <para>
62541 The logic for adding <emphasis>Sender:</emphasis> is duplicated for <emphasis>Resent-Sender:</emphasis> when any
62542 <option>Resent-</option> header lines are present.
62543 </para>
62544 </listitem>
62545 </itemizedlist>
62546 </section>
62547 <section id="SECID221">
62548 <title>The Auto-Submitted: header line</title>
62549 <para>
62550 Whenever Exim generates an autoreply, a bounce, or a delay warning message, it
62551 includes the header line:
62552 </para>
62553 <literallayout class="monospaced">
62554 Auto-Submitted: auto-replied
62555 </literallayout>
62556 </section>
62557 <section id="SECID222">
62558 <title>The Bcc: header line</title>
62559 <para>
62560 <indexterm role="concept">
62561 <primary><emphasis>Bcc:</emphasis> header line</primary>
62562 </indexterm>
62563 If Exim is called with the <option>-t</option> option, to take recipient addresses from a
62564 message&#x2019;s header, it removes any <emphasis>Bcc:</emphasis> header line that may exist (after
62565 extracting its addresses). If <option>-t</option> is not present on the command line, any
62566 existing <emphasis>Bcc:</emphasis> is not removed.
62567 </para>
62568 </section>
62569 <section id="SECID223">
62570 <title>The Date: header line</title>
62571 <para>
62572 <indexterm role="concept">
62573 <primary><emphasis>Date:</emphasis> header line</primary>
62574 </indexterm>
62575 <indexterm role="concept">
62576 <primary>header lines</primary>
62577 <secondary>Date:</secondary>
62578 </indexterm>
62579 If a locally-generated or submission-mode message has no <emphasis>Date:</emphasis> header line,
62580 Exim adds one, using the current date and time, unless the
62581 <option>suppress_local_fixups</option> control has been specified.
62582 </para>
62583 </section>
62584 <section id="SECID224">
62585 <title>The Delivery-date: header line</title>
62586 <para>
62587 <indexterm role="concept">
62588 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
62589 </indexterm>
62590 <indexterm role="option">
62591 <primary><option>delivery_date_remove</option></primary>
62592 </indexterm>
62593 <emphasis>Delivery-date:</emphasis> header lines are not part of the standard RFC 2822 header
62594 set. Exim can be configured to add them to the final delivery of messages. (See
62595 the generic <option>delivery_date_add</option> transport option.) They should not be present
62596 in messages in transit. If the <option>delivery_date_remove</option> configuration option is
62597 set (the default), Exim removes <emphasis>Delivery-date:</emphasis> header lines from incoming
62598 messages.
62599 </para>
62600 </section>
62601 <section id="SECID225">
62602 <title>The Envelope-to: header line</title>
62603 <para>
62604 <indexterm role="concept">
62605 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
62606 </indexterm>
62607 <indexterm role="concept">
62608 <primary>header lines</primary>
62609 <secondary>Envelope-to:</secondary>
62610 </indexterm>
62611 <indexterm role="option">
62612 <primary><option>envelope_to_remove</option></primary>
62613 </indexterm>
62614 <emphasis>Envelope-to:</emphasis> header lines are not part of the standard RFC 2822 header set.
62615 Exim can be configured to add them to the final delivery of messages. (See the
62616 generic <option>envelope_to_add</option> transport option.) They should not be present in
62617 messages in transit. If the <option>envelope_to_remove</option> configuration option is set
62618 (the default), Exim removes <emphasis>Envelope-to:</emphasis> header lines from incoming
62619 messages.
62620 </para>
62621 </section>
62622 <section id="SECTthefrohea">
62623 <title>The From: header line</title>
62624 <para>
62625 <indexterm role="concept">
62626 <primary><emphasis>From:</emphasis> header line</primary>
62627 </indexterm>
62628 <indexterm role="concept">
62629 <primary>header lines</primary>
62630 <secondary>From:</secondary>
62631 </indexterm>
62632 <indexterm role="concept">
62633 <primary>Sendmail compatibility</primary>
62634 <secondary><quote>From</quote> line</secondary>
62635 </indexterm>
62636 <indexterm role="concept">
62637 <primary>message</primary>
62638 <secondary>submission</secondary>
62639 </indexterm>
62640 <indexterm role="concept">
62641 <primary>submission mode</primary>
62642 </indexterm>
62643 If a submission-mode message does not contain a <emphasis>From:</emphasis> header line, Exim
62644 adds one if either of the following conditions is true:
62645 </para>
62646 <itemizedlist>
62647 <listitem>
62648 <para>
62649 The envelope sender address is not empty (that is, this is not a bounce
62650 message). The added header line copies the envelope sender address.
62651 </para>
62652 </listitem>
62653 <listitem>
62654 <para>
62655 <indexterm role="variable">
62656 <primary><varname>$authenticated_id</varname></primary>
62657 </indexterm>
62658 The SMTP session is authenticated and <varname>$authenticated_id</varname> is not empty.
62659 </para>
62660 <orderedlist numeration="arabic">
62661 <listitem>
62662 <para>
62663 <indexterm role="variable">
62664 <primary><varname>$qualify_domain</varname></primary>
62665 </indexterm>
62666 If no domain is specified by the submission control, the local part is
62667 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
62668 </para>
62669 </listitem>
62670 <listitem>
62671 <para>
62672 If a non-empty domain is specified by the submission control, the local
62673 part is <varname>$authenticated_id</varname>, and the domain is the specified domain.
62674 </para>
62675 </listitem>
62676 <listitem>
62677 <para>
62678 If an empty domain is specified by the submission control,
62679 <varname>$authenticated_id</varname> is assumed to be the complete address.
62680 </para>
62681 </listitem>
62682 </orderedlist>
62683 </listitem>
62684 </itemizedlist>
62685 <para>
62686 A non-empty envelope sender takes precedence.
62687 </para>
62688 <para>
62689 If a locally-generated incoming message does not contain a <emphasis>From:</emphasis> header
62690 line, and the <option>suppress_local_fixups</option> control is not set, Exim adds one
62691 containing the sender&#x2019;s address. The calling user&#x2019;s login name and full name
62692 are used to construct the address, as described in section <xref linkend="SECTconstr"/>.
62693 They are obtained from the password data by calling <function>getpwuid()</function> (but see the
62694 <option>unknown_login</option> configuration option). The address is qualified with
62695 <option>qualify_domain</option>.
62696 </para>
62697 <para>
62698 For compatibility with Sendmail, if an incoming, non-SMTP message has a
62699 <emphasis>From:</emphasis> header line containing just the unqualified login name of the calling
62700 user, this is replaced by an address containing the user&#x2019;s login name and full
62701 name as described in section <xref linkend="SECTconstr"/>.
62702 </para>
62703 </section>
62704 <section id="SECID226">
62705 <title>The Message-ID: header line</title>
62706 <para>
62707 <indexterm role="concept">
62708 <primary><emphasis>Message-ID:</emphasis> header line</primary>
62709 </indexterm>
62710 <indexterm role="concept">
62711 <primary>header lines</primary>
62712 <secondary>Message-ID:</secondary>
62713 </indexterm>
62714 <indexterm role="concept">
62715 <primary>message</primary>
62716 <secondary>submission</secondary>
62717 </indexterm>
62718 <indexterm role="option">
62719 <primary><option>message_id_header_text</option></primary>
62720 </indexterm>
62721 If a locally-generated or submission-mode incoming message does not contain a
62722 <emphasis>Message-ID:</emphasis> or <emphasis>Resent-Message-ID:</emphasis> header line, and the
62723 <option>suppress_local_fixups</option> control is not set, Exim adds a suitable header line
62724 to the message. If there are any <emphasis>Resent-:</emphasis> headers in the message, it
62725 creates <emphasis>Resent-Message-ID:</emphasis>. The id is constructed from Exim&#x2019;s internal
62726 message id, preceded by the letter E to ensure it starts with a letter, and
62727 followed by @ and the primary host name. Additional information can be included
62728 in this header line by setting the <option>message_id_header_text</option> and/or
62729 <option>message_id_header_domain</option> options.
62730 </para>
62731 </section>
62732 <section id="SECID227">
62733 <title>The Received: header line</title>
62734 <para>
62735 <indexterm role="concept">
62736 <primary><emphasis>Received:</emphasis> header line</primary>
62737 </indexterm>
62738 <indexterm role="concept">
62739 <primary>header lines</primary>
62740 <secondary>Received:</secondary>
62741 </indexterm>
62742 A <emphasis>Received:</emphasis> header line is added at the start of every message. The
62743 contents are defined by the <option>received_header_text</option> configuration option, and
62744 Exim automatically adds a semicolon and a timestamp to the configured string.
62745 </para>
62746 <para>
62747 The <emphasis>Received:</emphasis> header is generated as soon as the message&#x2019;s header lines
62748 have been received. At this stage, the timestamp in the <emphasis>Received:</emphasis> header
62749 line is the time that the message started to be received. This is the value
62750 that is seen by the DATA ACL and by the <function>local_scan()</function> function.
62751 </para>
62752 <para>
62753 Once a message is accepted, the timestamp in the <emphasis>Received:</emphasis> header line is
62754 changed to the time of acceptance, which is (apart from a small delay while the
62755 -H spool file is written) the earliest time at which delivery could start.
62756 </para>
62757 </section>
62758 <section id="SECID228">
62759 <title>The References: header line</title>
62760 <para>
62761 <indexterm role="concept">
62762 <primary><emphasis>References:</emphasis> header line</primary>
62763 </indexterm>
62764 <indexterm role="concept">
62765 <primary>header lines</primary>
62766 <secondary>References:</secondary>
62767 </indexterm>
62768 Messages created by the <command>autoreply</command> transport include a <emphasis>References:</emphasis>
62769 header line. This is constructed according to the rules that are described in
62770 section 3.64 of RFC 2822 (which states that replies should contain such a
62771 header line), and section 3.14 of RFC 3834 (which states that automatic
62772 responses are not different in this respect). However, because some mail
62773 processing software does not cope well with very long header lines, no more
62774 than 12 message IDs are copied from the <emphasis>References:</emphasis> header line in the
62775 incoming message. If there are more than 12, the first one and then the final
62776 11 are copied, before adding the message ID of the incoming message.
62777 </para>
62778 </section>
62779 <section id="SECID229">
62780 <title>The Return-path: header line</title>
62781 <para>
62782 <indexterm role="concept">
62783 <primary><emphasis>Return-path:</emphasis> header line</primary>
62784 </indexterm>
62785 <indexterm role="concept">
62786 <primary>header lines</primary>
62787 <secondary>Return-path:</secondary>
62788 </indexterm>
62789 <indexterm role="option">
62790 <primary><option>return_path_remove</option></primary>
62791 </indexterm>
62792 <emphasis>Return-path:</emphasis> header lines are defined as something an MTA may insert when
62793 it does the final delivery of messages. (See the generic <option>return_path_add</option>
62794 transport option.) Therefore, they should not be present in messages in
62795 transit. If the <option>return_path_remove</option> configuration option is set (the
62796 default), Exim removes <emphasis>Return-path:</emphasis> header lines from incoming messages.
62797 </para>
62798 </section>
62799 <section id="SECTthesenhea">
62800 <title>The Sender: header line</title>
62801 <para>
62802 <indexterm role="concept">
62803 <primary><emphasis>Sender:</emphasis> header line</primary>
62804 </indexterm>
62805 <indexterm role="concept">
62806 <primary>message</primary>
62807 <secondary>submission</secondary>
62808 </indexterm>
62809 <indexterm role="concept">
62810 <primary>header lines</primary>
62811 <secondary>Sender:</secondary>
62812 </indexterm>
62813 For a locally-originated message from an untrusted user, Exim may remove an
62814 existing <emphasis>Sender:</emphasis> header line, and it may add a new one. You can modify
62815 these actions by setting the <option>local_sender_retain</option> option true, the
62816 <option>local_from_check</option> option false, or by using the <option>suppress_local_fixups</option>
62817 control setting.
62818 </para>
62819 <para>
62820 When a local message is received from an untrusted user and
62821 <option>local_from_check</option> is true (the default), and the <option>suppress_local_fixups</option>
62822 control has not been set, a check is made to see if the address given in the
62823 <emphasis>From:</emphasis> header line is the correct (local) sender of the message. The address
62824 that is expected has the login name as the local part and the value of
62825 <option>qualify_domain</option> as the domain. Prefixes and suffixes for the local part can
62826 be permitted by setting <option>local_from_prefix</option> and <option>local_from_suffix</option>
62827 appropriately. If <emphasis>From:</emphasis> does not contain the correct sender, a <emphasis>Sender:</emphasis>
62828 line is added to the message.
62829 </para>
62830 <para>
62831 If you set <option>local_from_check</option> false, this checking does not occur. However,
62832 the removal of an existing <emphasis>Sender:</emphasis> line still happens, unless you also set
62833 <option>local_sender_retain</option> to be true. It is not possible to set both of these
62834 options true at the same time.
62835 </para>
62836 <para>
62837 <indexterm role="concept">
62838 <primary>submission mode</primary>
62839 </indexterm>
62840 By default, no processing of <emphasis>Sender:</emphasis> header lines is done for messages
62841 received over TCP/IP or for messages submitted by trusted users. However, when
62842 a message is received over TCP/IP in submission mode, and <option>sender_retain</option> is
62843 not specified on the submission control, the following processing takes place:
62844 </para>
62845 <para>
62846 <indexterm role="variable">
62847 <primary><varname>$authenticated_id</varname></primary>
62848 </indexterm>
62849 First, any existing <emphasis>Sender:</emphasis> lines are removed. Then, if the SMTP session is
62850 authenticated, and <varname>$authenticated_id</varname> is not empty, a sender address is
62851 created as follows:
62852 </para>
62853 <itemizedlist>
62854 <listitem>
62855 <para>
62856 <indexterm role="variable">
62857 <primary><varname>$qualify_domain</varname></primary>
62858 </indexterm>
62859 If no domain is specified by the submission control, the local part is
62860 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
62861 </para>
62862 </listitem>
62863 <listitem>
62864 <para>
62865 If a non-empty domain is specified by the submission control, the local part
62866 is <varname>$authenticated_id</varname>, and the domain is the specified domain.
62867 </para>
62868 </listitem>
62869 <listitem>
62870 <para>
62871 If an empty domain is specified by the submission control,
62872 <varname>$authenticated_id</varname> is assumed to be the complete address.
62873 </para>
62874 </listitem>
62875 </itemizedlist>
62876 <para>
62877 This address is compared with the address in the <emphasis>From:</emphasis> header line. If they
62878 are different, a <emphasis>Sender:</emphasis> header line containing the created address is
62879 added. Prefixes and suffixes for the local part in <emphasis>From:</emphasis> can be permitted
62880 by setting <option>local_from_prefix</option> and <option>local_from_suffix</option> appropriately.
62881 </para>
62882 <para>
62883 <indexterm role="concept">
62884 <primary>return path</primary>
62885 <secondary>created from <emphasis>Sender:</emphasis></secondary>
62886 </indexterm>
62887 <emphasis role="bold">Note</emphasis>: Whenever a <emphasis>Sender:</emphasis> header line is created, the return path for
62888 the message (the envelope sender address) is changed to be the same address,
62889 except in the case of submission mode when <option>sender_retain</option> is specified.
62890 </para>
62891 </section>
62892 <section id="SECTheadersaddrem">
62893 <title>Adding and removing header lines in routers and transports</title>
62894 <para>
62895 <indexterm role="concept">
62896 <primary>header lines</primary>
62897 <secondary>adding; in router or transport</secondary>
62898 </indexterm>
62899 <indexterm role="concept">
62900 <primary>header lines</primary>
62901 <secondary>removing; in router or transport</secondary>
62902 </indexterm>
62903 When a message is delivered, the addition and removal of header lines can be
62904 specified in a system filter, or on any of the routers and transports that
62905 process the message. Section <xref linkend="SECTaddremheasys"/> contains details about
62906 modifying headers in a system filter. Header lines can also be added in an ACL
62907 as a message is received (see section <xref linkend="SECTaddheadacl"/>).
62908 </para>
62909 <para>
62910 In contrast to what happens in a system filter, header modifications that are
62911 specified on routers and transports apply only to the particular recipient
62912 addresses that are being processed by those routers and transports. These
62913 changes do not actually take place until a copy of the message is being
62914 transported. Therefore, they do not affect the basic set of header lines, and
62915 they do not affect the values of the variables that refer to header lines.
62916 </para>
62917 <para>
62918 <emphasis role="bold">Note</emphasis>: In particular, this means that any expansions in the configuration of
62919 the transport cannot refer to the modified header lines, because such
62920 expansions all occur before the message is actually transported.
62921 </para>
62922 <para>
62923 For both routers and transports, the argument of a <option>headers_add</option>
62924 option must be in the form of one or more RFC 2822 header lines, separated by
62925 newlines (coded as <quote>\n</quote>). For example:
62926 </para>
62927 <literallayout class="monospaced">
62928 headers_add = X-added-header: added by $primary_hostname\n\
62929               X-added-second: another added header line
62930 </literallayout>
62931 <para>
62932 Exim does not check the syntax of these added header lines.
62933 </para>
62934 <para>
62935 Multiple <option>headers_add</option> options for a single router or transport can be
62936 specified; the values will append to a single list of header lines.
62937 Each header-line is separately expanded.
62938 </para>
62939 <para>
62940 The argument of a <option>headers_remove</option> option must consist of a colon-separated
62941 list of header names. This is confusing, because header names themselves are
62942 often terminated by colons. In this case, the colons are the list separators,
62943 not part of the names. For example:
62944 </para>
62945 <literallayout class="monospaced">
62946 headers_remove = return-receipt-to:acknowledge-to
62947 </literallayout>
62948 <para>
62949 Multiple <option>headers_remove</option> options for a single router or transport can be
62950 specified; the arguments will append to a single header-names list.
62951 Each item is separately expanded.
62952 Note that colons in complex expansions which are used to
62953 form all or part of a <option>headers_remove</option> list
62954 will act as list separators.
62955 </para>
62956 <para>
62957 When <option>headers_add</option> or <option>headers_remove</option> is specified on a router,
62958 items are expanded at routing time,
62959 and then associated with all addresses that are
62960 accepted by that router, and also with any new addresses that it generates. If
62961 an address passes through several routers as a result of aliasing or
62962 forwarding, the changes are cumulative.
62963 </para>
62964 <para>
62965 <indexterm role="option">
62966 <primary><option>unseen</option></primary>
62967 </indexterm>
62968 However, this does not apply to multiple routers that result from the use of
62969 the <option>unseen</option> option. Any header modifications that were specified by the
62970 <quote>unseen</quote> router or its predecessors apply only to the <quote>unseen</quote> delivery.
62971 </para>
62972 <para>
62973 Addresses that end up with different <option>headers_add</option> or <option>headers_remove</option>
62974 settings cannot be delivered together in a batch, so a transport is always
62975 dealing with a set of addresses that have the same header-processing
62976 requirements.
62977 </para>
62978 <para>
62979 The transport starts by writing the original set of header lines that arrived
62980 with the message, possibly modified by the system filter. As it writes out
62981 these lines, it consults the list of header names that were attached to the
62982 recipient address(es) by <option>headers_remove</option> options in routers, and it also
62983 consults the transport&#x2019;s own <option>headers_remove</option> option. Header lines whose
62984 names are on either of these lists are not written out. If there are multiple
62985 instances of any listed header, they are all skipped.
62986 </para>
62987 <para>
62988 After the remaining original header lines have been written, new header
62989 lines that were specified by routers&#x2019; <option>headers_add</option> options are written, in
62990 the order in which they were attached to the address. These are followed by any
62991 header lines specified by the transport&#x2019;s <option>headers_add</option> option.
62992 </para>
62993 <para>
62994 This way of handling header line modifications in routers and transports has
62995 the following consequences:
62996 </para>
62997 <itemizedlist>
62998 <listitem>
62999 <para>
63000 The original set of header lines, possibly modified by the system filter,
63001 remains <quote>visible</quote>, in the sense that the <varname>$header_</varname><emphasis>xxx</emphasis> variables refer
63002 to it, at all times.
63003 </para>
63004 </listitem>
63005 <listitem>
63006 <para>
63007 Header lines that are added by a router&#x2019;s
63008 <option>headers_add</option> option are not accessible by means of the <varname>$header_</varname><emphasis>xxx</emphasis>
63009 expansion syntax in subsequent routers or the transport.
63010 </para>
63011 </listitem>
63012 <listitem>
63013 <para>
63014 Conversely, header lines that are specified for removal by <option>headers_remove</option>
63015 in a router remain visible to subsequent routers and the transport.
63016 </para>
63017 </listitem>
63018 <listitem>
63019 <para>
63020 Headers added to an address by <option>headers_add</option> in a router cannot be removed by
63021 a later router or by a transport.
63022 </para>
63023 </listitem>
63024 <listitem>
63025 <para>
63026 An added header can refer to the contents of an original header that is to be
63027 removed, even it has the same name as the added header. For example:
63028 </para>
63029 <literallayout class="monospaced">
63030 headers_remove = subject
63031 headers_add = Subject: new subject (was: $h_subject:)
63032 </literallayout>
63033 </listitem>
63034 </itemizedlist>
63035 <para>
63036 <emphasis role="bold">Warning</emphasis>: The <option>headers_add</option> and <option>headers_remove</option> options cannot be used
63037 for a <command>redirect</command> router that has the <option>one_time</option> option set.
63038 </para>
63039 </section>
63040 <section id="SECTconstr">
63041 <title>Constructed addresses</title>
63042 <para>
63043 <indexterm role="concept">
63044 <primary>address</primary>
63045 <secondary>constructed</secondary>
63046 </indexterm>
63047 <indexterm role="concept">
63048 <primary>constructed address</primary>
63049 </indexterm>
63050 When Exim constructs a sender address for a locally-generated message, it uses
63051 the form
63052 </para>
63053 <literallayout>
63054 &lt;<emphasis>user name</emphasis>&gt;&nbsp;&nbsp;&lt;<emphasis>login</emphasis><literal>@</literal><emphasis>qualify_domain</emphasis>&gt;
63055 </literallayout>
63056 <para>
63057 For example:
63058 </para>
63059 <literallayout class="monospaced">
63060 Zaphod Beeblebrox &lt;zaphod@end.univ.example&gt;
63061 </literallayout>
63062 <para>
63063 The user name is obtained from the <option>-F</option> command line option if set, or
63064 otherwise by looking up the calling user by <function>getpwuid()</function> and extracting the
63065 <quote>gecos</quote> field from the password entry. If the <quote>gecos</quote> field contains an
63066 ampersand character, this is replaced by the login name with the first letter
63067 upper cased, as is conventional in a number of operating systems. See the
63068 <option>gecos_name</option> option for a way to tailor the handling of the <quote>gecos</quote> field.
63069 The <option>unknown_username</option> option can be used to specify user names in cases when
63070 there is no password file entry.
63071 </para>
63072 <para>
63073 <indexterm role="concept">
63074 <primary>RFC 2047</primary>
63075 </indexterm>
63076 In all cases, the user name is made to conform to RFC 2822 by quoting all or
63077 parts of it if necessary. In addition, if it contains any non-printing
63078 characters, it is encoded as described in RFC 2047, which defines a way of
63079 including non-ASCII characters in header lines. The value of the
63080 <option>headers_charset</option> option specifies the name of the encoding that is used (the
63081 characters are assumed to be in this encoding). The setting of
63082 <option>print_topbitchars</option> controls whether characters with the top bit set (that
63083 is, with codes greater than 127) count as printing characters or not.
63084 </para>
63085 </section>
63086 <section id="SECID230">
63087 <title>Case of local parts</title>
63088 <para>
63089 <indexterm role="concept">
63090 <primary>case of local parts</primary>
63091 </indexterm>
63092 <indexterm role="concept">
63093 <primary>local part</primary>
63094 <secondary>case of</secondary>
63095 </indexterm>
63096 RFC 2822 states that the case of letters in the local parts of addresses cannot
63097 be assumed to be non-significant. Exim preserves the case of local parts of
63098 addresses, but by default it uses a lower-cased form when it is routing,
63099 because on most Unix systems, usernames are in lower case and case-insensitive
63100 routing is required. However, any particular router can be made to use the
63101 original case for local parts by setting the <option>caseful_local_part</option> generic
63102 router option.
63103 </para>
63104 <para>
63105 <indexterm role="concept">
63106 <primary>mixed-case login names</primary>
63107 </indexterm>
63108 If you must have mixed-case user names on your system, the best way to proceed,
63109 assuming you want case-independent handling of incoming email, is to set up
63110 your first router to convert incoming local parts in your domains to the
63111 correct case by means of a file lookup. For example:
63112 </para>
63113 <literallayout class="monospaced">
63114 correct_case:
63115   driver = redirect
63116   domains = +local_domains
63117   data = ${lookup{$local_part}cdb\
63118               {/etc/usercased.cdb}{$value}fail}\
63119               @$domain
63120 </literallayout>
63121 <para>
63122 For this router, the local part is forced to lower case by the default action
63123 (<option>caseful_local_part</option> is not set). The lower-cased local part is used to look
63124 up a new local part in the correct case. If you then set <option>caseful_local_part</option>
63125 on any subsequent routers which process your domains, they will operate on
63126 local parts with the correct case in a case-sensitive manner.
63127 </para>
63128 </section>
63129 <section id="SECID231">
63130 <title>Dots in local parts</title>
63131 <para>
63132 <indexterm role="concept">
63133 <primary>dot</primary>
63134 <secondary>in local part</secondary>
63135 </indexterm>
63136 <indexterm role="concept">
63137 <primary>local part</primary>
63138 <secondary>dots in</secondary>
63139 </indexterm>
63140 RFC 2822 forbids empty components in local parts. That is, an unquoted local
63141 part may not begin or end with a dot, nor have two consecutive dots in the
63142 middle. However, it seems that many MTAs do not enforce this, so Exim permits
63143 empty components for compatibility.
63144 </para>
63145 </section>
63146 <section id="SECID232">
63147 <title>Rewriting addresses</title>
63148 <para>
63149 <indexterm role="concept">
63150 <primary>rewriting</primary>
63151 <secondary>addresses</secondary>
63152 </indexterm>
63153 Rewriting of sender and recipient addresses, and addresses in headers, can
63154 happen automatically, or as the result of configuration options, as described
63155 in chapter <xref linkend="CHAPrewrite"/>. The headers that may be affected by this are
63156 <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>.
63157 </para>
63158 <para>
63159 Automatic rewriting includes qualification, as mentioned above. The other case
63160 in which it can happen is when an incomplete non-local domain is given. The
63161 routing process may cause this to be expanded into the full domain name. For
63162 example, a header such as
63163 </para>
63164 <literallayout class="monospaced">
63165 To: hare@teaparty
63166 </literallayout>
63167 <para>
63168 might get rewritten as
63169 </para>
63170 <literallayout class="monospaced">
63171 To: hare@teaparty.wonderland.fict.example
63172 </literallayout>
63173 <para>
63174 Rewriting as a result of routing is the one kind of message processing that
63175 does not happen at input time, as it cannot be done until the address has
63176 been routed.
63177 </para>
63178 <para>
63179 Strictly, one should not do <emphasis>any</emphasis> deliveries of a message until all its
63180 addresses have been routed, in case any of the headers get changed as a
63181 result of routing. However, doing this in practice would hold up many
63182 deliveries for unreasonable amounts of time, just because one address could not
63183 immediately be routed. Exim therefore does not delay other deliveries when
63184 routing of one or more addresses is deferred.
63185 <indexterm role="concept" startref="IIDmesproc" class="endofrange"/>
63186 </para>
63187 </section>
63188 </chapter>
63189
63190 <chapter id="CHAPSMTP">
63191 <title>SMTP processing</title>
63192 <para>
63193 <indexterm role="concept" id="IIDsmtpproc1" class="startofrange">
63194 <primary>SMTP</primary>
63195 <secondary>processing details</secondary>
63196 </indexterm>
63197 <indexterm role="concept" id="IIDsmtpproc2" class="startofrange">
63198 <primary>LMTP</primary>
63199 <secondary>processing details</secondary>
63200 </indexterm>
63201 Exim supports a number of different ways of using the SMTP protocol, and its
63202 LMTP variant, which is an interactive protocol for transferring messages into a
63203 closed mail store application. This chapter contains details of how SMTP is
63204 processed. For incoming mail, the following are available:
63205 </para>
63206 <itemizedlist>
63207 <listitem>
63208 <para>
63209 SMTP over TCP/IP (Exim daemon or <emphasis>inetd</emphasis>);
63210 </para>
63211 </listitem>
63212 <listitem>
63213 <para>
63214 SMTP over the standard input and output (the <option>-bs</option> option);
63215 </para>
63216 </listitem>
63217 <listitem>
63218 <para>
63219 Batched SMTP on the standard input (the <option>-bS</option> option).
63220 </para>
63221 </listitem>
63222 </itemizedlist>
63223 <para>
63224 For mail delivery, the following are available:
63225 </para>
63226 <itemizedlist>
63227 <listitem>
63228 <para>
63229 SMTP over TCP/IP (the <command>smtp</command> transport);
63230 </para>
63231 </listitem>
63232 <listitem>
63233 <para>
63234 LMTP over TCP/IP (the <command>smtp</command> transport with the <option>protocol</option> option set to
63235 <quote>lmtp</quote>);
63236 </para>
63237 </listitem>
63238 <listitem>
63239 <para>
63240 LMTP over a pipe to a process running in the local host (the <command>lmtp</command>
63241 transport);
63242 </para>
63243 </listitem>
63244 <listitem>
63245 <para>
63246 Batched SMTP to a file or pipe (the <command>appendfile</command> and <command>pipe</command> transports with
63247 the <option>use_bsmtp</option> option set).
63248 </para>
63249 </listitem>
63250 </itemizedlist>
63251 <para>
63252 <emphasis>Batched SMTP</emphasis> is the name for a process in which batches of messages are
63253 stored in or read from files (or pipes), in a format in which SMTP commands are
63254 used to contain the envelope information.
63255 </para>
63256 <section id="SECToutSMTPTCP">
63257 <title>Outgoing SMTP and LMTP over TCP/IP</title>
63258 <para>
63259 <indexterm role="concept">
63260 <primary>SMTP</primary>
63261 <secondary>outgoing over TCP/IP</secondary>
63262 </indexterm>
63263 <indexterm role="concept">
63264 <primary>outgoing SMTP over TCP/IP</primary>
63265 </indexterm>
63266 <indexterm role="concept">
63267 <primary>LMTP</primary>
63268 <secondary>over TCP/IP</secondary>
63269 </indexterm>
63270 <indexterm role="concept">
63271 <primary>outgoing LMTP over TCP/IP</primary>
63272 </indexterm>
63273 <indexterm role="concept">
63274 <primary>EHLO</primary>
63275 </indexterm>
63276 <indexterm role="concept">
63277 <primary>HELO</primary>
63278 </indexterm>
63279 <indexterm role="concept">
63280 <primary>SIZE option on MAIL command</primary>
63281 </indexterm>
63282 Outgoing SMTP and LMTP over TCP/IP is implemented by the <command>smtp</command> transport.
63283 The <option>protocol</option> option selects which protocol is to be used, but the actual
63284 processing is the same in both cases.
63285 </para>
63286 <para>
63287 If, in response to its EHLO command, Exim is told that the SIZE
63288 parameter is supported, it adds SIZE=&lt;<emphasis>n</emphasis>&gt; to each subsequent MAIL
63289 command. The value of &lt;<emphasis>n</emphasis>&gt; is the message size plus the value of the
63290 <option>size_addition</option> option (default 1024) to allow for additions to the message
63291 such as per-transport header lines, or changes made in a
63292 <indexterm role="concept">
63293 <primary>transport</primary>
63294 <secondary>filter</secondary>
63295 </indexterm>
63296 <indexterm role="concept">
63297 <primary>filter</primary>
63298 <secondary>transport filter</secondary>
63299 </indexterm>
63300 transport filter. If <option>size_addition</option> is set negative, the use of SIZE is
63301 suppressed.
63302 </para>
63303 <para>
63304 If the remote server advertises support for PIPELINING, Exim uses the
63305 pipelining extension to SMTP (RFC 2197) to reduce the number of TCP/IP packets
63306 required for the transaction.
63307 </para>
63308 <para>
63309 If the remote server advertises support for the STARTTLS command, and Exim
63310 was built to support TLS encryption, it tries to start a TLS session unless the
63311 server matches <option>hosts_avoid_tls</option>. See chapter <xref linkend="CHAPTLS"/> for more details.
63312 Either a match in that or <option>hosts_verify_avoid_tls</option> apply when the transport
63313 is called for verification.
63314 </para>
63315 <para>
63316 If the remote server advertises support for the AUTH command, Exim scans
63317 the authenticators configuration for any suitable client settings, as described
63318 in chapter <xref linkend="CHAPSMTPAUTH"/>.
63319 </para>
63320 <para>
63321 <indexterm role="concept">
63322 <primary>carriage return</primary>
63323 </indexterm>
63324 <indexterm role="concept">
63325 <primary>linefeed</primary>
63326 </indexterm>
63327 Responses from the remote host are supposed to be terminated by CR followed by
63328 LF. However, there are known to be hosts that do not send CR characters, so in
63329 order to be able to interwork with such hosts, Exim treats LF on its own as a
63330 line terminator.
63331 </para>
63332 <para>
63333 If a message contains a number of different addresses, all those with the same
63334 characteristics (for example, the same envelope sender) that resolve to the
63335 same set of hosts, in the same order, are sent in a single SMTP transaction,
63336 even if they are for different domains, unless there are more than the setting
63337 of the <option>max_rcpt</option>s option in the <command>smtp</command> transport allows, in which case
63338 they are split into groups containing no more than <option>max_rcpt</option>s addresses
63339 each. If <option>remote_max_parallel</option> is greater than one, such groups may be sent
63340 in parallel sessions. The order of hosts with identical MX values is not
63341 significant when checking whether addresses can be batched in this way.
63342 </para>
63343 <para>
63344 When the <command>smtp</command> transport suffers a temporary failure that is not
63345 message-related, Exim updates its transport-specific database, which contains
63346 records indexed by host name that remember which messages are waiting for each
63347 particular host. It also updates the retry database with new retry times.
63348 </para>
63349 <para>
63350 <indexterm role="concept">
63351 <primary>hints database</primary>
63352 <secondary>retry keys</secondary>
63353 </indexterm>
63354 Exim&#x2019;s retry hints are based on host name plus IP address, so if one address of
63355 a multi-homed host is broken, it will soon be skipped most of the time.
63356 See the next section for more detail about error handling.
63357 </para>
63358 <para>
63359 <indexterm role="concept">
63360 <primary>SMTP</primary>
63361 <secondary>passed connection</secondary>
63362 </indexterm>
63363 <indexterm role="concept">
63364 <primary>SMTP</primary>
63365 <secondary>batching over TCP/IP</secondary>
63366 </indexterm>
63367 When a message is successfully delivered over a TCP/IP SMTP connection, Exim
63368 looks in the hints database for the transport to see if there are any queued
63369 messages waiting for the host to which it is connected. If it finds one, it
63370 creates a new Exim process using the <option>-MC</option> option (which can only be used by
63371 a process running as root or the Exim user) and passes the TCP/IP socket to it
63372 so that it can deliver another message using the same socket. The new process
63373 does only those deliveries that are routed to the connected host, and may in
63374 turn pass the socket on to a third process, and so on.
63375 </para>
63376 <para>
63377 The <option>connection_max_messages</option> option of the <command>smtp</command> transport can be used to
63378 limit the number of messages sent down a single TCP/IP connection.
63379 </para>
63380 <para>
63381 <indexterm role="concept">
63382 <primary>asterisk</primary>
63383 <secondary>after IP address</secondary>
63384 </indexterm>
63385 The second and subsequent messages delivered down an existing connection are
63386 identified in the main log by the addition of an asterisk after the closing
63387 square bracket of the IP address.
63388 </para>
63389 </section>
63390 <section id="SECToutSMTPerr">
63391 <title>Errors in outgoing SMTP</title>
63392 <para>
63393 <indexterm role="concept">
63394 <primary>error</primary>
63395 <secondary>in outgoing SMTP</secondary>
63396 </indexterm>
63397 <indexterm role="concept">
63398 <primary>SMTP</primary>
63399 <secondary>errors in outgoing</secondary>
63400 </indexterm>
63401 <indexterm role="concept">
63402 <primary>host</primary>
63403 <secondary>error</secondary>
63404 </indexterm>
63405 Three different kinds of error are recognized for outgoing SMTP: host errors,
63406 message errors, and recipient errors.
63407 </para>
63408 <variablelist>
63409 <varlistentry>
63410 <term><emphasis role="bold">Host errors</emphasis></term>
63411 <listitem>
63412 <para>
63413 A host error is not associated with a particular message or with a
63414 particular recipient of a message. The host errors are:
63415 </para>
63416 <itemizedlist>
63417 <listitem>
63418 <para>
63419 Connection refused or timed out,
63420 </para>
63421 </listitem>
63422 <listitem>
63423 <para>
63424 Any error response code on connection,
63425 </para>
63426 </listitem>
63427 <listitem>
63428 <para>
63429 Any error response code to EHLO or HELO,
63430 </para>
63431 </listitem>
63432 <listitem>
63433 <para>
63434 Loss of connection at any time, except after <quote>.</quote>,
63435 </para>
63436 </listitem>
63437 <listitem>
63438 <para>
63439 I/O errors at any time,
63440 </para>
63441 </listitem>
63442 <listitem>
63443 <para>
63444 Timeouts during the session, other than in response to MAIL, RCPT or
63445 the <quote>.</quote> at the end of the data.
63446 </para>
63447 </listitem>
63448 </itemizedlist>
63449 <para>
63450 For a host error, a permanent error response on connection, or in response to
63451 EHLO, causes all addresses routed to the host to be failed. Any other host
63452 error causes all addresses to be deferred, and retry data to be created for the
63453 host. It is not tried again, for any message, until its retry time arrives. If
63454 the current set of addresses are not all delivered in this run (to some
63455 alternative host), the message is added to the list of those waiting for this
63456 host, so if it is still undelivered when a subsequent successful delivery is
63457 made to the host, it will be sent down the same SMTP connection.
63458 </para>
63459 </listitem></varlistentry>
63460 <varlistentry>
63461 <term><emphasis role="bold">Message errors</emphasis></term>
63462 <listitem>
63463 <para>
63464 <indexterm role="concept">
63465 <primary>message</primary>
63466 <secondary>error</secondary>
63467 </indexterm>
63468 A message error is associated with a particular message when sent to a
63469 particular host, but not with a particular recipient of the message. The
63470 message errors are:
63471 </para>
63472 <itemizedlist>
63473 <listitem>
63474 <para>
63475 Any error response code to MAIL, DATA, or the <quote>.</quote> that terminates
63476 the data,
63477 </para>
63478 </listitem>
63479 <listitem>
63480 <para>
63481 Timeout after MAIL,
63482 </para>
63483 </listitem>
63484 <listitem>
63485 <para>
63486 Timeout or loss of connection after the <quote>.</quote> that terminates the data. A
63487 timeout after the DATA command itself is treated as a host error, as is loss of
63488 connection at any other time.
63489 </para>
63490 </listitem>
63491 </itemizedlist>
63492 <para>
63493 For a message error, a permanent error response (5<emphasis>xx</emphasis>) causes all addresses
63494 to be failed, and a delivery error report to be returned to the sender. A
63495 temporary error response (4<emphasis>xx</emphasis>), or one of the timeouts, causes all
63496 addresses to be deferred. Retry data is not created for the host, but instead,
63497 a retry record for the combination of host plus message id is created. The
63498 message is not added to the list of those waiting for this host. This ensures
63499 that the failing message will not be sent to this host again until the retry
63500 time arrives. However, other messages that are routed to the host are not
63501 affected, so if it is some property of the message that is causing the error,
63502 it will not stop the delivery of other mail.
63503 </para>
63504 <para>
63505 If the remote host specified support for the SIZE parameter in its response
63506 to EHLO, Exim adds SIZE=<emphasis>nnn</emphasis> to the MAIL command, so an
63507 over-large message will cause a message error because the error arrives as a
63508 response to MAIL.
63509 </para>
63510 </listitem></varlistentry>
63511 <varlistentry>
63512 <term><emphasis role="bold">Recipient errors</emphasis></term>
63513 <listitem>
63514 <para>
63515 <indexterm role="concept">
63516 <primary>recipient</primary>
63517 <secondary>error</secondary>
63518 </indexterm>
63519 A recipient error is associated with a particular recipient of a message. The
63520 recipient errors are:
63521 </para>
63522 <itemizedlist>
63523 <listitem>
63524 <para>
63525 Any error response to RCPT,
63526 </para>
63527 </listitem>
63528 <listitem>
63529 <para>
63530 Timeout after RCPT.
63531 </para>
63532 </listitem>
63533 </itemizedlist>
63534 <para>
63535 For a recipient error, a permanent error response (5<emphasis>xx</emphasis>) causes the
63536 recipient address to be failed, and a bounce message to be returned to the
63537 sender. A temporary error response (4<emphasis>xx</emphasis>) or a timeout causes the failing
63538 address to be deferred, and routing retry data to be created for it. This is
63539 used to delay processing of the address in subsequent queue runs, until its
63540 routing retry time arrives. This applies to all messages, but because it
63541 operates only in queue runs, one attempt will be made to deliver a new message
63542 to the failing address before the delay starts to operate. This ensures that,
63543 if the failure is really related to the message rather than the recipient
63544 (<quote>message too big for this recipient</quote> is a possible example), other messages
63545 have a chance of getting delivered. If a delivery to the address does succeed,
63546 the retry information gets cleared, so all stuck messages get tried again, and
63547 the retry clock is reset.
63548 </para>
63549 <para>
63550 The message is not added to the list of those waiting for this host. Use of the
63551 host for other messages is unaffected, and except in the case of a timeout,
63552 other recipients are processed independently, and may be successfully delivered
63553 in the current SMTP session. After a timeout it is of course impossible to
63554 proceed with the session, so all addresses get deferred. However, those other
63555 than the one that failed do not suffer any subsequent retry delays. Therefore,
63556 if one recipient is causing trouble, the others have a chance of getting
63557 through when a subsequent delivery attempt occurs before the failing
63558 recipient&#x2019;s retry time.
63559 </para>
63560 </listitem></varlistentry>
63561 </variablelist>
63562 <para>
63563 In all cases, if there are other hosts (or IP addresses) available for the
63564 current set of addresses (for example, from multiple MX records), they are
63565 tried in this run for any undelivered addresses, subject of course to their
63566 own retry data. In other words, recipient error retry data does not take effect
63567 until the next delivery attempt.
63568 </para>
63569 <para>
63570 Some hosts have been observed to give temporary error responses to every
63571 MAIL command at certain times (<quote>insufficient space</quote> has been seen). It
63572 would be nice if such circumstances could be recognized, and defer data for the
63573 host itself created, but this is not possible within the current Exim design.
63574 What actually happens is that retry data for every (host, message) combination
63575 is created.
63576 </para>
63577 <para>
63578 The reason that timeouts after MAIL and RCPT are treated specially is that
63579 these can sometimes arise as a result of the remote host&#x2019;s verification
63580 procedures. Exim makes this assumption, and treats them as if a temporary error
63581 response had been received. A timeout after <quote>.</quote> is treated specially because
63582 it is known that some broken implementations fail to recognize the end of the
63583 message if the last character of the last line is a binary zero. Thus, it is
63584 helpful to treat this case as a message error.
63585 </para>
63586 <para>
63587 Timeouts at other times are treated as host errors, assuming a problem with the
63588 host, or the connection to it. If a timeout after MAIL, RCPT,
63589 or <quote>.</quote> is really a connection problem, the assumption is that at the next try
63590 the timeout is likely to occur at some other point in the dialogue, causing it
63591 then to be treated as a host error.
63592 </para>
63593 <para>
63594 There is experimental evidence that some MTAs drop the connection after the
63595 terminating <quote>.</quote> if they do not like the contents of the message for some
63596 reason, in contravention of the RFC, which indicates that a 5<emphasis>xx</emphasis> response
63597 should be given. That is why Exim treats this case as a message rather than a
63598 host error, in order not to delay other messages to the same host.
63599 </para>
63600 </section>
63601 <section id="SECID233">
63602 <title>Incoming SMTP messages over TCP/IP</title>
63603 <para>
63604 <indexterm role="concept">
63605 <primary>SMTP</primary>
63606 <secondary>incoming over TCP/IP</secondary>
63607 </indexterm>
63608 <indexterm role="concept">
63609 <primary>incoming SMTP over TCP/IP</primary>
63610 </indexterm>
63611 <indexterm role="concept">
63612 <primary>inetd</primary>
63613 </indexterm>
63614 <indexterm role="concept">
63615 <primary>daemon</primary>
63616 </indexterm>
63617 Incoming SMTP messages can be accepted in one of two ways: by running a
63618 listening daemon, or by using <emphasis>inetd</emphasis>. In the latter case, the entry in
63619 <filename>/etc/inetd.conf</filename> should be like this:
63620 </para>
63621 <literallayout class="monospaced">
63622 smtp stream tcp nowait exim /opt/exim/bin/exim in.exim -bs
63623 </literallayout>
63624 <para>
63625 Exim distinguishes between this case and the case of a locally running user
63626 agent using the <option>-bs</option> option by checking whether or not the standard input is
63627 a socket. When it is, either the port must be privileged (less than 1024), or
63628 the caller must be root or the Exim user. If any other user passes a socket
63629 with an unprivileged port number, Exim prints a message on the standard error
63630 stream and exits with an error code.
63631 </para>
63632 <para>
63633 By default, Exim does not make a log entry when a remote host connects or
63634 disconnects (either via the daemon or <emphasis>inetd</emphasis>), unless the disconnection is
63635 unexpected. It can be made to write such log entries by setting the
63636 <option>smtp_connection</option> log selector.
63637 </para>
63638 <para>
63639 <indexterm role="concept">
63640 <primary>carriage return</primary>
63641 </indexterm>
63642 <indexterm role="concept">
63643 <primary>linefeed</primary>
63644 </indexterm>
63645 Commands from the remote host are supposed to be terminated by CR followed by
63646 LF. However, there are known to be hosts that do not send CR characters. In
63647 order to be able to interwork with such hosts, Exim treats LF on its own as a
63648 line terminator.
63649 Furthermore, because common code is used for receiving messages from all
63650 sources, a CR on its own is also interpreted as a line terminator. However, the
63651 sequence <quote>CR, dot, CR</quote> does not terminate incoming SMTP data.
63652 </para>
63653 <para>
63654 <indexterm role="concept">
63655 <primary>EHLO</primary>
63656 <secondary>invalid data</secondary>
63657 </indexterm>
63658 <indexterm role="concept">
63659 <primary>HELO</primary>
63660 <secondary>invalid data</secondary>
63661 </indexterm>
63662 One area that sometimes gives rise to problems concerns the EHLO or
63663 HELO commands. Some clients send syntactically invalid versions of these
63664 commands, which Exim rejects by default. (This is nothing to do with verifying
63665 the data that is sent, so <option>helo_verify_hosts</option> is not relevant.) You can tell
63666 Exim not to apply a syntax check by setting <option>helo_accept_junk_hosts</option> to
63667 match the broken hosts that send invalid commands.
63668 </para>
63669 <para>
63670 <indexterm role="concept">
63671 <primary>SIZE option on MAIL command</primary>
63672 </indexterm>
63673 <indexterm role="concept">
63674 <primary>MAIL</primary>
63675 <secondary>SIZE option</secondary>
63676 </indexterm>
63677 The amount of disk space available is checked whenever SIZE is received on
63678 a MAIL command, independently of whether <option>message_size_limit</option> or
63679 <option>check_spool_space</option> is configured, unless <option>smtp_check_spool_space</option> is set
63680 false. A temporary error is given if there is not enough space. If
63681 <option>check_spool_space</option> is set, the check is for that amount of space plus the
63682 value given with SIZE, that is, it checks that the addition of the incoming
63683 message will not reduce the space below the threshold.
63684 </para>
63685 <para>
63686 When a message is successfully received, Exim includes the local message id in
63687 its response to the final <quote>.</quote> that terminates the data. If the remote host
63688 logs this text it can help with tracing what has happened to a message.
63689 </para>
63690 <para>
63691 The Exim daemon can limit the number of simultaneous incoming connections it is
63692 prepared to handle (see the <option>smtp_accept_max</option> option). It can also limit the
63693 number of simultaneous incoming connections from a single remote host (see the
63694 <option>smtp_accept_max_per_host</option> option). Additional connection attempts are
63695 rejected using the SMTP temporary error code 421.
63696 </para>
63697 <para>
63698 The Exim daemon does not rely on the SIGCHLD signal to detect when a
63699 subprocess has finished, as this can get lost at busy times. Instead, it looks
63700 for completed subprocesses every time it wakes up. Provided there are other
63701 things happening (new incoming calls, starts of queue runs), completed
63702 processes will be noticed and tidied away. On very quiet systems you may
63703 sometimes see a <quote>defunct</quote> Exim process hanging about. This is not a problem;
63704 it will be noticed when the daemon next wakes up.
63705 </para>
63706 <para>
63707 When running as a daemon, Exim can reserve some SMTP slots for specific hosts,
63708 and can also be set up to reject SMTP calls from non-reserved hosts at times of
63709 high system load &ndash; for details see the <option>smtp_accept_reserve</option>,
63710 <option>smtp_load_reserve</option>, and <option>smtp_reserve_hosts</option> options. The load check
63711 applies in both the daemon and <emphasis>inetd</emphasis> cases.
63712 </para>
63713 <para>
63714 Exim normally starts a delivery process for each message received, though this
63715 can be varied by means of the <option>-odq</option> command line option and the
63716 <option>queue_only</option>, <option>queue_only_file</option>, and <option>queue_only_load</option> options. The
63717 number of simultaneously running delivery processes started in this way from
63718 SMTP input can be limited by the <option>smtp_accept_queue</option> and
63719 <option>smtp_accept_queue_per_connection</option> options. When either limit is reached,
63720 subsequently received messages are just put on the input queue without starting
63721 a delivery process.
63722 </para>
63723 <para>
63724 The controls that involve counts of incoming SMTP calls (<option>smtp_accept_max</option>,
63725 <option>smtp_accept_queue</option>, <option>smtp_accept_reserve</option>) are not available when Exim is
63726 started up from the <emphasis>inetd</emphasis> daemon, because in that case each connection is
63727 handled by an entirely independent Exim process. Control by load average is,
63728 however, available with <emphasis>inetd</emphasis>.
63729 </para>
63730 <para>
63731 Exim can be configured to verify addresses in incoming SMTP commands as they
63732 are received. See chapter <xref linkend="CHAPACL"/> for details. It can also be configured
63733 to rewrite addresses at this time &ndash; before any syntax checking is done. See
63734 section <xref linkend="SECTrewriteS"/>.
63735 </para>
63736 <para>
63737 Exim can also be configured to limit the rate at which a client host submits
63738 MAIL and RCPT commands in a single SMTP session. See the
63739 <option>smtp_ratelimit_hosts</option> option.
63740 </para>
63741 </section>
63742 <section id="SECID234">
63743 <title>Unrecognized SMTP commands</title>
63744 <para>
63745 <indexterm role="concept">
63746 <primary>SMTP</primary>
63747 <secondary>unrecognized commands</secondary>
63748 </indexterm>
63749 If Exim receives more than <option>smtp_max_unknown_commands</option> unrecognized SMTP
63750 commands during a single SMTP connection, it drops the connection after sending
63751 the error response to the last command. The default value for
63752 <option>smtp_max_unknown_commands</option> is 3. This is a defence against some kinds of
63753 abuse that subvert web servers into making connections to SMTP ports; in these
63754 circumstances, a number of non-SMTP lines are sent first.
63755 </para>
63756 </section>
63757 <section id="SECID235">
63758 <title>Syntax and protocol errors in SMTP commands</title>
63759 <para>
63760 <indexterm role="concept">
63761 <primary>SMTP</primary>
63762 <secondary>syntax errors</secondary>
63763 </indexterm>
63764 <indexterm role="concept">
63765 <primary>SMTP</primary>
63766 <secondary>protocol errors</secondary>
63767 </indexterm>
63768 A syntax error is detected if an SMTP command is recognized, but there is
63769 something syntactically wrong with its data, for example, a malformed email
63770 address in a RCPT command. Protocol errors include invalid command
63771 sequencing such as RCPT before MAIL. If Exim receives more than
63772 <option>smtp_max_synprot_errors</option> such commands during a single SMTP connection, it
63773 drops the connection after sending the error response to the last command. The
63774 default value for <option>smtp_max_synprot_errors</option> is 3. This is a defence against
63775 broken clients that loop sending bad commands (yes, it has been seen).
63776 </para>
63777 </section>
63778 <section id="SECID236">
63779 <title>Use of non-mail SMTP commands</title>
63780 <para>
63781 <indexterm role="concept">
63782 <primary>SMTP</primary>
63783 <secondary>non-mail commands</secondary>
63784 </indexterm>
63785 The <quote>non-mail</quote> SMTP commands are those other than MAIL, RCPT, and
63786 DATA. Exim counts such commands, and drops the connection if there are too
63787 many of them in a single SMTP session. This action catches some
63788 denial-of-service attempts and things like repeated failing AUTHs, or a mad
63789 client looping sending EHLO. The global option <option>smtp_accept_max_nonmail</option>
63790 defines what <quote>too many</quote> means. Its default value is 10.
63791 </para>
63792 <para>
63793 When a new message is expected, one occurrence of RSET is not counted. This
63794 allows a client to send one RSET between messages (this is not necessary,
63795 but some clients do it). Exim also allows one uncounted occurrence of HELO
63796 or EHLO, and one occurrence of STARTTLS between messages. After
63797 starting up a TLS session, another EHLO is expected, and so it too is not
63798 counted.
63799 </para>
63800 <para>
63801 The first occurrence of AUTH in a connection, or immediately following
63802 STARTTLS is also not counted. Otherwise, all commands other than MAIL,
63803 RCPT, DATA, and QUIT are counted.
63804 </para>
63805 <para>
63806 You can control which hosts are subject to the limit set by
63807 <option>smtp_accept_max_nonmail</option> by setting
63808 <option>smtp_accept_max_nonmail_hosts</option>. The default value is <literal>*</literal>, which makes
63809 the limit apply to all hosts. This option means that you can exclude any
63810 specific badly-behaved hosts that you have to live with.
63811 </para>
63812 </section>
63813 <section id="SECID237">
63814 <title>The VRFY and EXPN commands</title>
63815 <para>
63816 When Exim receives a VRFY or EXPN command on a TCP/IP connection, it
63817 runs the ACL specified by <option>acl_smtp_vrfy</option> or <option>acl_smtp_expn</option> (as
63818 appropriate) in order to decide whether the command should be accepted or not.
63819 </para>
63820 <para>
63821 <indexterm role="concept">
63822 <primary>VRFY</primary>
63823 <secondary>processing</secondary>
63824 </indexterm>
63825 When no ACL is defined for VRFY, or if it rejects without
63826 setting an explicit response code, the command is accepted
63827 (with a 252 SMTP response code)
63828 in order to support awkward clients that do a VRFY before every RCPT.
63829 When VRFY is accepted, it runs exactly the same code as when Exim is
63830 called with the <option>-bv</option> option, and returns 250/451/550
63831 SMTP response codes.
63832 </para>
63833 <para>
63834 <indexterm role="concept">
63835 <primary>EXPN</primary>
63836 <secondary>processing</secondary>
63837 </indexterm>
63838 If no ACL for EXPN is defined, the command is rejected.
63839 When EXPN is accepted, a single-level expansion of the address is done.
63840 EXPN is treated as an <quote>address test</quote> (similar to the <option>-bt</option> option) rather
63841 than a verification (the <option>-bv</option> option). If an unqualified local part is given
63842 as the argument to EXPN, it is qualified with <option>qualify_domain</option>. Rejections
63843 of VRFY and EXPN commands are logged on the main and reject logs, and
63844 VRFY verification failures are logged on the main log for consistency with
63845 RCPT failures.
63846 </para>
63847 </section>
63848 <section id="SECTETRN">
63849 <title>The ETRN command</title>
63850 <para>
63851 <indexterm role="concept">
63852 <primary>ETRN</primary>
63853 <secondary>processing</secondary>
63854 </indexterm>
63855 RFC 1985 describes an SMTP command called ETRN that is designed to
63856 overcome the security problems of the TURN command (which has fallen into
63857 disuse). When Exim receives an ETRN command on a TCP/IP connection, it runs
63858 the ACL specified by <option>acl_smtp_etrn</option> in order to decide whether the command
63859 should be accepted or not. If no ACL is defined, the command is rejected.
63860 </para>
63861 <para>
63862 The ETRN command is concerned with <quote>releasing</quote> messages that are awaiting
63863 delivery to certain hosts. As Exim does not organize its message queue by host,
63864 the only form of ETRN that is supported by default is the one where the
63865 text starts with the <quote>#</quote> prefix, in which case the remainder of the text is
63866 specific to the SMTP server. A valid ETRN command causes a run of Exim with
63867 the <option>-R</option> option to happen, with the remainder of the ETRN text as its
63868 argument. For example,
63869 </para>
63870 <literallayout class="monospaced">
63871 ETRN #brigadoon
63872 </literallayout>
63873 <para>
63874 runs the command
63875 </para>
63876 <literallayout class="monospaced">
63877 exim -R brigadoon
63878 </literallayout>
63879 <para>
63880 which causes a delivery attempt on all messages with undelivered addresses
63881 containing the text <quote>brigadoon</quote>. When <option>smtp_etrn_serialize</option> is set (the
63882 default), Exim prevents the simultaneous execution of more than one queue run
63883 for the same argument string as a result of an ETRN command. This stops
63884 a misbehaving client from starting more than one queue runner at once.
63885 </para>
63886 <para>
63887 <indexterm role="concept">
63888 <primary>hints database</primary>
63889 <secondary>ETRN serialization</secondary>
63890 </indexterm>
63891 Exim implements the serialization by means of a hints database in which a
63892 record is written whenever a process is started by ETRN, and deleted when
63893 the process completes. However, Exim does not keep the SMTP session waiting for
63894 the ETRN process to complete. Once ETRN is accepted, the client is sent
63895 a <quote>success</quote> return code. Obviously there is scope for hints records to get
63896 left lying around if there is a system or program crash. To guard against this,
63897 Exim ignores any records that are more than six hours old.
63898 </para>
63899 <para>
63900 <indexterm role="option">
63901 <primary><option>smtp_etrn_command</option></primary>
63902 </indexterm>
63903 For more control over what ETRN does, the <option>smtp_etrn_command</option> option can
63904 used. This specifies a command that is run whenever ETRN is received,
63905 whatever the form of its argument. For
63906 example:
63907 </para>
63908 <literallayout class="monospaced">
63909 smtp_etrn_command = /etc/etrn_command $domain \
63910                     $sender_host_address
63911 </literallayout>
63912 <para>
63913 <indexterm role="variable">
63914 <primary><varname>$domain</varname></primary>
63915 </indexterm>
63916 The string is split up into arguments which are independently expanded. The
63917 expansion variable <varname>$domain</varname> is set to the argument of the ETRN command,
63918 and no syntax checking is done on the contents of this argument. Exim does not
63919 wait for the command to complete, so its status code is not checked. Exim runs
63920 under its own uid and gid when receiving incoming SMTP, so it is not possible
63921 for it to change them before running the command.
63922 </para>
63923 </section>
63924 <section id="SECID238">
63925 <title>Incoming local SMTP</title>
63926 <para>
63927 <indexterm role="concept">
63928 <primary>SMTP</primary>
63929 <secondary>local incoming</secondary>
63930 </indexterm>
63931 Some user agents use SMTP to pass messages to their local MTA using the
63932 standard input and output, as opposed to passing the envelope on the command
63933 line and writing the message to the standard input. This is supported by the
63934 <option>-bs</option> option. This form of SMTP is handled in the same way as incoming
63935 messages over TCP/IP (including the use of ACLs), except that the envelope
63936 sender given in a MAIL command is ignored unless the caller is trusted. In
63937 an ACL you can detect this form of SMTP input by testing for an empty host
63938 identification. It is common to have this as the first line in the ACL that
63939 runs for RCPT commands:
63940 </para>
63941 <literallayout class="monospaced">
63942 accept hosts = :
63943 </literallayout>
63944 <para>
63945 This accepts SMTP messages from local processes without doing any other tests.
63946 </para>
63947 </section>
63948 <section id="SECTbatchSMTP">
63949 <title>Outgoing batched SMTP</title>
63950 <para>
63951 <indexterm role="concept">
63952 <primary>SMTP</primary>
63953 <secondary>batched outgoing</secondary>
63954 </indexterm>
63955 <indexterm role="concept">
63956 <primary>batched SMTP output</primary>
63957 </indexterm>
63958 Both the <command>appendfile</command> and <command>pipe</command> transports can be used for handling
63959 batched SMTP. Each has an option called <option>use_bsmtp</option> which causes messages to
63960 be output in BSMTP format. No SMTP responses are possible for this form of
63961 delivery. All it is doing is using SMTP commands as a way of transmitting the
63962 envelope along with the message.
63963 </para>
63964 <para>
63965 The message is written to the file or pipe preceded by the SMTP commands
63966 MAIL and RCPT, and followed by a line containing a single dot. Lines in
63967 the message that start with a dot have an extra dot added. The SMTP command
63968 HELO is not normally used. If it is required, the <option>message_prefix</option> option
63969 can be used to specify it.
63970 </para>
63971 <para>
63972 Because <command>appendfile</command> and <command>pipe</command> are both local transports, they accept only
63973 one recipient address at a time by default. However, you can arrange for them
63974 to handle several addresses at once by setting the <option>batch_max</option> option. When
63975 this is done for BSMTP, messages may contain multiple RCPT commands. See
63976 chapter <xref linkend="CHAPbatching"/> for more details.
63977 </para>
63978 <para>
63979 <indexterm role="variable">
63980 <primary><varname>$host</varname></primary>
63981 </indexterm>
63982 When one or more addresses are routed to a BSMTP transport by a router that
63983 sets up a host list, the name of the first host on the list is available to the
63984 transport in the variable <varname>$host</varname>. Here is an example of such a transport and
63985 router:
63986 </para>
63987 <literallayout class="monospaced">
63988 begin routers
63989 route_append:
63990   driver = manualroute
63991   transport = smtp_appendfile
63992   route_list = domain.example  batch.host.example
63993
63994 begin transports
63995 smtp_appendfile:
63996   driver = appendfile
63997   directory = /var/bsmtp/$host
63998   batch_max = 1000
63999   use_bsmtp
64000   user = exim
64001 </literallayout>
64002 <para>
64003 This causes messages addressed to <emphasis>domain.example</emphasis> to be written in BSMTP
64004 format to <filename>/var/bsmtp/batch.host.example</filename>, with only a single copy of each
64005 message (unless there are more than 1000 recipients).
64006 </para>
64007 </section>
64008 <section id="SECTincomingbatchedSMTP">
64009 <title>Incoming batched SMTP</title>
64010 <para>
64011 <indexterm role="concept">
64012 <primary>SMTP</primary>
64013 <secondary>batched incoming</secondary>
64014 </indexterm>
64015 <indexterm role="concept">
64016 <primary>batched SMTP input</primary>
64017 </indexterm>
64018 The <option>-bS</option> command line option causes Exim to accept one or more messages by
64019 reading SMTP on the standard input, but to generate no responses. If the caller
64020 is trusted, the senders in the MAIL commands are believed; otherwise the
64021 sender is always the caller of Exim. Unqualified senders and receivers are not
64022 rejected (there seems little point) but instead just get qualified. HELO
64023 and EHLO act as RSET; VRFY, EXPN, ETRN and  HELP, act
64024 as NOOP; QUIT quits.
64025 </para>
64026 <para>
64027 Minimal policy checking is done for BSMTP input. Only the non-SMTP
64028 ACL is run in the same way as for non-SMTP local input.
64029 </para>
64030 <para>
64031 If an error is detected while reading a message, including a missing <quote>.</quote> at
64032 the end, Exim gives up immediately. It writes details of the error to the
64033 standard output in a stylized way that the calling program should be able to
64034 make some use of automatically, for example:
64035 </para>
64036 <literallayout class="monospaced">
64037 554 Unexpected end of file
64038 Transaction started in line 10
64039 Error detected in line 14
64040 </literallayout>
64041 <para>
64042 It writes a more verbose version, for human consumption, to the standard error
64043 file, for example:
64044 </para>
64045 <literallayout class="monospaced">
64046 An error was detected while processing a file of BSMTP input.
64047 The error message was:
64048
64049 501 '&gt;' missing at end of address
64050
64051 The SMTP transaction started in line 10.
64052 The error was detected in line 12.
64053 The SMTP command at fault was:
64054
64055 rcpt to:&lt;malformed@in.com.plete
64056
64057 1 previous message was successfully processed.
64058 The rest of the batch was abandoned.
64059 </literallayout>
64060 <para>
64061 The return code from Exim is zero only if there were no errors. It is 1 if some
64062 messages were accepted before an error was detected, and 2 if no messages were
64063 accepted.
64064 <indexterm role="concept" startref="IIDsmtpproc1" class="endofrange"/>
64065 <indexterm role="concept" startref="IIDsmtpproc2" class="endofrange"/>
64066 </para>
64067 </section>
64068 </chapter>
64069
64070 <chapter id="CHAPemsgcust">
64071 <title>Customizing bounce and warning messages</title>
64072 <titleabbrev>Customizing messages</titleabbrev>
64073 <para>
64074 When a message fails to be delivered, or remains on the queue for more than a
64075 configured amount of time, Exim sends a message to the original sender, or
64076 to an alternative configured address. The text of these messages is built into
64077 the code of Exim, but it is possible to change it, either by adding a single
64078 string, or by replacing each of the paragraphs by text supplied in a file.
64079 </para>
64080 <para>
64081 The <emphasis>From:</emphasis> and <emphasis>To:</emphasis> header lines are automatically generated; you can
64082 cause a <emphasis>Reply-To:</emphasis> line to be added by setting the <option>errors_reply_to</option>
64083 option. Exim also adds the line
64084 </para>
64085 <literallayout class="monospaced">
64086 Auto-Submitted: auto-generated
64087 </literallayout>
64088 <para>
64089 to all warning and bounce messages,
64090 </para>
64091 <section id="SECID239">
64092 <title>Customizing bounce messages</title>
64093 <para>
64094 <indexterm role="concept">
64095 <primary>customizing</primary>
64096 <secondary>bounce message</secondary>
64097 </indexterm>
64098 <indexterm role="concept">
64099 <primary>bounce message</primary>
64100 <secondary>customizing</secondary>
64101 </indexterm>
64102 If <option>bounce_message_text</option> is set, its contents are included in the default
64103 message immediately after <quote>This message was created automatically by mail
64104 delivery software.</quote> The string is not expanded. It is not used if
64105 <option>bounce_message_file</option> is set.
64106 </para>
64107 <para>
64108 When <option>bounce_message_file</option> is set, it must point to a template file for
64109 constructing error messages. The file consists of a series of text items,
64110 separated by lines consisting of exactly four asterisks. If the file cannot be
64111 opened, default text is used and a message is written to the main and panic
64112 logs. If any text item in the file is empty, default text is used for that
64113 item.
64114 </para>
64115 <para>
64116 <indexterm role="variable">
64117 <primary><varname>$bounce_recipient</varname></primary>
64118 </indexterm>
64119 <indexterm role="variable">
64120 <primary><varname>$bounce_return_size_limit</varname></primary>
64121 </indexterm>
64122 Each item of text that is read from the file is expanded, and there are two
64123 expansion variables which can be of use here: <varname>$bounce_recipient</varname> is set to
64124 the recipient of an error message while it is being created, and
64125 <varname>$bounce_return_size_limit</varname> contains the value of the <option>return_size_limit</option>
64126 option, rounded to a whole number.
64127 </para>
64128 <para>
64129 The items must appear in the file in the following order:
64130 </para>
64131 <itemizedlist>
64132 <listitem>
64133 <para>
64134 The first item is included in the headers, and should include at least a
64135 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
64136 </para>
64137 </listitem>
64138 <listitem>
64139 <para>
64140 The second item forms the start of the error message. After it, Exim lists the
64141 failing addresses with their error messages.
64142 </para>
64143 </listitem>
64144 <listitem>
64145 <para>
64146 The third item is used to introduce any text from pipe transports that is to be
64147 returned to the sender. It is omitted if there is no such text.
64148 </para>
64149 </listitem>
64150 <listitem>
64151 <para>
64152 The fourth, fifth and sixth items will be ignored and may be empty.
64153 The fields exist for back-compatibility
64154 </para>
64155 </listitem>
64156 </itemizedlist>
64157 <para>
64158 The default state (<option>bounce_message_file</option> unset) is equivalent to the
64159 following file, in which the sixth item is empty. The <emphasis>Subject:</emphasis> and some
64160 other lines have been split in order to fit them on the page:
64161 </para>
64162 <literallayout class="monospaced">
64163 Subject: Mail delivery failed
64164   ${if eq{$sender_address}{$bounce_recipient}
64165   {: returning message to sender}}
64166 ****
64167 This message was created automatically by mail delivery software.
64168
64169 A message ${if eq{$sender_address}{$bounce_recipient}
64170   {that you sent }{sent by
64171
64172 &lt;$sender_address&gt;
64173
64174 }}could not be delivered to all of its recipients.
64175 This is a permanent error. The following address(es) failed:
64176 ****
64177 The following text was generated during the delivery attempt(s):
64178 ****
64179 ------ This is a copy of the message, including all the headers.
64180   ------
64181 ****
64182 ------ The body of the message is $message_size characters long;
64183   only the first
64184 ------ $bounce_return_size_limit or so are included here.
64185 ****
64186 </literallayout>
64187 </section>
64188 <section id="SECTcustwarn">
64189 <title>Customizing warning messages</title>
64190 <para>
64191 <indexterm role="concept">
64192 <primary>customizing</primary>
64193 <secondary>warning message</secondary>
64194 </indexterm>
64195 <indexterm role="concept">
64196 <primary>warning of delay</primary>
64197 <secondary>customizing the message</secondary>
64198 </indexterm>
64199 The option <option>warn_message_file</option> can be pointed at a template file for use when
64200 warnings about message delays are created. In this case there are only three
64201 text sections:
64202 </para>
64203 <itemizedlist>
64204 <listitem>
64205 <para>
64206 The first item is included in the headers, and should include at least a
64207 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
64208 </para>
64209 </listitem>
64210 <listitem>
64211 <para>
64212 The second item forms the start of the warning message. After it, Exim lists
64213 the delayed addresses.
64214 </para>
64215 </listitem>
64216 <listitem>
64217 <para>
64218 The third item then ends the message.
64219 </para>
64220 </listitem>
64221 </itemizedlist>
64222 <para>
64223 The default state is equivalent to the following file, except that some lines
64224 have been split here, in order to fit them on the page:
64225 </para>
64226 <literallayout class="monospaced">
64227 Subject: Warning: message $message_exim_id delayed
64228   $warn_message_delay
64229 ****
64230 This message was created automatically by mail delivery software.
64231
64232 A message ${if eq{$sender_address}{$warn_message_recipients}
64233 {that you sent }{sent by
64234
64235 &lt;$sender_address&gt;
64236
64237 }}has not been delivered to all of its recipients after
64238 more than $warn_message_delay on the queue on $primary_hostname.
64239
64240 The message identifier is:     $message_exim_id
64241 The subject of the message is: $h_subject
64242 The date of the message is:    $h_date
64243
64244 The following address(es) have not yet been delivered:
64245 ****
64246 No action is required on your part. Delivery attempts will
64247 continue for some time, and this warning may be repeated at
64248 intervals if the message remains undelivered. Eventually the
64249 mail delivery software will give up, and when that happens,
64250 the message will be returned to you.
64251 </literallayout>
64252 <para>
64253 <indexterm role="variable">
64254 <primary><varname>$warn_message_delay</varname></primary>
64255 </indexterm>
64256 <indexterm role="variable">
64257 <primary><varname>$warn_message_recipients</varname></primary>
64258 </indexterm>
64259 However, in the default state the subject and date lines are omitted if no
64260 appropriate headers exist. During the expansion of this file,
64261 <varname>$warn_message_delay</varname> is set to the delay time in one of the forms <quote>&lt;<emphasis>n</emphasis>&gt;
64262 minutes</quote> or <quote>&lt;<emphasis>n</emphasis>&gt; hours</quote>, and <varname>$warn_message_recipients</varname> contains a list
64263 of recipients for the warning message. There may be more than one if there are
64264 multiple addresses with different <option>errors_to</option> settings on the routers that
64265 handled them.
64266 </para>
64267 </section>
64268 </chapter>
64269
64270 <chapter id="CHAPcomconreq">
64271 <title>Some common configuration settings</title>
64272 <para>
64273 This chapter discusses some configuration settings that seem to be fairly
64274 common. More examples and discussion can be found in the Exim book.
64275 </para>
64276 <section id="SECID240">
64277 <title>Sending mail to a smart host</title>
64278 <para>
64279 <indexterm role="concept">
64280 <primary>smart host</primary>
64281 <secondary>example router</secondary>
64282 </indexterm>
64283 If you want to send all mail for non-local domains to a <quote>smart host</quote>, you
64284 should replace the default <command>dnslookup</command> router with a router which does the
64285 routing explicitly:
64286 </para>
64287 <literallayout class="monospaced">
64288 send_to_smart_host:
64289   driver = manualroute
64290   route_list = !+local_domains smart.host.name
64291   transport = remote_smtp
64292 </literallayout>
64293 <para>
64294 You can use the smart host&#x2019;s IP address instead of the name if you wish.
64295 If you are using Exim only to submit messages to a smart host, and not for
64296 receiving incoming messages, you can arrange for it to do the submission
64297 synchronously by setting the <option>mua_wrapper</option> option (see chapter
64298 <xref linkend="CHAPnonqueueing"/>).
64299 </para>
64300 </section>
64301 <section id="SECTmailinglists">
64302 <title>Using Exim to handle mailing lists</title>
64303 <para>
64304 <indexterm role="concept">
64305 <primary>mailing lists</primary>
64306 </indexterm>
64307 Exim can be used to run simple mailing lists, but for large and/or complicated
64308 requirements, the use of additional specialized mailing list software such as
64309 Majordomo or Mailman is recommended.
64310 </para>
64311 <para>
64312 The <command>redirect</command> router can be used to handle mailing lists where each list
64313 is maintained in a separate file, which can therefore be managed by an
64314 independent manager. The <option>domains</option> router option can be used to run these
64315 lists in a separate domain from normal mail. For example:
64316 </para>
64317 <literallayout class="monospaced">
64318 lists:
64319   driver = redirect
64320   domains = lists.example
64321   file = /usr/lists/$local_part
64322   forbid_pipe
64323   forbid_file
64324   errors_to = $local_part-request@lists.example
64325   no_more
64326 </literallayout>
64327 <para>
64328 This router is skipped for domains other than <emphasis>lists.example</emphasis>. For addresses
64329 in that domain, it looks for a file that matches the local part. If there is no
64330 such file, the router declines, but because <option>no_more</option> is set, no subsequent
64331 routers are tried, and so the whole delivery fails.
64332 </para>
64333 <para>
64334 The <option>forbid_pipe</option> and <option>forbid_file</option> options prevent a local part from being
64335 expanded into a file name or a pipe delivery, which is usually inappropriate in
64336 a mailing list.
64337 </para>
64338 <para>
64339 <indexterm role="option">
64340 <primary><option>errors_to</option></primary>
64341 </indexterm>
64342 The <option>errors_to</option> option specifies that any delivery errors caused by addresses
64343 taken from a mailing list are to be sent to the given address rather than the
64344 original sender of the message. However, before acting on this, Exim verifies
64345 the error address, and ignores it if verification fails.
64346 </para>
64347 <para>
64348 For example, using the configuration above, mail sent to
64349 <emphasis>dicts@lists.example</emphasis> is passed on to those addresses contained in
64350 <filename>/usr/lists/dicts</filename>, with error reports directed to
64351 <emphasis>dicts-request@lists.example</emphasis>, provided that this address can be verified.
64352 There could be a file called <filename>/usr/lists/dicts-request</filename> containing
64353 the address(es) of this particular list&#x2019;s manager(s), but other approaches,
64354 such as setting up an earlier router (possibly using the <option>local_part_prefix</option>
64355 or <option>local_part_suffix</option> options) to handle addresses of the form
64356 <option>owner-</option><emphasis>xxx</emphasis> or <option>xxx-</option><emphasis>request</emphasis>, are also possible.
64357 </para>
64358 </section>
64359 <section id="SECID241">
64360 <title>Syntax errors in mailing lists</title>
64361 <para>
64362 <indexterm role="concept">
64363 <primary>mailing lists</primary>
64364 <secondary>syntax errors in</secondary>
64365 </indexterm>
64366 If an entry in redirection data contains a syntax error, Exim normally defers
64367 delivery of the original address. That means that a syntax error in a mailing
64368 list holds up all deliveries to the list. This may not be appropriate when a
64369 list is being maintained automatically from data supplied by users, and the
64370 addresses are not rigorously checked.
64371 </para>
64372 <para>
64373 If the <option>skip_syntax_errors</option> option is set, the <command>redirect</command> router just skips
64374 entries that fail to parse, noting the incident in the log. If in addition
64375 <option>syntax_errors_to</option> is set to a verifiable address, a message is sent to it
64376 whenever a broken address is skipped. It is usually appropriate to set
64377 <option>syntax_errors_to</option> to the same address as <option>errors_to</option>.
64378 </para>
64379 </section>
64380 <section id="SECID242">
64381 <title>Re-expansion of mailing lists</title>
64382 <para>
64383 <indexterm role="concept">
64384 <primary>mailing lists</primary>
64385 <secondary>re-expansion of</secondary>
64386 </indexterm>
64387 Exim remembers every individual address to which a message has been delivered,
64388 in order to avoid duplication, but it normally stores only the original
64389 recipient addresses with a message. If all the deliveries to a mailing list
64390 cannot be done at the first attempt, the mailing list is re-expanded when the
64391 delivery is next tried. This means that alterations to the list are taken into
64392 account at each delivery attempt, so addresses that have been added to
64393 the list since the message arrived will therefore receive a copy of the
64394 message, even though it pre-dates their subscription.
64395 </para>
64396 <para>
64397 If this behaviour is felt to be undesirable, the <option>one_time</option> option can be set
64398 on the <command>redirect</command> router. If this is done, any addresses generated by the
64399 router that fail to deliver at the first attempt are added to the message as
64400 <quote>top level</quote> addresses, and the parent address that generated them is marked
64401 <quote>delivered</quote>. Thus, expansion of the mailing list does not happen again at the
64402 subsequent delivery attempts. The disadvantage of this is that if any of the
64403 failing addresses are incorrect, correcting them in the file has no effect on
64404 pre-existing messages.
64405 </para>
64406 <para>
64407 The original top-level address is remembered with each of the generated
64408 addresses, and is output in any log messages. However, any intermediate parent
64409 addresses are not recorded. This makes a difference to the log only if the
64410 <option>all_parents</option> selector is set, but for mailing lists there is normally only
64411 one level of expansion anyway.
64412 </para>
64413 </section>
64414 <section id="SECID243">
64415 <title>Closed mailing lists</title>
64416 <para>
64417 <indexterm role="concept">
64418 <primary>mailing lists</primary>
64419 <secondary>closed</secondary>
64420 </indexterm>
64421 The examples so far have assumed open mailing lists, to which anybody may
64422 send mail. It is also possible to set up closed lists, where mail is accepted
64423 from specified senders only. This is done by making use of the generic
64424 <option>senders</option> option to restrict the router that handles the list.
64425 </para>
64426 <para>
64427 The following example uses the same file as a list of recipients and as a list
64428 of permitted senders. It requires three routers:
64429 </para>
64430 <literallayout class="monospaced">
64431 lists_request:
64432   driver = redirect
64433   domains = lists.example
64434   local_part_suffix = -request
64435   file = /usr/lists/$local_part$local_part_suffix
64436   no_more
64437
64438 lists_post:
64439   driver = redirect
64440   domains = lists.example
64441   senders = ${if exists {/usr/lists/$local_part}\
64442              {lsearch;/usr/lists/$local_part}{*}}
64443   file = /usr/lists/$local_part
64444   forbid_pipe
64445   forbid_file
64446   errors_to = $local_part-request@lists.example
64447   no_more
64448
64449 lists_closed:
64450   driver = redirect
64451   domains = lists.example
64452   allow_fail
64453   data = :fail: $local_part@lists.example is a closed mailing list
64454 </literallayout>
64455 <para>
64456 All three routers have the same <option>domains</option> setting, so for any other domains,
64457 they are all skipped. The first router runs only if the local part ends in
64458 <option>-request</option>. It handles messages to the list manager(s) by means of an open
64459 mailing list.
64460 </para>
64461 <para>
64462 The second router runs only if the <option>senders</option> precondition is satisfied. It
64463 checks for the existence of a list that corresponds to the local part, and then
64464 checks that the sender is on the list by means of a linear search. It is
64465 necessary to check for the existence of the file before trying to search it,
64466 because otherwise Exim thinks there is a configuration error. If the file does
64467 not exist, the expansion of <option>senders</option> is *, which matches all senders. This
64468 means that the router runs, but because there is no list, declines, and
64469 <option>no_more</option> ensures that no further routers are run. The address fails with an
64470 <quote>unrouteable address</quote> error.
64471 </para>
64472 <para>
64473 The third router runs only if the second router is skipped, which happens when
64474 a mailing list exists, but the sender is not on it. This router forcibly fails
64475 the address, giving a suitable error message.
64476 </para>
64477 </section>
64478 <section id="SECTverp">
64479 <title>Variable Envelope Return Paths (VERP)</title>
64480 <para>
64481 <indexterm role="concept">
64482 <primary>VERP</primary>
64483 </indexterm>
64484 <indexterm role="concept">
64485 <primary>Variable Envelope Return Paths</primary>
64486 </indexterm>
64487 <indexterm role="concept">
64488 <primary>envelope sender</primary>
64489 </indexterm>
64490 Variable Envelope Return Paths &ndash; see <emphasis role="bold"><ulink url="http://cr.yp.to/proto/verp.txt">http://cr.yp.to/proto/verp.txt</ulink></emphasis> &ndash;
64491 are a way of helping mailing list administrators discover which subscription
64492 address is the cause of a particular delivery failure. The idea is to encode
64493 the original recipient address in the outgoing envelope sender address, so that
64494 if the message is forwarded by another host and then subsequently bounces, the
64495 original recipient can be extracted from the recipient address of the bounce.
64496 </para>
64497 <para>
64498 <indexterm role="option">
64499 <primary><option>errors_to</option></primary>
64500 </indexterm>
64501 <indexterm role="option">
64502 <primary><option>return_path</option></primary>
64503 </indexterm>
64504 Envelope sender addresses can be modified by Exim using two different
64505 facilities: the <option>errors_to</option> option on a router (as shown in previous mailing
64506 list examples), or the <option>return_path</option> option on a transport. The second of
64507 these is effective only if the message is successfully delivered to another
64508 host; it is not used for errors detected on the local host (see the description
64509 of <option>return_path</option> in chapter <xref linkend="CHAPtransportgeneric"/>). Here is an example
64510 of the use of <option>return_path</option> to implement VERP on an <command>smtp</command> transport:
64511 </para>
64512 <literallayout class="monospaced">
64513 verp_smtp:
64514   driver = smtp
64515   max_rcpt = 1
64516   return_path = \
64517     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
64518       {$1-request+$local_part=$domain@your.dom.example}fail}
64519 </literallayout>
64520 <para>
64521 This has the effect of rewriting the return path (envelope sender) on outgoing
64522 SMTP messages, if the local part of the original return path ends in
64523 <quote>-request</quote>, and the domain is <emphasis>your.dom.example</emphasis>. The rewriting inserts the
64524 local part and domain of the recipient into the return path. Suppose, for
64525 example, that a message whose return path has been set to
64526 <emphasis>somelist-request@your.dom.example</emphasis> is sent to
64527 <emphasis>subscriber@other.dom.example</emphasis>. In the transport, the return path is
64528 rewritten as
64529 </para>
64530 <literallayout class="monospaced">
64531 somelist-request+subscriber=other.dom.example@your.dom.example
64532 </literallayout>
64533 <para>
64534 <indexterm role="variable">
64535 <primary><varname>$local_part</varname></primary>
64536 </indexterm>
64537 For this to work, you must tell Exim to send multiple copies of messages that
64538 have more than one recipient, so that each copy has just one recipient. This is
64539 achieved by setting <option>max_rcpt</option> to 1. Without this, a single copy of a message
64540 might be sent to several different recipients in the same domain, in which case
64541 <varname>$local_part</varname> is not available in the transport, because it is not unique.
64542 </para>
64543 <para>
64544 Unless your host is doing nothing but mailing list deliveries, you should
64545 probably use a separate transport for the VERP deliveries, so as not to use
64546 extra resources in making one-per-recipient copies for other deliveries. This
64547 can easily be done by expanding the <option>transport</option> option in the router:
64548 </para>
64549 <literallayout class="monospaced">
64550 dnslookup:
64551   driver = dnslookup
64552   domains = ! +local_domains
64553   transport = \
64554     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
64555       {verp_smtp}{remote_smtp}}
64556   no_more
64557 </literallayout>
64558 <para>
64559 If you want to change the return path using <option>errors_to</option> in a router instead
64560 of using <option>return_path</option> in the transport, you need to set <option>errors_to</option> on all
64561 routers that handle mailing list addresses. This will ensure that all delivery
64562 errors, including those detected on the local host, are sent to the VERP
64563 address.
64564 </para>
64565 <para>
64566 On a host that does no local deliveries and has no manual routing, only the
64567 <command>dnslookup</command> router needs to be changed. A special transport is not needed for
64568 SMTP deliveries. Every mailing list recipient has its own return path value,
64569 and so Exim must hand them to the transport one at a time. Here is an example
64570 of a <command>dnslookup</command> router that implements VERP:
64571 </para>
64572 <literallayout class="monospaced">
64573 verp_dnslookup:
64574   driver = dnslookup
64575   domains = ! +local_domains
64576   transport = remote_smtp
64577   errors_to = \
64578     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}}
64579      {$1-request+$local_part=$domain@your.dom.example}fail}
64580   no_more
64581 </literallayout>
64582 <para>
64583 Before you start sending out messages with VERPed return paths, you must also
64584 configure Exim to accept the bounce messages that come back to those paths.
64585 Typically this is done by setting a <option>local_part_suffix</option> option for a
64586 router, and using this to route the messages to wherever you want to handle
64587 them.
64588 </para>
64589 <para>
64590 The overhead incurred in using VERP depends very much on the size of the
64591 message, the number of recipient addresses that resolve to the same remote
64592 host, and the speed of the connection over which the message is being sent. If
64593 a lot of addresses resolve to the same host and the connection is slow, sending
64594 a separate copy of the message for each address may take substantially longer
64595 than sending a single copy with many recipients (for which VERP cannot be
64596 used).
64597 </para>
64598 </section>
64599 <section id="SECTvirtualdomains">
64600 <title>Virtual domains</title>
64601 <para>
64602 <indexterm role="concept">
64603 <primary>virtual domains</primary>
64604 </indexterm>
64605 <indexterm role="concept">
64606 <primary>domain</primary>
64607 <secondary>virtual</secondary>
64608 </indexterm>
64609 The phrase <emphasis>virtual domain</emphasis> is unfortunately used with two rather different
64610 meanings:
64611 </para>
64612 <itemizedlist>
64613 <listitem>
64614 <para>
64615 A domain for which there are no real mailboxes; all valid local parts are
64616 aliases for other email addresses. Common examples are organizational
64617 top-level domains and <quote>vanity</quote> domains.
64618 </para>
64619 </listitem>
64620 <listitem>
64621 <para>
64622 One of a number of independent domains that are all handled by the same host,
64623 with mailboxes on that host, but where the mailbox owners do not necessarily
64624 have login accounts on that host.
64625 </para>
64626 </listitem>
64627 </itemizedlist>
64628 <para>
64629 The first usage is probably more common, and does seem more <quote>virtual</quote> than
64630 the second. This kind of domain can be handled in Exim with a straightforward
64631 aliasing router. One approach is to create a separate alias file for each
64632 virtual domain. Exim can test for the existence of the alias file to determine
64633 whether the domain exists. The <command>dsearch</command> lookup type is useful here, leading
64634 to a router of this form:
64635 </para>
64636 <literallayout class="monospaced">
64637 virtual:
64638   driver = redirect
64639   domains = dsearch;/etc/mail/virtual
64640   data = ${lookup{$local_part}lsearch{/etc/mail/virtual/$domain}}
64641   no_more
64642 </literallayout>
64643 <para>
64644 The <option>domains</option> option specifies that the router is to be skipped, unless there
64645 is a file in the <filename>/etc/mail/virtual</filename> directory whose name is the same as the
64646 domain that is being processed. When the router runs, it looks up the local
64647 part in the file to find a new address (or list of addresses). The <option>no_more</option>
64648 setting ensures that if the lookup fails (leading to <option>data</option> being an empty
64649 string), Exim gives up on the address without trying any subsequent routers.
64650 </para>
64651 <para>
64652 This one router can handle all the virtual domains because the alias file names
64653 follow a fixed pattern. Permissions can be arranged so that appropriate people
64654 can edit the different alias files. A successful aliasing operation results in
64655 a new envelope recipient address, which is then routed from scratch.
64656 </para>
64657 <para>
64658 The other kind of <quote>virtual</quote> domain can also be handled in a straightforward
64659 way. One approach is to create a file for each domain containing a list of
64660 valid local parts, and use it in a router like this:
64661 </para>
64662 <literallayout class="monospaced">
64663 my_domains:
64664   driver = accept
64665   domains = dsearch;/etc/mail/domains
64666   local_parts = lsearch;/etc/mail/domains/$domain
64667   transport = my_mailboxes
64668 </literallayout>
64669 <para>
64670 The address is accepted if there is a file for the domain, and the local part
64671 can be found in the file. The <option>domains</option> option is used to check for the
64672 file&#x2019;s existence because <option>domains</option> is tested before the <option>local_parts</option>
64673 option (see section <xref linkend="SECTrouprecon"/>). You cannot use <option>require_files</option>,
64674 because that option is tested after <option>local_parts</option>. The transport is as
64675 follows:
64676 </para>
64677 <literallayout class="monospaced">
64678 my_mailboxes:
64679   driver = appendfile
64680   file = /var/mail/$domain/$local_part
64681   user = mail
64682 </literallayout>
64683 <para>
64684 This uses a directory of mailboxes for each domain. The <option>user</option> setting is
64685 required, to specify which uid is to be used for writing to the mailboxes.
64686 </para>
64687 <para>
64688 The configuration shown here is just one example of how you might support this
64689 requirement. There are many other ways this kind of configuration can be set
64690 up, for example, by using a database instead of separate files to hold all the
64691 information about the domains.
64692 </para>
64693 </section>
64694 <section id="SECTmulbox">
64695 <title>Multiple user mailboxes</title>
64696 <para>
64697 <indexterm role="concept">
64698 <primary>multiple mailboxes</primary>
64699 </indexterm>
64700 <indexterm role="concept">
64701 <primary>mailbox</primary>
64702 <secondary>multiple</secondary>
64703 </indexterm>
64704 <indexterm role="concept">
64705 <primary>local part</primary>
64706 <secondary>prefix</secondary>
64707 </indexterm>
64708 <indexterm role="concept">
64709 <primary>local part</primary>
64710 <secondary>suffix</secondary>
64711 </indexterm>
64712 Heavy email users often want to operate with multiple mailboxes, into which
64713 incoming mail is automatically sorted. A popular way of handling this is to
64714 allow users to use multiple sender addresses, so that replies can easily be
64715 identified. Users are permitted to add prefixes or suffixes to their local
64716 parts for this purpose. The wildcard facility of the generic router options
64717 <option>local_part_prefix</option> and <option>local_part_suffix</option> can be used for this. For
64718 example, consider this router:
64719 </para>
64720 <literallayout class="monospaced">
64721 userforward:
64722   driver = redirect
64723   check_local_user
64724   file = $home/.forward
64725   local_part_suffix = -*
64726   local_part_suffix_optional
64727   allow_filter
64728 </literallayout>
64729 <para>
64730 <indexterm role="variable">
64731 <primary><varname>$local_part_suffix</varname></primary>
64732 </indexterm>
64733 It runs a user&#x2019;s <filename>.forward</filename> file for all local parts of the form
64734 <emphasis>username-*</emphasis>. Within the filter file the user can distinguish different
64735 cases by testing the variable <varname>$local_part_suffix</varname>. For example:
64736 </para>
64737 <literallayout class="monospaced">
64738 if $local_part_suffix contains -special then
64739 save /home/$local_part/Mail/special
64740 endif
64741 </literallayout>
64742 <para>
64743 If the filter file does not exist, or does not deal with such addresses, they
64744 fall through to subsequent routers, and, assuming no subsequent use of the
64745 <option>local_part_suffix</option> option is made, they presumably fail. Thus, users have
64746 control over which suffixes are valid.
64747 </para>
64748 <para>
64749 Alternatively, a suffix can be used to trigger the use of a different
64750 <filename>.forward</filename> file &ndash; which is the way a similar facility is implemented in
64751 another MTA:
64752 </para>
64753 <literallayout class="monospaced">
64754 userforward:
64755   driver = redirect
64756   check_local_user
64757   file = $home/.forward$local_part_suffix
64758   local_part_suffix = -*
64759   local_part_suffix_optional
64760   allow_filter
64761 </literallayout>
64762 <para>
64763 If there is no suffix, <filename>.forward</filename> is used; if the suffix is <emphasis>-special</emphasis>, for
64764 example, <filename>.forward-special</filename> is used. Once again, if the appropriate file
64765 does not exist, or does not deal with the address, it is passed on to
64766 subsequent routers, which could, if required, look for an unqualified
64767 <filename>.forward</filename> file to use as a default.
64768 </para>
64769 </section>
64770 <section id="SECID244">
64771 <title>Simplified vacation processing</title>
64772 <para>
64773 <indexterm role="concept">
64774 <primary>vacation processing</primary>
64775 </indexterm>
64776 The traditional way of running the <emphasis>vacation</emphasis> program is for a user to set up
64777 a pipe command in a <filename>.forward</filename> file
64778 (see section <xref linkend="SECTspecitredli"/> for syntax details).
64779 This is prone to error by inexperienced users. There are two features of Exim
64780 that can be used to make this process simpler for users:
64781 </para>
64782 <itemizedlist>
64783 <listitem>
64784 <para>
64785 A local part prefix such as <quote>vacation-</quote> can be specified on a router which
64786 can cause the message to be delivered directly to the <emphasis>vacation</emphasis> program, or
64787 alternatively can use Exim&#x2019;s <command>autoreply</command> transport. The contents of a user&#x2019;s
64788 <filename>.forward</filename> file are then much simpler. For example:
64789 </para>
64790 <literallayout class="monospaced">
64791 spqr, vacation-spqr
64792 </literallayout>
64793 </listitem>
64794 <listitem>
64795 <para>
64796 The <option>require_files</option> generic router option can be used to trigger a
64797 vacation delivery by checking for the existence of a certain file in the
64798 user&#x2019;s home directory. The <option>unseen</option> generic option should also be used, to
64799 ensure that the original delivery also proceeds. In this case, all the user has
64800 to do is to create a file called, say, <filename>.vacation</filename>, containing a vacation
64801 message.
64802 </para>
64803 </listitem>
64804 </itemizedlist>
64805 <para>
64806 Another advantage of both these methods is that they both work even when the
64807 use of arbitrary pipes by users is locked out.
64808 </para>
64809 </section>
64810 <section id="SECID245">
64811 <title>Taking copies of mail</title>
64812 <para>
64813 <indexterm role="concept">
64814 <primary>message</primary>
64815 <secondary>copying every</secondary>
64816 </indexterm>
64817 Some installations have policies that require archive copies of all messages to
64818 be made. A single copy of each message can easily be taken by an appropriate
64819 command in a system filter, which could, for example, use a different file for
64820 each day&#x2019;s messages.
64821 </para>
64822 <para>
64823 There is also a shadow transport mechanism that can be used to take copies of
64824 messages that are successfully delivered by local transports, one copy per
64825 delivery. This could be used, <emphasis>inter alia</emphasis>, to implement automatic
64826 notification of delivery by sites that insist on doing such things.
64827 </para>
64828 </section>
64829 <section id="SECID246">
64830 <title>Intermittently connected hosts</title>
64831 <para>
64832 <indexterm role="concept">
64833 <primary>intermittently connected hosts</primary>
64834 </indexterm>
64835 It has become quite common (because it is cheaper) for hosts to connect to the
64836 Internet periodically rather than remain connected all the time. The normal
64837 arrangement is that mail for such hosts accumulates on a system that is
64838 permanently connected.
64839 </para>
64840 <para>
64841 Exim was designed for use on permanently connected hosts, and so it is not
64842 particularly well-suited to use in an intermittently connected environment.
64843 Nevertheless there are some features that can be used.
64844 </para>
64845 </section>
64846 <section id="SECID247">
64847 <title>Exim on the upstream server host</title>
64848 <para>
64849 It is tempting to arrange for incoming mail for the intermittently connected
64850 host to remain on Exim&#x2019;s queue until the client connects. However, this
64851 approach does not scale very well. Two different kinds of waiting message are
64852 being mixed up in the same queue &ndash; those that cannot be delivered because of
64853 some temporary problem, and those that are waiting for their destination host
64854 to connect. This makes it hard to manage the queue, as well as wasting
64855 resources, because each queue runner scans the entire queue.
64856 </para>
64857 <para>
64858 A better approach is to separate off those messages that are waiting for an
64859 intermittently connected host. This can be done by delivering these messages
64860 into local files in batch SMTP, <quote>mailstore</quote>, or other envelope-preserving
64861 format, from where they are transmitted by other software when their
64862 destination connects. This makes it easy to collect all the mail for one host
64863 in a single directory, and to apply local timeout rules on a per-message basis
64864 if required.
64865 </para>
64866 <para>
64867 On a very small scale, leaving the mail on Exim&#x2019;s queue can be made to work. If
64868 you are doing this, you should configure Exim with a long retry period for the
64869 intermittent host. For example:
64870 </para>
64871 <literallayout class="monospaced">
64872 cheshire.wonderland.fict.example    *   F,5d,24h
64873 </literallayout>
64874 <para>
64875 This stops a lot of failed delivery attempts from occurring, but Exim remembers
64876 which messages it has queued up for that host. Once the intermittent host comes
64877 online, forcing delivery of one message (either by using the <option>-M</option> or <option>-R</option>
64878 options, or by using the ETRN SMTP command (see section <xref linkend="SECTETRN"/>)
64879 causes all the queued up messages to be delivered, often down a single SMTP
64880 connection. While the host remains connected, any new messages get delivered
64881 immediately.
64882 </para>
64883 <para>
64884 If the connecting hosts do not have fixed IP addresses, that is, if a host is
64885 issued with a different IP address each time it connects, Exim&#x2019;s retry
64886 mechanisms on the holding host get confused, because the IP address is normally
64887 used as part of the key string for holding retry information. This can be
64888 avoided by unsetting <option>retry_include_ip_address</option> on the <command>smtp</command> transport.
64889 Since this has disadvantages for permanently connected hosts, it is best to
64890 arrange a separate transport for the intermittently connected ones.
64891 </para>
64892 </section>
64893 <section id="SECID248">
64894 <title>Exim on the intermittently connected client host</title>
64895 <para>
64896 The value of <option>smtp_accept_queue_per_connection</option> should probably be
64897 increased, or even set to zero (that is, disabled) on the intermittently
64898 connected host, so that all incoming messages down a single connection get
64899 delivered immediately.
64900 </para>
64901 <para>
64902 <indexterm role="concept">
64903 <primary>SMTP</primary>
64904 <secondary>passed connection</secondary>
64905 </indexterm>
64906 <indexterm role="concept">
64907 <primary>SMTP</primary>
64908 <secondary>multiple deliveries</secondary>
64909 </indexterm>
64910 <indexterm role="concept">
64911 <primary>multiple SMTP deliveries</primary>
64912 </indexterm>
64913 Mail waiting to be sent from an intermittently connected host will probably
64914 not have been routed, because without a connection DNS lookups are not
64915 possible. This means that if a normal queue run is done at connection time,
64916 each message is likely to be sent in a separate SMTP session. This can be
64917 avoided by starting the queue run with a command line option beginning with
64918 <option>-qq</option> instead of <option>-q</option>. In this case, the queue is scanned twice. In the
64919 first pass, routing is done but no deliveries take place. The second pass is a
64920 normal queue run; since all the messages have been previously routed, those
64921 destined for the same host are likely to get sent as multiple deliveries in a
64922 single SMTP connection.
64923 </para>
64924 </section>
64925 </chapter>
64926
64927 <chapter id="CHAPnonqueueing">
64928 <title>Using Exim as a non-queueing client</title>
64929 <titleabbrev>Exim as a non-queueing client</titleabbrev>
64930 <para>
64931 <indexterm role="concept">
64932 <primary>client, non-queueing</primary>
64933 </indexterm>
64934 <indexterm role="concept">
64935 <primary>smart host</primary>
64936 <secondary>suppressing queueing</secondary>
64937 </indexterm>
64938 On a personal computer, it is a common requirement for all
64939 email to be sent to a <quote>smart host</quote>. There are plenty of MUAs that can be
64940 configured to operate that way, for all the popular operating systems.
64941 However, there are some MUAs for Unix-like systems that cannot be so
64942 configured: they submit messages using the command line interface of
64943 <filename>/usr/sbin/sendmail</filename>. Furthermore, utility programs such as <emphasis>cron</emphasis> submit
64944 messages this way.
64945 </para>
64946 <para>
64947 If the personal computer runs continuously, there is no problem, because it can
64948 run a conventional MTA that handles delivery to the smart host, and deal with
64949 any delays via its queueing mechanism. However, if the computer does not run
64950 continuously or runs different operating systems at different times, queueing
64951 email is not desirable.
64952 </para>
64953 <para>
64954 There is therefore a requirement for something that can provide the
64955 <filename>/usr/sbin/sendmail</filename> interface but deliver messages to a smart host without
64956 any queueing or retrying facilities. Furthermore, the delivery to the smart
64957 host should be synchronous, so that if it fails, the sending MUA is immediately
64958 informed. In other words, we want something that extends an MUA that submits
64959 to a local MTA via the command line so that it behaves like one that submits
64960 to a remote smart host using TCP/SMTP.
64961 </para>
64962 <para>
64963 There are a number of applications (for example, there is one called <emphasis>ssmtp</emphasis>)
64964 that do this job. However, people have found them to be lacking in various
64965 ways. For instance, you might want to allow aliasing and forwarding to be done
64966 before sending a message to the smart host.
64967 </para>
64968 <para>
64969 Exim already had the necessary infrastructure for doing this job. Just a few
64970 tweaks were needed to make it behave as required, though it is somewhat of an
64971 overkill to use a fully-featured MTA for this purpose.
64972 </para>
64973 <para>
64974 <indexterm role="option">
64975 <primary><option>mua_wrapper</option></primary>
64976 </indexterm>
64977 There is a Boolean global option called <option>mua_wrapper</option>, defaulting false.
64978 Setting <option>mua_wrapper</option> true causes Exim to run in a special mode where it
64979 assumes that it is being used to <quote>wrap</quote> a command-line MUA in the manner
64980 just described. As well as setting <option>mua_wrapper</option>, you also need to provide a
64981 compatible router and transport configuration. Typically there will be just one
64982 router and one transport, sending everything to a smart host.
64983 </para>
64984 <para>
64985 When run in MUA wrapping mode, the behaviour of Exim changes in the
64986 following ways:
64987 </para>
64988 <itemizedlist>
64989 <listitem>
64990 <para>
64991 A daemon cannot be run, nor will Exim accept incoming messages from <emphasis>inetd</emphasis>.
64992 In other words, the only way to submit messages is via the command line.
64993 </para>
64994 </listitem>
64995 <listitem>
64996 <para>
64997 Each message is synchronously delivered as soon as it is received (<option>-odi</option> is
64998 assumed). All queueing options (<option>queue_only</option>, <option>queue_smtp_domains</option>,
64999 <option>control</option> in an ACL, etc.) are quietly ignored. The Exim reception process
65000 does not finish until the delivery attempt is complete. If the delivery is
65001 successful, a zero return code is given.
65002 </para>
65003 </listitem>
65004 <listitem>
65005 <para>
65006 Address redirection is permitted, but the final routing for all addresses must
65007 be to the same remote transport, and to the same list of hosts. Furthermore,
65008 the return address (envelope sender) must be the same for all recipients, as
65009 must any added or deleted header lines. In other words, it must be possible to
65010 deliver the message in a single SMTP transaction, however many recipients there
65011 are.
65012 </para>
65013 </listitem>
65014 <listitem>
65015 <para>
65016 If these conditions are not met, or if routing any address results in a
65017 failure or defer status, or if Exim is unable to deliver all the recipients
65018 successfully to one of the smart hosts, delivery of the entire message fails.
65019 </para>
65020 </listitem>
65021 <listitem>
65022 <para>
65023 Because no queueing is allowed, all failures are treated as permanent; there
65024 is no distinction between 4<emphasis>xx</emphasis> and 5<emphasis>xx</emphasis> SMTP response codes from the
65025 smart host. Furthermore, because only a single yes/no response can be given to
65026 the caller, it is not possible to deliver to some recipients and not others. If
65027 there is an error (temporary or permanent) for any recipient, all are failed.
65028 </para>
65029 </listitem>
65030 <listitem>
65031 <para>
65032 If more than one smart host is listed, Exim will try another host after a
65033 connection failure or a timeout, in the normal way. However, if this kind of
65034 failure happens for all the hosts, the delivery fails.
65035 </para>
65036 </listitem>
65037 <listitem>
65038 <para>
65039 When delivery fails, an error message is written to the standard error stream
65040 (as well as to Exim&#x2019;s log), and Exim exits to the caller with a return code
65041 value 1. The message is expunged from Exim&#x2019;s spool files. No bounce messages
65042 are ever generated.
65043 </para>
65044 </listitem>
65045 <listitem>
65046 <para>
65047 No retry data is maintained, and any retry rules are ignored.
65048 </para>
65049 </listitem>
65050 <listitem>
65051 <para>
65052 A number of Exim options are overridden: <option>deliver_drop_privilege</option> is forced
65053 true, <option>max_rcpt</option> in the <command>smtp</command> transport is forced to <quote>unlimited</quote>,
65054 <option>remote_max_parallel</option> is forced to one, and fallback hosts are ignored.
65055 </para>
65056 </listitem>
65057 </itemizedlist>
65058 <para>
65059 The overall effect is that Exim makes a single synchronous attempt to deliver
65060 the message, failing if there is any kind of problem. Because no local
65061 deliveries are done and no daemon can be run, Exim does not need root
65062 privilege. It should be possible to run it setuid to <emphasis>exim</emphasis> instead of setuid
65063 to <emphasis>root</emphasis>. See section <xref linkend="SECTrunexiwitpri"/> for a general discussion about
65064 the advantages and disadvantages of running without root privilege.
65065 </para>
65066 </chapter>
65067
65068 <chapter id="CHAPlog">
65069 <title>Log files</title>
65070 <para>
65071 <indexterm role="concept" id="IIDloggen" class="startofrange">
65072 <primary>log</primary>
65073 <secondary>general description</secondary>
65074 </indexterm>
65075 <indexterm role="concept">
65076 <primary>log</primary>
65077 <secondary>types of</secondary>
65078 </indexterm>
65079 Exim writes three different logs, referred to as the main log, the reject log,
65080 and the panic log:
65081 </para>
65082 <itemizedlist>
65083 <listitem>
65084 <para>
65085 <indexterm role="concept">
65086 <primary>main log</primary>
65087 </indexterm>
65088 The main log records the arrival of each message and each delivery in a single
65089 line in each case. The format is as compact as possible, in an attempt to keep
65090 down the size of log files. Two-character flag sequences make it easy to pick
65091 out these lines. A number of other events are recorded in the main log. Some of
65092 them are optional, in which case the <option>log_selector</option> option controls whether
65093 they are included or not. A Perl script called <emphasis>eximstats</emphasis>, which does simple
65094 analysis of main log files, is provided in the Exim distribution (see section
65095 <xref linkend="SECTmailstat"/>).
65096 </para>
65097 </listitem>
65098 <listitem>
65099 <para>
65100 <indexterm role="concept">
65101 <primary>reject log</primary>
65102 </indexterm>
65103 The reject log records information from messages that are rejected as a result
65104 of a configuration option (that is, for policy reasons).
65105 The first line of each rejection is a copy of the line that is also written to
65106 the main log. Then, if the message&#x2019;s header has been read at the time the log
65107 is written, its contents are written to this log. Only the original header
65108 lines are available; header lines added by ACLs are not logged. You can use the
65109 reject log to check that your policy controls are working correctly; on a busy
65110 host this may be easier than scanning the main log for rejection messages. You
65111 can suppress the writing of the reject log by setting <option>write_rejectlog</option>
65112 false.
65113 </para>
65114 </listitem>
65115 <listitem>
65116 <para>
65117 <indexterm role="concept">
65118 <primary>panic log</primary>
65119 </indexterm>
65120 <indexterm role="concept">
65121 <primary>system log</primary>
65122 </indexterm>
65123 When certain serious errors occur, Exim writes entries to its panic log. If the
65124 error is sufficiently disastrous, Exim bombs out afterwards. Panic log entries
65125 are usually written to the main log as well, but can get lost amid the mass of
65126 other entries. The panic log should be empty under normal circumstances. It is
65127 therefore a good idea to check it (or to have a <emphasis>cron</emphasis> script check it)
65128 regularly, in order to become aware of any problems. When Exim cannot open its
65129 panic log, it tries as a last resort to write to the system log (syslog). This
65130 is opened with LOG_PID+LOG_CONS and the facility code of LOG_MAIL. The
65131 message itself is written at priority LOG_CRIT.
65132 </para>
65133 </listitem>
65134 </itemizedlist>
65135 <para>
65136 Every log line starts with a timestamp, in the format shown in the following
65137 example. Note that many of the examples shown in this chapter are line-wrapped.
65138 In the log file, this would be all on one line:
65139 </para>
65140 <literallayout class="monospaced">
65141 2001-09-16 16:09:47 SMTP connection from [127.0.0.1] closed
65142   by QUIT
65143 </literallayout>
65144 <para>
65145 By default, the timestamps are in the local timezone. There are two
65146 ways of changing this:
65147 </para>
65148 <itemizedlist>
65149 <listitem>
65150 <para>
65151 You can set the <option>timezone</option> option to a different time zone; in particular, if
65152 you set
65153 </para>
65154 <literallayout class="monospaced">
65155 timezone = UTC
65156 </literallayout>
65157 <para>
65158 the timestamps will be in UTC (aka GMT).
65159 </para>
65160 </listitem>
65161 <listitem>
65162 <para>
65163 If you set <option>log_timezone</option> true, the time zone is added to the timestamp, for
65164 example:
65165 </para>
65166 <literallayout class="monospaced">
65167 2003-04-25 11:17:07 +0100 Start queue run: pid=12762
65168 </literallayout>
65169 </listitem>
65170 </itemizedlist>
65171 <para>
65172 <indexterm role="concept">
65173 <primary>log</primary>
65174 <secondary>process ids in</secondary>
65175 </indexterm>
65176 <indexterm role="concept">
65177 <primary>pid (process id)</primary>
65178 <secondary>in log lines</secondary>
65179 </indexterm>
65180 Exim does not include its process id in log lines by default, but you can
65181 request that it does so by specifying the <literal>pid</literal> log selector (see section
65182 <xref linkend="SECTlogselector"/>). When this is set, the process id is output, in square
65183 brackets, immediately after the time and date.
65184 </para>
65185 <section id="SECTwhelogwri">
65186 <title>Where the logs are written</title>
65187 <para>
65188 <indexterm role="concept">
65189 <primary>log</primary>
65190 <secondary>destination</secondary>
65191 </indexterm>
65192 <indexterm role="concept">
65193 <primary>log</primary>
65194 <secondary>to file</secondary>
65195 </indexterm>
65196 <indexterm role="concept">
65197 <primary>log</primary>
65198 <secondary>to syslog</secondary>
65199 </indexterm>
65200 <indexterm role="concept">
65201 <primary>syslog</primary>
65202 </indexterm>
65203 The logs may be written to local files, or to syslog, or both. However, it
65204 should be noted that many syslog implementations use UDP as a transport, and
65205 are therefore unreliable in the sense that messages are not guaranteed to
65206 arrive at the loghost, nor is the ordering of messages necessarily maintained.
65207 It has also been reported that on large log files (tens of megabytes) you may
65208 need to tweak syslog to prevent it syncing the file with each write &ndash; on
65209 Linux this has been seen to make syslog take 90% plus of CPU time.
65210 </para>
65211 <para>
65212 The destination for Exim&#x2019;s logs is configured by setting LOG_FILE_PATH in
65213 <filename>Local/Makefile</filename> or by setting <option>log_file_path</option> in the run time
65214 configuration. This latter string is expanded, so it can contain, for example,
65215 references to the host name:
65216 </para>
65217 <literallayout class="monospaced">
65218 log_file_path = /var/log/$primary_hostname/exim_%slog
65219 </literallayout>
65220 <para>
65221 It is generally advisable, however, to set the string in <filename>Local/Makefile</filename>
65222 rather than at run time, because then the setting is available right from the
65223 start of Exim&#x2019;s execution. Otherwise, if there&#x2019;s something it wants to log
65224 before it has read the configuration file (for example, an error in the
65225 configuration file) it will not use the path you want, and may not be able to
65226 log at all.
65227 </para>
65228 <para>
65229 The value of LOG_FILE_PATH or <option>log_file_path</option> is a colon-separated
65230 list, currently limited to at most two items. This is one option where the
65231 facility for changing a list separator may not be used. The list must always be
65232 colon-separated. If an item in the list is <quote>syslog</quote> then syslog is used;
65233 otherwise the item must either be an absolute path, containing <literal>%s</literal> at the
65234 point where <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote> is to be inserted, or be empty,
65235 implying the use of a default path.
65236 </para>
65237 <para>
65238 When Exim encounters an empty item in the list, it searches the list defined by
65239 LOG_FILE_PATH, and uses the first item it finds that is neither empty nor
65240 <quote>syslog</quote>. This means that an empty item in <option>log_file_path</option> can be used to
65241 mean <quote>use the path specified at build time</quote>. It no such item exists, log
65242 files are written in the <filename>log</filename> subdirectory of the spool directory. This is
65243 equivalent to the setting:
65244 </para>
65245 <literallayout class="monospaced">
65246 log_file_path = $spool_directory/log/%slog
65247 </literallayout>
65248 <para>
65249 If you do not specify anything at build time or run time,
65250 or if you unset the option at run time (i.e. <literal>log_file_path = </literal>),
65251 that is where the logs are written.
65252 </para>
65253 <para>
65254 A log file path may also contain <literal>%D</literal> or <literal>%M</literal> if datestamped log file names
65255 are in use &ndash; see section <xref linkend="SECTdatlogfil"/> below.
65256 </para>
65257 <para>
65258 Here are some examples of possible settings:
65259 </para>
65260 <literallayout>
65261 <literal>LOG_FILE_PATH=syslog                    </literal> syslog only
65262 <literal>LOG_FILE_PATH=:syslog                   </literal> syslog and default path
65263 <literal>LOG_FILE_PATH=syslog : /usr/log/exim_%s </literal> syslog and specified path
65264 <literal>LOG_FILE_PATH=/usr/log/exim_%s          </literal> specified path only
65265 </literallayout>
65266 <para>
65267 If there are more than two paths in the list, the first is used and a panic
65268 error is logged.
65269 </para>
65270 </section>
65271 <section id="SECID285">
65272 <title>Logging to local files that are periodically <quote>cycled</quote></title>
65273 <para>
65274 <indexterm role="concept">
65275 <primary>log</primary>
65276 <secondary>cycling local files</secondary>
65277 </indexterm>
65278 <indexterm role="concept">
65279 <primary>cycling logs</primary>
65280 </indexterm>
65281 <indexterm role="concept">
65282 <primary><emphasis>exicyclog</emphasis></primary>
65283 </indexterm>
65284 <indexterm role="concept">
65285 <primary>log</primary>
65286 <secondary>local files; writing to</secondary>
65287 </indexterm>
65288 Some operating systems provide centralized and standardized methods for cycling
65289 log files. For those that do not, a utility script called <emphasis>exicyclog</emphasis> is
65290 provided (see section <xref linkend="SECTcyclogfil"/>). This renames and compresses the
65291 main and reject logs each time it is called. The maximum number of old logs to
65292 keep can be set. It is suggested this script is run as a daily <emphasis>cron</emphasis> job.
65293 </para>
65294 <para>
65295 An Exim delivery process opens the main log when it first needs to write to it,
65296 and it keeps the file open in case subsequent entries are required &ndash; for
65297 example, if a number of different deliveries are being done for the same
65298 message. However, remote SMTP deliveries can take a long time, and this means
65299 that the file may be kept open long after it is renamed if <emphasis>exicyclog</emphasis> or
65300 something similar is being used to rename log files on a regular basis. To
65301 ensure that a switch of log files is noticed as soon as possible, Exim calls
65302 <function>stat()</function> on the main log&#x2019;s name before reusing an open file, and if the file
65303 does not exist, or its inode has changed, the old file is closed and Exim
65304 tries to open the main log from scratch. Thus, an old log file may remain open
65305 for quite some time, but no Exim processes should write to it once it has been
65306 renamed.
65307 </para>
65308 </section>
65309 <section id="SECTdatlogfil">
65310 <title>Datestamped log files</title>
65311 <para>
65312 <indexterm role="concept">
65313 <primary>log</primary>
65314 <secondary>datestamped files</secondary>
65315 </indexterm>
65316 Instead of cycling the main and reject log files by renaming them
65317 periodically, some sites like to use files whose names contain a datestamp,
65318 for example, <filename>mainlog-20031225</filename>. The datestamp is in the form <filename>yyyymmdd</filename> or
65319 <filename>yyyymm</filename>. Exim has support for this way of working. It is enabled by setting
65320 the <option>log_file_path</option> option to a path that includes <literal>%D</literal> or <literal>%M</literal> at the
65321 point where the datestamp is required. For example:
65322 </para>
65323 <literallayout class="monospaced">
65324 log_file_path = /var/spool/exim/log/%slog-%D
65325 log_file_path = /var/log/exim-%s-%D.log
65326 log_file_path = /var/spool/exim/log/%D-%slog
65327 log_file_path = /var/log/exim/%s.%M
65328 </literallayout>
65329 <para>
65330 As before, <literal>%s</literal> is replaced by <quote>main</quote> or <quote>reject</quote>; the following are
65331 examples of names generated by the above examples:
65332 </para>
65333 <literallayout class="monospaced">
65334 /var/spool/exim/log/mainlog-20021225
65335 /var/log/exim-reject-20021225.log
65336 /var/spool/exim/log/20021225-mainlog
65337 /var/log/exim/main.200212
65338 </literallayout>
65339 <para>
65340 When this form of log file is specified, Exim automatically switches to new
65341 files at midnight. It does not make any attempt to compress old logs; you
65342 will need to write your own script if you require this. You should not
65343 run <emphasis>exicyclog</emphasis> with this form of logging.
65344 </para>
65345 <para>
65346 The location of the panic log is also determined by <option>log_file_path</option>, but it
65347 is not datestamped, because rotation of the panic log does not make sense.
65348 When generating the name of the panic log, <literal>%D</literal> or <literal>%M</literal> are removed from
65349 the string. In addition, if it immediately follows a slash, a following
65350 non-alphanumeric character is removed; otherwise a preceding non-alphanumeric
65351 character is removed. Thus, the four examples above would give these panic
65352 log names:
65353 </para>
65354 <literallayout class="monospaced">
65355 /var/spool/exim/log/paniclog
65356 /var/log/exim-panic.log
65357 /var/spool/exim/log/paniclog
65358 /var/log/exim/panic
65359 </literallayout>
65360 </section>
65361 <section id="SECID249">
65362 <title>Logging to syslog</title>
65363 <para>
65364 <indexterm role="concept">
65365 <primary>log</primary>
65366 <secondary>syslog; writing to</secondary>
65367 </indexterm>
65368 The use of syslog does not change what Exim logs or the format of its messages,
65369 except in one respect. If <option>syslog_timestamp</option> is set false, the timestamps on
65370 Exim&#x2019;s log lines are omitted when these lines are sent to syslog. Apart from
65371 that, the same strings are written to syslog as to log files. The syslog
65372 <quote>facility</quote> is set to LOG_MAIL, and the program name to <quote>exim</quote>
65373 by default, but you can change these by setting the <option>syslog_facility</option> and
65374 <option>syslog_processname</option> options, respectively. If Exim was compiled with
65375 SYSLOG_LOG_PID set in <filename>Local/Makefile</filename> (this is the default in
65376 <filename>src/EDITME</filename>), then, on systems that permit it (all except ULTRIX), the
65377 LOG_PID flag is set so that the <function>syslog()</function> call adds the pid as well as
65378 the time and host name to each line.
65379 The three log streams are mapped onto syslog priorities as follows:
65380 </para>
65381 <itemizedlist>
65382 <listitem>
65383 <para>
65384 <emphasis>mainlog</emphasis> is mapped to LOG_INFO
65385 </para>
65386 </listitem>
65387 <listitem>
65388 <para>
65389 <emphasis>rejectlog</emphasis> is mapped to LOG_NOTICE
65390 </para>
65391 </listitem>
65392 <listitem>
65393 <para>
65394 <emphasis>paniclog</emphasis> is mapped to LOG_ALERT
65395 </para>
65396 </listitem>
65397 </itemizedlist>
65398 <para>
65399 Many log lines are written to both <emphasis>mainlog</emphasis> and <emphasis>rejectlog</emphasis>, and some are
65400 written to both <emphasis>mainlog</emphasis> and <emphasis>paniclog</emphasis>, so there will be duplicates if
65401 these are routed by syslog to the same place. You can suppress this duplication
65402 by setting <option>syslog_duplication</option> false.
65403 </para>
65404 <para>
65405 Exim&#x2019;s log lines can sometimes be very long, and some of its <emphasis>rejectlog</emphasis>
65406 entries contain multiple lines when headers are included. To cope with both
65407 these cases, entries written to syslog are split into separate <function>syslog()</function>
65408 calls at each internal newline, and also after a maximum of
65409 870 data characters. (This allows for a total syslog line length of 1024, when
65410 additions such as timestamps are added.) If you are running a syslog
65411 replacement that can handle lines longer than the 1024 characters allowed by
65412 RFC 3164, you should set
65413 </para>
65414 <literallayout class="monospaced">
65415 SYSLOG_LONG_LINES=yes
65416 </literallayout>
65417 <para>
65418 in <filename>Local/Makefile</filename> before building Exim. That stops Exim from splitting long
65419 lines, but it still splits at internal newlines in <emphasis>reject</emphasis> log entries.
65420 </para>
65421 <para>
65422 To make it easy to re-assemble split lines later, each component of a split
65423 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;]
65424 where &lt;<emphasis>n</emphasis>&gt; is the component number and &lt;<emphasis>m</emphasis>&gt; is the total number of
65425 components in the entry. The / delimiter is used when the line was split
65426 because it was too long; if it was split because of an internal newline, the \
65427 delimiter is used. For example, supposing the length limit to be 50 instead of
65428 870, the following would be the result of a typical rejection message to
65429 <emphasis>mainlog</emphasis> (LOG_INFO), each line in addition being preceded by the time, host
65430 name, and pid as added by syslog:
65431 </para>
65432 <literallayout class="monospaced">
65433 [1/5] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected from
65434 [2/5]  [127.0.0.1] (ph10): syntax error in 'From' header
65435 [3/5]  when scanning for sender: missing or malformed lo
65436 [4/5] cal part in "&lt;&gt;" (envelope sender is &lt;ph10@cam.exa
65437 [5/5] mple&gt;)
65438 </literallayout>
65439 <para>
65440 The same error might cause the following lines to be written to <quote>rejectlog</quote>
65441 (LOG_NOTICE):
65442 </para>
65443 <literallayout class="monospaced">
65444 [1/18] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected fro
65445 [2/18] m [127.0.0.1] (ph10): syntax error in 'From' head
65446 [3/18] er when scanning for sender: missing or malformed
65447 [4/18]  local part in "&lt;&gt;" (envelope sender is &lt;ph10@cam
65448 [5\18] .example&gt;)
65449 [6\18] Recipients: ph10@some.domain.cam.example
65450 [7\18] P Received: from [127.0.0.1] (ident=ph10)
65451 [8\18]        by xxxxx.cam.example with smtp (Exim 4.00)
65452 [9\18]        id 16RdAL-0006pc-00
65453 [10/18]        for ph10@cam.example; Mon, 16 Sep 2002 16:
65454 [11\18] 09:43 +0100
65455 [12\18] F From: &lt;&gt;
65456 [13\18]   Subject: this is a test header
65457 [18\18]   X-something: this is another header
65458 [15/18] I Message-Id: &lt;E16RdAL-0006pc-00@xxxxx.cam.examp
65459 [16\18] le&gt;
65460 [17\18] B Bcc:
65461 [18/18]   Date: Mon, 16 Sep 2002 16:09:43 +0100
65462 </literallayout>
65463 <para>
65464 Log lines that are neither too long nor contain newlines are written to syslog
65465 without modification.
65466 </para>
65467 <para>
65468 If only syslog is being used, the Exim monitor is unable to provide a log tail
65469 display, unless syslog is routing <emphasis>mainlog</emphasis> to a file on the local host and
65470 the environment variable EXIMON_LOG_FILE_PATH is set to tell the monitor
65471 where it is.
65472 </para>
65473 </section>
65474 <section id="SECID250">
65475 <title>Log line flags</title>
65476 <para>
65477 One line is written to the main log for each message received, and for each
65478 successful, unsuccessful, and delayed delivery. These lines can readily be
65479 picked out by the distinctive two-character flags that immediately follow the
65480 timestamp. The flags are:
65481 </para>
65482 <literallayout>
65483 <literal>&lt;=</literal>     message arrival
65484 <literal>(=</literal>     message fakereject
65485 <literal>=&gt;</literal>     normal message delivery
65486 <literal>-&gt;</literal>     additional address in same delivery
65487 <literal>&gt;&gt;</literal>     cutthrough message delivery
65488 <literal>*&gt;</literal>     delivery suppressed by <option>-N</option>
65489 <literal>**</literal>     delivery failed; address bounced
65490 <literal>==</literal>     delivery deferred; temporary problem
65491 </literallayout>
65492 </section>
65493 <section id="SECID251">
65494 <title>Logging message reception</title>
65495 <para>
65496 <indexterm role="concept">
65497 <primary>log</primary>
65498 <secondary>reception line</secondary>
65499 </indexterm>
65500 The format of the single-line entry in the main log that is written for every
65501 message received is shown in the basic example below, which is split over
65502 several lines in order to fit it on the page:
65503 </para>
65504 <literallayout class="monospaced">
65505 2002-10-31 08:57:53 16ZCW1-0005MB-00 &lt;= kryten@dwarf.fict.example
65506   H=mailer.fict.example [192.168.123.123] U=exim
65507   P=smtp S=5678 id=&lt;incoming message id&gt;
65508 </literallayout>
65509 <para>
65510 The address immediately following <quote>&lt;=</quote> is the envelope sender address. A
65511 bounce message is shown with the sender address <quote>&lt;&gt;</quote>, and if it is locally
65512 generated, this is followed by an item of the form
65513 </para>
65514 <literallayout class="monospaced">
65515 R=&lt;message id&gt;
65516 </literallayout>
65517 <para>
65518 which is a reference to the message that caused the bounce to be sent.
65519 </para>
65520 <para>
65521 <indexterm role="concept">
65522 <primary>HELO</primary>
65523 </indexterm>
65524 <indexterm role="concept">
65525 <primary>EHLO</primary>
65526 </indexterm>
65527 For messages from other hosts, the H and U fields identify the remote host and
65528 record the RFC 1413 identity of the user that sent the message, if one was
65529 received. The number given in square brackets is the IP address of the sending
65530 host. If there is a single, unparenthesized  host name in the H field, as
65531 above, it has been verified to correspond to the IP address (see the
65532 <option>host_lookup</option> option). If the name is in parentheses, it was the name quoted
65533 by the remote host in the SMTP HELO or EHLO command, and has not been
65534 verified. If verification yields a different name to that given for HELO or
65535 EHLO, the verified name appears first, followed by the HELO or EHLO
65536 name in parentheses.
65537 </para>
65538 <para>
65539 Misconfigured hosts (and mail forgers) sometimes put an IP address, with or
65540 without brackets, in the HELO or EHLO command, leading to entries in
65541 the log containing text like these examples:
65542 </para>
65543 <literallayout class="monospaced">
65544 H=(10.21.32.43) [192.168.8.34]
65545 H=([10.21.32.43]) [192.168.8.34]
65546 </literallayout>
65547 <para>
65548 This can be confusing. Only the final address in square brackets can be relied
65549 on.
65550 </para>
65551 <para>
65552 For locally generated messages (that is, messages not received over TCP/IP),
65553 the H field is omitted, and the U field contains the login name of the caller
65554 of Exim.
65555 </para>
65556 <para>
65557 <indexterm role="concept">
65558 <primary>authentication</primary>
65559 <secondary>logging</secondary>
65560 </indexterm>
65561 <indexterm role="concept">
65562 <primary>AUTH</primary>
65563 <secondary>logging</secondary>
65564 </indexterm>
65565 For all messages, the P field specifies the protocol used to receive the
65566 message. This is the value that is stored in <varname>$received_protocol</varname>. In the case
65567 of incoming SMTP messages, the value indicates whether or not any SMTP
65568 extensions (ESMTP), encryption, or authentication were used. If the SMTP
65569 session was encrypted, there is an additional X field that records the cipher
65570 suite that was used.
65571 </para>
65572 <para>
65573 <indexterm role="concept">
65574 <primary>log</primary>
65575 <secondary>protocol</secondary>
65576 </indexterm>
65577 The protocol is set to <quote>esmtpsa</quote> or <quote>esmtpa</quote> for messages received from
65578 hosts that have authenticated themselves using the SMTP AUTH command. The first
65579 value is used when the SMTP connection was encrypted (<quote>secure</quote>). In this case
65580 there is an additional item A= followed by the name of the authenticator that
65581 was used. If an authenticated identification was set up by the authenticator&#x2019;s
65582 <option>server_set_id</option> option, this is logged too, separated by a colon from the
65583 authenticator name.
65584 </para>
65585 <para>
65586 <indexterm role="concept">
65587 <primary>size</primary>
65588 <secondary>of message</secondary>
65589 </indexterm>
65590 The id field records the existing message id, if present. The size of the
65591 received message is given by the S field. When the message is delivered,
65592 headers may be removed or added, so that the size of delivered copies of the
65593 message may not correspond with this value (and indeed may be different to each
65594 other).
65595 </para>
65596 <para>
65597 The <option>log_selector</option> option can be used to request the logging of additional
65598 data when a message is received. See section <xref linkend="SECTlogselector"/> below.
65599 </para>
65600 </section>
65601 <section id="SECID252">
65602 <title>Logging deliveries</title>
65603 <para>
65604 <indexterm role="concept">
65605 <primary>log</primary>
65606 <secondary>delivery line</secondary>
65607 </indexterm>
65608 The format of the single-line entry in the main log that is written for every
65609 delivery is shown in one of the examples below, for local and remote
65610 deliveries, respectively. Each example has been split into multiple lines in order
65611 to fit it on the page:
65612 </para>
65613 <literallayout class="monospaced">
65614 2002-10-31 08:59:13 16ZCW1-0005MB-00 =&gt; marv
65615   &lt;marv@hitch.fict.example&gt; R=localuser T=local_delivery
65616 2002-10-31 09:00:10 16ZCW1-0005MB-00 =&gt;
65617   monk@holistic.fict.example R=dnslookup T=remote_smtp
65618   H=holistic.fict.example [192.168.234.234]
65619 </literallayout>
65620 <para>
65621 For ordinary local deliveries, the original address is given in angle brackets
65622 after the final delivery address, which might be a pipe or a file. If
65623 intermediate address(es) exist between the original and the final address, the
65624 last of these is given in parentheses after the final address. The R and T
65625 fields record the router and transport that were used to process the address.
65626 </para>
65627 <para>
65628 If SMTP AUTH was used for the delivery there is an additional item A=
65629 followed by the name of the authenticator that was used.
65630 If an authenticated identification was set up by the authenticator&#x2019;s <option>client_set_id</option>
65631 option, this is logged too, separated by a colon from the authenticator name.
65632 </para>
65633 <para>
65634 If a shadow transport was run after a successful local delivery, the log line
65635 for the successful delivery has an item added on the end, of the form
65636 </para>
65637 <literallayout>
65638 <literal>ST=&lt;</literal><emphasis>shadow transport name</emphasis><literal>&gt;</literal>
65639 </literallayout>
65640 <para>
65641 If the shadow transport did not succeed, the error message is put in
65642 parentheses afterwards.
65643 </para>
65644 <para>
65645 <indexterm role="concept">
65646 <primary>asterisk</primary>
65647 <secondary>after IP address</secondary>
65648 </indexterm>
65649 When more than one address is included in a single delivery (for example, two
65650 SMTP RCPT commands in one transaction) the second and subsequent addresses are
65651 flagged with <literal>-&gt;</literal> instead of <literal>=&gt;</literal>. When two or more messages are delivered
65652 down a single SMTP connection, an asterisk follows the IP address in the log
65653 lines for the second and subsequent messages.
65654 </para>
65655 <para revisionflag="changed">
65656 When two or more messages are delivered down a single TLS connection, the
65657 DNS and some TLS-related information logged for the first message delivered
65658 will not be present in the log lines for the second and subsequent messages.
65659 TLS cipher information is still available.
65660 </para>
65661 <para>
65662 <indexterm role="concept">
65663 <primary>delivery</primary>
65664 <secondary>cutthrough; logging</secondary>
65665 </indexterm>
65666 <indexterm role="concept">
65667 <primary>cutthrough</primary>
65668 <secondary>logging</secondary>
65669 </indexterm>
65670 When delivery is done in cutthrough mode it is flagged with <literal>&gt;&gt;</literal> and the log
65671 line precedes the reception line, since cutthrough waits for a possible
65672 rejection from the destination in case it can reject the sourced item.
65673 </para>
65674 <para>
65675 The generation of a reply message by a filter file gets logged as a
65676 <quote>delivery</quote> to the addressee, preceded by <quote>&gt;</quote>.
65677 </para>
65678 <para>
65679 The <option>log_selector</option> option can be used to request the logging of additional
65680 data when a message is delivered. See section <xref linkend="SECTlogselector"/> below.
65681 </para>
65682 </section>
65683 <section id="SECID253">
65684 <title>Discarded deliveries</title>
65685 <para>
65686 <indexterm role="concept">
65687 <primary>discarded messages</primary>
65688 </indexterm>
65689 <indexterm role="concept">
65690 <primary>message</primary>
65691 <secondary>discarded</secondary>
65692 </indexterm>
65693 <indexterm role="concept">
65694 <primary>delivery</primary>
65695 <secondary>discarded; logging</secondary>
65696 </indexterm>
65697 When a message is discarded as a result of the command <quote>seen finish</quote> being
65698 obeyed in a filter file which generates no deliveries, a log entry of the form
65699 </para>
65700 <literallayout class="monospaced">
65701 2002-12-10 00:50:49 16auJc-0001UB-00 =&gt; discarded
65702   &lt;low.club@bridge.example&gt; R=userforward
65703 </literallayout>
65704 <para>
65705 is written, to record why no deliveries are logged. When a message is discarded
65706 because it is aliased to <quote>:blackhole:</quote> the log line is like this:
65707 </para>
65708 <literallayout class="monospaced">
65709 1999-03-02 09:44:33 10HmaX-0005vi-00 =&gt; :blackhole:
65710   &lt;hole@nowhere.example&gt; R=blackhole_router
65711 </literallayout>
65712 </section>
65713 <section id="SECID254">
65714 <title>Deferred deliveries</title>
65715 <para>
65716 When a delivery is deferred, a line of the following form is logged:
65717 </para>
65718 <literallayout class="monospaced">
65719 2002-12-19 16:20:23 16aiQz-0002Q5-00 == marvin@endrest.example
65720   R=dnslookup T=smtp defer (146): Connection refused
65721 </literallayout>
65722 <para>
65723 In the case of remote deliveries, the error is the one that was given for the
65724 last IP address that was tried. Details of individual SMTP failures are also
65725 written to the log, so the above line would be preceded by something like
65726 </para>
65727 <literallayout class="monospaced">
65728 2002-12-19 16:20:23 16aiQz-0002Q5-00 Failed to connect to
65729   mail1.endrest.example [192.168.239.239]: Connection refused
65730 </literallayout>
65731 <para>
65732 When a deferred address is skipped because its retry time has not been reached,
65733 a message is written to the log, but this can be suppressed by setting an
65734 appropriate value in <option>log_selector</option>.
65735 </para>
65736 </section>
65737 <section id="SECID255">
65738 <title>Delivery failures</title>
65739 <para>
65740 <indexterm role="concept">
65741 <primary>delivery</primary>
65742 <secondary>failure; logging</secondary>
65743 </indexterm>
65744 If a delivery fails because an address cannot be routed, a line of the
65745 following form is logged:
65746 </para>
65747 <literallayout class="monospaced">
65748 1995-12-19 16:20:23 0tRiQz-0002Q5-00 ** jim@trek99.example
65749   &lt;jim@trek99.example&gt;: unknown mail domain
65750 </literallayout>
65751 <para>
65752 If a delivery fails at transport time, the router and transport are shown, and
65753 the response from the remote host is included, as in this example:
65754 </para>
65755 <literallayout class="monospaced">
65756 2002-07-11 07:14:17 17SXDU-000189-00 ** ace400@pb.example
65757   R=dnslookup T=remote_smtp: SMTP error from remote mailer
65758   after pipelined RCPT TO:&lt;ace400@pb.example&gt;: host
65759   pbmail3.py.example [192.168.63.111]: 553 5.3.0
65760   &lt;ace400@pb.example&gt;...Addressee unknown
65761 </literallayout>
65762 <para>
65763 The word <quote>pipelined</quote> indicates that the SMTP PIPELINING extension was being
65764 used. See <option>hosts_avoid_esmtp</option> in the <command>smtp</command> transport for a way of
65765 disabling PIPELINING. The log lines for all forms of delivery failure are
65766 flagged with <literal>**</literal>.
65767 </para>
65768 </section>
65769 <section id="SECID256">
65770 <title>Fake deliveries</title>
65771 <para>
65772 <indexterm role="concept">
65773 <primary>delivery</primary>
65774 <secondary>fake; logging</secondary>
65775 </indexterm>
65776 If a delivery does not actually take place because the <option>-N</option> option has been
65777 used to suppress it, a normal delivery line is written to the log, except that
65778 <quote>=&gt;</quote> is replaced by <quote>*&gt;</quote>.
65779 </para>
65780 </section>
65781 <section id="SECID257">
65782 <title>Completion</title>
65783 <para>
65784 A line of the form
65785 </para>
65786 <literallayout class="monospaced">
65787 2002-10-31 09:00:11 16ZCW1-0005MB-00 Completed
65788 </literallayout>
65789 <para>
65790 is written to the main log when a message is about to be removed from the spool
65791 at the end of its processing.
65792 </para>
65793 </section>
65794 <section id="SECID258">
65795 <title>Summary of Fields in Log Lines</title>
65796 <para>
65797 <indexterm role="concept">
65798 <primary>log</primary>
65799 <secondary>summary of fields</secondary>
65800 </indexterm>
65801 A summary of the field identifiers that are used in log lines is shown in
65802 the following table:
65803 </para>
65804 <literallayout>
65805 <literal>A   </literal>        authenticator name (and optional id and sender)
65806 <literal>C   </literal>        SMTP confirmation on delivery
65807 <literal>    </literal>        command list for <quote>no mail in SMTP session</quote>
65808 <literal>CV  </literal>        certificate verification status
65809 <literal>D   </literal>        duration of <quote>no mail in SMTP session</quote>
65810 <literal>DN  </literal>        distinguished name from peer certificate
65811 <literal>DS  </literal>        DNSSEC secured lookups
65812 <literal>DT  </literal>        on <literal>=&gt;</literal> lines: time taken for a delivery
65813 <literal>F   </literal>        sender address (on delivery lines)
65814 <literal>H   </literal>        host name and IP address
65815 <literal>I   </literal>        local interface used
65816 <literal>K   </literal>        CHUNKING extension used
65817 <literal>id  </literal>        message id for incoming message
65818 <literal>M8S </literal>        8BITMIME status for incoming message
65819 <literal>P   </literal>        on <literal>&lt;=</literal> lines: protocol used
65820 <literal>    </literal>        on <literal>=&gt;</literal> and <literal>**</literal> lines: return path
65821 <literal>PRDR</literal>        PRDR extension used
65822 <literal>PRX </literal>        on <literal>&lt;=</literal> and <literal>=&gt;</literal> lines: proxy address
65823 <literal>Q   </literal>        alternate queue name
65824 <literal>QT  </literal>        on <literal>=&gt;</literal> lines: time spent on queue so far
65825 <literal>    </literal>        on <quote>Completed</quote> lines: time spent on queue
65826 <literal>R   </literal>        on <literal>&lt;=</literal> lines: reference for local bounce
65827 <literal>    </literal>        on <literal>=&gt;</literal>  <literal>&gt;&gt;</literal> <literal>**</literal> and <literal>==</literal> lines: router name
65828 <literal>S   </literal>        size of message in bytes
65829 <literal>SNI </literal>        server name indication from TLS client hello
65830 <literal>ST  </literal>        shadow transport name
65831 <literal>T   </literal>        on <literal>&lt;=</literal> lines: message subject (topic)
65832 <literal>TFO </literal>        connection took advantage of TCP Fast Open
65833 <literal>    </literal>        on <literal>=&gt;</literal> <literal>**</literal> and <literal>==</literal> lines: transport name
65834 <literal>U   </literal>        local user or RFC 1413 identity
65835 <literal>X   </literal>        TLS cipher suite
65836 </literallayout>
65837 </section>
65838 <section id="SECID259">
65839 <title>Other log entries</title>
65840 <para>
65841 Various other types of log entry are written from time to time. Most should be
65842 self-explanatory. Among the more common are:
65843 </para>
65844 <itemizedlist>
65845 <listitem>
65846 <para>
65847 <indexterm role="concept">
65848 <primary>retry</primary>
65849 <secondary>time not reached</secondary>
65850 </indexterm>
65851 <emphasis>retry time not reached</emphasis>&nbsp;&nbsp;An address previously suffered a temporary error
65852 during routing or local delivery, and the time to retry has not yet arrived.
65853 This message is not written to an individual message log file unless it happens
65854 during the first delivery attempt.
65855 </para>
65856 </listitem>
65857 <listitem>
65858 <para>
65859 <emphasis>retry time not reached for any host</emphasis>&nbsp;&nbsp;An address previously suffered
65860 temporary errors during remote delivery, and the retry time has not yet arrived
65861 for any of the hosts to which it is routed.
65862 </para>
65863 </listitem>
65864 <listitem>
65865 <para>
65866 <indexterm role="concept">
65867 <primary>spool directory</primary>
65868 <secondary>file locked</secondary>
65869 </indexterm>
65870 <emphasis>spool file locked</emphasis>&nbsp;&nbsp;An attempt to deliver a message cannot proceed because
65871 some other Exim process is already working on the message. This can be quite
65872 common if queue running processes are started at frequent intervals. The
65873 <emphasis>exiwhat</emphasis> utility script can be used to find out what Exim processes are
65874 doing.
65875 </para>
65876 </listitem>
65877 <listitem>
65878 <para>
65879 <indexterm role="concept">
65880 <primary>error</primary>
65881 <secondary>ignored</secondary>
65882 </indexterm>
65883 <emphasis>error ignored</emphasis>&nbsp;&nbsp;There are several circumstances that give rise to this
65884 message:
65885 </para>
65886 <orderedlist numeration="arabic">
65887 <listitem>
65888 <para>
65889 Exim failed to deliver a bounce message whose age was greater than
65890 <option>ignore_bounce_errors_after</option>. The bounce was discarded.
65891 </para>
65892 </listitem>
65893 <listitem>
65894 <para>
65895 A filter file set up a delivery using the <quote>noerror</quote> option, and the delivery
65896 failed. The delivery was discarded.
65897 </para>
65898 </listitem>
65899 <listitem>
65900 <para>
65901 A delivery set up by a router configured with
65902 </para>
65903 <literallayout class="monospaced">
65904     errors_to = &lt;&gt;
65905 </literallayout>
65906 <para>
65907 failed. The delivery was discarded.
65908 </para>
65909 </listitem>
65910 </orderedlist>
65911 </listitem>
65912 </itemizedlist>
65913 </section>
65914 <section id="SECTlogselector">
65915 <title>Reducing or increasing what is logged</title>
65916 <para>
65917 <indexterm role="concept">
65918 <primary>log</primary>
65919 <secondary>selectors</secondary>
65920 </indexterm>
65921 By setting the <option>log_selector</option> global option, you can disable some of Exim&#x2019;s
65922 default logging, or you can request additional logging. The value of
65923 <option>log_selector</option> is made up of names preceded by plus or minus characters. For
65924 example:
65925 </para>
65926 <literallayout class="monospaced">
65927 log_selector = +arguments -retry_defer
65928 </literallayout>
65929 <para>
65930 The list of optional log items is in the following table, with the default
65931 selection marked by asterisks:
65932 </para>
65933 <literallayout>
65934 <literal> 8bitmime                   </literal>  received 8BITMIME status
65935 <literal>*acl_warn_skipped           </literal>  skipped <option>warn</option> statement in ACL
65936 <literal> address_rewrite            </literal>  address rewriting
65937 <literal> all_parents                </literal>  all parents in =&gt; lines
65938 <literal> arguments                  </literal>  command line arguments
65939 <literal>*connection_reject          </literal>  connection rejections
65940 <literal>*delay_delivery             </literal>  immediate delivery delayed
65941 <literal> deliver_time               </literal>  time taken to perform delivery
65942 <literal> delivery_size              </literal>  add <literal>S=</literal><emphasis>nnn</emphasis> to =&gt; lines
65943 <literal>*dnslist_defer              </literal>  defers of DNS list (aka RBL) lookups
65944 <literal> dnssec                     </literal>  DNSSEC secured lookups
65945 <literal>*etrn                       </literal>  ETRN commands
65946 <literal>*host_lookup_failed         </literal>  as it says
65947 <literal> ident_timeout              </literal>  timeout for ident connection
65948 <literal> incoming_interface         </literal>  local interface on &lt;= and =&gt; lines
65949 <literal> incoming_port              </literal>  remote port on &lt;= lines
65950 <literal>*lost_incoming_connection   </literal>  as it says (includes timeouts)
65951 <literal> millisec                   </literal>  millisecond timestamps and QT,DT,D times
65952 <literal> outgoing_interface         </literal>  local interface on =&gt; lines
65953 <literal> outgoing_port              </literal>  add remote port to =&gt; lines
65954 <literal>*queue_run                  </literal>  start and end queue runs
65955 <literal> queue_time                 </literal>  time on queue for one recipient
65956 <literal> queue_time_overall         </literal>  time on queue for whole message
65957 <literal> pid                        </literal>  Exim process id
65958 <literal> proxy                      </literal>  proxy address on &lt;= and =&gt; lines
65959 <literal> received_recipients        </literal>  recipients on &lt;= lines
65960 <literal> received_sender            </literal>  sender on &lt;= lines
65961 <literal>*rejected_header            </literal>  header contents on reject log
65962 <literal>*retry_defer                </literal>  <quote>retry time not reached</quote>
65963 <literal> return_path_on_delivery    </literal>  put return path on =&gt; and ** lines
65964 <literal> sender_on_delivery         </literal>  add sender to =&gt; lines
65965 <literal>*sender_verify_fail         </literal>  sender verification failures
65966 <literal>*size_reject                </literal>  rejection because too big
65967 <literal>*skip_delivery              </literal>  delivery skipped in a queue run
65968 <literal>*smtp_confirmation          </literal>  SMTP confirmation on =&gt; lines
65969 <literal> smtp_connection            </literal>  incoming SMTP connections
65970 <literal> smtp_incomplete_transaction</literal>  incomplete SMTP transactions
65971 <literal> smtp_mailauth              </literal>  AUTH argument to MAIL commands
65972 <literal> smtp_no_mail               </literal>  session with no MAIL commands
65973 <literal> smtp_protocol_error        </literal>  SMTP protocol errors
65974 <literal> smtp_syntax_error          </literal>  SMTP syntax errors
65975 <literal> subject                    </literal>  contents of <emphasis>Subject:</emphasis> on &lt;= lines
65976 <literal>*tls_certificate_verified   </literal>  certificate verification status
65977 <literal>*tls_cipher                 </literal>  TLS cipher suite on &lt;= and =&gt; lines
65978 <literal> tls_peerdn                 </literal>  TLS peer DN on &lt;= and =&gt; lines
65979 <literal> tls_sni                    </literal>  TLS SNI on &lt;= lines
65980 <literal> unknown_in_list            </literal>  DNS lookup failed in list match
65981
65982 <literal> all                        </literal>  all of the above
65983 </literallayout>
65984 <para>
65985 See also the <option>slow_lookup_log</option> main configuration option,
65986 section <xref linkend="SECID99"/>
65987 </para>
65988 <para>
65989 More details on each of these items follows:
65990 </para>
65991 <itemizedlist>
65992 <listitem>
65993 <para>
65994 <indexterm role="concept">
65995 <primary>8BITMIME</primary>
65996 </indexterm>
65997 <indexterm role="concept">
65998 <primary>log</primary>
65999 <secondary>8BITMIME</secondary>
66000 </indexterm>
66001 <option>8bitmime</option>: This causes Exim to log any 8BITMIME status of received messages,
66002 which may help in tracking down interoperability issues with ancient MTAs
66003 that are not 8bit clean.  This is added to the <quote>&lt;=</quote> line, tagged with
66004 <literal>M8S=</literal> and a value of <literal>0</literal>, <literal>7</literal> or <literal>8</literal>, corresponding to "not given",
66005 <literal>7BIT</literal> and <literal>8BITMIME</literal> respectively.
66006 </para>
66007 </listitem>
66008 <listitem>
66009 <para>
66010 <indexterm role="concept">
66011 <primary><option>warn</option> ACL verb</primary>
66012 <secondary>log when skipping</secondary>
66013 </indexterm>
66014 <option>acl_warn_skipped</option>: When an ACL <option>warn</option> statement is skipped because one of
66015 its conditions cannot be evaluated, a log line to this effect is written if
66016 this log selector is set.
66017 </para>
66018 </listitem>
66019 <listitem>
66020 <para>
66021 <indexterm role="concept">
66022 <primary>log</primary>
66023 <secondary>rewriting</secondary>
66024 </indexterm>
66025 <indexterm role="concept">
66026 <primary>rewriting</primary>
66027 <secondary>logging</secondary>
66028 </indexterm>
66029 <option>address_rewrite</option>: This applies both to global rewrites and per-transport
66030 rewrites, but not to rewrites in filters run as an unprivileged user (because
66031 such users cannot access the log).
66032 </para>
66033 </listitem>
66034 <listitem>
66035 <para>
66036 <indexterm role="concept">
66037 <primary>log</primary>
66038 <secondary>full parentage</secondary>
66039 </indexterm>
66040 <option>all_parents</option>: Normally only the original and final addresses are logged on
66041 delivery lines; with this selector, intermediate parents are given in
66042 parentheses between them.
66043 </para>
66044 </listitem>
66045 <listitem>
66046 <para>
66047 <indexterm role="concept">
66048 <primary>log</primary>
66049 <secondary>Exim arguments</secondary>
66050 </indexterm>
66051 <indexterm role="concept">
66052 <primary>Exim arguments, logging</primary>
66053 </indexterm>
66054 <option>arguments</option>: This causes Exim to write the arguments with which it was called
66055 to the main log, preceded by the current working directory. This is a debugging
66056 feature, added to make it easier to find out how certain MUAs call
66057 <filename>/usr/sbin/sendmail</filename>. The logging does not happen if Exim has given up root
66058 privilege because it was called with the <option>-C</option> or <option>-D</option> options. Arguments
66059 that are empty or that contain white space are quoted. Non-printing characters
66060 are shown as escape sequences. This facility cannot log unrecognized arguments,
66061 because the arguments are checked before the configuration file is read. The
66062 only way to log such cases is to interpose a script such as <filename>util/logargs.sh</filename>
66063 between the caller and Exim.
66064 </para>
66065 </listitem>
66066 <listitem>
66067 <para>
66068 <indexterm role="concept">
66069 <primary>log</primary>
66070 <secondary>connection rejections</secondary>
66071 </indexterm>
66072 <option>connection_reject</option>: A log entry is written whenever an incoming SMTP
66073 connection is rejected, for whatever reason.
66074 </para>
66075 </listitem>
66076 <listitem>
66077 <para>
66078 <indexterm role="concept">
66079 <primary>log</primary>
66080 <secondary>delayed delivery</secondary>
66081 </indexterm>
66082 <indexterm role="concept">
66083 <primary>delayed delivery, logging</primary>
66084 </indexterm>
66085 <option>delay_delivery</option>: A log entry is written whenever a delivery process is not
66086 started for an incoming message because the load is too high or too many
66087 messages were received on one connection. Logging does not occur if no delivery
66088 process is started because <option>queue_only</option> is set or <option>-odq</option> was used.
66089 </para>
66090 </listitem>
66091 <listitem>
66092 <para>
66093 <indexterm role="concept">
66094 <primary>log</primary>
66095 <secondary>delivery duration</secondary>
66096 </indexterm>
66097 <option>deliver_time</option>: For each delivery, the amount of real time it has taken to
66098 perform the actual delivery is logged as DT=&lt;<emphasis>time</emphasis>&gt;, for example, <literal>DT=1s</literal>.
66099 If millisecond logging is enabled, short times will be shown with greater
66100 precision, eg. <literal>DT=0.304</literal>.
66101 </para>
66102 </listitem>
66103 <listitem>
66104 <para>
66105 <indexterm role="concept">
66106 <primary>log</primary>
66107 <secondary>message size on delivery</secondary>
66108 </indexterm>
66109 <indexterm role="concept">
66110 <primary>size</primary>
66111 <secondary>of message</secondary>
66112 </indexterm>
66113 <option>delivery_size</option>: For each delivery, the size of message delivered is added to
66114 the <quote>=&gt;</quote> line, tagged with S=.
66115 </para>
66116 </listitem>
66117 <listitem>
66118 <para>
66119 <indexterm role="concept">
66120 <primary>log</primary>
66121 <secondary>dnslist defer</secondary>
66122 </indexterm>
66123 <indexterm role="concept">
66124 <primary>DNS list</primary>
66125 <secondary>logging defer</secondary>
66126 </indexterm>
66127 <indexterm role="concept">
66128 <primary>black list (DNS)</primary>
66129 </indexterm>
66130 <option>dnslist_defer</option>: A log entry is written if an attempt to look up a host in a
66131 DNS black list suffers a temporary error.
66132 </para>
66133 </listitem>
66134 <listitem>
66135 <para>
66136 <indexterm role="concept">
66137 <primary>log</primary>
66138 <secondary>dnssec</secondary>
66139 </indexterm>
66140 <indexterm role="concept">
66141 <primary>dnssec</primary>
66142 <secondary>logging</secondary>
66143 </indexterm>
66144 <option>dnssec</option>: For message acceptance and (attempted) delivery log lines, when
66145 dns lookups gave secure results a tag of DS is added.
66146 For acceptance this covers the reverse and forward lookups for host name verification.
66147 It does not cover helo-name verification.
66148 For delivery this covers the SRV, MX, A and/or AAAA lookups.
66149 </para>
66150 </listitem>
66151 <listitem>
66152 <para>
66153 <indexterm role="concept">
66154 <primary>log</primary>
66155 <secondary>ETRN commands</secondary>
66156 </indexterm>
66157 <indexterm role="concept">
66158 <primary>ETRN</primary>
66159 <secondary>logging</secondary>
66160 </indexterm>
66161 <option>etrn</option>: Every valid ETRN command that is received is logged, before the ACL
66162 is run to determine whether or not it is actually accepted. An invalid ETRN
66163 command, or one received within a message transaction is not logged by this
66164 selector (see <option>smtp_syntax_error</option> and <option>smtp_protocol_error</option>).
66165 </para>
66166 </listitem>
66167 <listitem>
66168 <para>
66169 <indexterm role="concept">
66170 <primary>log</primary>
66171 <secondary>host lookup failure</secondary>
66172 </indexterm>
66173 <option>host_lookup_failed</option>: When a lookup of a host&#x2019;s IP addresses fails to find
66174 any addresses, or when a lookup of an IP address fails to find a host name, a
66175 log line is written. This logging does not apply to direct DNS lookups when
66176 routing email addresses, but it does apply to <quote>byname</quote> lookups.
66177 </para>
66178 </listitem>
66179 <listitem>
66180 <para>
66181 <indexterm role="concept">
66182 <primary>log</primary>
66183 <secondary>ident timeout</secondary>
66184 </indexterm>
66185 <indexterm role="concept">
66186 <primary>RFC 1413</primary>
66187 <secondary>logging timeout</secondary>
66188 </indexterm>
66189 <option>ident_timeout</option>: A log line is written whenever an attempt to connect to a
66190 client&#x2019;s ident port times out.
66191 </para>
66192 </listitem>
66193 <listitem>
66194 <para>
66195 <indexterm role="concept">
66196 <primary>log</primary>
66197 <secondary>incoming interface</secondary>
66198 </indexterm>
66199 <indexterm role="concept">
66200 <primary>log</primary>
66201 <secondary>local interface</secondary>
66202 </indexterm>
66203 <indexterm role="concept">
66204 <primary>log</primary>
66205 <secondary>local address and port</secondary>
66206 </indexterm>
66207 <indexterm role="concept">
66208 <primary>TCP/IP</primary>
66209 <secondary>logging local address and port</secondary>
66210 </indexterm>
66211 <indexterm role="concept">
66212 <primary>interface</primary>
66213 <secondary>logging</secondary>
66214 </indexterm>
66215 <option>incoming_interface</option>: The interface on which a message was received is added
66216 to the <quote>&lt;=</quote> line as an IP address in square brackets, tagged by I= and
66217 followed by a colon and the port number. The local interface and port are also
66218 added to other SMTP log lines, for example <quote>SMTP connection from</quote>, to
66219 rejection lines, and (despite the name) to outgoing <quote>=&gt;</quote> and <quote>-&gt;</quote> lines.
66220 The latter can be disabled by turning off the <option>outgoing_interface</option> option.
66221 </para>
66222 </listitem>
66223 <listitem>
66224 <para>
66225 <indexterm role="concept">
66226 <primary>log</primary>
66227 <secondary>incoming proxy address</secondary>
66228 </indexterm>
66229 <indexterm role="concept">
66230 <primary>proxy</primary>
66231 <secondary>logging proxy address</secondary>
66232 </indexterm>
66233 <indexterm role="concept">
66234 <primary>TCP/IP</primary>
66235 <secondary>logging proxy address</secondary>
66236 </indexterm>
66237 <option>proxy</option>: The internal (closest to the system running Exim) IP address
66238 of the proxy, tagged by PRX=, on the <quote>&lt;=</quote> line for a message accepted
66239 on a proxied connection
66240 or the <quote>=&gt;</quote> line for a message delivered on a proxied connection.
66241 See <xref linkend="SECTproxyInbound"/> for more information.
66242 </para>
66243 </listitem>
66244 <listitem>
66245 <para>
66246 <indexterm role="concept">
66247 <primary>log</primary>
66248 <secondary>incoming remote port</secondary>
66249 </indexterm>
66250 <indexterm role="concept">
66251 <primary>port</primary>
66252 <secondary>logging remote</secondary>
66253 </indexterm>
66254 <indexterm role="concept">
66255 <primary>TCP/IP</primary>
66256 <secondary>logging incoming remote port</secondary>
66257 </indexterm>
66258 <indexterm role="variable">
66259 <primary><varname>$sender_fullhost</varname></primary>
66260 </indexterm>
66261 <indexterm role="variable">
66262 <primary><varname>$sender_rcvhost</varname></primary>
66263 </indexterm>
66264 <option>incoming_port</option>: The remote port number from which a message was received is
66265 added to log entries and <emphasis>Received:</emphasis> header lines, following the IP address
66266 in square brackets, and separated from it by a colon. This is implemented by
66267 changing the value that is put in the <varname>$sender_fullhost</varname> and
66268 <varname>$sender_rcvhost</varname> variables. Recording the remote port number has become more
66269 important with the widening use of NAT (see RFC 2505).
66270 </para>
66271 </listitem>
66272 <listitem>
66273 <para>
66274 <indexterm role="concept">
66275 <primary>log</primary>
66276 <secondary>dropped connection</secondary>
66277 </indexterm>
66278 <option>lost_incoming_connection</option>: A log line is written when an incoming SMTP
66279 connection is unexpectedly dropped.
66280 </para>
66281 </listitem>
66282 <listitem>
66283 <para revisionflag="changed">
66284 <indexterm role="concept">
66285 <primary>log</primary>
66286 <secondary>millisecond timestamps</secondary>
66287 </indexterm>
66288 <indexterm role="concept">
66289 <primary>millisecond</primary>
66290 <secondary>logging</secondary>
66291 </indexterm>
66292 <indexterm role="concept">
66293 <primary>timstamps</primary>
66294 <secondary>millisecond, in logs</secondary>
66295 </indexterm>
66296 <option>millisec</option>: Timestamps have a period and three decimal places of finer granularity
66297 appended to the seconds value.
66298 </para>
66299 </listitem>
66300 <listitem>
66301 <para>
66302 <indexterm role="concept">
66303 <primary>log</primary>
66304 <secondary>outgoing interface</secondary>
66305 </indexterm>
66306 <indexterm role="concept">
66307 <primary>log</primary>
66308 <secondary>local interface</secondary>
66309 </indexterm>
66310 <indexterm role="concept">
66311 <primary>log</primary>
66312 <secondary>local address and port</secondary>
66313 </indexterm>
66314 <indexterm role="concept">
66315 <primary>TCP/IP</primary>
66316 <secondary>logging local address and port</secondary>
66317 </indexterm>
66318 <indexterm role="concept">
66319 <primary>interface</primary>
66320 <secondary>logging</secondary>
66321 </indexterm>
66322 <option>outgoing_interface</option>: If <option>incoming_interface</option> is turned on, then the
66323 interface on which a message was sent is added to delivery lines as an I= tag
66324 followed by IP address in square brackets. You can disable this by turning
66325 off the <option>outgoing_interface</option> option.
66326 </para>
66327 </listitem>
66328 <listitem>
66329 <para>
66330 <indexterm role="concept">
66331 <primary>log</primary>
66332 <secondary>outgoing remote port</secondary>
66333 </indexterm>
66334 <indexterm role="concept">
66335 <primary>port</primary>
66336 <secondary>logging outgoint remote</secondary>
66337 </indexterm>
66338 <indexterm role="concept">
66339 <primary>TCP/IP</primary>
66340 <secondary>logging outgoing remote port</secondary>
66341 </indexterm>
66342 <option>outgoing_port</option>: The remote port number is added to delivery log lines (those
66343 containing =&gt; tags) following the IP address.
66344 The local port is also added if <option>incoming_interface</option> and
66345 <option>outgoing_interface</option> are both enabled.
66346 This option is not included in the default setting, because for most ordinary
66347 configurations, the remote port number is always 25 (the SMTP port), and the
66348 local port is a random ephemeral port.
66349 </para>
66350 </listitem>
66351 <listitem>
66352 <para>
66353 <indexterm role="concept">
66354 <primary>log</primary>
66355 <secondary>process ids in</secondary>
66356 </indexterm>
66357 <indexterm role="concept">
66358 <primary>pid (process id)</primary>
66359 <secondary>in log lines</secondary>
66360 </indexterm>
66361 <option>pid</option>: The current process id is added to every log line, in square brackets,
66362 immediately after the time and date.
66363 </para>
66364 </listitem>
66365 <listitem>
66366 <para>
66367 <indexterm role="concept">
66368 <primary>log</primary>
66369 <secondary>queue run</secondary>
66370 </indexterm>
66371 <indexterm role="concept">
66372 <primary>queue runner</primary>
66373 <secondary>logging</secondary>
66374 </indexterm>
66375 <option>queue_run</option>: The start and end of every queue run are logged.
66376 </para>
66377 </listitem>
66378 <listitem>
66379 <para>
66380 <indexterm role="concept">
66381 <primary>log</primary>
66382 <secondary>queue time</secondary>
66383 </indexterm>
66384 <option>queue_time</option>: The amount of time the message has been in the queue on the
66385 local host is logged as QT=&lt;<emphasis>time</emphasis>&gt; on delivery (<literal>=&gt;</literal>) lines, for example,
66386 <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the message, so it
66387 includes reception time as well as the delivery time for the current address.
66388 This means that it may be longer than the difference between the arrival and
66389 delivery log line times, because the arrival log line is not written until the
66390 message has been successfully received.
66391 If millisecond logging is enabled, short times will be shown with greater
66392 precision, eg. <literal>QT=1.578s</literal>.
66393 </para>
66394 </listitem>
66395 <listitem>
66396 <para>
66397 <option>queue_time_overall</option>: The amount of time the message has been in the queue on
66398 the local host is logged as QT=&lt;<emphasis>time</emphasis>&gt; on <quote>Completed</quote> lines, for
66399 example, <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the
66400 message, so it includes reception time as well as the total delivery time.
66401 </para>
66402 </listitem>
66403 <listitem>
66404 <para>
66405 <indexterm role="concept">
66406 <primary>log</primary>
66407 <secondary>recipients</secondary>
66408 </indexterm>
66409 <option>received_recipients</option>: The recipients of a message are listed in the main log
66410 as soon as the message is received. The list appears at the end of the log line
66411 that is written when a message is received, preceded by the word <quote>for</quote>. The
66412 addresses are listed after they have been qualified, but before any rewriting
66413 has taken place.
66414 Recipients that were discarded by an ACL for MAIL or RCPT do not appear
66415 in the list.
66416 </para>
66417 </listitem>
66418 <listitem>
66419 <para>
66420 <indexterm role="concept">
66421 <primary>log</primary>
66422 <secondary>sender reception</secondary>
66423 </indexterm>
66424 <option>received_sender</option>: The unrewritten original sender of a message is added to
66425 the end of the log line that records the message&#x2019;s arrival, after the word
66426 <quote>from</quote> (before the recipients if <option>received_recipients</option> is also set).
66427 </para>
66428 </listitem>
66429 <listitem>
66430 <para>
66431 <indexterm role="concept">
66432 <primary>log</primary>
66433 <secondary>header lines for rejection</secondary>
66434 </indexterm>
66435 <option>rejected_header</option>: If a message&#x2019;s header has been received at the time a
66436 rejection is written to the reject log, the complete header is added to the
66437 log. Header logging can be turned off individually for messages that are
66438 rejected by the <function>local_scan()</function> function (see section <xref linkend="SECTapiforloc"/>).
66439 </para>
66440 </listitem>
66441 <listitem>
66442 <para>
66443 <indexterm role="concept">
66444 <primary>log</primary>
66445 <secondary>retry defer</secondary>
66446 </indexterm>
66447 <option>retry_defer</option>: A log line is written if a delivery is deferred because a
66448 retry time has not yet been reached. However, this <quote>retry time not reached</quote>
66449 message is always omitted from individual message logs after the first delivery
66450 attempt.
66451 </para>
66452 </listitem>
66453 <listitem>
66454 <para>
66455 <indexterm role="concept">
66456 <primary>log</primary>
66457 <secondary>return path</secondary>
66458 </indexterm>
66459 <option>return_path_on_delivery</option>: The return path that is being transmitted with
66460 the message is included in delivery and bounce lines, using the tag P=.
66461 This is omitted if no delivery actually happens, for example, if routing fails,
66462 or if delivery is to <filename>/dev/null</filename> or to <literal>:blackhole:</literal>.
66463 </para>
66464 </listitem>
66465 <listitem>
66466 <para>
66467 <indexterm role="concept">
66468 <primary>log</primary>
66469 <secondary>sender on delivery</secondary>
66470 </indexterm>
66471 <option>sender_on_delivery</option>: The message&#x2019;s sender address is added to every delivery
66472 and bounce line, tagged by F= (for <quote>from</quote>).
66473 This is the original sender that was received with the message; it is not
66474 necessarily the same as the outgoing return path.
66475 </para>
66476 </listitem>
66477 <listitem>
66478 <para>
66479 <indexterm role="concept">
66480 <primary>log</primary>
66481 <secondary>sender verify failure</secondary>
66482 </indexterm>
66483 <option>sender_verify_fail</option>: If this selector is unset, the separate log line that
66484 gives details of a sender verification failure is not written. Log lines for
66485 the rejection of SMTP commands contain just <quote>sender verify failed</quote>, so some
66486 detail is lost.
66487 </para>
66488 </listitem>
66489 <listitem>
66490 <para>
66491 <indexterm role="concept">
66492 <primary>log</primary>
66493 <secondary>size rejection</secondary>
66494 </indexterm>
66495 <option>size_reject</option>: A log line is written whenever a message is rejected because
66496 it is too big.
66497 </para>
66498 </listitem>
66499 <listitem>
66500 <para>
66501 <indexterm role="concept">
66502 <primary>log</primary>
66503 <secondary>frozen messages; skipped</secondary>
66504 </indexterm>
66505 <indexterm role="concept">
66506 <primary>frozen messages</primary>
66507 <secondary>logging skipping</secondary>
66508 </indexterm>
66509 <option>skip_delivery</option>: A log line is written whenever a message is skipped during a
66510 queue run because it is frozen or because another process is already delivering
66511 it.
66512 <indexterm role="concept">
66513 <primary><quote>spool file is locked</quote></primary>
66514 </indexterm>
66515 The message that is written is <quote>spool file is locked</quote>.
66516 </para>
66517 </listitem>
66518 <listitem>
66519 <para>
66520 <indexterm role="concept">
66521 <primary>log</primary>
66522 <secondary>smtp confirmation</secondary>
66523 </indexterm>
66524 <indexterm role="concept">
66525 <primary>SMTP</primary>
66526 <secondary>logging confirmation</secondary>
66527 </indexterm>
66528 <indexterm role="concept">
66529 <primary>LMTP</primary>
66530 <secondary>logging confirmation</secondary>
66531 </indexterm>
66532 <option>smtp_confirmation</option>: The response to the final <quote>.</quote> in the SMTP or LMTP dialogue for
66533 outgoing messages is added to delivery log lines in the form <literal>C=</literal>&lt;<emphasis>text</emphasis>&gt;.
66534 A number of MTAs (including Exim) return an identifying string in this
66535 response.
66536 </para>
66537 </listitem>
66538 <listitem>
66539 <para>
66540 <indexterm role="concept">
66541 <primary>log</primary>
66542 <secondary>SMTP connections</secondary>
66543 </indexterm>
66544 <indexterm role="concept">
66545 <primary>SMTP</primary>
66546 <secondary>logging connections</secondary>
66547 </indexterm>
66548 <option>smtp_connection</option>: A log line is written whenever an incoming SMTP connection is
66549 established or closed, unless the connection is from a host that matches
66550 <option>hosts_connection_nolog</option>. (In contrast, <option>lost_incoming_connection</option> applies
66551 only when the closure is unexpected.) This applies to connections from local
66552 processes that use <option>-bs</option> as well as to TCP/IP connections. If a connection is
66553 dropped in the middle of a message, a log line is always written, whether or
66554 not this selector is set, but otherwise nothing is written at the start and end
66555 of connections unless this selector is enabled.
66556 </para>
66557 <para>
66558 For TCP/IP connections to an Exim daemon, the current number of connections is
66559 included in the log message for each new connection, but note that the count is
66560 reset if the daemon is restarted.
66561 Also, because connections are closed (and the closure is logged) in
66562 subprocesses, the count may not include connections that have been closed but
66563 whose termination the daemon has not yet noticed. Thus, while it is possible to
66564 match up the opening and closing of connections in the log, the value of the
66565 logged counts may not be entirely accurate.
66566 </para>
66567 </listitem>
66568 <listitem>
66569 <para>
66570 <indexterm role="concept">
66571 <primary>log</primary>
66572 <secondary>SMTP transaction; incomplete</secondary>
66573 </indexterm>
66574 <indexterm role="concept">
66575 <primary>SMTP</primary>
66576 <secondary>logging incomplete transactions</secondary>
66577 </indexterm>
66578 <option>smtp_incomplete_transaction</option>: When a mail transaction is aborted by
66579 RSET, QUIT, loss of connection, or otherwise, the incident is logged,
66580 and the message sender plus any accepted recipients are included in the log
66581 line. This can provide evidence of dictionary attacks.
66582 </para>
66583 </listitem>
66584 <listitem>
66585 <para>
66586 <indexterm role="concept">
66587 <primary>log</primary>
66588 <secondary>non-MAIL SMTP sessions</secondary>
66589 </indexterm>
66590 <indexterm role="concept">
66591 <primary>MAIL</primary>
66592 <secondary>logging session without</secondary>
66593 </indexterm>
66594 <option>smtp_no_mail</option>: A line is written to the main log whenever an accepted SMTP
66595 connection terminates without having issued a MAIL command. This includes both
66596 the case when the connection is dropped, and the case when QUIT is used. It
66597 does not include cases where the connection is rejected right at the start (by
66598 an ACL, or because there are too many connections, or whatever). These cases
66599 already have their own log lines.
66600 </para>
66601 <para>
66602 The log line that is written contains the identity of the client in the usual
66603 way, followed by D= and a time, which records the duration of the connection.
66604 If the connection was authenticated, this fact is logged exactly as it is for
66605 an incoming message, with an A= item. If the connection was encrypted, CV=,
66606 DN=, and X= items may appear as they do for an incoming message, controlled by
66607 the same logging options.
66608 </para>
66609 <para>
66610 Finally, if any SMTP commands were issued during the connection, a C= item
66611 is added to the line, listing the commands that were used. For example,
66612 </para>
66613 <literallayout class="monospaced">
66614 C=EHLO,QUIT
66615 </literallayout>
66616 <para>
66617 shows that the client issued QUIT straight after EHLO. If there were fewer
66618 than 20 commands, they are all listed. If there were more than 20 commands,
66619 the last 20 are listed, preceded by <quote>...</quote>. However, with the default
66620 setting of 10 for <option>smtp_accept_max_nonmail</option>, the connection will in any case
66621 have been aborted before 20 non-mail commands are processed.
66622 </para>
66623 </listitem>
66624 <listitem>
66625 <para>
66626 <option>smtp_mailauth</option>: A third subfield with the authenticated sender,
66627 colon-separated, is appended to the A= item for a message arrival or delivery
66628 log line, if an AUTH argument to the SMTP MAIL command (see <xref linkend="SECTauthparamail"/>)
66629 was accepted or used.
66630 </para>
66631 </listitem>
66632 <listitem>
66633 <para>
66634 <indexterm role="concept">
66635 <primary>log</primary>
66636 <secondary>SMTP protocol error</secondary>
66637 </indexterm>
66638 <indexterm role="concept">
66639 <primary>SMTP</primary>
66640 <secondary>logging protocol error</secondary>
66641 </indexterm>
66642 <option>smtp_protocol_error</option>: A log line is written for every SMTP protocol error
66643 encountered. Exim does not have perfect detection of all protocol errors
66644 because of transmission delays and the use of pipelining. If PIPELINING has
66645 been advertised to a client, an Exim server assumes that the client will use
66646 it, and therefore it does not count <quote>expected</quote> errors (for example, RCPT
66647 received after rejecting MAIL) as protocol errors.
66648 </para>
66649 </listitem>
66650 <listitem>
66651 <para>
66652 <indexterm role="concept">
66653 <primary>SMTP</primary>
66654 <secondary>logging syntax errors</secondary>
66655 </indexterm>
66656 <indexterm role="concept">
66657 <primary>SMTP</primary>
66658 <secondary>syntax errors; logging</secondary>
66659 </indexterm>
66660 <indexterm role="concept">
66661 <primary>SMTP</primary>
66662 <secondary>unknown command; logging</secondary>
66663 </indexterm>
66664 <indexterm role="concept">
66665 <primary>log</primary>
66666 <secondary>unknown SMTP command</secondary>
66667 </indexterm>
66668 <indexterm role="concept">
66669 <primary>log</primary>
66670 <secondary>SMTP syntax error</secondary>
66671 </indexterm>
66672 <option>smtp_syntax_error</option>: A log line is written for every SMTP syntax error
66673 encountered. An unrecognized command is treated as a syntax error. For an
66674 external connection, the host identity is given; for an internal connection
66675 using <option>-bs</option> the sender identification (normally the calling user) is given.
66676 </para>
66677 </listitem>
66678 <listitem>
66679 <para>
66680 <indexterm role="concept">
66681 <primary>log</primary>
66682 <secondary>subject</secondary>
66683 </indexterm>
66684 <indexterm role="concept">
66685 <primary>subject, logging</primary>
66686 </indexterm>
66687 <option>subject</option>: The subject of the message is added to the arrival log line,
66688 preceded by <quote>T=</quote> (T for <quote>topic</quote>, since S is already used for <quote>size</quote>).
66689 Any MIME <quote>words</quote> in the subject are decoded. The <option>print_topbitchars</option> option
66690 specifies whether characters with values greater than 127 should be logged
66691 unchanged, or whether they should be rendered as escape sequences.
66692 </para>
66693 </listitem>
66694 <listitem>
66695 <para>
66696 <indexterm role="concept">
66697 <primary>log</primary>
66698 <secondary>certificate verification</secondary>
66699 </indexterm>
66700 <option>tls_certificate_verified</option>: An extra item is added to &lt;= and =&gt; log lines
66701 when TLS is in use. The item is <literal>CV=yes</literal> if the peer&#x2019;s certificate was
66702 verified, and <literal>CV=no</literal> if not.
66703 </para>
66704 </listitem>
66705 <listitem>
66706 <para>
66707 <indexterm role="concept">
66708 <primary>log</primary>
66709 <secondary>TLS cipher</secondary>
66710 </indexterm>
66711 <indexterm role="concept">
66712 <primary>TLS</primary>
66713 <secondary>logging cipher</secondary>
66714 </indexterm>
66715 <option>tls_cipher</option>: When a message is sent or received over an encrypted
66716 connection, the cipher suite used is added to the log line, preceded by X=.
66717 </para>
66718 </listitem>
66719 <listitem>
66720 <para>
66721 <indexterm role="concept">
66722 <primary>log</primary>
66723 <secondary>TLS peer DN</secondary>
66724 </indexterm>
66725 <indexterm role="concept">
66726 <primary>TLS</primary>
66727 <secondary>logging peer DN</secondary>
66728 </indexterm>
66729 <option>tls_peerdn</option>: When a message is sent or received over an encrypted
66730 connection, and a certificate is supplied by the remote host, the peer DN is
66731 added to the log line, preceded by DN=.
66732 </para>
66733 </listitem>
66734 <listitem>
66735 <para>
66736 <indexterm role="concept">
66737 <primary>log</primary>
66738 <secondary>TLS SNI</secondary>
66739 </indexterm>
66740 <indexterm role="concept">
66741 <primary>TLS</primary>
66742 <secondary>logging SNI</secondary>
66743 </indexterm>
66744 <option>tls_sni</option>: When a message is received over an encrypted connection, and
66745 the remote host provided the Server Name Indication extension, the SNI is
66746 added to the log line, preceded by SNI=.
66747 </para>
66748 </listitem>
66749 <listitem>
66750 <para>
66751 <indexterm role="concept">
66752 <primary>log</primary>
66753 <secondary>DNS failure in list</secondary>
66754 </indexterm>
66755 <option>unknown_in_list</option>: This setting causes a log entry to be written when the
66756 result of a list match is failure because a DNS lookup failed.
66757 </para>
66758 </listitem>
66759 </itemizedlist>
66760 </section>
66761 <section id="SECID260">
66762 <title>Message log</title>
66763 <para>
66764 <indexterm role="concept">
66765 <primary>message</primary>
66766 <secondary>log file for</secondary>
66767 </indexterm>
66768 <indexterm role="concept">
66769 <primary>log</primary>
66770 <secondary>message log; description of</secondary>
66771 </indexterm>
66772 <indexterm role="concept">
66773 <primary><filename>msglog</filename> directory</primary>
66774 </indexterm>
66775 <indexterm role="option">
66776 <primary><option>preserve_message_logs</option></primary>
66777 </indexterm>
66778 In addition to the general log files, Exim writes a log file for each message
66779 that it handles. The names of these per-message logs are the message ids, and
66780 they are kept in the <filename>msglog</filename> sub-directory of the spool directory. Each
66781 message log contains copies of the log lines that apply to the message. This
66782 makes it easier to inspect the status of an individual message without having
66783 to search the main log. A message log is deleted when processing of the message
66784 is complete, unless <option>preserve_message_logs</option> is set, but this should be used
66785 only with great care because they can fill up your disk very quickly.
66786 </para>
66787 <para>
66788 On a heavily loaded system, it may be desirable to disable the use of
66789 per-message logs, in order to reduce disk I/O. This can be done by setting the
66790 <option>message_logs</option> option false.
66791 <indexterm role="concept" startref="IIDloggen" class="endofrange"/>
66792 </para>
66793 </section>
66794 </chapter>
66795
66796 <chapter id="CHAPutils">
66797 <title>Exim utilities</title>
66798 <para>
66799 <indexterm role="concept" id="IIDutils" class="startofrange">
66800 <primary>utilities</primary>
66801 </indexterm>
66802 A number of utility scripts and programs are supplied with Exim and are
66803 described in this chapter. There is also the Exim Monitor, which is covered in
66804 the next chapter. The utilities described here are:
66805 </para>
66806 <informaltable frame="none">
66807 <tgroup cols="3" colsep="0" rowsep="0">
66808 <colspec colwidth="7*" align="left"/>
66809 <colspec colwidth="15*" align="left"/>
66810 <colspec colwidth="40*" align="left"/>
66811 <tbody>
66812 <row>
66813 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTfinoutwha"/></entry>
66814 <entry><emphasis>exiwhat</emphasis></entry>
66815 <entry>list what Exim processes are doing</entry>
66816 </row>
66817 <row>
66818 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTgreptheque"/></entry>
66819 <entry><emphasis>exiqgrep</emphasis></entry>
66820 <entry>grep the queue</entry>
66821 </row>
66822 <row>
66823 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTsumtheque"/></entry>
66824 <entry><emphasis>exiqsumm</emphasis></entry>
66825 <entry>summarize the queue</entry>
66826 </row>
66827 <row>
66828 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTextspeinf"/></entry>
66829 <entry><emphasis>exigrep</emphasis></entry>
66830 <entry>search the main log</entry>
66831 </row>
66832 <row>
66833 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTexipick"/></entry>
66834 <entry><emphasis>exipick</emphasis></entry>
66835 <entry>select messages on various criteria</entry>
66836 </row>
66837 <row>
66838 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTcyclogfil"/></entry>
66839 <entry><emphasis>exicyclog</emphasis></entry>
66840 <entry>cycle (rotate) log files</entry>
66841 </row>
66842 <row>
66843 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTmailstat"/></entry>
66844 <entry><emphasis>eximstats</emphasis></entry>
66845 <entry>extract statistics from the log</entry>
66846 </row>
66847 <row>
66848 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTcheckaccess"/></entry>
66849 <entry><emphasis>exim_checkaccess</emphasis></entry>
66850 <entry>check address acceptance from given IP</entry>
66851 </row>
66852 <row>
66853 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTdbmbuild"/></entry>
66854 <entry><emphasis>exim_dbmbuild</emphasis></entry>
66855 <entry>build a DBM file</entry>
66856 </row>
66857 <row>
66858 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTfinindret"/></entry>
66859 <entry><emphasis>exinext</emphasis></entry>
66860 <entry>extract retry information</entry>
66861 </row>
66862 <row>
66863 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
66864 <entry><emphasis>exim_dumpdb</emphasis></entry>
66865 <entry>dump a hints database</entry>
66866 </row>
66867 <row>
66868 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
66869 <entry><emphasis>exim_tidydb</emphasis></entry>
66870 <entry>clean up a hints database</entry>
66871 </row>
66872 <row>
66873 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
66874 <entry><emphasis>exim_fixdb</emphasis></entry>
66875 <entry>patch a hints database</entry>
66876 </row>
66877 <row>
66878 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTmailboxmaint"/></entry>
66879 <entry><emphasis>exim_lock</emphasis></entry>
66880 <entry>lock a mailbox file</entry>
66881 </row>
66882 </tbody>
66883 </tgroup>
66884 </informaltable>
66885 <para>
66886 Another utility that might be of use to sites with many MTAs is Tom Kistner&#x2019;s
66887 <emphasis>exilog</emphasis>. It provides log visualizations across multiple Exim servers. See
66888 <emphasis role="bold"><ulink url="http://duncanthrax.net/exilog/">http://duncanthrax.net/exilog/</ulink></emphasis> for details.
66889 </para>
66890 <section id="SECTfinoutwha">
66891 <title>Finding out what Exim processes are doing (exiwhat)</title>
66892 <para>
66893 <indexterm role="concept">
66894 <primary><emphasis>exiwhat</emphasis></primary>
66895 </indexterm>
66896 <indexterm role="concept">
66897 <primary>process, querying</primary>
66898 </indexterm>
66899 <indexterm role="concept">
66900 <primary>SIGUSR1</primary>
66901 </indexterm>
66902 On operating systems that can restart a system call after receiving a signal
66903 (most modern OS), an Exim process responds to the SIGUSR1 signal by writing
66904 a line describing what it is doing to the file <filename>exim-process.info</filename> in the
66905 Exim spool directory. The <emphasis>exiwhat</emphasis> script sends the signal to all Exim
66906 processes it can find, having first emptied the file. It then waits for one
66907 second to allow the Exim processes to react before displaying the results. In
66908 order to run <emphasis>exiwhat</emphasis> successfully you have to have sufficient privilege to
66909 send the signal to the Exim processes, so it is normally run as root.
66910 </para>
66911 <para>
66912 <emphasis role="bold">Warning</emphasis>: This is not an efficient process. It is intended for occasional
66913 use by system administrators. It is not sensible, for example, to set up a
66914 script that sends SIGUSR1 signals to Exim processes at short intervals.
66915 </para>
66916 <para>
66917 Unfortunately, the <emphasis>ps</emphasis> command that <emphasis>exiwhat</emphasis> uses to find Exim processes
66918 varies in different operating systems. Not only are different options used,
66919 but the format of the output is different. For this reason, there are some
66920 system configuration options that configure exactly how <emphasis>exiwhat</emphasis> works. If
66921 it doesn&#x2019;t seem to be working for you, check the following compile-time
66922 options:
66923 </para>
66924 <literallayout>
66925 <literal>EXIWHAT_PS_CMD    </literal> the command for running <emphasis>ps</emphasis>
66926 <literal>EXIWHAT_PS_ARG    </literal> the argument for <emphasis>ps</emphasis>
66927 <literal>EXIWHAT_EGREP_ARG </literal> the argument for <emphasis>egrep</emphasis> to select from <emphasis>ps</emphasis> output
66928 <literal>EXIWHAT_KILL_ARG  </literal> the argument for the <emphasis>kill</emphasis> command
66929 </literallayout>
66930 <para>
66931 An example of typical output from <emphasis>exiwhat</emphasis> is
66932 </para>
66933 <literallayout class="monospaced">
66934 164 daemon: -q1h, listening on port 25
66935 10483 running queue: waiting for 0tAycK-0002ij-00 (10492)
66936 10492 delivering 0tAycK-0002ij-00 to mail.ref.example
66937   [10.19.42.42] (editor@ref.example)
66938 10592 handling incoming call from [192.168.243.242]
66939 10628 accepting a local non-SMTP message
66940 </literallayout>
66941 <para>
66942 The first number in the output line is the process number. The third line has
66943 been split here, in order to fit it on the page.
66944 </para>
66945 </section>
66946 <section id="SECTgreptheque">
66947 <title>Selective queue listing (exiqgrep)</title>
66948 <para>
66949 <indexterm role="concept">
66950 <primary><emphasis>exiqgrep</emphasis></primary>
66951 </indexterm>
66952 <indexterm role="concept">
66953 <primary>queue</primary>
66954 <secondary>grepping</secondary>
66955 </indexterm>
66956 This utility is a Perl script contributed by Matt Hubbard. It runs
66957 </para>
66958 <literallayout class="monospaced">
66959 exim -bpu
66960 </literallayout>
66961 <para>
66962 or (in case <emphasis role="bold">-a</emphasis> switch is specified)
66963 </para>
66964 <literallayout class="monospaced">
66965 exim -bp
66966 </literallayout>
66967 <para>
66968 The <emphasis role="bold">-C</emphasis> option is used to specify an alternate <filename>exim.conf</filename> which might
66969 contain alternate exim configuration the queue management might be using.
66970 </para>
66971 <para>
66972 to obtain a queue listing, and then greps the output to select messages
66973 that match given criteria. The following selection options are available:
66974 </para>
66975 <variablelist>
66976 <varlistentry>
66977 <term><emphasis role="bold">-f</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
66978 <listitem>
66979 <para>
66980 Match the sender address using a case-insensitive search. The field that is
66981 tested is enclosed in angle brackets, so you can test for bounce messages with
66982 </para>
66983 <literallayout class="monospaced">
66984 exiqgrep -f '^&lt;&gt;$'
66985 </literallayout>
66986 </listitem></varlistentry>
66987 <varlistentry>
66988 <term><emphasis role="bold">-r</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
66989 <listitem>
66990 <para>
66991 Match a recipient address using a case-insensitive search. The field that is
66992 tested is not enclosed in angle brackets.
66993 </para>
66994 </listitem></varlistentry>
66995 <varlistentry>
66996 <term><emphasis role="bold">-s</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
66997 <listitem>
66998 <para>
66999 Match against the size field.
67000 </para>
67001 </listitem></varlistentry>
67002 <varlistentry>
67003 <term><emphasis role="bold">-y</emphasis>&nbsp;&lt;<emphasis>seconds</emphasis>&gt;</term>
67004 <listitem>
67005 <para>
67006 Match messages that are younger than the given time.
67007 </para>
67008 </listitem></varlistentry>
67009 <varlistentry>
67010 <term><emphasis role="bold">-o</emphasis>&nbsp;&lt;<emphasis>seconds</emphasis>&gt;</term>
67011 <listitem>
67012 <para>
67013 Match messages that are older than the given time.
67014 </para>
67015 </listitem></varlistentry>
67016 <varlistentry>
67017 <term><emphasis role="bold">-z</emphasis></term>
67018 <listitem>
67019 <para>
67020 Match only frozen messages.
67021 </para>
67022 </listitem></varlistentry>
67023 <varlistentry>
67024 <term><emphasis role="bold">-x</emphasis></term>
67025 <listitem>
67026 <para>
67027 Match only non-frozen messages.
67028 </para>
67029 </listitem></varlistentry>
67030 </variablelist>
67031 <para>
67032 The following options control the format of the output:
67033 </para>
67034 <variablelist>
67035 <varlistentry>
67036 <term><emphasis role="bold">-c</emphasis></term>
67037 <listitem>
67038 <para>
67039 Display only the count of matching messages.
67040 </para>
67041 </listitem></varlistentry>
67042 <varlistentry>
67043 <term><emphasis role="bold">-l</emphasis></term>
67044 <listitem>
67045 <para>
67046 Long format &ndash; display the full message information as output by Exim. This is
67047 the default.
67048 </para>
67049 </listitem></varlistentry>
67050 <varlistentry>
67051 <term><emphasis role="bold">-i</emphasis></term>
67052 <listitem>
67053 <para>
67054 Display message ids only.
67055 </para>
67056 </listitem></varlistentry>
67057 <varlistentry>
67058 <term><emphasis role="bold">-b</emphasis></term>
67059 <listitem>
67060 <para>
67061 Brief format &ndash; one line per message.
67062 </para>
67063 </listitem></varlistentry>
67064 <varlistentry>
67065 <term><emphasis role="bold">-R</emphasis></term>
67066 <listitem>
67067 <para>
67068 Display messages in reverse order.
67069 </para>
67070 </listitem></varlistentry>
67071 <varlistentry>
67072 <term><emphasis role="bold">-a</emphasis></term>
67073 <listitem>
67074 <para>
67075 Include delivered recipients in queue listing.
67076 </para>
67077 </listitem></varlistentry>
67078 </variablelist>
67079 <para>
67080 There is one more option, <option>-h</option>, which outputs a list of options.
67081 </para>
67082 </section>
67083 <section id="SECTsumtheque">
67084 <title>Summarizing the queue (exiqsumm)</title>
67085 <para>
67086 <indexterm role="concept">
67087 <primary><emphasis>exiqsumm</emphasis></primary>
67088 </indexterm>
67089 <indexterm role="concept">
67090 <primary>queue</primary>
67091 <secondary>summary</secondary>
67092 </indexterm>
67093 The <emphasis>exiqsumm</emphasis> utility is a Perl script which reads the output of <literal>exim
67094 -bp</literal> and produces a summary of the messages on the queue. Thus, you use it by
67095 running a command such as
67096 </para>
67097 <literallayout class="monospaced">
67098 exim -bp | exiqsumm
67099 </literallayout>
67100 <para>
67101 The output consists of one line for each domain that has messages waiting for
67102 it, as in the following example:
67103 </para>
67104 <literallayout class="monospaced">
67105 3   2322   74m   66m  msn.com.example
67106 </literallayout>
67107 <para>
67108 Each line lists the number of pending deliveries for a domain, their total
67109 volume, and the length of time that the oldest and the newest messages have
67110 been waiting. Note that the number of pending deliveries is greater than the
67111 number of messages when messages have more than one recipient.
67112 </para>
67113 <para>
67114 A summary line is output at the end. By default the output is sorted on the
67115 domain name, but <emphasis>exiqsumm</emphasis> has the options <option>-a</option> and <option>-c</option>, which cause
67116 the output to be sorted by oldest message and by count of messages,
67117 respectively. There are also three options that split the messages for each
67118 domain into two or more subcounts: <option>-b</option> separates bounce messages, <option>-f</option>
67119 separates frozen messages, and <option>-s</option> separates messages according to their
67120 sender.
67121 </para>
67122 <para>
67123 The output of <emphasis>exim -bp</emphasis> contains the original addresses in the message, so
67124 this also applies to the output from <emphasis>exiqsumm</emphasis>. No domains from addresses
67125 generated by aliasing or forwarding are included (unless the <option>one_time</option>
67126 option of the <command>redirect</command> router has been used to convert them into <quote>top
67127 level</quote> addresses).
67128 </para>
67129 </section>
67130 <section id="SECTextspeinf">
67131 <title>Extracting specific information from the log (exigrep)</title>
67132 <para>
67133 <indexterm role="concept">
67134 <primary><emphasis>exigrep</emphasis></primary>
67135 </indexterm>
67136 <indexterm role="concept">
67137 <primary>log</primary>
67138 <secondary>extracts; grepping for</secondary>
67139 </indexterm>
67140 The <emphasis>exigrep</emphasis> utility is a Perl script that searches one or more main log
67141 files for entries that match a given pattern. When it finds a match, it
67142 extracts all the log entries for the relevant message, not just those that
67143 match the pattern. Thus, <emphasis>exigrep</emphasis> can extract complete log entries for a
67144 given message, or all mail for a given user, or for a given host, for example.
67145 The input files can be in Exim log format or syslog format.
67146 If a matching log line is not associated with a specific message, it is
67147 included in <emphasis>exigrep</emphasis>&#x2019;s output without any additional lines. The usage is:
67148 </para>
67149 <literallayout>
67150 <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>
67151 </literallayout>
67152 <para>
67153 If no log file names are given on the command line, the standard input is read.
67154 </para>
67155 <para>
67156 The <option>-t</option> argument specifies a number of seconds. It adds an additional
67157 condition for message selection. Messages that are complete are shown only if
67158 they spent more than &lt;<emphasis>n</emphasis>&gt; seconds on the queue.
67159 </para>
67160 <para>
67161 By default, <emphasis>exigrep</emphasis> does case-insensitive matching. The <option>-I</option> option
67162 makes it case-sensitive. This may give a performance improvement when searching
67163 large log files. Without <option>-I</option>, the Perl pattern matches use Perl&#x2019;s <literal>/i</literal>
67164 option; with <option>-I</option> they do not. In both cases it is possible to change the
67165 case sensitivity within the pattern by using <literal>(?i)</literal> or <literal>(?-i)</literal>.
67166 </para>
67167 <para>
67168 The <option>-l</option> option means <quote>literal</quote>, that is, treat all characters in the
67169 pattern as standing for themselves. Otherwise the pattern must be a Perl
67170 regular expression.
67171 </para>
67172 <para>
67173 The <option>-v</option> option inverts the matching condition. That is, a line is selected
67174 if it does <emphasis>not</emphasis> match the pattern.
67175 </para>
67176 <para>
67177 The <option>-M</option> options means <quote>related messages</quote>. <emphasis>exigrep</emphasis> will show messages
67178 that are generated as a result/response to a message that <emphasis>exigrep</emphasis> matched
67179 normally.
67180 </para>
67181 <para>
67182 Example of <option>-M</option>:
67183 user_a sends a message to user_b, which generates a bounce back to user_b. If
67184 <emphasis>exigrep</emphasis> is used to search for <quote>user_a</quote>, only the first message will be
67185 displayed.  But if <emphasis>exigrep</emphasis> is used to search for <quote>user_b</quote>, the first and
67186 the second (bounce) message will be displayed. Using <option>-M</option> with <emphasis>exigrep</emphasis>
67187 when searching for <quote>user_a</quote> will show both messages since the bounce is
67188 <quote>related</quote> to or a <quote>result</quote> of the first message that was found by the
67189 search term.
67190 </para>
67191 <para>
67192 If the location of a <emphasis>zcat</emphasis> command is known from the definition of
67193 ZCAT_COMMAND in <filename>Local/Makefile</filename>, <emphasis>exigrep</emphasis> automatically passes any file
67194 whose name ends in COMPRESS_SUFFIX through <emphasis>zcat</emphasis> as it searches it.
67195 If the ZCAT_COMMAND is not executable, <emphasis>exigrep</emphasis> tries to use
67196 autodetection of some well known compression extensions.
67197 </para>
67198 </section>
67199 <section id="SECTexipick">
67200 <title>Selecting messages by various criteria (exipick)</title>
67201 <para>
67202 <indexterm role="concept">
67203 <primary><emphasis>exipick</emphasis></primary>
67204 </indexterm>
67205 John Jetmore&#x2019;s <emphasis>exipick</emphasis> utility is included in the Exim distribution. It
67206 lists messages from the queue according to a variety of criteria. For details
67207 of <emphasis>exipick</emphasis>&#x2019;s facilities, run <emphasis>exipick</emphasis> with
67208 the <option>--help</option> option.
67209 </para>
67210 </section>
67211 <section id="SECTcyclogfil">
67212 <title>Cycling log files (exicyclog)</title>
67213 <para>
67214 <indexterm role="concept">
67215 <primary>log</primary>
67216 <secondary>cycling local files</secondary>
67217 </indexterm>
67218 <indexterm role="concept">
67219 <primary>cycling logs</primary>
67220 </indexterm>
67221 <indexterm role="concept">
67222 <primary><emphasis>exicyclog</emphasis></primary>
67223 </indexterm>
67224 The <emphasis>exicyclog</emphasis> script can be used to cycle (rotate) <emphasis>mainlog</emphasis> and
67225 <emphasis>rejectlog</emphasis> files. This is not necessary if only syslog is being used, or if
67226 you are using log files with datestamps in their names (see section
67227 <xref linkend="SECTdatlogfil"/>). Some operating systems have their own standard mechanisms
67228 for log cycling, and these can be used instead of <emphasis>exicyclog</emphasis> if preferred.
67229 There are two command line options for <emphasis>exicyclog</emphasis>:
67230 </para>
67231 <itemizedlist>
67232 <listitem>
67233 <para>
67234 <option>-k</option> &lt;<emphasis>count</emphasis>&gt; specifies the number of log files to keep, overriding the
67235 default that is set when Exim is built. The default default is 10.
67236 </para>
67237 </listitem>
67238 <listitem>
67239 <para>
67240 <option>-l</option> &lt;<emphasis>path</emphasis>&gt; specifies the log file path, in the same format as Exim&#x2019;s
67241 <option>log_file_path</option> option (for example, <literal>/var/log/exim_%slog</literal>), again
67242 overriding the script&#x2019;s default, which is to find the setting from Exim&#x2019;s
67243 configuration.
67244 </para>
67245 </listitem>
67246 </itemizedlist>
67247 <para>
67248 Each time <emphasis>exicyclog</emphasis> is run the file names get <quote>shuffled down</quote> by one. If
67249 the main log file name is <filename>mainlog</filename> (the default) then when <emphasis>exicyclog</emphasis> is
67250 run <filename>mainlog</filename> becomes <filename>mainlog.01</filename>, the previous <filename>mainlog.01</filename> becomes
67251 <filename>mainlog.02</filename> and so on, up to the limit that is set in the script or by the
67252 <option>-k</option> option. Log files whose numbers exceed the limit are discarded. Reject
67253 logs are handled similarly.
67254 </para>
67255 <para>
67256 If the limit is greater than 99, the script uses 3-digit numbers such as
67257 <filename>mainlog.001</filename>, <filename>mainlog.002</filename>, etc. If you change from a number less than 99
67258 to one that is greater, or <emphasis>vice versa</emphasis>, you will have to fix the names of
67259 any existing log files.
67260 </para>
67261 <para>
67262 If no <filename>mainlog</filename> file exists, the script does nothing. Files that <quote>drop off</quote>
67263 the end are deleted. All files with numbers greater than 01 are compressed,
67264 using a compression command which is configured by the COMPRESS_COMMAND
67265 setting in <filename>Local/Makefile</filename>. It is usual to run <emphasis>exicyclog</emphasis> daily from a
67266 root <option>crontab</option> entry of the form
67267 </para>
67268 <literallayout class="monospaced">
67269 1 0 * * * su exim -c /usr/exim/bin/exicyclog
67270 </literallayout>
67271 <para>
67272 assuming you have used the name <quote>exim</quote> for the Exim user. You can run
67273 <emphasis>exicyclog</emphasis> as root if you wish, but there is no need.
67274 </para>
67275 </section>
67276 <section id="SECTmailstat">
67277 <title>Mail statistics (eximstats)</title>
67278 <para>
67279 <indexterm role="concept">
67280 <primary>statistics</primary>
67281 </indexterm>
67282 <indexterm role="concept">
67283 <primary><emphasis>eximstats</emphasis></primary>
67284 </indexterm>
67285 A Perl script called <emphasis>eximstats</emphasis> is provided for extracting statistical
67286 information from log files. The output is either plain text, or HTML.
67287 Exim log files are also supported by the <emphasis>Lire</emphasis> system produced by the
67288 LogReport Foundation <emphasis role="bold"><ulink url="http://www.logreport.org">http://www.logreport.org</ulink></emphasis>.
67289 </para>
67290 <para>
67291 The <emphasis>eximstats</emphasis> script has been hacked about quite a bit over time. The
67292 latest version is the result of some extensive revision by Steve Campbell. A
67293 lot of information is given by default, but there are options for suppressing
67294 various parts of it. Following any options, the arguments to the script are a
67295 list of files, which should be main log files. For example:
67296 </para>
67297 <literallayout class="monospaced">
67298 eximstats -nr /var/spool/exim/log/mainlog.01
67299 </literallayout>
67300 <para>
67301 By default, <emphasis>eximstats</emphasis> extracts information about the number and volume of
67302 messages received from or delivered to various hosts. The information is sorted
67303 both by message count and by volume, and the top fifty hosts in each category
67304 are listed on the standard output. Similar information, based on email
67305 addresses or domains instead of hosts can be requested by means of various
67306 options. For messages delivered and received locally, similar statistics are
67307 also produced per user.
67308 </para>
67309 <para>
67310 The output also includes total counts and statistics about delivery errors, and
67311 histograms showing the number of messages received and deliveries made in each
67312 hour of the day. A delivery with more than one address in its envelope (for
67313 example, an SMTP transaction with more than one RCPT command) is counted
67314 as a single delivery by <emphasis>eximstats</emphasis>.
67315 </para>
67316 <para>
67317 Though normally more deliveries than receipts are reported (as messages may
67318 have multiple recipients), it is possible for <emphasis>eximstats</emphasis> to report more
67319 messages received than delivered, even though the queue is empty at the start
67320 and end of the period in question. If an incoming message contains no valid
67321 recipients, no deliveries are recorded for it. A bounce message is handled as
67322 an entirely separate message.
67323 </para>
67324 <para>
67325 <emphasis>eximstats</emphasis> always outputs a grand total summary giving the volume and number
67326 of messages received and deliveries made, and the number of hosts involved in
67327 each case. It also outputs the number of messages that were delayed (that is,
67328 not completely delivered at the first attempt), and the number that had at
67329 least one address that failed.
67330 </para>
67331 <para>
67332 The remainder of the output is in sections that can be independently disabled
67333 or modified by various options. It consists of a summary of deliveries by
67334 transport, histograms of messages received and delivered per time interval
67335 (default per hour), information about the time messages spent on the queue,
67336 a list of relayed messages, lists of the top fifty sending hosts, local
67337 senders, destination hosts, and destination local users by count and by volume,
67338 and a list of delivery errors that occurred.
67339 </para>
67340 <para>
67341 The relay information lists messages that were actually relayed, that is, they
67342 came from a remote host and were directly delivered to some other remote host,
67343 without being processed (for example, for aliasing or forwarding) locally.
67344 </para>
67345 <para>
67346 There are quite a few options for <emphasis>eximstats</emphasis> to control exactly what it
67347 outputs. These are documented in the Perl script itself, and can be extracted
67348 by running the command <command>perldoc</command> on the script. For example:
67349 </para>
67350 <literallayout class="monospaced">
67351 perldoc /usr/exim/bin/eximstats
67352 </literallayout>
67353 </section>
67354 <section id="SECTcheckaccess">
67355 <title>Checking access policy (exim_checkaccess)</title>
67356 <para>
67357 <indexterm role="concept">
67358 <primary><emphasis>exim_checkaccess</emphasis></primary>
67359 </indexterm>
67360 <indexterm role="concept">
67361 <primary>policy control</primary>
67362 <secondary>checking access</secondary>
67363 </indexterm>
67364 <indexterm role="concept">
67365 <primary>checking access</primary>
67366 </indexterm>
67367 The <option>-bh</option> command line argument allows you to run a fake SMTP session with
67368 debugging output, in order to check what Exim is doing when it is applying
67369 policy controls to incoming SMTP mail. However, not everybody is sufficiently
67370 familiar with the SMTP protocol to be able to make full use of <option>-bh</option>, and
67371 sometimes you just want to answer the question <quote>Does this address have
67372 access?</quote> without bothering with any further details.
67373 </para>
67374 <para>
67375 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option>. It takes
67376 two arguments, an IP address and an email address:
67377 </para>
67378 <literallayout class="monospaced">
67379 exim_checkaccess 10.9.8.7 A.User@a.domain.example
67380 </literallayout>
67381 <para>
67382 The utility runs a call to Exim with the <option>-bh</option> option, to test whether the
67383 given email address would be accepted in a RCPT command in a TCP/IP
67384 connection from the host with the given IP address. The output of the utility
67385 is either the word <quote>accepted</quote>, or the SMTP error response, for example:
67386 </para>
67387 <literallayout class="monospaced">
67388 Rejected:
67389 550 Relay not permitted
67390 </literallayout>
67391 <para>
67392 When running this test, the utility uses <literal>&lt;&gt;</literal> as the envelope sender address
67393 for the MAIL command, but you can change this by providing additional
67394 options. These are passed directly to the Exim command. For example, to specify
67395 that the test is to be run with the sender address <emphasis>himself@there.example</emphasis>
67396 you can use:
67397 </para>
67398 <literallayout class="monospaced">
67399 exim_checkaccess 10.9.8.7 A.User@a.domain.example \
67400                  -f himself@there.example
67401 </literallayout>
67402 <para>
67403 Note that these additional Exim command line items must be given after the two
67404 mandatory arguments.
67405 </para>
67406 <para>
67407 Because the <option>exim_checkaccess</option> uses <option>-bh</option>, it does not perform callouts
67408 while running its checks. You can run checks that include callouts by using
67409 <option>-bhc</option>, but this is not yet available in a <quote>packaged</quote> form.
67410 </para>
67411 </section>
67412 <section id="SECTdbmbuild">
67413 <title>Making DBM files (exim_dbmbuild)</title>
67414 <para>
67415 <indexterm role="concept">
67416 <primary>DBM</primary>
67417 <secondary>building dbm files</secondary>
67418 </indexterm>
67419 <indexterm role="concept">
67420 <primary>building DBM files</primary>
67421 </indexterm>
67422 <indexterm role="concept">
67423 <primary><emphasis>exim_dbmbuild</emphasis></primary>
67424 </indexterm>
67425 <indexterm role="concept">
67426 <primary>lower casing</primary>
67427 </indexterm>
67428 <indexterm role="concept">
67429 <primary>binary zero</primary>
67430 <secondary>in lookup key</secondary>
67431 </indexterm>
67432 The <emphasis>exim_dbmbuild</emphasis> program reads an input file containing keys and data in
67433 the format used by the <command>lsearch</command> lookup (see section
67434 <xref linkend="SECTsinglekeylookups"/>). It writes a DBM file using the lower-cased alias
67435 names as keys and the remainder of the information as data. The lower-casing
67436 can be prevented by calling the program with the <option>-nolc</option> option.
67437 </para>
67438 <para>
67439 A terminating zero is included as part of the key string. This is expected by
67440 the <command>dbm</command> lookup type. However, if the option <option>-nozero</option> is given,
67441 <emphasis>exim_dbmbuild</emphasis> creates files without terminating zeroes in either the key
67442 strings or the data strings. The <command>dbmnz</command> lookup type can be used with such
67443 files.
67444 </para>
67445 <para>
67446 The program requires two arguments: the name of the input file (which can be a
67447 single hyphen to indicate the standard input), and the name of the output file.
67448 It creates the output under a temporary name, and then renames it if all went
67449 well.
67450 </para>
67451 <para>
67452 <indexterm role="concept">
67453 <primary>USE_DB</primary>
67454 </indexterm>
67455 If the native DB interface is in use (USE_DB is set in a compile-time
67456 configuration file &ndash; this is common in free versions of Unix) the two file
67457 names must be different, because in this mode the Berkeley DB functions create
67458 a single output file using exactly the name given. For example,
67459 </para>
67460 <literallayout class="monospaced">
67461 exim_dbmbuild /etc/aliases /etc/aliases.db
67462 </literallayout>
67463 <para>
67464 reads the system alias file and creates a DBM version of it in
67465 <filename>/etc/aliases.db</filename>.
67466 </para>
67467 <para>
67468 In systems that use the <emphasis>ndbm</emphasis> routines (mostly proprietary versions of
67469 Unix), two files are used, with the suffixes <filename>.dir</filename> and <filename>.pag</filename>. In this
67470 environment, the suffixes are added to the second argument of
67471 <emphasis>exim_dbmbuild</emphasis>, so it can be the same as the first. This is also the case
67472 when the Berkeley functions are used in compatibility mode (though this is not
67473 recommended), because in that case it adds a <filename>.db</filename> suffix to the file name.
67474 </para>
67475 <para>
67476 If a duplicate key is encountered, the program outputs a warning, and when it
67477 finishes, its return code is 1 rather than zero, unless the <option>-noduperr</option>
67478 option is used. By default, only the first of a set of duplicates is used &ndash;
67479 this makes it compatible with <command>lsearch</command> lookups. There is an option
67480 <option>-lastdup</option> which causes it to use the data for the last duplicate instead.
67481 There is also an option <option>-nowarn</option>, which stops it listing duplicate keys to
67482 <option>stderr</option>. For other errors, where it doesn&#x2019;t actually make a new file, the
67483 return code is 2.
67484 </para>
67485 </section>
67486 <section id="SECTfinindret">
67487 <title>Finding individual retry times (exinext)</title>
67488 <para>
67489 <indexterm role="concept">
67490 <primary>retry</primary>
67491 <secondary>times</secondary>
67492 </indexterm>
67493 <indexterm role="concept">
67494 <primary><emphasis>exinext</emphasis></primary>
67495 </indexterm>
67496 A utility called <emphasis>exinext</emphasis> (mostly a Perl script) provides the ability to
67497 fish specific information out of the retry database. Given a mail domain (or a
67498 complete address), it looks up the hosts for that domain, and outputs any retry
67499 information for the hosts or for the domain. At present, the retry information
67500 is obtained by running <emphasis>exim_dumpdb</emphasis> (see below) and post-processing the
67501 output. For example:
67502 </para>
67503 <literallayout class="monospaced">
67504 $ exinext piglet@milne.fict.example
67505 kanga.milne.example:192.168.8.1 error 146: Connection refused
67506   first failed: 21-Feb-1996 14:57:34
67507   last tried:   21-Feb-1996 14:57:34
67508   next try at:  21-Feb-1996 15:02:34
67509 roo.milne.example:192.168.8.3 error 146: Connection refused
67510   first failed: 20-Jan-1996 13:12:08
67511   last tried:   21-Feb-1996 11:42:03
67512   next try at:  21-Feb-1996 19:42:03
67513   past final cutoff time
67514 </literallayout>
67515 <para>
67516 You can also give <emphasis>exinext</emphasis> a local part, without a domain, and it
67517 will give any retry information for that local part in your default domain.
67518 A message id can be used to obtain retry information pertaining to a specific
67519 message. This exists only when an attempt to deliver a message to a remote host
67520 suffers a message-specific error (see section <xref linkend="SECToutSMTPerr"/>).
67521 <emphasis>exinext</emphasis> is not particularly efficient, but then it is not expected to be
67522 run very often.
67523 </para>
67524 <para>
67525 The <emphasis>exinext</emphasis> utility calls Exim to find out information such as the location
67526 of the spool directory. The utility has <option>-C</option> and <option>-D</option> options, which are
67527 passed on to the <emphasis>exim</emphasis> commands. The first specifies an alternate Exim
67528 configuration file, and the second sets macros for use within the configuration
67529 file. These features are mainly to help in testing, but might also be useful in
67530 environments where more than one configuration file is in use.
67531 </para>
67532 </section>
67533 <section id="SECThindatmai">
67534 <title>Hints database maintenance</title>
67535 <para>
67536 <indexterm role="concept">
67537 <primary>hints database</primary>
67538 <secondary>maintenance</secondary>
67539 </indexterm>
67540 <indexterm role="concept">
67541 <primary>maintaining Exim&#x2019;s hints database</primary>
67542 </indexterm>
67543 Three utility programs are provided for maintaining the DBM files that Exim
67544 uses to contain its delivery hint information. Each program requires two
67545 arguments. The first specifies the name of Exim&#x2019;s spool directory, and the
67546 second is the name of the database it is to operate on. These are as follows:
67547 </para>
67548 <itemizedlist>
67549 <listitem>
67550 <para>
67551 <emphasis>retry</emphasis>: the database of retry information
67552 </para>
67553 </listitem>
67554 <listitem>
67555 <para>
67556 <emphasis>wait-</emphasis>&lt;<emphasis>transport name</emphasis>&gt;: databases of information about messages waiting
67557 for remote hosts
67558 </para>
67559 </listitem>
67560 <listitem>
67561 <para>
67562 <emphasis>callout</emphasis>: the callout cache
67563 </para>
67564 </listitem>
67565 <listitem>
67566 <para>
67567 <emphasis>ratelimit</emphasis>: the data for implementing the ratelimit ACL condition
67568 </para>
67569 </listitem>
67570 <listitem>
67571 <para>
67572 <emphasis>misc</emphasis>: other hints data
67573 </para>
67574 </listitem>
67575 </itemizedlist>
67576 <para>
67577 The <emphasis>misc</emphasis> database is used for
67578 </para>
67579 <itemizedlist>
67580 <listitem>
67581 <para>
67582 Serializing ETRN runs (when <option>smtp_etrn_serialize</option> is set)
67583 </para>
67584 </listitem>
67585 <listitem>
67586 <para>
67587 Serializing delivery to a specific host (when <option>serialize_hosts</option> is set in an
67588 <command>smtp</command> transport)
67589 </para>
67590 </listitem>
67591 <listitem>
67592 <para>
67593 Limiting the concurrency of specific transports (when <option>max_parallel</option> is set
67594 in a transport)
67595 </para>
67596 </listitem>
67597 </itemizedlist>
67598 </section>
67599 <section id="SECID261">
67600 <title>exim_dumpdb</title>
67601 <para>
67602 <indexterm role="concept">
67603 <primary><emphasis>exim_dumpdb</emphasis></primary>
67604 </indexterm>
67605 The entire contents of a database are written to the standard output by the
67606 <emphasis>exim_dumpdb</emphasis> program, which has no options or arguments other than the
67607 spool and database names. For example, to dump the retry database:
67608 </para>
67609 <literallayout class="monospaced">
67610 exim_dumpdb /var/spool/exim retry
67611 </literallayout>
67612 <para>
67613 Two lines of output are produced for each entry:
67614 </para>
67615 <literallayout class="monospaced">
67616 T:mail.ref.example:192.168.242.242 146 77 Connection refused
67617 31-Oct-1995 12:00:12 02-Nov-1995 12:21:39 02-Nov-1995 20:21:39 *
67618 </literallayout>
67619 <para>
67620 The first item on the first line is the key of the record. It starts with one
67621 of the letters R, or T, depending on whether it refers to a routing or
67622 transport retry. For a local delivery, the next part is the local address; for
67623 a remote delivery it is the name of the remote host, followed by its failing IP
67624 address (unless <option>retry_include_ip_address</option> is set false on the <command>smtp</command>
67625 transport). If the remote port is not the standard one (port 25), it is added
67626 to the IP address. Then there follows an error code, an additional error code,
67627 and a textual description of the error.
67628 </para>
67629 <para>
67630 The three times on the second line are the time of first failure, the time of
67631 the last delivery attempt, and the computed time for the next attempt. The line
67632 ends with an asterisk if the cutoff time for the last retry rule has been
67633 exceeded.
67634 </para>
67635 <para>
67636 Each output line from <emphasis>exim_dumpdb</emphasis> for the <emphasis>wait-xxx</emphasis> databases
67637 consists of a host name followed by a list of ids for messages that are or were
67638 waiting to be delivered to that host. If there are a very large number for any
67639 one host, continuation records, with a sequence number added to the host name,
67640 may be seen. The data in these records is often out of date, because a message
67641 may be routed to several alternative hosts, and Exim makes no effort to keep
67642 cross-references.
67643 </para>
67644 </section>
67645 <section id="SECID262">
67646 <title>exim_tidydb</title>
67647 <para>
67648 <indexterm role="concept">
67649 <primary><emphasis>exim_tidydb</emphasis></primary>
67650 </indexterm>
67651 The <emphasis>exim_tidydb</emphasis> utility program is used to tidy up the contents of a hints
67652 database. If run with no options, it removes all records that are more than 30
67653 days old. The age is calculated from the date and time that the record was last
67654 updated. Note that, in the case of the retry database, it is <emphasis>not</emphasis> the time
67655 since the first delivery failure. Information about a host that has been down
67656 for more than 30 days will remain in the database, provided that the record is
67657 updated sufficiently often.
67658 </para>
67659 <para>
67660 The cutoff date can be altered by means of the <option>-t</option> option, which must be
67661 followed by a time. For example, to remove all records older than a week from
67662 the retry database:
67663 </para>
67664 <literallayout class="monospaced">
67665 exim_tidydb -t 7d /var/spool/exim retry
67666 </literallayout>
67667 <para>
67668 Both the <emphasis>wait-xxx</emphasis> and <emphasis>retry</emphasis> databases contain items that involve
67669 message ids. In the former these appear as data in records keyed by host &ndash;
67670 they were messages that were waiting for that host &ndash; and in the latter they
67671 are the keys for retry information for messages that have suffered certain
67672 types of error. When <emphasis>exim_tidydb</emphasis> is run, a check is made to ensure that
67673 message ids in database records are those of messages that are still on the
67674 queue. Message ids for messages that no longer exist are removed from
67675 <emphasis>wait-xxx</emphasis> records, and if this leaves any records empty, they are deleted.
67676 For the <emphasis>retry</emphasis> database, records whose keys are non-existent message ids are
67677 removed. The <emphasis>exim_tidydb</emphasis> utility outputs comments on the standard output
67678 whenever it removes information from the database.
67679 </para>
67680 <para>
67681 Certain records are automatically removed by Exim when they are no longer
67682 needed, but others are not. For example, if all the MX hosts for a domain are
67683 down, a retry record is created for each one. If the primary MX host comes back
67684 first, its record is removed when Exim successfully delivers to it, but the
67685 records for the others remain because Exim has not tried to use those hosts.
67686 </para>
67687 <para>
67688 It is important, therefore, to run <emphasis>exim_tidydb</emphasis> periodically on all the
67689 hints databases. You should do this at a quiet time of day, because it requires
67690 a database to be locked (and therefore inaccessible to Exim) while it does its
67691 work. Removing records from a DBM file does not normally make the file smaller,
67692 but all the common DBM libraries are able to re-use the space that is released.
67693 After an initial phase of increasing in size, the databases normally reach a
67694 point at which they no longer get any bigger, as long as they are regularly
67695 tidied.
67696 </para>
67697 <para>
67698 <emphasis role="bold">Warning</emphasis>: If you never run <emphasis>exim_tidydb</emphasis>, the space used by the hints
67699 databases is likely to keep on increasing.
67700 </para>
67701 </section>
67702 <section id="SECID263">
67703 <title>exim_fixdb</title>
67704 <para>
67705 <indexterm role="concept">
67706 <primary><emphasis>exim_fixdb</emphasis></primary>
67707 </indexterm>
67708 The <emphasis>exim_fixdb</emphasis> program is a utility for interactively modifying databases.
67709 Its main use is for testing Exim, but it might also be occasionally useful for
67710 getting round problems in a live system. It has no options, and its interface
67711 is somewhat crude. On entry, it prompts for input with a right angle-bracket. A
67712 key of a database record can then be entered, and the data for that record is
67713 displayed.
67714 </para>
67715 <para>
67716 If <quote>d</quote> is typed at the next prompt, the entire record is deleted. For all
67717 except the <emphasis>retry</emphasis> database, that is the only operation that can be carried
67718 out. For the <emphasis>retry</emphasis> database, each field is output preceded by a number, and
67719 data for individual fields can be changed by typing the field number followed
67720 by new data, for example:
67721 </para>
67722 <literallayout class="monospaced">
67723 &gt; 4 951102:1000
67724 </literallayout>
67725 <para>
67726 resets the time of the next delivery attempt. Time values are given as a
67727 sequence of digit pairs for year, month, day, hour, and minute. Colons can be
67728 used as optional separators.
67729 </para>
67730 </section>
67731 <section id="SECTmailboxmaint">
67732 <title>Mailbox maintenance (exim_lock)</title>
67733 <para>
67734 <indexterm role="concept">
67735 <primary>mailbox</primary>
67736 <secondary>maintenance</secondary>
67737 </indexterm>
67738 <indexterm role="concept">
67739 <primary><emphasis>exim_lock</emphasis></primary>
67740 </indexterm>
67741 <indexterm role="concept">
67742 <primary>locking mailboxes</primary>
67743 </indexterm>
67744 The <emphasis>exim_lock</emphasis> utility locks a mailbox file using the same algorithm as
67745 Exim. For a discussion of locking issues, see section <xref linkend="SECTopappend"/>.
67746 <emphasis>Exim_lock</emphasis> can be used to prevent any modification of a mailbox by Exim or
67747 a user agent while investigating a problem. The utility requires the name of
67748 the file as its first argument. If the locking is successful, the second
67749 argument is run as a command (using C&#x2019;s <function>system()</function> function); if there is no
67750 second argument, the value of the SHELL environment variable is used; if this
67751 is unset or empty, <filename>/bin/sh</filename> is run. When the command finishes, the mailbox
67752 is unlocked and the utility ends. The following options are available:
67753 </para>
67754 <variablelist>
67755 <varlistentry>
67756 <term><option>-fcntl</option></term>
67757 <listitem>
67758 <para>
67759 Use <function>fcntl()</function> locking on the open mailbox.
67760 </para>
67761 </listitem></varlistentry>
67762 <varlistentry>
67763 <term><option>-flock</option></term>
67764 <listitem>
67765 <para>
67766 Use <function>flock()</function> locking on the open mailbox, provided the operating system
67767 supports it.
67768 </para>
67769 </listitem></varlistentry>
67770 <varlistentry>
67771 <term><option>-interval</option></term>
67772 <listitem>
67773 <para>
67774 This must be followed by a number, which is a number of seconds; it sets the
67775 interval to sleep between retries (default 3).
67776 </para>
67777 </listitem></varlistentry>
67778 <varlistentry>
67779 <term><option>-lockfile</option></term>
67780 <listitem>
67781 <para>
67782 Create a lock file before opening the mailbox.
67783 </para>
67784 </listitem></varlistentry>
67785 <varlistentry>
67786 <term><option>-mbx</option></term>
67787 <listitem>
67788 <para>
67789 Lock the mailbox using MBX rules.
67790 </para>
67791 </listitem></varlistentry>
67792 <varlistentry>
67793 <term><option>-q</option></term>
67794 <listitem>
67795 <para>
67796 Suppress verification output.
67797 </para>
67798 </listitem></varlistentry>
67799 <varlistentry>
67800 <term><option>-retries</option></term>
67801 <listitem>
67802 <para>
67803 This must be followed by a number; it sets the number of times to try to get
67804 the lock (default 10).
67805 </para>
67806 </listitem></varlistentry>
67807 <varlistentry>
67808 <term><option>-restore_time</option></term>
67809 <listitem>
67810 <para>
67811 This option causes <option>exim_lock</option> to restore the modified and read times to the
67812 locked file before exiting. This allows you to access a locked mailbox (for
67813 example, to take a backup copy) without disturbing the times that the user
67814 subsequently sees.
67815 </para>
67816 </listitem></varlistentry>
67817 <varlistentry>
67818 <term><option>-timeout</option></term>
67819 <listitem>
67820 <para>
67821 This must be followed by a number, which is a number of seconds; it sets a
67822 timeout to be used with a blocking <function>fcntl()</function> lock. If it is not set (the
67823 default), a non-blocking call is used.
67824 </para>
67825 </listitem></varlistentry>
67826 <varlistentry>
67827 <term><option>-v</option></term>
67828 <listitem>
67829 <para>
67830 Generate verbose output.
67831 </para>
67832 </listitem></varlistentry>
67833 </variablelist>
67834 <para>
67835 If none of <option>-fcntl</option>, <option>-flock</option>, <option>-lockfile</option> or <option>-mbx</option> are given, the
67836 default is to create a lock file and also to use <function>fcntl()</function> locking on the
67837 mailbox, which is the same as Exim&#x2019;s default. The use of <option>-flock</option> or
67838 <option>-fcntl</option> requires that the file be writeable; the use of <option>-lockfile</option>
67839 requires that the directory containing the file be writeable. Locking by lock
67840 file does not last for ever; Exim assumes that a lock file is expired if it is
67841 more than 30 minutes old.
67842 </para>
67843 <para>
67844 The <option>-mbx</option> option can be used with either or both of <option>-fcntl</option> or
67845 <option>-flock</option>. It assumes <option>-fcntl</option> by default. MBX locking causes a shared lock
67846 to be taken out on the open mailbox, and an exclusive lock on the file
67847 <filename>/tmp/.n.m</filename> where <emphasis>n</emphasis> and <emphasis>m</emphasis> are the device number and inode
67848 number of the mailbox file. When the locking is released, if an exclusive lock
67849 can be obtained for the mailbox, the file in <filename>/tmp</filename> is deleted.
67850 </para>
67851 <para>
67852 The default output contains verification of the locking that takes place. The
67853 <option>-v</option> option causes some additional information to be given. The <option>-q</option> option
67854 suppresses all output except error messages.
67855 </para>
67856 <para>
67857 A command such as
67858 </para>
67859 <literallayout class="monospaced">
67860 exim_lock /var/spool/mail/spqr
67861 </literallayout>
67862 <para>
67863 runs an interactive shell while the file is locked, whereas
67864 </para>
67865 <literallayout>
67866 <literal>exim_lock -q /var/spool/mail/spqr &lt;&lt;End</literal>
67867 &lt;<emphasis>some commands</emphasis>&gt;
67868 <literal>End</literal>
67869 </literallayout>
67870 <para>
67871 runs a specific non-interactive sequence of commands while the file is locked,
67872 suppressing all verification output. A single command can be run by a command
67873 such as
67874 </para>
67875 <literallayout class="monospaced">
67876 exim_lock -q /var/spool/mail/spqr \
67877   "cp /var/spool/mail/spqr /some/where"
67878 </literallayout>
67879 <para>
67880 Note that if a command is supplied, it must be entirely contained within the
67881 second argument &ndash; hence the quotes.
67882 <indexterm role="concept" startref="IIDutils" class="endofrange"/>
67883 </para>
67884 </section>
67885 </chapter>
67886
67887 <chapter id="CHAPeximon">
67888 <title>The Exim monitor</title>
67889 <para>
67890 <indexterm role="concept" id="IIDeximon" class="startofrange">
67891 <primary>Exim monitor</primary>
67892 <secondary>description</secondary>
67893 </indexterm>
67894 <indexterm role="concept">
67895 <primary>X-windows</primary>
67896 </indexterm>
67897 <indexterm role="concept">
67898 <primary><emphasis>eximon</emphasis></primary>
67899 </indexterm>
67900 <indexterm role="concept">
67901 <primary>Local/eximon.conf</primary>
67902 </indexterm>
67903 <indexterm role="concept">
67904 <primary><filename>exim_monitor/EDITME</filename></primary>
67905 </indexterm>
67906 The Exim monitor is an application which displays in an X window information
67907 about the state of Exim&#x2019;s queue and what Exim is doing. An admin user can
67908 perform certain operations on messages from this GUI interface; however all
67909 such facilities are also available from the command line, and indeed, the
67910 monitor itself makes use of the command line to perform any actions requested.
67911 </para>
67912 <section id="SECID264">
67913 <title>Running the monitor</title>
67914 <para>
67915 The monitor is started by running the script called <emphasis>eximon</emphasis>. This is a shell
67916 script that sets up a number of environment variables, and then runs the
67917 binary called <filename>eximon.bin</filename>. The default appearance of the monitor window can
67918 be changed by editing the <filename>Local/eximon.conf</filename> file created by editing
67919 <filename>exim_monitor/EDITME</filename>. Comments in that file describe what the various
67920 parameters are for.
67921 </para>
67922 <para>
67923 The parameters that get built into the <emphasis>eximon</emphasis> script can be overridden for
67924 a particular invocation by setting up environment variables of the same names,
67925 preceded by <literal>EXIMON_</literal>. For example, a shell command such as
67926 </para>
67927 <literallayout class="monospaced">
67928 EXIMON_LOG_DEPTH=400 eximon
67929 </literallayout>
67930 <para>
67931 (in a Bourne-compatible shell) runs <emphasis>eximon</emphasis> with an overriding setting of
67932 the LOG_DEPTH parameter. If EXIMON_LOG_FILE_PATH is set in the environment, it
67933 overrides the Exim log file configuration. This makes it possible to have
67934 <emphasis>eximon</emphasis> tailing log data that is written to syslog, provided that MAIL.INFO
67935 syslog messages are routed to a file on the local host.
67936 </para>
67937 <para>
67938 X resources can be used to change the appearance of the window in the normal
67939 way. For example, a resource setting of the form
67940 </para>
67941 <literallayout class="monospaced">
67942 Eximon*background: gray94
67943 </literallayout>
67944 <para>
67945 changes the colour of the background to light grey rather than white. The
67946 stripcharts are drawn with both the data lines and the reference lines in
67947 black. This means that the reference lines are not visible when on top of the
67948 data. However, their colour can be changed by setting a resource called
67949 <quote>highlight</quote> (an odd name, but that&#x2019;s what the Athena stripchart widget uses).
67950 For example, if your X server is running Unix, you could set up lighter
67951 reference lines in the stripcharts by obeying
67952 </para>
67953 <literallayout class="monospaced">
67954 xrdb -merge &lt;&lt;End
67955 Eximon*highlight: gray
67956 End
67957 </literallayout>
67958 <para>
67959 <indexterm role="concept">
67960 <primary>admin user</primary>
67961 </indexterm>
67962 In order to see the contents of messages on the queue, and to operate on them,
67963 <emphasis>eximon</emphasis> must either be run as root or by an admin user.
67964 </para>
67965 <para>
67966 The command-line parameters of <emphasis>eximon</emphasis> are passed to <filename>eximon.bin</filename> and may
67967 contain X11 resource parameters interpreted by the X11 library.  In addition,
67968 if the first parameter starts with the string "gdb" then it is removed and the
67969 binary is invoked under gdb (the parameter is used as the gdb command-name, so
67970 versioned variants of gdb can be invoked).
67971 </para>
67972 <para>
67973 The monitor&#x2019;s window is divided into three parts. The first contains one or
67974 more stripcharts and two action buttons, the second contains a <quote>tail</quote> of the
67975 main log file, and the third is a display of the queue of messages awaiting
67976 delivery, with two more action buttons. The following sections describe these
67977 different parts of the display.
67978 </para>
67979 </section>
67980 <section id="SECID265">
67981 <title>The stripcharts</title>
67982 <para>
67983 <indexterm role="concept">
67984 <primary>stripchart</primary>
67985 </indexterm>
67986 The first stripchart is always a count of messages on the queue. Its name can
67987 be configured by setting QUEUE_STRIPCHART_NAME in the
67988 <filename>Local/eximon.conf</filename> file. The remaining stripcharts are defined in the
67989 configuration script by regular expression matches on log file entries, making
67990 it possible to display, for example, counts of messages delivered to certain
67991 hosts or using certain transports. The supplied defaults display counts of
67992 received and delivered messages, and of local and SMTP deliveries. The default
67993 period between stripchart updates is one minute; this can be adjusted by a
67994 parameter in the <filename>Local/eximon.conf</filename> file.
67995 </para>
67996 <para>
67997 The stripchart displays rescale themselves automatically as the value they are
67998 displaying changes. There are always 10 horizontal lines in each chart; the
67999 title string indicates the value of each division when it is greater than one.
68000 For example, <quote>x2</quote> means that each division represents a value of 2.
68001 </para>
68002 <para>
68003 It is also possible to have a stripchart which shows the percentage fullness of
68004 a particular disk partition, which is useful when local deliveries are confined
68005 to a single partition.
68006 </para>
68007 <para>
68008 <indexterm role="concept">
68009 <primary><option>statvfs</option> function</primary>
68010 </indexterm>
68011 This relies on the availability of the <function>statvfs()</function> function or equivalent in
68012 the operating system. Most, but not all versions of Unix that support Exim have
68013 this. For this particular stripchart, the top of the chart always represents
68014 100%, and the scale is given as <quote>x10%</quote>. This chart is configured by setting
68015 SIZE_STRIPCHART and (optionally) SIZE_STRIPCHART_NAME in the
68016 <filename>Local/eximon.conf</filename> file.
68017 </para>
68018 </section>
68019 <section id="SECID266">
68020 <title>Main action buttons</title>
68021 <para>
68022 <indexterm role="concept">
68023 <primary>size</primary>
68024 <secondary>of monitor window</secondary>
68025 </indexterm>
68026 <indexterm role="concept">
68027 <primary>Exim monitor</primary>
68028 <secondary>window size</secondary>
68029 </indexterm>
68030 <indexterm role="concept">
68031 <primary>window size</primary>
68032 </indexterm>
68033 Below the stripcharts there is an action button for quitting the monitor. Next
68034 to this is another button marked <quote>Size</quote>. They are placed here so that
68035 shrinking the window to its default minimum size leaves just the queue count
68036 stripchart and these two buttons visible. Pressing the <quote>Size</quote> button causes
68037 the window to expand to its maximum size, unless it is already at the maximum,
68038 in which case it is reduced to its minimum.
68039 </para>
68040 <para>
68041 When expanding to the maximum, if the window cannot be fully seen where it
68042 currently is, it is moved back to where it was the last time it was at full
68043 size. When it is expanding from its minimum size, the old position is
68044 remembered, and next time it is reduced to the minimum it is moved back there.
68045 </para>
68046 <para>
68047 The idea is that you can keep a reduced window just showing one or two
68048 stripcharts at a convenient place on your screen, easily expand it to show
68049 the full window when required, and just as easily put it back to what it was.
68050 The idea is copied from what the <emphasis>twm</emphasis> window manager does for its
68051 <emphasis>f.fullzoom</emphasis> action. The minimum size of the window can be changed by setting
68052 the MIN_HEIGHT and MIN_WIDTH values in <filename>Local/eximon.conf</filename>.
68053 </para>
68054 <para>
68055 Normally, the monitor starts up with the window at its full size, but it can be
68056 built so that it starts up with the window at its smallest size, by setting
68057 START_SMALL=yes in <filename>Local/eximon.conf</filename>.
68058 </para>
68059 </section>
68060 <section id="SECID267">
68061 <title>The log display</title>
68062 <para>
68063 <indexterm role="concept">
68064 <primary>log</primary>
68065 <secondary>tail of; in monitor</secondary>
68066 </indexterm>
68067 The second section of the window is an area in which a display of the tail of
68068 the main log is maintained.
68069 To save space on the screen, the timestamp on each log line is shortened by
68070 removing the date and, if <option>log_timezone</option> is set, the timezone.
68071 The log tail is not available when the only destination for logging data is
68072 syslog, unless the syslog lines are routed to a local file whose name is passed
68073 to <emphasis>eximon</emphasis> via the EXIMON_LOG_FILE_PATH environment variable.
68074 </para>
68075 <para>
68076 The log sub-window has a scroll bar at its lefthand side which can be used to
68077 move back to look at earlier text, and the up and down arrow keys also have a
68078 scrolling effect. The amount of log that is kept depends on the setting of
68079 LOG_BUFFER in <filename>Local/eximon.conf</filename>, which specifies the amount of memory
68080 to use. When this is full, the earlier 50% of data is discarded &ndash; this is
68081 much more efficient than throwing it away line by line. The sub-window also has
68082 a horizontal scroll bar for accessing the ends of long log lines. This is the
68083 only means of horizontal scrolling; the right and left arrow keys are not
68084 available. Text can be cut from this part of the window using the mouse in the
68085 normal way. The size of this subwindow is controlled by parameters in the
68086 configuration file <filename>Local/eximon.conf</filename>.
68087 </para>
68088 <para>
68089 Searches of the text in the log window can be carried out by means of the ^R
68090 and ^S keystrokes, which default to a reverse and a forward search,
68091 respectively. The search covers only the text that is displayed in the window.
68092 It cannot go further back up the log.
68093 </para>
68094 <para>
68095 The point from which the search starts is indicated by a caret marker. This is
68096 normally at the end of the text in the window, but can be positioned explicitly
68097 by pointing and clicking with the left mouse button, and is moved automatically
68098 by a successful search. If new text arrives in the window when it is scrolled
68099 back, the caret remains where it is, but if the window is not scrolled back,
68100 the caret is moved to the end of the new text.
68101 </para>
68102 <para>
68103 Pressing ^R or ^S pops up a window into which the search text can be typed.
68104 There are buttons for selecting forward or reverse searching, for carrying out
68105 the search, and for cancelling. If the <quote>Search</quote> button is pressed, the search
68106 happens and the window remains so that further searches can be done. If the
68107 <quote>Return</quote> key is pressed, a single search is done and the window is closed. If
68108 ^C is typed the search is cancelled.
68109 </para>
68110 <para>
68111 The searching facility is implemented using the facilities of the Athena text
68112 widget. By default this pops up a window containing both <quote>search</quote> and
68113 <quote>replace</quote> options. In order to suppress the unwanted <quote>replace</quote> portion for
68114 eximon, a modified version of the <option>TextPop</option> widget is distributed with Exim.
68115 However, the linkers in BSDI and HP-UX seem unable to handle an externally
68116 provided version of <option>TextPop</option> when the remaining parts of the text widget
68117 come from the standard libraries. The compile-time option EXIMON_TEXTPOP can be
68118 unset to cut out the modified <option>TextPop</option>, making it possible to build Eximon
68119 on these systems, at the expense of having unwanted items in the search popup
68120 window.
68121 </para>
68122 </section>
68123 <section id="SECID268">
68124 <title>The queue display</title>
68125 <para>
68126 <indexterm role="concept">
68127 <primary>queue</primary>
68128 <secondary>display in monitor</secondary>
68129 </indexterm>
68130 The bottom section of the monitor window contains a list of all messages that
68131 are on the queue, which includes those currently being received or delivered,
68132 as well as those awaiting delivery. The size of this subwindow is controlled by
68133 parameters in the configuration file <filename>Local/eximon.conf</filename>, and the frequency
68134 at which it is updated is controlled by another parameter in the same file &ndash;
68135 the default is 5 minutes, since queue scans can be quite expensive. However,
68136 there is an <quote>Update</quote> action button just above the display which can be used
68137 to force an update of the queue display at any time.
68138 </para>
68139 <para>
68140 When a host is down for some time, a lot of pending mail can build up for it,
68141 and this can make it hard to deal with other messages on the queue. To help
68142 with this situation there is a button next to <quote>Update</quote> called <quote>Hide</quote>. If
68143 pressed, a dialogue box called <quote>Hide addresses ending with</quote> is put up. If you
68144 type anything in here and press <quote>Return</quote>, the text is added to a chain of
68145 such texts, and if every undelivered address in a message matches at least one
68146 of the texts, the message is not displayed.
68147 </para>
68148 <para>
68149 If there is an address that does not match any of the texts, all the addresses
68150 are displayed as normal. The matching happens on the ends of addresses so, for
68151 example, <emphasis>cam.ac.uk</emphasis> specifies all addresses in Cambridge, while
68152 <emphasis>xxx@foo.com.example</emphasis> specifies just one specific address. When any hiding
68153 has been set up, a button called <quote>Unhide</quote> is displayed. If pressed, it
68154 cancels all hiding. Also, to ensure that hidden messages do not get forgotten,
68155 a hide request is automatically cancelled after one hour.
68156 </para>
68157 <para>
68158 While the dialogue box is displayed, you can&#x2019;t press any buttons or do anything
68159 else to the monitor window. For this reason, if you want to cut text from the
68160 queue display to use in the dialogue box, you have to do the cutting before
68161 pressing the <quote>Hide</quote> button.
68162 </para>
68163 <para>
68164 The queue display contains, for each unhidden queued message, the length of
68165 time it has been on the queue, the size of the message, the message id, the
68166 message sender, and the first undelivered recipient, all on one line. If it is
68167 a bounce message, the sender is shown as <quote>&lt;&gt;</quote>. If there is more than one
68168 recipient to which the message has not yet been delivered, subsequent ones are
68169 listed on additional lines, up to a maximum configured number, following which
68170 an ellipsis is displayed. Recipients that have already received the message are
68171 not shown.
68172 </para>
68173 <para>
68174 <indexterm role="concept">
68175 <primary>frozen messages</primary>
68176 <secondary>display</secondary>
68177 </indexterm>
68178 If a message is frozen, an asterisk is displayed at the left-hand side.
68179 </para>
68180 <para>
68181 The queue display has a vertical scroll bar, and can also be scrolled by means
68182 of the arrow keys. Text can be cut from it using the mouse in the normal way.
68183 The text searching facilities, as described above for the log window, are also
68184 available, but the caret is always moved to the end of the text when the queue
68185 display is updated.
68186 </para>
68187 </section>
68188 <section id="SECID269">
68189 <title>The queue menu</title>
68190 <para>
68191 <indexterm role="concept">
68192 <primary>queue</primary>
68193 <secondary>menu in monitor</secondary>
68194 </indexterm>
68195 If the <option>shift</option> key is held down and the left button is clicked when the mouse
68196 pointer is over the text for any message, an action menu pops up, and the first
68197 line of the queue display for the message is highlighted. This does not affect
68198 any selected text.
68199 </para>
68200 <para>
68201 If you want to use some other event for popping up the menu, you can set the
68202 MENU_EVENT parameter in <filename>Local/eximon.conf</filename> to change the default, or
68203 set EXIMON_MENU_EVENT in the environment before starting the monitor. The
68204 value set in this parameter is a standard X event description. For example, to
68205 run eximon using <option>ctrl</option> rather than <option>shift</option> you could use
68206 </para>
68207 <literallayout class="monospaced">
68208 EXIMON_MENU_EVENT='Ctrl&lt;Btn1Down&gt;' eximon
68209 </literallayout>
68210 <para>
68211 The title of the menu is the message id, and it contains entries which act as
68212 follows:
68213 </para>
68214 <itemizedlist>
68215 <listitem>
68216 <para>
68217 <emphasis>message log</emphasis>: The contents of the message log for the message are displayed
68218 in a new text window.
68219 </para>
68220 </listitem>
68221 <listitem>
68222 <para>
68223 <emphasis>headers</emphasis>: Information from the spool file that contains the envelope
68224 information and headers is displayed in a new text window. See chapter
68225 <xref linkend="CHAPspool"/> for a description of the format of spool files.
68226 </para>
68227 </listitem>
68228 <listitem>
68229 <para>
68230 <emphasis>body</emphasis>: The contents of the spool file containing the body of the message are
68231 displayed in a new text window. There is a default limit of 20,000 bytes to the
68232 amount of data displayed. This can be changed by setting the BODY_MAX
68233 option at compile time, or the EXIMON_BODY_MAX option at run time.
68234 </para>
68235 </listitem>
68236 <listitem>
68237 <para>
68238 <emphasis>deliver message</emphasis>: A call to Exim is made using the <option>-M</option> option to request
68239 delivery of the message. This causes an automatic thaw if the message is
68240 frozen. The <option>-v</option> option is also set, and the output from Exim is displayed in
68241 a new text window. The delivery is run in a separate process, to avoid holding
68242 up the monitor while the delivery proceeds.
68243 </para>
68244 </listitem>
68245 <listitem>
68246 <para>
68247 <emphasis>freeze message</emphasis>: A call to Exim is made using the <option>-Mf</option> option to request
68248 that the message be frozen.
68249 </para>
68250 </listitem>
68251 <listitem>
68252 <para>
68253 <indexterm role="concept">
68254 <primary>thawing messages</primary>
68255 </indexterm>
68256 <indexterm role="concept">
68257 <primary>unfreezing messages</primary>
68258 </indexterm>
68259 <indexterm role="concept">
68260 <primary>frozen messages</primary>
68261 <secondary>thawing</secondary>
68262 </indexterm>
68263 <emphasis>thaw message</emphasis>: A call to Exim is made using the <option>-Mt</option> option to request
68264 that the message be thawed.
68265 </para>
68266 </listitem>
68267 <listitem>
68268 <para>
68269 <indexterm role="concept">
68270 <primary>delivery</primary>
68271 <secondary>forcing failure</secondary>
68272 </indexterm>
68273 <emphasis>give up on msg</emphasis>: A call to Exim is made using the <option>-Mg</option> option to request
68274 that Exim gives up trying to deliver the message. A bounce message is generated
68275 for any remaining undelivered addresses.
68276 </para>
68277 </listitem>
68278 <listitem>
68279 <para>
68280 <emphasis>remove message</emphasis>: A call to Exim is made using the <option>-Mrm</option> option to request
68281 that the message be deleted from the system without generating a bounce
68282 message.
68283 </para>
68284 </listitem>
68285 <listitem>
68286 <para>
68287 <emphasis>add recipient</emphasis>: A dialog box is displayed into which a recipient address can
68288 be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
68289 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
68290 Otherwise it must be entered as a fully qualified address. Pressing RETURN
68291 causes a call to Exim to be made using the <option>-Mar</option> option to request that an
68292 additional recipient be added to the message, unless the entry box is empty, in
68293 which case no action is taken.
68294 </para>
68295 </listitem>
68296 <listitem>
68297 <para>
68298 <emphasis>mark delivered</emphasis>: A dialog box is displayed into which a recipient address
68299 can be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
68300 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
68301 Otherwise it must be entered as a fully qualified address. Pressing RETURN
68302 causes a call to Exim to be made using the <option>-Mmd</option> option to mark the given
68303 recipient address as already delivered, unless the entry box is empty, in which
68304 case no action is taken.
68305 </para>
68306 </listitem>
68307 <listitem>
68308 <para>
68309 <emphasis>mark all delivered</emphasis>: A call to Exim is made using the <option>-Mmad</option> option to
68310 mark all recipient addresses as already delivered.
68311 </para>
68312 </listitem>
68313 <listitem>
68314 <para>
68315 <emphasis>edit sender</emphasis>: A dialog box is displayed initialized with the current
68316 sender&#x2019;s address. Pressing RETURN causes a call to Exim to be made using the
68317 <option>-Mes</option> option to replace the sender address, unless the entry box is empty,
68318 in which case no action is taken. If you want to set an empty sender (as in
68319 bounce messages), you must specify it as <quote>&lt;&gt;</quote>. Otherwise, if the address is
68320 not qualified and the QUALIFY_DOMAIN parameter is set in <filename>Local/eximon.conf</filename>,
68321 the address is qualified with that domain.
68322 </para>
68323 </listitem>
68324 </itemizedlist>
68325 <para>
68326 When a delivery is forced, a window showing the <option>-v</option> output is displayed. In
68327 other cases when a call to Exim is made, if there is any output from Exim (in
68328 particular, if the command fails) a window containing the command and the
68329 output is displayed. Otherwise, the results of the action are normally apparent
68330 from the log and queue displays. However, if you set ACTION_OUTPUT=yes in
68331 <filename>Local/eximon.conf</filename>, a window showing the Exim command is always opened, even
68332 if no output is generated.
68333 </para>
68334 <para>
68335 The queue display is automatically updated for actions such as freezing and
68336 thawing, unless ACTION_QUEUE_UPDATE=no has been set in
68337 <filename>Local/eximon.conf</filename>. In this case the <quote>Update</quote> button has to be used to
68338 force an update of the display after one of these actions.
68339 </para>
68340 <para>
68341 In any text window that is displayed as result of a menu action, the normal
68342 cut-and-paste facility is available, and searching can be carried out using ^R
68343 and ^S, as described above for the log tail window.
68344 <indexterm role="concept" startref="IIDeximon" class="endofrange"/>
68345 </para>
68346 </section>
68347 </chapter>
68348
68349 <chapter id="CHAPsecurity">
68350 <title>Security considerations</title>
68351 <para>
68352 <indexterm role="concept" id="IIDsecurcon" class="startofrange">
68353 <primary>security</primary>
68354 <secondary>discussion of</secondary>
68355 </indexterm>
68356 This chapter discusses a number of issues concerned with security, some of
68357 which are also covered in other parts of this manual.
68358 </para>
68359 <para>
68360 For reasons that this author does not understand, some people have promoted
68361 Exim as a <quote>particularly secure</quote> mailer. Perhaps it is because of the
68362 existence of this chapter in the documentation. However, the intent of the
68363 chapter is simply to describe the way Exim works in relation to certain
68364 security concerns, not to make any specific claims about the effectiveness of
68365 its security as compared with other MTAs.
68366 </para>
68367 <para>
68368 What follows is a description of the way Exim is supposed to be. Best efforts
68369 have been made to try to ensure that the code agrees with the theory, but an
68370 absence of bugs can never be guaranteed. Any that are reported will get fixed
68371 as soon as possible.
68372 </para>
68373 <section id="SECID286">
68374 <title>Building a more <quote>hardened</quote> Exim</title>
68375 <para>
68376 <indexterm role="concept">
68377 <primary>security</primary>
68378 <secondary>build-time features</secondary>
68379 </indexterm>
68380 There are a number of build-time options that can be set in <filename>Local/Makefile</filename>
68381 to create Exim binaries that are <quote>harder</quote> to attack, in particular by a rogue
68382 Exim administrator who does not have the root password, or by someone who has
68383 penetrated the Exim (but not the root) account. These options are as follows:
68384 </para>
68385 <itemizedlist>
68386 <listitem>
68387 <para>
68388 ALT_CONFIG_PREFIX can be set to a string that is required to match the
68389 start of any file names used with the <option>-C</option> option. When it is set, these file
68390 names are also not allowed to contain the sequence <quote>/../</quote>. (However, if the
68391 value of the <option>-C</option> option is identical to the value of CONFIGURE_FILE in
68392 <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as usual.) There is no
68393 default setting for <option>ALT_CONFIG_PREFIX</option>.
68394 </para>
68395 <para>
68396 If the permitted configuration files are confined to a directory to
68397 which only root has access, this guards against someone who has broken
68398 into the Exim account from running a privileged Exim with an arbitrary
68399 configuration file, and using it to break into other accounts.
68400 </para>
68401 </listitem>
68402 <listitem>
68403 <para>
68404 If a non-trusted configuration file (i.e. not the default configuration file
68405 or one which is trusted by virtue of being listed in the TRUSTED_CONFIG_LIST
68406 file) is specified with <option>-C</option>, or if macros are given with <option>-D</option> (but see
68407 the next item), then root privilege is retained only if the caller of Exim is
68408 root. This locks out the possibility of testing a configuration using <option>-C</option>
68409 right through message reception and delivery, even if the caller is root. The
68410 reception works, but by that time, Exim is running as the Exim user, so when
68411 it re-execs to regain privilege for the delivery, the use of <option>-C</option> causes
68412 privilege to be lost. However, root can test reception and delivery using two
68413 separate commands.
68414 </para>
68415 </listitem>
68416 <listitem>
68417 <para>
68418 The WHITELIST_D_MACROS build option declares some macros to be safe to override
68419 with <option>-D</option> if the real uid is one of root, the Exim run-time user or the
68420 CONFIGURE_OWNER, if defined.  The potential impact of this option is limited by
68421 requiring the run-time value supplied to <option>-D</option> to match a regex that errs on
68422 the restrictive side.  Requiring build-time selection of safe macros is onerous
68423 but this option is intended solely as a transition mechanism to permit
68424 previously-working configurations to continue to work after release 4.73.
68425 </para>
68426 </listitem>
68427 <listitem>
68428 <para>
68429 If DISABLE_D_OPTION is defined, the use of the <option>-D</option> command line option
68430 is disabled.
68431 </para>
68432 </listitem>
68433 <listitem>
68434 <para>
68435 FIXED_NEVER_USERS can be set to a colon-separated list of users that are
68436 never to be used for any deliveries. This is like the <option>never_users</option> runtime
68437 option, but it cannot be overridden; the runtime option adds additional users
68438 to the list. The default setting is <quote>root</quote>; this prevents a non-root user who
68439 is permitted to modify the runtime file from using Exim as a way to get root.
68440 </para>
68441 </listitem>
68442 </itemizedlist>
68443 </section>
68444 <section id="SECID270">
68445 <title>Root privilege</title>
68446 <para>
68447 <indexterm role="concept">
68448 <primary>setuid</primary>
68449 </indexterm>
68450 <indexterm role="concept">
68451 <primary>root privilege</primary>
68452 </indexterm>
68453 The Exim binary is normally setuid to root, which means that it gains root
68454 privilege (runs as root) when it starts execution. In some special cases (for
68455 example, when the daemon is not in use and there are no local deliveries), it
68456 may be possible to run Exim setuid to some user other than root. This is
68457 discussed in the next section. However, in most installations, root privilege
68458 is required for two things:
68459 </para>
68460 <itemizedlist>
68461 <listitem>
68462 <para>
68463 To set up a socket connected to the standard SMTP port (25) when initialising
68464 the listening daemon. If Exim is run from <emphasis>inetd</emphasis>, this privileged action is
68465 not required.
68466 </para>
68467 </listitem>
68468 <listitem>
68469 <para>
68470 To be able to change uid and gid in order to read users&#x2019; <filename>.forward</filename> files and
68471 perform local deliveries as the receiving user or as specified in the
68472 configuration.
68473 </para>
68474 </listitem>
68475 </itemizedlist>
68476 <para>
68477 It is not necessary to be root to do any of the other things Exim does, such as
68478 receiving messages and delivering them externally over SMTP, and it is
68479 obviously more secure if Exim does not run as root except when necessary.
68480 For this reason, a user and group for Exim to use must be defined in
68481 <filename>Local/Makefile</filename>. These are known as <quote>the Exim user</quote> and <quote>the Exim
68482 group</quote>. Their values can be changed by the run time configuration, though this
68483 is not recommended. Often a user called <emphasis>exim</emphasis> is used, but some sites use
68484 <emphasis>mail</emphasis> or another user name altogether.
68485 </para>
68486 <para>
68487 Exim uses <function>setuid()</function> whenever it gives up root privilege. This is a permanent
68488 abdication; the process cannot regain root afterwards. Prior to release 4.00,
68489 <function>seteuid()</function> was used in some circumstances, but this is no longer the case.
68490 </para>
68491 <para>
68492 After a new Exim process has interpreted its command line options, it changes
68493 uid and gid in the following cases:
68494 </para>
68495 <itemizedlist>
68496 <listitem>
68497 <para>
68498 <indexterm role="option">
68499 <primary><option>-C</option></primary>
68500 </indexterm>
68501 <indexterm role="option">
68502 <primary><option>-D</option></primary>
68503 </indexterm>
68504 If the <option>-C</option> option is used to specify an alternate configuration file, or if
68505 the <option>-D</option> option is used to define macro values for the configuration, and the
68506 calling process is not running as root, the uid and gid are changed to those of
68507 the calling process.
68508 However, if DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the <option>-D</option>
68509 option may not be used at all.
68510 If WHITELIST_D_MACROS is defined in <filename>Local/Makefile</filename>, then some macro values
68511 can be supplied if the calling process is running as root, the Exim run-time
68512 user or CONFIGURE_OWNER, if defined.
68513 </para>
68514 </listitem>
68515 <listitem>
68516 <para>
68517 <indexterm role="option">
68518 <primary><option>-be</option></primary>
68519 </indexterm>
68520 <indexterm role="option">
68521 <primary><option>-bf</option></primary>
68522 </indexterm>
68523 <indexterm role="option">
68524 <primary><option>-bF</option></primary>
68525 </indexterm>
68526 If the expansion test option (<option>-be</option>) or one of the filter testing options
68527 (<option>-bf</option> or <option>-bF</option>) are used, the uid and gid are changed to those of the
68528 calling process.
68529 </para>
68530 </listitem>
68531 <listitem>
68532 <para>
68533 If the process is not a daemon process or a queue runner process or a delivery
68534 process or a process for testing address routing (started with <option>-bt</option>), the
68535 uid and gid are changed to the Exim user and group. This means that Exim always
68536 runs under its own uid and gid when receiving messages. This also applies when
68537 testing address verification
68538 <indexterm role="option">
68539 <primary><option>-bv</option></primary>
68540 </indexterm>
68541 <indexterm role="option">
68542 <primary><option>-bh</option></primary>
68543 </indexterm>
68544 (the <option>-bv</option> option) and testing incoming message policy controls (the <option>-bh</option>
68545 option).
68546 </para>
68547 </listitem>
68548 <listitem>
68549 <para>
68550 For a daemon, queue runner, delivery, or address testing process, the uid
68551 remains as root at this stage, but the gid is changed to the Exim group.
68552 </para>
68553 </listitem>
68554 </itemizedlist>
68555 <para>
68556 The processes that initially retain root privilege behave as follows:
68557 </para>
68558 <itemizedlist>
68559 <listitem>
68560 <para>
68561 A daemon process changes the gid to the Exim group and the uid to the Exim
68562 user after setting up one or more listening sockets. The <function>initgroups()</function>
68563 function is called, so that if the Exim user is in any additional groups, they
68564 will be used during message reception.
68565 </para>
68566 </listitem>
68567 <listitem>
68568 <para>
68569 A queue runner process retains root privilege throughout its execution. Its
68570 job is to fork a controlled sequence of delivery processes.
68571 </para>
68572 </listitem>
68573 <listitem>
68574 <para>
68575 A delivery process retains root privilege throughout most of its execution,
68576 but any actual deliveries (that is, the transports themselves) are run in
68577 subprocesses which always change to a non-root uid and gid. For local
68578 deliveries this is typically the uid and gid of the owner of the mailbox; for
68579 remote deliveries, the Exim uid and gid are used. Once all the delivery
68580 subprocesses have been run, a delivery process changes to the Exim uid and gid
68581 while doing post-delivery tidying up such as updating the retry database and
68582 generating bounce and warning messages.
68583 </para>
68584 <para>
68585 While the recipient addresses in a message are being routed, the delivery
68586 process runs as root. However, if a user&#x2019;s filter file has to be processed,
68587 this is done in a subprocess that runs under the individual user&#x2019;s uid and
68588 gid. A system filter is run as root unless <option>system_filter_user</option> is set.
68589 </para>
68590 </listitem>
68591 <listitem>
68592 <para>
68593 A process that is testing addresses (the <option>-bt</option> option) runs as root so that
68594 the routing is done in the same environment as a message delivery.
68595 </para>
68596 </listitem>
68597 </itemizedlist>
68598 </section>
68599 <section id="SECTrunexiwitpri">
68600 <title>Running Exim without privilege</title>
68601 <para>
68602 <indexterm role="concept">
68603 <primary>privilege, running without</primary>
68604 </indexterm>
68605 <indexterm role="concept">
68606 <primary>unprivileged running</primary>
68607 </indexterm>
68608 <indexterm role="concept">
68609 <primary>root privilege</primary>
68610 <secondary>running without</secondary>
68611 </indexterm>
68612 Some installations like to run Exim in an unprivileged state for more of its
68613 operation, for added security. Support for this mode of operation is provided
68614 by the global option <option>deliver_drop_privilege</option>. When this is set, the uid and
68615 gid are changed to the Exim user and group at the start of a delivery process
68616 (and also queue runner and address testing processes). This means that address
68617 routing is no longer run as root, and the deliveries themselves cannot change
68618 to any other uid.
68619 </para>
68620 <para>
68621 <indexterm role="concept">
68622 <primary>SIGHUP</primary>
68623 </indexterm>
68624 <indexterm role="concept">
68625 <primary>daemon</primary>
68626 <secondary>restarting</secondary>
68627 </indexterm>
68628 Leaving the binary setuid to root, but setting <option>deliver_drop_privilege</option> means
68629 that the daemon can still be started in the usual way, and it can respond
68630 correctly to SIGHUP because the re-invocation regains root privilege.
68631 </para>
68632 <para>
68633 An alternative approach is to make Exim setuid to the Exim user and also setgid
68634 to the Exim group. If you do this, the daemon must be started from a root
68635 process. (Calling Exim from a root process makes it behave in the way it does
68636 when it is setuid root.) However, the daemon cannot restart itself after a
68637 SIGHUP signal because it cannot regain privilege.
68638 </para>
68639 <para>
68640 It is still useful to set <option>deliver_drop_privilege</option> in this case, because it
68641 stops Exim from trying to re-invoke itself to do a delivery after a message has
68642 been received. Such a re-invocation is a waste of resources because it has no
68643 effect.
68644 </para>
68645 <para>
68646 If restarting the daemon is not an issue (for example, if <option>mua_wrapper</option> is
68647 set, or <emphasis>inetd</emphasis> is being used instead of a daemon), having the binary setuid
68648 to the Exim user seems a clean approach, but there is one complication:
68649 </para>
68650 <para>
68651 In this style of operation, Exim is running with the real uid and gid set to
68652 those of the calling process, and the effective uid/gid set to Exim&#x2019;s values.
68653 Ideally, any association with the calling process&#x2019; uid/gid should be dropped,
68654 that is, the real uid/gid should be reset to the effective values so as to
68655 discard any privileges that the caller may have. While some operating systems
68656 have a function that permits this action for a non-root effective uid, quite a
68657 number of them do not. Because of this lack of standardization, Exim does not
68658 address this problem at this time.
68659 </para>
68660 <para>
68661 For this reason, the recommended approach for <quote>mostly unprivileged</quote> running
68662 is to keep the Exim binary setuid to root, and to set
68663 <option>deliver_drop_privilege</option>. This also has the advantage of allowing a daemon to
68664 be used in the most straightforward way.
68665 </para>
68666 <para>
68667 If you configure Exim not to run delivery processes as root, there are a
68668 number of restrictions on what you can do:
68669 </para>
68670 <itemizedlist>
68671 <listitem>
68672 <para>
68673 You can deliver only as the Exim user/group. You should  explicitly use the
68674 <option>user</option> and <option>group</option> options to override routers or local transports that
68675 normally deliver as the recipient. This makes sure that configurations that
68676 work in this mode function the same way in normal mode. Any implicit or
68677 explicit specification of another user causes an error.
68678 </para>
68679 </listitem>
68680 <listitem>
68681 <para>
68682 Use of <filename>.forward</filename> files is severely restricted, such that it is usually
68683 not worthwhile to include them in the configuration.
68684 </para>
68685 </listitem>
68686 <listitem>
68687 <para>
68688 Users who wish to use <filename>.forward</filename> would have to make their home directory and
68689 the file itself accessible to the Exim user. Pipe and append-to-file entries,
68690 and their equivalents in Exim filters, cannot be used. While they could be
68691 enabled in the Exim user&#x2019;s name, that would be insecure and not very useful.
68692 </para>
68693 </listitem>
68694 <listitem>
68695 <para>
68696 Unless the local user mailboxes are all owned by the Exim user (possible in
68697 some POP3 or IMAP-only environments):
68698 </para>
68699 <orderedlist numeration="arabic">
68700 <listitem>
68701 <para>
68702 They must be owned by the Exim group and be writeable by that group. This
68703 implies you must set <option>mode</option> in the appendfile configuration, as well as the
68704 mode of the mailbox files themselves.
68705 </para>
68706 </listitem>
68707 <listitem>
68708 <para>
68709 You must set <option>no_check_owner</option>, since most or all of the files will not be
68710 owned by the Exim user.
68711 </para>
68712 </listitem>
68713 <listitem>
68714 <para>
68715 You must set <option>file_must_exist</option>, because Exim cannot set the owner correctly
68716 on a newly created mailbox when unprivileged. This also implies that new
68717 mailboxes need to be created manually.
68718 </para>
68719 </listitem>
68720 </orderedlist>
68721 </listitem>
68722 </itemizedlist>
68723 <para>
68724 These restrictions severely restrict what can be done in local deliveries.
68725 However, there are no restrictions on remote deliveries. If you are running a
68726 gateway host that does no local deliveries, setting <option>deliver_drop_privilege</option>
68727 gives more security at essentially no cost.
68728 </para>
68729 <para>
68730 If you are using the <option>mua_wrapper</option> facility (see chapter
68731 <xref linkend="CHAPnonqueueing"/>), <option>deliver_drop_privilege</option> is forced to be true.
68732 </para>
68733 </section>
68734 <section id="SECID271">
68735 <title>Delivering to local files</title>
68736 <para>
68737 Full details of the checks applied by <command>appendfile</command> before it writes to a file
68738 are given in chapter <xref linkend="CHAPappendfile"/>.
68739 </para>
68740 </section>
68741 <section id="SECTsecconslocalcmds">
68742 <title>Running local commands</title>
68743 <para>
68744 <indexterm role="concept">
68745 <primary>security</primary>
68746 <secondary>local commands</secondary>
68747 </indexterm>
68748 <indexterm role="concept">
68749 <primary>security</primary>
68750 <secondary>command injection attacks</secondary>
68751 </indexterm>
68752 There are a number of ways in which an administrator can configure Exim to run
68753 commands based upon received, untrustworthy, data. Further, in some
68754 configurations a user who can control a <filename>.forward</filename> file can also arrange to
68755 run commands. Configuration to check includes, but is not limited to:
68756 </para>
68757 <itemizedlist>
68758 <listitem>
68759 <para>
68760 Use of <option>use_shell</option> in the pipe transport: various forms of shell command
68761 injection may be possible with this option present. It is dangerous and should
68762 be used only with considerable caution. Consider constraints which whitelist
68763 allowed characters in a variable which is to be used in a pipe transport that
68764 has <option>use_shell</option> enabled.
68765 </para>
68766 </listitem>
68767 <listitem>
68768 <para>
68769 A number of options such as <option>forbid_filter_run</option>, <option>forbid_filter_perl</option>,
68770 <option>forbid_filter_dlfunc</option> and so forth which restrict facilities available to
68771 <filename>.forward</filename> files in a redirect router. If Exim is running on a central mail
68772 hub to which ordinary users do not have shell access, but home directories are
68773 NFS mounted (for instance) then administrators should review the list of these
68774 forbid options available, and should bear in mind that the options that may
68775 need forbidding can change as new features are added between releases.
68776 </para>
68777 </listitem>
68778 <listitem>
68779 <para>
68780 The <option>${run...}</option> expansion item does not use a shell by default, but
68781 administrators can configure use of <filename>/bin/sh</filename> as part of the command.
68782 Such invocations should be viewed with prejudicial suspicion.
68783 </para>
68784 </listitem>
68785 <listitem>
68786 <para>
68787 Administrators who use embedded Perl are advised to explore how Perl&#x2019;s
68788 taint checking might apply to their usage.
68789 </para>
68790 </listitem>
68791 <listitem>
68792 <para>
68793 Use of <option>${expand...}</option> is somewhat analogous to shell&#x2019;s eval builtin and
68794 administrators are well advised to view its use with suspicion, in case (for
68795 instance) it allows a local-part to contain embedded Exim directives.
68796 </para>
68797 </listitem>
68798 <listitem>
68799 <para>
68800 Use of <option>${match_local_part...}</option> and friends becomes more dangerous if
68801 Exim was built with EXPAND_LISTMATCH_RHS defined: the second string in
68802 each can reference arbitrary lists and files, rather than just being a list
68803 of opaque strings.
68804 The EXPAND_LISTMATCH_RHS option was added and set false by default because of
68805 real-world security vulnerabilities caused by its use with untrustworthy data
68806 injected in, for SQL injection attacks.
68807 Consider the use of the <option>inlisti</option> expansion condition instead.
68808 </para>
68809 </listitem>
68810 </itemizedlist>
68811 </section>
68812 <section id="SECTsecconfdata">
68813 <title>Trust in configuration data</title>
68814 <para>
68815 <indexterm role="concept">
68816 <primary>security</primary>
68817 <secondary>data sources</secondary>
68818 </indexterm>
68819 <indexterm role="concept">
68820 <primary>security</primary>
68821 <secondary>regular expressions</secondary>
68822 </indexterm>
68823 <indexterm role="concept">
68824 <primary>regular expressions</primary>
68825 <secondary>security</secondary>
68826 </indexterm>
68827 <indexterm role="concept">
68828 <primary>PCRE</primary>
68829 <secondary>security</secondary>
68830 </indexterm>
68831 If configuration data for Exim can come from untrustworthy sources, there
68832 are some issues to be aware of:
68833 </para>
68834 <itemizedlist>
68835 <listitem>
68836 <para>
68837 Use of <option>${expand...}</option> may provide a path for shell injection attacks.
68838 </para>
68839 </listitem>
68840 <listitem>
68841 <para>
68842 Letting untrusted data provide a regular expression is unwise.
68843 </para>
68844 </listitem>
68845 <listitem>
68846 <para>
68847 Using <option>${match...}</option> to apply a fixed regular expression against untrusted
68848 data may result in pathological behaviour within PCRE.  Be aware of what
68849 "backtracking" means and consider options for being more strict with a regular
68850 expression. Avenues to explore include limiting what can match (avoiding <literal>.</literal>
68851 when <literal>[a-z0-9]</literal> or other character class will do), use of atomic grouping and
68852 possessive quantifiers or just not using regular expressions against untrusted
68853 data.
68854 </para>
68855 </listitem>
68856 <listitem>
68857 <para>
68858 It can be important to correctly use <option>${quote:...}</option>,
68859 <option>${quote_local_part:...}</option> and <option>${quote_</option>&lt;<emphasis>lookup-type</emphasis>&gt;<option>:...}</option> expansion
68860 items to ensure that data is correctly constructed.
68861 </para>
68862 </listitem>
68863 <listitem>
68864 <para>
68865 Some lookups might return multiple results, even though normal usage is only
68866 expected to yield one result.
68867 </para>
68868 </listitem>
68869 </itemizedlist>
68870 </section>
68871 <section id="SECID272">
68872 <title>IPv4 source routing</title>
68873 <para>
68874 <indexterm role="concept">
68875 <primary>source routing</primary>
68876 <secondary>in IP packets</secondary>
68877 </indexterm>
68878 <indexterm role="concept">
68879 <primary>IP source routing</primary>
68880 </indexterm>
68881 Many operating systems suppress IP source-routed packets in the kernel, but
68882 some cannot be made to do this, so Exim does its own check. It logs incoming
68883 IPv4 source-routed TCP calls, and then drops them. Things are all different in
68884 IPv6. No special checking is currently done.
68885 </para>
68886 </section>
68887 <section id="SECID273">
68888 <title>The VRFY, EXPN, and ETRN commands in SMTP</title>
68889 <para>
68890 Support for these SMTP commands is disabled by default. If required, they can
68891 be enabled by defining suitable ACLs.
68892 </para>
68893 </section>
68894 <section id="SECID274">
68895 <title>Privileged users</title>
68896 <para>
68897 <indexterm role="concept">
68898 <primary>trusted users</primary>
68899 </indexterm>
68900 <indexterm role="concept">
68901 <primary>admin user</primary>
68902 </indexterm>
68903 <indexterm role="concept">
68904 <primary>privileged user</primary>
68905 </indexterm>
68906 <indexterm role="concept">
68907 <primary>user</primary>
68908 <secondary>trusted</secondary>
68909 </indexterm>
68910 <indexterm role="concept">
68911 <primary>user</primary>
68912 <secondary>admin</secondary>
68913 </indexterm>
68914 Exim recognizes two sets of users with special privileges. Trusted users are
68915 able to submit new messages to Exim locally, but supply their own sender
68916 addresses and information about a sending host. For other users submitting
68917 local messages, Exim sets up the sender address from the uid, and doesn&#x2019;t
68918 permit a remote host to be specified.
68919 </para>
68920 <para>
68921 <indexterm role="option">
68922 <primary><option>-f</option></primary>
68923 </indexterm>
68924 However, an untrusted user is permitted to use the <option>-f</option> command line option
68925 in the special form <option>-f &lt;&gt;</option> to indicate that a delivery failure for the
68926 message should not cause an error report. This affects the message&#x2019;s envelope,
68927 but it does not affect the <emphasis>Sender:</emphasis> header. Untrusted users may also be
68928 permitted to use specific forms of address with the <option>-f</option> option by setting
68929 the <option>untrusted_set_sender</option> option.
68930 </para>
68931 <para>
68932 Trusted users are used to run processes that receive mail messages from some
68933 other mail domain and pass them on to Exim for delivery either locally, or over
68934 the Internet. Exim trusts a caller that is running as root, as the Exim user,
68935 as any user listed in the <option>trusted_users</option> configuration option, or under any
68936 group listed in the <option>trusted_groups</option> option.
68937 </para>
68938 <para>
68939 Admin users are permitted to do things to the messages on Exim&#x2019;s queue. They
68940 can freeze or thaw messages, cause them to be returned to their senders, remove
68941 them entirely, or modify them in various ways. In addition, admin users can run
68942 the Exim monitor and see all the information it is capable of providing, which
68943 includes the contents of files on the spool.
68944 </para>
68945 <para>
68946 <indexterm role="option">
68947 <primary><option>-M</option></primary>
68948 </indexterm>
68949 <indexterm role="option">
68950 <primary><option>-q</option></primary>
68951 </indexterm>
68952 By default, the use of the <option>-M</option> and <option>-q</option> options to cause Exim to attempt
68953 delivery of messages on its queue is restricted to admin users. This
68954 restriction can be relaxed by setting the <option>no_prod_requires_admin</option> option.
68955 Similarly, the use of <option>-bp</option> (and its variants) to list the contents of the
68956 queue is also restricted to admin users. This restriction can be relaxed by
68957 setting <option>no_queue_list_requires_admin</option>.
68958 </para>
68959 <para>
68960 Exim recognizes an admin user if the calling process is running as root or as
68961 the Exim user or if any of the groups associated with the calling process is
68962 the Exim group. It is not necessary actually to be running under the Exim
68963 group. However, if admin users who are not root or the Exim user are to access
68964 the contents of files on the spool via the Exim monitor (which runs
68965 unprivileged), Exim must be built to allow group read access to its spool
68966 files.
68967 </para>
68968 <para revisionflag="changed">
68969 By default, regular users are trusted to perform basic testing and
68970 introspection commands, as themselves.  This setting can be tightened by
68971 setting the <option>commandline_checks_require_admin</option> option.
68972 This affects most of the checking options,
68973 such as <option>-be</option> and anything else <option>-b*</option>.
68974 </para>
68975 </section>
68976 <section id="SECID275">
68977 <title>Spool files</title>
68978 <para>
68979 <indexterm role="concept">
68980 <primary>spool directory</primary>
68981 <secondary>files</secondary>
68982 </indexterm>
68983 Exim&#x2019;s spool directory and everything it contains is owned by the Exim user and
68984 set to the Exim group. The mode for spool files is defined in the
68985 <filename>Local/Makefile</filename> configuration file, and defaults to 0640. This means that
68986 any user who is a member of the Exim group can access these files.
68987 </para>
68988 </section>
68989 <section id="SECID276">
68990 <title>Use of argv[0]</title>
68991 <para>
68992 Exim examines the last component of <option>argv[0]</option>, and if it matches one of a set
68993 of specific strings, Exim assumes certain options. For example, calling Exim
68994 with the last component of <option>argv[0]</option> set to <quote>rsmtp</quote> is exactly equivalent
68995 to calling it with the option <option>-bS</option>. There are no security implications in
68996 this.
68997 </para>
68998 </section>
68999 <section id="SECID277">
69000 <title>Use of %f formatting</title>
69001 <para>
69002 The only use made of <quote>%f</quote> by Exim is in formatting load average values. These
69003 are actually stored in integer variables as 1000 times the load average.
69004 Consequently, their range is limited and so therefore is the length of the
69005 converted output.
69006 </para>
69007 </section>
69008 <section id="SECID278">
69009 <title>Embedded Exim path</title>
69010 <para>
69011 Exim uses its own path name, which is embedded in the code, only when it needs
69012 to re-exec in order to regain root privilege. Therefore, it is not root when it
69013 does so. If some bug allowed the path to get overwritten, it would lead to an
69014 arbitrary program&#x2019;s being run as exim, not as root.
69015 </para>
69016 </section>
69017 <section id="SECTdynmoddir">
69018 <title>Dynamic module directory</title>
69019 <para>
69020 Any dynamically loadable modules must be installed into the directory
69021 defined in <literal>LOOKUP_MODULE_DIR</literal> in <filename>Local/Makefile</filename> for Exim to permit
69022 loading it.
69023 </para>
69024 </section>
69025 <section id="SECID279">
69026 <title>Use of sprintf()</title>
69027 <para>
69028 <indexterm role="concept">
69029 <primary><function>sprintf()</function></primary>
69030 </indexterm>
69031 A large number of occurrences of <quote>sprintf</quote> in the code are actually calls to
69032 <emphasis>string_sprintf()</emphasis>, a function that returns the result in malloc&#x2019;d store.
69033 The intermediate formatting is done into a large fixed buffer by a function
69034 that runs through the format string itself, and checks the length of each
69035 conversion before performing it, thus preventing buffer overruns.
69036 </para>
69037 <para>
69038 The remaining uses of <function>sprintf()</function> happen in controlled circumstances where
69039 the output buffer is known to be sufficiently long to contain the converted
69040 string.
69041 </para>
69042 </section>
69043 <section id="SECID280">
69044 <title>Use of debug_printf() and log_write()</title>
69045 <para>
69046 Arbitrary strings are passed to both these functions, but they do their
69047 formatting by calling the function <emphasis>string_vformat()</emphasis>, which runs through
69048 the format string itself, and checks the length of each conversion.
69049 </para>
69050 </section>
69051 <section id="SECID281">
69052 <title>Use of strcat() and strcpy()</title>
69053 <para>
69054 These are used only in cases where the output buffer is known to be large
69055 enough to hold the result.
69056 <indexterm role="concept" startref="IIDsecurcon" class="endofrange"/>
69057 </para>
69058 </section>
69059 </chapter>
69060
69061 <chapter id="CHAPspool">
69062 <title>Format of spool files</title>
69063 <para>
69064 <indexterm role="concept" id="IIDforspo1" class="startofrange">
69065 <primary>format</primary>
69066 <secondary>spool files</secondary>
69067 </indexterm>
69068 <indexterm role="concept" id="IIDforspo2" class="startofrange">
69069 <primary>spool directory</primary>
69070 <secondary>format of files</secondary>
69071 </indexterm>
69072 <indexterm role="concept" id="IIDforspo3" class="startofrange">
69073 <primary>spool files</primary>
69074 <secondary>format of</secondary>
69075 </indexterm>
69076 <indexterm role="concept">
69077 <primary>spool files</primary>
69078 <secondary>editing</secondary>
69079 </indexterm>
69080 A message on Exim&#x2019;s queue consists of two files, whose names are the message id
69081 followed by -D and -H, respectively. The data portion of the message is kept in
69082 the -D file on its own. The message&#x2019;s envelope, status, and headers are all
69083 kept in the -H file, whose format is described in this chapter. Each of these
69084 two files contains the final component of its own name as its first line. This
69085 is insurance against disk crashes where the directory is lost but the files
69086 themselves are recoverable.
69087 </para>
69088 <para>
69089 Some people are tempted into editing -D files in order to modify messages. You
69090 need to be extremely careful if you do this; it is not recommended and you are
69091 on your own if you do it. Here are some of the pitfalls:
69092 </para>
69093 <itemizedlist>
69094 <listitem>
69095 <para>
69096 You must ensure that Exim does not try to deliver the message while you are
69097 fiddling with it. The safest way is to take out a write lock on the -D file,
69098 which is what Exim itself does, using <function>fcntl()</function>. If you update the file in
69099 place, the lock will be retained. If you write a new file and rename it, the
69100 lock will be lost at the instant of rename.
69101 </para>
69102 </listitem>
69103 <listitem>
69104 <para>
69105 <indexterm role="variable">
69106 <primary><varname>$body_linecount</varname></primary>
69107 </indexterm>
69108 If you change the number of lines in the file, the value of
69109 <varname>$body_linecount</varname>, which is stored in the -H file, will be incorrect and can
69110 cause incomplete transmission of messages or undeliverable messages.
69111 </para>
69112 </listitem>
69113 <listitem>
69114 <para>
69115 If the message is in MIME format, you must take care not to break it.
69116 </para>
69117 </listitem>
69118 <listitem>
69119 <para>
69120 If the message is cryptographically signed, any change will invalidate the
69121 signature.
69122 </para>
69123 </listitem>
69124 </itemizedlist>
69125 <para>
69126 All in all, modifying -D files is fraught with danger.
69127 </para>
69128 <para>
69129 Files whose names end with -J may also be seen in the <filename>input</filename> directory (or
69130 its subdirectories when <option>split_spool_directory</option> is set). These are journal
69131 files, used to record addresses to which the message has been delivered during
69132 the course of a delivery attempt. If there are still undelivered recipients at
69133 the end, the -H file is updated, and the -J file is deleted. If, however, there
69134 is some kind of crash (for example, a power outage) before this happens, the -J
69135 file remains in existence. When Exim next processes the message, it notices the
69136 -J file and uses it to update the -H file before starting the next delivery
69137 attempt.
69138 </para>
69139 <para revisionflag="changed">
69140 Files whose names end with -K or .eml may also be seen in the spool.
69141 These are temporaries used for DKIM or malware processing, when that is used.
69142 They should be tidied up by normal operations; any old ones are probably
69143 relics of crashes and can be removed.
69144 </para>
69145 <section id="SECID282">
69146 <title>Format of the -H file</title>
69147 <para>
69148 <indexterm role="concept">
69149 <primary>uid (user id)</primary>
69150 <secondary>in spool file</secondary>
69151 </indexterm>
69152 <indexterm role="concept">
69153 <primary>gid (group id)</primary>
69154 <secondary>in spool file</secondary>
69155 </indexterm>
69156 The second line of the -H file contains the login name for the uid of the
69157 process that called Exim to read the message, followed by the numerical uid and
69158 gid. For a locally generated message, this is normally the user who sent the
69159 message. For a message received over TCP/IP via the daemon, it is
69160 normally the Exim user.
69161 </para>
69162 <para>
69163 The third line of the file contains the address of the message&#x2019;s sender as
69164 transmitted in the envelope, contained in angle brackets. The sender address is
69165 empty for bounce messages. For incoming SMTP mail, the sender address is given
69166 in the MAIL command. For locally generated mail, the sender address is
69167 created by Exim from the login name of the current user and the configured
69168 <option>qualify_domain</option>. However, this can be overridden by the <option>-f</option> option or a
69169 leading <quote>From&nbsp;</quote> line if the caller is trusted, or if the supplied address is
69170 <quote>&lt;&gt;</quote> or an address that matches <option>untrusted_set_senders</option>.
69171 </para>
69172 <para>
69173 The fourth line contains two numbers. The first is the time that the message
69174 was received, in the conventional Unix form &ndash; the number of seconds since the
69175 start of the epoch. The second number is a count of the number of messages
69176 warning of delayed delivery that have been sent to the sender.
69177 </para>
69178 <para>
69179 There follow a number of lines starting with a hyphen. These can appear in any
69180 order, and are omitted when not relevant:
69181 </para>
69182 <variablelist>
69183 <varlistentry>
69184 <term><option>-acl</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
69185 <listitem>
69186 <para>
69187 This item is obsolete, and is not generated from Exim release 4.61 onwards;
69188 <option>-aclc</option> and <option>-aclm</option> are used instead. However, <option>-acl</option> is still
69189 recognized, to provide backward compatibility. In the old format, a line of
69190 this form is present for every ACL variable that is not empty. The number
69191 identifies the variable; the <option>acl_c</option><emphasis role="bold">x</emphasis> variables are numbered 0&ndash;9 and
69192 the <option>acl_m</option><emphasis role="bold">x</emphasis> variables are numbered 10&ndash;19. The length is the length of
69193 the data string for the variable. The string itself starts at the beginning of
69194 the next line, and is followed by a newline character. It may contain internal
69195 newlines.
69196 </para>
69197 </listitem></varlistentry>
69198 <varlistentry>
69199 <term><option>-aclc</option>&nbsp;&lt;<emphasis>rest-of-name</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
69200 <listitem>
69201 <para>
69202 A line of this form is present for every ACL connection variable that is
69203 defined. Note that there is a space between <option>-aclc</option> and the rest of the name.
69204 The length is the length of the data string for the variable. The string itself
69205 starts at the beginning of the next line, and is followed by a newline
69206 character. It may contain internal newlines.
69207 </para>
69208 </listitem></varlistentry>
69209 <varlistentry>
69210 <term><option>-aclm</option>&nbsp;&lt;<emphasis>rest-of-name</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
69211 <listitem>
69212 <para>
69213 A line of this form is present for every ACL message variable that is defined.
69214 Note that there is a space between <option>-aclm</option> and the rest of the name. The
69215 length is the length of the data string for the variable. The string itself
69216 starts at the beginning of the next line, and is followed by a newline
69217 character. It may contain internal newlines.
69218 </para>
69219 </listitem></varlistentry>
69220 <varlistentry>
69221 <term><option>-active_hostname</option>&nbsp;&lt;<emphasis>hostname</emphasis>&gt;</term>
69222 <listitem>
69223 <para>
69224 This is present if, when the message was received over SMTP, the value of
69225 <varname>$smtp_active_hostname</varname> was different to the value of <varname>$primary_hostname</varname>.
69226 </para>
69227 </listitem></varlistentry>
69228 <varlistentry>
69229 <term><option>-allow_unqualified_recipient</option></term>
69230 <listitem>
69231 <para>
69232 This is present if unqualified recipient addresses are permitted in header
69233 lines (to stop such addresses from being qualified if rewriting occurs at
69234 transport time). Local messages that were input using <option>-bnq</option> and remote
69235 messages from hosts that match <option>recipient_unqualified_hosts</option> set this flag.
69236 </para>
69237 </listitem></varlistentry>
69238 <varlistentry>
69239 <term><option>-allow_unqualified_sender</option></term>
69240 <listitem>
69241 <para>
69242 This is present if unqualified sender addresses are permitted in header lines
69243 (to stop such addresses from being qualified if rewriting occurs at transport
69244 time). Local messages that were input using <option>-bnq</option> and remote messages from
69245 hosts that match <option>sender_unqualified_hosts</option> set this flag.
69246 </para>
69247 </listitem></varlistentry>
69248 <varlistentry>
69249 <term><option>-auth_id</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
69250 <listitem>
69251 <para>
69252 The id information for a message received on an authenticated SMTP connection
69253 &ndash; the value of the <varname>$authenticated_id</varname> variable.
69254 </para>
69255 </listitem></varlistentry>
69256 <varlistentry>
69257 <term><option>-auth_sender</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
69258 <listitem>
69259 <para>
69260 The address of an authenticated sender &ndash; the value of the
69261 <varname>$authenticated_sender</varname> variable.
69262 </para>
69263 </listitem></varlistentry>
69264 <varlistentry>
69265 <term><option>-body_linecount</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
69266 <listitem>
69267 <para>
69268 This records the number of lines in the body of the message, and is
69269 present unless <option>-spool_file_wireformat</option> is.
69270 </para>
69271 </listitem></varlistentry>
69272 <varlistentry>
69273 <term><option>-body_zerocount</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
69274 <listitem>
69275 <para>
69276 This records the number of binary zero bytes in the body of the message, and is
69277 present if the number is greater than zero.
69278 </para>
69279 </listitem></varlistentry>
69280 <varlistentry>
69281 <term><option>-deliver_firsttime</option></term>
69282 <listitem>
69283 <para>
69284 This is written when a new message is first added to the spool. When the spool
69285 file is updated after a deferral, it is omitted.
69286 </para>
69287 </listitem></varlistentry>
69288 <varlistentry>
69289 <term><option>-frozen</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
69290 <listitem>
69291 <para>
69292 <indexterm role="concept">
69293 <primary>frozen messages</primary>
69294 <secondary>spool data</secondary>
69295 </indexterm>
69296 The message is frozen, and the freezing happened at &lt;<emphasis>time</emphasis>&gt;.
69297 </para>
69298 </listitem></varlistentry>
69299 <varlistentry>
69300 <term><option>-helo_name</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
69301 <listitem>
69302 <para>
69303 This records the host name as specified by a remote host in a HELO or EHLO
69304 command.
69305 </para>
69306 </listitem></varlistentry>
69307 <varlistentry>
69308 <term><option>-host_address</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;.&lt;<emphasis>port</emphasis>&gt;</term>
69309 <listitem>
69310 <para>
69311 This records the IP address of the host from which the message was received and
69312 the remote port number that was used. It is omitted for locally generated
69313 messages.
69314 </para>
69315 </listitem></varlistentry>
69316 <varlistentry>
69317 <term><option>-host_auth</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
69318 <listitem>
69319 <para>
69320 If the message was received on an authenticated SMTP connection, this records
69321 the name of the authenticator &ndash; the value of the
69322 <varname>$sender_host_authenticated</varname> variable.
69323 </para>
69324 </listitem></varlistentry>
69325 <varlistentry>
69326 <term><option>-host_lookup_failed</option></term>
69327 <listitem>
69328 <para>
69329 This is present if an attempt to look up the sending host&#x2019;s name from its IP
69330 address failed. It corresponds to the <varname>$host_lookup_failed</varname> variable.
69331 </para>
69332 </listitem></varlistentry>
69333 <varlistentry>
69334 <term><option>-host_name</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
69335 <listitem>
69336 <para>
69337 <indexterm role="concept">
69338 <primary>reverse DNS lookup</primary>
69339 </indexterm>
69340 <indexterm role="concept">
69341 <primary>DNS</primary>
69342 <secondary>reverse lookup</secondary>
69343 </indexterm>
69344 This records the name of the remote host from which the message was received,
69345 if the host name was looked up from the IP address when the message was being
69346 received. It is not present if no reverse lookup was done.
69347 </para>
69348 </listitem></varlistentry>
69349 <varlistentry>
69350 <term><option>-ident</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
69351 <listitem>
69352 <para>
69353 For locally submitted messages, this records the login of the originating user,
69354 unless it was a trusted user and the <option>-oMt</option> option was used to specify an
69355 ident value. For messages received over TCP/IP, this records the ident string
69356 supplied by the remote host, if any.
69357 </para>
69358 </listitem></varlistentry>
69359 <varlistentry>
69360 <term><option>-interface_address</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;.&lt;<emphasis>port</emphasis>&gt;</term>
69361 <listitem>
69362 <para>
69363 This records the IP address of the local interface and the port number through
69364 which a message was received from a remote host. It is omitted for locally
69365 generated messages.
69366 </para>
69367 </listitem></varlistentry>
69368 <varlistentry>
69369 <term><option>-local</option></term>
69370 <listitem>
69371 <para>
69372 The message is from a local sender.
69373 </para>
69374 </listitem></varlistentry>
69375 <varlistentry>
69376 <term><option>-localerror</option></term>
69377 <listitem>
69378 <para>
69379 The message is a locally-generated bounce message.
69380 </para>
69381 </listitem></varlistentry>
69382 <varlistentry>
69383 <term><option>-local_scan</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
69384 <listitem>
69385 <para>
69386 This records the data string that was returned by the <function>local_scan()</function> function
69387 when the message was received &ndash; the value of the <varname>$local_scan_data</varname>
69388 variable. It is omitted if no data was returned.
69389 </para>
69390 </listitem></varlistentry>
69391 <varlistentry>
69392 <term><option>-manual_thaw</option></term>
69393 <listitem>
69394 <para>
69395 The message was frozen but has been thawed manually, that is, by an explicit
69396 Exim command rather than via the auto-thaw process.
69397 </para>
69398 </listitem></varlistentry>
69399 <varlistentry>
69400 <term><option>-N</option></term>
69401 <listitem>
69402 <para>
69403 A testing delivery process was started using the <option>-N</option> option to suppress any
69404 actual deliveries, but delivery was deferred. At any further delivery attempts,
69405 <option>-N</option> is assumed.
69406 </para>
69407 </listitem></varlistentry>
69408 <varlistentry>
69409 <term><option>-received_protocol</option></term>
69410 <listitem>
69411 <para>
69412 This records the value of the <varname>$received_protocol</varname> variable, which contains
69413 the name of the protocol by which the message was received.
69414 </para>
69415 </listitem></varlistentry>
69416 <varlistentry>
69417 <term><option>-sender_set_untrusted</option></term>
69418 <listitem>
69419 <para>
69420 The envelope sender of this message was set by an untrusted local caller (used
69421 to ensure that the caller is displayed in queue listings).
69422 </para>
69423 </listitem></varlistentry>
69424 <varlistentry>
69425 <term><option>-spam_score_int</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
69426 <listitem>
69427 <para>
69428 If a message was scanned by SpamAssassin, this is present. It records the value
69429 of <varname>$spam_score_int</varname>.
69430 </para>
69431 </listitem></varlistentry>
69432 <varlistentry revisionflag="changed">
69433 <term><option>-spool_file_wireformat</option></term>
69434 <listitem>
69435 <para revisionflag="changed">
69436 The -D file for this message is in wire-format (for ESMTP CHUNKING)
69437 rather than Unix-format.
69438 The line-ending is CRLF rather than newline.
69439 There is still, however, no leading-dot-stuffing.
69440 </para>
69441 </listitem></varlistentry>
69442 <varlistentry>
69443 <term><option>-tls_certificate_verified</option></term>
69444 <listitem>
69445 <para>
69446 A TLS certificate was received from the client that sent this message, and the
69447 certificate was verified by the server.
69448 </para>
69449 </listitem></varlistentry>
69450 <varlistentry>
69451 <term><option>-tls_cipher</option>&nbsp;&lt;<emphasis>cipher name</emphasis>&gt;</term>
69452 <listitem>
69453 <para>
69454 When the message was received over an encrypted connection, this records the
69455 name of the cipher suite that was used.
69456 </para>
69457 </listitem></varlistentry>
69458 <varlistentry>
69459 <term><option>-tls_peerdn</option>&nbsp;&lt;<emphasis>peer DN</emphasis>&gt;</term>
69460 <listitem>
69461 <para>
69462 When the message was received over an encrypted connection, and a certificate
69463 was received from the client, this records the Distinguished Name from that
69464 certificate.
69465 </para>
69466 </listitem></varlistentry>
69467 </variablelist>
69468 <para>
69469 Following the options there is a list of those addresses to which the message
69470 is not to be delivered. This set of addresses is initialized from the command
69471 line when the <option>-t</option> option is used and <option>extract_addresses_remove_arguments</option>
69472 is set; otherwise it starts out empty. Whenever a successful delivery is made,
69473 the address is added to this set. The addresses are kept internally as a
69474 balanced binary tree, and it is a representation of that tree which is written
69475 to the spool file. If an address is expanded via an alias or forward file, the
69476 original address is added to the tree when deliveries to all its child
69477 addresses are complete.
69478 </para>
69479 <para>
69480 If the tree is empty, there is a single line in the spool file containing just
69481 the text <quote>XX</quote>. Otherwise, each line consists of two letters, which are either
69482 Y or N, followed by an address. The address is the value for the node of the
69483 tree, and the letters indicate whether the node has a left branch and/or a
69484 right branch attached to it, respectively. If branches exist, they immediately
69485 follow. Here is an example of a three-node tree:
69486 </para>
69487 <literallayout class="monospaced">
69488 YY darcy@austen.fict.example
69489 NN alice@wonderland.fict.example
69490 NN editor@thesaurus.ref.example
69491 </literallayout>
69492 <para>
69493 After the non-recipients tree, there is a list of the message&#x2019;s recipients.
69494 This is a simple list, preceded by a count. It includes all the original
69495 recipients of the message, including those to whom the message has already been
69496 delivered. In the simplest case, the list contains one address per line. For
69497 example:
69498 </para>
69499 <literallayout class="monospaced">
69500 4
69501 editor@thesaurus.ref.example
69502 darcy@austen.fict.example
69503 rdo@foundation
69504 alice@wonderland.fict.example
69505 </literallayout>
69506 <para>
69507 However, when a child address has been added to the top-level addresses as a
69508 result of the use of the <option>one_time</option> option on a <command>redirect</command> router, each
69509 line is of the following form:
69510 </para>
69511 <literallayout>
69512 &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;
69513 </literallayout>
69514 <para>
69515 The 01 flag bit indicates the presence of the three other fields that follow
69516 the top-level address. Other bits may be used in future to support additional
69517 fields. The &lt;<emphasis>parent number</emphasis>&gt; is the offset in the recipients list of the
69518 original parent of the <quote>one time</quote> address. The first two fields are the
69519 envelope sender that is associated with this address and its length. If the
69520 length is zero, there is no special envelope sender (there are then two space
69521 characters in the line). A non-empty field can arise from a <command>redirect</command> router
69522 that has an <option>errors_to</option> setting.
69523 </para>
69524 <para>
69525 A blank line separates the envelope and status information from the headers
69526 which follow. A header may occupy several lines of the file, and to save effort
69527 when reading it in, each header is preceded by a number and an identifying
69528 character. The number is the number of characters in the header, including any
69529 embedded newlines and the terminating newline. The character is one of the
69530 following:
69531 </para>
69532 <informaltable frame="none">
69533 <tgroup cols="2" colsep="0" rowsep="0">
69534 <colspec colwidth="50pt" align="left"/>
69535 <colspec colwidth="254pt" align="left"/>
69536 <tbody>
69537 <row>
69538 <entry>&lt;<emphasis>blank</emphasis>&gt;</entry>
69539 <entry>header in which Exim has no special interest</entry>
69540 </row>
69541 <row>
69542 <entry><literal>B</literal></entry>
69543 <entry><emphasis>Bcc:</emphasis> header</entry>
69544 </row>
69545 <row>
69546 <entry><literal>C</literal></entry>
69547 <entry><emphasis>Cc:</emphasis> header</entry>
69548 </row>
69549 <row>
69550 <entry><literal>F</literal></entry>
69551 <entry><emphasis>From:</emphasis> header</entry>
69552 </row>
69553 <row>
69554 <entry><literal>I</literal></entry>
69555 <entry><emphasis>Message-id:</emphasis> header</entry>
69556 </row>
69557 <row>
69558 <entry><literal>P</literal></entry>
69559 <entry><emphasis>Received:</emphasis> header &ndash; P for <quote>postmark</quote></entry>
69560 </row>
69561 <row>
69562 <entry><literal>R</literal></entry>
69563 <entry><emphasis>Reply-To:</emphasis> header</entry>
69564 </row>
69565 <row>
69566 <entry><literal>S</literal></entry>
69567 <entry><emphasis>Sender:</emphasis> header</entry>
69568 </row>
69569 <row>
69570 <entry><literal>T</literal></entry>
69571 <entry><emphasis>To:</emphasis> header</entry>
69572 </row>
69573 <row>
69574 <entry><literal>*</literal></entry>
69575 <entry>replaced or deleted header</entry>
69576 </row>
69577 </tbody>
69578 </tgroup>
69579 </informaltable>
69580 <para>
69581 Deleted or replaced (rewritten) headers remain in the spool file for debugging
69582 purposes. They are not transmitted when the message is delivered. Here is a
69583 typical set of headers:
69584 </para>
69585 <literallayout class="monospaced">
69586 111P Received: by hobbit.fict.example with local (Exim 4.00)
69587 id 14y9EI-00026G-00; Fri, 11 May 2001 10:28:59 +0100
69588 049  Message-Id: &lt;E14y9EI-00026G-00@hobbit.fict.example&gt;
69589 038* X-rewrote-sender: bb@hobbit.fict.example
69590 042* From: Bilbo Baggins &lt;bb@hobbit.fict.example&gt;
69591 049F From: Bilbo Baggins &lt;B.Baggins@hobbit.fict.example&gt;
69592 099* To: alice@wonderland.fict.example, rdo@foundation,
69593 darcy@austen.fict.example, editor@thesaurus.ref.example
69594 104T To: alice@wonderland.fict.example, rdo@foundation.example,
69595 darcy@austen.fict.example, editor@thesaurus.ref.example
69596 038  Date: Fri, 11 May 2001 10:28:59 +0100
69597 </literallayout>
69598 <para>
69599 The asterisked headers indicate that the envelope sender, <emphasis>From:</emphasis> header, and
69600 <emphasis>To:</emphasis> header have been rewritten, the last one because routing expanded the
69601 unqualified domain <emphasis>foundation</emphasis>.
69602 <indexterm role="concept" startref="IIDforspo1" class="endofrange"/>
69603 <indexterm role="concept" startref="IIDforspo2" class="endofrange"/>
69604 <indexterm role="concept" startref="IIDforspo3" class="endofrange"/>
69605 </para>
69606 </section>
69607 <section id="SECID282a" revisionflag="changed">
69608 <title>Format of the -D file</title>
69609 <para revisionflag="changed">
69610 The data file is traditionally in Unix-standard format: lines are ended with
69611 an ASCII newline character.
69612 However, when the <option>spool_wireformat</option> main option is used some -D files
69613 can have an alternate format.
69614 This is flagged by a <option>-spool_file_wireformat</option> line in the corresponding -H file.
69615 The -D file lines (not including the first name-component line) are
69616 suitable for direct copying to the wire when transmitting using the
69617 ESMTP CHUNKING option, meaning lower processing overhead.
69618 Lines are terminated with an ASCII CRLF pair.
69619 There is no dot-stuffing (and no dot-termination).
69620 </para>
69621 </section>
69622 </chapter>
69623
69624 <chapter id="CHAPdkim">
69625 <title>Support for DKIM (DomainKeys Identified Mail)</title>
69626 <titleabbrev>DKIM Support</titleabbrev>
69627 <para>
69628 <indexterm role="concept">
69629 <primary>DKIM</primary>
69630 </indexterm>
69631 </para>
69632 <para>
69633 DKIM is a mechanism by which messages sent by some entity can be provably
69634 linked to a domain which that entity controls.  It permits reputation to
69635 be tracked on a per-domain basis, rather than merely upon source IP address.
69636 DKIM is documented in RFC 4871.
69637 </para>
69638 <para>
69639 DKIM support is compiled into Exim by default if TLS support is present.
69640 It can be disabled by setting DISABLE_DKIM=yes in <filename>Local/Makefile</filename>.
69641 </para>
69642 <para>
69643 Exim&#x2019;s DKIM implementation allows for
69644 </para>
69645 <orderedlist numeration="arabic">
69646 <listitem>
69647 <para>
69648 Signing outgoing messages: This function is implemented in the SMTP transport.
69649 It can co-exist with all other Exim features
69650 (including transport filters)
69651 except cutthrough delivery.
69652 </para>
69653 </listitem>
69654 <listitem>
69655 <para>
69656 Verifying signatures in incoming messages: This is implemented by an additional
69657 ACL (acl_smtp_dkim), which can be called several times per message, with
69658 different signature contexts.
69659 </para>
69660 </listitem>
69661 </orderedlist>
69662 <para>
69663 In typical Exim style, the verification implementation does not include any
69664 default "policy". Instead it enables you to build your own policy using
69665 Exim&#x2019;s standard controls.
69666 </para>
69667 <para revisionflag="changed">
69668 Please note that verification of DKIM signatures in incoming mail is turned
69669 on by default for logging (in the &lt;= line) purposes.
69670 </para>
69671 <para revisionflag="changed">
69672 Additional log detail can be enabled using the <option>dkim_verbose</option> log_selector.
69673 When set, for each signature in incoming email,
69674 exim will log a line displaying the most important signature details, and the
69675 signature status. Here is an example (with line-breaks added for clarity):
69676 </para>
69677 <literallayout class="monospaced" revisionflag="changed">
69678 2009-09-09 10:22:28 1MlIRf-0003LU-U3 DKIM:
69679     d=facebookmail.com s=q1-2009b
69680     c=relaxed/relaxed a=rsa-sha1
69681     i=@facebookmail.com t=1252484542 [verification succeeded]
69682 </literallayout>
69683 <para>
69684 You might want to turn off DKIM verification processing entirely for internal
69685 or relay mail sources. To do that, set the <option>dkim_disable_verify</option> ACL
69686 control modifier. This should typically be done in the RCPT ACL, at points
69687 where you accept mail from relay sources (internal hosts or authenticated
69688 senders).
69689 </para>
69690 <section id="SECDKIMSIGN">
69691 <title>Signing outgoing messages</title>
69692 <para>
69693 <indexterm role="concept">
69694 <primary>DKIM</primary>
69695 <secondary>signing</secondary>
69696 </indexterm>
69697 </para>
69698 <para revisionflag="changed">
69699 For signing to be usable you must have published a DKIM record in DNS.
69700 Note that RFC 8301 says:
69701 </para>
69702 <literallayout class="monospaced" revisionflag="changed">
69703 rsa-sha1 MUST NOT be used for signing or verifying.
69704
69705 Signers MUST use RSA keys of at least 1024 bits for all keys.
69706 Signers SHOULD use RSA keys of at least 2048 bits.
69707 </literallayout>
69708 <para>
69709 Signing is enabled by setting private options on the SMTP transport.
69710 These options take (expandable) strings as arguments.
69711 </para>
69712 <para>
69713 <indexterm role="option">
69714 <primary><option>unset</option></primary>
69715 </indexterm>
69716 </para>
69717 <informaltable frame="all">
69718 <tgroup cols="4" colsep="0" rowsep="0">
69719 <colspec colwidth="8*" align="left"/>
69720 <colspec colwidth="6*" align="center"/>
69721 <colspec colwidth="6*" align="center"/>
69722 <colspec colwidth="6*" align="right"/>
69723 <tbody>
69724 <row>
69725 <entry><option>dkim_domain</option></entry>
69726 <entry>Use: <emphasis>smtp</emphasis></entry>
69727 <entry>Type: <emphasis>string</emphasis></entry>
69728 <entry>Default: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
69729 </row>
69730 </tbody>
69731 </tgroup>
69732 </informaltable>
69733 <para>
69734 The domain(s) you want to sign with.
69735 </para>
69736 <para revisionflag="changed">
69737 After expansion, this can be a list.
69738 Each element in turn is put into the <option>$dkim_domain</option> expansion variable
69739 while expanding the remaining signing options.
69740 </para>
69741 <para>
69742 If it is empty after expansion, DKIM signing is not done,
69743 and no error will result even if <option>dkim_strict</option> is set.
69744 </para>
69745 <para>
69746 <indexterm role="option">
69747 <primary><option>unset</option></primary>
69748 </indexterm>
69749 </para>
69750 <informaltable frame="all">
69751 <tgroup cols="4" colsep="0" rowsep="0">
69752 <colspec colwidth="8*" align="left"/>
69753 <colspec colwidth="6*" align="center"/>
69754 <colspec colwidth="6*" align="center"/>
69755 <colspec colwidth="6*" align="right"/>
69756 <tbody>
69757 <row>
69758 <entry><option>dkim_selector</option></entry>
69759 <entry>Use: <emphasis>smtp</emphasis></entry>
69760 <entry>Type: <emphasis>string</emphasis></entry>
69761 <entry>Default: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
69762 </row>
69763 </tbody>
69764 </tgroup>
69765 </informaltable>
69766 <para>
69767 This sets the key selector string.
69768 </para>
69769 <para revisionflag="changed">
69770 After expansion, which can use <varname>$dkim_domain</varname>, this can be a list.
69771 Each element in turn is put in the expansion
69772 variable <option>$dkim_selector</option> which may be used in the <option>dkim_private_key</option>
69773 option along with <option>$dkim_domain</option>.
69774 </para>
69775 <para>
69776 If the option is empty after expansion, DKIM signing is not done for this domain,
69777 and no error will result even if <option>dkim_strict</option> is set.
69778 </para>
69779 <para>
69780 <indexterm role="option">
69781 <primary><option>dkim_private_key</option></primary>
69782 </indexterm>
69783 </para>
69784 <informaltable frame="all">
69785 <tgroup cols="4" colsep="0" rowsep="0">
69786 <colspec colwidth="8*" align="left"/>
69787 <colspec colwidth="6*" align="center"/>
69788 <colspec colwidth="6*" align="center"/>
69789 <colspec colwidth="6*" align="right"/>
69790 <tbody>
69791 <row>
69792 <entry><option>dkim_private_key</option></entry>
69793 <entry>Use: <emphasis>smtp</emphasis></entry>
69794 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
69795 <entry>Default: <emphasis>unset</emphasis></entry>
69796 </row>
69797 </tbody>
69798 </tgroup>
69799 </informaltable>
69800 <para>
69801 This sets the private key to use.
69802 You can use the <option>$dkim_domain</option> and
69803 <option>$dkim_selector</option> expansion variables to determine the private key to use.
69804 The result can either
69805 </para>
69806 <itemizedlist>
69807 <listitem>
69808 <para>
69809 be a valid RSA private key in ASCII armor, including line breaks.
69810 </para>
69811 </listitem>
69812 <listitem>
69813 <para>
69814 start with a slash, in which case it is treated as a file that contains
69815 the private key.
69816 </para>
69817 </listitem>
69818 <listitem>
69819 <para>
69820 be "0", "false" or the empty string, in which case the message will not
69821 be signed. This case will not result in an error, even if <option>dkim_strict</option>
69822 is set.
69823 </para>
69824 </listitem>
69825 </itemizedlist>
69826 <para revisionflag="changed">
69827 Note that RFC 8301 says:
69828 </para>
69829 <literallayout class="monospaced" revisionflag="changed">
69830 Signers MUST use RSA keys of at least 1024 bits for all keys.
69831 Signers SHOULD use RSA keys of at least 2048 bits.
69832 </literallayout>
69833 <para>
69834 <indexterm role="option">
69835 <primary><option>dkim_hash</option></primary>
69836 </indexterm>
69837 </para>
69838 <informaltable frame="all">
69839 <tgroup cols="4" colsep="0" rowsep="0">
69840 <colspec colwidth="8*" align="left"/>
69841 <colspec colwidth="6*" align="center"/>
69842 <colspec colwidth="6*" align="center"/>
69843 <colspec colwidth="6*" align="right"/>
69844 <tbody>
69845 <row>
69846 <entry><option>dkim_hash</option></entry>
69847 <entry>Use: <emphasis>smtp</emphasis></entry>
69848 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
69849 <entry>Default: <emphasis>sha256</emphasis></entry>
69850 </row>
69851 </tbody>
69852 </tgroup>
69853 </informaltable>
69854 <para>
69855 Can be set alternatively to <quote>sha1</quote> to use an alternate hash
69856 method.
69857 </para>
69858 <para revisionflag="changed">
69859 Note that RFC 8301 says:
69860 </para>
69861 <literallayout class="monospaced" revisionflag="changed">
69862 rsa-sha1 MUST NOT be used for signing or verifying.
69863 </literallayout>
69864 <para>
69865 <indexterm role="option">
69866 <primary><option>dkim_identity</option></primary>
69867 </indexterm>
69868 </para>
69869 <informaltable frame="all">
69870 <tgroup cols="4" colsep="0" rowsep="0">
69871 <colspec colwidth="8*" align="left"/>
69872 <colspec colwidth="6*" align="center"/>
69873 <colspec colwidth="6*" align="center"/>
69874 <colspec colwidth="6*" align="right"/>
69875 <tbody>
69876 <row>
69877 <entry><option>dkim_identity</option></entry>
69878 <entry>Use: <emphasis>smtp</emphasis></entry>
69879 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
69880 <entry>Default: <emphasis>unset</emphasis></entry>
69881 </row>
69882 </tbody>
69883 </tgroup>
69884 </informaltable>
69885 <para>
69886 If set after expansion, the value is used to set an "i=" tag in
69887 the signing header.  The DKIM standards restrict the permissible
69888 syntax of this optional tag to a mail address, with possibly-empty
69889 local part, an @, and a domain identical to or subdomain of the "d="
69890 tag value.  Note that Exim does not check the value.
69891 </para>
69892 <para>
69893 <indexterm role="option">
69894 <primary><option>dkim_canon</option></primary>
69895 </indexterm>
69896 </para>
69897 <informaltable frame="all">
69898 <tgroup cols="4" colsep="0" rowsep="0">
69899 <colspec colwidth="8*" align="left"/>
69900 <colspec colwidth="6*" align="center"/>
69901 <colspec colwidth="6*" align="center"/>
69902 <colspec colwidth="6*" align="right"/>
69903 <tbody>
69904 <row>
69905 <entry><option>dkim_canon</option></entry>
69906 <entry>Use: <emphasis>smtp</emphasis></entry>
69907 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
69908 <entry>Default: <emphasis>unset</emphasis></entry>
69909 </row>
69910 </tbody>
69911 </tgroup>
69912 </informaltable>
69913 <para>
69914 This option sets the canonicalization method used when signing a message.
69915 The DKIM RFC currently supports two methods: "simple" and "relaxed".
69916 The option defaults to "relaxed" when unset. Note: the current implementation
69917 only supports using the same canonicalization method for both headers and body.
69918 </para>
69919 <para>
69920 <indexterm role="option">
69921 <primary><option>dkim_strict</option></primary>
69922 </indexterm>
69923 </para>
69924 <informaltable frame="all">
69925 <tgroup cols="4" colsep="0" rowsep="0">
69926 <colspec colwidth="8*" align="left"/>
69927 <colspec colwidth="6*" align="center"/>
69928 <colspec colwidth="6*" align="center"/>
69929 <colspec colwidth="6*" align="right"/>
69930 <tbody>
69931 <row>
69932 <entry><option>dkim_strict</option></entry>
69933 <entry>Use: <emphasis>smtp</emphasis></entry>
69934 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
69935 <entry>Default: <emphasis>unset</emphasis></entry>
69936 </row>
69937 </tbody>
69938 </tgroup>
69939 </informaltable>
69940 <para>
69941 This  option  defines  how  Exim  behaves  when  signing a message that
69942 should be signed fails for some reason.  When the expansion evaluates to
69943 either "1" or "true", Exim will defer. Otherwise Exim will send the message
69944 unsigned. You can use the <option>$dkim_domain</option> and <option>$dkim_selector</option> expansion
69945 variables here.
69946 </para>
69947 <para>
69948 <indexterm role="option">
69949 <primary><option>dkim_sign_headers</option></primary>
69950 </indexterm>
69951 </para>
69952 <informaltable frame="all">
69953 <tgroup cols="4" colsep="0" rowsep="0">
69954 <colspec colwidth="8*" align="left"/>
69955 <colspec colwidth="6*" align="center"/>
69956 <colspec colwidth="6*" align="center"/>
69957 <colspec colwidth="6*" align="right"/>
69958 <tbody>
69959 <row>
69960 <entry><option>dkim_sign_headers</option></entry>
69961 <entry>Use: <emphasis>smtp</emphasis></entry>
69962 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
69963 <entry>Default: <emphasis>see below</emphasis></entry>
69964 </row>
69965 </tbody>
69966 </tgroup>
69967 </informaltable>
69968 <para>
69969 If set, this option must expand to a colon-separated
69970 list of header names.
69971 </para>
69972 <para revisionflag="changed">
69973 Headers with these names, or the absence or such a header, will be included
69974 in the message signature.
69975 When unspecified, the header names listed in RFC4871 will be used,
69976 whether or not each header is present in the message.
69977 The default list is available for the expansion in the macro
69978 "_DKIM_SIGN_HEADERS".
69979 </para>
69980 <para revisionflag="changed">
69981 If a name is repeated, multiple headers by that name (or the absence therof)
69982 will be signed.  The textually later headers in the headers part of the
69983 message are signed first, if there are multiples.
69984 </para>
69985 <para revisionflag="changed">
69986 A name can be prefixed with either an &#x2019;=&#x2019; or a &#x2019;+&#x2019; character.
69987 If an &#x2019;=&#x2019; prefix is used, all headers that are present with this name
69988 will be signed.
69989 If a &#x2019;+&#x2019; prefix if used, all headers that are present with this name
69990 will be signed, and one signtature added for a missing header with the
69991 name will be appended.
69992 </para>
69993 </section>
69994 <section id="SECID514">
69995 <title>Verifying DKIM signatures in incoming mail</title>
69996 <para>
69997 <indexterm role="concept">
69998 <primary>DKIM</primary>
69999 <secondary>verification</secondary>
70000 </indexterm>
70001 </para>
70002 <para>
70003 Verification of DKIM signatures in SMTP incoming email is implemented via the
70004 <option>acl_smtp_dkim</option> ACL. By default, this ACL is called once for each
70005 syntactically(!) correct signature in the incoming message.
70006 A missing ACL definition defaults to accept.
70007 If any ACL call does not accept, the message is not accepted.
70008 If a cutthrough delivery was in progress for the message, that is
70009 summarily dropped (having wasted the transmission effort).
70010 </para>
70011 <para>
70012 To evaluate the signature in the ACL a large number of expansion variables
70013 containing the signature status and its details are set up during the
70014 runtime of the ACL.
70015 </para>
70016 <para>
70017 Calling the ACL only for existing signatures is not sufficient to build
70018 more advanced policies. For that reason, the global option
70019 <option>dkim_verify_signers</option>, and a global expansion variable
70020 <option>$dkim_signers</option> exist.
70021 </para>
70022 <para>
70023 The global option <option>dkim_verify_signers</option> can be set to a colon-separated
70024 list of DKIM domains or identities for which the ACL <option>acl_smtp_dkim</option> is
70025 called. It is expanded when the message has been received. At this point,
70026 the expansion variable <option>$dkim_signers</option> already contains a colon-separated
70027 list of signer domains and identities for the message. When
70028 <option>dkim_verify_signers</option> is not specified in the main configuration,
70029 it defaults as:
70030 </para>
70031 <literallayout class="monospaced">
70032 dkim_verify_signers = $dkim_signers
70033 </literallayout>
70034 <para>
70035 This leads to the default behaviour of calling <option>acl_smtp_dkim</option> for each
70036 DKIM signature in the message. Current DKIM verifiers may want to explicitly
70037 call the ACL for known domains or identities. This would be achieved as follows:
70038 </para>
70039 <literallayout class="monospaced">
70040 dkim_verify_signers = paypal.com:ebay.com:$dkim_signers
70041 </literallayout>
70042 <para>
70043 This would result in <option>acl_smtp_dkim</option> always being called for "paypal.com"
70044 and "ebay.com", plus all domains and identities that have signatures in the message.
70045 You can also be more creative in constructing your policy. For example:
70046 </para>
70047 <literallayout class="monospaced">
70048 dkim_verify_signers = $sender_address_domain:$dkim_signers
70049 </literallayout>
70050 <para>
70051 If a domain or identity is listed several times in the (expanded) value of
70052 <option>dkim_verify_signers</option>, the ACL is only called once for that domain or identity.
70053 </para>
70054 <para revisionflag="changed">
70055 If multiple signatures match a domain (or identity), the ACL is called once
70056 for each matching signature.
70057 </para>
70058 <para>
70059 Inside the <option>acl_smtp_dkim</option>, the following expansion variables are
70060 available (from most to least important):
70061 </para>
70062 <variablelist>
70063 <varlistentry>
70064 <term><option>$dkim_cur_signer</option></term>
70065 <listitem>
70066 <para>
70067 The signer that is being evaluated in this ACL run. This can be a domain or
70068 an identity. This is one of the list items from the expanded main option
70069 <option>dkim_verify_signers</option> (see above).
70070 </para>
70071 </listitem></varlistentry>
70072 <varlistentry>
70073 <term><option>$dkim_verify_status</option></term>
70074 <listitem>
70075 <para>
70076 Within the DKIM ACL,
70077 a string describing the general status of the signature. One of
70078 </para>
70079 <itemizedlist>
70080 <listitem>
70081 <para>
70082 <option>none</option>: There is no signature in the message for the current domain or
70083 identity (as reflected by <option>$dkim_cur_signer</option>).
70084 </para>
70085 </listitem>
70086 <listitem>
70087 <para>
70088 <option>invalid</option>: The signature could not be verified due to a processing error.
70089 More detail is available in <option>$dkim_verify_reason</option>.
70090 </para>
70091 </listitem>
70092 <listitem>
70093 <para>
70094 <option>fail</option>: Verification of the signature failed.  More detail is
70095 available in <option>$dkim_verify_reason</option>.
70096 </para>
70097 </listitem>
70098 <listitem>
70099 <para>
70100 <option>pass</option>: The signature passed verification. It is valid.
70101 </para>
70102 </listitem>
70103 </itemizedlist>
70104 <para revisionflag="changed">
70105 This variable can be overwritten using an ACL &#x2019;set&#x2019; modifier.
70106 This might, for instance, be done to enforce a policy restriction on
70107 hash-method or key-size:
70108 </para>
70109 <literallayout class="monospaced" revisionflag="changed">
70110   warn  condition =     ${if eq {$dkim_algo}{rsa-sha1}}
70111         condition =     ${if eq {$dkim_verify_status}{pass}}
70112         logwrite =      NOTE: forcing dkim verify fail (was pass)
70113         set dkim_verify_status = fail
70114         set dkim_verify_reason = hash too weak
70115 </literallayout>
70116 <para revisionflag="changed">
70117 After all the DKIM ACL runs have completed, the value becomes a
70118 colon-separated list of the values after each run.
70119 </para>
70120 </listitem></varlistentry>
70121 <varlistentry>
70122 <term><option>$dkim_verify_reason</option></term>
70123 <listitem>
70124 <para>
70125 A string giving a little bit more detail when <option>$dkim_verify_status</option> is either
70126 "fail" or "invalid". One of
70127 </para>
70128 <itemizedlist>
70129 <listitem>
70130 <para>
70131 <option>pubkey_unavailable</option> (when <option>$dkim_verify_status</option>="invalid"): The public
70132 key for the domain could not be retrieved. This may be a temporary problem.
70133 </para>
70134 </listitem>
70135 <listitem>
70136 <para>
70137 <option>pubkey_syntax</option> (when <option>$dkim_verify_status</option>="invalid"): The public key
70138 record for the domain is syntactically invalid.
70139 </para>
70140 </listitem>
70141 <listitem>
70142 <para>
70143 <option>bodyhash_mismatch</option> (when <option>$dkim_verify_status</option>="fail"): The calculated
70144 body hash does not match the one specified in the signature header. This
70145 means that the message body was modified in transit.
70146 </para>
70147 </listitem>
70148 <listitem>
70149 <para>
70150 <option>signature_incorrect</option> (when <option>$dkim_verify_status</option>="fail"): The signature
70151 could not be verified. This may mean that headers were modified,
70152 re-written or otherwise changed in a way which is incompatible with
70153 DKIM verification. It may of course also mean that the signature is forged.
70154 </para>
70155 </listitem>
70156 </itemizedlist>
70157 <para revisionflag="changed">
70158 This variable can be overwritten, with any value, using an ACL &#x2019;set&#x2019; modifier.
70159 </para>
70160 </listitem></varlistentry>
70161 <varlistentry>
70162 <term><option>$dkim_domain</option></term>
70163 <listitem>
70164 <para>
70165 The signing domain. IMPORTANT: This variable is only populated if there is
70166 an actual signature in the message for the current domain or identity (as
70167 reflected by <option>$dkim_cur_signer</option>).
70168 </para>
70169 </listitem></varlistentry>
70170 <varlistentry>
70171 <term><option>$dkim_identity</option></term>
70172 <listitem>
70173 <para>
70174 The signing identity, if present. IMPORTANT: This variable is only populated
70175 if there is an actual signature in the message for the current domain or
70176 identity (as reflected by <option>$dkim_cur_signer</option>).
70177 </para>
70178 </listitem></varlistentry>
70179 <varlistentry>
70180 <term><option>$dkim_selector</option></term>
70181 <listitem>
70182 <para>
70183 The key record selector string.
70184 </para>
70185 </listitem></varlistentry>
70186 <varlistentry>
70187 <term><option>$dkim_algo</option></term>
70188 <listitem>
70189 <para>
70190 The algorithm used. One of &#x2019;rsa-sha1&#x2019; or &#x2019;rsa-sha256&#x2019;.
70191 </para>
70192 <para revisionflag="changed">
70193 Note that RFC 8301 says:
70194 </para>
70195 <literallayout class="monospaced" revisionflag="changed">
70196 rsa-sha1 MUST NOT be used for signing or verifying.
70197
70198 DKIM signatures identified as having been signed with historic
70199 algorithms (currently, rsa-sha1) have permanently failed evaluation
70200 </literallayout>
70201 <para revisionflag="changed">
70202 To enforce this you must have a DKIM ACL which checks this variable
70203 and overwrites the <varname>$dkim_verify_status</varname> variable as discussed above.
70204 </para>
70205 </listitem></varlistentry>
70206 <varlistentry>
70207 <term><option>$dkim_canon_body</option></term>
70208 <listitem>
70209 <para>
70210 The body canonicalization method. One of &#x2019;relaxed&#x2019; or &#x2019;simple&#x2019;.
70211 </para>
70212 </listitem></varlistentry>
70213 <varlistentry>
70214 <term><option>$dkim_canon_headers</option></term>
70215 <listitem>
70216 <para>
70217 The header canonicalization method. One of &#x2019;relaxed&#x2019; or &#x2019;simple&#x2019;.
70218 </para>
70219 </listitem></varlistentry>
70220 <varlistentry>
70221 <term><option>$dkim_copiedheaders</option></term>
70222 <listitem>
70223 <para>
70224 A transcript of headers and their values which are included in the signature
70225 (copied from the &#x2019;z=&#x2019; tag of the signature).
70226 Note that RFC6376 requires that verification fail if the From: header is
70227 not included in the signature.  Exim does not enforce this; sites wishing
70228 strict enforcement should code the check explicitly.
70229 </para>
70230 </listitem></varlistentry>
70231 <varlistentry>
70232 <term><option>$dkim_bodylength</option></term>
70233 <listitem>
70234 <para>
70235 The number of signed body bytes. If zero ("0"), the body is unsigned. If no
70236 limit was set by the signer, "9999999999999" is returned. This makes sure
70237 that this variable always expands to an integer value.
70238 </para>
70239 </listitem></varlistentry>
70240 <varlistentry>
70241 <term><option>$dkim_created</option></term>
70242 <listitem>
70243 <para>
70244 UNIX timestamp reflecting the date and time when the signature was created.
70245 When this was not specified by the signer, "0" is returned.
70246 </para>
70247 </listitem></varlistentry>
70248 <varlistentry>
70249 <term><option>$dkim_expires</option></term>
70250 <listitem>
70251 <para>
70252 UNIX timestamp reflecting the date and time when the signer wants the
70253 signature to be treated as "expired". When this was not specified by the
70254 signer, "9999999999999" is returned. This makes it possible to do useful
70255 integer size comparisons against this value.
70256 </para>
70257 </listitem></varlistentry>
70258 <varlistentry>
70259 <term><option>$dkim_headernames</option></term>
70260 <listitem>
70261 <para>
70262 A colon-separated list of names of headers included in the signature.
70263 </para>
70264 </listitem></varlistentry>
70265 <varlistentry>
70266 <term><option>$dkim_key_testing</option></term>
70267 <listitem>
70268 <para>
70269 "1" if the key record has the "testing" flag set, "0" if not.
70270 </para>
70271 </listitem></varlistentry>
70272 <varlistentry>
70273 <term><option>$dkim_key_nosubdomains</option></term>
70274 <listitem>
70275 <para>
70276 "1" if the key record forbids subdomaining, "0" otherwise.
70277 </para>
70278 </listitem></varlistentry>
70279 <varlistentry>
70280 <term><option>$dkim_key_srvtype</option></term>
70281 <listitem>
70282 <para>
70283 Service type (tag s=) from the key record. Defaults to "*" if not specified
70284 in the key record.
70285 </para>
70286 </listitem></varlistentry>
70287 <varlistentry>
70288 <term><option>$dkim_key_granularity</option></term>
70289 <listitem>
70290 <para>
70291 Key granularity (tag g=) from the key record. Defaults to "*" if not specified
70292 in the key record.
70293 </para>
70294 </listitem></varlistentry>
70295 <varlistentry>
70296 <term><option>$dkim_key_notes</option></term>
70297 <listitem>
70298 <para>
70299 Notes from the key record (tag n=).
70300 </para>
70301 </listitem></varlistentry>
70302 <varlistentry>
70303 <term><option>$dkim_key_length</option></term>
70304 <listitem>
70305 <para>
70306 Number of bits in the key.
70307 </para>
70308 <para revisionflag="changed">
70309 Note that RFC 8301 says:
70310 </para>
70311 <literallayout class="monospaced" revisionflag="changed">
70312 Verifiers MUST NOT consider signatures using RSA keys of
70313 less than 1024 bits as valid signatures.
70314 </literallayout>
70315 <para revisionflag="changed">
70316 To enforce this you must have a DKIM ACL which checks this variable
70317 and overwrites the <varname>$dkim_verify_status</varname> variable as discussed above.
70318 </para>
70319 </listitem></varlistentry>
70320 </variablelist>
70321 <para>
70322 In addition, two ACL conditions are provided:
70323 </para>
70324 <variablelist>
70325 <varlistentry>
70326 <term><option>dkim_signers</option></term>
70327 <listitem>
70328 <para>
70329 ACL condition that checks a colon-separated list of domains or identities
70330 for a match against the domain or identity that the ACL is currently verifying
70331 (reflected by <option>$dkim_cur_signer</option>). This is typically used to restrict an ACL
70332 verb to a group of domains or identities. For example:
70333 </para>
70334 <literallayout class="monospaced">
70335 # Warn when Mail purportedly from GMail has no gmail signature
70336 warn log_message = GMail sender without gmail.com DKIM signature
70337      sender_domains = gmail.com
70338      dkim_signers = gmail.com
70339      dkim_status = none
70340 </literallayout>
70341 <para>
70342 Note that the above does not check for a total lack of DKIM signing;
70343 for that check for empty <varname>$h_DKIM-Signature:</varname> in the data ACL.
70344 </para>
70345 </listitem></varlistentry>
70346 <varlistentry>
70347 <term><option>dkim_status</option></term>
70348 <listitem>
70349 <para>
70350 ACL condition that checks a colon-separated list of possible DKIM verification
70351 results against the actual result of verification. This is typically used
70352 to restrict an ACL verb to a list of verification outcomes, for example:
70353 </para>
70354 <literallayout class="monospaced">
70355 deny message = Mail from Paypal with invalid/missing signature
70356      sender_domains = paypal.com:paypal.de
70357      dkim_signers = paypal.com:paypal.de
70358      dkim_status = none:invalid:fail
70359 </literallayout>
70360 <para>
70361 The possible status keywords are: &#x2019;none&#x2019;,&#x2019;invalid&#x2019;,&#x2019;fail&#x2019; and &#x2019;pass&#x2019;. Please
70362 see the documentation of the <option>$dkim_verify_status</option> expansion variable above
70363 for more information of what they mean.
70364 </para>
70365 </listitem></varlistentry>
70366 </variablelist>
70367 </section>
70368 </chapter>
70369
70370 <chapter id="CHAPproxies">
70371 <title>Proxies</title>
70372 <titleabbrev>Proxy support</titleabbrev>
70373 <para>
70374 <indexterm role="concept">
70375 <primary>proxy support</primary>
70376 </indexterm>
70377 <indexterm role="concept">
70378 <primary>proxy</primary>
70379 <secondary>access via</secondary>
70380 </indexterm>
70381 </para>
70382 <para>
70383 A proxy is an intermediate system through which communication is passed.
70384 Proxies may provide a security, availability or load-distribution function.
70385 </para>
70386 <section id="SECTproxyInbound">
70387 <title>Inbound proxies</title>
70388 <para>
70389 <indexterm role="concept">
70390 <primary>proxy</primary>
70391 <secondary>inbound</secondary>
70392 </indexterm>
70393 <indexterm role="concept">
70394 <primary>proxy</primary>
70395 <secondary>server side</secondary>
70396 </indexterm>
70397 <indexterm role="concept">
70398 <primary>proxy</primary>
70399 <secondary>Proxy protocol</secondary>
70400 </indexterm>
70401 <indexterm role="concept">
70402 <primary>Proxy protocol</primary>
70403 <secondary>proxy</secondary>
70404 </indexterm>
70405 </para>
70406 <para>
70407 Exim has support for receiving inbound SMTP connections via a proxy
70408 that uses <quote>Proxy Protocol</quote> to speak to it.
70409 To include this support, include <quote>SUPPORT_PROXY=yes</quote>
70410 in Local/Makefile.
70411 </para>
70412 <para>
70413 It was built on specifications from:
70414 (<emphasis role="bold"><ulink url="http://haproxy.1wt.eu/download/1.5/doc/proxy-protocol.txt">http://haproxy.1wt.eu/download/1.5/doc/proxy-protocol.txt</ulink></emphasis>).
70415 That URL was revised in May 2014 to version 2 spec:
70416 (<emphasis role="bold"><ulink url="http://git.1wt.eu/web?p=haproxy.git;a=commitdiff;h=afb768340c9d7e50d8e">http://git.1wt.eu/web?p=haproxy.git;a=commitdiff;h=afb768340c9d7e50d8e</ulink></emphasis>).
70417 </para>
70418 <para>
70419 The purpose of this facility is so that an application load balancer,
70420 such as HAProxy, can sit in front of several Exim servers
70421 to distribute load.
70422 Exim uses the local protocol communication with the proxy to obtain
70423 the remote SMTP system IP address and port information.
70424 There is no logging if a host passes or
70425 fails Proxy Protocol negotiation, but it can easily be determined and
70426 recorded in an ACL (example is below).
70427 </para>
70428 <para>
70429 Use of a proxy is enabled by setting the <option>hosts_proxy</option>
70430 main configuration option to a hostlist; connections from these
70431 hosts will use Proxy Protocol.
70432 Exim supports both version 1 and version 2 of the Proxy Protocol and
70433 automatically determines which version is in use.
70434 </para>
70435 <para>
70436 The Proxy Protocol header is the first data received on a TCP connection
70437 and is inserted before any TLS-on-connect handshake from the client; Exim
70438 negotiates TLS between Exim-as-server and the remote client, not between
70439 Exim and the proxy server.
70440 </para>
70441 <para>
70442 The following expansion variables are usable
70443 (<quote>internal</quote> and <quote>external</quote> here refer to the interfaces
70444 of the proxy):
70445 </para>
70446 <literallayout>
70447 <emphasis>proxy_external_address   </emphasis> IP of host being proxied or IP of remote interface of proxy
70448 <emphasis>proxy_external_port      </emphasis> Port of host being proxied or Port on remote interface of proxy
70449 <emphasis>proxy_local_address      </emphasis> IP of proxy server inbound or IP of local interface of proxy
70450 <emphasis>proxy_local_port         </emphasis> Port of proxy server inbound or Port on local interface of proxy
70451 <emphasis>proxy_session            </emphasis> boolean: SMTP connection via proxy
70452 </literallayout>
70453 <para>
70454 If <varname>$proxy_session</varname> is set but <varname>$proxy_external_address</varname> is empty
70455 there was a protocol error.
70456 </para>
70457 <para>
70458 Since the real connections are all coming from the proxy, and the
70459 per host connection tracking is done before Proxy Protocol is
70460 evaluated, <option>smtp_accept_max_per_host</option> must be set high enough to
70461 handle all of the parallel volume you expect per inbound proxy.
70462 With the option set so high, you lose the ability
70463 to protect your server from many connections from one IP.
70464 In order to prevent your server from overload, you
70465 need to add a per connection ratelimit to your connect ACL.
70466 A possible solution is:
70467 </para>
70468 <literallayout>
70469   # Set max number of connections per host
70470   LIMIT   = 5
70471   # Or do some kind of IP lookup in a flat file or database
70472   # LIMIT = ${lookup{$sender_host_address}iplsearch{/etc/exim/proxy_limits}}
70473
70474   defer   message        = Too many connections from this IP right now
70475           ratelimit      = LIMIT / 5s / per_conn / strict
70476 </literallayout>
70477 </section>
70478 <section id="SECTproxySOCKS">
70479 <title>Outbound proxies</title>
70480 <para>
70481 <indexterm role="concept">
70482 <primary>proxy</primary>
70483 <secondary>outbound</secondary>
70484 </indexterm>
70485 <indexterm role="concept">
70486 <primary>proxy</primary>
70487 <secondary>client side</secondary>
70488 </indexterm>
70489 <indexterm role="concept">
70490 <primary>proxy</primary>
70491 <secondary>SOCKS</secondary>
70492 </indexterm>
70493 <indexterm role="concept">
70494 <primary>SOCKS</primary>
70495 <secondary>proxy</secondary>
70496 </indexterm>
70497 Exim has support for sending outbound SMTP via a proxy
70498 using a protocol called SOCKS5 (defined by RFC1928).
70499 The support can be optionally included by defining SUPPORT_SOCKS=yes in
70500 Local/Makefile.
70501 </para>
70502 <para>
70503 Use of a proxy is enabled by setting the <option>socks_proxy</option> option
70504 on an smtp transport.
70505 The option value is expanded and should then be a list
70506 (colon-separated by default) of proxy specifiers.
70507 Each proxy specifier is a list
70508 (space-separated by default) where the initial element
70509 is an IP address and any subsequent elements are options.
70510 </para>
70511 <para>
70512 Options are a string &lt;name&gt;=&lt;value&gt;.
70513 The list of options is in the following table:
70514 </para>
70515 <literallayout>
70516 <emphasis>auth   </emphasis> authentication method
70517 <emphasis>name   </emphasis> authentication username
70518 <emphasis>pass   </emphasis> authentication password
70519 <emphasis>port   </emphasis> tcp port
70520 <emphasis>tmo    </emphasis> connection timeout
70521 <emphasis>pri    </emphasis> priority
70522 <emphasis>weight </emphasis> selection bias
70523 </literallayout>
70524 <para>
70525 More details on each of these options follows:
70526 </para>
70527 <itemizedlist>
70528 <listitem>
70529 <para>
70530 <indexterm role="concept">
70531 <primary>authentication</primary>
70532 <secondary>to proxy</secondary>
70533 </indexterm>
70534 <indexterm role="concept">
70535 <primary>proxy</primary>
70536 <secondary>authentication</secondary>
70537 </indexterm>
70538 <option>auth</option>: Either <quote>none</quote> (default) or <quote>name</quote>.
70539 Using <quote>name</quote> selects username/password authentication per RFC 1929
70540 for access to the proxy.
70541 Default is <quote>none</quote>.
70542 </para>
70543 </listitem>
70544 <listitem>
70545 <para>
70546 <option>name</option>: sets the username for the <quote>name</quote> authentication method.
70547 Default is empty.
70548 </para>
70549 </listitem>
70550 <listitem>
70551 <para>
70552 <option>pass</option>: sets the password for the <quote>name</quote> authentication method.
70553 Default is empty.
70554 </para>
70555 </listitem>
70556 <listitem>
70557 <para>
70558 <option>port</option>: the TCP port number to use for the connection to the proxy.
70559 Default is 1080.
70560 </para>
70561 </listitem>
70562 <listitem>
70563 <para>
70564 <option>tmo</option>: sets a connection timeout in seconds for this proxy.
70565 Default is 5.
70566 </para>
70567 </listitem>
70568 <listitem>
70569 <para>
70570 <option>pri</option>: specifies a priority for the proxy within the list,
70571 higher values being tried first.
70572 The default priority is 1.
70573 </para>
70574 </listitem>
70575 <listitem>
70576 <para>
70577 <option>weight</option>: specifies a selection bias.
70578 Within a priority set servers are queried in a random fashion,
70579 weighted by this value.
70580 The default value for selection bias is 1.
70581 </para>
70582 </listitem>
70583 </itemizedlist>
70584 <para>
70585 Proxies from the list are tried according to their priority
70586 and weight settings until one responds.  The timeout for the
70587 overall connection applies to the set of proxied attempts.
70588 </para>
70589 </section>
70590 <section id="SECTproxyLog">
70591 <title>Logging</title>
70592 <para>
70593 To log the (local) IP of a proxy in the incoming or delivery logline,
70594 add <quote>+proxy</quote> to the <option>log_selector</option> option.
70595 This will add a component tagged with <quote>PRX=</quote> to the line.
70596 </para>
70597 </section>
70598 </chapter>
70599
70600 <chapter id="CHAPi18n">
70601 <title>Internationalisation</title>
70602 <titleabbrev>Internationalisation"</titleabbrev>
70603 <para>
70604 <indexterm role="concept">
70605 <primary>internationalisation</primary>
70606 <secondary>email address</secondary>
70607 </indexterm>
70608 <indexterm role="concept">
70609 <primary>EAI</primary>
70610 </indexterm>
70611 <indexterm role="concept">
70612 <primary>i18n</primary>
70613 </indexterm>
70614 <indexterm role="concept">
70615 <primary>UTF-8</primary>
70616 <secondary>mail name handling</secondary>
70617 </indexterm>
70618 </para>
70619 <para>
70620 Exim has support for Internationalised mail names.
70621 To include this it must be built with SUPPORT_I18N and the libidn library.
70622 Standards supported are RFCs 2060, 5890, 6530 and 6533.
70623 </para>
70624 <para>
70625 If Exim is built with SUPPORT_I18N_2008 (in addition to SUPPORT_I18N, not
70626 instead of it) then IDNA2008 is supported; this adds an extra library
70627 requirement, upon libidn2.
70628 </para>
70629 <section id="SECTi18nMTA">
70630 <title>MTA operations</title>
70631 <para>
70632 <indexterm role="concept">
70633 <primary>SMTPUTF8</primary>
70634 <secondary>ESMTP option</secondary>
70635 </indexterm>
70636 The main configuration option <option>smtputf8_advertise_hosts</option> specifies
70637 a host list.  If this matches the sending host and
70638 accept_8bitmime is true (the default) then the ESMTP option
70639 SMTPUTF8 will be advertised.
70640 </para>
70641 <para>
70642 If the sender specifies the SMTPUTF8 option on a MAIL command
70643 international handling for the message is enabled and
70644 the expansion variable <varname>$message_smtputf8</varname> will have value TRUE.
70645 </para>
70646 <para>
70647 The option <option>allow_utf8_domains</option> is set to true for this
70648 message. All DNS lookups are converted to a-label form
70649 whatever the setting of <option>allow_utf8_domains</option>
70650 when Exim is built with SUPPORT_I18N.
70651 </para>
70652 <para>
70653 Both localparts and domain are maintained as the original
70654 UTF-8 form internally; any comparison or regular-expression use will
70655 require appropriate care.  Filenames created, eg. by
70656 the appendfile transport, will have UTF-8 names.
70657 </para>
70658 <para>
70659 HELO names sent by the smtp transport will have any UTF-8
70660 components expanded to a-label form,
70661 and any certificate name checks will be done using the a-label
70662 form of the name.
70663 </para>
70664 <para>
70665 <indexterm role="concept">
70666 <primary>log</primary>
70667 <secondary>protocol</secondary>
70668 </indexterm>
70669 <indexterm role="concept">
70670 <primary>SMTPUTF8</primary>
70671 <secondary>logging</secondary>
70672 </indexterm>
70673 Log lines and Received-by: header lines will acquire a "utf8"
70674 prefix on the protocol element, eg. utf8esmtp.
70675 </para>
70676 <para>
70677 The following expansion operators can be used:
70678 </para>
70679 <literallayout class="monospaced">
70680 ${utf8_domain_to_alabel:str}
70681 ${utf8_domain_from_alabel:str}
70682 ${utf8_localpart_to_alabel:str}
70683 ${utf8_localpart_from_alabel:str}
70684 </literallayout>
70685 <para>
70686 ACLs may use the following modifier:
70687 </para>
70688 <literallayout>
70689 control = utf8_downconvert
70690 control = utf8_downconvert/&lt;value&gt;
70691 </literallayout>
70692 <para>
70693 This sets a flag requiring that addresses are converted to
70694 a-label form before smtp delivery, for use in a
70695 Message Submission Agent context.
70696 If a value is appended it may be:
70697 </para>
70698 <literallayout>
70699 <literal>1  </literal> (default) mandatory downconversion
70700 <literal>0  </literal> no downconversion
70701 <literal>-1 </literal> if SMTPUTF8 not supported by destination host
70702 </literallayout>
70703 <para>
70704 If mua_wrapper is set, the utf8_downconvert control
70705 is initially set to -1.
70706 </para>
70707 <para>
70708 There is no explicit support for VRFY and EXPN.
70709 Configurations supporting these should inspect
70710 <varname>$smtp_command_argument</varname> for an SMTPUTF8 argument.
70711 </para>
70712 <para>
70713 There is no support for LMTP on Unix sockets.
70714 Using the "lmtp" protocol option on an smtp transport,
70715 for LMTP over TCP, should work as expected.
70716 </para>
70717 <para>
70718 There is no support for DSN unitext handling,
70719 and no provision for converting logging from or to UTF-8.
70720 </para>
70721 </section>
70722 <section id="SECTi18nMDA">
70723 <title>MDA operations</title>
70724 <para>
70725 To aid in constructing names suitable for IMAP folders
70726 the following expansion operator can be used:
70727 </para>
70728 <literallayout class="monospaced">
70729 ${imapfolder {&lt;string&gt;} {&lt;sep&gt;} {&lt;specials&gt;}}
70730 </literallayout>
70731 <para>
70732 The string is converted from the charset specified by
70733 the "headers charset" command (in a filter file)
70734 or <option>headers_charset</option> main configuration option (otherwise),
70735 to the
70736 modified UTF-7 encoding specified by RFC 2060,
70737 with the following exception: All occurences of &lt;sep&gt;
70738 (which has to be a single character)
70739 are replaced with periods ("."), and all periods and slashes that are not
70740 &lt;sep&gt; and are not in the &lt;specials&gt; string are BASE64 encoded.
70741 </para>
70742 <para>
70743 The third argument can be omitted, defaulting to an empty string.
70744 The second argument can be omitted, defaulting to "/".
70745 </para>
70746 <para>
70747 This is the encoding used by Courier for Maildir names on disk, and followed
70748 by many other IMAP servers.
70749 </para>
70750 <para>
70751 Examples:
70752 </para>
70753 <literallayout>
70754 <literal>${imapfolder {Foo/Bar}}       </literal> yields <literal>Foo.Bar</literal>
70755 <literal>${imapfolder {Foo/Bar}{.}{/}} </literal> yields <literal>Foo&amp;AC8-Bar</literal>
70756 <literal>${imapfolder {Räksmörgås}}    </literal> yields <literal>R&amp;AOQ-ksm&amp;APY-rg&amp;AOU-s</literal>
70757 </literallayout>
70758 <para>
70759 Note that the source charset setting is vital, and also that characters
70760 must be representable in UTF-16.
70761 </para>
70762 </section>
70763 </chapter>
70764
70765 <chapter id="CHAPevents">
70766 <title>Events</title>
70767 <titleabbrev>Events</titleabbrev>
70768 <para>
70769 <indexterm role="concept">
70770 <primary>events</primary>
70771 </indexterm>
70772 </para>
70773 <para>
70774 The events mechanism in Exim can be used to intercept processing at a number
70775 of points.  It was originally invented to give a way to do customised logging
70776 actions (for example, to a database) but can also be used to modify some
70777 processing actions.
70778 </para>
70779 <para>
70780 Most installations will never need to use Events.
70781 The support can be left out of a build by defining DISABLE_EVENT=yes
70782 in <filename>Local/Makefile</filename>.
70783 </para>
70784 <para>
70785 There are two major classes of events: main and transport.
70786 The main configuration option <option>event_action</option> controls reception events;
70787 a transport option <option>event_action</option> controls delivery events.
70788 </para>
70789 <para>
70790 Both options are a string which is expanded when the event fires.
70791 An example might look like:
70792 <indexterm role="concept">
70793 <primary>logging</primary>
70794 <secondary>custom</secondary>
70795 </indexterm>
70796 </para>
70797 <literallayout class="monospaced">
70798 event_action = ${if eq {msg:delivery}{$event_name} \
70799 {${lookup pgsql {SELECT * FROM record_Delivery( \
70800     '${quote_pgsql:$sender_address_domain}',\
70801     '${quote_pgsql:${lc:$sender_address_local_part}}', \
70802     '${quote_pgsql:$domain}', \
70803     '${quote_pgsql:${lc:$local_part}}', \
70804     '${quote_pgsql:$host_address}', \
70805     '${quote_pgsql:${lc:$host}}', \
70806     '${quote_pgsql:$message_exim_id}')}} \
70807 } {}}
70808 </literallayout>
70809 <para>
70810 Events have names which correspond to the point in process at which they fire.
70811 The name is placed in the variable <varname>$event_name</varname> and the event action
70812 expansion must check this, as it will be called for every possible event type.
70813 </para>
70814 <para>
70815 The current list of events is:
70816 </para>
70817 <literallayout>
70818 <literal>msg:complete           after    main       </literal> per message
70819 <literal>msg:delivery           after    transport  </literal> per recipient
70820 <literal>msg:rcpt:host:defer    after    transport  </literal> per recipient per host
70821 <literal>msg:rcpt:defer         after    transport  </literal> per recipient
70822 <literal>msg:host:defer         after    transport  </literal> per attempt
70823 <literal>msg:fail:delivery      after    transport  </literal> per recipient
70824 <literal>msg:fail:internal      after    main       </literal> per recipient
70825 <literal>tcp:connect            before   transport  </literal> per connection
70826 <literal>tcp:close              after    transport  </literal> per connection
70827 <literal>tls:cert               before   both       </literal> per certificate in verification chain
70828 <literal>smtp:connect           after    transport  </literal> per connection
70829 </literallayout>
70830 <para>
70831 New event types may be added in future.
70832 </para>
70833 <para>
70834 The event name is a colon-separated list, defining the type of
70835 event in a tree of possibilities.  It may be used as a list
70836 or just matched on as a whole.  There will be no spaces in the name.
70837 </para>
70838 <para>
70839 The second column in the table above describes whether the event fires
70840 before or after the action is associates with.  Those which fire before
70841 can be used to affect that action (more on this below).
70842 </para>
70843 <para revisionflag="changed">
70844 The third column in the table above says what section of the configumration
70845 should define the event action.
70846 </para>
70847 <para>
70848 An additional variable, <varname>$event_data</varname>, is filled with information varying
70849 with the event type:
70850 </para>
70851 <literallayout>
70852 <literal>msg:delivery         </literal> smtp confirmation message
70853 <literal>msg:rcpt:host:defer  </literal> error string
70854 <literal>msg:rcpt:defer       </literal> error string
70855 <literal>msg:host:defer       </literal> error string
70856 <literal>tls:cert             </literal> verification chain depth
70857 <literal>smtp:connect         </literal> smtp banner
70858 </literallayout>
70859 <para>
70860 The :defer events populate one extra variable: <varname>$event_defer_errno</varname>.
70861 </para>
70862 <para>
70863 For complex operations an ACL expansion can be used in <option>event_action</option>
70864 however due to the multiple contexts that Exim operates in during
70865 the course of its processing:
70866 </para>
70867 <itemizedlist>
70868 <listitem>
70869 <para>
70870 variables set in transport events will not be visible outside that
70871 transport call
70872 </para>
70873 </listitem>
70874 <listitem>
70875 <para>
70876 acl_m variables in a server context are lost on a new connection,
70877 and after smtp helo/ehlo/mail/starttls/rset commands
70878 </para>
70879 </listitem>
70880 </itemizedlist>
70881 <para>
70882 Using an ACL expansion with the logwrite modifier can be
70883 a useful way of writing to the main log.
70884 </para>
70885 <para>
70886 The expansion of the event_action option should normally
70887 return an empty string.  Should it return anything else the
70888 following will be forced:
70889 </para>
70890 <literallayout>
70891 <literal>msg:delivery     </literal>  (ignored)
70892 <literal>msg:host:defer   </literal>  (ignored)
70893 <literal>msg:fail:delivery</literal>  (ignored)
70894 <literal>tcp:connect      </literal>  do not connect
70895 <literal>tcp:close        </literal>  (ignored)
70896 <literal>tls:cert         </literal>  refuse verification
70897 <literal>smtp:connect     </literal>  close connection
70898 </literallayout>
70899 <para>
70900 No other use is made of the result string.
70901 </para>
70902 <para>
70903 For a tcp:connect event, if the connection is being made to a proxy
70904 then the address and port variables will be that of the proxy and not
70905 the target system.
70906 </para>
70907 <para>
70908 For tls:cert events, if GnuTLS is in use this will trigger only per
70909 chain element received on the connection.
70910 For OpenSSL it will trigger for every chain element including those
70911 loaded locally.
70912 </para>
70913 </chapter>
70914
70915 <chapter id="CHID13">
70916 <title>Adding new drivers or lookup types</title>
70917 <titleabbrev>Adding drivers or lookups</titleabbrev>
70918 <para>
70919 <indexterm role="concept">
70920 <primary>adding drivers</primary>
70921 </indexterm>
70922 <indexterm role="concept">
70923 <primary>new drivers, adding</primary>
70924 </indexterm>
70925 <indexterm role="concept">
70926 <primary>drivers</primary>
70927 <secondary>adding new</secondary>
70928 </indexterm>
70929 The following actions have to be taken in order to add a new router, transport,
70930 authenticator, or lookup type to Exim:
70931 </para>
70932 <orderedlist numeration="arabic">
70933 <listitem>
70934 <para>
70935 Choose a name for the driver or lookup type that does not conflict with any
70936 existing name; I will use <quote>newdriver</quote> in what follows.
70937 </para>
70938 </listitem>
70939 <listitem>
70940 <para>
70941 Add to <filename>src/EDITME</filename> the line:
70942 </para>
70943 <literallayout>
70944 &lt;<emphasis>type</emphasis>&gt;<literal>_NEWDRIVER=yes</literal>
70945 </literallayout>
70946 <para>
70947 where &lt;<emphasis>type</emphasis>&gt; is ROUTER, TRANSPORT, AUTH, or LOOKUP. If the
70948 code is not to be included in the binary by default, comment this line out. You
70949 should also add any relevant comments about the driver or lookup type.
70950 </para>
70951 </listitem>
70952 <listitem>
70953 <para>
70954 Add to <filename>src/config.h.defaults</filename> the line:
70955 </para>
70956 <literallayout class="monospaced">
70957 #define &lt;type&gt;_NEWDRIVER
70958 </literallayout>
70959 </listitem>
70960 <listitem>
70961 <para>
70962 Edit <filename>src/drtables.c</filename>, adding conditional code to pull in the private header
70963 and create a table entry as is done for all the other drivers and lookup types.
70964 </para>
70965 </listitem>
70966 <listitem>
70967 <para>
70968 Edit <filename>scripts/lookups-Makefile</filename> if this is a new lookup; there is a for-loop
70969 near the bottom, ranging the <literal>name_mod</literal> variable over a list of all lookups.
70970 Add your <literal>NEWDRIVER</literal> to that list.
70971 As long as the dynamic module would be named <filename>newdriver.so</filename>, you can use the
70972 simple form that most lookups have.
70973 </para>
70974 </listitem>
70975 <listitem>
70976 <para>
70977 Edit <filename>Makefile</filename> in the appropriate sub-directory (<filename>src/routers</filename>,
70978 <filename>src/transports</filename>, <filename>src/auths</filename>, or <filename>src/lookups</filename>); add a line for the new
70979 driver or lookup type and add it to the definition of OBJ.
70980 </para>
70981 </listitem>
70982 <listitem>
70983 <para>
70984 Create <filename>newdriver.h</filename> and <filename>newdriver.c</filename> in the appropriate sub-directory of
70985 <filename>src</filename>.
70986 </para>
70987 </listitem>
70988 <listitem>
70989 <para>
70990 Edit <filename>scripts/MakeLinks</filename> and add commands to link the <filename>.h</filename> and <filename>.c</filename> files
70991 as for other drivers and lookups.
70992 </para>
70993 </listitem>
70994 </orderedlist>
70995 <para>
70996 Then all you need to do is write the code! A good way to start is to make a
70997 proforma by copying an existing module of the same type, globally changing all
70998 occurrences of the name, and cutting out most of the code. Note that any
70999 options you create must be listed in alphabetical order, because the tables are
71000 searched using a binary chop procedure.
71001 </para>
71002 <para>
71003 There is a <filename>README</filename> file in each of the sub-directories of <filename>src</filename> describing
71004 the interface that is expected.
71005 </para>
71006 <?sdop
71007   format="newpage"
71008   foot_right_recto="&chaptertitle;"
71009   foot_right_verso="&chaptertitle;"
71010 ?>
71011 </chapter>
71012
71013 <index role="option">
71014 <title>Options index</title>
71015 </index>
71016
71017 <index role="variable">
71018 <title>Variables index</title>
71019 </index>
71020
71021 <index role="concept">
71022 <title>Concept index</title>
71023 </index>
71024
71025 </book>